Changes
This commit is contained in:
@@ -320,7 +320,6 @@ Use : To Update status of restaurant.
|
||||
*/
|
||||
public function updateRestaurantStatus(Request $request)
|
||||
{
|
||||
dd($request);
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$voucher_data = ManageRestaurant::where('id', $request->dataId)->first();
|
||||
|
||||
@@ -34,9 +34,6 @@ class CustomerJwtMiddleware
|
||||
|
||||
// Check if authentication was successful and user type is correct
|
||||
|
||||
Log::info("Customer jwt");
|
||||
Log::info($user);
|
||||
|
||||
if (!$user || $user->principal_type_xid != 3) {
|
||||
return response()->json(['status' => 'error', 'status_code' => 401, 'message' => 'Unauthorized access'], 401);
|
||||
}
|
||||
@@ -44,7 +41,7 @@ class CustomerJwtMiddleware
|
||||
Log::info($user);
|
||||
Log::info($user->principal_type_xid);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Session::flash('vendorToken', $token);
|
||||
|
||||
@@ -114,20 +114,20 @@
|
||||
<ul class="random_cl">
|
||||
<li class="tooltip-element {{ $currentPage == 'manage-customer' ? 'active' : '' }}"
|
||||
data-tooltip="1">
|
||||
<a href="{{ route('manage.customer') }}" data-active="1">Customer App
|
||||
<a href="{{ route('manage.customer') }}" data-active="1" class="text">Customer App
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tooltip-element {{ $currentPage == 'manage-restaurant_app' ? 'active' : '' }}"
|
||||
data-tooltip="1">
|
||||
<a href="{{ route('restraunt_users') }}" data-active="1">Restaurant App
|
||||
<a href="{{ route('restraunt_users') }}" data-active="1" class="text">Restaurant App
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="tooltip-element {{ $currentPage == 'sub-admins' ? 'active' : '' }}"
|
||||
data-tooltip="1">
|
||||
<a href="{{ route('manage.subAdmin') }}" data-active="1">Sub Admins
|
||||
<a href="{{ route('manage.subAdmin') }}" data-active="1" class="text">Sub Admins
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
|
||||
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
|
||||
<div class="widget-content widget-content-area br-8 position-btn" style="overflow: auto;">
|
||||
<form action="{{ route('export-selected-restaurant') }}" method="POST" id="restaurant-form">
|
||||
@csrf
|
||||
@@ -54,8 +54,8 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check form-check-sm form-check-custom form-check-solid">
|
||||
<input class="form-check-input" type="checkbox" name="restaurant_ids"
|
||||
value="{{ $restaurants->id }}" />
|
||||
<input class="form-check-input restaurant-checkbox" type="checkbox"
|
||||
name="restaurant_ids" value="{{ $restaurants->id }}" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">{{ $count }}</td>
|
||||
@@ -82,7 +82,8 @@
|
||||
</button>
|
||||
<ul>
|
||||
<li>
|
||||
<a href={{ route('manage_view_restaurant', $restaurants->id) }}>
|
||||
<a
|
||||
href={{ route('manage_view_restaurant', $restaurants->id) }}>
|
||||
<img src="{{ asset('public/assets/img/view.svg') }}" />
|
||||
<span>View</span>
|
||||
</a>
|
||||
@@ -117,15 +118,16 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="delete-restaurant-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
@@ -174,7 +176,7 @@
|
||||
@section('section_script')
|
||||
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
|
||||
<script>
|
||||
$('#zero-config').DataTable({
|
||||
var table = $('#zero-config').DataTable({
|
||||
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
|
||||
"<'table-responsive'tr>" +
|
||||
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
|
||||
@@ -222,55 +224,61 @@
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#status-change input[type="checkbox"]').on('change', function() {
|
||||
var dataId = $(this).data('id');
|
||||
var isChecked = $(this).is(':checked');
|
||||
|
||||
// Perform actions based on the dataId and isChecked values
|
||||
var status = isChecked ? '1' : '0';
|
||||
updateStatusOfVoucher(status, dataId);
|
||||
if (isChecked) {
|
||||
// console.log('Switch with data-id ' + dataId + ' is checked.');
|
||||
// Perform additional logic for checked state
|
||||
} else {
|
||||
// console.log('Switch with data-id ' + dataId + ' is unchecked.');
|
||||
// Perform additional logic for unchecked state
|
||||
}
|
||||
|
||||
function bindStatusChangeHandler() {
|
||||
$('input[type="checkbox"][name="status"]').on('change', function() {
|
||||
var dataId = $(this).data('id');
|
||||
var isChecked = $(this).is(':checked');
|
||||
|
||||
// Perform actions based on the dataId and isChecked values
|
||||
var status = isChecked ? '1' : '0';
|
||||
updateStatusOfRestaurant(status, dataId);
|
||||
});
|
||||
}
|
||||
|
||||
function updateStatusOfRestaurant(status, dataId) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: "{{ route('update_status_of_restaurant') }}",
|
||||
method: 'POST',
|
||||
data: {
|
||||
status: status,
|
||||
dataId: dataId
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.status_code == 200) {
|
||||
toastr.success('Restaurant Status Updated Successfully');
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('manage.restaurants') }}";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('manage.restaurants') }}";
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle errors if needed
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Bind change event handler initially
|
||||
bindStatusChangeHandler();
|
||||
|
||||
// Bind change event handler on table draw (pagination, search, etc.)
|
||||
table.on('draw', function() {
|
||||
bindStatusChangeHandler();
|
||||
});
|
||||
});
|
||||
|
||||
function updateStatusOfVoucher(status, dataId) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: "{{ route('update_status_of_restaurant') }}",
|
||||
method: 'POST',
|
||||
data: {
|
||||
status: status,
|
||||
dataId: dataId
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.status_code == 200) {
|
||||
toastr.success('Restaurant Status Updated Sucessfully');
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('manage.restaurants') }}";
|
||||
}, 2000);
|
||||
} else {
|
||||
toastr.error('Something Went Wrong');
|
||||
setTimeout(function() {
|
||||
window.location.href = "{{ route('manage.restaurants') }}";
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle errors if needed
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user