|
@@ -137,15 +137,19 @@ class RecurringInvoiceResource extends Resource
|
137
|
137
|
$offeringId = $state;
|
138
|
138
|
$offeringRecord = Offering::with(['salesTaxes', 'salesDiscounts'])->find($offeringId);
|
139
|
139
|
|
140
|
|
- if ($offeringRecord) {
|
141
|
|
- $set('description', $offeringRecord->description);
|
142
|
|
- $set('unit_price', $offeringRecord->price);
|
143
|
|
- $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
|
|
140
|
+ if (! $offeringRecord) {
|
|
141
|
+ return;
|
|
142
|
+ }
|
|
143
|
+
|
|
144
|
+ $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency());
|
144
|
145
|
|
145
|
|
- $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
|
146
|
|
- if ($discountMethod->isPerLineItem()) {
|
147
|
|
- $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
|
148
|
|
- }
|
|
146
|
+ $set('description', $offeringRecord->description);
|
|
147
|
+ $set('unit_price', $unitPrice);
|
|
148
|
+ $set('salesTaxes', $offeringRecord->salesTaxes->pluck('id')->toArray());
|
|
149
|
+
|
|
150
|
+ $discountMethod = DocumentDiscountMethod::parse($get('../../discount_method'));
|
|
151
|
+ if ($discountMethod->isPerLineItem()) {
|
|
152
|
+ $set('salesDiscounts', $offeringRecord->salesDiscounts->pluck('id')->toArray());
|
149
|
153
|
}
|
150
|
154
|
}),
|
151
|
155
|
Forms\Components\TextInput::make('description'),
|