<!-- Page Heading -->
<h3 class="sub-settings mt-0">Ticket System Settings</h3>

<!-- Ticket ID Prefix -->
<div class="row mb-3">
    <label for="settings[ticket_system][ticket_id_prefix]" class="col-sm-2 control-label">Ticket ID Prefix</label>
    <div class="col-sm-4">
        <input type="text" class="form-control" id="settings[ticket_system][ticket_id_prefix]" name="settings[ticket_system][ticket_id_prefix]" placeholder="RIX" value="{{ old('settings.ticket_system.ticket_id_prefix', setting('ticket_system.ticket_id_prefix', 'RIX')) }}">
        <div class="small">Set a customizable prefix for ticket IDs.</div>
    </div>
</div>

<!-- Ticket Priority Level -->
<div class="row mb-3">
    <label for="settings[ticket_system][default_priority]" class="col-sm-2 control-label">Default Priority</label>
    <div class="col-sm-4">
        <select class="form-control" id="settings[ticket_system][default_priority]" name="settings[ticket_system][default_priority]">
            <option value="Low" @selected(old('settings.ticket_system.default_priority', setting('ticket_system.default_priority')) == 'Low')>Low</option>
            <option value="Medium" @selected(old('settings.ticket_system.default_priority', setting('ticket_system.default_priority')) == 'Medium')>Medium</option>
            <option value="High" @selected(old('settings.ticket_system.default_priority', setting('ticket_system.default_priority')) == 'High')>High</option>
            <option value="Critical" @selected(old('settings.ticket_system.default_priority', setting('ticket_system.default_priority')) == 'Critical')>Critical</option>
        </select>
        <div class="small">Set the default priority level for new tickets.</div>
    </div>
</div>

<!-- Ticket Category -->
<div class="mb-3 row">
    <label for="settings[ticket_system][default_category_id]" class="col-sm-2 control-label">Default Category</label>
    <div class="col-sm-4">
        <select class="form-control" id="settings[ticket_system][default_category_id]" name="settings[ticket_system][default_category_id]">
            @foreach($categories as $category)
                <option value="{{ $category->id }}" @selected(old('settings.ticket_system.default_category_id', setting('ticket_system.default_category_id', 4)) == $category->id)>{{ $category->name }}</option>
            @endforeach
        </select>
        <div class="small">Set the default category for new tickets.</div>
    </div>
</div>

<!-- Ticket Limit -->
<div class="row mb-3">
    <label for="settings[ticket_system][max_tickets_per_user]" class="col-sm-2 control-label">Maximum Open Tickets per User</label>
    <div class="col-sm-4">
        <input type="number" class="form-control" id="settings[ticket_system][max_tickets_per_user]" name="settings[ticket_system][max_tickets_per_user]" placeholder="3" value="{{ old('settings.ticket_system.max_tickets_per_user', setting('ticket_system.max_tickets_per_user', 3)) }}" min="1">
        <div class="small">Set the maximum number of open tickets allowed per user.</div>
    </div>
</div>

<!-- File Attachments -->
<div class="row mb-3">
    <label for="settings[ticket_system][file_attachments]" class="col-sm-2 control-label">Allow File Attachments</label>
    <div class="col-sm-4">
        <select class="form-control" id="settings[ticket_system][file_attachments]" name="settings[ticket_system][file_attachments]">
            <option value="1" @selected(old('settings.ticket_system.file_attachments', setting('ticket_system.file_attachments')) == '1')>Yes</option>
            <option value="0" @selected(old('settings.ticket_system.file_attachments', setting('ticket_system.file_attachments')) == '0')>No</option>
        </select>
        <div class="small">Allow users to attach files to tickets or ticket messages.</div>
    </div>
</div>

