restaurant module chnages
This commit is contained in:
@@ -30,59 +30,56 @@ class ReinstateRestaurant extends Command
|
||||
* Execute the console command.
|
||||
*/
|
||||
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get();
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get();
|
||||
|
||||
foreach ($recordsToUpdate as $record) {
|
||||
//find restaurant
|
||||
$managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first();
|
||||
foreach ($recordsToUpdate as $record) {
|
||||
//find restaurant
|
||||
$managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first();
|
||||
|
||||
$customerData = IamPrincipal::where('id', $record->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid',3)->first(); //fetch customer
|
||||
$customerData = IamPrincipal::where('id', $record->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid', 3)->first(); //fetch customer
|
||||
|
||||
if ($managerestaurant && $managerestaurant->is_active == 1) {
|
||||
$redeemDate = Carbon::parse($record->redeem_date);
|
||||
if ($managerestaurant && $managerestaurant->is_active == 1) {
|
||||
$redeemDate = Carbon::parse($record->redeem_date);
|
||||
|
||||
$fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours(4);
|
||||
$fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours($managerestaurant->time_hours);
|
||||
|
||||
$currentTime = Carbon::now();
|
||||
$currentTime = Carbon::now();
|
||||
|
||||
if ($currentTime > $fourHourPlusTimeOfRecord) {
|
||||
$record->update([
|
||||
'is_redeem' => 0,
|
||||
'redeem_date' => null,
|
||||
'count' => $record->count + 1,
|
||||
'is_redeemption_undone' => 0,
|
||||
'redeemption_undone_date' => null,
|
||||
]);
|
||||
$restImage = ListingImageUrl('restaurant_images', $managerestaurant->image);
|
||||
$title = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$message = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$content_type = 'Restaurant Reinstate';
|
||||
$imageUrl = $restImage;
|
||||
if ($currentTime > $fourHourPlusTimeOfRecord) {
|
||||
$record->update([
|
||||
'is_redeem' => 0,
|
||||
'redeem_date' => null,
|
||||
'count' => $record->count + 1,
|
||||
'is_redeemption_undone' => 0,
|
||||
'redeemption_undone_date' => null,
|
||||
]);
|
||||
$restImage = ListingImageUrl('restaurant_images', $managerestaurant->image);
|
||||
$title = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$message = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$content_type = 'Restaurant Reinstate';
|
||||
$imageUrl = $restImage;
|
||||
|
||||
onesignalhelper::sendNotificationApi(
|
||||
$customerData->one_signal_player_id,
|
||||
$title,
|
||||
$message,
|
||||
$content_type,
|
||||
$imageUrl,
|
||||
$id = null
|
||||
);
|
||||
Log::info('Reinstate of record done at ' . now());
|
||||
|
||||
onesignalhelper::StoreNotificationDetails($customerData->id, $content_type, $title, $restImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log::info('Reinstate task ran successfully at ' . now());
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Reinstate function failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
onesignalhelper::sendNotificationApi(
|
||||
$customerData->one_signal_player_id,
|
||||
$title,
|
||||
$message,
|
||||
$content_type,
|
||||
$imageUrl,
|
||||
$id = null
|
||||
);
|
||||
Log::info('Reinstate of record done at ' . now());
|
||||
|
||||
onesignalhelper::StoreNotificationDetails($customerData->id, $content_type, $title, $restImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log::info('Reinstate task ran successfully at ' . now());
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Reinstate function failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,10 @@ class ManageRestrauntController extends Controller
|
||||
$restaurant->try_on_2 = $request->input('try_on_2');
|
||||
$restaurant->try_on_3 = $request->input('try_on_3');
|
||||
$restaurant->try_on_4 = $request->input('try_on_4');
|
||||
$restaurant->time_hours = $request->input('timeHours');
|
||||
$restaurant->max_numb_day = $request->input('maxNumbDay');
|
||||
$restaurant->max_numb_week = $request->input('maxNumbWeek');
|
||||
$restaurant->max_numb_month = $request->input('maxNumbMonth');
|
||||
$restaurant->save();
|
||||
|
||||
foreach ($request->input('operating_hours') as $day => $hours) {
|
||||
@@ -189,6 +193,10 @@ class ManageRestrauntController extends Controller
|
||||
$restaurant->try_on_2 = $request->input('try_on_2');
|
||||
$restaurant->try_on_3 = $request->input('try_on_3');
|
||||
$restaurant->try_on_4 = $request->input('try_on_4');
|
||||
$restaurant->time_hours = $request->input('timeHours');
|
||||
$restaurant->max_numb_day = $request->input('maxNumbDay');
|
||||
$restaurant->max_numb_week = $request->input('maxNumbWeek');
|
||||
$restaurant->max_numb_month = $request->input('maxNumbMonth');
|
||||
$restaurant->save();
|
||||
|
||||
foreach ($request->input('operating_hours') as $day => $hours) {
|
||||
|
||||
@@ -22,7 +22,7 @@ class ManageRestaurant extends Model
|
||||
protected $fillable = [
|
||||
'short_id', 'name', 'description', 'restaurant_id', 'address', 'image', 'bio',
|
||||
'try_on_1', 'try_on_2', 'try_on_3', 'try_on_4', 'exclusion', 'latitude', 'longitude',
|
||||
'is_active', 'created_by', 'modified_by', 'phone_number'
|
||||
'is_active', 'created_by', 'modified_by', 'phone_number','time_hours','max_numb_day','max_numb_week','max_numb_month'
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
|
||||
@@ -15,21 +15,25 @@ return new class extends Migration
|
||||
Schema::create('manage_restaurants', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('short_id')->unique();
|
||||
$table->string('name',255)->nullable();
|
||||
$table->string('name', 255)->nullable();
|
||||
$table->longText('description')->nullable();
|
||||
$table->string('phone_number', 15)->nullable();
|
||||
$table->bigInteger('state_xid')->nullable();
|
||||
$table->string('restaurant_id')->nullable();
|
||||
$table->string('address',255)->nullable();
|
||||
$table->string('address', 255)->nullable();
|
||||
$table->string('image')->nullable();
|
||||
$table->string('bio')->nullable();
|
||||
$table->text('try_on_1')->nullable();
|
||||
$table->text('try_on_2')->nullable();
|
||||
$table->text('try_on_3')->nullable();
|
||||
$table->text('try_on_4')->nullable();
|
||||
$table->string('exclusion',255)->nullable();
|
||||
$table->string('exclusion', 255)->nullable();
|
||||
$table->string('latitude');
|
||||
$table->string('longtitude');
|
||||
$table->integer('time_hours')->default(1)->comment('Time in hours between redeeming two cocktails');
|
||||
$table->integer('max_numb_day')->default(1)->comment('Maximum number of cocktails per day');
|
||||
$table->integer('max_numb_week')->default(1)->comment('Maximum number of cocktails per week');
|
||||
$table->integer('max_numb_month')->default(1)->comment('Maximum number of cocktails per month');
|
||||
$table->boolean('is_active')->default(1)->comment('1=Active, 0=Expired');
|
||||
$table->integer('created_by')->nullable();
|
||||
$table->integer('modified_by')->nullable();
|
||||
|
||||
@@ -50,6 +50,26 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
|
||||
try_on_4: {
|
||||
required: true,
|
||||
},
|
||||
timeHours: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
},
|
||||
maxNumbDay: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
},
|
||||
maxNumbWeek: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
},
|
||||
maxNumbMonth: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
name: {
|
||||
@@ -93,6 +113,26 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
|
||||
try_on_4: {
|
||||
required: "Please enter this field",
|
||||
},
|
||||
timeHours: {
|
||||
required: "Please enter the time in hours between redeeming two cocktails",
|
||||
number: "Time must be a number",
|
||||
min: "Time must be greater than 0"
|
||||
},
|
||||
maxNumbDay: {
|
||||
required: "Please enter the maximum number of cocktails per day",
|
||||
number: "Value must be a number",
|
||||
min: "Value must be greater than 0"
|
||||
},
|
||||
maxNumbWeek: {
|
||||
required: "Please enter the maximum number of cocktails per week",
|
||||
number: "Value must be a number",
|
||||
min: "Value must be greater than 0"
|
||||
},
|
||||
maxNumbMonth: {
|
||||
required: "Please enter the maximum number of cocktails per month",
|
||||
number: "Value must be a number",
|
||||
min: "Value must be greater than 0"
|
||||
}
|
||||
},
|
||||
errorClass: 'error-message',
|
||||
submitHandler: function (form) {
|
||||
@@ -144,3 +184,4 @@ $(document).on("click", "#update_restaurant_btn", function (e) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -132,6 +132,39 @@
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="timeHours" class="label">Time in hours between redeeming two
|
||||
cocktails in hours</label>
|
||||
<input type="number" class="form-control" id="timeHours" name="timeHours"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="maxNumbDay" class="label">Maximum number of cocktails per
|
||||
day</label>
|
||||
<input type="number" class="form-control" id="maxNumbDay" name="maxNumbDay"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="maxNumbWeek" class="label">Maximum number of cocktails per
|
||||
week</label>
|
||||
<input type="number" class="form-control" id="maxNumbWeek"
|
||||
name="maxNumbWeek" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="maxNumbMonth" class="label">Maximum number of cocktails per
|
||||
month</label>
|
||||
<input type="number" class="form-control" id="maxNumbMonth"
|
||||
name="maxNumbMonth" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">While at Restaurant be sure to
|
||||
|
||||
@@ -116,6 +116,38 @@
|
||||
maxlength="30" value="{{ $restaurantItem->longtitude }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="timeHours" class="label">Time in hours between redeeming two
|
||||
cocktails in hours</label>
|
||||
<input type="number" class="form-control" id="timeHours" name="timeHours"
|
||||
value="{{ $restaurantItem->time_hours }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="maxNumbDay" class="label">Maximum number of cocktails per
|
||||
day</label>
|
||||
<input type="number" class="form-control" id="maxNumbDay" name="maxNumbDay"
|
||||
value="{{ $restaurantItem->max_numb_day }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="maxNumbWeek" class="label">Maximum number of cocktails per
|
||||
week</label>
|
||||
<input type="number" class="form-control" id="maxNumbWeek"
|
||||
value="{{ $restaurantItem->max_numb_week }}" name="maxNumbWeek">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="maxNumbMonth" class="label">Maximum number of cocktails per
|
||||
month</label>
|
||||
<input type="number" class="form-control" id="maxNumbMonth"
|
||||
value="{{ $restaurantItem->max_numb_month }}" name="maxNumbMonth">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Bio</label>
|
||||
@@ -257,6 +289,26 @@
|
||||
return $.trim(value);
|
||||
}
|
||||
},
|
||||
timeHours: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
},
|
||||
maxNumbDay: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
},
|
||||
maxNumbWeek: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
},
|
||||
maxNumbMonth: {
|
||||
required: true,
|
||||
number: true,
|
||||
min: 1
|
||||
},
|
||||
bio: {
|
||||
required: true,
|
||||
},
|
||||
@@ -297,6 +349,26 @@
|
||||
required: "Please enter longitude",
|
||||
number: "Longitude must be a number without spaces",
|
||||
},
|
||||
timeHours: {
|
||||
required: "Please enter the time in hours between redeeming two cocktails",
|
||||
number: "Time must be a number",
|
||||
min: "Time must be greater than 0"
|
||||
},
|
||||
maxNumbDay: {
|
||||
required: "Please enter the maximum number of cocktails per day",
|
||||
number: "Value must be a number",
|
||||
min: "Value must be greater than 0"
|
||||
},
|
||||
maxNumbWeek: {
|
||||
required: "Please enter the maximum number of cocktails per week",
|
||||
number: "Value must be a number",
|
||||
min: "Value must be greater than 0"
|
||||
},
|
||||
maxNumbMonth: {
|
||||
required: "Please enter the maximum number of cocktails per month",
|
||||
number: "Value must be a number",
|
||||
min: "Value must be greater than 0"
|
||||
},
|
||||
bio: {
|
||||
required: "Enter Bio",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user