where('currency_to', 'TMT')->first('value');
if (! $usd_to_tmt) {
return [];
}
$max_value = number_format($usd_to_tmt->value * 250, 2);
return [
Heading::make(Blade::render(<<1 USD = $usd_to_tmt->value TMT
TVEB USD tutumy: 18 USD
GBÜS tutumy: 3 TMT
HTML))->asHtml(),
Text::make(sprintf('%s (%s)', __('Töleg möçberi'), __('TMT')), 'payment_amount')
->fullWidth()
->required()
->rules('required', 'numeric', 'max:'.$max_value)
->help("Iň ýokary möçberi: {$max_value} TMT"),
Text::make(__('USD ekwalendi'), 'usd_rate')
->fullWidth()
->readonly()
->dependsOn('payment_amount', function ($field, $request, $formData) use ($usd_to_tmt) {
if ($formData->payment_amount) {
$field->setValue(number_format($formData->payment_amount / $usd_to_tmt->value, 2, '.', ''));
} else {
$field->setValue('');
}
}),
Text::make(__('Jemi (TMT)'), 'total_amount')
->fullWidth()
->readonly()
->dependsOn('payment_amount', function ($field, $request, $formData) {
if (is_numeric($formData->payment_amount)) {
$field->setValue(
floatval(number_format($formData->payment_amount, 2, '.', '')) + 23
);
} else {
$field->setValue('');
}
}),
];
}
}