add permission to suppliers

This commit is contained in:
Aya
2026-05-06 15:17:58 +03:00
parent da4cb36036
commit 9e5dd47a2f
6 changed files with 153 additions and 19 deletions

View File

@@ -1624,3 +1624,12 @@ model Approval {
@@map("approvals") @@map("approvals")
} }
model SystemSetting {
key String @id
value String
category String @default("general")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("system_settings")
}

View File

@@ -8,13 +8,13 @@ const router = Router();
router.use(authenticate); router.use(authenticate);
router.get('/', authorize('contacts', 'contacts', 'read'), suppliersController.findAll); router.get('/', authorize('suppliers', 'suppliers', 'read'), suppliersController.findAll);
router.get('/stats', authorize('contacts', 'contacts', 'read'), suppliersController.getStats); router.get('/stats', authorize('suppliers', 'suppliers', 'read'), suppliersController.getStats);
router.get('/export', authorize('contacts', 'contacts', 'read'), suppliersController.export); router.get('/export', authorize('suppliers', 'suppliers', 'read'), suppliersController.export);
router.get( router.get(
'/:id', '/:id',
authorize('contacts', 'contacts', 'read'), authorize('suppliers', 'suppliers', 'read'),
param('id').isUUID(), param('id').isUUID(),
validate, validate,
suppliersController.findById suppliersController.findById
@@ -22,7 +22,7 @@ router.get(
router.post( router.post(
'/', '/',
authorize('contacts', 'contacts', 'create'), authorize('suppliers', 'suppliers', 'create'),
[ [
body('name').optional({ values: 'falsy' }).trim(), body('name').optional({ values: 'falsy' }).trim(),
body('companyName').optional({ values: 'falsy' }).trim(), body('companyName').optional({ values: 'falsy' }).trim(),
@@ -40,7 +40,7 @@ router.post(
router.put( router.put(
'/:id', '/:id',
authorize('contacts', 'contacts', 'update'), authorize('suppliers', 'suppliers', 'update'),
[ [
param('id').isUUID(), param('id').isUUID(),
body('email') body('email')
@@ -57,7 +57,7 @@ router.put(
router.post( router.post(
'/:id/archive', '/:id/archive',
authorize('contacts', 'contacts', 'archive'), authorize('suppliers', 'suppliers', 'archive'),
param('id').isUUID(), param('id').isUUID(),
validate, validate,
suppliersController.archive suppliersController.archive

View File

@@ -9,6 +9,7 @@ import LoadingSpinner from '@/components/LoadingSpinner';
const MODULES = [ const MODULES = [
{ id: 'contacts', name: 'إدارة جهات الاتصال', nameEn: 'Contact Management' }, { id: 'contacts', name: 'إدارة جهات الاتصال', nameEn: 'Contact Management' },
{ id: 'suppliers', name: 'إدارة الموردين', nameEn: 'Supplier Management' },
{ id: 'crm', name: 'إدارة علاقات العملاء', nameEn: 'CRM' }, { id: 'crm', name: 'إدارة علاقات العملاء', nameEn: 'CRM' },
{ id: 'tenders', name: 'إدارة الٍٍٍمناقصات', nameEn: 'Tender Management' }, { id: 'tenders', name: 'إدارة الٍٍٍمناقصات', nameEn: 'Tender Management' },
{ id: 'inventory', name: 'المخزون والأصول', nameEn: 'Inventory & Assets' }, { id: 'inventory', name: 'المخزون والأصول', nameEn: 'Inventory & Assets' },

View File

@@ -10,6 +10,7 @@ import LoadingSpinner from '@/components/LoadingSpinner';
const MODULES = [ const MODULES = [
{ id: 'contacts', name: 'إدارة جهات الاتصال', nameEn: 'Contact Management' }, { id: 'contacts', name: 'إدارة جهات الاتصال', nameEn: 'Contact Management' },
{ id: 'suppliers', name: 'إدارة الموردين', nameEn: 'Supplier Management' },
{ id: 'crm', name: 'إدارة علاقات العملاء', nameEn: 'CRM' }, { id: 'crm', name: 'إدارة علاقات العملاء', nameEn: 'CRM' },
{ id: 'tenders', name: 'إدارة المناقصات', nameEn: 'Tender Management' }, { id: 'tenders', name: 'إدارة المناقصات', nameEn: 'Tender Management' },
{ id: 'inventory', name: 'المخزون والأصول', nameEn: 'Inventory & Assets' }, { id: 'inventory', name: 'المخزون والأصول', nameEn: 'Inventory & Assets' },

File diff suppressed because one or more lines are too long

View File

@@ -551,7 +551,7 @@ const translations = {
view: 'عرض', view: 'عرض',
win: 'فوز', win: 'فوز',
lose: 'خسارة', lose: 'خسارة',
archive: 'أرشفة', delete: 'حذف',
deleteDeal: 'حذف الصفقة', deleteDeal: 'حذف الصفقة',
markWon: 'تحديد كفائز', markWon: 'تحديد كفائز',
markLost: 'تحديد كخاسر', markLost: 'تحديد كخاسر',
@@ -563,7 +563,7 @@ const translations = {
updateSuccess: 'تم تحديث الصفقة بنجاح', updateSuccess: 'تم تحديث الصفقة بنجاح',
winSuccess: 'تم الفوز بالصفقة بنجاح', winSuccess: 'تم الفوز بالصفقة بنجاح',
loseSuccess: 'تم تحديد الصفقة كخاسرة', loseSuccess: 'تم تحديد الصفقة كخاسرة',
deleteSuccess: 'تم أرشفة الصفقة بنجاح', deleteSuccess: 'تم حذف الصفقة بنجاح',
fixFormErrors: 'يرجى إصلاح أخطاء النموذج', fixFormErrors: 'يرجى إصلاح أخطاء النموذج',
pipelineRequired: 'مسار المبيعات مطلوب', pipelineRequired: 'مسار المبيعات مطلوب',
dealNameMin: 'اسم الصفقة يجب أن يكون 3 أحرف على الأقل', dealNameMin: 'اسم الصفقة يجب أن يكون 3 أحرف على الأقل',