<?php $__env->startSection('content'); ?>
<?php $__env->startSection('title', 'Update Settings'); ?>

<div class="row">
    <div class="col-xl-12 col-lg-12">
        <div class="alert alert-success my-3" style="display:none;" id="success"></div>
        
                <div class="card">
            <div class="card-header d-flex justify-content-between align-items-center">
                <h4 class="card-title mb-0">Update Settings</h4>
                <a href="javascript:history.back()" class="btn btn-sm btn-light">
                    <i class="ri-arrow-left-line"></i> Back
                </a>
    </div>

            <div class="card-body">
    <form accept-charset="utf-8" name="update-form" id="update-form">
        <?php echo csrf_field(); ?>
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="mb-3">
                                <label for="setting_scope" class="form-label"><?php echo e($dbs_site_settings['setting_scope_title']); ?></label>
                            <select class="form-control" name="setting_scope" id="setting_scope">
                                <?php $__currentLoopData = $dbs_site_settings['setting_scope_array']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($key); ?>" <?php if($row->setting_scope == $key): ?> selected <?php endif; ?>><?php echo e($value); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            <span class="text-danger" id="setting_scopeError"></span>
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="mb-3">
                                <label for="setting_type" class="form-label"><?php echo e($dbs_site_settings['setting_type_title']); ?></label>
                            <select class="form-control" name="setting_type" id="setting_type" onchange="doSettings();">
                                <?php $__currentLoopData = $dbs_site_settings['setting_type_array']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($key); ?>" <?php if($row->setting_type == $key): ?> selected <?php endif; ?>><?php echo e($value); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            <span class="text-danger" id="setting_typeError"></span>
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="mb-3">
                                <label for="setting_options" class="form-label"><?php echo e($dbs_site_settings['setting_options_title']); ?></label>
                            <input type="<?php echo e($dbs_site_settings['setting_options_html5_type']); ?>" class="form-control" id="setting_options" name="setting_options" 
                                   value="<?php echo e($row->setting_options); ?>" maxlength="<?php echo e($dbs_site_settings['setting_options_max']); ?>" 
                                   placeholder="Type comma-separated values" readonly="readonly" 
                                   <?php echo e($dbs_site_settings['setting_options_html5_req']); ?>>
                            <span class="text-danger" id="setting_optionsError"></span>
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="mb-3">
                                <label for="setting_settings" class="form-label"><?php echo e($dbs_site_settings['setting_settings_title']); ?></label>
                            <input type="<?php echo e($dbs_site_settings['setting_settings_html5_type']); ?>" class="form-control" id="setting_settings" name="setting_settings" 
                                   value="<?php echo e($row->setting_settings); ?>" maxlength="<?php echo e($dbs_site_settings['setting_settings_max']); ?>" 
                                   placeholder="<?php echo e($dbs_site_settings['setting_settings_title']); ?>" 
                                   <?php echo e($dbs_site_settings['setting_settings_html5_req']); ?> 
                                   onkeyup="$('#setting_key').val(doSlugify(this.value, '_'));">
                            <span class="text-danger" id="setting_settingsError"></span>
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="mb-3">
                                <label for="setting_key" class="form-label"><?php echo e($dbs_site_settings['setting_key_title']); ?></label>
                            <input type="<?php echo e($dbs_site_settings['setting_key_html5_type']); ?>" class="form-control" id="setting_key" name="setting_key" 
                                   value="<?php echo e($row->setting_key); ?>" maxlength="<?php echo e($dbs_site_settings['setting_key_max']); ?>" 
                                   placeholder="<?php echo e($dbs_site_settings['setting_key_title']); ?>" 
                                   <?php echo e($dbs_site_settings['setting_key_html5_req']); ?>>
                            <span class="text-danger" id="setting_keyError"></span>
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="mb-3">
                                <label for="setting_value" class="form-label"><?php echo e($dbs_site_settings['setting_value_title']); ?></label>
                            <div id="option-wrapper">
                                <input type="<?php echo e($dbs_site_settings['setting_value_html5_type']); ?>" class="form-control" id="setting_value" name="setting_value" 
                                       value="<?php echo e($row->setting_value); ?>" maxlength="<?php echo e($dbs_site_settings['setting_value_max']); ?>" 
                                       placeholder="<?php echo e($dbs_site_settings['setting_value_title']); ?>" 
                                       <?php echo e($dbs_site_settings['setting_value_html5_req']); ?>>
                            </div>
                            <span class="text-danger" id="setting_valueError"></span>
                        </div>
                        </div>
                    </div>

                    <div class="p-3 mb-3 rounded">
                        <div class="row justify-content-end g-2">
                            <div class="col-lg-3">
                                <div id="edit-mode">
                                    <button type='submit' name='update-submit' id='update-submit'
                                            class='btn btn-outline-secondary w-100' data-args1='<?php echo e(route("settings.update", $row->id)); ?>'
                                            data-args2='admin/settings' onclick='addUpdate(event, "update")'>
                                        <i class="ri-save-line"></i> Save 
                                    </button>
                                </div>
                            </div>
                            <div class="col-lg-2">
                                <a href="<?php echo e(url('/admin/settings')); ?>" class="btn btn-primary w-100">
                                    <i class="ri-close-circle-line"></i> Cancel
                                </a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    var optTextbox = $('#option-wrapper').html();
    var optSelect = '<select required="required" name="setting_value" id="setting_value" class="form-control"></select>';

    $(document).ready(function () {
        // Load settings
        doSettings('<?php echo e($row->setting_value); ?>');
    });
</script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.metor.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/MAMP/htdocs/payroll/resources/views/settings/edit.blade.php ENDPATH**/ ?>