|
|
@@ -185,7 +185,7 @@ class RecurringInvoiceResource extends Resource
|
|
185
|
185
|
return;
|
|
186
|
186
|
}
|
|
187
|
187
|
|
|
188
|
|
- $unitPrice = CurrencyConverter::convertToFloat($offeringRecord->price, CurrencyAccessor::getDefaultCurrency());
|
|
|
188
|
+ $unitPrice = CurrencyConverter::convertCentsToFormatSimple($offeringRecord->price, 'USD');
|
|
189
|
189
|
|
|
190
|
190
|
$set('description', $offeringRecord->description);
|
|
191
|
191
|
$set('unit_price', $unitPrice);
|
|
|
@@ -207,9 +207,8 @@ class RecurringInvoiceResource extends Resource
|
|
207
|
207
|
->default(1),
|
|
208
|
208
|
Forms\Components\TextInput::make('unit_price')
|
|
209
|
209
|
->hiddenLabel()
|
|
210
|
|
- ->numeric()
|
|
|
210
|
+ ->money(useAffix: false)
|
|
211
|
211
|
->live()
|
|
212
|
|
- ->maxValue(9999999999.99)
|
|
213
|
212
|
->default(0),
|
|
214
|
213
|
Forms\Components\Group::make([
|
|
215
|
214
|
CreateAdjustmentSelect::make('salesTaxes')
|
|
|
@@ -250,7 +249,9 @@ class RecurringInvoiceResource extends Resource
|
|
250
|
249
|
->extraAttributes(['class' => 'text-left sm:text-right'])
|
|
251
|
250
|
->content(function (Forms\Get $get) {
|
|
252
|
251
|
$quantity = max((float) ($get('quantity') ?? 0), 0);
|
|
253
|
|
- $unitPrice = max((float) ($get('unit_price') ?? 0), 0);
|
|
|
252
|
+ $unitPrice = CurrencyConverter::isValidAmount($get('unit_price'), 'USD')
|
|
|
253
|
+ ? CurrencyConverter::convertToFloat($get('unit_price'), 'USD')
|
|
|
254
|
+ : 0;
|
|
254
|
255
|
$salesTaxes = $get('salesTaxes') ?? [];
|
|
255
|
256
|
$salesDiscounts = $get('salesDiscounts') ?? [];
|
|
256
|
257
|
$currencyCode = $get('../../currency_code') ?? CurrencyAccessor::getDefaultCurrency();
|