From 11530c575bcb91bc7f66c2582862b4162d027d3f Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sat, 21 Sep 2024 15:22:26 +0200 Subject: [PATCH] --wip-- [skip ci] --- app/Member/MemberResource.php | 1 + docker-compose.yml | 4 + resources/js/components/ui/Popup.vue | 2 +- .../js/composables/useInertiaApiIndex.js | 7 +- resources/js/views/member/VForm.vue | 308 +++++++++--------- resources/js/views/member/VIndex.vue | 39 ++- resources/js/views/member/index/Actions.vue | 4 +- 7 files changed, 195 insertions(+), 170 deletions(-) diff --git a/app/Member/MemberResource.php b/app/Member/MemberResource.php index e2f53d33..6f724db8 100644 --- a/app/Member/MemberResource.php +++ b/app/Member/MemberResource.php @@ -155,6 +155,7 @@ class MemberResource extends JsonResource 'members' => Member::ordered()->get()->map(fn ($member) => ['id' => $member->id, 'name' => $member->fullname]), 'links' => [ 'index' => route('member.index'), + 'store' => route('member.store'), ], 'default_membership_filter' => [ 'group_ids' => [], diff --git a/docker-compose.yml b/docker-compose.yml index aa27c717..50c63b6b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -92,6 +92,8 @@ services: socketi: image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian + ports: + - '6001:6001' environment: SOKETI_DEFAULT_APP_ID: adremaid SOKETI_DEFAULT_APP_KEY: adremakey @@ -104,6 +106,8 @@ services: meilisearch: image: getmeili/meilisearch:v1.6 + ports: + - '7700:7700' volumes: - ./data/meilisearch:/meili_data env_file: diff --git a/resources/js/components/ui/Popup.vue b/resources/js/components/ui/Popup.vue index 9761890a..b6e197cb 100644 --- a/resources/js/components/ui/Popup.vue +++ b/resources/js/components/ui/Popup.vue @@ -4,7 +4,7 @@ class="relative rounded-lg p-8 bg-zinc-800 shadow-2xl shadow-black border border-zinc-700 border-solid w-full max-h-full flex flex-col overflow-auto" :class="full ? 'h-full' : innerWidth" > -
+
diff --git a/resources/js/composables/useInertiaApiIndex.js b/resources/js/composables/useInertiaApiIndex.js index b106ed60..f129b9f1 100644 --- a/resources/js/composables/useInertiaApiIndex.js +++ b/resources/js/composables/useInertiaApiIndex.js @@ -58,7 +58,11 @@ export function useIndex(props, siteName) { single.value = JSON.parse(JSON.stringify(model)); } - async function submit() { + async function submit(data = null) { + if (data !== null) { + single.value = data; + } + single.value.id ? await axios.patch(single.value.links.update, single.value) : await axios.post(inner.meta.value.links.store, single.value); reload(); single.value = null; @@ -105,6 +109,7 @@ export function useIndex(props, siteName) { axios, setFilter, getFilter, + filterString, }; } diff --git a/resources/js/views/member/VForm.vue b/resources/js/views/member/VForm.vue index b202a9e6..04dd6ea5 100644 --- a/resources/js/views/member/VForm.vue +++ b/resources/js/views/member/VForm.vue @@ -1,5 +1,5 @@ - diff --git a/resources/js/views/member/VIndex.vue b/resources/js/views/member/VIndex.vue index 5901e236..76e07949 100644 --- a/resources/js/views/member/VIndex.vue +++ b/resources/js/views/member/VIndex.vue @@ -1,11 +1,17 @@ @@ -149,20 +155,25 @@ import MemberMemberships from './MemberMemberships.vue'; import MemberCourses from './MemberCourses.vue'; import Tags from './Tags.vue'; import Actions from './index/Actions.vue'; -import { indexProps, useIndex } from '../../composables/useIndex.js'; +import VForm from './VForm.vue'; +import { indexProps, useIndex } from '../../composables/useInertiaApiIndex.js'; import { ref, defineProps } from 'vue'; -const single = ref(null); +const sidebar = ref(null); const deleting = ref(null); const membershipFilters = ref(null); const props = defineProps(indexProps); -var { router, data, meta, getFilter, setFilter, filterString, reloadPage } = useIndex(props.data, 'member'); +var { router, data, meta, getFilter, setFilter, reloadPage, edit, create, single, cancel, submit, filterString } = useIndex(props.data, 'member'); function exportMembers() { window.open(`/member-export?filter=${filterString.value}`); } +function show(member) { + console.log(member); +} + async function remove(member) { new Promise((resolve, reject) => { deleting.value = { resolve, reject, member }; @@ -175,12 +186,12 @@ async function remove(member) { } function openSidebar(type, model) { - single.value = { + sidebar.value = { type: type, model: model, }; } function closeSidebar() { - single.value = null; + sidebar.value = null; } diff --git a/resources/js/views/member/index/Actions.vue b/resources/js/views/member/index/Actions.vue index 0f45815f..08d685a5 100644 --- a/resources/js/views/member/index/Actions.vue +++ b/resources/js/views/member/index/Actions.vue @@ -1,7 +1,7 @@