
<div class="modal-body p-4">
    <?php
    $designation_options = array('' => lang('select') . ' ' . lang('designation'));
    if (!empty($all_department_info)) {
        foreach ($all_department_info as $dept_name => $v_department_info) {
            if (empty($v_department_info) || !is_array($v_department_info)) {
                continue;
            }
            $dept_label = !empty($all_dept_info[$dept_name]->deptname)
                ? $all_dept_info[$dept_name]->deptname
                : lang('undefined_department');

            foreach ($v_department_info as $designation) {
                if (empty($designation->designations_id) || empty($designation->designations)) {
                    continue;
                }
                $designation_options[$designation->designations_id] = $dept_label . ' - ' . $designation->designations;
            }
        }
    }
    ?>
    <form id="form" role="form" enctype="multipart/form-data" data-parsley-validate="" novalidate=""
          action="<?php echo base_url() ?>admin/job_circular/save_job_posted/<?php
          if (!empty($job_posted->job_circular_id)) {
              echo $job_posted->job_circular_id;
          }
          ?>" method="post" class="space-y-4">
        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
            <?= form_input_group('job_title', lang('job_title'), !empty($job_posted->job_title) ? $job_posted->job_title : '', 'text', true); ?>
            <?= form_select_group(
                'designations_id',
                lang('designation'),
                $designation_options,
                !empty($job_posted->designations_id) ? $job_posted->designations_id : '',
                true,
                array('class' => 'select_box w-full', 'data-search' => 'true')
            ) ?>
            <?php
            $employment_options = array(
                'contractual' => lang('contractual'),
                'full_time' => lang('full_time'),
                'part_time' => lang('part_time'),
            );
            $employment_selected = !empty($job_posted->employment_type) ? $job_posted->employment_type : 'contractual';
            echo form_select_group('employment_type', lang('employment_type'), $employment_options, $employment_selected, true);
            ?>
            <?= form_input_group('experience', lang('experience'), !empty($job_posted->experience) ? $job_posted->experience : '', 'number', true, array('placeholder' => lang('experience_placeholder'))); ?>
            <?= form_input_group('age', lang('age'), !empty($job_posted->age) ? $job_posted->age : '', 'number', true, array('placeholder' => lang('age_placeholder'))); ?>
            <?= form_input_group('salary_range', lang('salary_range'), !empty($job_posted->salary_range) ? $job_posted->salary_range : '', 'number', true, array('placeholder' => lang('salary_range_placeholder'))); ?>
            <?= form_input_group('vacancy_no', lang('vacancy_no'), !empty($job_posted->vacancy_no) ? $job_posted->vacancy_no : '', 'number', true); ?>
            <?= form_datepicker('posted_date', lang('posted_date'), !empty($job_posted->posted_date) ? $job_posted->posted_date : '', true, array('class' => 'datepicker', 'data-max' => '#last_date', 'data-auto-close' => 'true')); ?>
            <?= form_datepicker('last_date', lang('last_date_to_apply'), !empty($job_posted->last_date) ? $job_posted->last_date : '', true, array('class' => 'datepicker', 'data-min' => '#posted_date', 'data-auto-close' => 'true')); ?>
        </div>
        <?php
        if (!empty($job_posted)) {
            $job_circular_id = $job_posted->job_circular_id;
        } else {
            $job_circular_id = null;
        }
        ?>
        <?= custom_form_Fields(14, $job_circular_id); ?>

    
		<?= form_editor('description', lang('task_description'), !empty($job_posted->description) ? $job_posted->description : '', true); ?>

        <?php
        $status_options = array(
            'published' => lang('published'),
            'unpublished' => lang('unpublished'),
        );
        $status_selected = !empty($job_posted->status) ? $job_posted->status : 'published';
        echo form_radio_group('status', lang('status'), $status_options, $status_selected);
        ?>

        <?php
        $permissionL = null;
        if (!empty($job_posted->permission)) {
            $permissionL = $job_posted->permission;
        }
        ?>
  
		<?= form_permission_modern($assign_user, $permissionL, lang('assined_to')); ?>

        <div class="flex items-center justify-end gap-2 pt-2">
            <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="save" class="h-4 w-4"></i>
                <?= lang('save') ?>
            </button>
        </div>
    </form>
</div>
