![]() 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/orders/ |
@extends('layouts.admin.app') @section('stylesheets') <link href="{{ asset('css/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" /> @endsection @section('css') <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <style> .red{ background-color:red !important; } fieldset{ border: 1px solid #ddd !important; margin: 0; min-width: 0; padding: 10px; position: relative; border-radius:4px; background-color:#f5f5f5; padding-left:10px!important; } legend{ font-size:14px; font-weight:bold; margin-bottom: 0px; width: 35%; border: 1px solid #ddd; border-radius: 4px; padding: 5px 5px 5px 10px; background-color: #ffffff; } .search_btn{ margin-top: 11%; } .csv_css_cls{ margin-top: 26px; } .panel1 { margin-bottom: 20px; background-color: #fff; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); } </style> @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"> <div class="panel1 panel-default"> <div class="panel-body"> <fieldset class="col-md-12"> <legend>Filter By</legend> <div class="panel1 panel-default"> <form name="training_filter" id="training_filter" action="{{route('admin.orders.filter')}}" method="get" class=""> <div class="panel-body"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="">From</label> <input type="text" name="from_date" readonly autocomplete="off" id="datepicker1" class="form-control input-lg" value="<?php if(isset($filter_data) && !empty($filter_data['from_date'])){ echo date("d-m-Y",strtotime($filter_data['from_date'])); } ?>" > </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="">To</label> <input type="text" name="to_date" readonly autocomplete="off" id="datepicker2" class="form-control input-lg" value="<?php if(isset($filter_data) && !empty($filter_data['to_date'])){ echo date("d-m-Y",strtotime($filter_data['to_date'])); } ?>"> </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="">Order Status</label> <select name="order_status" id="order_status" class="form-control input-lg custom-select"> <option value="">Choose Option</option> <?php if(isset($filter_data)){ ?> <option <?php if(isset($filter_data['order_status']) && $filter_data['order_status'] == '0'){ echo "selected"; } ?> value="0">Pending</option> <option <?php if(isset($filter_data['order_status']) && $filter_data['order_status'] == '1'){ echo "selected"; } ?> value="1">Completed</option> <?php } else{ ?> <option value="0">Pending</option> <option value="1">Completed</option> <?php } ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="">Payment Status</label> <select name="payment_status" id="payment_status" class="form-control input-lg custom-select"> <option value="">Choose Option</option> <?php if(isset($filter_data)){ ?> @foreach($orderStatuses as $payment) <option <?php if(isset($filter_data['payment_status']) && $filter_data['payment_status'] == $payment->id){ echo "selected"; } ?> value="{{$payment->id}}">{{ucwords($payment->name)}}</option> @endforeach <?php } else{ ?> @foreach($orderStatuses as $payment) <option value="{{$payment->id}}">{{ucwords($payment->name)}}</option> @endforeach <?php } ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="">Driver</label> <select name="driver" id="driver" class="form-control input-lg custom-select"> <option value="">Choose Option</option> <option value="0" <?php if(isset($filter_data['driver']) && $filter_data['driver'] == 0){ echo "selected"; } ?>>Unassigned</option> @foreach($drivers as $driver) <?php if(isset($filter_data)){ ?> <option value="{{$driver->id}}" <?php if(isset($filter_data['driver']) && $filter_data['driver'] == $driver->id){ echo "selected"; } ?> >{{ $driver->name}}</option> <?php } else{ ?> <option value="{{$driver->id}}" >{{ $driver->name}}</option> <?php } ?> @endforeach </select> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <button type="submit" class="btn btn-dark btn-lg btn-block"><i class="fa fa-search"></i> Search</button> </div> </div> <div class="col-md-6"> <div class="form-group"> <a href="{{ route('admin.orders.index') }}" class="btn btn-default btn-lg btn-block"><i class="fa fa-refresh"> Reset</i></a> </div> </div> </div> </div> </form> </div> </fieldset> <div class="clearfix"></div> </div> </div> <h3 class="bold">Oil Orders <span class="font-black">|</span> <a href="{{ route('admin.orders.new.oilorder') }}" class="btn btn-dark">+ Add New</a> <small>- all oil quotations</small></h3> <ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" href="#Outstanding">Outstanding</a></li> <li><a data-toggle="tab" href="#Completed">Completed</a></li> </ul> <div class="tab-content"> <div id="Outstanding" class="tab-pane fade in active"> <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="order_table2"> <thead class="thead-dark"> <tr> <th scope="col" class="all">ID</th> <th scope="col" class="desktop">Customer</th> <th scope="col" class="desktop">Address</th> <th scope="col" class="min-mobile-l">Products</th> <th scope="col" class="min-tablet-l">Date</th> <th scope="col" class="min-tablet-l">Total</th> <th scope="col" class="min-mobile-l">P.Status</th> <th scope="col" class="min-tablet-l">O.Status</th> <th scope="col" class="desktop">Delivery</th> <th scope="col" class="desktop">Driver</th> <th scope="col" class="min-mobile-l">Action</th> </tr> </thead> <tbody> </tbody> </table> </div> <div id="Completed" class="tab-pane fade"> <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="order_table_completed"> <thead class="thead-dark"> <tr> <th scope="col" class="all">ID</th> <th scope="col" class="desktop">Customer</th> <th scope="col" class="desktop">Address</th> <th scope="col" class="min-mobile-l">Products</th> <th scope="col" class="min-tablet-l">Date</th> <th scope="col" class="min-tablet-l">Total</th> <th scope="col" class="min-mobile-l">P. Status</th> <th scope="col" class="min-tablet-l">O. Status</th> <th scope="col" class="desktop">Delivery</th> <th scope="col" class="desktop">Driver</th> <th scope="col" class="min-mobile-l">Action</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div> </div> </div> </section> </div> </div> @if($orders) <div class="row"> <div class="col-md-12"> <section class="content"> <div class="box"> <div class="box-body"> <div class="col-md-12"> <h3 class="bold">Product Orders <span class="font-black">|</span> <a href="{{ route('admin.orders.new.productorder') }}" class="btn btn-dark">+ Add New</a> <small>- all products bought through the shop</small></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">ID</th> <th scope="col" class="min-mobile-l">Products</th> <th scope="col" class="min-tablet-l">Date</th> <th scope="col" class="min-tablet-l">Customer</th> <th scope="col" class="min-tablet-l">Total</th> <th scope="col" class="min-mobile-l">Status</th> <th scope="col" class="min-mobile-l">Action</th> </tr> </thead> <tbody> @foreach ($orders as $order) <tr> <td class="dtr-control">{{$order->id}}</td> <td> @if( isset( $order->products ) ) @php $orderCount = $order->products->count(); @endphp @php $orderCounter = 1; @endphp @foreach( $order->products as $product ) <a title="Show order" href="{{ route('admin.orders.show', $order->id) }}">{{ $product->name }}</a> ({{$product['pivot']['quantity']}}){{ ( $orderCounter < $orderCount ) ? ', ': '' }}</a> @php $orderCounter++; @endphp @endforeach @endif </td> <td data-sort="{{ date('Ymd', strtotime($order->created_at)) }}">{{ date('d/m/Y h:i a', strtotime($order->created_at)) }}</td> <td>{{$order->customer->name}}</td> <td>{{ config('cart.currency_symbol') }}{{ $order->total_paid }}</td> <td><span class="badge font-badge @if($order->status->name == 'paid') badge-success @elseif($order->status->name == 'pending') badge-warning @elseif($order->status->name == 'awaiting payment') badge-awaiting @elseif($order->status->name == 'error') badge-danger @else @endif">{{ $order->status->name }}</span></td> <td> <form action="{{ route('admin.order.destroy', [$order->id]) }}" method="post" id="remove-from-form" class="form-horizontal"> <input type="hidden" name="id" value="{{ $order->id }}"> {{ csrf_field() }} <input type="hidden" name="_method" value="delete"> <div class="btn-group"> <a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-default"><i class="fa fa-eye"></i> View</a> <button id="{{ $order->id }}" type="submit" title="Delete" class="btn btn-danger delete_submit" {{ ( $order->status->name == 'pending' || $order->status->name == 'awaiting payment') ? '': 'disabled' }}><i class="fa fa-times"></i> Delete</button> </div> </form> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </section> </div> </div> @endif @endsection @section('js') <script src="{{ asset('js/sweetalert2.all.min.js') }}"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script type="text/javascript"> $(document).ready( function () { $.fn.DataTable.ext.pager.numbers_length = 5; $('#order_table').DataTable({ "responsive": true, "order": [[ 0, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "130px", "targets": 6 } ] }); // $('#order_table2').DataTable({ // "responsive": true, // "order": [[ 0, "desc" ]], // "bAutoWidth": false, // "rowReorder": { // selector: 'td:nth-child(2)' // }, // "columnDefs": [ // { "width": "130px", "targets": 2 }, // { "width": "130px", "targets": 10 } // ] // }); $('#order_table2').DataTable({ "responsive": true, "processing": true, "serverSide": true, "ajax":{ "url": "{{ url('admin/server-pagination') }}", "dataType": "json", "type": "POST", "data":{ _token: "{{csrf_token()}}","from_date" : "{{ isset($filter_data['from_date']) ? $filter_data['from_date'] : ''}}","to_date" : "{{ isset($filter_data['to_date']) ? $filter_data['to_date'] : ''}}","order_status" : "{{ isset($filter_data['order_status']) ? $filter_data['order_status'] : ''}}","payment_status" : "{{ isset($filter_data['payment_status']) ? $filter_data['payment_status'] : ''}}","driver" : "{{ isset($filter_data['driver']) ? $filter_data['driver'] : ''}}"} }, "columns": [ { "data": "id" }, { "data": "customerName" }, { "data": "customerAdd" }, { "data": "quantity" }, { "data": "created-at" }, { "data": "total" }, { "data": "status" }, { "data": "order_status" }, { "data": "delivery_date" }, { "data": "driver_name" }, { "data": "actions" }, ], createdRow: function( row, data, dataIndex ) { if(data.driver_name == ''){ $( row ).find('td:eq(9)').addClass('redbg'); } // Set the data-status attribute, and add a class $( row ).find('td:eq(0)').addClass('dtr-control'); }, "order": [[ 0, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "130px", "targets": 1 }, { "width": "130px", "targets": 2 }, { "width": "130px", "targets": 10 } ] }); // $('#order_table_completed').DataTable({ // "responsive": true, // "order": [[ 0, "desc" ]], // "bAutoWidth": false, // "rowReorder": { // selector: 'td:nth-child(2)' // }, // "columnDefs": [ // { "width": "130px", "targets": 2 }, // { "width": "130px", "targets": 10 } // ] // }); $('#order_table_completed').DataTable({ "responsive": true, "processing": true, "serverSide": true, "ajax":{ "url": "{{ url('admin/completed-orders') }}", "dataType": "json", "type": "POST", "data":{ _token: "{{csrf_token()}}","from_date" : "{{ isset($filter_data['from_date']) ? $filter_data['from_date'] : ''}}","to_date" : "{{ isset($filter_data['to_date']) ? $filter_data['to_date'] : ''}}","order_status" : "{{ isset($filter_data['order_status']) ? $filter_data['order_status'] : ''}}","payment_status" : "{{ isset($filter_data['payment_status']) ? $filter_data['payment_status'] : ''}}","driver" : "{{ isset($filter_data['driver']) ? $filter_data['driver'] : ''}}"} }, "columns": [ { "data": "id" }, { "data": "customerName" }, { "data": "customerAdd" }, { "data": "quantity" }, { "data": "created-at" }, { "data": "total" }, { "data": "status" }, { "data": "order_status" }, { "data": "delivery_date" }, { "data": "driver_name" }, { "data": "actions" }, ], createdRow: function( row, data, dataIndex ) { if(data.driver_name == ''){ $( row ).find('td:eq(9)').addClass('redbg'); } // Set the data-status attribute, and add a class $( row ).find('td:eq(0)').addClass('dtr-control'); }, "order": [[ 0, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "130px", "targets": 1 }, { "width": "130px", "targets": 2 }, { "width": "130px", "targets": 10 } ] }); $('.delete_submit').on('click',function(e) { var refer = $(this).attr("id"); var step_remove_url = $(this).closest("#remove-from-form").attr('action'); 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 order 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); } }); } }); } }); $( "#datepicker1" ).datepicker({ dateFormat: 'dd-mm-yy' }); $( "#datepicker2" ).datepicker({ dateFormat: 'dd-mm-yy' }); }); </script> @endsection