JS :
<script src="{{ asset('backoffice/global_assets/bootstrap-sweetalert/dist/sweetalert.min.js') }}"></script>
CSS :
<link rel="stylesheet" href="{{ asset('backoffice/global_assets/bootstrap-sweetalert/dist/sweetalert.css') }}">
wep.php:
Route::post(
'delivery-man/deposit_status',
'Admin\DeliveryManMoneyController@depositStatusChange'
)->name('delivery-man.deposit_status');
controller :
public function depositStatusChange(Request $request){
$deposit=DeliveryManCollection::where(
'id', $request->collection_id
)->first();
$deposit->deposit_status=1;
$deposit->update();
return ['msg'=>'Money deposited.'];
}
blade.php :
<td>
@if($row->deposit_status ==1)
<button class="btn btn-danger" >Deposited</button>
@else
<button class="btn btn-danger btn-xs action-button deposit_status_change" data-id=" {{$row->id}}">Deposit
</button>
@endif
</td>
<script type="text/javascript">
$(function(){
$('.deposit_status_change').click(function() {
var collection_id=$(this).data('id');
//console.log(urll)
swal({
title: "Are you sure?",
text: "Press Yes to confirm or press No to cancel.",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes",
cancelButtonText: "No",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm){
if(isConfirm){
$.ajax({
url: "{{ route('delivery-man.deposit_status') }}",
type: 'POST',
data: {
collection_id: collection_id,
_token: "{{ csrf_token() }}"
},
success: function(res){
$.jGrowl(res.msg, {
header: 'Success',
theme: 'alert-bordered alert-styled-left alert-success'
});
location.reload();
},
error: function (data) {
$.jGrowl('Sorry form submission failed. Try again later.', {
header: 'Error',
theme: 'alert-bordered alert-styled-left alert-danger'
});
}
});
}
});
});
});
</script>
Subscribe to:
Post Comments (Atom)
Ajax load lage with laravel.
step-1: HTML <div class="row"> <div class="col-lg-12"> <d...
-
<template > <tr v-for="(item, i) in list"> <td :rowspan="item.same_num" ...
-
HTML: @foreach($user-> as $key => $row) <tr class="{{$row->id}}"> ...
-
HTML <select class="form-control" data-selectField="sales_invoices_customer_id" id="sales_invoices_customer_id...
No comments:
Post a Comment