![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/resources/views/admin/discountcoupon/ |
@extends('layouts.admin.app') @section('stylesheets') <link href="{{ asset('css/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" /> @endsection @section('content') <div class="row"> <div class="col-md-12"> <section class="content"> @include('layouts.errors-and-messages') <div class="box"> <div class="box-body"> <div class="col-md-12"> <h3 class="bold">Discount Coupons <span class="font-black">|</span> <a href="{{ route('admin.discountcoupons.create') }}" class="btn btn-dark">+ Add New</a></h3> <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="order_table"> <thead class="thead-dark"> <tr> <th scope="col" class="all">Coupon Code</th> <th scope="col" class="min-tablet-l">Discount Value</th> <th scope="col" class="desktop">Discount Type</th> <th scope="col" class="min-tablet-l">Expires</th> <th scope="col" class="desktop">Description</th> <th scope="col" class="min-mobile-l">Status</th> <th scope="col" class="min-mobile-l">Action</th> </tr> </thead> <tbody> @if( $discount_coupons ) @php $count = 1; @endphp @foreach( $discount_coupons as $discount_coupon ) <tr> <td class="dtr-control">{{ $discount_coupon->coupon_code }}</td> <td>{{ ( $discount_coupon->coupon_type == 1 ) ? $discount_coupon->discount_value : $discount_coupon->discount_value }}</td> <td>{{ ( $discount_coupon->coupon_type == 1 ) ? 'Percentage' : 'Fixed Amount' }}</td> <td data-sort="{{ date('Ymd', strtotime($discount_coupon->valid_upto)) }}">{{ date('d/m/Y', strtotime($discount_coupon->valid_upto)) }}</td> <td>{{ $discount_coupon->description }}</td> <td>@if ($discount_coupon->status == 1 ) <span class="badge font-badge badge-success">Enabled</span> @else <span class="badge font-badge badge-danger">Disabled</span> @endif </td> <td> {!! Form::open(['method' => 'post', 'route' => ['admin.discountcoupons.destroy'], 'id' => 'remove-from-form']) !!} <input type="hidden" name="id" value="{{ $discount_coupon->id }}"> {{ csrf_field() }} <input type="hidden" name="_method" value="delete"> <div class="btn-group"> <a href="{{ route('admin.discountcoupons.edit', $discount_coupon->id) }}" class="btn btn-dark"><i class="fa fa-pencil"></i> Edit</a> <input type="hidden" name="id" value="{{ $discount_coupon->id }}"> <button id="{{ $discount_coupon->id }}" type="submit" class="btn btn-danger delete_submit"><i class="fa fa-times"></i> Delete</button> </div> {!! Form::close() !!} </td> </tr> @php $count++; @endphp @endforeach @endif </tbody> </table> </div> </div> </div> </section> </div> </div> @endsection @section('js') <script src="{{ asset('js/sweetalert2.all.min.js') }}"></script> <script type="text/javascript"> $(document).ready( function () { $.fn.DataTable.ext.pager.numbers_length = 5; $('#order_table').DataTable({ "responsive": true, "order": [[ 0, "asc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "130px", "targets": 6 } ] }); $('.delete_submit').on('click',function(e) { var refer = $(this).attr("id"); var step_remove_url = $(this).closest("#remove-from-form").attr('action'); console.log('refer: '+refer); console.log('url: '+step_remove_url); e.preventDefault(); e.stopPropagation(); if (refer != '') { Swal.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then((result) => { if (result.value) { Swal.fire({ title: 'Deleted!', text: "Your discount coupon has been deleted.", type: 'success', showConfirmButton: false, timer: 1500 }); $.ajax({ url: step_remove_url, method: "POST", data: { "_token": "{{ csrf_token() }}", "_method": "delete", id: refer }, success:function(response){ setTimeout(function(){ window.location.reload(); }, 1500); } }); } }); } }); }); </script> @endsection