<?php
$created = can_action_by_label('chart_of_accounts', 'created');
$edited = can_action_by_label('chart_of_accounts', 'edited');
if (!empty($created) || !empty($edited)) {
	$sub_type_id = !empty($account_sub->account_sub_type_id) ? $account_sub->account_sub_type_id : null;
	$status_selected = isset($account_sub->status) ? (string) $account_sub->status : '1';
	$status_options = array(
		'1' => lang('active'),
		'0' => lang('inactive'),
	);
	?>
	
	<div class="modal-body">
		<?= form_open(base_url('admin/accounting/save_account_sub_type/' . $sub_type_id), array('class' => 'space-y-4', 'data-parsley-validate' => '', 'novalidate' => '', 'enctype' => 'multipart/form-data')); ?>
		<?= form_select_group(
			'account_type_id',
			lang('account_type'),
			$account_types,
			!empty($account_sub->account_type_id) ? $account_sub->account_type_id : '',
			true,
			array('class' => 'select_box')
		); ?>
		<?= form_input_group('account_sub_type', lang('account_sub_type'), !empty($account_sub->account_sub_type) ? $account_sub->account_sub_type : '', 'text', true); ?>
		<?= form_select_group('status', lang('status'), $status_options, $status_selected); ?>
		<div class="flex justify-end gap-2">
			<button type="button" class="inline-flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-xs font-semibold text-foreground hover:bg-muted" data-dismiss="modal">
				<i data-lucide="x" class="h-4 w-4"></i>
				<?= lang('close') ?>
			</button>
			<button type="submit" class="inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-indigo-500">
				<i data-lucide="check" class="h-4 w-4"></i>
				<?= lang('save') ?>
			</button>
		</div>
		<?= form_close(); ?>
	</div>
<?php } ?>
