diff --git a/resources/js/components/EditCustomer.vue b/resources/js/components/EditCustomer.vue
new file mode 100644
index 0000000..245ff60
--- /dev/null
+++ b/resources/js/components/EditCustomer.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/pages/Customers.vue b/resources/js/pages/Customers.vue
index 0cf6535..3727edf 100644
--- a/resources/js/pages/Customers.vue
+++ b/resources/js/pages/Customers.vue
@@ -11,11 +11,12 @@ import { randomInt, bgColorForString } from '@/lib/utils'
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { Input } from '@/components/ui/input'
import { Button } from '@/components/ui/button'
-import { Copy, Delete, Phone, Plus, Search } from "lucide-vue-next"
+import { Copy, Delete, Edit, Phone, Plus, Search } from "lucide-vue-next"
import Fuse from 'fuse.js';
import { getInitials } from '@/composables/useInitials';
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from '@/components/ui/card'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
+import EditCustomer from '@/components/EditCustomer.vue'
const breadcrumbs: BreadcrumbItem[] = [
{
@@ -27,6 +28,8 @@ const breadcrumbs: BreadcrumbItem[] = [
const customersData = ref([] as Customer[])
const searchQuery = ref('')
const searchField = ref()
+const activeCustomer = ref(null)
+const detailDialogOpen = ref(false)
onMounted(async () => {
try {
@@ -36,7 +39,7 @@ onMounted(async () => {
searchField.value.focus()
} catch (error) {
- // TODO: toast
+ // TODO: toast, depends on #33
console.log(error);
}
})
@@ -62,13 +65,22 @@ const addressToClipbard = async function (address: Address) {
address.lineOne + '\n' +
(address.lineTwo ? address.lineTwo + '\n' : '') +
address.postalCode + ' ' + address.city
+ // TODO: toast, depends on #33
)
} catch (error) {
if (error instanceof Error)
+ // TODO: toast, depends on #33
console.error(error.message)
}
}
+const showDetail = (customer: Customer) => {
+ // make a deep copy, so the changes in the dialog won’t affect the data until saved
+ activeCustomer.value = JSON.parse(JSON.stringify(customer))
+ detailDialogOpen.value = true
+ console.log(activeCustomer.value)
+}
+
@@ -101,7 +113,7 @@ const addressToClipbard = async function (address: Address) {
+ class="mb-4 shadow-xl break-inside-avoid hover:bg-accent" @click="showDetail(customer)">
{{ customer.companyName }}
Kategorie / Umsatz
@@ -124,7 +136,7 @@ const addressToClipbard = async function (address: Address) {
-
+
@@ -142,6 +154,11 @@ const addressToClipbard = async function (address: Address) {
+
+
+
+
+
\ No newline at end of file