refactor(order): mengubah nama kolom dari order_at menjadi ordered_at
- menambahkan key ordered_at untuk create - mengaubah type param di WithMember - menambahkan clearable di input
This commit is contained in:
parent
b32bcb5f65
commit
ac59863be3
@ -42,7 +42,7 @@ public function columns(): array
|
|||||||
})
|
})
|
||||||
->html(),
|
->html(),
|
||||||
|
|
||||||
Column::make('Tanggal', 'order_at')
|
Column::make('Tanggal', 'ordered_at')
|
||||||
->format(fn ($value) => formatDate($value))
|
->format(fn ($value) => formatDate($value))
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public function columns(): array
|
|||||||
|
|
||||||
public function builder(): Builder
|
public function builder(): Builder
|
||||||
{
|
{
|
||||||
return Order::select('orders.id', 'orders.user_id', 'invoice_number', 'customer_id', 'orders.order_at', 'cogs', 'subtotal', 'discount', 'total', 'orders.status', 'channel', 'orders.voucher_id', 'orders.created_at')
|
return Order::select('orders.id', 'orders.user_id', 'invoice_number', 'customer_id', 'orders.ordered_at', 'cogs', 'subtotal', 'discount', 'total', 'orders.status', 'channel', 'orders.voucher_id', 'orders.created_at')
|
||||||
->with(['user', 'user.employee', 'customer', 'voucher']);
|
->with(['user', 'user.employee', 'customer', 'voucher']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,6 +129,7 @@ public function store()
|
|||||||
'channel' => $this->channel,
|
'channel' => $this->channel,
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'payment_method' => $this->payment_method,
|
'payment_method' => $this->payment_method,
|
||||||
|
'ordered_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Attach all order items to the newly created order
|
// Attach all order items to the newly created order
|
||||||
@ -149,6 +150,7 @@ public function store()
|
|||||||
'status' => PaymentStatus::PAID->value,
|
'status' => PaymentStatus::PAID->value,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Deduct voucher quantity
|
||||||
if ($this->voucher_id) {
|
if ($this->voucher_id) {
|
||||||
$userVoucher = DB::table('user_voucher')
|
$userVoucher = DB::table('user_voucher')
|
||||||
->where('user_id', $member->id)
|
->where('user_id', $member->id)
|
||||||
@ -171,6 +173,7 @@ public function store()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -29,9 +29,13 @@ public function members()
|
|||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatedFormMemberId(Customer $customer)
|
public function updatedFormMemberId(?string $member_id = null)
|
||||||
{
|
{
|
||||||
$customer->load('user');
|
$customer = Customer::with('user')->find($member_id);
|
||||||
|
|
||||||
|
if (! $customer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$memberId = $customer->user?->id;
|
$memberId = $customer->user?->id;
|
||||||
|
|
||||||
|
|||||||
@ -278,9 +278,9 @@ class="text-xs text-gray-400">{{ currency($item->quantity, '') }}
|
|||||||
<flux:label>Member</flux:label>
|
<flux:label>Member</flux:label>
|
||||||
<flux:description>Silakan ketikkan nomor telepon.</flux:description>
|
<flux:description>Silakan ketikkan nomor telepon.</flux:description>
|
||||||
<flux:select variant="combobox" placeholder="Pilih Member"
|
<flux:select variant="combobox" placeholder="Pilih Member"
|
||||||
wire:model.live.debounce.500ms="form.member_id">
|
wire:model.live.debounce.500ms="form.member_id" clear>
|
||||||
<x-slot name="input">
|
<x-slot name="input">
|
||||||
<flux:select.input wire:model.live.debounce.250ms="searchMember" />
|
<flux:select.input wire:model.live.debounce.250ms="searchMember" clearable/>
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@foreach ($this->members as $member)
|
@foreach ($this->members as $member)
|
||||||
<flux:select.option value="{{ $member['id'] }}" key="{{ $member['id'] }}">
|
<flux:select.option value="{{ $member['id'] }}" key="{{ $member['id'] }}">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user