<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?php
$contract_type_options = array('' => lang('select') . ' ' . lang('contract_type'));
if (!empty($contract_types)) {
	foreach ($contract_types as $contract_type) {
		$contract_type_options[$contract_type->contract_type_id] = $contract_type->contract_type;
	}
}

$status_options = array(
	'active' => lang('active'),
	'expired' => lang('expired'),
	'terminated' => lang('terminated'),
	'cancelled' => lang('cancelled'),
);
?>

<div class="p-5">
	<?= form_open(base_url('admin/client/save_contract/' . $client_id), array('class' => 'space-y-5', 'data-parsley-validate' => '', 'role' => 'form')); ?>
		<div class="space-y-4">
			<?= form_input_group('subject', lang('contract'), '', 'text', true); ?>
			<?= form_select_group('contract_type_id', lang('contract_type'), $contract_type_options, '', false); ?>
			<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
				<?= form_datepicker('start_date', lang('start_date'), date('Y-m-d'), true, array('data-auto-close' => 'true')); ?>
				<?= form_datepicker('end_date', lang('end_date'), '', false, array('data-auto-close' => 'true')); ?>
			</div>
			<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
				<?= form_select_group('status', lang('status'), $status_options, 'active', true); ?>
				<?= form_input_group('contract_value', lang('amount'), '0.00', 'text', false, array('data-parsley-type' => 'number')); ?>
			</div>
			<?= form_textarea_group('notes', lang('notes'), '', 4, false); ?>
		</div>
		<div class="flex justify-end gap-2 border-t border-border pt-4">
			<button type="submit" class="inline-flex items-center rounded-lg bg-slate-900 px-4 py-2 text-sm font-semibold text-white hover:bg-slate-800 dark:bg-slate-100 dark:text-slate-900 dark:hover:bg-white">
				<?= lang('save') ?>
			</button>
		</div>
	<?= form_close(); ?>
</div>
