<!DOCTYPE html>
<html lang="<?php echo e(str_replace('_', '-', app()->getLocale())); ?>">
<head>
  <title><?php echo e(config('dashboard.config.dashboard_name')); ?> Menu List</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="main-header navbar navbar-expand navbar-white navbar-light">
      <?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>Update Content type : </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">Menu List</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

      <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">Edit menu</h3>
                  </div>
                  <!-- /.card-header -->
                    <?php if($errors->any()): ?>
                        <ul>
                            <?php $__currentLoopData = $errors->all(); $__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(); ?>
                    <input type="hidden" name="mode" value="update">
                    <input type="hidden" name="typeID" value="<?php echo e($editTypeInfo->categoryTypeID); ?>">
                    <div class="card-body">
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Status</label>
                        <div class="col-sm-10">
                          <input name="status_flg" id="status_flg_<?php echo e($editTypeInfo->categoryTypeID); ?>" class="statusSwitch" data-id="<?php echo e($editTypeInfo->categoryTypeID); ?>" type="checkbox" <?php echo e($editTypeInfo->status_flg === 'A' ? 'checked' : ''); ?> data-bootstrap-switch data-off-color="danger" data-on-color="success">
                        </div>
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Ordering</label>
                        <div class="col-sm-10">
                          <input name="ordering" value="<?php echo e($editTypeInfo->ordering); ?>" id="ordering" type="text" class="form-control" placeholder="0, 1 or number" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Name TH</label>
                        <div class="col-sm-10">
                          <input type="text" name="type_name_th" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_name_th); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Name EN</label>
                        <div class="col-sm-10">
                          <input type="text" name="type_name_en" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_name_en); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Name Alias</label>
                        <div class="col-sm-10">
                          <input type="text" name="type_name_alias" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_name_alias); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type URL Alias </label>
                        <div class="col-sm-10">
                          <input type="text" name="type_url_alias" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_url_alias); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Page Title TH</label>
                        <div class="col-sm-10">
                          <input type="text" name="type_page_title_th" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_page_title_th); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Page Title EN</label>
                        <div class="col-sm-10">
                          <input type="text" name="type_page_title_en" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_page_title_en); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Meta Keyword TH</label>
                        <div class="col-sm-10">
                          <input type="text" name="type_meta_keyword_th" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_meta_keyword_th); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Meta Keyword EN</label>
                        <div class="col-sm-10">
                          <input type="text" name="type_meta_keyword_en" class="form-control" placeholder="your-website.com or subdomain.your-website.com" value="<?php echo e($editTypeInfo->type_meta_keyword_en); ?>" required>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Meta Description TH</label>
                        <div class="col-sm-10">
                            <textarea  id="type_meta_description_th" name="type_meta_description_th" class="form-control" rows="3" placeholder="กรุณาเพิ่มข้อมูล ภาษาไทย"><?php echo e($editTypeInfo->type_meta_description_th); ?></textarea>
                        </div>
                      </div>
                      <div class="form-group row">
                        <label for="inputEmail3" class="col-sm-2 col-form-label" style="text-align:right;">Type Meta Description EN</label>
                        <div class="col-sm-10">
                            <textarea  id="type_meta_description_en" name="type_meta_description_en" class="form-control" rows="3" placeholder="Enter Meta Description English"><?php echo e($editTypeInfo->type_meta_description_en); ?></textarea>
                        </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>
                Back to type list
            </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>
<!-- Summernote -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/summernote/summernote-bs4.min.js"></script>
<!-- CodeMirror -->
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/codemirror/codemirror.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/codemirror/mode/css/css.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/codemirror/mode/xml/xml.js"></script>
<script src="<?php echo e(config('dashboard.config._dashboard_main_path')); ?>plugins/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<!-- Page specific script -->
<script>
  $(function () {
    $("#example1").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>
<!-- Page specific script -->
<script>
  $(function () {
    // Summernote
        $('#type_meta_description_th').summernote();
    $('#type_meta_description_en').summernote();

    // CodeMirror
//    CodeMirror.fromTextArea(document.getElementById("codeMirrorDemo"), {
//      mode: "htmlmixed",
//      theme: "monokai"
//    });
  })
</script>
</body>
</html>
<?php /**PATH /home3/cp260824/public_html/seoezypro.com/resources/views/dashboard/admin/content/typeUpdate.blade.php ENDPATH**/ ?>