From 7233392ab821cc36fede36b863f7c64c065e821a Mon Sep 17 00:00:00 2001 From: xGrz <33755434+xGrz@users.noreply.github.com> Date: Fri, 7 Jun 2024 15:25:59 +0200 Subject: [PATCH] TrackingEventEdit fixed --- .../tracking-event-edit.blade.php | 4 ++-- .../tracking-event-listing.blade.php | 6 +++--- resources/views/shipments/show.blade.php | 7 +++++-- .../TrackingEvents/TrackingEventEdit.php | 16 ++++++++-------- .../TrackingEvents/TrackingEventListing.php | 11 +++++------ 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/resources/views/settings/livewire/tracking-events/tracking-event-edit.blade.php b/resources/views/settings/livewire/tracking-events/tracking-event-edit.blade.php index 2f772c5..bbf7c6d 100644 --- a/resources/views/settings/livewire/tracking-events/tracking-event-edit.blade.php +++ b/resources/views/settings/livewire/tracking-events/tracking-event-edit.blade.php @@ -4,9 +4,9 @@

DHL system description: - {{$description}} + {{$system_description}}

- + @foreach($types as $ident => $typeName) diff --git a/resources/views/settings/livewire/tracking-events/tracking-event-listing.blade.php b/resources/views/settings/livewire/tracking-events/tracking-event-listing.blade.php index e1949c3..f764925 100644 --- a/resources/views/settings/livewire/tracking-events/tracking-event-listing.blade.php +++ b/resources/views/settings/livewire/tracking-events/tracking-event-listing.blade.php @@ -13,12 +13,12 @@ @foreach($events as $event) - {{$event->symbol}} - {{$event->custom_description ?? $event->description}} + {{$event->code}} + {{$event->label}} {{$event->type->getLabel()}} Edit diff --git a/resources/views/shipments/show.blade.php b/resources/views/shipments/show.blade.php index b331044..ea5f733 100644 --- a/resources/views/shipments/show.blade.php +++ b/resources/views/shipments/show.blade.php @@ -176,9 +176,12 @@ class="absolute w-3 h-3 rounded-full mt-1.5 -start-1.5 border border-white {{ str($event->type->getStateColor())->replace('text', 'bg') }}">
-
{{$event->getDescription()}}
+
{{$event->label}}

- @if($event->pivot->terminal){{'@'}}{{$event->pivot->terminal}}@endif + @if($event->pivot->terminal) + {{'@'}}{{$event->pivot->terminal}} + @endif

@endforeach diff --git a/src/Livewire/Settings/TrackingEvents/TrackingEventEdit.php b/src/Livewire/Settings/TrackingEvents/TrackingEventEdit.php index 1b49705..2ca242d 100644 --- a/src/Livewire/Settings/TrackingEvents/TrackingEventEdit.php +++ b/src/Livewire/Settings/TrackingEvents/TrackingEventEdit.php @@ -6,25 +6,25 @@ use Livewire\Attributes\Validate; use LivewireUI\Modal\ModalComponent; use xGrz\Dhl24\Enums\DHLStatusType; -use xGrz\Dhl24\Models\DHLStatus; +use xGrz\Dhl24\Models\DHLTrackingState; class TrackingEventEdit extends ModalComponent { - public DHLStatus $event; + public DHLTrackingState $event; public $types = []; - public $description = ''; #[Validate] - public $custom_description = ''; + public $description = ''; + public $system_description = ''; public $type; - public function mount(DHLStatus $event): void + public function mount(DHLTrackingState $event): void { $this->types = DHLStatusType::getOptions(); $this->type = $event->type; $this->event = $event; + $this->system_description = $event->system_description; $this->description = $event->description; - $this->custom_description = $event->custom_description; } public function render(): View { @@ -36,7 +36,7 @@ public function render(): View public function rules(): array { return [ - 'custom_description' => 'string', + 'description' => 'string', 'type' => 'required' ]; } @@ -45,7 +45,7 @@ public function update(): void { $this->validate(); $this->event->update([ - 'custom_description' => $this->custom_description, + 'description' => $this->description, 'type' => $this->type ]); $this->closeModal(); diff --git a/src/Livewire/Settings/TrackingEvents/TrackingEventListing.php b/src/Livewire/Settings/TrackingEvents/TrackingEventListing.php index 82dc916..9df953b 100644 --- a/src/Livewire/Settings/TrackingEvents/TrackingEventListing.php +++ b/src/Livewire/Settings/TrackingEvents/TrackingEventListing.php @@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\View\View; use Livewire\Component; -use xGrz\Dhl24\Models\DHLStatus; +use xGrz\Dhl24\Facades\DHL24; class TrackingEventListing extends Component { @@ -13,7 +13,10 @@ class TrackingEventListing extends Component public function mount(): void { - self::loadEvents(); + $this->events = DHL24::states() + ->query() + ->orderByTypes() + ->get(); } public function render(): View @@ -21,9 +24,5 @@ public function render(): View return view('dhl-ui::settings.livewire.tracking-events.tracking-event-listing'); } - private function loadEvents(): void - { - $this->events = DHLStatus::orderByTypes()->get(); - } }