-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Courier booking moved to full page Livewire.
Moved listing and show. Added modal confirmation for booking removing in listing.
- Loading branch information
Showing
11 changed files
with
232 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
asda | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<div> | ||
<x-p-pagination livewire :source="$bookings"/> | ||
<x-p-paper class="bg-slate-800"> | ||
<x-slot:title>Item list</x-slot:title> | ||
<x-slot:actions> | ||
<x-p-button color="success" href="{{ route('dhl24.bookings.create') }}">New courier booking</x-p-button> | ||
</x-slot:actions> | ||
@if($bookings->count()) | ||
<x-p-table> | ||
<x-p-thead> | ||
<x-p-tr> | ||
<x-p-th left>Booking ID</x-p-th> | ||
<x-p-th left>Date</x-p-th> | ||
<x-p-th center>Pickup time</x-p-th> | ||
<x-p-th left>Info</x-p-th> | ||
<x-p-th center>Shipments</x-p-th> | ||
<x-p-th right>Options</x-p-th> | ||
</x-p-tr> | ||
</x-p-thead> | ||
<x-p-tbody> | ||
@foreach($bookings as $booking) | ||
<x-p-tr> | ||
<x-p-td> | ||
<x-p-link href="{{route('dhl24.bookings.show', $booking->id)}}"> | ||
{{ $booking->order_id }} | ||
</x-p-link> | ||
</x-p-td> | ||
<x-p-td>{{$booking->pickup_from->format('d-m-Y')}}</x-p-td> | ||
<x-p-td center> | ||
{{ $booking->pickup_from->format("H:i") }} | ||
- | ||
{{ $booking->pickup_to->format("H:i") }}</x-p-td> | ||
<x-p-td>{{ $booking->additional_info }}</x-p-td> | ||
<x-p-td center>{{$booking->shipments->count()}}</x-p-td> | ||
<x-p-td right> | ||
<x-p-button | ||
color="danger" | ||
size="small" | ||
wire:click="$dispatch('openModal', { component: 'cancel-booking-modal', arguments: { booking: {{$booking->id}} } })" | ||
> | ||
Cancel | ||
</x-p-button> | ||
</x-p-td> | ||
</x-p-tr> | ||
@endforeach | ||
</x-p-tbody> | ||
</x-p-table> | ||
|
||
<div class="py-3"> | ||
<x-p-pagination :source="$bookings"/> | ||
</div> | ||
@else | ||
<x-p-not-found message="Bookings not found."/> | ||
@endif | ||
|
||
</x-p-paper> | ||
<x-p-pagination livewire :source="$bookings"/> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<div> | ||
<x-p-paper> | ||
<x-slot:title>Courier book: {{$booking->order_id}}</x-slot:title> | ||
Courier has been booked for {{$booking->pickup_from->format('d-m-Y')}} | ||
from {{$booking->pickup_from->format('H:i')}} | ||
to {{$booking->pickup_to->format('H:i')}}. | ||
</x-p-paper> | ||
|
||
<x-p-paper class="mt-2"> | ||
<x-slot:title> | ||
Shipments in booking | ||
</x-slot:title> | ||
<x-p-table size="small"> | ||
<x-p-tbody> | ||
<x-p-thead> | ||
<x-p-tr> | ||
<x-p-th left>Number</x-p-th> | ||
<x-p-th left>Status</x-p-th> | ||
<x-p-th left>Receiver name</x-p-th> | ||
<x-p-th left>Receiver city</x-p-th> | ||
<x-p-th left>Items</x-p-th> | ||
<x-p-th left>Type</x-p-th> | ||
</x-p-tr> | ||
</x-p-thead> | ||
@foreach($booking->shipments as $shipment) | ||
<x-p-tr> | ||
<x-p-td> | ||
<x-p-link href="{{route('dhl24.shipments.show', $shipment->id)}}"> | ||
{{$shipment->number}} | ||
</x-p-link> | ||
</x-p-td> | ||
<x-p-td> | ||
<x-dhl-ui::shipment-state :status="$shipment->tracking->first()"/> | ||
<span class="text-sm block"> | ||
{{$shipment->tracking->first()?->pivot->event_timestamp->format('d-m-Y H:i')}} | ||
</span> | ||
</x-p-td> | ||
<x-p-td>{{$shipment->receiver_name}}</x-p-td> | ||
<x-p-td>{{$shipment->receiver_city}}</x-p-td> | ||
<x-p-td>{{$shipment->items->count()}}</x-p-td> | ||
<x-p-td> | ||
<x-dhl-ui::shipment-type :shipment="$shipment"/> | ||
</x-p-td> | ||
</x-p-tr> | ||
@endforeach | ||
</x-p-tbody> | ||
</x-p-table> | ||
</x-p-paper> | ||
<div class="mt-4 text-right"> | ||
<x-p-button color="danger">Cancel booking</x-p-button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<x-p-paper> | ||
<x-slot:title>Cancel booking confirmation</x-slot:title> | ||
Are you sure you want to cancel courier booking ({{$booking->order_id}})?<br/> | ||
Courier was booked for {{$booking->pickup_from->format('d-m-Y')}} ({{$booking->pickup_from->format('H:i')}}-{{$booking->pickup_to->format('H:i')}}) | ||
<div class="mt-2 text-right"> | ||
<x-p-button color="success" wire:click="$dispatch('closeModal')">No</x-p-button> | ||
<x-p-button color="danger" wire:click="cancelBooking"> | ||
Yes, remove booking | ||
</x-p-button> | ||
</div> | ||
</x-p-paper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace xGrz\Dhl24UI\Livewire\Bookings; | ||
|
||
use Illuminate\View\View; | ||
use xGrz\Dhl24UI\Livewire\BaseComponent; | ||
|
||
class DHLBookingsCreate extends BaseComponent | ||
{ | ||
public function render(): View | ||
{ | ||
return view('livewire.d-h-l-bookings-create'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace xGrz\Dhl24UI\Livewire\Bookings; | ||
|
||
|
||
use xGrz\Dhl24\Models\DHLCourierBooking; | ||
use xGrz\Dhl24UI\Livewire\BaseComponent; | ||
|
||
class DHLBookingsListing extends BaseComponent | ||
{ | ||
public function render() | ||
{ | ||
return view('dhl-ui::bookings.bookings-listing', [ | ||
'bookings' => DHLCourierBooking::orderByDesc('pickup_from')->with('shipments')->latest()->paginate(), | ||
]) | ||
->extends('p::app') | ||
->section('content'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace xGrz\Dhl24UI\Livewire\Bookings; | ||
|
||
use Illuminate\View\View; | ||
use xGrz\Dhl24\Models\DHLCourierBooking; | ||
use xGrz\Dhl24UI\Livewire\BaseComponent; | ||
|
||
class DHLBookingsShow extends BaseComponent | ||
{ | ||
|
||
public DHLCourierBooking $booking; | ||
|
||
public function render(): View | ||
{ | ||
return view('dhl-ui::bookings.bookings-show') | ||
->extends('p::app') | ||
->section('content'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace xGrz\Dhl24UI\Livewire\Bookings; | ||
|
||
use Illuminate\View\View; | ||
use LivewireUI\Modal\ModalComponent; | ||
use xGrz\Dhl24\Exceptions\DHL24Exception; | ||
use xGrz\Dhl24\Models\DHLCourierBooking; | ||
use xGrz\Dhl24\Services\DHLBookingService; | ||
|
||
class DHLCancelBookingModal extends ModalComponent | ||
{ | ||
|
||
public DHLCourierBooking $booking; | ||
|
||
public function render(): View | ||
{ | ||
return view('dhl-ui::bookings.cancel-booking-modal'); | ||
} | ||
|
||
public function cancelBooking(): void | ||
{ | ||
try { | ||
(new DHLBookingService())->cancel($this->booking); | ||
session()->flash('success', 'Courier booking has been cancelled.'); | ||
$this->redirectRoute('dhl24.bookings.index'); | ||
} catch (DHL24Exception $e) { | ||
$this->dispatch('openModal', component: 'error-modal', arguments: [ | ||
'title' => 'Shipment cannot be deleted', | ||
'message' => $e->getMessage(), | ||
]); | ||
} | ||
|
||
} | ||
} |