Commit Graph
202 Commits
Author SHA1 Message Date
s.esmaeiliandCursor 032fa800d9 fix(admin-panel): serve assets under /admin/ for same-host path deploy
Default Vite base to /admin/ (ADMIN_PANEL_BASE) so Dokploy Path+/admin + Strip Path resolves assets instead of the user app root.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-31 23:24:46 +03:30
mahmoodandClaude Sonnet 5.5 7b0bbc072c build: refresh release artifacts after cart rial wage, header back button, variant modal responsive
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 10:48:08 +03:30
mahmoodandClaude Sonnet 5.5 09ff2a9c9b feat(app): rial wage total on cart lines, split cart totals, back button on every header; admin variant modal responsive
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 10:43:31 +03:30
mahmoodandClaude Sonnet 5.5 6514b05d18 fix(money,orders): wage/gram-debt parity, atomic document confirm, expert edit, made-to-order, QA fixes
- Rial wage and gram-debt arithmetic matched to the reference; order corrections keep debt in sync
- Document confirm/un-confirm is a compare-and-swap (no double-applied cache under concurrency)
- Settlement document and expert inputs validated (400 instead of 500)
- Expert: edit / activate-deactivate own customers, adjust raw weights only
- Made-to-order flow in the app, PreOrder.quantity migration
- Order grids: customer column, sort keys; panel select search; pre-order quantity save
- Rebuilt release artifacts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 18:09:02 +03:30
mahmoodandCursor 959a272227 build: refresh release artifacts after dropping user-app
Rebuild API bundle, admin panel, and user-app-v2 for Dokploy copy-only deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-28 16:25:46 +03:30
mahmoodandCursor 520454481b Remove user-app v1 and ship pending order, auth, and app fixes.
Drop the duplicate customer app from the monorepo and keep user-app-v2 as the only app; include order pricing, admin cart, OTP/SMS, and dashboard cache updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-28 16:22:32 +03:30
mahmoodandClaude Sonnet 5.5 bc881a0a8a build: rebuild API release bundle for the one-mobile-one-person check
Rebuilds apps/api/release so the deployed image carries 5f3b004. The vendored
Prisma client changes are only its recorded build paths. No source change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 14:26:16 +03:30
mahmoodandClaude Sonnet 5.5 5f3b00497e feat(auth): one mobile, one person across sales experts and customers
Experts (AdminUser) and customers (Customer) sign in to the same apps by mobile
but live in different tables, so the database cannot make the number unique
across them. A number could be given to an expert and to a customer, and the
login then silently merged the two (the customer row was adopted as the expert's
trading account), which left the expert on a customer session and the panel's
name edits unreachable.

The reference rejected a duplicate at entry (`unique:customers`, the agent being
a customers row too); this does the same where a number is typed in:

- customer create/update (wholesale, banker, walk-in): refused when an ACTIVE
  expert holds the number;
- expert create/update: refused when a customer holds it (the expert's own
  trading account excepted);
- the app's self sign-up: refused when an active expert holds it.

Only a number being created or CHANGED is checked, so existing duplicates keep
signing in and stay editable; the login's "expert wins" adoption is untouched.
Plain equality on the two unique columns, normalised with faToEn, so both
lookups are index hits.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 14:24:37 +03:30
mahmoodandClaude Sonnet 5.5 5ddb225813 fix(ui): act-as strip no longer covers headers; customer type and slider permission
- apps: the fixed «در حال مشاهده به‌عنوان» strip (38px) sat over the fixed page
  headers, which still sat at top: 0 (the old 30px body padding was shorter than
  the strip too). The strip's height is now one variable, --aab-h, that the
  fixed headers (PageBar, home, dashboard, toasts) use as their top.
- admin: the customer form offers only «مغازه دار اپلیکیشن» to anyone but the
  super admin; bankers and walk-in shopkeepers are listed by super-admin-only
  endpoints, so ordinary admins lost the customers they created under them.
- admin: the mobile slider rid (custom.config.statics.slider) was only under the
  «سفارشی» branch, which the permission screen hides outside level 104. Same rid,
  now listed under «مدیریت ثابت ها». Display only: the slider routes are still
  gated by config.statics.

Rebuilds admin-panel, user-app and user-app-v2 dist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 11:16:23 +03:30
mahmoodandClaude Sonnet 5.5 8c4ca20a25 fix(app): open the expert drawers — ant-design-vue 3 takes visible, not open
CustomerChoiceView, ChildOrdersView and ReportView bound their Drawer with
v-model:open, which only exists from ant-design-vue 4. Both apps ship 3.2.20,
so the drawer never opened: tapping a customer in «مشتریان من» did nothing and
the "ورود به حساب این مشتری" button inside it was unreachable.

