<?php
$selected_color = !empty($holiday_list->color) ? $holiday_list->color : '#83c340';
$colors = array(
	'#83c340',
	'#29c2c2',
	'#2d9cdb',
	'#aab7b7',
	'#f1c40f',
	'#e18a00',
	'#e74c3c',
	'#d43480',
	'#ad159e',
	'#34495e',
	'#dbadff',
	'#f05050'
);
?>

<div class="p-0">
	<form data-parsley-validate="" novalidate="" action="<?php echo base_url(); ?>admin/holiday/save_holiday/<?php
																												if (!empty($holiday_list->holiday_id)) {
																													echo $holiday_list->holiday_id;
																												}
																												?>" method="post" class="space-y-6">
		<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
			<div class="rounded-xl border border-border bg-card p-4 space-y-4">
				<div class="flex items-center gap-2 text-sm font-semibold text-foreground border-b border-border pb-3">
					<i data-lucide="badge-check" class="h-4 w-4 text-muted-foreground"></i>
					<h4 class="text-sm font-semibold text-foreground"><?= lang('holiday') . ' ' . lang('details') ?></h4>
				</div>
				<div class="space-y-4">
					<?= form_input_group(
						'event_name',
						lang('event_name'),
						!empty($holiday_list->event_name) ? $holiday_list->event_name : '',
						'text',
						true,
						array('placeholder' => lang('event_name'))
					); ?>

					<?= form_textarea_group(
						'description',
						lang('description'),
						!empty($holiday_list->description) ? $holiday_list->description : '',
						4,
						true
					); ?>

					<?= form_input_group(
						'location',
						lang('location'),
						!empty($holiday_list->location) ? $holiday_list->location : '',
						'text',
						false,
						array('placeholder' => lang('location'))
					); ?>
				</div>
			</div>

			<div class="rounded-xl border border-border bg-card p-4 space-y-4">
				<div class="flex items-center gap-2 text-sm font-semibold text-foreground border-b border-border pb-3">
					<i data-lucide="calendar" class="h-4 w-4 text-muted-foreground"></i>
					<h4 class="text-sm font-semibold text-foreground"><?= lang('schedule') ?></h4>
				</div>
				<div class="space-y-4">
					<?= form_datepicker(
						'start_date',
						lang('start_date'),
						!empty($holiday_list->start_date) ? $holiday_list->start_date : '',
						true,
						array('class' => 'start_date')
					); ?>

					<?= form_datepicker(
						'end_date',
						lang('end_date'),
						!empty($holiday_list->end_date) ? $holiday_list->end_date : '',
						true,
						array('class' => 'end_date')
					); ?>
				</div>
			</div>
		</div>

		<div class="rounded-xl border border-border bg-card p-4 space-y-4">
			<div class="flex items-center gap-2 text-sm font-semibold text-foreground border-b border-border pb-3">
				<i data-lucide="palette" class="h-4 w-4 text-muted-foreground"></i>
				<h4 class="text-sm font-semibold text-foreground"><?= lang('color') ?></h4>
			</div>
			<div class="flex flex-col lg:flex-row lg:items-center gap-4">
				<label class="text-sm font-medium text-foreground lg:w-48"><?= lang('color') ?></label>
				<div class="flex items-center gap-3">
					<input type="color" value="<?= html_escape($selected_color) ?>" class="h-10 w-14 rounded-lg border border-border bg-card p-0.5" data-holiday-color-picker>
					<input type="hidden" name="color" value="<?= html_escape($selected_color) ?>" data-holiday-color-value>
					<span class="text-xs text-muted-foreground"><?= lang('select') ?> <?= lang('color') ?></span>
				</div>
			</div>
			<div class="flex flex-wrap gap-2 color-palet" data-holiday-color-palette>
				<?php foreach ($colors as $color): ?>
					<button type="button" class="h-7 w-7 rounded-full ring-1 ring-border clickable <?= $selected_color === $color ? 'ring-2 ring-indigo-500' : '' ?>" style="background-color:<?= html_escape($color) ?>" data-holiday-color-option="<?= html_escape($color) ?>" aria-label="<?= html_escape(lang('select') . ' ' . lang('color') . ' ' . $color) ?>"></button>
				<?php endforeach; ?>
			</div>
		</div>

		<div class="flex items-center justify-end gap-2 border-t border-border pt-4">
			<button type="button" class="inline-flex items-center rounded-lg border border-border bg-card px-3 py-2 text-xs font-semibold text-foreground hover:bg-muted" data-dismiss="modal"><?= lang('close') ?></button>
			<button type="submit" id="sbtn" class="inline-flex items-center rounded-lg bg-indigo-600 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-indigo-500"><?= lang('save') ?></button>
		</div>
	</form>
</div>
