<?php
$modal_title = lang('new') . ' ' . lang('attachment');
echo form_open_multipart(base_url('client/bugs/save_attachment'), array('id' => 'attachment-form', 'class' => 'modal-form'));
?>
<div class="panel panel-custom">
    <div class="panel-heading">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel"><?= $modal_title ?></h4>
    </div>
    <div class="modal-body wrap-modal wrap">
        <div class="grid gap-4">
            <div class="grid gap-4 md:grid-cols-2">
                <?= form_input_group('title', lang('file_title'), (!empty($add_files_info)) ? $add_files_info->title : '', 'text', true) ?>
                <?= form_textarea_group('description', lang('description'), (!empty($add_files_info)) ? $add_files_info->description : '') ?>
            </div>

            <input type="hidden" name="bug_id" value="<?php
            if (!empty($bugs_details->bug_id)) {
                echo $bugs_details->bug_id;
            }
            ?>" class="form-control">

            <?= form_attachment_group('files[]', null, 'dropzone', [
                'dropzone_id' => 'bug-attachments-dropzone',
                'list_id' => 'bug-attachments-list',
                'comment' => true,
            ]); ?>
        </div>

        <div class="modal-footer flex items-center justify-end gap-2 border-0 px-0">
            <button type="button"
                    class="cancel-upload inline-flex items-center gap-2 rounded-lg border border-slate-200 bg-white px-4 py-2 text-xs font-semibold text-slate-600 hover:bg-slate-50"
                    data-dismiss="modal">
                <i data-lucide="x" class="h-4 w-4"></i>
                <?php echo lang('close'); ?>
            </button>
            <button id="file-save-bug-btn" type="submit"
                    class="start-upload inline-flex items-center gap-2 rounded-lg bg-slate-900 px-4 py-2 text-xs font-semibold text-white hover:bg-slate-800">
                <i data-lucide="check-circle" class="h-4 w-4"></i>
                <?php echo lang('save'); ?>
            </button>
        </div>
    </div>
</div>
<?php echo form_close(); ?>
