Skip to content

Commit

Permalink
fix donationa modal
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Oct 24, 2023
1 parent ebff058 commit 4a39fb4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
27 changes: 13 additions & 14 deletions resources/js/Components/modals/DonateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
};
</script>

0 comments on commit 4a39fb4

Please sign in to comment.