Merge branch 'main' of https://github.com/WDI-Ideas/cheerstothe_season_laravel11
This commit is contained in:
@@ -50,6 +50,28 @@ if (!function_exists('jsonResponseWithErrorMessageApi')) {
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('jsonResponseWithDataErrorMessageApi')) {
|
||||
function jsonResponseWithDataErrorMessageApi($errorMessage, $data = [], $statusCode = 406)
|
||||
{
|
||||
// Set the HTTP status code
|
||||
http_response_code($statusCode);
|
||||
|
||||
// Prepare the response array
|
||||
$response = [
|
||||
'status' => 'error',
|
||||
'status_code' => $statusCode,
|
||||
'message' => $errorMessage,
|
||||
'data' => $data,
|
||||
|
||||
];
|
||||
return response()->json($response, $statusCode);
|
||||
|
||||
// Stop further execution (optional)
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('jsonResponseWithErrorMessage')) {
|
||||
function jsonResponseWithErrorMessage($errorMessage)
|
||||
{
|
||||
|
||||
@@ -120,7 +120,6 @@ class RestaurantApiServices
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function addToFavourite($customerIamId, $request)
|
||||
{
|
||||
try {
|
||||
@@ -381,7 +380,7 @@ class RestaurantApiServices
|
||||
->count();
|
||||
|
||||
if ($redeemCountState >= $stateMaxLimitation) {
|
||||
return jsonResponseWithErrorMessageApi(__('auth.state_limit_reached'), 403);
|
||||
return jsonResponseWithDataErrorMessageApi(__('limitexceed') , ('You have reached the maximum limit for redeeming vouchers.'));
|
||||
}
|
||||
|
||||
// Calculate the restaurant interval start date
|
||||
@@ -394,7 +393,7 @@ class RestaurantApiServices
|
||||
->count();
|
||||
|
||||
if ($redeemCountRestaurant >= $restaurantMaxLimitation) {
|
||||
return jsonResponseWithErrorMessageApi(__('auth.restaurant_limit_reached'), 403);
|
||||
return jsonResponseWithDataErrorMessageApi(__('limitexceed') , ('You have reached the maximum limit for redeeming vouchers.'));
|
||||
}
|
||||
|
||||
// Get the last redeem time
|
||||
@@ -423,14 +422,14 @@ class RestaurantApiServices
|
||||
$remainingTime = $currentTime->diff($stateAllowedRedeemTime);
|
||||
$hours = $remainingTime->h;
|
||||
$minutes = $remainingTime->i;
|
||||
return jsonResponseWithErrorMessageApi(__('auth.redeem_not_allowed_yet') . " {$hours} hours and {$minutes} minutes remaining.", 403);
|
||||
return jsonResponseWithDataErrorMessageApi(__('limitexceed') , ('Please wait before redeeming the next voucher.'. " {$hours} hours and {$minutes} minutes remaining."));
|
||||
}
|
||||
|
||||
if ($currentTime < $restAllowedRedeemTime) {
|
||||
$remainingTime = $currentTime->diff($restAllowedRedeemTime);
|
||||
$hours = $remainingTime->h;
|
||||
$minutes = $remainingTime->i;
|
||||
return jsonResponseWithErrorMessageApi(__('auth.redeem_not_allowed_yet') . " {$hours} hours and {$minutes} minutes remaining.", 403);
|
||||
return jsonResponseWithDataErrorMessageApi(__('limitexceed') , ('Please wait before redeeming the next voucher.'. " {$hours} hours and {$minutes} minutes remaining."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
->withSchedule(function (Schedule $schedule) {
|
||||
$schedule->command('app:reinstate-restaurant')->everyMinute();
|
||||
$schedule->command('app:sent-schedule-notification')->everyMinute();
|
||||
$schedule->command('queue:work')->everyMinute();
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
//
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
<tr>
|
||||
<th>Sr No.</th>
|
||||
<th>Subscription ID</th>
|
||||
<th>User Name</th>
|
||||
<th> Name</th>
|
||||
<th> Email </th>
|
||||
<th> Phone Number </th>
|
||||
<th>State</th>
|
||||
<th>Subscription Date Time</th>
|
||||
<th>Subscription Date and Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -29,6 +31,8 @@
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $subscription->id }}</td>
|
||||
<td>{{ $subscription->iamPrincipal->first_name ?? 'N/A' }} {{ $subscription->iamPrincipal->last_name ?? 'N/A' }} </td>
|
||||
<td>{{ $subscription->iamPrincipal->email_address}}</td>
|
||||
<td>{{ $subscription->iamPrincipal->phone_number}}</td>
|
||||
<td>{{ $subscription->iamPrincipal->state->name ?? 'N/A' }}</td>
|
||||
<td>{{\Carbon\Carbon::parse($subscription->created_at)->format('m-d-Y H:i')}}</td>
|
||||
</tr>
|
||||
@@ -42,6 +46,8 @@
|
||||
<th>Sr No.</th>
|
||||
<th>Customer ID</th>
|
||||
<th>Customer Name</th>
|
||||
<th>Customer Email </th>
|
||||
<th>Customer Phone Number</th>
|
||||
<th>State</th>
|
||||
<th>Customer Join Date Time</th>
|
||||
</tr>
|
||||
@@ -52,6 +58,8 @@
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $user->id }}</td>
|
||||
<td>{{ $user->first_name }} {{ $user->last_name }}</td>
|
||||
<td>{{ $user->email_address }}</td>
|
||||
<td>{{ $user->phone_number }}</td>
|
||||
<td>{{ $user->state->name }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($user->created_at)->format('m-d-Y H:i') }}</td>
|
||||
|
||||
@@ -67,6 +75,8 @@
|
||||
<th>Redemption ID</th>
|
||||
<th>Restaurant Name</th>
|
||||
<th>Customer Name</th>
|
||||
<th>Customer Email </th>
|
||||
<th>Customer Phone Number </th>
|
||||
<th>State</th>
|
||||
<th>Redemption Date Time</th>
|
||||
</tr>
|
||||
@@ -78,6 +88,8 @@
|
||||
<td>{{ $redemption->id }}</td>
|
||||
<td>{{ $redemption->restaurant->name }}</td>
|
||||
<td>{{ $redemption->customer->first_name }} {{ $redemption->customer->last_name }}</td>
|
||||
<td>{{ $redemption->customer->email_address }}</td>
|
||||
<td>{{ $redemption->customer->phone_number }}</td>
|
||||
<td>{{ $redemption->customer->state->name }}</td>
|
||||
<td>{{\Carbon\Carbon::parse($redemption->created_at)->format('m-d-Y H:i')}} </td>
|
||||
</tr>
|
||||
@@ -92,6 +104,8 @@
|
||||
<th>Redemption ID</th>
|
||||
<th>Restaurant Name</th>
|
||||
<th>Customer Name</th>
|
||||
<th>Customer Email</th>
|
||||
<th>Customer Phone Number </th>
|
||||
<th>State</th>
|
||||
<th>Redemption Date Time</th>
|
||||
</tr>
|
||||
@@ -103,6 +117,8 @@
|
||||
<td>{{ $redemption->id }}</td>
|
||||
<td>{{ $redemption->restaurant->name }}</td>
|
||||
<td>{{ $redemption->customer->first_name }} {{ $redemption->customer->last_name }}</td>
|
||||
<td>{{ $redemption->customer->email_address }}</td>
|
||||
<td>{{ $redemption->customer->phone_number }}</td>
|
||||
<td>{{ $redemption->customer->state->name }}</td>
|
||||
<td>{{\Carbon\Carbon::parse($redemption->created_at)->format('m-d-Y H:i')}} </td>
|
||||
</tr>
|
||||
@@ -114,18 +130,24 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sr No.</th>
|
||||
<th>Subscription ID</th>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Phone number</th>
|
||||
<th>State</th>
|
||||
<th>Subscription Status</th>
|
||||
<th>Subscription Cancel Date Time</th>
|
||||
<th>Subscription Cancel Date Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($data as $item)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $item->id }}</td>
|
||||
<td>{{ $item->iamPrincipal->first_name }} {{ $item->iamPrincipal->last_name }}</td>
|
||||
<td>{{ $item->iamPrincipal->email_address }}</td>
|
||||
<td>{{ $item->iamPrincipal->phone_number }}</td>
|
||||
<td>{{ $item->iamPrincipal->state->name }}</td>
|
||||
<td>{{ $item->subscription_status }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($item->cancelled_at)->format('m-d-Y H:i') }}</td>
|
||||
@@ -144,7 +166,7 @@
|
||||
<th>Email</th>
|
||||
<th>Phone Number</th>
|
||||
<th>State</th>
|
||||
<th>Referred Date Time</th>
|
||||
<th>Referred Date Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -172,7 +194,7 @@
|
||||
<th>Email</th>
|
||||
<th>Phone number</th>
|
||||
<th>State</th>
|
||||
<th>Referred Date Time</th>
|
||||
<th>Referred Date Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user