From 12c8195090e42ecef71b8f206096ef9cee822fa4 Mon Sep 17 00:00:00 2001 From: "s.esmaeili" Date: Mon, 14 Sep 2026 15:22:54 +0330 Subject: [PATCH] admin-panel: convert city create form into a modal (pilot) Establishes the pattern the remaining 15 add/edit forms will follow: - The form component accepts open?/id? props. When open is defined it's used as-is; asModal is fixed at mount (not reactive) since the parent decides once whether this instance is a modal or a route page. - As a modal it renders through BaseFormModal (header=title, footer= buttons, body=form) and emits success + update:open instead of navigating; as a route page (the old /city/create still exists and still works) it falls back to the original + button layout unchanged. - The list page gets a ListPageHeader add button above the list, gated on the exact rid the route used to gate on (cities.create), opening the modal instead of navigating. Verified: pnpm build passes. Co-Authored-By: Claude Sonnet 5 --- apps/admin-panel/src/views/city/cityList.vue | 7 +++ .../admin-panel/src/views/city/createCity.vue | 59 +++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/apps/admin-panel/src/views/city/cityList.vue b/apps/admin-panel/src/views/city/cityList.vue index af4dec1..7c36a28 100644 --- a/apps/admin-panel/src/views/city/cityList.vue +++ b/apps/admin-panel/src/views/city/cityList.vue @@ -6,6 +6,8 @@ -->
+ + @@ -56,6 +60,8 @@ import { reactive, ref } from 'vue'; import { message } from 'ant-design-vue'; import { DeleteOutlined, EditOutlined } from '@ant-design/icons-vue'; import XTable from '../../components/x-table/XTable.vue'; +import ListPageHeader from '../../components/common/ListPageHeader.vue'; +import CreateCity from './createCity.vue'; import { buildCityListModel } from './CityListModel'; import { useUsersStore } from '../../stores/users'; import { useDeleteHandler } from '../../composables/useDeleteHandler'; @@ -66,6 +72,7 @@ const hasPermission = (rid: string) => Boolean(users.hasPermission(rid)); const model = buildCityListModel(); const citiesTable = ref<{ fetch: () => Promise } | null>(null); +const addOpen = ref(false); const visible = ref(false); const tempRow = ref | undefined>(undefined); const form = reactive>({ title: '', percent: null, percent_aux: null }); diff --git a/apps/admin-panel/src/views/city/createCity.vue b/apps/admin-panel/src/views/city/createCity.vue index 4614569..3aa6efa 100644 --- a/apps/admin-panel/src/views/city/createCity.vue +++ b/apps/admin-panel/src/views/city/createCity.vue @@ -1,6 +1,35 @@