WIP
This commit is contained in:
@@ -45,14 +45,14 @@ class MakePaymentNovaVisaMaster extends Action
|
|||||||
*/
|
*/
|
||||||
public function handle(ActionFields $fields, Collection $models): mixed
|
public function handle(ActionFields $fields, Collection $models): mixed
|
||||||
{
|
{
|
||||||
// $payment_amount = $fields->get('payment_amount');
|
$payment_amount = $fields->get('payment_amount');
|
||||||
// $usd_payment = $fields->get('usd_payment');
|
$usd_payment = $fields->get('usd_payment');
|
||||||
|
|
||||||
$usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value);
|
// $usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value);
|
||||||
$max_value = number_format($usd_to_tmt * 250, 2);
|
// $max_value = number_format($usd_to_tmt * 250, 2);
|
||||||
|
|
||||||
$usd_payment = 250;
|
// $usd_payment = 250;
|
||||||
$payment_amount = $usd_payment * $usd_to_tmt;
|
// $payment_amount = $usd_payment * $usd_to_tmt;
|
||||||
|
|
||||||
if (! $payment_amount || ! $usd_payment) {
|
if (! $payment_amount || ! $usd_payment) {
|
||||||
return Action::modal('modal-response', [
|
return Action::modal('modal-response', [
|
||||||
@@ -117,86 +117,86 @@ class MakePaymentNovaVisaMaster extends Action
|
|||||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
* @return array<int, \Laravel\Nova\Fields\Field>
|
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||||
*/
|
*/
|
||||||
// public function fields(NovaRequest $request): array
|
public function fields(NovaRequest $request): array
|
||||||
// {
|
{
|
||||||
// $usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value);
|
$usd_to_tmt = floatval(CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value')?->value);
|
||||||
|
|
||||||
// $payment_warning_text = VisaMasterSettings::where('name', 'payment_warning_text')->first();
|
$payment_warning_text = VisaMasterSettings::where('name', 'payment_warning_text')->first();
|
||||||
|
|
||||||
// if (! $usd_to_tmt || ! $payment_warning_text) {
|
if (! $usd_to_tmt || ! $payment_warning_text) {
|
||||||
// return [];
|
return [];
|
||||||
// }
|
}
|
||||||
|
|
||||||
// $max_value = number_format($usd_to_tmt * 250, 2);
|
$max_value = number_format($usd_to_tmt * 250, 2);
|
||||||
// $payment_amount = floatval(number_format($max_value, 2, '.', '')) + 115;
|
$payment_amount = floatval(number_format($max_value, 2, '.', '')) + 115;
|
||||||
|
|
||||||
// return [
|
return [
|
||||||
// Heading::make(Blade::render(<<<HTML
|
Heading::make(Blade::render(<<<HTML
|
||||||
// <h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 USD = $usd_to_tmt TMT</h3>
|
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 USD = $usd_to_tmt TMT</h3>
|
||||||
// <h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">Bankyň tutumy: 100 TMT</h3>
|
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">Bankyň tutumy: 100 TMT</h3>
|
||||||
// <h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">GBÜS tutumy: 15 TMT</h3>
|
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">GBÜS tutumy: 15 TMT</h3>
|
||||||
// HTML))->asHtml(),
|
HTML))->asHtml(),
|
||||||
|
|
||||||
// Text::make(__('Töleg aý'), 'month')
|
Text::make(__('Töleg aý'), 'month')
|
||||||
// ->fullWidth()
|
->fullWidth()
|
||||||
// ->readonly()
|
->readonly()
|
||||||
// ->default(today()->translatedFormat('F')),
|
->default(today()->translatedFormat('F')),
|
||||||
|
|
||||||
// Text::make(sprintf('%s (%s)', __('Töleg möçberi'), __('TMT')), 'payment_amount')
|
Text::make(sprintf('%s (%s)', __('Töleg möçberi'), __('TMT')), 'payment_amount')
|
||||||
// ->fullWidth()
|
->fullWidth()
|
||||||
// ->required()
|
->required()
|
||||||
// ->rules('required', 'numeric', 'max:'.$max_value)
|
->rules('required', 'numeric', 'max:'.$max_value)
|
||||||
// ->help("Iň ýokary möçberi: {$max_value} TMT"),
|
->help("Iň ýokary möçberi: {$max_value} TMT"),
|
||||||
|
|
||||||
// Text::make(__('USD ekwalendi'), 'usd_rate')
|
Text::make(__('USD ekwalendi'), 'usd_rate')
|
||||||
// ->fullWidth()
|
->fullWidth()
|
||||||
// ->readonly()
|
->readonly()
|
||||||
// ->dependsOn('payment_amount', function (Text $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
|
->dependsOn('payment_amount', function (Text $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
|
||||||
// $payment_amount = $formData->get('payment_amount');
|
$payment_amount = $formData->get('payment_amount');
|
||||||
|
|
||||||
// if ($payment_amount) {
|
if ($payment_amount) {
|
||||||
// $field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
|
$field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
|
||||||
// } else {
|
} else {
|
||||||
// $field->setValue('');
|
$field->setValue('');
|
||||||
// }
|
}
|
||||||
// }),
|
}),
|
||||||
|
|
||||||
// Hidden::make('usd_payment')
|
Hidden::make('usd_payment')
|
||||||
// ->dependsOn('payment_amount', function (Hidden $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
|
->dependsOn('payment_amount', function (Hidden $field, NovaRequest $request, FormData $formData) use ($usd_to_tmt) {
|
||||||
// $payment_amount = $formData->get('payment_amount');
|
$payment_amount = $formData->get('payment_amount');
|
||||||
|
|
||||||
// if ($payment_amount) {
|
if ($payment_amount) {
|
||||||
// $field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
|
$field->setValue(number_format($payment_amount / $usd_to_tmt, 2, '.', ''));
|
||||||
// } else {
|
} else {
|
||||||
// $field->setValue('');
|
$field->setValue('');
|
||||||
// }
|
}
|
||||||
// }),
|
}),
|
||||||
|
|
||||||
// Text::make(__('Jemi (TMT)'), 'total_amount')
|
Text::make(__('Jemi (TMT)'), 'total_amount')
|
||||||
// ->fullWidth()
|
->fullWidth()
|
||||||
// ->readonly()
|
->readonly()
|
||||||
// ->dependsOn('payment_amount', function ($field, $request, $formData) {
|
->dependsOn('payment_amount', function ($field, $request, $formData) {
|
||||||
// $payment_amount = $formData->get('payment_amount');
|
$payment_amount = $formData->get('payment_amount');
|
||||||
|
|
||||||
// if ($payment_amount) {
|
if ($payment_amount) {
|
||||||
// $field->setValue(
|
$field->setValue(
|
||||||
// floatval(number_format($payment_amount, 2, '.', '')) + 115
|
floatval(number_format($payment_amount, 2, '.', '')) + 115
|
||||||
// );
|
);
|
||||||
// } else {
|
} else {
|
||||||
// $field->setValue('');
|
$field->setValue('');
|
||||||
// }
|
}
|
||||||
// }),
|
}),
|
||||||
|
|
||||||
// Heading::make(Blade::render(<<<HTML
|
Heading::make(Blade::render(<<<HTML
|
||||||
// <div class="w-full border text-left appearance-none rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 relative inline-flex items-center justify-center shadow h-9 px-3 bg-primary-500 border-primary-500 text-white dark:text-gray-900">
|
<div class="w-full border text-left appearance-none rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 relative inline-flex items-center justify-center shadow h-9 px-3 bg-primary-500 border-primary-500 text-white dark:text-gray-900">
|
||||||
// <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6 mr-2">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6 mr-2">
|
||||||
// <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||||
// </svg>
|
</svg>
|
||||||
// <span>$payment_warning_text->value</span>
|
<span>$payment_warning_text->value</span>
|
||||||
// </div>
|
</div>
|
||||||
// HTML))->asHtml(),
|
HTML))->asHtml(),
|
||||||
// ];
|
];
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order a payment page
|
* Order a payment page
|
||||||
|
|||||||
Reference in New Issue
Block a user