Skip to content

Commit

Permalink
Allow editing of amount in payments
Browse files Browse the repository at this point in the history
  • Loading branch information
OniiCoder committed Mar 8, 2024
1 parent ccdf709 commit d020282
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions resources/views/models/organizations/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<x-fab::layouts.panel title="Balance Brought Forward Record">
<x-fab::forms.input
wire:model="formattedBFAmount"
label="BF Amount"
label="BF Amount (NGN)"
help="This is the amount owed at the given date."
{{-- :disabled="$model->exists"--}}
x-data
Expand All @@ -89,7 +89,7 @@

<x-fab::forms.input
{{-- wire:model="formattedBFBalance"--}}
label="BF Balance"
label="BF Balance (NGN)"
value="{{ number_format($this->getBalance()) }}"
help="This is the balance remaining to be paid."
:disabled="true"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/models/payments/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
wire:model="formattedAmount"
label="Amount (NGN)"
help="Total value of this payment."
:disabled="$model->id ? true : false"
:disabled="$model->status != 'PENDING' ? true : false"
x-data
x-on:input="isNaN(parseFloat($event.target.value.replace(/,/g, ''))) ? $event.target.value = 0 : $event.target.value = parseFloat($event.target.value.replace(/,/g, '')).toLocaleString('en-US')"
/>
Expand Down
9 changes: 6 additions & 3 deletions src/Http/Livewire/OrdersForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ public function mount($order = null)
$this->model->status = 'PENDING';
}

if ($this->model->exists) {
// set formatted volume and unit price
$this->formattedVolume = number_format($this->model->volume);
$this->formattedUnitPrice = number_format($this->model->unit_price);
}

if ($this->model->depot_order_id) {
$depotOrder = DepotOrder::find($this->model->depot_order_id);
if ($depotOrder) {
// set formatted volume and unit price
$this->formattedVolume = number_format($depotOrder->volume);
$this->formattedUnitPrice = number_format($depotOrder->unit_price);

$this->model->product_id = $depotOrder->product_id;
$this->allDepotPickups = DepotPickup::where('depot_order_id', $this->model->depot_order_id)->where('status', 'LOADED')->get();
Expand Down

0 comments on commit d020282

Please sign in to comment.