<div class="offcanvas offcanvas-end offcanvas-lead" data-bs-scroll="true" data-bs-backdrop="true" tabindex="-1" id="offcanvasInquiry" aria-labelledby="offcanvasInquiryLabel">
<?php get_template_part('template-parts/dashboard/loader'); ?>	
	<div class="offcanvas-head">
		<h5><?php esc_html_e('Add New Inquiry', 'houzez'); ?></h5>  
		<a href="#" class="close-btn" data-bs-dismiss="offcanvas"><i class="houzez-icon icon-close"></i></a> 
  	</div>
	<div class="offcanvas-body">
		<form id="enquiry-form">
		<div class="offcanvas-box">
			<div class="mb-3">
				<label><?php esc_html_e('Contact*', 'houzez'); ?></label>
				<select name="lead_id" id="lead_id" class="selectpicker form-control bs-select-hidden" data-live-search="true">
					<option value=""><?php esc_html_e('Select', 'houzez'); ?></option>
					<?php
					$contacts = Houzez_Leads::get_all_leads();
					foreach ($contacts as $contact) {

						if( $contact->lead_id != '' ) {
							$display_name = $contact->display_name;
							if( $display_name == '' ) {
								$display_name = $contact->first_name . ' ' . $contact->last_name;
							}
							echo '<option value="'.esc_attr($contact->lead_id).'">'.esc_attr($display_name).'</option>';
						}
					}
					?>
				</select>
			</div>
		</div>
		<div class="offcanvas-box">
			<h4><?php esc_html_e('Information', 'houzez'); ?></h4>
			<div class="mb-3">
				<label><?php esc_html_e('Inquiry Type*', 'houzez'); ?></label>
				<select id="enquiry_type" name="enquiry_type" class="selectpicker form-control bs-select-hidden" title="<?php esc_html_e('Select', 'houzez'); ?>" data-live-search="false">
					<option value=""><?php esc_html_e('Select', 'houzez'); ?></option>
					<?php
					$enquiry_type = hcrm_get_option('enquiry_type', 'hcrm_enquiry_settings', esc_html__('Purchase, Rent, Sell, Miss, Evaluation, Mortgage', 'houzez'));
					if(!empty($enquiry_type)) {

						$enquiry_type = explode(',', $enquiry_type);
						foreach( $enquiry_type as $en_type ) {
							echo '<option value="'.trim($en_type).'">'.esc_attr($en_type).'</value>';
						}
					}
					?>
				</select><!-- selectpicker -->
			</div><!-- form-group -->
			
			<div class="mb-3">
				<label><?php esc_html_e('Property Type*', 'houzez'); ?></label>
				<select id="property_type" name="e_meta[property_type]" class="selectpicker form-control bs-select-hidden" title="<?php esc_html_e('Select', 'houzez'); ?>" data-live-search="true">
					<?php
					// All Option
					echo '<option value="">'.esc_html__('Select', 'houzez').'</option>';

					$prop_type = get_terms (
						array(
							"property_type"
						),
						array(
							'orderby' => 'name',
							'order' => 'ASC',
							'hide_empty' => false,
							'parent' => 0
						)
					);
					hcrm_get_taxonomy('property_type', $prop_type);
					?>
				</select><!-- selectpicker -->
			</div>

			<div class="mb-3">
				<label><?php esc_html_e('Property Status', 'houzez'); ?></label>
				<select id="property_status" name="e_meta[property_status]" class="selectpicker form-control bs-select-hidden" title="<?php esc_html_e('Select', 'houzez'); ?>" data-live-search="true">
					<?php
					// All Option
					echo '<option value="">'.esc_html__('Select', 'houzez').'</option>';

					$prop_status = get_terms (
						array(
							"property_status"
						),
						array(
							'orderby' => 'name',
							'order' => 'ASC',
							'hide_empty' => false,
							'parent' => 0
						)
					);
					hcrm_get_taxonomy('property_status', $prop_status);
					?>
				</select><!-- selectpicker -->
			</div>

			<div class="mb-3">
				<label><?php esc_html_e('Property Label', 'houzez'); ?></label>
				<select id="property_label" name="e_meta[property_label]" class="selectpicker form-control bs-select-hidden" title="<?php esc_html_e('Select', 'houzez'); ?>" data-live-search="true">
					<?php
					// All Option
					echo '<option value="">'.esc_html__('Select', 'houzez').'</option>';

					$prop_label = get_terms (
						array(
							"property_label"
						),
						array(
							'orderby' => 'name',
							'order' => 'ASC',
							'hide_empty' => false,
							'parent' => 0
						)
					);
					hcrm_get_taxonomy('property_label', $prop_label);
					?>
				</select><!-- selectpicker -->
			</div>

			<div class="mb-3">
				<label><?php esc_html_e('Price', 'houzez'); ?></label>
				<input class="form-control" name="e_meta[min-price]" id="min-price" placeholder="<?php esc_html_e('From', 'houzez'); ?>" type="text">
			</div>
			
			<div class="mb-3">
				<label>&nbsp;</label>
				<input class="form-control" name="e_meta[max-price]" id="max-price" placeholder="<?php esc_html_e('To', 'houzez'); ?>" type="text">
			</div>
			
			<div class="mb-3">
				<label><?php esc_html_e('Bedrooms', 'houzez'); ?></label>
				<input class="form-control" name="e_meta[min-beds]" id="min-beds" placeholder="<?php esc_html_e('Min', 'houzez'); ?>" type="text">
			</div>
			
			<div class="mb-3">
				<label>&nbsp;</label>
				<input class="form-control" name="e_meta[max-beds]" id="max-beds" placeholder="<?php esc_html_e('Max', 'houzez'); ?>" type="text">
			</div>
			
			<div class="mb-3">
				<label><?php esc_html_e('Bathrooms', 'houzez'); ?></label>
				<input class="form-control" name="e_meta[min-baths]" id="min-baths" placeholder="<?php esc_html_e('Min', 'houzez'); ?>" type="text">
			</div>
			
			<div class="mb-3">
				<label>&nbsp;</label>
				<input class="form-control" name="e_meta[max-baths]" id="max-baths" placeholder="<?php esc_html_e('Max', 'houzez'); ?>" type="text">
			</div>
			
			<div class="mb-3">
				<label><?php esc_html_e('Area Size', 'houzez'); ?></label>
				<input class="form-control" name="e_meta[min-area]" id="min-area" placeholder="<?php esc_html_e('Min', 'houzez'); ?>" type="text">
			</div>
			
			<div class="mb-3">
				<label>&nbsp;</label>
				<input class="form-control" name="e_meta[max-area]" id="max-area" placeholder="<?php esc_html_e('Max', 'houzez'); ?>" type="text">
			</div>
		</div>
		<div class="offcanvas-box">
			<h4><?php esc_html_e('Address', 'houzez'); ?></h4>

			<?php if( taxonomy_exists('property_country') ) { ?>
			<div class="mb-3">
				<label><?php esc_html_e('Country', 'houzez'); ?></label>
				<select name="e_meta[country]" id="country" class="houzezSelectFilter houzezCountryFilter houzezFirstList houzez-country-js selectpicker form-control bs-select-hidden" title="<?php esc_html_e('Country', 'houzez'); ?>" data-live-search="true" data-target="houzezSecondList" data-size="5">
					<?php
					// All Option
					echo '<option value="">'.esc_html__('Select', 'houzez').'</option>';

					$prop_country = get_terms (
						array(
							"property_country"
						),
						array(
							'orderby' => 'name',
							'order' => 'ASC',
							'hide_empty' => false,
							'parent' => 0
						)
					);
					hcrm_get_taxonomy('property_country', $prop_country);
					?>
				</select><!-- selectpicker -->
			</div>
			<?php } ?>
			
			<?php if( taxonomy_exists('property_state') ) { ?>
			<div class="mb-3">
				<label><?php esc_html_e('State', 'houzez'); ?></label>
				
				<select name="e_meta[state]" id="state" class="houzezSelectFilter houzezStateFilter houzezSecondList houzez-state-js selectpicker form-control bs-select-hidden" title="<?php esc_html_e('State', 'houzez'); ?>" data-live-search="true" data-target="houzezThirdList" data-size="5">
					<?php
					// All Option
					echo '<option value="">'.esc_html__('Select', 'houzez').'</option>';

					$prop_state = get_terms (
						array(
							"property_state"
						),
						array(
							'orderby' => 'name',
							'order' => 'ASC',
							'hide_empty' => false,
							'parent' => 0
						)
					);
					hcrm_get_taxonomy('property_state', $prop_state);
					?>
				</select>
			</div>
			<?php } ?>


			<?php if( taxonomy_exists('property_city') ) { ?>
			<div class="mb-3">
				<label><?php esc_html_e('City', 'houzez'); ?></label>
				<select name="e_meta[city]" id="city" class="houzezSelectFilter houzezCityFilter houzezThirdList houzez-city-js selectpicker form-control bs-select-hidden" title="<?php esc_html_e('City', 'houzez'); ?>" data-live-search="true" data-target="houzezFourthList" data-size="5">
					<?php
					// All Option
					echo '<option value="">'.esc_html__('Select', 'houzez').'</option>';

					$prop_city = get_terms (
						array(
							"property_city"
						),
						array(
							'orderby' => 'name',
							'order' => 'ASC',
							'hide_empty' => false,
							'parent' => 0
						)
					);
					hcrm_get_taxonomy('property_city', $prop_city);
					?>
				</select>
			</div>
			<?php } ?>

			<?php if( taxonomy_exists('property_area') ) { ?>
			<div class="mb-3">
				<label><?php esc_html_e('Area', 'houzez'); ?></label>
				<select name="e_meta[area]" id="area" class="houzezSelectFilter houzezFourthList selectpicker form-control bs-select-hidden" title="<?php esc_html_e('Area', 'houzez'); ?>" data-live-search="true" data-size="5">
					<?php
					// All Option
					echo '<option value="">'.esc_html__('Select', 'houzez').'</option>';

					$prop_area = get_terms (
						array(
							"property_area"
						),
						array(
							'orderby' => 'name',
							'order' => 'ASC',
							'hide_empty' => false,
							'parent' => 0
						)
					);
					hcrm_get_taxonomy('property_area', $prop_area);
					?>
				</select>
			</div>
			<?php } ?>

			<div class="mb-3">
				<label><?php esc_html_e('Postal Code / Zip', 'houzez'); ?></label>
				<input class="form-control" name="e_meta[zipcode]" id="zipcode" placeholder="<?php esc_html_e('Enter the zip code', 'houzez'); ?>" type="text">
			</div>

			<div class="mb-3">
				<label><?php esc_html_e('Streat Address', 'houzez'); ?></label>
				<input class="form-control" name="e_meta[streat_address]" id="streat_address" placeholder="<?php esc_html_e('Enter the streat address', 'houzez'); ?>" type="text">
			</div>
		</div>
		<div class="offcanvas-box">
			<h4><?php esc_html_e('Notes', 'houzez'); ?></h4>
			<div class="mb-3">
				<textarea name="private_note" id="private_note" class="form-control" rows="5"></textarea>
			</div>
		</div>
		<input type="hidden" name="action" value="crm_add_new_enquiry">
		<div id="enquiry-msgs"></div>
		
		<?php get_template_part('template-parts/overlay-loader'); ?>
		
		</form>
	</div>

	<div class="offcanvas-footer">
		<button id="add_new_enquiry" type="button" class="btn btn-primary w-100">
			<?php esc_html_e('Save', 'houzez'); ?>
		</button>
	</div>
</div>