<!DOCTYPE html>
<html lang="<?php echo e(str_replace('_', '-', app()->getLocale())); ?>">
<head>
  <title>SEO Content Type List : <?php echo e(config('dashboard.config.dashboard_name')); ?></title>
  <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>"><!-- for onchange/update-status -->
  <?php if ($__env->exists('dashboard.partials.header')) echo $__env->make('dashboard.partials.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
</head>
<body class="<?php echo e(config('dashboard.config._dashboard_css_body_class')); ?>"><!-- hold-transition dark-mode sidebar-mini layout-fixed layout-navbar-fixed layout-footer-fixed -->
<div class="wrapper">
  <!-- Navbar -->
  <nav class="<?php echo e(config('dashboard.config._dashboard_css_topnav_class')); ?>">
      <?php if ($__env->exists('dashboard.partials.topnav')) echo $__env->make('dashboard.partials.topnav', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
      <?php if ($__env->exists('dashboard.partials.sidebar')) echo $__env->make('dashboard.partials.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>Content Type List</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active">Content Type List</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
    
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <div class="card">
                
            </div>
          </div>
        </div>

              <div class="card">
                <div class="card-body">
                  <div class="row">
                    <div class="col-12 col-md-12 col-lg-12 order-2 order-md-1">
        
                        <div class="card card-info">
                          <div class="card-header">
                            <h3 class="card-title">Content type management</h3>
                          </div>
                          <!-- /.card-header -->
                            <?php if($errors->has('type_name_en')): ?>
                                <ul>
                                    <?php $__currentLoopData = $errors->get('type_name_en'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <li style="color:red;font-weight:bold;"><?php echo e($error); ?></li>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </ul>
                            <?php endif; ?>
                          <!-- form start -->
                          <form class="form-horizontal" action="<?php echo e(localized_route('dashboard.admin.content.type.post')); ?>" method="post">
                            <?php echo csrf_field(); ?>
                            <div class="card-body">
                              <div class="form-group row">
                                <label for="inputEmail3" class="col-sm-2 col-form-label">Type name th</label>
                                <div class="col-sm-10">
                                  <input type="text" name="type_name_th" class="form-control" placeholder="Type name in th" required>
                                </div>
                              </div>
                              <div class="form-group row">
                                <label for="inputEmail3" class="col-sm-2 col-form-label">Type name en</label>
                                <div class="col-sm-10">
                                  <input type="text" name="type_name_en" class="form-control" placeholder="Type name in en" required>
                                </div>
                              </div>
                            </div>
                            <!-- /.card-body -->
                            <div class="card-footer">
                              <button type="submit" class="btn btn-info">Submit</button>
                              <button type="reset" class="btn btn-danger">Reset</button>
                            </div>
                            <!-- /.card-footer -->
                          </form>
                        </div>
                      
                      <!-- /.card-header -->
                      <div class="card-body">
                        <table id="TypeTableList" class="table table-bordered table-striped">
                          <thead>
                          <tr>
                            <th>No.</th>
                            <th>Type Name TH</th>
                            <th>Type Name EN</th>
                            <th>Type Name Alias</th>
                            <th>Type Url Alias</th>
                            <th>Ordering</th>
                            <th>Status</th>
                            <th>Action</th>
                          </tr>
                          </thead>
                          <tbody>
                                <?php
                                    $indCnt = 1;
                                ?>
                                <?php $__currentLoopData = $typeList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index=>$typeInfo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                      <td><?php echo e($indCnt); ?></td>
                                      <td><?php echo e($typeInfo->type_name_th); ?></td>
                                      <td><?php echo e($typeInfo->type_name_en); ?></td>
                                      <td><?php echo e($typeInfo->type_name_alias); ?></td>
                                      <td><?php echo e($typeInfo->type_url_alias); ?></td>
                                      <td><?php echo e($typeInfo->ordering); ?></td>
                                      <td>
                                          <input name="status_flg" id="status_flg_<?php echo e($indCnt); ?>" class="statusSwitch" data-id="<?php echo e($typeInfo->categoryTypeID); ?>" type="checkbox" <?php echo e($typeInfo->status_flg === 'A' ? 'checked' : ''); ?> data-bootstrap-switch data-off-color="danger" data-on-color="success">
                                      </td>
                                      <td>
                                        <!-- Edit Button -->
                                        <a href="<?php echo e(localized_route('dashboard.admin.content.type.update', ['typeID' => $typeInfo->categoryTypeID])); ?>" class="btn btn-sm btn-primary">
                                            <i class="fas fa-edit"></i>
                                        </a>
        
                                        <!-- Delete Button -->
                                        <form action="<?php echo e(localized_route('dashboard.admin.content.type.delete')); ?>" method="POST" style="display:inline;">
                                            <?php echo csrf_field(); ?>
                                            <input type="hidden" name="categoryTypeID" value="<?php echo e($typeInfo->categoryTypeID); ?>">
                                            <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure?')">
                                                <i class="fas fa-trash-alt"></i>
                                            </button>
                                        </form>
                                      </td>
                                    </tr>
                                    <?php
                                        $indCnt++;
                                    ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        
                          </tbody>
                          <tfoot>
                          <tr>
                            <th>No.</th>
                            <th>Type Name</th>
                            <th>Type Name EN</th>
                            <th>Type Name Alias</th>
                            <th>Type Url Alias</th>
                            <th>Ordering</th>
                            <th>Status</th>
                            <th>Action</th>
                          </tr>
                          </tfoot>
                        </table>
                      </div>
        
                    </div>
                  </div>
                </div>
                <!-- /.card-body -->
              </div>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <strong>Copyright &copy; <?php echo e(config('site.config.copyright')); ?> <a href="<?php echo e(config('site.config._live_site')); ?>"><?php echo e(config('site.config._sitename')); ?></a>.</strong>
    All rights reserved.
    <div class="float-right d-none d-sm-inline-block">
      <b>Version</b> <?php echo e(config('dashboard.config.dashboard_Veresion')); ?> Template <?php echo e(config('dashboard.config._dashboard_template_version')); ?>

    </div>
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/jquery/jquery.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Bootstrap Switch -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script>
<!-- Bootstrap 4 -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables  & Plugins -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/jszip/jszip.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/pdfmake/pdfmake.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/pdfmake/vfs_fonts.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<!-- AdminLTE App -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>dist/js/adminlte.min.js"></script>
<!-- Page specific script -->
<script>
  $(function () {
    $("#TypeTableList").DataTable({
      "responsive": true, "lengthChange": false, "autoWidth": false,
      "lengthMenu": [ [10, 25, 50, 100], [10, 25, 50, 100] ],
      "pageLength": 15,
      "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
    
    $("input[data-bootstrap-switch]").each(function(){
      $(this).bootstrapSwitch('state', $(this).prop('checked'));
    });
    
    $("[name='status_flg']").bootstrapSwitch({
        onText: "ON",
        offText: "OFF",
        inverse: true // flips the switch direction
    });
    $("[name='automatic_tracking_status']").bootstrapSwitch({
        onText: "ON",
        offText: "OFF",
        inverse: true // flips the switch direction
    });
     // Handle change for ALL switches
    $(document).on('switchChange.bootstrapSwitch', '.statusSwitch', function (event, state) {
        let id = $(this).data('id');
        let newState = state ? 1 : 0;
        let checkboxName = $(this).attr('name');
        let StatusColName = (checkboxName === 'automatic_tracking_status') 
            ? 'automatic_tracking_status' 
            : 'status_flg';

        $.ajax({
            url: '/onchange/update-status',
            type: 'POST',
            data: {
                dbTbName:'GCategoryType',//model name
                dbTbColName:'categoryTypeID',
                dbTbStatusColName: StatusColName,
                id: id,
                status: newState,
                _token: $('meta[name="csrf-token"]').attr('content')
            },
            success: function (response) {
console.log(response.message); // "string"
                if (response.success) {
                    //success from Laravel
                    $('#statusModalLabel').text('Success');
                    $('#statusModalBody').text(response.message);
                } else {
                    //Laravel returned success=false (logical error, not HTTP error)
                    $('#statusModalLabel').text('Error');
                    $('#statusModalBody').text(response.message);
                }
                $('#statusModal').modal('show');
            },
            error: function (xhr) {
                //HTTP-level error (404, 500, etc.)
                let errorMsg = xhr.responseJSON?.message || 'Unknown server error';
console.log(errorMsg); // "string"
                $('#statusModalLabel').text('Error');
                $('#statusModalBody').text(errorMsg);
                $('#statusModal').modal('show');
            }
        });
    });
  });
</script>

</body>
</html>
<?php /**PATH /home3/cp260824/public_html/seoezypro.com/resources/views/dashboard/admin/content/type.blade.php ENDPATH**/ ?>