<?php $FILTER = isset($_SESSION[$controller->defaultFilter]) ? $_SESSION[$controller->defaultFilter] : array();?>
<div class="row">
	<div class="col-xs-12 text-center pjAsFilterGenderWrap">
		<?php 
		$service_gender = __('service_gender', true);
		$gender_arr = array('male','female','child');
		foreach ($gender_arr as $v) { ?>
			<a href="javascript:void(0);" class="btn btn-default pjAsBtn pjAsSwitchGender <?php echo isset($FILTER['gender']) && $FILTER['gender'] == $v ? 'pjAsBtnPrimary' : 'pjAsBtnSecondary';?>" data-gender="<?php echo $v;?>"><?php echo pjSanitize::html($service_gender[$v]);?></a>
		<?php } ?>
	</div>
</div>

<?php if (isset($FILTER['gender']) && in_array($FILTER['gender'], array('male','female','child'))) { ?>
	<div class="row">
		<div class="col-xs-12 text-center pjAsFilterCategoryWrap">
			<?php 
			foreach ($tpl['category_arr'] as $v) { 
				if (!empty($v['image'])) {
					$c_image = PJ_INSTALL_URL . $v['image'];	
				} else {
					$c_image = 'https://via.placeholder.com/100x170.png';
				}
				?>
				<a href="javascript:void(0);" class="pjAsFilterCategory <?php echo isset($FILTER['category']) && $FILTER['category'] == $v['id'] ? 'active' : '';?>" data-category="<?php echo $v['id'];?>"><img src="<?php echo $c_image;?>" /><span class="pjAsCategoryName"><?php echo pjSanitize::html($v['name']);?></span></a>
			<?php } ?>
		</div>
	</div>
<?php } ?>

<?php if (isset($tpl['filter_service_arr']) && count($tpl['filter_service_arr']) > 0) { ?>
	<div class="row pjAsFilterServicesWrap">
		<?php foreach ($tpl['filter_service_arr'] as $service) { ?>
			<div class="col-md-3 col-sm-4 col-xs-12 custom-checkbox">
				<div class="checkbox">
					<label>
						<input type="checkbox" name="service_id[]" id="service_id_<?php echo $service['id'];?>" class="pjAsFilterService" <?php echo isset($FILTER['services']) && in_array($service['id'], $FILTER['services']) ? 'checked="checked"' : '';?> value="<?php echo $service['id'];?>">
						<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
						<?php echo pjSanitize::html($service['name']);?>
					</label>
				</div>
			</div>
		<?php } ?>
	</div>
<?php } ?>
<?php if (isset($tpl['filter_subservice_arr']) && count($tpl['filter_subservice_arr']) > 0) { ?>
	<div class="row pjAsFilterSubServicesWrap">
		<?php foreach ($tpl['filter_subservice_arr'] as $subservice) { ?>
			<div class="col-md-3 col-sm-4 col-xs-12 custom-checkbox">
				<div class="checkbox">
					<label>
						<input type="checkbox" name="subservice_id[]" id="subservice_id_<?php echo $subservice['id'];?>" class="pjAsFilterSubService" <?php echo isset($FILTER['subservices']) && in_array($subservice['id'], $FILTER['subservices']) ? 'checked="checked"' : '';?> value="<?php echo $subservice['id'];?>">
						<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
						<?php echo pjSanitize::html($subservice['name']);?>
					</label>
				</div>
			</div>
		<?php } ?>
	</div>
<?php } ?>
<?php if (isset($tpl['filter_employee_arr']) && count($tpl['filter_employee_arr']) > 0) { ?>
	<div class="row pjAsFilterEmployeesWrap">
		<div class="col-md-3 col-sm-4 col-xs-12">
			<!--<div class="pjAsFilterEmployeeItem pjAsFilterAnyEmployee <?php echo $controller->_get->toString('employee') == 'any' ? 'active' : '';?>"><?php __('front_btn_any_employee');?>
				<a href="javascript:void(0);" class="btn btn-default pjAsBtn pjAsBtnPrimary pjAsFilterEmployee" data-id="any">
					<img src="/images/buchungssystem/placeholder_beliebig.jpg" class="img-responsive" alt="<?php __('front_btn_any_employee');?>" title="<?php __('front_btn_any_employee');?>"/>
				</a>
			</div>-->
			<div class="pjAsFilterEmployeeItem <?php echo $controller->_get->toString('employee') == 'any' ? 'active' : '';?>"><?php __('front_btn_any_employee');?>
				<a href="javascript:void(0);" class="pjAsFilterEmployee" data-id="any">
					<img src="/images/buchungssystem/placeholder_beliebig.jpg" class="img-responsive" alt="<?php __('front_btn_any_employee');?>" title="<?php __('front_btn_any_employee');?>"/>
				</a>
			</div>
		</div>
		<?php foreach ($tpl['filter_employee_arr'] as $employee) { 
			if (!empty($employee['avatar']) && is_file($employee['avatar']))
			{
				$src = PJ_INSTALL_URL . $employee['avatar'];
			} else {
				$src = PJ_INSTALL_URL . PJ_IMG_PATH . 'frontend/professional.gif';
			}
			?>
			<div class="col-md-3 col-sm-4 col-xs-12">
				<div class="pjAsFilterEmployeeItem <?php echo $controller->_get->toString('employee') == $employee['id'] ? 'active' : '';?>"><?php echo pjSanitize::html($employee['name']); ?>
					<a href="javascript:void(0);" class="pjAsFilterEmployee" data-id="<?php echo $employee['id'];?>">
						<img src="<?php echo $src;?>" class="img-responsive" alt="<?php echo pjSanitize::html($employee['name']); ?>" title="<?php echo pjSanitize::html($employee['name']); ?>"/>
					</a>
				</div>
			</div>
		<?php } ?>
	</div>
<?php } ?>