<?php
$created = can_action('142', 'created');
$edited = can_action('142', 'edited');
if (!empty($created) || !empty($edited)) {
    ?>
    <div class="modal-body ">
        <form id="form_validation" data-parsley-validate="" novalidate="" enctype="multipart/form-data"
              action="<?php echo base_url() ?>admin/knowledgebase/saved_categories/<?php
              if (!empty($category_info->kb_category_id)) {
                  echo $category_info->kb_category_id;
              } elseif (!empty($inline)) {
                  echo $inline;
              }
              ?>" method="post" class="space-y-4">
            <?=
            form_input_group(
                'category',
                lang('categories'),
                !empty($category_info->category) ? $category_info->category : '',
                'text',
                true
            );
            ?>
            <input type="hidden" name="type" required class="form-control" value="kb"/>
            <?= form_textarea_group('description', lang('description'), !empty($category_info->description) ? $category_info->description : '', 3); ?>
            <?= form_input_group('sort', lang('order'), !empty($category_info->sort) ? $category_info->sort : '', 'number', true, array('data-parsley-type' => 'number')); ?>
            <?php
            $status_options = array(
                '1' => lang('active'),
                '2' => lang('inactive'),
            );
            $status_selected = !empty($category_info->status) ? $category_info->status : '1';
            ?>
            <?= form_radio_group('status', lang('status'), $status_options, $status_selected); ?>
            <div class="flex items-center justify-end gap-2 pt-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" id="sbtn" 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>
<?php }
if (!empty($inline)) { ?>
<?php }
?>
