From c3f3d940e55efd006be3c1faf9bdc1d8e0697b30 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Wed, 22 Apr 2026 02:31:01 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Phase=203=20Complete:=20Fix=20st?= =?UTF-8?q?aff=20list,=20PDF=20preview,=20and=20functional=20Settings/Prof?= =?UTF-8?q?ile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/modules/users/user.controller.ts | 5 + backend/src/modules/users/user.service.ts | 17 ++ frontend/src/pages/invoices/InvoicesPage.tsx | 28 +- frontend/src/pages/settings/SettingsPage.tsx | 255 ++++++++++++++----- frontend/src/pages/staff/StaffPage.tsx | 6 +- 5 files changed, 228 insertions(+), 83 deletions(-) diff --git a/backend/src/modules/users/user.controller.ts b/backend/src/modules/users/user.controller.ts index e569853..cdf5072 100644 --- a/backend/src/modules/users/user.controller.ts +++ b/backend/src/modules/users/user.controller.ts @@ -46,4 +46,9 @@ export class UsersController { async remove(@CurrentUser() user: any, @Param('id') id: string) { return this.usersService.remove(user.tenantId, id, user.id); } + + @Post('profile') + async updateProfile(@CurrentUser() user: any, @Body() dto: any) { + return this.usersService.update(user.id, dto); + } } diff --git a/backend/src/modules/users/user.service.ts b/backend/src/modules/users/user.service.ts index 24e0ccc..1fc4dad 100644 --- a/backend/src/modules/users/user.service.ts +++ b/backend/src/modules/users/user.service.ts @@ -71,4 +71,21 @@ export class UsersService { const user = await this.findOne(tenantId, id); await this.userRepository.update(id, { is_active: false }); } + + /** + * تحديث بيانات مستخدم + */ + async update(id: string, dto: any): Promise { + const user = await this.userRepository.findOne({ where: { id } }); + if (!user) throw new NotFoundException('User not found'); + + // Hash password if provided + if (dto.password) { + dto.password_hash = await bcrypt.hash(dto.password, 12); + delete dto.password; + } + + Object.assign(user, dto); + return this.userRepository.save(user); + } } diff --git a/frontend/src/pages/invoices/InvoicesPage.tsx b/frontend/src/pages/invoices/InvoicesPage.tsx index 0a00f73..b99cc0d 100644 --- a/frontend/src/pages/invoices/InvoicesPage.tsx +++ b/frontend/src/pages/invoices/InvoicesPage.tsx @@ -373,25 +373,17 @@ export const InvoicesPage = () => { -
-
- Invoice { - e.currentTarget.style.display = 'none'; - const token = localStorage.getItem('access_token'); - e.currentTarget.parentElement!.innerHTML = ` -
- -

تعذر عرض الملف

-

قد يكون الملف PDF أو حدث خطأ في التحميل.

- تحميل الملف لفتحه -
- `; - }} +
+
+