This commit is contained in:
Adrian Hopek 2022-03-07 15:16:53 +01:00
parent f0355f56d3
commit b11e60ab74
11 changed files with 19 additions and 20 deletions

View File

@ -11,7 +11,6 @@ class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
Carbon::macro("toDisplayString", fn() => $this->translatedFormat("j F Y"));
Carbon::macro("toDisplayDate", fn() => $this->translatedFormat("d.m.Y"));
Carbon::macro("toDisplayString", fn() => $this->translatedFormat("d.m.Y"));
}
}

View File

@ -45,8 +45,8 @@ class VacationRequestApprovedNotification extends Notification
$user = $this->user->first_name;
$title = $this->vacationRequest->name;
$type = $this->vacationRequest->type->label();
$from = $this->vacationRequest->from->toDisplayDate();
$to = $this->vacationRequest->to->toDisplayDate();
$from = $this->vacationRequest->from->toDisplayString();
$to = $this->vacationRequest->to->toDisplayString();
$days = $this->vacationRequest->vacations()->count();
$requester = $this->vacationRequest->user->fullName;

View File

@ -45,8 +45,8 @@ class VacationRequestCancelledNotification extends Notification
$user = $this->user->first_name;
$title = $this->vacationRequest->name;
$type = $this->vacationRequest->type->label();
$from = $this->vacationRequest->from->toDisplayDate();
$to = $this->vacationRequest->to->toDisplayDate();
$from = $this->vacationRequest->from->toDisplayString();
$to = $this->vacationRequest->to->toDisplayString();
$days = $this->vacationRequest->vacations()->count();
$requester = $this->vacationRequest->user->fullName;

View File

@ -42,8 +42,8 @@ class VacationRequestCreatedNotification extends Notification
$user = $this->vacationRequest->user->first_name;
$title = $this->vacationRequest->name;
$type = $this->vacationRequest->type->label();
$from = $this->vacationRequest->from->toDisplayDate();
$to = $this->vacationRequest->to->toDisplayDate();
$from = $this->vacationRequest->from->toDisplayString();
$to = $this->vacationRequest->to->toDisplayString();
$days = $this->vacationRequest->vacations()->count();
$appName = config("app.name");

View File

@ -43,8 +43,8 @@ class VacationRequestCreatedOnEmployeeBehalf extends Notification
$user = $this->vacationRequest->user->first_name;
$title = $this->vacationRequest->name;
$type = $this->vacationRequest->type->label();
$from = $this->vacationRequest->from->toDisplayDate();
$to = $this->vacationRequest->to->toDisplayDate();
$from = $this->vacationRequest->from->toDisplayString();
$to = $this->vacationRequest->to->toDisplayString();
$days = $this->vacationRequest->vacations()->count();
$appName = config("app.name");

View File

@ -45,8 +45,8 @@ class VacationRequestRejectedNotification extends Notification
$user = $this->user->first_name;
$title = $this->vacationRequest->name;
$type = $this->vacationRequest->type->label();
$from = $this->vacationRequest->from->toDisplayDate();
$to = $this->vacationRequest->to->toDisplayDate();
$from = $this->vacationRequest->from->toDisplayString();
$to = $this->vacationRequest->to->toDisplayString();
$days = $this->vacationRequest->vacations()->count();
$requester = $this->vacationRequest->user->fullName;

View File

@ -46,8 +46,8 @@ class VacationRequestWaitsForAdminApprovalNotification extends Notification
$requester = $this->vacationRequest->user->fullName;
$title = $this->vacationRequest->name;
$type = $this->vacationRequest->type->label();
$from = $this->vacationRequest->from->toDisplayDate();
$to = $this->vacationRequest->to->toDisplayDate();
$from = $this->vacationRequest->from->toDisplayString();
$to = $this->vacationRequest->to->toDisplayString();
$days = $this->vacationRequest->vacations()->count();
return (new MailMessage())

View File

@ -46,8 +46,8 @@ class VacationRequestWaitsForTechApprovalNotification extends Notification
$requester = $this->vacationRequest->user->fullName;
$title = $this->vacationRequest->name;
$type = $this->vacationRequest->type->label();
$from = $this->vacationRequest->from->toDisplayDate();
$to = $this->vacationRequest->to->toDisplayDate();
$from = $this->vacationRequest->from->toDisplayString();
$to = $this->vacationRequest->to->toDisplayString();
$days = $this->vacationRequest->vacations()->count();
return (new MailMessage())

View File

@ -13,7 +13,7 @@ class VacationRequestActivityResource extends JsonResource
public function toArray($request): array
{
return [
"date" => $this->created_at->toDisplayDate(),
"date" => $this->created_at->toDisplayString(),
"time" => $this->created_at->format("H:i"),
"user" => $this->user ? $this->user->fullName : __("System"),
"state" => $this->to,

View File

@ -18,8 +18,8 @@ class VacationRequestResource extends JsonResource
"user" => new UserResource($this->user),
"type" => $this->type->label(),
"state" => $this->state,
"from" => $this->from->toDisplayDate(),
"to" => $this->to->toDisplayDate(),
"from" => $this->from->toDisplayString(),
"to" => $this->to->toDisplayString(),
"comment" => $this->comment,
"days" => VacationResource::collection($this->vacations),
];

View File

@ -38,7 +38,7 @@ Flatpickr.localize(Polish)
Flatpickr.setDefaults({
dateFormat: 'Y-m-d',
enableTime: false,
altFormat: 'j F Y',
altFormat: 'd.m.Y',
altInput: true,
})