Rebuilds user-app and user-app-v2 dist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 10:51:34 +03:30
mahmoodandClaude Sonnet 5.5 0b973f9e46 fix(app): re-check the sales-expert flag on every dashboard visit
The "سفارش مشتریان" / "مشتریان من" entries are shown from session.isSalesExpert,
which was fetched from /expert/whoami only once, at sign-in. A slow or failed
request (silently swallowed) left the flag false until the next login, so an
expert saw a customer-only menu. The dashboard now asks again on mount and on
every re-activation, and keeps the current value when the request fails.

Rebuilds user-app and user-app-v2 dist.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 10:23:08 +03:30
mahmoodandClaude Sonnet 5.5 d8b6d36c1b build: rebuild API release bundle and admin panel for the omde list debug block
Rebuilds apps/api/release and apps/admin-panel/dist so the deployed images
carry 0156a97 (X-Debug counts block on the wholesale lists, console output in
the panel). No source change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 09:38:35 +03:30
mahmoodandClaude Sonnet 5.5 0156a976e7 feat(customers): opt-in debug block on the omde lists, printed in the panel console
Sending X-Debug: 1 makes the five wholesale list endpoints return a counts-only
`debug` block next to the rows: the WHERE that actually ran, how many customers
the scope matches before the grid's own filters, how many customers exist per
kind/active/archived/step and how many are an expert's trading account. The
panel sends the header and console-logs the block when localStorage.debug === '1'.

Off by default; DIAG_LOG=false disables it server-side. No names or mobiles.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 08:59:33 +03:30
s.esmaeiliandClaude Opus 5.5 ab39f6abed chore(api): temporary boot-time data diagnostics in the container log
Prints aggregate counts only, prefixed [DIAG], right after migrations: customers
by kind/active/archived/step, what the omde list can show and how many rows are
sales-expert trading accounts (created vs adopted), experts' profile/trading
state, referral counts, the Admin table and the last applied migrations.

Read-only, no mobile/name/id is printed, each query isolated so a failure is
reported without stopping boot. Disable with DIAG_LOG=false; remove once the
empty-omde-list investigation is closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:02:57 +03:30
s.esmaeiliandClaude Opus 5.5 ee43d664d5 fix(experts): an expert edited in the panel now shows up in the app
The app shows a sales expert their own account through the linked trading
Customer row (/customer/me). That row was seeded from the expert once, at first
sign-in, and never updated again, so a name, mobile, credit-limit or wage-percent
change made in the panel never reached the app. In the reference the agent and
that account were one row, so an edit changed both.

Editing an expert now mirrors exactly the changed fields onto the trading row in
the same transaction: name parts, credit limit (gram_level), wage percent, and the
mobile when no other customer holds it. Existing drift heals on the next save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:00:01 +03:30
s.esmaeiliandClaude Sonnet 5.5 600ce06d15 fix: Persian duplicate-value errors; admin panel favicon uses the project logo
- PrismaExceptionFilter returned "Unique constraint failed on: mobile" in
  English for a duplicate. It now answers in Persian, naming the field
  (mobile, national code, member code, order number), with a safe generic
  fallback. Covered by a unit test.
- The admin panel still shipped the old "NZ" favicon. favicon.png/.ico are now
  generated from the project logo (the same one the user apps use), in both
  public/ and dist/, and the links carry ?v=2 so browsers drop the cached icon.
- Rebuilt apps/api/release/app.js.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 06:54:28 +03:30
s.esmaeiliandClaude Sonnet 5.5 0c52adcd26 fix(customers): show every non-archived wholesale customer in the main list
The reference (henza_server AdminController::getCustomer) lists type=2 AND
is_archive=0 with no verification or active filter. The develop-branch change
that hid inactive customers with a pending verification step from «عمده»
emptied the list for customers migrated in that state, while their numbers
stayed taken ("already exists"). Restore parity; the sales-expert trading
account exclusion is kept.

Includes the rebuilt release/app.js and a regression test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 06:50:05 +03:30
s.esmaeiliandClaude Sonnet 5.5 e2ec30f241 build: rebuild API release bundle for the admin/expert table split
app.js, seed.js, the Prisma client in release/vendor and the new migration
20261026120000_split_admin_table, built with `pnpm build:release` (API only;
the admin panel and user apps are unchanged by this work).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 23:55:07 +03:30
s.esmaeiliandClaude Sonnet 5.5 06c8a5f434 feat(auth): split panel admins out of AdminUser into their own Admin table
AdminUser held both panel staff and sales experts, so one mobile could not be
both. Staff now live in "Admin" (panel only); sales experts stay in "AdminUser"
untouched. Uniqueness is per table.

