<?php $__env->startSection('styles'); ?>
	<!-- FLATPICKR CSS -->
	<link rel="stylesheet" href="<?php echo e(asset('assets/libs/flatpickr/flatpickr.min.css')); ?>">
	<!-- CHOICES CSS -->
	<link rel="stylesheet" href="<?php echo e(asset('assets/libs/choices.js/public/assets/styles/choices.min.css')); ?>">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
	<div class="content">
		<?php if($individual): ?>
			<!-- Edit mode -->
			<div id="individual-dashboard" class="main-content">
				<div class="block justify-between page-header sm:flex">
					<div>
						<h3 class="text-gray-700 hover:text-gray-900 dark:text-white dark:hover:text-white text-2xl font-medium">
							<?php echo e($individual->first_name); ?> <?php echo e($individual->last_name); ?></h3>
					</div>
					<div>
						<?php if(session('status')): ?>
							<script>
								document.addEventListener("DOMContentLoaded", function() {
									notifier.success("<?php echo e(session('status')); ?>");
								});
							</script>
						<?php endif; ?>
					</div>
				</div>

				<div class="grid grid-cols-12 gap-x-6">
					<div class="col-span-12 lg:col-span-2">
						<div class="box">
							<div class="box-body pt-6">
								<?php echo $__env->make('backend.crm.individuals.components.sidebar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
						</div>
					</div>
					<div class="col-span-12 lg:col-span-10">
						<div class="grid grid-cols-12 gap-x-5">
							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.individuals.forms.individual-form-edit', [
									'individual' => $individual,
									'readonly' => $readonly,
								], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>

							<div class="col-span-12 lg:col-span-4">
								<?php if($individual->lastActiveIdCard): ?>
									<?php echo $__env->make('backend.crm.individuals.forms.id-card-form-edit', [
										'individual' => $individual,
									], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
								<?php else: ?>
									<?php echo $__env->make('backend.crm.individuals.forms.id-card-form', [
										'individual' => $individual,
									], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
								<?php endif; ?>

							</div>

							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.individuals.forms.passport-form', [
									'individual' => $individual,
								], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
							<div class="col-span-12 lg:col-span-4">
								<?php if($individual->lastActiveIdCard || $individual->lastActivePassport): ?>
									<?php if($individual->lastActiveResidence): ?>
										<?php echo $__env->make('backend.crm.individuals.forms.address-residence-form-edit', [
											'individual' => $individual,
										], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
									<?php else: ?>
										<?php echo $__env->make('backend.crm.individuals.forms.address-residence-form', [
											'individual' => $individual,
										], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
									<?php endif; ?>
								<?php else: ?>
									<?php echo $__env->make('backend.crm.placeholders.address-residence-form', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
								<?php endif; ?>
							</div>
							<div class="col-span-12 lg:col-span-4">
								<?php if(($individual->lastActiveIdCard || $individual->lastActivePassport) && $individual->lastActiveResidence): ?>
									<?php if($individual->lastActiveMailing): ?>
										<?php echo $__env->make('backend.crm.individuals.forms.address-mailing-form-edit', [
											'individual' => $individual,
										], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
									<?php else: ?>
										<?php echo $__env->make('backend.crm.individuals.forms.address-mailing-form', [
											'individual' => $individual,
										], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
									<?php endif; ?>
								<?php else: ?>
									<?php echo $__env->make('backend.crm.placeholders.address-mailing-form', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
								<?php endif; ?>
							</div>

						</div>
					</div>
				</div>
			</div>
		<?php else: ?>
			<!-- Create mode -->
			<div id="individual-dashboard" class="main-content">
				<div class="block justify-between page-header sm:flex">
					<div>
						<h3 class="text-gray-700 hover:text-gray-900 dark:text-white dark:hover:text-white text-2xl font-medium">
							Novi klijent </h3>
					</div>
					<div>
						<?php if(session('status')): ?>
							<?php echo $__env->make('backend.crm.individuals.components.alert-status', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
						<?php endif; ?>
					</div>
				</div>

				<div class="grid grid-cols-12 gap-x-6">
					<div class="col-span-12 lg:col-span-2">
						<div class="box">
							<div class="box-body pt-6">
								<?php echo $__env->make('backend.crm.individuals.components.sidebar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
						</div>
					</div>
					<div class="col-span-12 lg:col-span-10">
						<div class="grid grid-cols-12 gap-x-5">
							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.individuals.forms.individual-form', [
									'readonly' => $readonly,
								], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.placeholders.id-card-form', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.placeholders.passport-form', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.placeholders.address-residence-form', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.placeholders.address-mailing-form', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
							<div class="col-span-12 lg:col-span-4">
								<?php echo $__env->make('backend.crm.placeholders.accounts-form', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
							</div>
						</div>
					</div>
				</div>
			</div>
		<?php endif; ?>
	</div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
	<!-- FLATPICKR JS -->
	<script src="<?php echo e(asset('assets/libs/flatpickr/flatpickr.min.js')); ?>"></script>

	<script>
		flatpickr(".date-picker", {
			dateFormat: "d.m.Y.",
			allowInput: true
		});
	</script>

	<!-- CHOICES JS -->
	<script src="<?php echo e(asset('assets/libs/choices.js/public/assets/scripts/choices.min.js')); ?>"></script>

	<?php if($individual): ?>
		<script>
			window.__IS_READONLY__ = <?php echo json_encode($readonly, 15, 512) ?>;

			// For ID Card place of birth
			window.__OLD_place_of_birth_city_id = "<?php echo e(old('place_of_birth_city_id')); ?>";
			window.__EXISTING_place_of_birth_city_id = "<?php echo e($individual->lastActiveIdCard?->place_of_birth_city_id); ?>";

			// For Passport BIRTH PLACE:
			window.__OLD_place_of_birth_country_id = "<?php echo e(old('passport.place_of_birth_country_id')); ?>";
			window.__EXISTING_place_of_birth_country_id = "<?php echo e($individual->lastActivePassport?->place_of_birth_country_id); ?>";

			// For Passport "country code" field:
			window.__OLD_country_code_country_id = "<?php echo e(old('passport.country_code_country_id')); ?>";
			window.__EXISTING_country_code_country_id = "<?php echo e($individual->lastActivePassport?->country_code_country_id); ?>";

			// For Passport nationality
			window.__OLD_nationality_country_id = "<?php echo e(old('passport.nationality_country_id')); ?>";
			window.__EXISTING_nationality_country_id = "<?php echo e($individual->lastActivePassport?->nationality_country_id); ?>";

			// For residence
			window.__OLD_residence_city_id = "<?php echo e(old('residence.city_id')); ?>";
			window.__EXISTING_residence_city_id = "<?php echo e(optional($individual->lastActiveResidence)->city_id); ?>";

			// For mailing
			window.__OLD_mailing_city_id = "<?php echo e(old('mailing.city_id')); ?>";
			window.__EXISTING_mailing_city_id = "<?php echo e(optional($individual->lastActiveMailing)->city_id); ?>";
		</script>
		<?php echo app('Illuminate\Foundation\Vite')(['resources/js/choices-setup.js']); ?>
	<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\policypilot\resources\views/backend/crm/individuals/dashboard.blade.php ENDPATH**/ ?>