From 4a39fb4a309fa1b74e01905e89b3413a8964185f Mon Sep 17 00:00:00 2001 From: Lupu Gheorghe Date: Tue, 24 Oct 2023 14:41:04 +0300 Subject: [PATCH] fix donationa modal --- app/Http/Controllers/ProjectController.php | 2 +- .../js/Components/modals/DonateModal.vue | 27 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index bc06c326..16458852 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -103,7 +103,7 @@ public function donation(Project $project, Request $request) 'first_name' => $firstName, 'last_name' => $lastName, 'email' => $request->email, - 'status' => EuPlatescStatus::in_progress->value, + 'status' => EuPlatescStatus::INITIALIZE, 'card_status' => null, 'card_holder_status_message' => null, 'approval_date' => null, diff --git a/resources/js/Components/modals/DonateModal.vue b/resources/js/Components/modals/DonateModal.vue index e269d646..6d0338c7 100644 --- a/resources/js/Components/modals/DonateModal.vue +++ b/resources/js/Components/modals/DonateModal.vue @@ -210,25 +210,24 @@ /** Initialize inertia from Object. */ const authForm = useForm({ amount: '', + }); /** Donate action */ const donate = () => { - console.log(guestForm); - /** Trigger donate post method. */ - if (!usePage().props.auth.user) { - guestForm.post(route('project.donation', props.data.slug), { - onSuccess: () => (open.value = false), - onError: (errors) => { - console.log('error', errors); - }, - onFinish: () => guestForm.reset(), - }); - } else { - // authForm.post(route('ruta', data.id), { - // onFinish: () => form.reset(), - // }); + if (usePage().props.auth.user) { + guestForm.name = usePage().props.auth.user.name; + guestForm.email = usePage().props.auth.user.email; + guestForm.terms = true; + guestForm.amount = authForm.amount; } + guestForm.post(route('project.donation', props.data.slug), { + onSuccess: () => (open.value = false), + onError: (errors) => { + console.log('error', errors); + }, + onFinish: () => guestForm.reset(), + }); };