<!-- Maximum File Attachments -->
<div class="row mb-3">
    <label for="settings[ticket_system][max_file_attachments]" class="col-sm-2 control-label">Maximum Files per Message</label>
    <div class="col-sm-4">
        <input type="number" class="form-control" id="settings[ticket_system][max_file_attachments]" name="settings[ticket_system][max_file_attachments]" placeholder="1" value="{{ old('settings.ticket_system.max_file_attachments', setting('ticket_system.max_file_attachments', 1)) }}" min="1">
        <div class="small">Set the maximum number of files that can be attached to a single message.</div>
    </div>
</div>

<!-- File Attachment Size -->
<div class="row mb-3">
    <label for="settings[ticket_system][file_size]" class="col-sm-2 control-label">File's Size</label>
    <div class="col-sm-4">
        <input type="number" class="form-control" id="settings[ticket_system][file_size]" name="settings[ticket_system][file_size]" placeholder="2" value="{{ old('settings.ticket_system.file_size', setting('ticket_system.file_size', 2)) }}" min="1">
        <div class="small">Set the maximum file size (in MB) for each attached file.</div>
    </div>
</div>

<!-- Rich Editor -->
<div class="row mb-3">
    <label for="settings[ticket_system][rich_editor]" class="col-sm-2 control-label">Enable Rich Text Editor</label>
    <div class="col-sm-4">
        <select class="form-control" id="settings[ticket_system][rich_editor]" name="settings[ticket_system][rich_editor]">
            <option value="1" @selected(old('settings.ticket_system.rich_editor', setting('ticket_system.rich_editor')) == '1')>Yes</option>
            <option value="0" @selected(old('settings.ticket_system.rich_editor', setting('ticket_system.rich_editor')) == '0')>No</option>
        </select>
        <div class="small">Allow customers to use a rich text editor for ticket messages.</div>
    </div>
</div>

<!-- Ticket Copy to Customer -->
<div class="row mb-3">
    <label for="settings[ticket_system][copy_to_customer]" class="col-sm-2 control-label">Send Ticket Copy to Customer</label>
    <div class="col-sm-4">
        <select class="form-control" id="settings[ticket_system][copy_to_customer]" name="settings[ticket_system][copy_to_customer]">
            <option value="1" @selected(old('settings.ticket_system.copy_to_customer', setting('ticket_system.copy_to_customer')) == '1')>Yes</option>
            <option value="0" @selected(old('settings.ticket_system.copy_to_customer', setting('ticket_system.copy_to_customer')) == '0')>No</option>
        </select>
        <div class="small">Send a copy of the new ticket to the customer.</div>
    </div>
</div>

<!-- Notify Admins on New Tickets -->
<div class="row mb-3">
    <label for="settings[ticket_system][notify_admin]" class="col-sm-2 control-label">Notify Admins on New Tickets</label>
    <div class="col-sm-4">
        <select class="form-control" id="settings[ticket_system][notify_admin]" name="settings[ticket_system][notify_admin]">
            <option value="1" @selected(old('settings.ticket_system.notify_admin', setting('ticket_system.notify_admin')) == '1')>Yes</option>
            <option value="0" @selected(old('settings.ticket_system.notify_admin', setting('ticket_system.notify_admin')) == '0')>No</option>
        </select>
        <div class="small">Notify admins when a new ticket is created.</div>
    </div>
</div>

<!-- Notify Admins on Customer Responses -->
<div class="row mb-3">
    <label for="settings[ticket_system][customer_response_to_admin]" class="col-sm-2 control-label">Notify Admins on Customer Responses</label>
    <div class="col-sm-4">
        <select class="form-control" id="settings[ticket_system][customer_response_to_admin]" name="settings[ticket_system][customer_response_to_admin]">
            <option value="1" @selected(old('settings.ticket_system.customer_response_to_admin', setting('ticket_system.customer_response_to_admin')) == '1')>Yes</option>
            <option value="0" @selected(old('settings.ticket_system.customer_response_to_admin', setting('ticket_system.customer_response_to_admin')) == '0')>No</option>
        </select>
        <div class="small">Notify admins when a customer responds to a ticket.</div>
    </div>
</div>
