From 38ce3d24885c19aa1f77b6a1087db946a9584cd2 Mon Sep 17 00:00:00 2001 From: "s.esmaeili" Date: Thu, 8 Oct 2026 10:40:22 +0330 Subject: [PATCH] fix(admin): Jalali dates in grids and legacy order-status tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API sends ISO timestamps where legacy sent formatted Jalali strings, so every grid printed "2026-07-25T12:32:29.000Z". Date columns now render 1405/5/3-16:02. The order-status column is a green/red «فعال/عدم سفارش» tag again (Customer::$STS), not bare «مجاز». Co-Authored-By: Claude Opus 5.5 --- apps/admin-panel/src/components/x-table/XTable.vue | 3 +++ apps/admin-panel/src/utils/filters.ts | 13 +++++++++++++ .../src/views/customer/omde/OmdeCustomerList.vue | 3 ++- .../src/views/customer/reagentList/ReagentList.vue | 3 ++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/admin-panel/src/components/x-table/XTable.vue b/apps/admin-panel/src/components/x-table/XTable.vue index 67e70c2..d0cb865 100644 --- a/apps/admin-panel/src/components/x-table/XTable.vue +++ b/apps/admin-panel/src/components/x-table/XTable.vue @@ -130,6 +130,7 @@ + @@ -140,6 +141,7 @@ import { computed, onMounted, reactive, ref } from 'vue'; import { FilterOutlined, PrinterOutlined, ReloadOutlined, SettingOutlined } from '@ant-design/icons-vue'; import api from '../../api/client'; import type { XTbl } from './model'; +import { gridDate } from '../../utils/filters'; const props = withDefaults( defineProps<{ @@ -224,6 +226,7 @@ const antColumns = computed(() => sorter: c.__sorter, width: c.width, __slot: c.scopedSlots?.customRender, + __date: c.filterType === 'date', })), ); diff --git a/apps/admin-panel/src/utils/filters.ts b/apps/admin-panel/src/utils/filters.ts index 7864b98..444dda2 100644 --- a/apps/admin-panel/src/utils/filters.ts +++ b/apps/admin-panel/src/utils/filters.ts @@ -60,6 +60,19 @@ export function jdate(val: unknown) { } /** Jalali date+time. Legacy used 12-hour 'hh' here — preserved. */ +/** + * A date column in an XTable grid. The legacy API sent `caj`/`uaj`/… already + * formatted (Selector::convertDate, Jalalian) and the grid printed the string; + * the new API sends an ISO timestamp, which the grid printed raw + * ("2026-07-25T12:32:29.000Z"). Same shape the legacy screen shows: + * 1405/5/3-16:02, in the viewer's local (Tehran) time. Anything that is not + * an ISO timestamp is returned untouched. + */ +export function gridDate(val: unknown) { + if (typeof val !== 'string' || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(val)) return val; + return moment(val).format('jYYYY/jM/jD-HH:mm'); +} + export function jdateTime(val: unknown) { if (val) { return moment(val as string).format('jYYYY/jMM/jDD - hh:mm:ss'); diff --git a/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue b/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue index 14cdf8f..65b3972 100644 --- a/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue +++ b/apps/admin-panel/src/views/customer/omde/OmdeCustomerList.vue @@ -31,8 +31,9 @@
-
+ +