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 أو حدث خطأ في التحميل.

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