feat: add shift management functionality
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Admin;
|
||||
|
||||
use App\Enums\ShiftDayEnum;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ShiftResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'user_id' => $this->user_id,
|
||||
'doctor' => $this->relationLoaded('doctor') && $this->doctor ? $this->doctor->only(['id', 'fullname']) : null,
|
||||
'day_of_week' => $this->day_of_week,
|
||||
'day_index' => $this->day_of_week ? ShiftDayEnum::from($this->day_of_week)->carbonDay() : null,
|
||||
'date' => $this->date ? verta($this->date)->format('%Y/%m/%d') : null,
|
||||
'date_raw' => $this->date?->format('Y-m-d'),
|
||||
'start_time' => substr($this->start_time, 0, 5),
|
||||
'end_time' => substr($this->end_time, 0, 5),
|
||||
'is_active' => $this->is_active,
|
||||
'created_at' => verta($this->created_at)->format('%Y/%m/%d - H:i'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources\Client;
|
||||
|
||||
use App\Enums\DocumentModalityEnum;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -16,6 +17,10 @@ class FastRequestResource extends JsonResource
|
||||
'status' => $this->status,
|
||||
'priority' => $this->priority,
|
||||
'pet' => new PetArchiveResource($this->whenLoaded('pet')),
|
||||
'invoice' => [
|
||||
'number' => str_pad((string) $this->id, 5, '0', STR_PAD_LEFT),
|
||||
'amount' => DocumentModalityEnum::from($this->modality)->price(),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Client;
|
||||
|
||||
use App\Enums\ShiftDayEnum;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ShiftResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'day_of_week' => $this->day_of_week,
|
||||
'day_index' => $this->day_of_week ? ShiftDayEnum::from($this->day_of_week)->carbonDay() : null,
|
||||
'date' => $this->date ? verta($this->date)->format('%Y/%m/%d') : null,
|
||||
'date_raw' => $this->date?->format('Y-m-d'),
|
||||
'start_time' => substr($this->start_time, 0, 5),
|
||||
'end_time' => substr($this->end_time, 0, 5),
|
||||
'is_active' => $this->is_active,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user