<form data-parsley-validate="" novalidate="" role="form" enctype="multipart/form-data"
      action="<?= base_url() ?>admin/utilities/save_overtime/<?php if (!empty($overtime_info->overtime_id)) { echo $overtime_info->overtime_id; } ?>"
      method="post" class="space-y-5">

    <?php if ((int) $this->session->userdata('user_type') === 1) { ?>
        <?php
        $selected_user_id = !empty($overtime_info->user_id) ? $overtime_info->user_id : '';
        $selected_employee_label = !empty($selected_employee_label) ? $selected_employee_label : '';
        ?>
        <div class="rounded-xl border border-border bg-muted/30 p-4">
            <?= form_lookup_group(
                'user_id',
                lang('employee'),
                $selected_user_id,
                $selected_employee_label,
                true,
                array('id' => 'overtime_employee_lookup'),
                '',
                array(
                    'type' => 'staff',
                    'limit' => 12,
                    'min_length' => 0,
                    'placeholder' => lang('search') . ' ' . lang('employee'),
                )
            ); ?>
        </div>
    <?php } else { ?>
        <input type="hidden" name="user_id" value="<?= $this->session->userdata('user_id') ?>">
    <?php } ?>

    <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
        <?= form_datepicker('overtime_date', lang('date'), !empty($overtime_info->overtime_date) ? $overtime_info->overtime_date : date('Y-m-d'), true, array('data-format' => 'Y-m-d')) ?>

        <?= form_timepicker('overtime_hours', lang('overtime_hour'), !empty($overtime_info->overtime_hours) ? $overtime_info->overtime_hours : '', true, array('data-format' => 'H:i')) ?>
    </div>

    <?= form_textarea_group('notes', lang('notes'), !empty($overtime_info->notes) ? $overtime_info->notes : '', 4, false) ?>

    <div class="flex items-center justify-end gap-2 border-t border-border pt-4">
        <button id="sbtn" type="submit" name="sbtn" value="1"
                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="save" class="h-4 w-4"></i>
            <?= lang('save') ?>
        </button>
    </div>
</form>
