<?= message_box('success'); ?>
<?= message_box('error'); ?>

<?php
$permissionL = !empty($task_info->permission) ? $task_info->permission : null;

$status_options = [
	'not_started' => lang('not_started'),
	'in_progress' => lang('in_progress'),
	'completed' => lang('completed'),
	'deferred' => lang('deferred'),
	'waiting_for_someone' => lang('waiting_for_someone'),
];
$status_selected = !empty($task_info->task_status) ? $task_info->task_status : 'not_started';
?>

<div class="space-y-6">
	<div class="rounded-2xl border border-border bg-card p-6">
		<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
			<div>
				<p class="text-xs font-semibold uppercase tracking-wide text-muted-foreground"><?= lang('tasks'); ?></p>
				<h1 class="text-2xl font-semibold text-foreground"><?= lang('import') . ' ' . lang('tasks') ?></h1>
			</div>
			<div class="flex items-center gap-2">
				<a href="<?= base_url('assets/sample/tasks_sample.xlsx') ?>"
					class="inline-flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-sm font-medium text-foreground hover:bg-muted">
					<i data-lucide="download" class="h-4 w-4"></i>
					<?= lang('download_sample') ?>
				</a>
			</div>
		</div>
	</div>

	<?= form_open(base_url('admin/tasks/save_imported'), [
		'class' => 'space-y-6',
		'enctype' => 'multipart/form-data',
		'data-parsley-validate' => '',
		'novalidate' => '',
	]); ?>
		<div class="grid grid-cols-1 xl:grid-cols-12 gap-6">
			<div class="xl:col-span-8 space-y-6">
				<div class="rounded-xl border border-border bg-card p-6 space-y-5">
					<div class="flex items-center gap-2 border-b border-slate-200 pb-3 dark:border-slate-700">
						<i data-lucide="upload" class="h-5 w-5"></i>
						<h2 class="text-base font-semibold text-foreground"><?= lang('import') . ' ' . lang('details') ?></h2>
					</div>

					<div class="grid grid-cols-1 md:grid-cols-2 gap-5">
						<div class="md:col-span-2">
							<label for="upload_file" class="text-sm font-medium text-foreground">
								<?= lang('choose_file') ?> <span class="text-rose-500">*</span>
							</label>
							<input id="upload_file" name="upload_file" type="file" required
								class="mt-2 block w-full rounded-lg border border-border bg-card px-3 py-2 text-sm text-foreground shadow-sm file:mr-4 file:rounded-md file:border-0 file:bg-muted file:px-3 file:py-2 file:text-sm file:font-semibold hover:file:bg-muted/80">
							<p class="mt-2 text-xs text-muted-foreground"><?= lang('select_file') ?></p>
						</div>
					</div>
				</div>
			</div>

			<aside class="xl:col-span-4 space-y-6">
				<div class="rounded-xl border border-border bg-card p-6 space-y-5">
					<div class="flex items-center gap-2 text-sm font-semibold text-foreground mb-3 border-b border-slate-200 pb-2 dark:border-slate-700">
						<i data-lucide="info" class="h-5 w-5"></i>
						<h2 class="text-base font-semibold text-foreground"><?= lang('additional_info') ?></h2>
					</div>
					<?= form_select_group('task_status', lang('task_status'), $status_options, $status_selected, true); ?>
				</div>

				<?= form_permission_modern($assign_user, $permissionL, lang('assined_to')); ?>
			</aside>
		</div>

		<div class="sticky bottom-4 z-20">
			<div class="flex flex-wrap justify-end gap-3 rounded-2xl border border-border bg-card px-4 py-3 shadow-sm">
				<button type="submit" class="inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500">
					<i data-lucide="upload" class="h-4 w-4"></i>
					<?= lang('upload') ?>
				</button>
			</div>
		</div>
	<?= form_close(); ?>
</div>
