restchanges

This commit is contained in:
sayaliparab
2024-07-22 19:54:00 +05:30
parent 362036606d
commit cca6aefd5c
2 changed files with 107 additions and 6 deletions

View File

@@ -173,7 +173,7 @@ $currentPage = 'manage-restaurant_app';
</table>
</form> -->
<form action="{{ route('export-selected-restaurantApp') }}" method="POST" id="restaurant-form">
<form action="{{ route('export-selected-restaurantApp')}}" method="POST" id="restaurant-form">
@csrf
<input type="hidden" name="selected_id" id="selected_ids" disabled>
<input type="hidden" name="all_id" id="all_id" value="all" disabled>
@@ -414,6 +414,8 @@ $currentPage = 'manage-restaurant_app';
}
</script>
<script>
$(document).on('click', "#delete_restaurant_user_id", function() {
var delete_restaurant_user_id = $(this).data('id');
@@ -453,12 +455,18 @@ $currentPage = 'manage-restaurant_app';
});
});
</script>
<script>
<!-- <script>
//old code start
$(document).ready(function() {
// Handle approve button click
$(".approve-btn").on("click", function() {
// alert('sdjdh');
let base_url = url_path;
var rest_user_id = $(this).data("id");
// console.log(rest_user_id);
// return;
var switchElement = $('#switch' + rest_user_id);
// Check current status
@@ -537,8 +545,96 @@ $currentPage = 'manage-restaurant_app';
toastr.error("You can only change the status using Approve/Disapprove buttons.");
});
});
</script>
//old code is empty
</script> -->
<script>
$(document).ready(function() {
// Handle approve button click
$(".approve-btn").on("click", function(e) {
e.preventDefault(); // Prevent form submission
let base_url = url_path;
var rest_user_id = $(this).data("id");
var switchElement = $('#switch' + rest_user_id);
// Check current status
if (switchElement.prop('checked')) {
toastr.options = {
"timeOut": 500
}
toastr.warning("User is already approved. !!");
return;
}
$.ajax({
type: "GET",
dataType: "json",
url: base_url + '/change_rest_status',
data: {
status: 1,
rest_user_id: rest_user_id,
},
success: function(data) {
toastr.options = {
"timeOut": 500
}
toastr.success("User approved and status activated successfully. !!");
// Update the switch to active
switchElement.prop('checked', true);
},
});
});
// Handle disapprove button click
$(".disapprove-btn").on("click", function(e) {
e.preventDefault(); // Prevent form submission
let base_url = url_path;
var rest_user_id = $(this).data("id");
var switchElement = $('#switch' + rest_user_id);
// Check current status
if (!switchElement.prop('checked')) {
toastr.options = {
"timeOut": 500
}
toastr.warning("User is already disapproved. !!");
return;
}
$.ajax({
type: "GET",
dataType: "json",
url: base_url + '/change_rest_status',
data: {
status: 0,
rest_user_id: rest_user_id,
},
success: function(data) {
toastr.error("User disapproved and status deactivated successfully. !!");
// Update the switch to inactive
switchElement.prop('checked', false);
},
});
});
// Handle switch change
$(".rest_users_table").on("change", ".active_rest_user", function() {
// Revert the switch change
var currentStatus = $(this).prop("checked");
// Revert the switch state
$(this).prop("checked", !currentStatus);
toastr.options = {
"timeOut": 500
}
toastr.error("You can only change the status using Approve/Disapprove buttons.");
});
});
</script>
<script>
@@ -603,6 +699,10 @@ $(function (e) {
}, 5000); // Adjust the timeout as needed
});
});
</script>
</script>
@endsection

View File

@@ -219,12 +219,13 @@ Route::group(['middleware' => ['checkStatus']], function () {
Route::get('/change_location_status', [ManageLocationController::class, 'change_location_status']);
Route::delete('/delete_location/{id}', [ManageLocationController::class, 'delete_location']);
Route::post('/update_location', [ManageLocationController::class, 'update_location']);
//*******************************************************Rules and regulation********************************************************
//*******************************************************manage redemptions rules********************************************************
Route::get('/manage_rules', [ManageRulesController::class, 'index'])->name('manage_rules');
Route::get('/rules_edit/{id}', [ManageRulesController::class, 'edit'])->name('rules_edit');
Route::post('/update_rules', [ManageRulesController::class, 'update']);
//*******************************************************manage referral rules********************************************************
Route::get('/manage_referral_rules', [ ManageReferralController::class, 'index'])->name('manage_referral');
Route::get('/referral_rules_edit/{id}', [ManageReferralController::class, 'editReferral'])->name('edit.referralRules');
Route::post('/update_referral_rules', [ManageReferralController::class, 'updateReferral']);