wip
This commit is contained in:
@@ -207,3 +207,13 @@ function convertToOriginalFormat($apiPrice) {
|
|||||||
$originalPrice = intval($apiPrice) / 100;
|
$originalPrice = intval($apiPrice) / 100;
|
||||||
return number_format($originalPrice, 2, '.', ''); // Format with 2 decimal places
|
return number_format($originalPrice, 2, '.', ''); // Format with 2 decimal places
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lastDayOfMonth($month, $year) {
|
||||||
|
// Create a DateTime object for the first day of the given month
|
||||||
|
$date = new DateTime("$year-$month-01");
|
||||||
|
// Modify the date to the last day of the same month
|
||||||
|
$date->modify('last day of this month');
|
||||||
|
// Return the formatted date
|
||||||
|
return $date->format('d');
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,11 @@ class MakePaymentNovaVisaMaster extends Action
|
|||||||
|
|
||||||
$resource = $models->first();
|
$resource = $models->first();
|
||||||
|
|
||||||
|
$today = today();
|
||||||
|
|
||||||
$hasBeenPaid = false;
|
$hasBeenPaid = false;
|
||||||
$resource->paymentItems->each(function ($item) use ($hasBeenPaid) {
|
$resource->paymentItems->each(function ($item) use ($hasBeenPaid, $today) {
|
||||||
if (boolval($item->paid) && now()->format('m Y') == $item->created_at->format('m Y')) {
|
if (boolval($item->paid) && $today->format('m Y') == $item->created_at->format('m Y')) {
|
||||||
$hasBeenPaid = true;
|
$hasBeenPaid = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -66,6 +68,13 @@ class MakePaymentNovaVisaMaster extends Action
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lastDayOfMonth($today->format('m'), $today->format('Y'))) {
|
||||||
|
return Action::modal('modal-response', [
|
||||||
|
'title' => 'Bu gun aýyn sonky guni!',
|
||||||
|
'body' => 'Ayyn sonky guni toleg alynmayar.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if (! $resource->branch || ! $resource->branch->billing_visa_master_username) {
|
if (! $resource->branch || ! $resource->branch->billing_visa_master_username) {
|
||||||
return Action::modal('modal-response', [
|
return Action::modal('modal-response', [
|
||||||
'title' => 'Billing maglumatlary şahamçada ýok!',
|
'title' => 'Billing maglumatlary şahamçada ýok!',
|
||||||
|
|||||||
Reference in New Issue
Block a user