diff --git a/README.md b/README.md index bd53632..49a5cd2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # codbex-contracts ### Model -Screenshot 2025-01-03 at 19 58 47 +![model](images/contracts-model.png) diff --git a/codbex-contracts/codbex-contracts.edm b/codbex-contracts/codbex-contracts.edm index 5b4a51d..d0534de 100644 --- a/codbex-contracts/codbex-contracts.edm +++ b/codbex-contracts/codbex-contracts.edm @@ -1,22 +1,22 @@ - + - + - + - + @@ -31,12 +31,12 @@ - + - + @@ -55,7 +55,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -86,5 +86,5 @@ - + \ No newline at end of file diff --git a/codbex-contracts/codbex-contracts.gen b/codbex-contracts/codbex-contracts.gen index a39795e..ee93b67 100644 --- a/codbex-contracts/codbex-contracts.gen +++ b/codbex-contracts/codbex-contracts.gen @@ -7,6 +7,28 @@ "fileName": "codbex-contracts", "genFolderName": "codbex-contracts", "dataSource": "DefaultDB", + "roles": [ + { + "entityName": "Contract", + "roleRead": "codbex-contracts.Contract.ContractReadOnly", + "roleWrite": "codbex-contracts.Contract.ContractFullAccess" + }, + { + "entityName": "ContractType", + "roleRead": "codbex-contracts.Settings.ContractTypeReadOnly", + "roleWrite": "codbex-contracts.Settings.ContractTypeFullAccess" + }, + { + "entityName": "EmployeeContract", + "roleRead": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly", + "roleWrite": "codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" + }, + { + "entityName": "EmployeeContractItem", + "roleRead": "codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly", + "roleWrite": "codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess" + } + ], "projectName": "codbex-contracts", "workspaceName": "workspace", "filePath": "codbex-contracts.model", @@ -33,6 +55,10 @@ "Contract-details", "Contract-details", "Contract-details", + "Contract-details", + "Contract-details", + "Contract-details", + "Contract-details", "Contract-details" ], "name": "Contract", @@ -84,6 +110,10 @@ "EmployeeContract-details", "EmployeeContract-details", "EmployeeContract-details", + "EmployeeContract-details", + "EmployeeContract-details", + "EmployeeContract-details", + "EmployeeContract-details", "EmployeeContract-details" ], "name": "EmployeeContracts", @@ -235,7 +265,7 @@ }, { "dataLength": "500", - "dataName": "CONTRACT_URL", + "dataName": "CONTRACT_DOCUMENT", "dataNullable": true, "dataType": "VARCHAR", "description": "", @@ -322,6 +352,7 @@ "description": "Manage entity Contract", "feedPassword": "YWRtaW4=", "feedUsername": "YWRtaW4=", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "importsCode": "import { NumberGeneratorService } from \"/codbex-number-generator/service/generator\";", @@ -336,6 +367,8 @@ "perspectiveName": "Contract", "perspectiveOrder": "100", "perspectiveRole": "", + "roleRead": "codbex-contracts.Contract.ContractReadOnly", + "roleWrite": "codbex-contracts.Contract.ContractFullAccess", "title": "Contract", "tooltip": "Contract", "type": "PRIMARY", @@ -459,7 +492,7 @@ }, { "dataLength": "500", - "dataName": "CONTRACT_URL", + "dataName": "CONTRACT_DOCUMENT", "dataNullable": true, "dataType": "VARCHAR", "description": "", @@ -602,6 +635,7 @@ "description": "Manage entity ContractType", "feedPassword": "YWRtaW4=", "feedUsername": "YWRtaW4=", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", @@ -615,6 +649,8 @@ "perspectiveName": "Settings", "perspectiveOrder": "999", "perspectiveRole": "", + "roleRead": "codbex-contracts.Settings.ContractTypeReadOnly", + "roleWrite": "codbex-contracts.Settings.ContractTypeFullAccess", "title": "ContractType", "tooltip": "ContractType", "type": "SETTING", @@ -940,6 +976,7 @@ "dataName": "COMPANY", "dataQuery": "", "description": "Manage entity Company", + "generateDefaultRoles": "false", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", @@ -1051,6 +1088,7 @@ "dataName": "JOBROLE", "dataQuery": "", "description": "Manage entity JobRole", + "generateDefaultRoles": "false", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", @@ -1374,6 +1412,7 @@ "dataName": "EMPLOYEECONTRACT", "dataQuery": "", "description": "Manage entity EmployeeContract", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "importsCode": "import { NumberGeneratorService } from \"/codbex-number-generator/service/generator\";", @@ -1388,6 +1427,8 @@ "perspectiveName": "EmployeeContracts", "perspectiveOrder": "103", "perspectiveRole": "", + "roleRead": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly", + "roleWrite": "codbex-contracts.EmployeeContracts.EmployeeContractFullAccess", "title": "EmployeeContract", "tooltip": "EmployeeContract", "type": "PRIMARY", @@ -1798,6 +1839,7 @@ "dataName": "EMPLOYEECONTRACTITEM", "dataQuery": "", "description": "Manage entity EmployeeContractItem", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE_DETAILS", @@ -1811,6 +1853,8 @@ "perspectiveName": "EmployeeContracts", "perspectiveOrder": "103", "perspectiveRole": "", + "roleRead": "codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly", + "roleWrite": "codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess", "title": "EmployeeContractItem", "tooltip": "EmployeeContractItem", "type": "DEPENDENT", @@ -2122,6 +2166,7 @@ "dataName": "EMPLOYEE", "dataQuery": "", "description": "Manage entity Employee", + "generateDefaultRoles": "false", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", diff --git a/codbex-contracts/codbex-contracts.model b/codbex-contracts/codbex-contracts.model index 1ca79cd..959835a 100644 --- a/codbex-contracts/codbex-contracts.model +++ b/codbex-contracts/codbex-contracts.model @@ -79,7 +79,7 @@ }, { "dataLength": "500", - "dataName": "CONTRACT_URL", + "dataName": "CONTRACT_DOCUMENT", "dataNullable": "true", "dataType": "VARCHAR", "description": "", @@ -130,6 +130,7 @@ "description": "Manage entity Contract", "feedPassword": "YWRtaW4=", "feedUsername": "YWRtaW4=", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "importsCode": "aW1wb3J0IHsgTnVtYmVyR2VuZXJhdG9yU2VydmljZSB9IGZyb20gIi9jb2RiZXgtbnVtYmVyLWdlbmVyYXRvci9zZXJ2aWNlL2dlbmVyYXRvciI7", @@ -144,6 +145,8 @@ "perspectiveName": "Contract", "perspectiveOrder": "100", "perspectiveRole": "", + "roleRead": "codbex-contracts.Contract.ContractReadOnly", + "roleWrite": "codbex-contracts.Contract.ContractFullAccess", "title": "Contract", "tooltip": "Contract", "type": "PRIMARY" @@ -185,6 +188,7 @@ "description": "Manage entity ContractType", "feedPassword": "YWRtaW4=", "feedUsername": "YWRtaW4=", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", @@ -198,6 +202,8 @@ "perspectiveName": "Settings", "perspectiveOrder": "999", "perspectiveRole": "", + "roleRead": "codbex-contracts.Settings.ContractTypeReadOnly", + "roleWrite": "codbex-contracts.Settings.ContractTypeFullAccess", "title": "ContractType", "tooltip": "ContractType", "type": "SETTING" @@ -388,6 +394,7 @@ "dataName": "COMPANY", "dataQuery": "", "description": "Manage entity Company", + "generateDefaultRoles": "false", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", @@ -459,6 +466,7 @@ "dataName": "JOBROLE", "dataQuery": "", "description": "Manage entity JobRole", + "generateDefaultRoles": "false", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", @@ -657,6 +665,7 @@ "dataName": "EMPLOYEECONTRACT", "dataQuery": "", "description": "Manage entity EmployeeContract", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "importsCode": "aW1wb3J0IHsgTnVtYmVyR2VuZXJhdG9yU2VydmljZSB9IGZyb20gIi9jb2RiZXgtbnVtYmVyLWdlbmVyYXRvci9zZXJ2aWNlL2dlbmVyYXRvciI7", @@ -671,6 +680,8 @@ "perspectiveName": "EmployeeContracts", "perspectiveOrder": "103", "perspectiveRole": "", + "roleRead": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly", + "roleWrite": "codbex-contracts.EmployeeContracts.EmployeeContractFullAccess", "title": "EmployeeContract", "tooltip": "EmployeeContract", "type": "PRIMARY" @@ -742,6 +753,7 @@ "dataName": "EMPLOYEECONTRACTITEM", "dataQuery": "", "description": "Manage entity EmployeeContractItem", + "generateDefaultRoles": "true", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE_DETAILS", @@ -755,6 +767,8 @@ "perspectiveName": "EmployeeContracts", "perspectiveOrder": "103", "perspectiveRole": "", + "roleRead": "codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly", + "roleWrite": "codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess", "title": "EmployeeContractItem", "tooltip": "EmployeeContractItem", "type": "DEPENDENT" @@ -938,6 +952,7 @@ "dataName": "EMPLOYEE", "dataQuery": "", "description": "Manage entity Employee", + "generateDefaultRoles": "false", "generateReport": "false", "icon": "/services/web/resources/unicons/file.svg", "layoutType": "MANAGE", diff --git a/codbex-contracts/events/EmployeeContractItem/EmployeeContractItemToRecord.extension b/codbex-contracts/events/EmployeeContractItem/EmployeeContractItemToRecord.extension index e8ddee1..e12c377 100644 --- a/codbex-contracts/events/EmployeeContractItem/EmployeeContractItemToRecord.extension +++ b/codbex-contracts/events/EmployeeContractItem/EmployeeContractItemToRecord.extension @@ -1,5 +1,6 @@ { "module": "codbex-contracts/events/EmployeeContractItem/EmployeeContractItemToRecordHandler.ts", "extensionPoint": "codbex-contracts-EmployeeContracts-EmployeeContract", - "description": "Employee contract Extension" + "description": "Employee contract Extension", + "role": "" } \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/api/Contract/ContractService.ts b/codbex-contracts/gen/codbex-contracts/api/Contract/ContractService.ts index 4b7b717..59ee6fb 100644 --- a/codbex-contracts/gen/codbex-contracts/api/Contract/ContractService.ts +++ b/codbex-contracts/gen/codbex-contracts/api/Contract/ContractService.ts @@ -1,6 +1,8 @@ import { Controller, Get, Post, Put, Delete, response } from "sdk/http" import { Extensions } from "sdk/extensions" import { ContractRepository, ContractEntityOptions } from "../../dao/Contract/ContractRepository"; +import { user } from "sdk/security" +import { ForbiddenError } from "../utils/ForbiddenError"; import { ValidationError } from "../utils/ValidationError"; import { HttpUtils } from "../utils/HttpUtils"; // custom imports @@ -16,6 +18,7 @@ class ContractService { @Get("/") public getAll(_: any, ctx: any) { try { + this.checkPermissions("read"); const options: ContractEntityOptions = { $limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : undefined, $offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : undefined @@ -30,6 +33,7 @@ class ContractService { @Post("/") public create(entity: any) { try { + this.checkPermissions("write"); this.validateEntity(entity); entity.Id = this.repository.create(entity); response.setHeader("Content-Location", "/services/ts/codbex-contracts/gen/codbex-contracts/api/Contract/ContractService.ts/" + entity.Id); @@ -43,6 +47,7 @@ class ContractService { @Get("/count") public count() { try { + this.checkPermissions("read"); return this.repository.count(); } catch (error: any) { this.handleError(error); @@ -52,6 +57,7 @@ class ContractService { @Post("/count") public countWithFilter(filter: any) { try { + this.checkPermissions("read"); return this.repository.count(filter); } catch (error: any) { this.handleError(error); @@ -61,6 +67,7 @@ class ContractService { @Post("/search") public search(filter: any) { try { + this.checkPermissions("read"); return this.repository.findAll(filter); } catch (error: any) { this.handleError(error); @@ -70,6 +77,7 @@ class ContractService { @Get("/:id") public getById(_: any, ctx: any) { try { + this.checkPermissions("read"); const id = parseInt(ctx.pathParameters.id); const entity = this.repository.findById(id); if (entity) { @@ -85,6 +93,7 @@ class ContractService { @Put("/:id") public update(entity: any, ctx: any) { try { + this.checkPermissions("write"); entity.Id = ctx.pathParameters.id; this.validateEntity(entity); this.repository.update(entity); @@ -97,6 +106,7 @@ class ContractService { @Delete("/:id") public deleteById(_: any, ctx: any) { try { + this.checkPermissions("write"); const id = ctx.pathParameters.id; const entity = this.repository.findById(id); if (entity) { @@ -120,6 +130,15 @@ class ContractService { } } + private checkPermissions(operationType: string) { + if (operationType === "read" && !(user.isInRole("codbex-contracts.Contract.ContractReadOnly") || user.isInRole("codbex-contracts.Contract.ContractFullAccess"))) { + throw new ForbiddenError(); + } + if (operationType === "write" && !user.isInRole("codbex-contracts.Contract.ContractFullAccess")) { + throw new ForbiddenError(); + } + } + private validateEntity(entity: any): void { if (entity.Number?.length > 20) { throw new ValidationError(`The 'Number' exceeds the maximum length of [20] characters`); diff --git a/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractItemService.ts b/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractItemService.ts index b08ed02..cd8b1b8 100644 --- a/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractItemService.ts +++ b/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractItemService.ts @@ -1,6 +1,8 @@ import { Controller, Get, Post, Put, Delete, response } from "sdk/http" import { Extensions } from "sdk/extensions" import { EmployeeContractItemRepository, EmployeeContractItemEntityOptions } from "../../dao/EmployeeContracts/EmployeeContractItemRepository"; +import { user } from "sdk/security" +import { ForbiddenError } from "../utils/ForbiddenError"; import { ValidationError } from "../utils/ValidationError"; import { HttpUtils } from "../utils/HttpUtils"; @@ -14,6 +16,7 @@ class EmployeeContractItemService { @Get("/") public getAll(_: any, ctx: any) { try { + this.checkPermissions("read"); const options: EmployeeContractItemEntityOptions = { $limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : undefined, $offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : undefined @@ -39,6 +42,7 @@ class EmployeeContractItemService { @Post("/") public create(entity: any) { try { + this.checkPermissions("write"); this.validateEntity(entity); entity.Id = this.repository.create(entity); response.setHeader("Content-Location", "/services/ts/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractItemService.ts/" + entity.Id); @@ -52,6 +56,7 @@ class EmployeeContractItemService { @Get("/count") public count() { try { + this.checkPermissions("read"); return this.repository.count(); } catch (error: any) { this.handleError(error); @@ -61,6 +66,7 @@ class EmployeeContractItemService { @Post("/count") public countWithFilter(filter: any) { try { + this.checkPermissions("read"); return this.repository.count(filter); } catch (error: any) { this.handleError(error); @@ -70,6 +76,7 @@ class EmployeeContractItemService { @Post("/search") public search(filter: any) { try { + this.checkPermissions("read"); return this.repository.findAll(filter); } catch (error: any) { this.handleError(error); @@ -79,6 +86,7 @@ class EmployeeContractItemService { @Get("/:id") public getById(_: any, ctx: any) { try { + this.checkPermissions("read"); const id = parseInt(ctx.pathParameters.id); const entity = this.repository.findById(id); if (entity) { @@ -94,6 +102,7 @@ class EmployeeContractItemService { @Put("/:id") public update(entity: any, ctx: any) { try { + this.checkPermissions("write"); entity.Id = ctx.pathParameters.id; this.validateEntity(entity); this.repository.update(entity); @@ -106,6 +115,7 @@ class EmployeeContractItemService { @Delete("/:id") public deleteById(_: any, ctx: any) { try { + this.checkPermissions("write"); const id = ctx.pathParameters.id; const entity = this.repository.findById(id); if (entity) { @@ -129,6 +139,15 @@ class EmployeeContractItemService { } } + private checkPermissions(operationType: string) { + if (operationType === "read" && !(user.isInRole("codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly") || user.isInRole("codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess"))) { + throw new ForbiddenError(); + } + if (operationType === "write" && !user.isInRole("codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess")) { + throw new ForbiddenError(); + } + } + private validateEntity(entity: any): void { if (entity.Name === null || entity.Name === undefined) { throw new ValidationError(`The 'Name' property is required, provide a valid value`); diff --git a/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractService.ts b/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractService.ts index 281799c..445b93f 100644 --- a/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractService.ts +++ b/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractService.ts @@ -1,6 +1,8 @@ import { Controller, Get, Post, Put, Delete, response } from "sdk/http" import { Extensions } from "sdk/extensions" import { EmployeeContractRepository, EmployeeContractEntityOptions } from "../../dao/EmployeeContracts/EmployeeContractRepository"; +import { user } from "sdk/security" +import { ForbiddenError } from "../utils/ForbiddenError"; import { ValidationError } from "../utils/ValidationError"; import { HttpUtils } from "../utils/HttpUtils"; // custom imports @@ -16,6 +18,7 @@ class EmployeeContractService { @Get("/") public getAll(_: any, ctx: any) { try { + this.checkPermissions("read"); const options: EmployeeContractEntityOptions = { $limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : undefined, $offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : undefined @@ -30,6 +33,7 @@ class EmployeeContractService { @Post("/") public create(entity: any) { try { + this.checkPermissions("write"); this.validateEntity(entity); entity.Id = this.repository.create(entity); response.setHeader("Content-Location", "/services/ts/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractService.ts/" + entity.Id); @@ -43,6 +47,7 @@ class EmployeeContractService { @Get("/count") public count() { try { + this.checkPermissions("read"); return this.repository.count(); } catch (error: any) { this.handleError(error); @@ -52,6 +57,7 @@ class EmployeeContractService { @Post("/count") public countWithFilter(filter: any) { try { + this.checkPermissions("read"); return this.repository.count(filter); } catch (error: any) { this.handleError(error); @@ -61,6 +67,7 @@ class EmployeeContractService { @Post("/search") public search(filter: any) { try { + this.checkPermissions("read"); return this.repository.findAll(filter); } catch (error: any) { this.handleError(error); @@ -70,6 +77,7 @@ class EmployeeContractService { @Get("/:id") public getById(_: any, ctx: any) { try { + this.checkPermissions("read"); const id = parseInt(ctx.pathParameters.id); const entity = this.repository.findById(id); if (entity) { @@ -85,6 +93,7 @@ class EmployeeContractService { @Put("/:id") public update(entity: any, ctx: any) { try { + this.checkPermissions("write"); entity.Id = ctx.pathParameters.id; this.validateEntity(entity); this.repository.update(entity); @@ -97,6 +106,7 @@ class EmployeeContractService { @Delete("/:id") public deleteById(_: any, ctx: any) { try { + this.checkPermissions("write"); const id = ctx.pathParameters.id; const entity = this.repository.findById(id); if (entity) { @@ -120,6 +130,15 @@ class EmployeeContractService { } } + private checkPermissions(operationType: string) { + if (operationType === "read" && !(user.isInRole("codbex-contracts.EmployeeContracts.EmployeeContractReadOnly") || user.isInRole("codbex-contracts.EmployeeContracts.EmployeeContractFullAccess"))) { + throw new ForbiddenError(); + } + if (operationType === "write" && !user.isInRole("codbex-contracts.EmployeeContracts.EmployeeContractFullAccess")) { + throw new ForbiddenError(); + } + } + private validateEntity(entity: any): void { if (entity.Number?.length > 20) { throw new ValidationError(`The 'Number' exceeds the maximum length of [20] characters`); diff --git a/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts b/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts index 4f90945..985843c 100644 --- a/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts +++ b/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts @@ -1,6 +1,8 @@ import { Controller, Get, Post, Put, Delete, response } from "sdk/http" import { Extensions } from "sdk/extensions" import { ContractTypeRepository, ContractTypeEntityOptions } from "../../dao/Settings/ContractTypeRepository"; +import { user } from "sdk/security" +import { ForbiddenError } from "../utils/ForbiddenError"; import { ValidationError } from "../utils/ValidationError"; import { HttpUtils } from "../utils/HttpUtils"; @@ -14,6 +16,7 @@ class ContractTypeService { @Get("/") public getAll(_: any, ctx: any) { try { + this.checkPermissions("read"); const options: ContractTypeEntityOptions = { $limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : undefined, $offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : undefined @@ -28,6 +31,7 @@ class ContractTypeService { @Post("/") public create(entity: any) { try { + this.checkPermissions("write"); this.validateEntity(entity); entity.Id = this.repository.create(entity); response.setHeader("Content-Location", "/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts/" + entity.Id); @@ -41,6 +45,7 @@ class ContractTypeService { @Get("/count") public count() { try { + this.checkPermissions("read"); return this.repository.count(); } catch (error: any) { this.handleError(error); @@ -50,6 +55,7 @@ class ContractTypeService { @Post("/count") public countWithFilter(filter: any) { try { + this.checkPermissions("read"); return this.repository.count(filter); } catch (error: any) { this.handleError(error); @@ -59,6 +65,7 @@ class ContractTypeService { @Post("/search") public search(filter: any) { try { + this.checkPermissions("read"); return this.repository.findAll(filter); } catch (error: any) { this.handleError(error); @@ -68,6 +75,7 @@ class ContractTypeService { @Get("/:id") public getById(_: any, ctx: any) { try { + this.checkPermissions("read"); const id = parseInt(ctx.pathParameters.id); const entity = this.repository.findById(id); if (entity) { @@ -83,6 +91,7 @@ class ContractTypeService { @Put("/:id") public update(entity: any, ctx: any) { try { + this.checkPermissions("write"); entity.Id = ctx.pathParameters.id; this.validateEntity(entity); this.repository.update(entity); @@ -95,6 +104,7 @@ class ContractTypeService { @Delete("/:id") public deleteById(_: any, ctx: any) { try { + this.checkPermissions("write"); const id = ctx.pathParameters.id; const entity = this.repository.findById(id); if (entity) { @@ -118,6 +128,15 @@ class ContractTypeService { } } + private checkPermissions(operationType: string) { + if (operationType === "read" && !(user.isInRole("codbex-contracts.Settings.ContractTypeReadOnly") || user.isInRole("codbex-contracts.Settings.ContractTypeFullAccess"))) { + throw new ForbiddenError(); + } + if (operationType === "write" && !user.isInRole("codbex-contracts.Settings.ContractTypeFullAccess")) { + throw new ForbiddenError(); + } + } + private validateEntity(entity: any): void { if (entity.Name?.length > 100) { throw new ValidationError(`The 'Name' exceeds the maximum length of [100] characters`); diff --git a/codbex-contracts/gen/codbex-contracts/dao/Contract/ContractRepository.ts b/codbex-contracts/gen/codbex-contracts/dao/Contract/ContractRepository.ts index 0b8a8d3..a57fd94 100644 --- a/codbex-contracts/gen/codbex-contracts/dao/Contract/ContractRepository.ts +++ b/codbex-contracts/gen/codbex-contracts/dao/Contract/ContractRepository.ts @@ -159,7 +159,7 @@ export class ContractRepository { }, { name: "Document", - column: "CONTRACT_URL", + column: "CONTRACT_DOCUMENT", type: "VARCHAR", }, { diff --git a/codbex-contracts/gen/codbex-contracts/index.html b/codbex-contracts/gen/codbex-contracts/index.html index ccbab3b..2c7b0c9 100644 --- a/codbex-contracts/gen/codbex-contracts/index.html +++ b/codbex-contracts/gen/codbex-contracts/index.html @@ -49,7 +49,7 @@ .constant('extensionPoint', { perspectives: "codbex-contracts", views: "codbex-contracts-view", - dialogWindows: "codbex-contracts-dialog-window" + dialogWindows: "dialog-window" }) .config(["messageHubProvider", function (messageHubProvider) { messageHubProvider.eventIdPrefix = 'codbex-contracts.launchpad.Home'; diff --git a/codbex-contracts/gen/codbex-contracts/roles/default-roles.roles b/codbex-contracts/gen/codbex-contracts/roles/default-roles.roles new file mode 100644 index 0000000..9036b9d --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/roles/default-roles.roles @@ -0,0 +1,34 @@ +[ + { + "name": "codbex-contracts.Contract.ContractReadOnly", + "description": "A role that grants read only permission for Contract." + }, + { + "name": "codbex-contracts.Contract.ContractFullAccess", + "description": "A role that grants full access for Contract." + }, + { + "name": "codbex-contracts.Settings.ContractTypeReadOnly", + "description": "A role that grants read only permission for ContractType." + }, + { + "name": "codbex-contracts.Settings.ContractTypeFullAccess", + "description": "A role that grants full access for ContractType." + }, + { + "name": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly", + "description": "A role that grants read only permission for EmployeeContract." + }, + { + "name": "codbex-contracts.EmployeeContracts.EmployeeContractFullAccess", + "description": "A role that grants full access for EmployeeContract." + }, + { + "name": "codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly", + "description": "A role that grants read only permission for EmployeeContractItem." + }, + { + "name": "codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess", + "description": "A role that grants full access for EmployeeContractItem." + } +] \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/schema/codbex-contracts.schema b/codbex-contracts/gen/codbex-contracts/schema/codbex-contracts.schema index 6c1ef06..e286e1b 100644 --- a/codbex-contracts/gen/codbex-contracts/schema/codbex-contracts.schema +++ b/codbex-contracts/gen/codbex-contracts/schema/codbex-contracts.schema @@ -37,7 +37,7 @@ "type": "VARCHAR", "length": 500, "nullable": true, - "name": "CONTRACT_URL" + "name": "CONTRACT_DOCUMENT" }, { "type": "INTEGER", diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.extension index 5b56bf0..608e06f 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.extension @@ -1,5 +1,6 @@ { "module": "codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.js", - "extensionPoint": "codbex-contracts-dialog-window", - "description": "codbex-contracts - Application Dialog Window" + "extensionPoint": "dialog-window", + "description": "codbex-contracts - Application Dialog Window", + "role": "codbex-contracts.Contract.ContractReadOnly,codbex-contracts.Contract.ContractFullAccess" } \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.js index 3bd357b..253b9bc 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/view.js @@ -7,7 +7,7 @@ const viewData = { id: "Contract-filter", label: "Contract Filter", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-filter/index.html", - perspectiveName: "Contract", + perspectiveName: "Contract" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/controller.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/controller.js new file mode 100644 index 0000000..b45c246 --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/controller.js @@ -0,0 +1,101 @@ +angular.module('page', ["ideUI", "ideView", "entityApi"]) + .config(["messageHubProvider", function (messageHubProvider) { + messageHubProvider.eventIdPrefix = 'codbex-contracts.Contract.Contract'; + }]) + .config(["entityApiProvider", function (entityApiProvider) { + entityApiProvider.baseUrl = "/services/ts/codbex-contracts/gen/codbex-contracts/api/Contract/ContractService.ts"; + }]) + .controller('PageController', ['$scope', '$http', 'messageHub', 'ViewParameters', 'entityApi', function ($scope, $http, messageHub, ViewParameters, entityApi) { + + $scope.entity = {}; + $scope.forms = { + details: {}, + }; + $scope.formHeaders = { + select: "Contract Details", + create: "Create Contract", + update: "Update Contract" + }; + $scope.action = 'select'; + + let params = ViewParameters.get(); + if (Object.keys(params).length) { + $scope.action = params.action; + if (params.entity.StartDate) { + params.entity.StartDate = new Date(params.entity.StartDate); + } + if (params.entity.EndDate) { + params.entity.EndDate = new Date(params.entity.EndDate); + } + $scope.entity = params.entity; + $scope.selectedMainEntityKey = params.selectedMainEntityKey; + $scope.selectedMainEntityId = params.selectedMainEntityId; + $scope.optionsCompany = params.optionsCompany; + $scope.optionsType = params.optionsType; + } + + $scope.create = function () { + let entity = $scope.entity; + entity[$scope.selectedMainEntityKey] = $scope.selectedMainEntityId; + entityApi.create(entity).then(function (response) { + if (response.status != 201) { + $scope.errorMessage = `Unable to create Contract: '${response.message}'`; + return; + } + messageHub.postMessage("entityCreated", response.data); + $scope.cancel(); + messageHub.showAlertSuccess("Contract", "Contract successfully created"); + }); + }; + + $scope.update = function () { + let id = $scope.entity.Id; + let entity = $scope.entity; + entity[$scope.selectedMainEntityKey] = $scope.selectedMainEntityId; + entityApi.update(id, entity).then(function (response) { + if (response.status != 200) { + $scope.errorMessage = `Unable to update Contract: '${response.message}'`; + return; + } + messageHub.postMessage("entityUpdated", response.data); + $scope.cancel(); + messageHub.showAlertSuccess("Contract", "Contract successfully updated"); + }); + }; + + $scope.serviceCompany = "/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts"; + + $scope.optionsCompany = []; + + $http.get("/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts").then(function (response) { + $scope.optionsCompany = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + $scope.serviceType = "/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts"; + + $scope.optionsType = []; + + $http.get("/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts").then(function (response) { + $scope.optionsType = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + + $scope.cancel = function () { + $scope.entity = {}; + $scope.action = 'select'; + messageHub.closeDialogWindow("Contract-details"); + }; + + $scope.clearErrorMessage = function () { + $scope.errorMessage = null; + }; + + }]); \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/index.html b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/index.html new file mode 100644 index 0000000..f6a3721 --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/index.html @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ Number +
+
+ + + + The value doesn't match the required pattern '' + + +
+
+ +
+ StartDate +
+
+ + + + Incorrect Input + + +
+
+ +
+ EndDate +
+
+ + + + Incorrect Input + + +
+
+ +
+ Company +
+
+ + + +
+
+ +
+ Document +
+ +
+ + + + The value doesn't match the required pattern '' + + +
+
+ +
+ Type +
+
+ + + +
+
+ +
+ Comment +
+
+ + + + The value doesn't match the required pattern '' + + +
+
+
+
+
+ + + + + + + + + + + + + + + diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/view.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/view.extension new file mode 100644 index 0000000..cc961bc --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/view.extension @@ -0,0 +1,6 @@ +{ + "module": "{{projectName}}/gen/{{genFolderName}}/ui/{{perspectiveName}}/{{name}}/dialog-window/view.js", + "extensionPoint": "dialog-window", + "description": "{{projectName}} - Application Dialog Window", + "role": "codbex-contracts.Contract.ContractReadOnly,codbex-contracts.Contract.ContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/view.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/view.js new file mode 100644 index 0000000..7962faf --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/view.js @@ -0,0 +1,20 @@ +/* + * Generated by Eclipse Dirigible based on model and template. + * + * Do not modify the content as it may be re-generated again. + */ +const viewData = { + id: "Contract-details", + label: "Contract", + link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/dialog-window/index.html", + perspectiveName: "Contract", + roles: [ + "codbex-contracts.Contract.ContractReadOnly", + ] +}; + +if (typeof exports !== 'undefined') { + exports.getDialogWindow = function () { + return viewData; + } +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/controller.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/controller.js index c52fe99..d936c90 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/controller.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/controller.js @@ -5,7 +5,7 @@ angular.module('page', ["ideUI", "ideView", "entityApi"]) .config(["entityApiProvider", function (entityApiProvider) { entityApiProvider.baseUrl = "/services/ts/codbex-contracts/gen/codbex-contracts/api/Contract/ContractService.ts"; }]) - .controller('PageController', ['$scope', 'Extensions', 'messageHub', 'entityApi', function ($scope, Extensions, messageHub, entityApi) { + .controller('PageController', ['$scope', '$http', 'Extensions', 'messageHub', 'entityApi', function ($scope, $http, Extensions, messageHub, entityApi) { $scope.entity = {}; $scope.forms = { @@ -117,5 +117,52 @@ angular.module('page', ["ideUI", "ideView", "entityApi"]) $scope.cancel = function () { messageHub.postMessage("clearDetails"); }; + + //-----------------Dialogs-------------------// + + $scope.createCompany = function () { + messageHub.showDialogWindow("Company-details", { + action: "create", + entity: {}, + }, null, false); + }; + $scope.createType = function () { + messageHub.showDialogWindow("ContractType-details", { + action: "create", + entity: {}, + }, null, false); + }; + + //-----------------Dialogs-------------------// + + + + //----------------Dropdowns-----------------// + + $scope.refreshCompany = function () { + $scope.optionsCompany = []; + $http.get("/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts").then(function (response) { + $scope.optionsCompany = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + }; + $scope.refreshType = function () { + $scope.optionsType = []; + $http.get("/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts").then(function (response) { + $scope.optionsType = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + }; + + //----------------Dropdowns-----------------// + }]); \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/index.html b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/index.html index 27bea7a..189425c 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/index.html +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/index.html @@ -84,7 +84,7 @@
Company
-
+
-
+
+ + + +
@@ -127,7 +135,7 @@
Type
-
+
-
+
+ + + +
diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.extension index 8b4eb5c..0de3b80 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.js","extensionPoint":"codbex-contracts-view","description":"codbex-contracts - Application View - Main Details"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.js", + "extensionPoint": "codbex-contracts-view", + "description": "codbex-contracts - Application View - Main Details", + "role": "codbex-contracts.Contract.ContractReadOnly,codbex-contracts.Contract.ContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.js index e24eebb..9a3a6bc 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/view.js @@ -9,7 +9,7 @@ const viewData = { factory: "frame", region: "center", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/main-details/index.html", - perspectiveName: "Contract", + perspectiveName: "Contract" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile-portal.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile-portal.extension index 3d0629c..b81b995 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile-portal.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile-portal.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js","extensionPoint":"portal-tile","description":"codbex-contracts - Application Tile"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js", + "extensionPoint": "portal-tile", + "description": "codbex-contracts - Application Tile", + "role": "codbex-contracts.Contract.ContractReadOnly,codbex-contracts.Contract.ContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.extension index 3ce5e57..6841e40 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js","extensionPoint":"codbex-contracts-tile","description":"codbex-contracts - Application Tile"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js", + "extensionPoint": "codbex-contracts-tile", + "description": "codbex-contracts - Application Tile", + "role": "codbex-contracts.Contract.ContractReadOnly,codbex-contracts.Contract.ContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js index e51e4dd..aeb162b 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/tile.js @@ -14,6 +14,6 @@ exports.getTile = function () { icon: "/services/web/resources/unicons/file.svg", location: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Contract/index.html", order: "100", - groupOrder: "100", + groupOrder: "100" }; -}; +} diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.extension index dcc2130..310aa42 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.js","extensionPoint":"codbex-contracts-view","description":"codbex-contracts - Application View"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.js", + "extensionPoint": "codbex-contracts-view", + "description": "codbex-contracts - Application View", + "role": "codbex-contracts.Contract.ContractReadOnly,codbex-contracts.Contract.ContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.js index 25ae0b1..1481a00 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/view.js @@ -9,7 +9,7 @@ const viewData = { factory: "frame", region: "left", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Contract/Contract/index.html", - perspectiveName: "Contract", + perspectiveName: "Contract" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/index.html b/codbex-contracts/gen/codbex-contracts/ui/Contract/index.html index ee5e8fe..3de1caa 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/index.html +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/index.html @@ -52,7 +52,7 @@ .constant('extensionPoint', { perspectives: 'codbex-contracts', views: 'codbex-contracts-view', - dialogWindows: 'codbex-contracts-dialog-window' + dialogWindows: 'dialog-window' }) .controller('ApplicationController', ['$scope', 'messageHub', 'Extensions', function ($scope, messageHub, Extensions) { $scope.state = { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective-portal.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective-portal.extension index 2fa88fd..209f153 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective-portal.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective-portal.extension @@ -1 +1,5 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js","extensionPoint":"portal","description":"codbex-contracts - Perspective - Contract"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js", + "extensionPoint": "portal", + "description": "codbex-contracts - Perspective - Contract" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.extension b/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.extension index c614a6e..631e524 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.extension @@ -1 +1,5 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js","extensionPoint":"codbex-contracts","description":"codbex-contracts - Perspective - Contract"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js", + "extensionPoint": "codbex-contracts", + "description": "codbex-contracts - Perspective - Contract" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js b/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js index f3a8b25..aaa0c27 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Contract/perspective.js @@ -7,8 +7,8 @@ const perspectiveData = { id: 'Contract', name: 'Contract', link: '/services/web/codbex-contracts/gen/codbex-contracts/ui/Contract/index.html', - order: 100, - icon: '/services/web/resources/unicons/document-info.svg', + order: '100', + icon: '/services/web/resources/unicons/document-info.svg' }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.extension index 8e45eea..9da6106 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.extension @@ -1,5 +1,6 @@ { "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.js", - "extensionPoint": "codbex-contracts-dialog-window", - "description": "codbex-contracts - Application Dialog Window" + "extensionPoint": "dialog-window", + "description": "codbex-contracts - Application Dialog Window", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess" } \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.js index c3be0e4..a09bc20 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/view.js @@ -7,7 +7,7 @@ const viewData = { id: "EmployeeContractItem-filter", label: "EmployeeContractItem Filter", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-filter/index.html", - perspectiveName: "EmployeeContracts", + perspectiveName: "EmployeeContracts" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.extension index f7dd189..a9f6036 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.extension @@ -1,5 +1,6 @@ { "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.js", - "extensionPoint": "codbex-contracts-dialog-window", - "description": "codbex-contracts - Application Dialog Window" + "extensionPoint": "dialog-window", + "description": "codbex-contracts - Application Dialog Window", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess" } \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.js index e9a13a3..de55c3c 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/view.js @@ -7,7 +7,7 @@ const viewData = { id: "EmployeeContractItem-details", label: "EmployeeContractItem", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/dialog-window/index.html", - perspectiveName: "EmployeeContracts", + perspectiveName: "EmployeeContracts" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.extension index 359d035..e093b5e 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.extension @@ -1,5 +1,6 @@ { "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.js", "extensionPoint": "codbex-contracts-view", - "description": "codbex-contracts - Application View - Details" + "description": "codbex-contracts - Application View - Details", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractItemReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractItemFullAccess" } \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.js index b8ac21b..99bd37c 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/view.js @@ -9,7 +9,7 @@ const viewData = { factory: "frame", region: "bottom", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/EmployeeContractItem/index.html", - perspectiveName: "EmployeeContracts", + perspectiveName: "EmployeeContracts" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.extension index 9b2bed5..e08eb7e 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.extension @@ -1,5 +1,6 @@ { "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.js", - "extensionPoint": "codbex-contracts-dialog-window", - "description": "codbex-contracts - Application Dialog Window" + "extensionPoint": "dialog-window", + "description": "codbex-contracts - Application Dialog Window", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" } \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.js index 85f963a..60af3ab 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/view.js @@ -7,7 +7,7 @@ const viewData = { id: "EmployeeContract-filter", label: "EmployeeContract Filter", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-filter/index.html", - perspectiveName: "EmployeeContracts", + perspectiveName: "EmployeeContracts" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/controller.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/controller.js new file mode 100644 index 0000000..f812486 --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/controller.js @@ -0,0 +1,127 @@ +angular.module('page', ["ideUI", "ideView", "entityApi"]) + .config(["messageHubProvider", function (messageHubProvider) { + messageHubProvider.eventIdPrefix = 'codbex-contracts.EmployeeContracts.EmployeeContract'; + }]) + .config(["entityApiProvider", function (entityApiProvider) { + entityApiProvider.baseUrl = "/services/ts/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractService.ts"; + }]) + .controller('PageController', ['$scope', '$http', 'messageHub', 'ViewParameters', 'entityApi', function ($scope, $http, messageHub, ViewParameters, entityApi) { + + $scope.entity = {}; + $scope.forms = { + details: {}, + }; + $scope.formHeaders = { + select: "EmployeeContract Details", + create: "Create EmployeeContract", + update: "Update EmployeeContract" + }; + $scope.action = 'select'; + + let params = ViewParameters.get(); + if (Object.keys(params).length) { + $scope.action = params.action; + if (params.entity.StartDate) { + params.entity.StartDate = new Date(params.entity.StartDate); + } + if (params.entity.EndDate) { + params.entity.EndDate = new Date(params.entity.EndDate); + } + $scope.entity = params.entity; + $scope.selectedMainEntityKey = params.selectedMainEntityKey; + $scope.selectedMainEntityId = params.selectedMainEntityId; + $scope.optionsEmployee = params.optionsEmployee; + $scope.optionsCompany = params.optionsCompany; + $scope.optionsJobRole = params.optionsJobRole; + $scope.optionsType = params.optionsType; + } + + $scope.create = function () { + let entity = $scope.entity; + entity[$scope.selectedMainEntityKey] = $scope.selectedMainEntityId; + entityApi.create(entity).then(function (response) { + if (response.status != 201) { + $scope.errorMessage = `Unable to create EmployeeContract: '${response.message}'`; + return; + } + messageHub.postMessage("entityCreated", response.data); + $scope.cancel(); + messageHub.showAlertSuccess("EmployeeContract", "EmployeeContract successfully created"); + }); + }; + + $scope.update = function () { + let id = $scope.entity.Id; + let entity = $scope.entity; + entity[$scope.selectedMainEntityKey] = $scope.selectedMainEntityId; + entityApi.update(id, entity).then(function (response) { + if (response.status != 200) { + $scope.errorMessage = `Unable to update EmployeeContract: '${response.message}'`; + return; + } + messageHub.postMessage("entityUpdated", response.data); + $scope.cancel(); + messageHub.showAlertSuccess("EmployeeContract", "EmployeeContract successfully updated"); + }); + }; + + $scope.serviceEmployee = "/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeService.ts"; + + $scope.optionsEmployee = []; + + $http.get("/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeService.ts").then(function (response) { + $scope.optionsEmployee = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + $scope.serviceCompany = "/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts"; + + $scope.optionsCompany = []; + + $http.get("/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts").then(function (response) { + $scope.optionsCompany = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + $scope.serviceJobRole = "/services/ts/codbex-companies/gen/codbex-companies/api/Companies/JobRoleService.ts"; + + $scope.optionsJobRole = []; + + $http.get("/services/ts/codbex-companies/gen/codbex-companies/api/Companies/JobRoleService.ts").then(function (response) { + $scope.optionsJobRole = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + $scope.serviceType = "/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts"; + + $scope.optionsType = []; + + $http.get("/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts").then(function (response) { + $scope.optionsType = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + + $scope.cancel = function () { + $scope.entity = {}; + $scope.action = 'select'; + messageHub.closeDialogWindow("EmployeeContract-details"); + }; + + $scope.clearErrorMessage = function () { + $scope.errorMessage = null; + }; + + }]); \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/index.html b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/index.html new file mode 100644 index 0000000..c638581 --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/index.html @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + +
+ Number +
+
+ + + + The value doesn't match the required pattern '' + + +
+
+ +
+ Employee +
+
+ + + +
+
+ +
+ StartDate +
+
+ + + + Incorrect Input + + +
+
+ +
+ EndDate +
+
+ + + + Incorrect Input + + +
+
+ +
+ Company +
+
+ + + +
+
+ +
+ JobRole +
+
+ + + +
+
+ +
+ AnnualPaidLeave +
+
+ + + +
+
+ +
+ Document +
+ +
+ + + + The value doesn't match the required pattern '' + + +
+
+ +
+ Type +
+
+ + + +
+
+ +
+ Comment +
+
+ + + + The value doesn't match the required pattern '' + + +
+
+
+
+
+ + + + + + + + + + + + + + + diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/view.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/view.extension new file mode 100644 index 0000000..f09e3b4 --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/view.extension @@ -0,0 +1,6 @@ +{ + "module": "{{projectName}}/gen/{{genFolderName}}/ui/{{perspectiveName}}/{{name}}/dialog-window/view.js", + "extensionPoint": "dialog-window", + "description": "{{projectName}} - Application Dialog Window", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/view.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/view.js new file mode 100644 index 0000000..714cd57 --- /dev/null +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/view.js @@ -0,0 +1,20 @@ +/* + * Generated by Eclipse Dirigible based on model and template. + * + * Do not modify the content as it may be re-generated again. + */ +const viewData = { + id: "EmployeeContract-details", + label: "EmployeeContract", + link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/dialog-window/index.html", + perspectiveName: "EmployeeContracts", + roles: [ + "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly", + ] +}; + +if (typeof exports !== 'undefined') { + exports.getDialogWindow = function () { + return viewData; + } +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/controller.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/controller.js index 76e055d..28bf45c 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/controller.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/controller.js @@ -5,7 +5,7 @@ angular.module('page', ["ideUI", "ideView", "entityApi"]) .config(["entityApiProvider", function (entityApiProvider) { entityApiProvider.baseUrl = "/services/ts/codbex-contracts/gen/codbex-contracts/api/EmployeeContracts/EmployeeContractService.ts"; }]) - .controller('PageController', ['$scope', 'Extensions', 'messageHub', 'entityApi', function ($scope, Extensions, messageHub, entityApi) { + .controller('PageController', ['$scope', '$http', 'Extensions', 'messageHub', 'entityApi', function ($scope, $http, Extensions, messageHub, entityApi) { $scope.entity = {}; $scope.forms = { @@ -127,5 +127,86 @@ angular.module('page', ["ideUI", "ideView", "entityApi"]) $scope.cancel = function () { messageHub.postMessage("clearDetails"); }; + + //-----------------Dialogs-------------------// + + $scope.createEmployee = function () { + messageHub.showDialogWindow("Employee-details", { + action: "create", + entity: {}, + }, null, false); + }; + $scope.createCompany = function () { + messageHub.showDialogWindow("Company-details", { + action: "create", + entity: {}, + }, null, false); + }; + $scope.createJobRole = function () { + messageHub.showDialogWindow("JobRole-details", { + action: "create", + entity: {}, + }, null, false); + }; + $scope.createType = function () { + messageHub.showDialogWindow("ContractType-details", { + action: "create", + entity: {}, + }, null, false); + }; + + //-----------------Dialogs-------------------// + + + + //----------------Dropdowns-----------------// + + $scope.refreshEmployee = function () { + $scope.optionsEmployee = []; + $http.get("/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeService.ts").then(function (response) { + $scope.optionsEmployee = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + }; + $scope.refreshCompany = function () { + $scope.optionsCompany = []; + $http.get("/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts").then(function (response) { + $scope.optionsCompany = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + }; + $scope.refreshJobRole = function () { + $scope.optionsJobRole = []; + $http.get("/services/ts/codbex-companies/gen/codbex-companies/api/Companies/JobRoleService.ts").then(function (response) { + $scope.optionsJobRole = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + }; + $scope.refreshType = function () { + $scope.optionsType = []; + $http.get("/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts").then(function (response) { + $scope.optionsType = response.data.map(e => { + return { + value: e.Id, + text: e.Name + } + }); + }); + }; + + //----------------Dropdowns-----------------// + }]); \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/index.html b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/index.html index c368bec..3d01da8 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/index.html +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/index.html @@ -46,7 +46,7 @@
Employee
-
+
-
+
+ + + +
@@ -101,7 +109,7 @@
Company
-
+
-
+
+ + + +
JobRole
-
+
-
+
+ + + +
@@ -178,7 +202,7 @@
Type
-
+
-
+
+ + + +
diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.extension index ef0302c..0f8394e 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.js","extensionPoint":"codbex-contracts-view","description":"codbex-contracts - Application View - Main Details"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.js", + "extensionPoint": "codbex-contracts-view", + "description": "codbex-contracts - Application View - Main Details", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.js index 3a517d5..f8c4c93 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/view.js @@ -9,7 +9,7 @@ const viewData = { factory: "frame", region: "center", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/main-details/index.html", - perspectiveName: "EmployeeContracts", + perspectiveName: "EmployeeContracts" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile-portal.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile-portal.extension index 781e36c..c496ac0 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile-portal.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile-portal.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js","extensionPoint":"portal-tile","description":"codbex-contracts - Application Tile"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js", + "extensionPoint": "portal-tile", + "description": "codbex-contracts - Application Tile", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.extension index 392a116..8c346af 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js","extensionPoint":"codbex-contracts-tile","description":"codbex-contracts - Application Tile"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js", + "extensionPoint": "codbex-contracts-tile", + "description": "codbex-contracts - Application Tile", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js index 779816a..eb5de4d 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/tile.js @@ -14,6 +14,6 @@ exports.getTile = function () { icon: "/services/web/resources/unicons/file.svg", location: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/index.html", order: "100", - groupOrder: "103", + groupOrder: "103" }; -}; +} diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.extension index 4a5b75b..eda40df 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.js","extensionPoint":"codbex-contracts-view","description":"codbex-contracts - Application View"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.js", + "extensionPoint": "codbex-contracts-view", + "description": "codbex-contracts - Application View", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.js index c83fe28..631307a 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/view.js @@ -9,7 +9,7 @@ const viewData = { factory: "frame", region: "left", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/EmployeeContract/index.html", - perspectiveName: "EmployeeContracts", + perspectiveName: "EmployeeContracts" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/index.html b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/index.html index 0ad09d3..e82bf78 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/index.html +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/index.html @@ -52,7 +52,7 @@ .constant('extensionPoint', { perspectives: 'codbex-contracts', views: 'codbex-contracts-view', - dialogWindows: 'codbex-contracts-dialog-window' + dialogWindows: 'dialog-window' }) .controller('ApplicationController', ['$scope', 'messageHub', 'Extensions', function ($scope, messageHub, Extensions) { $scope.state = { diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective-portal.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective-portal.extension index 16548fc..3f4f1f3 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective-portal.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective-portal.extension @@ -1 +1,5 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js","extensionPoint":"portal","description":"codbex-contracts - Perspective - EmployeeContracts"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js", + "extensionPoint": "portal", + "description": "codbex-contracts - Perspective - EmployeeContracts" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.extension b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.extension index 59294f4..e93cdbd 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.extension @@ -1 +1,5 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js","extensionPoint":"codbex-contracts","description":"codbex-contracts - Perspective - EmployeeContracts"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js", + "extensionPoint": "codbex-contracts", + "description": "codbex-contracts - Perspective - EmployeeContracts" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js index e66d1c5..be0c9ae 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js +++ b/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/perspective.js @@ -7,8 +7,8 @@ const perspectiveData = { id: 'EmployeeContracts', name: 'EmployeeContracts', link: '/services/web/codbex-contracts/gen/codbex-contracts/ui/EmployeeContracts/index.html', - order: 103, - icon: '/services/web/resources/unicons/book-open.svg', + order: '103', + icon: '/services/web/resources/unicons/book-open.svg' }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.extension b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.extension index 6ca20d6..20998da 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.extension @@ -1,5 +1,6 @@ { "module": "codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.js", - "extensionPoint": "codbex-contracts-dialog-window", - "description": "codbex-contracts - Application Dialog Window" + "extensionPoint": "dialog-window", + "description": "codbex-contracts - Application Dialog Window", + "role": "codbex-contracts.Settings.ContractTypeReadOnly,codbex-contracts.Settings.ContractTypeFullAccess" } \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.js b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.js index c8e4f09..8f4a25e 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/view.js @@ -7,7 +7,7 @@ const viewData = { id: "ContractType-filter", label: "ContractType Filter", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-filter/index.html", - perspectiveName: "Settings", + perspectiveName: "Settings" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/controller.js b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/controller.js index 97f4af2..9458a9c 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/controller.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/controller.js @@ -5,7 +5,7 @@ angular.module('page', ["ideUI", "ideView", "entityApi"]) .config(["entityApiProvider", function (entityApiProvider) { entityApiProvider.baseUrl = "/services/ts/codbex-contracts/gen/codbex-contracts/api/Settings/ContractTypeService.ts"; }]) - .controller('PageController', ['$scope', 'messageHub', 'ViewParameters', 'entityApi', function ($scope, messageHub, ViewParameters, entityApi) { + .controller('PageController', ['$scope', 'messageHub', 'ViewParameters', 'entityApi', function ($scope, messageHub, ViewParameters, entityApi) { $scope.entity = {}; $scope.forms = { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.extension b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.extension index 0232e1a..79e46f7 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.js","extensionPoint":"codbex-contracts-dialog-window","description":"codbex-contracts - Application Dialog Window"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.js", + "extensionPoint": "dialog-window", + "description": "codbex-contracts - Application Dialog Window", + "role": "codbex-contracts.Settings.ContractTypeReadOnly,codbex-contracts.Settings.ContractTypeFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.js b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.js index 83ceed1..bbf95dc 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/view.js @@ -7,7 +7,7 @@ const viewData = { id: "ContractType-details", label: "ContractType", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/dialog-window/index.html", - perspectiveName: "Settings", + perspectiveName: "Settings" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile-portal.extension b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile-portal.extension index f2ff204..8127b8f 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile-portal.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile-portal.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js","extensionPoint":"portal-tile","description":"codbex-contracts - Application Tile"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js", + "extensionPoint": "portal-tile", + "description": "codbex-contracts - Application Tile", + "role": "codbex-contracts.Settings.ContractTypeReadOnly,codbex-contracts.Settings.ContractTypeFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.extension b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.extension index 9546743..658cf60 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js","extensionPoint":"codbex-contracts-tile","description":"codbex-contracts - Application Tile"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js", + "extensionPoint": "codbex-contracts-tile", + "description": "codbex-contracts - Application Tile", + "role": "codbex-contracts.Settings.ContractTypeReadOnly,codbex-contracts.Settings.ContractTypeFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js index 9daa39c..b11498c 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/tile.js @@ -14,6 +14,6 @@ exports.getTile = function () { icon: "/services/web/resources/unicons/file.svg", location: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Settings/index.html", order: "100", - groupOrder: "999", + groupOrder: "999" }; -}; +} diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.extension b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.extension index e32f57d..3814e1b 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.extension @@ -1 +1,6 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.js","extensionPoint":"codbex-contracts-view","description":"codbex-contracts - Application View"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.js", + "extensionPoint": "codbex-contracts-view", + "description": "codbex-contracts - Application View", + "role": "codbex-contracts.Settings.ContractTypeReadOnly,codbex-contracts.Settings.ContractTypeFullAccess" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.js b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.js index b392bca..2da1a5a 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/view.js @@ -9,7 +9,7 @@ const viewData = { factory: "frame", region: "center", link: "/services/web/codbex-contracts/gen/codbex-contracts/ui/Settings/ContractType/index.html", - perspectiveName: "Settings", + perspectiveName: "Settings" }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/index.html b/codbex-contracts/gen/codbex-contracts/ui/Settings/index.html index e57ae3b..f05295f 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/index.html +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/index.html @@ -52,7 +52,7 @@ .constant('extensionPoint', { perspectives: 'codbex-contracts', views: 'codbex-contracts-view', - dialogWindows: 'codbex-contracts-dialog-window' + dialogWindows: 'dialog-window' }) .controller('ApplicationController', ['$scope', 'messageHub', 'Extensions', function ($scope, messageHub, Extensions) { $scope.state = { diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective-portal.extension b/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective-portal.extension index 6bc89b3..3de8437 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective-portal.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective-portal.extension @@ -1 +1,5 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js","extensionPoint":"portal","description":"codbex-contracts - Perspective - Settings"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js", + "extensionPoint": "portal", + "description": "codbex-contracts - Perspective - Settings" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.extension b/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.extension index 0df6289..4d2d0c6 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.extension +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.extension @@ -1 +1,5 @@ -{"module":"codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js","extensionPoint":"codbex-contracts","description":"codbex-contracts - Perspective - Settings"} \ No newline at end of file +{ + "module": "codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js", + "extensionPoint": "codbex-contracts", + "description": "codbex-contracts - Perspective - Settings" +} \ No newline at end of file diff --git a/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js b/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js index e0420f7..eb59bae 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js +++ b/codbex-contracts/gen/codbex-contracts/ui/Settings/perspective.js @@ -7,8 +7,8 @@ const perspectiveData = { id: 'Settings', name: 'Settings', link: '/services/web/codbex-contracts/gen/codbex-contracts/ui/Settings/index.html', - order: 999, - icon: '/services/web/resources/unicons/wrench.svg', + order: '999', + icon: '/services/web/resources/unicons/wrench.svg' }; if (typeof exports !== 'undefined') { diff --git a/codbex-contracts/gen/codbex-contracts/ui/launchpad/dialog-window.extensionpoint b/codbex-contracts/gen/codbex-contracts/ui/launchpad/dialog-window.extensionpoint index 9b5e7af..ebfdc93 100644 --- a/codbex-contracts/gen/codbex-contracts/ui/launchpad/dialog-window.extensionpoint +++ b/codbex-contracts/gen/codbex-contracts/ui/launchpad/dialog-window.extensionpoint @@ -1,4 +1,4 @@ { - "name": "codbex-contracts-dialog-window", + "name": "dialog-window", "description": "codbex-contracts - Extension Point for the Application Dialog Window Providers" } \ No newline at end of file diff --git a/codbex-contracts/navigations/contracts/navigation.extension b/codbex-contracts/navigations/contracts/navigation.extension index 398394c..e4f07c4 100644 --- a/codbex-contracts/navigations/contracts/navigation.extension +++ b/codbex-contracts/navigations/contracts/navigation.extension @@ -1,5 +1,6 @@ { "extensionPoint": "dashboard-navigations", "module": "codbex-contracts/navigations/contracts/service.js", - "description": "Contracts Navigation" + "description": "Contracts Navigation", + "role": "codbex-contracts.Contract.ContractFullAccess,codbex-contracts.Contract.ContractReadOnly" } \ No newline at end of file diff --git a/codbex-contracts/navigations/employee-contracts/navigation.extension b/codbex-contracts/navigations/employee-contracts/navigation.extension index c9dc5ff..91571c3 100644 --- a/codbex-contracts/navigations/employee-contracts/navigation.extension +++ b/codbex-contracts/navigations/employee-contracts/navigation.extension @@ -1,5 +1,6 @@ { "extensionPoint": "dashboard-navigations", "module": "codbex-contracts/navigations/employee-contracts/service.js", - "description": "Contracts Navigation" + "description": "Contracts Navigation", + "role": "codbex-contracts.EmployeeContracts.EmployeeContractReadOnly,codbex-contracts.EmployeeContracts.EmployeeContractFullAccess" } \ No newline at end of file diff --git a/images/contracts-model.png b/images/contracts-model.png new file mode 100644 index 0000000..bf332f2 Binary files /dev/null and b/images/contracts-model.png differ