<?php

$sSleep = '<section class="add-edit-subgroup sleep" data-groupname="sleep">';

	$sSleep .= '<div class="article-form">';
	
		$sSleep .= '<div class="sleep-container" id="sleepingplaces-container">			
			<div class="sleep" id="sale-sleepingplaces-container">
				<label for="set-sleepingplaces">Slaapplaatsen</label>
				<input autocomplete="false" class="text-input auto-save" type="tel" name="set-sleepingplaces" inputmode="numeric" maxlength="2" id="set-sleepingplaces" value="'.($oMijnOVIS->parsedDetails->sleepingplaces).'">			
			</div>
		</div>';	

		$sSleep .= '<div class="select-radio-container sleep-container'.(!empty($oMijnOVIS->parsedDetails->bedrooms) ? ' active' : false).'" id="bedrooms-container" data-field="bedrooms">			
			<div class="sleep" id="sale-bedrooms-container">
				<label class="label-sub">Aantal slaapkamers</label>
				<span class="open-sub'.(!empty($oMijnOVIS->parsedDetails->bedrooms) ? ' active' : false).'" id="open-sub-bedrooms" data-group="sleep" data-field="bedrooms" data-title="slaapkamers" data-default="Kies slaapkamers">'.(!empty($oMijnOVIS->parsedDetails->bedrooms) ? $oMijnOVIS->parsedDetails->bedrooms . ($oMijnOVIS->parsedDetails->bedrooms == '1' ? ' slaapkamer' : ' slaapkamers') : 'Kies slaapkamers').'</span>';

				$sSleep .= '<div class="sub-container" id="sub-bedrooms">';
					
					for($i=1; $i<=10; $i++){
						$sSleep .= '<label for="set-bedrooms-'.strtolower($i).'">'.$i.'</label>';
						$sSleep .= '<input class="select-radio bedrooms-radio" type="checkbox" name="set-bedrooms" id="set-bedrooms-'.strtolower($i).'" value="'.strtolower($i).'"'.(strtolower($oMijnOVIS->parsedDetails->bedrooms) == strtolower($i) ? ' checked="checked"' : false).'>';						
					}
					
				$sSleep .= '</div>';					
						
			$sSleep .= '</div>
		</div>';	

		$sSleep .= '<div class="select-radio-container sleep-container'.(!empty($oMijnOVIS->parsedDetails->bedsBoat) ? ' active' : false).'" id="beds-boat-container" data-field="beds-boat">			
			<div class="sleep" id="sale-beds-boat-container">
				<label class="label-sub">Aantal bedden</label>
				<span class="open-sub'.(!empty($oMijnOVIS->parsedDetails->bedsBoat) ? ' active' : false).'" id="open-sub-beds-boat" data-group="sleep" data-field="beds-boat" data-title="bedden" data-default="Kies bedden">'.(!empty($oMijnOVIS->parsedDetails->bedsBoat) ? $oMijnOVIS->parsedDetails->bedsBoat . ($oMijnOVIS->parsedDetails->bedsBoat == '1' ? ' bed' : ' bedden') : 'Kies bedden').'</span>';

				$sSleep .= '<div class="sub-container" id="sub-beds-boat">';
					
					for($i=1; $i<=10; $i++){
						$sSleep .= '<label for="set-beds-boat-'.strtolower($i).'">'.$i.'</label>';
						$sSleep .= '<input class="select-radio beds-boat-radio" type="checkbox" name="set-beds-boat" id="set-beds-boat-'.strtolower($i).'" value="'.strtolower($i).'"'.(strtolower($oMijnOVIS->parsedDetails->bedsBoat) == strtolower($i) ? ' checked="checked"' : false).'>';						
					}
					
				$sSleep .= '</div>';					
						
			$sSleep .= '</div>
		</div>';
			
		$sSleep .= '<div class="sleep-container no-border" id="beds-add-container">
			<div class="add-bed" id="add-bed">+ Voeg een bed toe</div>
			<div class="too-many-beds" id="too-many-beds">U kunt maximaal 10 bedden toevoegen</div>
		</div>';
		
		$sSleep .= '<div class="beds-container" id="beds-container">';	

			if($oMijnOVIS->parsedDetails->beds > 0){
				
				for($i=1; $i<=$oMijnOVIS->parsedDetails->beds; $i++){
					
					$iWidth = false;
					$iLength = false;
					$iType = false;
					
					if(!empty($oMijnOVIS->parsedDetails->bedspecifications)){
						
						$aBedSpecs = $oMijnOVIS->parsedDetails->bedspecifications;
						
						if(!empty($aBedSpecs[($i-1)])){
							$iWidth = !empty($aBedSpecs[($i-1)]->width) ? $aBedSpecs[($i-1)]->width : false;
							$iLength = !empty($aBedSpecs[($i-1)]->length) ? $aBedSpecs[($i-1)]->length : false;
							$iType = !empty($aBedSpecs[($i-1)]->type) ? strtolower($aBedSpecs[($i-1)]->type) : false;
						}
					}
					
					$sSleep .= '<div class="sleep-container sleep-container-bed sleep-container-'.$i.'" data-bedid="'.$i.'" id="sleep-container">		
					<div class="sleep bed-container" id="sale-beds-container">
						<label class="bed-title">Bed specificaties<span class="remove-bed" data-bedid="'.$i.'">Verwijder</span></label>
						<div class="bed-line">
						<label for="set-bed-length-'.$i.'">Lengte (cm)</label>
						<input autocomplete="false" class="text-input bed-length auto-save" type="tel" name="set-bed-length-'.$i.'" inputmode="numeric" maxlength="3" id="set-bed-length-'.$i.'" value="'.($iLength).'">	
						</div>
						<div class="bed-line">
						<label for="set-bed-width-'.$i.'">Breedte (cm)</label>
						<input autocomplete="false" class="text-input bed-width auto-save" type="tel" name="set-bed-width-'.$i.'" inputmode="numeric" maxlength="3" id="set-bed-width-'.$i.'" value="'.($iWidth).'">
						</div>						
						<div class="bed-select-container" id="sale-beds-select-container-'.$i.'">
							<select class="set-bed-type bed-type" name="set-bed-type-'.$i.'" id="set-bed-type-'.$i.'">
								<option value="">Kies een bedtype</option>		
								<option value="1-persoonsbed"'.($iType == '1-persoonsbed' ? ' selected="selected"' : false).'>Eenpersoonsbed</option>		
								<option value="2-persoonsbed"'.($iType == '2-persoonsbed' ? ' selected="selected"' : false).'>Tweepersoonsbed</option>	
								<option value="losse bedden"'.($iType == 'losse bedden' ? ' selected="selected"' : false).'>Losse bedden</option>		
								<option value="stapelbed"'.($iType == 'stapelbed' ? ' selected="selected"' : false).'>Stapelbed</option>	
								<option value="frans bed"'.($iType == 'frans bed' ? ' selected="selected"' : false).'>Frans bed</option>
							</select>		
						</div>
					</div>
				</div>';					
				}				
			}			
		
		$sSleep .= '</div>';
	$sSleep .= '</div>';

$sSleep .= '</section>';

return $sSleep;