Lots of changes

This commit is contained in:
Simon Pocrnjič
2024-11-13 22:11:07 +01:00
parent 90a5858320
commit 953ff38d64
76 changed files with 2822 additions and 427 deletions
+31 -15
View File
@@ -1,23 +1,22 @@
<script setup>
import { ref } from 'vue';
import { ref, watch } from 'vue';
import AppLayout from '@/Layouts/AppLayout.vue';
import List from '@/Components/List.vue';
import ListItem from '@/Components/ListItem.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import InputLabel from '@/Components/InputLabel.vue';
import TextInput from '@/Components/TextInput.vue';
import { useForm } from '@inertiajs/vue3';
import { Link, useForm } from '@inertiajs/vue3';
import ActionMessage from '@/Components/ActionMessage.vue';
import Drawer from '@/Components/Drawer.vue';
import Pagination from '@/Components/Pagination.vue';
import SearchInput from '@/Components/SearchInput.vue';
const props = defineProps({
persons: Array,
create_url: String,
person_types: Array
clients: Object,
filters: Object
});
const drawerCreateClient = ref(false);
const Address = {
address: '',
country: '',
@@ -31,14 +30,29 @@ const formClient = useForm({
address: Address
});
//Create client drawer
const drawerCreateClient = ref(false);
//Search input
const search = {
search: props.filters.search,
route: {
link: 'client'
}
}
//Open drawer create client
const openDrawerCreateClient = () => {
drawerCreateClient.value = true
}
//Close any drawer on page
const closeDrawer = () => {
drawerCreateClient.value = false
}
//Ajax call post to store new client
const storeClient = () => {
formClient.post(route('client.store'), {
onBefore: () => {
@@ -50,10 +64,8 @@ const storeClient = () => {
}
});
};
</script>
<template>
@@ -67,26 +79,30 @@ const storeClient = () => {
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="px-3 bg-white overflow-hidden shadow-xl sm:rounded-lg">
<div class="mx-auto max-w-4x1 py-3">
<PrimaryButton @click="openDrawerCreateClient" class="bg-blue-400">Add client</PrimaryButton>
<div class="flex justify-between">
<PrimaryButton @click="openDrawerCreateClient" class="bg-blue-400">Add client</PrimaryButton>
<SearchInput :options="search" />
</div>
<List class="mt-2">
<ListItem v-for="person in persons">
<ListItem v-for="client in clients.data">
<div class="flex justify-between shadow rounded border-solid border-l-4 border-blue-400 p-3">
<div class="flex min-w-0 gap-x-4">
<div class="min-w-0 flex-auto">
<p class="text-sm font-semibold leading-6 text-gray-900"><a :href="route('client.show', { uuid: person.uuid })">{{ person.full_name }}</a></p>
<p class="mt-1 truncate text-xs leading-5 text-gray-500">{{ person.nu }}</p>
<p class="text-sm font-semibold leading-6 text-gray-900"><Link :href="route('client.show', {uuid: client.uuid})">{{ client.person.full_name }}</Link></p>
<p class="mt-1 truncate text-xs leading-5 text-gray-500">{{ client.person.nu }}</p>
</div>
</div>
<div class="hidden shrink-0 sm:flex sm:flex-col sm:items-end">
<p class="text-sm leading-6 text-gray-900">{{ person.tax_number }}</p>
<p class="text-sm leading-6 text-gray-900">{{ client.person.tax_number }}</p>
<div class="mt-1 flex items-center gap-x-1.5">
<p class="text-xs leading-5 text-gray-500">{{ person.group.name }}</p>
<p class="text-xs leading-5 text-gray-500">Client</p>
</div>
</div>
</div>
</ListItem>
</List>
</div>
<Pagination :links="clients.links" :from="clients.from" :to="clients.to" :total="clients.total" />
</div>
</div>
</div>