<?php
  $form_url = user_url("brands/store/device_add");
  $redirect_url = previous_url();
  $form_attributes = array('class' => 'form actionForm', 'data-redirect' => $redirect_url, 'method' => "POST");
  
  $form_hidden = [
    'type'   => 'devices',
  ];
  $config_status = app_config('config')['status'];
  $class_element = app_config('template')['form']['class_element'];
  $class_element_select = app_config('template')['form']['class_element_select'];
  
  $current_config_status = (in_array($controller_name, $config_status)) ? $config_status[$controller_name] : $config_status['default'];
  $form_status = array_intersect_key(app_config('template')['status'], $current_config_status); 
  $form_status = array_combine(array_keys($form_status), array_column($form_status, 'name')); 

  // ইনপুট ফিল্ডকে স্লিম ও সিম্পল করার জন্য ক্লাস ও স্টাইল যুক্ত করা হয়েছে
  $custom_input_class = $class_element . " rounded-2 custom-form-input";

  $general_elements = [
    [
      'label'      => form_label('Device Name', '', ['class' => 'text-secondary small fw-medium mb-1']),
      'element'    => form_input(['name' => 'device_name', 'value' => @$item['device_name'], 'type' => 'text', 'class' => $custom_input_class, 'style' => 'height: 38px; font-size: 13px; border: 1px solid #e2e8f0;']),
      'class_main' => "col-12 mb-2",
    ]
  ];
  
  $data['modal_title'] = 'Add Device';
?>

<?= view('layouts/common/modal/modal_top', $data); ?>

<?php echo form_open($form_url, $form_attributes, $form_hidden); ?>
<div class="modal-body px-4 py-3">
    <div class="row">
        <?php echo render_elements_form($general_elements); ?>
    </div>
</div>

<div class="modal-footer px-4 py-3 border-top-0 d-flex justify-content-end gap-2" style="background-color: #ffffff;">
    <?= modal_buttons(); ?>
</div>

<?php echo form_close(); ?>

<?= view('layouts/common/modal/modal_bottom'); ?>

<style>
    /* সিম্পল ফর্ম ফোকাস স্টাইল */
    .custom-form-input:focus {
        border-color: #3b82f6 !important;
        box-shadow: none !important;
        background-color: #fff !important;
    }
</style>
