![]() 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/customers/ |
@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"> <div class="box"> <div class="box-body"> <div class="col-md-12"> <h3 class="bold">Customers Details</h3> <div class="jumbotron"> <div class="row"> <div class="col-md-4 col-xs-12 col-sm-6 col-lg-4"> <div class="col-md-12 initialsadded"> <div class="kt-widget__media"> <span class="kt-badge kt-badge--username kt-badge--unified-success kt-badge--lg kt-badge--rounded kt-badge--bold">@if(!empty($customer->fname)){{ strtoupper($customer->fname[0].$customer->lname[0]) }}@endif</span> </div> </div> </div> <div class="col-md-5 col-xs-12 col-sm-6 col-lg-5"> <div class="container" style="border-bottom:1px solid #ccc"> <h2><a href="{{ route('admin.customers.show', $customer->id) }}">{{$customer->name}}</a></h2> </div> <ul class="container details"> <li><p><span class="fa fa-phone one" style="width:50px;"></span>@if($customer->phone){{$customer->phone}}@else{{('n/a')}}@endif</p></li> <li><p><span class="fa fa-envelope one" style="width:50px;"></span>{{$customer->email}}</p></li> <li><p><span class="fa fa-calendar one" style="width:50px;"></span>Registered: {{ date('d/m/Y @ h:i a', strtotime($customer->created_at)) }}</p></li> <li><p><span class="fa fa-bell one" style="width:50px;"></span>Status: <span class="badge font-badge @if($customer->status == 1) badge-success @else badge-danger @endif">@if($customer->status == 1) enabled @else disabled @endif</span></p></li> </ul> </div> <div class="col-md-3 col-xs-12 col-sm-12 col-lg-3"> <div class="container margin-top-30"> <div class="btn-margin-top"><a href="{{ route('admin.customers.edit', $customer['id']) }}" class="btn btn-dark btn-block btn-with-icon"><i class="fa fa-pencil"></i> Edit</a></div> <form action="{{ route('admin.customers.destroy', $customer['id']) }}" method="post" id="remove-from-form" class="form-horizontal"> <input type="hidden" name="row_id" id="" value="{{ $customer['id'] }}"> {{ csrf_field() }} <input type="hidden" name="_method" value="delete"> @if(count($orders) > 0) <div class="btn-margin-top"><button class="btn btn-danger btn-block btn-with-icon" id="btn_delete_order" disabled><i class="fa fa-trash"></i> Delete</button></div> @else <div class="btn-margin-top"><button type="submit" class="btn btn-danger btn-block btn-with-icon" id="btn_delete_order"><i class="fa fa-trash"></i> Delete</button></div> @endif </form> </div> </div> </div> </div> </div> </div> </div> </section> </div> </div> <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">Addresses</h3> <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="addresses_table"> <thead class="thead-dark"> <tr> <th scope="col" class="all">Address</th> <th scope="col" class="min-tablet-l">Type</th> <th scope="col" class="min-tablet-l">Town</th> <th scope="col" class="min-tablet-l">County</th> <th scope="col" class="min-tablet-l">Eircode</th> <th scope="col" class="min-tablet-l">Status</th> <th scope="col" class="min-mobile-l">Actions</th> </tr> </thead> <tbody> @foreach ($addresses as $address) <tr> <td class="dtr-control">{{ $address->address_1 }}@if (!empty($address->address_2)), {{$address->address_2 }} @endif</td> <td>{{ ($address->billing_type_address == 1) ? 'Billing': 'Delivery' }}</td> <td>{{ $address->town }}</td> <td>{{ $address->county }}</td> <td>{{ $address->zip }}</td> <td><span class="badge font-badge @if($address->status != '1') badge-danger @else badge-success @endif">@if($address->status != '1') disabled @else enabled @endif</span></td> <td> <form action="{{ route('admin.addresses.destroy', $address->id) }}" method="post" id="remove-addr-form" class="form-horizontal"> <input type="hidden" name="id" value="{{ $address->id }}"> {{ csrf_field() }} <input type="hidden" name="_method" value="delete"> <div class="btn-group"> <a href="{{ route('admin.addresses.edit', $address->id) }}" class="btn btn-dark"><i class="fa fa-pencil"></i> Edit</a> <button id="{{ $address->id }}" type="submit" title="Delete" class="btn btn-danger addr_delete_submit" {{ ($address->billing_type_address == 1) ? 'disabled': '' }}><i class="fa fa-trash"></i> Delete</button> </div> </form> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </section> </div> </div> <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">Order History</h3> <table class="table table-striped table-hover table-checkable dataTable table-responsive table-responsive-md responsive" id="orders_table"> <thead class="thead-dark"> <tr> <th scope="col" class="all">ID</th> <th scope="col" class="min-tablet-l">Products</th> <th scope="col" class="min-tablet-l">Date</th> <th scope="col" class="min-mobile-l">Driver</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> @php $orderCount = count($order['products']); @endphp @php $orderCounter = 1; @endphp @foreach ($order['products'] as $product) @if(isset($product['cover'])) <img src="{{ URL::asset('/public/storage/'.$product['cover']) }}" style="height: 15px;width: 15px; margin-right:5px" /> @else <img src="{{ url('/images/default.jpg') }}" style="height: 15px;width: 15px; margin-right:5px" />@endif {{$product['name']}} (@if(empty($product['pivot']['quantity'])){{ ('Fill the Tank') }}@else{{ $product['pivot']['quantity'] }}@endif){{ ( $orderCounter < $orderCount ) ? ', ': '' }} @php $orderCounter++; @endphp @endforeach </td> <td data-sort="{{ date('Ymd', strtotime($order['created_at'])) }}">{{ date('M d, Y h:i a', strtotime($order['created_at'])) }}</td> <td @if(empty($order['driver_id']) && ($order['oil_type_order']))class="redbg"@endif >@if(!empty($order['driver_id']))<a href="{{url('admin/driver/'.$order['driver_id'])}}">{{$order['driver_name']}}</a>@endif</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="_method" value="delete"> <input type="hidden" id="redirection_url" name="redirection_url" value="customers"> <input type="hidden" name="id" value="{{ $order['id'] }}"> {{ csrf_field() }} <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-trash"></i> Delete</button> </div> </form> </td> </tr> @endforeach </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; $('#details_table').DataTable({ "responsive": true, "order": [[ 1, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' } }); $('#addresses_table').DataTable({ "responsive": true, "order": [[ 1, "asc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "130px", "targets": 6 } ] }); $('#orders_table').DataTable({ "responsive": true, "order": [[ 0, "desc" ]], "bAutoWidth": false, "rowReorder": { selector: 'td:nth-child(2)' }, "columnDefs": [ { "width": "130px", "targets": 6 } ] }); $('.addr_delete_submit').on('click',function(e) { var refer = $(this).attr("id"); var step_remove_url = $(this).closest("#remove-addr-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 address 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); } }); } }); } }); $('.delete_submit').on('click',function(e) { var redirection_url = $(this).closest("#remove-from-form").find('#redirection_url').val(); 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", redirection_url: redirection_url, id: refer }, success:function(response){ setTimeout(function(){ window.location.reload(); }, 1500); } }); } }); } }); }); </script> @endsection