- migration 20261026120000_split_admin_table: additive only. Creates "Admin",
  copies non-expert rows with their ids, re-points the "who did this" foreign
  keys (ledger, order status, sms, notification, upload, allocation, workshop,
  admin session) to "Admin" without moving data. Never writes to "AdminUser".
- login, JWT, SSO, branch/workshop supervisors and the users grid use "Admin";
  SALES_EXPERT create/edit still goes through admin/users into "AdminUser".
- an admin cannot be turned into an expert or the reverse (different tables).
- manual/: optional phase-2 script to drop the dormant admin copies from
  "AdminUser", and a read-only expert-login diagnostic.
- docs/ADMIN-TABLE-SPLIT.md: what changed, deploy checklist, rollback.

Tested on a copy with 12,000 experts: expert rows byte-identical (md5) before
and after; full migration chain applies and matches schema.prisma.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 23:52:33 +03:30
s.esmaeiliandCursor 4679e2498c Exclude sales-expert trading accounts from wholesale customer lists.
Expert trading rows are APP_SHOPKEEPER for orders/ledger and were showing next to real omde customers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-25 23:16:13 +03:30
s.esmaeiliandCursor 066bfd2818 Build release artifacts for deploy.
Refresh API release bundle and admin/user app dist outputs for Dokploy copy-only deploys.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-25 22:46:21 +03:30
s.esmaeiliandCursor 6592e88a2c Fix admin IAM redirect and separate pending wholesale lists.
Keep admin browser bootstrap from falling back to the customer app URL, and exclude activated customers from the pending-verification list so it no longer mirrors the main omde grid.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-25 22:44:48 +03:30
mahmood 55d27151c9 feat(products): port missing variant fields from henza and redesign variant modal 2026-10-25 16:06:17 +03:30
mahmood 143d9aefbb fix(cities): remove 'استان' prefix, keep clean city/province names 2026-10-25 13:31:35 +03:30
mahmood 41fc2496ef fix(cities): keep only 31 provinces, remove bulky sub-cities seed 2026-10-25 13:23:57 +03:30
mahmood bb281cc5d6 feat(cities): seed all Iran provinces and cities with tree hierarchy 2026-10-25 13:04:07 +03:30
mahmood af5095a0e3 build: rebuild release and app bundles 2026-10-25 12:08:58 +03:30
mahmood 88cc8935de build: rebuild assets and update bundles 2026-10-25 11:55:55 +03:30
mahmood 5bd77c33d3 update admin panel, api, and shared-types 2026-10-25 11:43:45 +03:30
s.esmaeiliandCursor 3223c90983 build: rebuild release bundles for orders pagination and dashboard hero
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-17 13:21:55 +03:30
s.esmaeiliandCursor afb068c643 feat: paginate customer orders and polish the dashboard hero
Add paged orders API and infinite scroll, short order numbers, and align the guest invite card with the logged-in hero shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-17 13:11:42 +03:30
s.esmaeiliandClaude Opus 5.5 f550172567 build: rebuild release bundles for the product detail action bar fix
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:54:27 +03:30
s.esmaeiliandClaude Opus 5.5 037280cc09 fix: size the v2 product detail to the visible screen so its action bar stays on screen
اپ۲: دکمه‌ی «افزودن به سفارش» در صفحه‌ی جزئیات محصول دیگر از پایین صفحه بیرون نمی‌افتد و همیشه دیده می‌شود.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:49:35 +03:30
s.esmaeiliandClaude Haiku 5.5 1cfc19f483 build: rebuild release bundles for wine colour change
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 15:30:33 +03:30
s.esmaeiliandClaude Haiku 5.5 c018fe6dae style: use the brand wine instead of navy for fills and borders
اپ۲: رنگ دکمه‌ها، نوار نرخ طلا و خط‌های جداکننده‌ی بالای صفحه از سرمه‌ای به قرمز-شرابی برند تغییر کرد.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 15:27:45 +03:30
s.esmaeiliandClaude Haiku 5.5 b4f260a1c5 build: rebuild release bundles for navy and person-form fixes
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 15:21:24 +03:30
s.esmaeiliandClaude Haiku 5.5 1c4571a68d fix: remove navy from the customer app chrome and keep person forms fresh
اپ۲: رنگ سرمه‌ای از پس‌زمینه‌ی بالای برنامه و رنگ نوار مرورگر حذف شد؛ همه‌جا از رنگ صفحه‌ی اصلی استفاده می‌شود.
پنل: فرم افزودن شخص با هر بار جابه‌جایی نوع شخص خالی باز می‌شود و اطلاعات نیمه‌کارهٔ قبلی دیگر نمایش داده نمی‌شود.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 15:18:26 +03:30
s.esmaeiliandClaude Haiku 5.5 890f5a9725 build: rebuild release bundles with retail dashboard change
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 14:54:52 +03:30
s.esmaeiliandClaude Haiku 5.5 640a42da05 feat: show retail dashboard figures to the super admin only
پنل: بخش‌های «تک فروشی» داشبورد (کارت، نمودار روند و تفکیک عمده/تک) فقط برای مدیر اصلی نمایش داده می‌شود.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 14:51:25 +03:30
s.esmaeiliandClaude Haiku 5.5 0520aaf1b1 build: rebuild release bundles with new logo
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 14:37:52 +03:30
s.esmaeiliandClaude Haiku 5.5 37902e8bff feat: replace brand logo across apps and icons
اپ: لوگوی تازه‌ی برند در صفحه‌ی اصلی، لودر و صفحه‌ی ورود نمایش داده می‌شود.
پنل: لوگوی تازه‌ی برند در ورود، منو و کامنت‌ها نمایش داده می‌شود.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 14:34:19 +03:30
s.esmaeiliandClaude Haiku 5.5 c845f6db19 build: rebuild release bundles for build 181
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 13:35:35 +03:30
s.esmaeiliandClaude Haiku 5.5 532ceee189 feat: move brand name to one config and redesign the accounting card
اپ: نام برند در همه‌ی صفحه‌ها و پیام‌ها یکسان شده و از یک تنظیم مرکزی خوانده می‌شود.
اپ: کارت حسابداری در صفحه‌ی مشتری بازطراحی شد؛ مانده‌ها و وضعیت لینک واضح‌تر نمایش داده می‌شوند.
پنل: کارت حسابداری در پرونده‌ی مشتری بازطراحی شد؛ مانده‌ها، آخرین ارسال و فرم لینک دستی واضح‌تر شده‌اند.
پنل: ستون «کد» در جدول‌ها به‌طور پیش‌فرض پنهان است و از انتخاب ستون‌ها قابل نمایش است.
پنل: تغییر نمایش ستون‌ها در جدول‌ها بلافاصله اعمال می‌شود.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 13:31:20 +03:30
s.esmaeiliandClaude Haiku 5.5 5d2a1efb0c build(api): rebuild release bundle with baseline-first migration fix
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 10:46:15 +03:30
s.esmaeiliandClaude Haiku 5.5 e7c9b7238f fix(api): run baseline migration first so an empty database boots
Migrations were applied in plain name order, so 0002_admin_schema.sql ran
before 20260910113720_first and failed with relation "City" does not exist.
sortMigrations now always puts the baseline first; existing databases are
unaffected because their applied names are unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 10:45:30 +03:30
s.esmaeiliandClaude Haiku 5.5 96416490bc build: rebuild admin-panel, user-app, user-app-v2 and shared-types dist
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 04:34:01 +03:30
s.esmaeiliandClaude Haiku 5.5 cf014e1f6c chore: commit pending admin-panel, api auth and parity doc changes
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 04:33:24 +03:30
s.esmaeiliandClaude Haiku 5.5 55856cac89 ui(admin-panel): add form-page styles from the design line (styles only)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 03:57:46 +03:30
s.esmaeiliandClaude Haiku 5.5 e26dddebd9 ui(admin-panel): restore login page design from the local design line
Only the template, styles and decorative icon imports change. The script
logic (login flow, validation, redirects) is identical to dev.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-14 03:55:51 +03:30
s.esmaeiliandClaude Haiku 5.5 ea987b708f fix(accounting): zarrin copy and sign notes match verified install
Zarrin v228 was tested on the real install (test account 953): negative
balance = owes, and temporary documents move the balance at once. Update
the admin copy and provider comments to match what was verified.

پنل: متن راهنمای زرین به‌روز شد: علامت مانده روی نصب واقعی بررسی شده است، و هشدار مربوط به ثبت سند موقت در «ثبت سفارش» اضافه شد.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-13 19:19:38 +03:30