mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Refactor Summary component to remove unnecessary code and add product notes
This commit is contained in:
parent
5d9da26970
commit
e8eca033eb
@ -25,19 +25,6 @@ class Summary extends Component
|
||||
|
||||
public array $context;
|
||||
|
||||
#[On('purchase.context')]
|
||||
public function handleContext(string $property, $value): self
|
||||
{
|
||||
data_set($this->context, $property, $value);
|
||||
|
||||
// The following may not be needed, as we can pass arround $context.
|
||||
// cache()->set($this->hash, $this->context);
|
||||
|
||||
// $this->dispatch('purchase.context', property: 'products', value: $products);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$bundle = $this->context['bundle'] ?? [
|
||||
@ -59,6 +46,7 @@ class Summary extends Component
|
||||
$bundle['one_time_products'][$product->hashed_id] = [
|
||||
'product' => $product,
|
||||
'quantity' => 1,
|
||||
'notes' => $product->markdownNotes(),
|
||||
];
|
||||
}
|
||||
|
||||
@ -66,6 +54,7 @@ class Summary extends Component
|
||||
$bundle['optional_recurring_products'][$product->hashed_id] = [
|
||||
'product' => $product,
|
||||
'quantity' => 0,
|
||||
'notes' => $product->markdownNotes(),
|
||||
];
|
||||
}
|
||||
|
||||
@ -73,6 +62,7 @@ class Summary extends Component
|
||||
$bundle['optional_one_time_products'][$product->hashed_id] = [
|
||||
'product' => $product,
|
||||
'quantity' => 0,
|
||||
'notes' => $product->markdownNotes(),
|
||||
];
|
||||
}
|
||||
|
||||
@ -180,6 +170,8 @@ class Summary extends Component
|
||||
];
|
||||
}
|
||||
|
||||
$this->dispatch('purchase.context', property: 'products', value: $products);
|
||||
|
||||
return $products;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user