Files
exchange-2.0/resources/assets/vue/components/bookings/forms/PaymentProofFormComponent.vue
T

96 lines
3.9 KiB
Vue

<template>
<div class="row" @keyup.enter="submitForm">
<div class="col">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
<div class="row" v-show="!isLoading">
<div class="col">
<div class="row m-b-10">
<div class="col">
<div class="font-heading fs-16 all-caps bold m-b-15">Payment Proof</div>
</div>
</div>
<error-message-component class="m-b-20" :error="error"></error-message-component>
<bank-in-component :data="data" class="m-b-25"></bank-in-component>
<div class="row">
<div class="col">
<file-input-component :validator="v$.files" v-model="files">
<template #label>
<div class="font-heading fs-11 text-primary all-caps">Payment Proof</div>
</template>
<template #tips>
<div class="row">
<div class="col">
<div class="row m-b-10">
<div class="col">
<div class="font-heading fs-11 text-warning m-b-10">The payment total shown in the photo should tally with customer booking amount.</div>
</div>
</div>
</div>
</div>
</template>
</file-input-component>
</div>
</div>
<div class="row m-t-20">
<div class="col">
<div class="row">
<div class="col-auto">
<button type="button" class="btn btn-sm bg-master-lighter p-t-10 p-b-10 p-r-35 p-l-35 btn-default b-rad-none" data-dismiss="modal">Cancel</button>
</div>
<div class="col text-right">
<button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none" @click="submitForm">Save and continue</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { useFormHandler } from '@/composables/useFormHandler';
import { useQueueStore } from '@/stores/queue';
import useVuelidate from '@vuelidate/core';
import { required } from '@vuelidate/validators';
const props = defineProps<{
id: number;
data: any;
section: string;
}>();
const { submit, closeModal, isLoading, error, parameters, formHandler } = useFormHandler({ section: props.section });
const queueStore = useQueueStore();
const files = ref([]);
const rules = {
files: { required }
};
const v$ = useVuelidate(rules, { files });
const submitForm = async () => {
const isFormCorrect = await v$.value.$validate();
if (!isFormCorrect) return;
parameters.value = {
files: files.value
};
submit(route('api.transaction.bill.verification', props.id, props.data.id), 'post', props.section, true, false, parameters.value, {
successHandler: () => {
closeModal();
formHandler();
queueStore.reloadList({ name: "bookingDetailSection" });
},
errorHandler: (response: any) => {
formHandler(response.message);
}
});
};
</script>