diff --git a/apps/admin-panel/src/views/apps/customer/bulkCustomer.vue b/apps/admin-panel/src/views/apps/customer/bulkCustomer.vue index 9da7993..adc8704 100644 --- a/apps/admin-panel/src/views/apps/customer/bulkCustomer.vue +++ b/apps/admin-panel/src/views/apps/customer/bulkCustomer.vue @@ -5,6 +5,11 @@ wrapper around it (the rest of AddCustomer's markup is commented out in legacy). Field names, Farsi labels and validation messages are preserved. + Converted to a modal (BaseFormModal): /customer/add (via AddCustomer.vue) + and /bulkCustomer/edit/:id (via EditBulkCustomer.vue) still exist and still + render this component directly as a route-based fallback, but OmdeList.vue + now opens it as a modal via open/id props. + Dropped: the MyUpload avatar widget and the Jalali DateInput, which belong to fields the redesigned Customer schema has no column for. Flagged in docs/ADMIN-PORT-PLAN.md rather than faked. @@ -12,7 +17,108 @@ The نوع کاربری selector is live again now that Customer.type exists; its four options are legacy's own list, byte for byte. --> - + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + +
+ + + + {{ item.title }} + + + + + + + + + + + + + + + + {{ r.name }} + + + + + + + + + +
+
+ + +
+ + + + {{ c.title }} + + + + + + +
+
+
+ + +
@@ -112,12 +218,24 @@ import { onMounted, reactive, ref } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { message } from 'ant-design-vue'; +import BaseFormModal from '../../../components/common/BaseFormModal.vue'; import api from '../../../api/client'; +const props = defineProps<{ + open?: boolean; + id?: string; +}>(); +const emit = defineEmits<{ + (e: 'update:open', value: boolean): void; + (e: 'success'): void; +}>(); + +const asModal = props.open !== undefined; + const route = useRoute(); const router = useRouter(); -const id = route.params.id as string | undefined; +const id = asModal ? props.id : (route.params.id as string | undefined); const loading = ref(false); const cities = ref<{ id: string; title: string }[]>([]); const reagent = ref<{ id: string; name: string }[]>([]); @@ -210,7 +328,12 @@ async function handleSubmitOmde() { await api.post('customer/create', payload); } message.info('اطلاعات با موفقیت به ثبت رسید.'); - router.go(-1); + if (asModal) { + emit('success'); + emit('update:open', false); + } else { + router.go(-1); + } } catch (e: any) { // legacy surfaced the server's mobile-uniqueness error specifically const mobileErr = e?.response?.data?.errors?.mobile?.[0]; diff --git a/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue b/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue index 72b3437..aee95fe 100644 --- a/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue +++ b/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue @@ -13,6 +13,13 @@ -->
+ +
{{ query.total }} رکورد یافت شد - {{ query.count }} رکورد غیر فعال @@ -205,6 +212,15 @@
+ +
@@ -226,6 +242,8 @@ import { UnorderedListOutlined, } from '@ant-design/icons-vue'; import XTable from '../../../components/x-table/XTable.vue'; +import ListPageHeader from '../../../components/common/ListPageHeader.vue'; +import BulkCustomer from '../../apps/customer/bulkCustomer.vue'; import { useUsersStore } from '../../../stores/users'; import api from '../../../api/client'; import type { XTbl } from '../../../components/x-table/model'; @@ -243,8 +261,10 @@ const props = withDefaults( * silently "fixed" — see docs/ADMIN-PORT-PLAN.md. */ rejectOnlyStepOne?: boolean; + /** Only OmdeList.vue passes this — see the comment on its call site. */ + showAddButton?: boolean; }>(), - { rejectOnlyStepOne: false }, + { rejectOnlyStepOne: false, showAddButton: false }, ); const router = useRouter(); @@ -252,6 +272,8 @@ const users = useUsersStore(); const hasPermission = (rid: string) => Boolean(users.hasPermission(rid)); const tbl = ref<{ fetch: () => Promise } | null>(null); +const modalOpen = ref(false); +const editingId = ref(undefined); const query = ref<{ count?: number; total?: number } | undefined>(undefined); /** legacy setCount(): the "N رکورد غیر فعال" banner above the grid */ @@ -399,7 +421,20 @@ async function toggleArchive(id: string) { } function toEdit(id: string) { - router.push(`/bulkCustomer/edit/${id}`); + // Only the OmdeList variant (showAddButton) has the modal wired up; the + // other four (BankerList, ShopkeeperList, OmdeNonVerifiedList, + // OmdeArchivedList) keep navigating to the route, unchanged. + if (props.showAddButton) { + editingId.value = id; + modalOpen.value = true; + } else { + router.push(`/bulkCustomer/edit/${id}`); + } +} + +function openAdd() { + editingId.value = undefined; + modalOpen.value = true; } function toView(id: string) { router.push(`/bulkCustomer/view/${id}`); diff --git a/apps/admin-panel/src/views/customer/omde/OmdeList.vue b/apps/admin-panel/src/views/customer/omde/OmdeList.vue index 50144c3..bcd92ce 100644 --- a/apps/admin-panel/src/views/customer/omde/OmdeList.vue +++ b/apps/admin-panel/src/views/customer/omde/OmdeList.vue @@ -1,6 +1,10 @@