Feat: Correctly displaying Manual VOucher Edit Button
This commit is contained in:
1 parent
162827dff7
commit
3020bd070c
6 files changed
+18
-12
No files matched your search
@@ -124,12 +124,13 @@ class OrderShipmentsExtension extends ViewPageExtension
|
||||
->schema(fn (Shipment $record) => [
|
||||
TextInput::make('tracking_reference')
|
||||
->label('Voucher / tracking number')
|
||||
->required($record->source === Shipment::SOURCE_MANUAL_VOUCHER)
|
||||
->unique(Shipment::class, 'tracking_reference', ignorable: $record),
|
||||
])
|
||||
->action(fn (Shipment $record, array $data) => $record->update([
|
||||
'tracking_reference' => filled($data['tracking_reference']) ? trim($data['tracking_reference']) : null,
|
||||
]))
|
||||
->visible(fn (Shipment $record) => $record->source === Shipment::SOURCE_MANUAL && ! $record->isCancelled()),
|
||||
->visible(fn (Shipment $record) => in_array($record->source, [Shipment::SOURCE_MANUAL, Shipment::SOURCE_MANUAL_VOUCHER], true) && ! $record->isCancelled()),
|
||||
Action::make('add_tracking_update')
|
||||
->label('Add tracking update')
|
||||
->icon('heroicon-o-plus-circle')
|
||||
@@ -152,7 +153,7 @@ class OrderShipmentsExtension extends ViewPageExtension
|
||||
->helperText('Shown to the customer on their order page.'),
|
||||
])
|
||||
->action(fn (Shipment $record, array $data) => $this->addTrackingUpdate($record, $data))
|
||||
->visible(fn (Shipment $record) => $record->source === Shipment::SOURCE_MANUAL && ! $record->isCancelled()),
|
||||
->visible(fn (Shipment $record) => in_array($record->source, [Shipment::SOURCE_MANUAL, Shipment::SOURCE_MANUAL_VOUCHER], true) && ! $record->isCancelled()),
|
||||
Action::make('cancel_shipment')
|
||||
->label('Cancel')
|
||||
->icon('heroicon-o-x-circle')
|
||||
|
||||
Reference in new issue
Block a user