All files / js/pages/client-zone RequestUpdate.vue

0% Statements 0/15
0% Branches 0/36
0% Functions 0/10
0% Lines 0/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58                                                                                                                   
<script setup lang="ts">
import AppLayout from '@/layouts/AppLayout.vue';
import { Head, useForm } from '@inertiajs/vue3';
 
const props = defineProps<{
    customer: {
        id: number;
        name: string;
        email: string;
        phone?: string | null;
        address?: string | null;
        city?: string | null;
        country?: string | null;
        vat_number?: string | null;
        notes?: string | null;
    };
}>();
 
const updateForm = useForm({
    name: props.customer.name ?? '',
    email: props.customer.email ?? '',
    phone: props.customer.phone ?? '',
    address: props.customer.address ?? '',
    city: props.customer.city ?? '',
    country: props.customer.country ?? '',
    vat_number: props.customer.vat_number ?? '',
    notes: props.customer.notes ?? '',
});
 
const submitRequest = () => {
    updateForm.post('/client-zone/update-request');
};
</script>
 
<template>
    <Head title="Request Info Update" />
    <AppLayout :breadcrumbs="[{ title: 'Client Zone', href: '/client-zone' }, { title: 'Request Info Update', href: '/client-zone/request-update' }]">
        <div class="space-y-6 p-4">
            <h1 class="text-2xl font-semibold">Request Customer Information Update</h1>
            <div class="rounded border p-4">
                <form class="grid gap-3 md:grid-cols-2" @submit.prevent="submitRequest">
                    <input v-model="updateForm.name" class="rounded border px-3 py-2" placeholder="Name" required />
                    <input v-model="updateForm.email" class="rounded border px-3 py-2" placeholder="Email" type="email" required />
                    <input v-model="updateForm.phone" class="rounded border px-3 py-2" placeholder="Phone" />
                    <input v-model="updateForm.vat_number" class="rounded border px-3 py-2" placeholder="VAT Number" />
                    <input v-model="updateForm.address" class="rounded border px-3 py-2 md:col-span-2" placeholder="Address" />
                    <input v-model="updateForm.city" class="rounded border px-3 py-2" placeholder="City" />
                    <input v-model="updateForm.country" class="rounded border px-3 py-2" placeholder="Country" />
                    <textarea v-model="updateForm.notes" class="rounded border px-3 py-2 md:col-span-2" rows="3" placeholder="Notes" />
                    <button type="submit" class="rounded bg-blue-600 px-4 py-2 text-white md:col-span-2" :disabled="updateForm.processing">
                        {{ updateForm.processing ? 'Submitting...' : 'Submit update request' }}
                    </button>
                </form>
            </div>
        </div>
    </AppLayout>
</template>