Файловый менеджер - Редактировать - /home/clickysoft/public_html/securebeans.clickysoft.net/resources/views/admin/products/index.blade.php
Назад
@extends('layouts.admin') @section('content') <div class="content"> @if (\Session::has('success')) <p class="alert alert-success"> {!! \Session::get('success') !!} </p> @endif @if (\Session::has('error')) <p class="alert alert-danger"> {!! \Session::get('error') !!} </p> @endif <div id="success"></div> <div id="ul"></div> @can('product_create') <div style="margin-bottom: 10px;" class="row"> <div class="col-lg-12"> <a class="btn btn-success float-right" href="{{ route('admin.products.create') }}"> Add Product </a> </div> </div> @endcan <div class="card"> <div class="card-header"> Products </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered data-table "> <thead> <tr> <th>Id</th> <th>Principal Name</th> <th>Product SKU</th> <th>Product Name</th> <th>Product Description</th> <th width="100px">Action</th> </tr> </thead> <tbody> </table> </div> </div> </div> </div> @endsection @section('scripts') <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" /> --> <link href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet"> <link href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script> <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script> <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script> <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script type="text/javascript"> $(".table").css("width", "100%"); var selected_ids=[]; var check_id=0; let bit=0; $(function () { var table = $('.data-table').DataTable({ processing: false, serverSide: true, ordering:false, ajax: "{{ route('admin.products.index') }}", columns: [ {data: 'id', name: 'id'}, {data: 'principal_name', name: 'principals.principal_name'}, {data: 'product_sku', name: 'product_sku'}, {data: 'product_name', name: 'product_name'}, {data: 'description', name: 'description'}, {data: 'action', name: 'action', orderable: false, searchable: false}, ] }); }); //delete product $(document).on('click','#delete',function(event){ var btn = $(this) btn.addClass('focus-none'); btn.prop('focus',false); Swal.fire({ title: 'Are you sure?', showDenyButton: true, showCancelButton: false, confirmButtonText: 'Yes', denyButtonText: `No`, }).then((result) => { var id = $(this).attr('data-form-id'); if (result.isConfirmed) { document.getElementById('delete-product'+id).submit(); } else if(result.isDenied) { } }) }) $('#delete-selected').on('click',function(e){ var btn = $(this) btn.addClass('focus-none'); btn.prop('focus',false); e.preventDefault(); if(selected_ids.length==0){ alert("Please Select items from list") } else{ if(bit == 0){ Swal.fire({ title: 'Are you sure?', showDenyButton: true, showCancelButton: false, confirmButtonText: 'Yes', denyButtonText: `No`, focusDeny:true }).then((result) => { if (result.isConfirmed) { $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ beforeSend: function() { bit=1; }, type:"delete", url:"{{route('admin.products.massDestroy')}}", data:{ids:selected_ids}, success:function(response){ if(response.status==200){ $('#success').html("<p class='alert alert-success'>Products deleted successfully</p>") // console.log(response) location.reload(); } else{ selected_ids=[] $('#ul').html('') $("input[name='checkbox[]']").each( function () { $(this).prop('checked', false); }) $('#checkbox').prop('checked',false); for(let i=0;i<response.ids_array.length;i++){ var id=response.ids_array[i]; $('#ul').append('<li class="alert alert-danger">Product id '+id+' can not be deleted because it contains license, please remove license first.</li>') } setTimeout(function() { location.reload() }, 2000) } } }) } else if(result.isDenied) { } }) } } }) $('#checkbox').on('click',function(){ if(check_id==0){ check_id=1; selected_ids=[] $("input[name='checkbox[]']").each( function () { $(this).prop('checked', true); var id=$(this).attr('id'); selected_ids.push(id) }); } else{ check_id=0 $("input[name='checkbox[]']").each( function () { selected_ids=[] $(this).prop('checked', false); }); } }) //onchange checkbox $(document).on('change','.checkbox',function(){ if ($(this).is(':checked')) { selected_ids.push($(this).attr("id")) } else{ const index = selected_ids.indexOf($(this).attr('id')); if (index > -1) { selected_ids.splice(index, 1); } } }) function transferFocus(e) { } // $(document).on('focus', '.swal2-deny', transferFocus); // $(document).on('focus', '.swal2-confirm', function(e) { // alert("aaa"); // }); // window.setTimeout(function () { // }, 0); </script> @endsection
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка