/home/brandsfa/bigshoponly.com/resources/views/admin-views/shipping-method/by-seller.blade.php
@extends('layouts.back-end.app')
@push('css_or_js')
<link href="{{dynamicAsset(path: 'public/assets/back-end/vendor/datatables/dataTables.bootstrap4.min.css')}}" rel="stylesheet">
<meta name="csrf-token" content="{{ csrf_token() }}">
@endpush
@section('content')
<div class="content container-fluid __inline-6">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{route('admin.dashboard.index')}}">{{translate('dashboard')}}</a></li>
<li class="breadcrumb-item" aria-current="page">{{translate('shipping_Method_by_Vendor')}}</li>
</ol>
</nav>
<div class="row mt-4">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h5>{{translate('shipping_method_table')}} ( {{translate('suggested')}} )</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"
style="text-align: {{Session::get('direction') === "rtl" ? 'right' : 'left'}};">
<thead>
<tr>
<th scope="col">{{translate('SL')}}#</th>
<th scope="col">{{translate('title')}}</th>
<th scope="col">{{translate('duration')}}</th>
<th scope="col">{{translate('cost')}}</th>
<th scope="col">{{translate('status')}}</th>
<th scope="col" class="__w-50px">{{translate('action')}}</th>
</tr>
</thead>
<tbody>
@foreach($shipping_methods as $k=>$method)
<tr>
<th scope="row">{{$k+1}}</th>
<td>
{{$method['title']}}<br>
{{translate('by')}} : <a
href="{{route('admin.sellers.view',$method->creator_id)}}">{{$method->seller->f_name??""}} {{$method->seller->l_name??""}}</a>
</td>
<td>
{{$method['duration']}}
</td>
<td>
{{\App\Utils\BackEndHelper::usd_to_currency($method['cost']) .\App\Utils\BackEndHelper::currency_symbol()}}
</td>
<td>
<label class="switch">
<input type="checkbox" class="status"
id="{{$method['id']}}" {{$method->status == 1?'checked':''}}>
<span class="slider round"></span>
</label>
</td>
<td>
<div class="dropdown float-right">
<button class="btn btn-seconary btn-sm dropdown-toggle" type="button"
id="dropdownMenuButton" data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<i class="tio-settings"></i>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item"
href="{{route('admin.business-settings.shipping-method.edit',[$method['id']])}}">{{translate('edit')}}</a>
<a class="dropdown-item delete cursor-pointer"
id="{{ $method['id'] }}">{{translate('delete')}}</a>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('script')
<!-- Page level plugins -->
<script src="{{dynamicAsset(path: 'public/assets/back-end/vendor/datatables/jquery.dataTables.min.js')}}"></script>
<script src="{{dynamicAsset(path: 'public/assets/back-end/vendor/datatables/dataTables.bootstrap4.min.js')}}"></script>
<!-- Page level custom scripts -->
<script>
// Call the dataTables jQuery plugin
$(document).ready(function () {
$('#dataTable').DataTable();
});
$(document).on('change', '.status', function () {
var id = $(this).attr("id");
if ($(this).prop("checked") == true) {
var status = 1;
} else if ($(this).prop("checked") == false) {
var status = 0;
}
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
$.ajax({
url: "{{route('admin.business-settings.shipping-method.status-update')}}",
method: 'POST',
data: {
id: id,
status: status
},
success: function () {
toastr.success('{{translate("status_updated_successfully")}}');
}
});
});
$(document).on('click', '.delete', function () {
var id = $(this).attr("id");
Swal.fire({
title: '{{translate("are_you_sure_delete_this")}} ?',
text: "{{translate('you_will_not_be_able_to_revert_this')}}!",
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '{{translate("yes_delete_it")}}!',
cancelButtonText: '{{ translate("cancel") }}',
}).then((result) => {
if (result.value) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
$.ajax({
url: "{{route('admin.business-settings.shipping-method.delete')}}",
method: 'POST',
data: {id: id},
success: function () {
toastr.success('{{translate("shipping_Method_deleted_successfully")}}');
location.reload();
}
});
}
})
});
</script>
@endpush