From d8f314cb00f4ba87ea33bd25c862ac14f52495ff Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Thu, 2 Oct 2025 18:50:16 +0300 Subject: [PATCH 1/5] MED-186: added upsert to balance if increased MED-185: add wallet balance. to new employee --- .env.example | 1 + README.md | 4 +- .../_components/update-account-form.tsx | 120 ++++++------ .../_components/home-menu-navigation.tsx | 16 +- .../20250930175100_update_tto_tables.sql | 4 - .../20251002170200_upsert_account_balance.sql | 172 ++++++++++++++++++ 6 files changed, 244 insertions(+), 73 deletions(-) delete mode 100644 supabase/migrations/20250930175100_update_tto_tables.sql create mode 100644 supabase/migrations/20251002170200_upsert_account_balance.sql diff --git a/.env.example b/.env.example index 091949f..afbc0aa 100644 --- a/.env.example +++ b/.env.example @@ -19,6 +19,7 @@ EMAIL_PORT= # or 465 for SSL EMAIL_TLS= # or false for SSL (see provider documentation) NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY= +MEDUSA_SECRET_API_KEY== NEXT_PUBLIC_MONTONIO_ACCESS_KEY=7da5d7fa-3383-4997-9435-46aa818f4ead MONTONIO_SECRET_KEY=rNZkzwxOiH93mzkdV53AvhSsbGidrgO2Kl5lE/IT7cvo diff --git a/README.md b/README.md index 1125158..ecbbedc 100644 --- a/README.md +++ b/README.md @@ -98,13 +98,13 @@ To access admin pages follow these steps: - Register new user - Go to Profile and add Multi-Factor Authentication - Authenticate with mfa (at current time profile page prompts it again) -- update your role. look at `supabase/sql/super-admin.sql` +- update your `account.application_role` to `super_admin`. - Sign out and Sign in ## Company User - With admin account go to `http://localhost:3000/admin/accounts` -- For Create Company Account to work you need to have rows in `medreport.roles` table. For that you can sql in `supabase/sql/super-admin.sql` +- For Create Company Account to work you need to have rows in `medreport.roles` table. ## Start email server diff --git a/app/auth/update-account/_components/update-account-form.tsx b/app/auth/update-account/_components/update-account-form.tsx index 473325a..9477004 100644 --- a/app/auth/update-account/_components/update-account-form.tsx +++ b/app/auth/update-account/_components/update-account-form.tsx @@ -181,80 +181,74 @@ export function UpdateAccountForm({ )} /> - {!isEmailUser && ( - <> + <> + ( + + + + + + + + + + )} + /> + +
( - + - + - + + field.onChange( + e.target.value === '' ? null : Number(e.target.value), + ) + } + /> )} /> -
- ( - - - - - - - field.onChange( - e.target.value === '' - ? null - : Number(e.target.value), - ) - } - /> - - - - )} - /> - - ( - - - - - - - field.onChange( - e.target.value === '' - ? null - : Number(e.target.value), - ) - } - /> - - - - )} - /> -
- - )} + ( + + + + + + + field.onChange( + e.target.value === '' ? null : Number(e.target.value), + ) + } + /> + + + + )} + /> +
+ */}
- {/* TODO: add wallet functionality - € {Number(0).toFixed(2).replace('.', ',')} + + {formatCurrency({ + value: balanceSummary?.totalBalance || 0, + locale: language, + currencyCode: 'EUR', + })} + - */} + {hasCartItems && (