tnx-shared 5.3.254 → 5.3.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/tnx-shared.umd.js +1120 -1110
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/classes/base/list-component-base.d.ts +5 -5
- package/classes/base/list-component-base.d.ts.map +1 -1
- package/classes/form-schema.d.ts +1 -0
- package/classes/form-schema.d.ts.map +1 -1
- package/components/tn-tinymce/tn-tinymce.component.d.ts.map +1 -1
- package/esm2015/classes/base/list-component-base.js +18 -14
- package/esm2015/classes/form-schema.js +2 -1
- package/esm2015/components/tn-tinymce/tn-tinymce.component.js +12 -9
- package/esm2015/services/user.service.js +6 -4
- package/fesm2015/tnx-shared.js +922 -912
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/services/user.service.d.ts.map +1 -1
- package/tnx-shared.metadata.json +1 -1
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -1431,6 +1431,7 @@ class EditorControlSchema extends FormControlBase {
|
|
|
1431
1431
|
this.placeholder = '';
|
|
1432
1432
|
this.hiddenToolbar = false;
|
|
1433
1433
|
this.hiddenMenubar = false;
|
|
1434
|
+
this.isFullPage = false;
|
|
1434
1435
|
for (const key in init) {
|
|
1435
1436
|
this[key] = init[key];
|
|
1436
1437
|
}
|
|
@@ -10153,19 +10154,21 @@ class UserService extends BaseService {
|
|
|
10153
10154
|
new ColumnSchemaBase({
|
|
10154
10155
|
field: 'code',
|
|
10155
10156
|
width: '150px',
|
|
10156
|
-
includeSelect: isInUserList
|
|
10157
|
+
includeSelect: isInUserList,
|
|
10158
|
+
isPinned: true
|
|
10157
10159
|
}),
|
|
10158
10160
|
new ColumnSchemaBase({
|
|
10159
10161
|
field: 'fullNameNew',
|
|
10160
10162
|
width: '200px',
|
|
10161
10163
|
includeSelect: isInUserList,
|
|
10162
|
-
visible: isInUserList
|
|
10164
|
+
visible: isInUserList,
|
|
10165
|
+
isPinned: true
|
|
10163
10166
|
}),
|
|
10164
10167
|
new ColumnSchemaBase({
|
|
10165
10168
|
field: 'dob',
|
|
10166
10169
|
dataType: 'date',
|
|
10167
10170
|
width: '110px',
|
|
10168
|
-
includeSelect: isInUserList
|
|
10171
|
+
includeSelect: isInUserList,
|
|
10169
10172
|
}),
|
|
10170
10173
|
new ColumnSchemaBase({
|
|
10171
10174
|
field: 'email',
|
|
@@ -16179,6 +16182,253 @@ DataFormBase.propDecorators = {
|
|
|
16179
16182
|
onDataBinded: [{ type: Output }]
|
|
16180
16183
|
};
|
|
16181
16184
|
|
|
16185
|
+
class CauHinhWorkflowService extends BaseService {
|
|
16186
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16187
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CauHinhWorkflow`);
|
|
16188
|
+
this._moduleConfigService = _moduleConfigService;
|
|
16189
|
+
this.serviceCode = 'congviec';
|
|
16190
|
+
this.entityName = 'CauHinhWorkflow';
|
|
16191
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
16192
|
+
}
|
|
16193
|
+
}
|
|
16194
|
+
CauHinhWorkflowService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CauHinhWorkflowService_Factory() { return new CauHinhWorkflowService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: CauHinhWorkflowService, providedIn: "root" });
|
|
16195
|
+
CauHinhWorkflowService.decorators = [
|
|
16196
|
+
{ type: Injectable, args: [{
|
|
16197
|
+
providedIn: 'root'
|
|
16198
|
+
},] }
|
|
16199
|
+
];
|
|
16200
|
+
CauHinhWorkflowService.ctorParameters = () => [
|
|
16201
|
+
{ type: HttpClient },
|
|
16202
|
+
{ type: Injector },
|
|
16203
|
+
{ type: ModuleConfigService }
|
|
16204
|
+
];
|
|
16205
|
+
|
|
16206
|
+
class StateMachinesService extends BaseService {
|
|
16207
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16208
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/StateMachines`);
|
|
16209
|
+
this._moduleConfigService = _moduleConfigService;
|
|
16210
|
+
this.entityName = 'StateMachines';
|
|
16211
|
+
this.serviceCode = 'workflow';
|
|
16212
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint;
|
|
16213
|
+
}
|
|
16214
|
+
changeState(itemWorkflowHistory) {
|
|
16215
|
+
return this.defaultPost(`${this.serviceUri}/ChangeState`, itemWorkflowHistory);
|
|
16216
|
+
}
|
|
16217
|
+
rollback(rowData) {
|
|
16218
|
+
return this.defaultPost(`${this.serviceUri}/Rollback/${rowData.__workflowCode}/${rowData.id}`, {});
|
|
16219
|
+
}
|
|
16220
|
+
getUserInProcessForm(workflowCode, stateCode, actionCode, itemId) {
|
|
16221
|
+
return this.defaultPost(`${this.serviceUri}/GetUserInProcessForm/${workflowCode}/${stateCode}/${actionCode}/${itemId}`, {});
|
|
16222
|
+
}
|
|
16223
|
+
}
|
|
16224
|
+
StateMachinesService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StateMachinesService_Factory() { return new StateMachinesService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: StateMachinesService, providedIn: "root" });
|
|
16225
|
+
StateMachinesService.decorators = [
|
|
16226
|
+
{ type: Injectable, args: [{
|
|
16227
|
+
providedIn: 'root'
|
|
16228
|
+
},] }
|
|
16229
|
+
];
|
|
16230
|
+
StateMachinesService.ctorParameters = () => [
|
|
16231
|
+
{ type: HttpClient },
|
|
16232
|
+
{ type: Injector },
|
|
16233
|
+
{ type: ModuleConfigService }
|
|
16234
|
+
];
|
|
16235
|
+
|
|
16236
|
+
class DmLoaiCongViecService extends BaseService {
|
|
16237
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16238
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/DM_LoaiCongViec`);
|
|
16239
|
+
this._moduleConfigService = _moduleConfigService;
|
|
16240
|
+
this.serviceCode = 'congviec';
|
|
16241
|
+
this.entityName = 'DM_LoaiCongViec';
|
|
16242
|
+
this.dicLoaiCongViec = {};
|
|
16243
|
+
this.keyIdLoaiCongViecRoot = 'root';
|
|
16244
|
+
this.getWorkflowSettingByIdLoaiCongViec = (idLoaiCongViec) => __awaiter(this, void 0, void 0, function* () {
|
|
16245
|
+
if (!this.dicWorkflowByLoaiCongViec) {
|
|
16246
|
+
yield this.getDatasourceWorkflowCongViec();
|
|
16247
|
+
}
|
|
16248
|
+
if (!idLoaiCongViec) {
|
|
16249
|
+
return this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot];
|
|
16250
|
+
}
|
|
16251
|
+
let result = this.dicWorkflowByLoaiCongViec[idLoaiCongViec];
|
|
16252
|
+
if (result)
|
|
16253
|
+
return result;
|
|
16254
|
+
const idLoaiCongViecs = yield this.getIdLoaiCongViecs(idLoaiCongViec);
|
|
16255
|
+
if (!Array.isArray(idLoaiCongViecs))
|
|
16256
|
+
return null;
|
|
16257
|
+
if (idLoaiCongViecs.length > 1) {
|
|
16258
|
+
for (let i = idLoaiCongViecs.length - 2; i >= 0; i--) {
|
|
16259
|
+
result = this.dicWorkflowByLoaiCongViec[idLoaiCongViecs[i]];
|
|
16260
|
+
if (result)
|
|
16261
|
+
return result;
|
|
16262
|
+
}
|
|
16263
|
+
}
|
|
16264
|
+
if (!result) {
|
|
16265
|
+
result = this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot];
|
|
16266
|
+
}
|
|
16267
|
+
return result;
|
|
16268
|
+
});
|
|
16269
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
16270
|
+
}
|
|
16271
|
+
getDatasourceWorkflowCongViec() {
|
|
16272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16273
|
+
if (!this.dicWorkflowByLoaiCongViec) {
|
|
16274
|
+
this.dicWorkflowByLoaiCongViec = {};
|
|
16275
|
+
}
|
|
16276
|
+
const cauHinhWorkflowService = this._injector.get(CauHinhWorkflowService);
|
|
16277
|
+
const cauHinhWorkflows = (yield cauHinhWorkflowService.getAll([], 'idLoaiCongViec,workflowCodes,workflowCode')).data;
|
|
16278
|
+
const notifierService = this._injector.get(NotifierService);
|
|
16279
|
+
if (cauHinhWorkflows == null) {
|
|
16280
|
+
notifierService.showWarning('Dịch vụ workflow không phản hồi');
|
|
16281
|
+
return [];
|
|
16282
|
+
}
|
|
16283
|
+
const workflowCodes = [];
|
|
16284
|
+
cauHinhWorkflows.forEach(itemWorkflowSetting => {
|
|
16285
|
+
if (itemWorkflowSetting.workflowCodes && !Array.isArray(itemWorkflowSetting.workflowCodes)) {
|
|
16286
|
+
itemWorkflowSetting.workflowCodes = itemWorkflowSetting.workflowCodes.split(',');
|
|
16287
|
+
}
|
|
16288
|
+
else {
|
|
16289
|
+
itemWorkflowSetting.workflowCodes = [];
|
|
16290
|
+
}
|
|
16291
|
+
itemWorkflowSetting.workflowCodes.forEach(workflowCode => {
|
|
16292
|
+
if (workflowCodes.indexOf(workflowCode) == -1) {
|
|
16293
|
+
workflowCodes.push(workflowCode);
|
|
16294
|
+
}
|
|
16295
|
+
});
|
|
16296
|
+
});
|
|
16297
|
+
const stateMachinesService = this._injector.get(StateMachinesService);
|
|
16298
|
+
const workflows = (yield stateMachinesService.getDataDropdownByFilter([
|
|
16299
|
+
this.newFilter('code', Operator.in, workflowCodes)
|
|
16300
|
+
], new DropdownOptions({
|
|
16301
|
+
valueField: 'code',
|
|
16302
|
+
displayField: 'title',
|
|
16303
|
+
fieldPlus: 'data'
|
|
16304
|
+
})));
|
|
16305
|
+
workflows.forEach(item => {
|
|
16306
|
+
item.data = JSON.parse(item.data);
|
|
16307
|
+
const stateMachineData = item.data;
|
|
16308
|
+
stateMachineData.actions = {};
|
|
16309
|
+
stateMachineData.machines.forEach(machine => {
|
|
16310
|
+
stateMachineData.actions[machine.code] = [];
|
|
16311
|
+
stateMachineData.connections.forEach(conn => {
|
|
16312
|
+
if (conn.source == machine.id) {
|
|
16313
|
+
stateMachineData.actions[machine.code].push(conn);
|
|
16314
|
+
}
|
|
16315
|
+
});
|
|
16316
|
+
});
|
|
16317
|
+
});
|
|
16318
|
+
cauHinhWorkflows.forEach(itemWorkflowSetting => {
|
|
16319
|
+
itemWorkflowSetting.workflows = workflows.filter(q => itemWorkflowSetting.workflowCodes.indexOf(q.code) > -1);
|
|
16320
|
+
if (!itemWorkflowSetting.idLoaiCongViec) {
|
|
16321
|
+
this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot] = itemWorkflowSetting;
|
|
16322
|
+
}
|
|
16323
|
+
else {
|
|
16324
|
+
this.dicWorkflowByLoaiCongViec[itemWorkflowSetting.idLoaiCongViec] = itemWorkflowSetting;
|
|
16325
|
+
}
|
|
16326
|
+
});
|
|
16327
|
+
return workflows;
|
|
16328
|
+
});
|
|
16329
|
+
}
|
|
16330
|
+
getIdLoaiCongViecs(idLoaiCongViec) {
|
|
16331
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16332
|
+
const notifierService = this._injector.get(NotifierService);
|
|
16333
|
+
const itemLoaiCongViec = yield this.getItemLoaiCongViec(idLoaiCongViec);
|
|
16334
|
+
if (itemLoaiCongViec == null) {
|
|
16335
|
+
notifierService.showWarning('Loại công việc không tồn tại');
|
|
16336
|
+
return null;
|
|
16337
|
+
}
|
|
16338
|
+
const idLoaiCongViecs = itemLoaiCongViec.idDuongDan.split(';').filter(q => !!q);
|
|
16339
|
+
return idLoaiCongViecs;
|
|
16340
|
+
});
|
|
16341
|
+
}
|
|
16342
|
+
getItemLoaiCongViec(idLoaiCongViec) {
|
|
16343
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16344
|
+
if (!this.dicLoaiCongViec[idLoaiCongViec]) {
|
|
16345
|
+
this.dicLoaiCongViec[idLoaiCongViec] = (yield this.getDetail(idLoaiCongViec)).data;
|
|
16346
|
+
}
|
|
16347
|
+
return this.dicLoaiCongViec[idLoaiCongViec];
|
|
16348
|
+
});
|
|
16349
|
+
}
|
|
16350
|
+
}
|
|
16351
|
+
DmLoaiCongViecService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DmLoaiCongViecService_Factory() { return new DmLoaiCongViecService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: DmLoaiCongViecService, providedIn: "root" });
|
|
16352
|
+
DmLoaiCongViecService.decorators = [
|
|
16353
|
+
{ type: Injectable, args: [{
|
|
16354
|
+
providedIn: 'root'
|
|
16355
|
+
},] }
|
|
16356
|
+
];
|
|
16357
|
+
DmLoaiCongViecService.ctorParameters = () => [
|
|
16358
|
+
{ type: HttpClient },
|
|
16359
|
+
{ type: Injector },
|
|
16360
|
+
{ type: ModuleConfigService }
|
|
16361
|
+
];
|
|
16362
|
+
|
|
16363
|
+
class CongViecService extends BaseService {
|
|
16364
|
+
constructor(http, injector, _moduleConfigService, _dmLoaiCongViecService) {
|
|
16365
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CongViec_Chinh`);
|
|
16366
|
+
this._dmLoaiCongViecService = _dmLoaiCongViecService;
|
|
16367
|
+
this.serviceCode = 'congviec';
|
|
16368
|
+
this.entityName = 'CongViec_Chinh';
|
|
16369
|
+
this.objectName = 'công việc';
|
|
16370
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
16371
|
+
this._moduleConfig = _moduleConfigService.getConfig();
|
|
16372
|
+
}
|
|
16373
|
+
adjustSettingWorkflowForCrudList(setting) {
|
|
16374
|
+
this.useWorkflow = true;
|
|
16375
|
+
setting.isWorkflowTree = true;
|
|
16376
|
+
setting.baseService = this;
|
|
16377
|
+
setting.displayField = (item) => item.ten;
|
|
16378
|
+
setting.baseService.useWorkflow = true;
|
|
16379
|
+
setting.workflowConfigAdvance = {
|
|
16380
|
+
getWorkflowSetting: this.getWorkflowConfig.bind(this)
|
|
16381
|
+
};
|
|
16382
|
+
}
|
|
16383
|
+
getWorkflowConfig(rowData) {
|
|
16384
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16385
|
+
return yield this._dmLoaiCongViecService.getWorkflowSettingByIdLoaiCongViec(rowData.idLoaiCongViec);
|
|
16386
|
+
});
|
|
16387
|
+
}
|
|
16388
|
+
countByMenuState(data) {
|
|
16389
|
+
return this.defaultPost(`${this.serviceUri}/CountByMenuState`, data);
|
|
16390
|
+
}
|
|
16391
|
+
getDicIdByMenuState(data, tuNgay, denNgay) {
|
|
16392
|
+
return this.defaultPost(`${this.serviceUri}/GetDicIdByMenuState`, {
|
|
16393
|
+
lstTrangThai: data,
|
|
16394
|
+
tuNgay,
|
|
16395
|
+
denNgay
|
|
16396
|
+
});
|
|
16397
|
+
}
|
|
16398
|
+
updateBulkIdCha(model) {
|
|
16399
|
+
const url = `${this.serviceUri}/UpdateBulkIdCha`;
|
|
16400
|
+
return this.defaultPost(url, model);
|
|
16401
|
+
}
|
|
16402
|
+
deleteBulkCongViecCon(ids) {
|
|
16403
|
+
const url = `${this.serviceUri}/DeleteBulkCongViecCon`;
|
|
16404
|
+
return this.defaultPost(url, ids);
|
|
16405
|
+
}
|
|
16406
|
+
getDataDashboardCaNhan(inputData) {
|
|
16407
|
+
const url = `${this.serviceUri}/GetDataDashboardCaNhan`;
|
|
16408
|
+
return this.defaultPost(url, inputData);
|
|
16409
|
+
}
|
|
16410
|
+
getDataDashboardByDonVi(inputData) {
|
|
16411
|
+
const url = `${this.serviceUri}/GetDataDashboardByDonVi`;
|
|
16412
|
+
return this.defaultPost(url, inputData);
|
|
16413
|
+
}
|
|
16414
|
+
getListTasksDashboard(dataFilter) {
|
|
16415
|
+
const url = `${this.serviceUri}/getListTasksDashboard`;
|
|
16416
|
+
return this.defaultPost(url, dataFilter);
|
|
16417
|
+
}
|
|
16418
|
+
}
|
|
16419
|
+
CongViecService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CongViecService_Factory() { return new CongViecService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(DmLoaiCongViecService)); }, token: CongViecService, providedIn: "root" });
|
|
16420
|
+
CongViecService.decorators = [
|
|
16421
|
+
{ type: Injectable, args: [{
|
|
16422
|
+
providedIn: 'root'
|
|
16423
|
+
},] }
|
|
16424
|
+
];
|
|
16425
|
+
CongViecService.ctorParameters = () => [
|
|
16426
|
+
{ type: HttpClient },
|
|
16427
|
+
{ type: Injector },
|
|
16428
|
+
{ type: ModuleConfigService },
|
|
16429
|
+
{ type: DmLoaiCongViecService }
|
|
16430
|
+
];
|
|
16431
|
+
|
|
16182
16432
|
class SearchInfo {
|
|
16183
16433
|
constructor(init) {
|
|
16184
16434
|
this.fieldSearchText = [];
|
|
@@ -16446,619 +16696,27 @@ TnCustomScrollbarComponent.propDecorators = {
|
|
|
16446
16696
|
scrollXReachStart: [{ type: Output }]
|
|
16447
16697
|
};
|
|
16448
16698
|
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
constructor(_http, _injector, _commonService, _moduleConfigService) {
|
|
16453
|
-
this._http = _http;
|
|
16454
|
-
this._injector = _injector;
|
|
16455
|
-
this._commonService = _commonService;
|
|
16456
|
-
this._moduleConfig = _moduleConfigService.getConfig();
|
|
16457
|
-
this.environment = this._moduleConfig.environment;
|
|
16458
|
-
this.serviceUri = `${this._moduleConfig.environment.apiDomain.templateEndpoint}/Export`;
|
|
16459
|
-
}
|
|
16460
|
-
objectToExcel(data, fileName, numOfHeaderRow) {
|
|
16461
|
-
return this._http
|
|
16462
|
-
.post(`${this.serviceUri}/ObjectToExcel?numOfHeaderRow=${numOfHeaderRow}`, data, { responseType: 'blob' })
|
|
16463
|
-
.pipe(catchError((err) => this._commonService.handleError(err, this._injector)))
|
|
16464
|
-
.subscribe(res => {
|
|
16465
|
-
this.saveAsExcelFile(res, fileName);
|
|
16466
|
-
});
|
|
16467
|
-
}
|
|
16468
|
-
saveAsExcelFile(buffer, fileName) {
|
|
16469
|
-
const data = new Blob([buffer], {
|
|
16470
|
-
type: EXCEL_TYPE
|
|
16471
|
-
});
|
|
16472
|
-
FileSaver__default.saveAs(data, fileName + '_' + new Date().getTime() + EXCEL_EXTENSION);
|
|
16473
|
-
}
|
|
16474
|
-
saveSpreadSheet(buffer, fileName) {
|
|
16475
|
-
const data = new Blob([buffer], {
|
|
16476
|
-
type: EXCEL_TYPE
|
|
16477
|
-
});
|
|
16478
|
-
FileSaver__default.saveAs(data, new Date().getTime() + '_' + fileName);
|
|
16479
|
-
}
|
|
16480
|
-
}
|
|
16481
|
-
ExportService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ExportService_Factory() { return new ExportService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(CommonService), i0.ɵɵinject(ModuleConfigService)); }, token: ExportService, providedIn: "root" });
|
|
16482
|
-
ExportService.decorators = [
|
|
16483
|
-
{ type: Injectable, args: [{
|
|
16484
|
-
providedIn: 'root'
|
|
16485
|
-
},] }
|
|
16486
|
-
];
|
|
16487
|
-
ExportService.ctorParameters = () => [
|
|
16488
|
-
{ type: HttpClient },
|
|
16489
|
-
{ type: Injector },
|
|
16490
|
-
{ type: CommonService },
|
|
16491
|
-
{ type: ModuleConfigService }
|
|
16492
|
-
];
|
|
16493
|
-
|
|
16494
|
-
class PhanQuyenModel {
|
|
16495
|
-
constructor(init) {
|
|
16496
|
-
this.addRoleIds = [];
|
|
16497
|
-
this.removeRoleIds = [];
|
|
16498
|
-
this.addPermissionIds = [];
|
|
16499
|
-
this.removePermissionIds = [];
|
|
16500
|
-
for (const key in init) {
|
|
16501
|
-
this[key] = init[key];
|
|
16502
|
-
}
|
|
16503
|
-
}
|
|
16504
|
-
}
|
|
16505
|
-
class PermissionService extends BaseService {
|
|
16506
|
-
constructor(http, injector, _moduleConfigService, _userService, _oauthService, _appContext) {
|
|
16507
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/permission`);
|
|
16699
|
+
class BasePermissionService extends BaseService {
|
|
16700
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16701
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/BasePermission`);
|
|
16508
16702
|
this._moduleConfigService = _moduleConfigService;
|
|
16509
|
-
this.
|
|
16510
|
-
this.
|
|
16511
|
-
this.
|
|
16512
|
-
this.storage = sessionStorage;
|
|
16513
|
-
this.ignoreAdmin = false;
|
|
16514
|
-
this.delayCheckPermissions = [];
|
|
16515
|
-
this.appCode = null;
|
|
16516
|
-
this._config = this._moduleConfigService.getConfig();
|
|
16517
|
-
this.endPoint = this._config.environment.apiDomain.authorizationEndpoint;
|
|
16518
|
-
this.ignoreAdmin = this._config.environment.isIgnoreAdmin;
|
|
16519
|
-
this.appCode = this._config.appCode;
|
|
16520
|
-
}
|
|
16521
|
-
clearPermissionCacheAll() {
|
|
16522
|
-
var _a, _b, _c;
|
|
16523
|
-
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
16524
|
-
const lstApiEndpoint = [];
|
|
16525
|
-
const apiDomain = this._config.environment.apiDomain;
|
|
16526
|
-
for (const domainName in apiDomain) {
|
|
16527
|
-
if (domainName.startsWith('-') || domainName.startsWith('1') || domainName == 'gateway')
|
|
16528
|
-
continue;
|
|
16529
|
-
const realDomainName = domainName.split('Endpoint') ? domainName.split('Endpoint')[0] : domainName;
|
|
16530
|
-
lstApiEndpoint.push(realDomainName.toUpperCase());
|
|
16531
|
-
}
|
|
16532
|
-
return this.clearPermissionCache([...lstAppCodes, ...lstApiEndpoint]);
|
|
16533
|
-
}
|
|
16534
|
-
clearPermissionCache(lstModule) {
|
|
16535
|
-
const url = `${this.serviceUri}/ClearPermissionCache`;
|
|
16536
|
-
return this.defaultPost(url, lstModule);
|
|
16537
|
-
}
|
|
16538
|
-
getCurrentUserPermission() {
|
|
16539
|
-
const url = `${this.serviceUri}/GetCurrentUserPermission`;
|
|
16540
|
-
return this.defaultGet(url);
|
|
16541
|
-
}
|
|
16542
|
-
getAllBasePermission(userId) {
|
|
16543
|
-
var _a, _b, _c;
|
|
16544
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16545
|
-
const url = `${this.serviceUri}/GetAllBasePermission`;
|
|
16546
|
-
// return sớm vì đây là trường hợp lấy permission theo Id của User
|
|
16547
|
-
// ko set local storage vì sẽ làm hỏng quyền của người dùng hiện tại
|
|
16548
|
-
if (userId && userId != '' && userId != this._commonService.guidEmpty()) {
|
|
16549
|
-
return this.defaultGet(url + `?userId=${userId}`);
|
|
16550
|
-
}
|
|
16551
|
-
if (isDevMode()) {
|
|
16552
|
-
return;
|
|
16553
|
-
}
|
|
16554
|
-
const user = this._userService.getCurrentUser();
|
|
16555
|
-
if (user
|
|
16556
|
-
&& (user.issuperuser && user.issuperuser.toLowerCase() == 'true')
|
|
16557
|
-
|| (user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin)) {
|
|
16558
|
-
return;
|
|
16559
|
-
}
|
|
16560
|
-
const res = yield this.defaultGet(url);
|
|
16561
|
-
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
16562
|
-
// Nếu Có error lấy dữ liệu quyền tổng hợp thì quay về lấy dữ liệu quyền dựa vào từng module
|
|
16563
|
-
if (!res || !res.success || res.data == null) {
|
|
16564
|
-
const promiseArr = [];
|
|
16565
|
-
for (const code of lstAppCodes) {
|
|
16566
|
-
promiseArr.push(this.getServicePermission(code, true));
|
|
16567
|
-
}
|
|
16568
|
-
yield Promise.all(promiseArr);
|
|
16569
|
-
return;
|
|
16570
|
-
}
|
|
16571
|
-
// Set local storage cho permission của người dùng
|
|
16572
|
-
for (const service of lstAppCodes) {
|
|
16573
|
-
let permissions = [];
|
|
16574
|
-
const serviceCode = service.toUpperCase();
|
|
16575
|
-
for (const key in res.data) {
|
|
16576
|
-
if (key.toUpperCase() != serviceCode) {
|
|
16577
|
-
continue;
|
|
16578
|
-
}
|
|
16579
|
-
permissions = res.data[key];
|
|
16580
|
-
break;
|
|
16581
|
-
}
|
|
16582
|
-
const key = `AUTHORIZATION.${serviceCode}`;
|
|
16583
|
-
const storageItem = this.storage.getItem(key);
|
|
16584
|
-
if (storageItem != null) {
|
|
16585
|
-
this.storage.removeItem(key);
|
|
16586
|
-
}
|
|
16587
|
-
this.storage.setItem(key, JSON.stringify(permissions));
|
|
16588
|
-
}
|
|
16589
|
-
});
|
|
16590
|
-
}
|
|
16591
|
-
/**
|
|
16592
|
-
* Truyền vào danh sách permision cần check
|
|
16593
|
-
* @param lstPermissionCode những perrmision code cần check => nên dùng trong trường hợp check các button trong code
|
|
16594
|
-
* @returns trả ra các perrmisionCode có quyền
|
|
16595
|
-
*/
|
|
16596
|
-
getPermissionAuthorized(lstPermissionCode) {
|
|
16597
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
16598
|
-
const user = (yield this._userService.getCurrentUser());
|
|
16599
|
-
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
16600
|
-
resolve(lstPermissionCode);
|
|
16601
|
-
return;
|
|
16602
|
-
}
|
|
16603
|
-
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
16604
|
-
resolve(lstPermissionCode);
|
|
16605
|
-
return;
|
|
16606
|
-
}
|
|
16607
|
-
const result = [];
|
|
16608
|
-
for (const item of lstPermissionCode) {
|
|
16609
|
-
if (yield this.isAuthorizedPermission(item)) {
|
|
16610
|
-
result.push(item);
|
|
16611
|
-
}
|
|
16612
|
-
}
|
|
16613
|
-
resolve(result);
|
|
16614
|
-
}));
|
|
16615
|
-
}
|
|
16616
|
-
isAuthorizedPermission(permission) {
|
|
16617
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16618
|
-
let retryCount = 0;
|
|
16619
|
-
while (!this._oauthService.hasValidAccessToken()) {
|
|
16620
|
-
yield this._commonService.delay(100);
|
|
16621
|
-
retryCount++;
|
|
16622
|
-
if (retryCount > 50) {
|
|
16623
|
-
break;
|
|
16624
|
-
}
|
|
16625
|
-
}
|
|
16626
|
-
return yield this.checkPermission(this.appCode, permission);
|
|
16627
|
-
});
|
|
16628
|
-
}
|
|
16629
|
-
isAuthorized(service, permission, checForMenu = false) {
|
|
16630
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16631
|
-
this.root = this._appContext.getRootContext();
|
|
16632
|
-
let retryCount = 0;
|
|
16633
|
-
while (!this._oauthService.hasValidAccessToken()) {
|
|
16634
|
-
yield this._commonService.delay(100);
|
|
16635
|
-
retryCount++;
|
|
16636
|
-
if (retryCount > 50) {
|
|
16637
|
-
break;
|
|
16638
|
-
}
|
|
16639
|
-
}
|
|
16640
|
-
return yield this.checkPermission(service, permission, checForMenu);
|
|
16641
|
-
});
|
|
16642
|
-
}
|
|
16643
|
-
checkPermission(service, permissionToCheck, checkForMenu = false) {
|
|
16644
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16645
|
-
try {
|
|
16646
|
-
const user = this._userService.getCurrentUser();
|
|
16647
|
-
const valueIsDevMode = true;
|
|
16648
|
-
if (isDevMode() && valueIsDevMode) {
|
|
16649
|
-
return true;
|
|
16650
|
-
}
|
|
16651
|
-
if (user && user.issuperuser && user.issuperuser.toLowerCase() == 'true' && valueIsDevMode) {
|
|
16652
|
-
return true;
|
|
16653
|
-
}
|
|
16654
|
-
if (user && user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin && valueIsDevMode) {
|
|
16655
|
-
return true;
|
|
16656
|
-
}
|
|
16657
|
-
const userPermissions = yield this.getServicePermission(service);
|
|
16658
|
-
if (userPermissions && userPermissions.length > 0) {
|
|
16659
|
-
return checkForMenu
|
|
16660
|
-
? userPermissions.includes(permissionToCheck)
|
|
16661
|
-
: this._checkPermission(userPermissions, permissionToCheck);
|
|
16662
|
-
}
|
|
16663
|
-
else {
|
|
16664
|
-
// console.log(`Không có quyền với phân hệ [${service}]`);
|
|
16665
|
-
return false;
|
|
16666
|
-
}
|
|
16667
|
-
}
|
|
16668
|
-
catch (_a) {
|
|
16669
|
-
return false;
|
|
16670
|
-
}
|
|
16671
|
-
});
|
|
16672
|
-
}
|
|
16673
|
-
_checkPermission(userPermissions, permissionToCheck) {
|
|
16674
|
-
let isAuthorized = false;
|
|
16675
|
-
// check permission của người dùng
|
|
16676
|
-
// duyệt qua từng permission của người dùng
|
|
16677
|
-
for (const userPermission of userPermissions) {
|
|
16678
|
-
// biến để break khỏi vòng khi người dùng được authorized
|
|
16679
|
-
let breakOuterLoop = false;
|
|
16680
|
-
// pointer permission của người dùng
|
|
16681
|
-
let userPermissionPointer = 0;
|
|
16682
|
-
// pointer permission đang check
|
|
16683
|
-
let permissionToCheckPointer = 0;
|
|
16684
|
-
// mark co the check query param
|
|
16685
|
-
let aboutToCheckQueryParam = false;
|
|
16686
|
-
// check từng char của 2 mảng
|
|
16687
|
-
for (; permissionToCheckPointer < permissionToCheck.length;) {
|
|
16688
|
-
// nếu char là ký tự bắt đầu template => tịnh tiến pointer của 2 mảng
|
|
16689
|
-
let needRecheck = false;
|
|
16690
|
-
if (userPermission[userPermissionPointer] == '{') {
|
|
16691
|
-
// cho đến khi tìm được ký tự '/' tiếp theo thì dừng lại
|
|
16692
|
-
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
16693
|
-
if (userPermissionPointer == userPermission.length - 1) {
|
|
16694
|
-
break;
|
|
16695
|
-
}
|
|
16696
|
-
if (userPermission[userPermissionPointer] != '}') {
|
|
16697
|
-
continue;
|
|
16698
|
-
}
|
|
16699
|
-
if (userPermission[userPermissionPointer] === '?') {
|
|
16700
|
-
aboutToCheckQueryParam = true;
|
|
16701
|
-
}
|
|
16702
|
-
++userPermissionPointer; // tiến tiến đến ký tự sau kết thúc template
|
|
16703
|
-
// check trường hợp trường hợp chuỗi template có dạng "{template}acsekjf"
|
|
16704
|
-
// => cần check các ký tự sau template và trước ký tự '/'
|
|
16705
|
-
if (userPermission[userPermissionPointer] != '/' && (aboutToCheckQueryParam && userPermission[userPermissionPointer] != '&')) {
|
|
16706
|
-
needRecheck = true;
|
|
16707
|
-
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
16708
|
-
if (userPermissionPointer == userPermission.length - 1) {
|
|
16709
|
-
break;
|
|
16710
|
-
}
|
|
16711
|
-
if (userPermission[userPermissionPointer] != '/') {
|
|
16712
|
-
continue;
|
|
16713
|
-
}
|
|
16714
|
-
break;
|
|
16715
|
-
}
|
|
16716
|
-
}
|
|
16717
|
-
break;
|
|
16718
|
-
}
|
|
16719
|
-
for (; permissionToCheckPointer < permissionToCheck.length; permissionToCheckPointer++) {
|
|
16720
|
-
if (permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
16721
|
-
break;
|
|
16722
|
-
}
|
|
16723
|
-
if (permissionToCheck[permissionToCheckPointer] == '/' || (aboutToCheckQueryParam && permissionToCheck[permissionToCheckPointer] == '&')) {
|
|
16724
|
-
break;
|
|
16725
|
-
}
|
|
16726
|
-
}
|
|
16727
|
-
}
|
|
16728
|
-
let breakInnerLoop = false;
|
|
16729
|
-
if (needRecheck) {
|
|
16730
|
-
// check lại cho trường hợp chuỗi template có dạng "{template}acslekfj"
|
|
16731
|
-
// duyệt ngược lại cho đến khi gặp ký tự kết thúc template
|
|
16732
|
-
let tempUserPointer = userPermissionPointer;
|
|
16733
|
-
let tempToCheckPointer = permissionToCheckPointer;
|
|
16734
|
-
while (userPermission[tempUserPointer] != '}') {
|
|
16735
|
-
// ký tự khác nhau => break khỏi vòng kiểm tra trong
|
|
16736
|
-
if (userPermission[tempUserPointer].toLowerCase() != permissionToCheck[tempToCheckPointer].toLowerCase()) {
|
|
16737
|
-
breakInnerLoop = true;
|
|
16738
|
-
break;
|
|
16739
|
-
}
|
|
16740
|
-
tempUserPointer--;
|
|
16741
|
-
tempToCheckPointer--;
|
|
16742
|
-
}
|
|
16743
|
-
}
|
|
16744
|
-
if (breakInnerLoop) {
|
|
16745
|
-
break;
|
|
16746
|
-
}
|
|
16747
|
-
const userChar = userPermission[userPermissionPointer].toLowerCase();
|
|
16748
|
-
const toCheckChar = permissionToCheck[permissionToCheckPointer].toLowerCase();
|
|
16749
|
-
// nếu userPermission đang ở index cuối
|
|
16750
|
-
if (userPermissionPointer == userPermission.length - 1) {
|
|
16751
|
-
// check char cuối của 2 mảng (trừ khi là ký tự kết thúc template)
|
|
16752
|
-
// và cũng phải là char cuối của mảng permission cần check
|
|
16753
|
-
// => người dùng authorized và break khỏi vòng lặp ngoài cùng
|
|
16754
|
-
if ((userChar == '}' || userChar == toCheckChar)
|
|
16755
|
-
&& permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
16756
|
-
breakOuterLoop = true;
|
|
16757
|
-
isAuthorized = true;
|
|
16758
|
-
}
|
|
16759
|
-
break;
|
|
16760
|
-
}
|
|
16761
|
-
// check char có giống nhau không, không giống thì break khỏi vòng check
|
|
16762
|
-
if (userChar != toCheckChar) {
|
|
16763
|
-
break;
|
|
16764
|
-
}
|
|
16765
|
-
// nếu char giống nhau thì tiếp tục vòng lăp
|
|
16766
|
-
permissionToCheckPointer++;
|
|
16767
|
-
userPermissionPointer++;
|
|
16768
|
-
}
|
|
16769
|
-
if (breakOuterLoop) {
|
|
16770
|
-
break;
|
|
16771
|
-
}
|
|
16772
|
-
}
|
|
16773
|
-
return isAuthorized;
|
|
16774
|
-
}
|
|
16775
|
-
_checkPermissionOld(userPermissions, permissionToCheck) {
|
|
16776
|
-
let isAuthorized = false;
|
|
16777
|
-
// check quyền theo cách cũ nếu trường họp là phân quyền module
|
|
16778
|
-
if (permissionToCheck.includes('MODULE')) {
|
|
16779
|
-
return userPermissions.includes(permissionToCheck);
|
|
16780
|
-
}
|
|
16781
|
-
for (const userPermission of userPermissions) {
|
|
16782
|
-
// Cắt chuỗi permission thành mảng để xem mỗi fragement có khớp nhau không
|
|
16783
|
-
const userPermissionFragments = userPermission.split('/');
|
|
16784
|
-
const permissionFragments = permissionToCheck.split('/');
|
|
16785
|
-
// Mảng khác độ dài thì thoát sớm
|
|
16786
|
-
if (userPermissionFragments.length != permissionFragments.length) {
|
|
16787
|
-
continue;
|
|
16788
|
-
}
|
|
16789
|
-
// biến flag ra hiệu người dùng authorized và out vòng
|
|
16790
|
-
let breakLoop = false;
|
|
16791
|
-
// nếu tất cả phần tử khớp nhau => permission này trùng và người dùng được authorized
|
|
16792
|
-
for (let index = 0; index < permissionFragments.length; index++) {
|
|
16793
|
-
const userFragement = userPermissionFragments[index];
|
|
16794
|
-
const permissionFragment = permissionFragments[index];
|
|
16795
|
-
// skip qua các phần tử có ký tự bắt đầu là '{'
|
|
16796
|
-
if (userFragement[0] == '{') {
|
|
16797
|
-
if (index == permissionFragments.length - 1) {
|
|
16798
|
-
isAuthorized = true;
|
|
16799
|
-
breakLoop = true;
|
|
16800
|
-
}
|
|
16801
|
-
continue;
|
|
16802
|
-
}
|
|
16803
|
-
if (userFragement.toLowerCase() != permissionFragment.toLowerCase()) {
|
|
16804
|
-
break;
|
|
16805
|
-
}
|
|
16806
|
-
if (index == permissionFragments.length - 1) {
|
|
16807
|
-
isAuthorized = true;
|
|
16808
|
-
breakLoop = true;
|
|
16809
|
-
}
|
|
16810
|
-
}
|
|
16811
|
-
if (breakLoop) {
|
|
16812
|
-
break;
|
|
16813
|
-
}
|
|
16814
|
-
}
|
|
16815
|
-
return isAuthorized;
|
|
16816
|
-
}
|
|
16817
|
-
isAuthorizedByPermissions(permissions, operator = 'OR', ignoreAdmin = false) {
|
|
16818
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
16819
|
-
const user = (yield this._userService.getCurrentUser());
|
|
16820
|
-
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
16821
|
-
resolve(true);
|
|
16822
|
-
return;
|
|
16823
|
-
}
|
|
16824
|
-
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
16825
|
-
resolve(true);
|
|
16826
|
-
return;
|
|
16827
|
-
}
|
|
16828
|
-
let isAuthorized = true;
|
|
16829
|
-
if (operator.toUpperCase() == 'OR') {
|
|
16830
|
-
isAuthorized = false;
|
|
16831
|
-
}
|
|
16832
|
-
permissions.forEach(item => {
|
|
16833
|
-
this.getServicePermission(item.service).then(permissionResult => {
|
|
16834
|
-
if (operator.toUpperCase() == 'OR') {
|
|
16835
|
-
if (permissionResult.includes(item.permission)) {
|
|
16836
|
-
isAuthorized = true;
|
|
16837
|
-
return;
|
|
16838
|
-
}
|
|
16839
|
-
}
|
|
16840
|
-
else {
|
|
16841
|
-
if (!permissionResult.includes(item.permission)) {
|
|
16842
|
-
isAuthorized = false;
|
|
16843
|
-
return;
|
|
16844
|
-
}
|
|
16845
|
-
}
|
|
16846
|
-
}, error => {
|
|
16847
|
-
reject(false);
|
|
16848
|
-
});
|
|
16849
|
-
});
|
|
16850
|
-
resolve(isAuthorized);
|
|
16851
|
-
}));
|
|
16852
|
-
}
|
|
16853
|
-
getServicePermission(service, overrideLocalStorage = false) {
|
|
16854
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16855
|
-
const key = `AUTHORIZATION.${service.toUpperCase()}`;
|
|
16856
|
-
if (!overrideLocalStorage) {
|
|
16857
|
-
const storageItem = this.storage.getItem(key);
|
|
16858
|
-
if (storageItem && storageItem !== 'null') {
|
|
16859
|
-
const result = JSON.parse(storageItem);
|
|
16860
|
-
return result;
|
|
16861
|
-
}
|
|
16862
|
-
}
|
|
16863
|
-
const url = `${this.serviceUri}/GetPermissionsByService?service=${service}`;
|
|
16864
|
-
const response = yield this.defaultGet(url);
|
|
16865
|
-
if (!response || !response.success) {
|
|
16866
|
-
return [];
|
|
16867
|
-
}
|
|
16868
|
-
if (overrideLocalStorage) {
|
|
16869
|
-
this.storage.removeItem(key);
|
|
16870
|
-
}
|
|
16871
|
-
this.storage.setItem(key, JSON.stringify(response.data));
|
|
16872
|
-
return response.data;
|
|
16873
|
-
});
|
|
16874
|
-
}
|
|
16875
|
-
getPermissionIdsByModule(moduleCode, userId) {
|
|
16876
|
-
const url = `${this.serviceUri}/GetPermissionIdsByModule/${moduleCode}/${userId}`;
|
|
16877
|
-
return this.defaultGet(url);
|
|
16703
|
+
this.entityName = 'BasePermission';
|
|
16704
|
+
this.serviceCode = 'Authorization';
|
|
16705
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint;
|
|
16878
16706
|
}
|
|
16879
|
-
|
|
16880
|
-
|
|
16881
|
-
return this.defaultPost(url, model);
|
|
16707
|
+
getPermissionByCode(code) {
|
|
16708
|
+
return this.defaultGet(`${this.serviceUri}/GetPermissionByCode?code=${code}`);
|
|
16882
16709
|
}
|
|
16883
16710
|
}
|
|
16884
|
-
|
|
16885
|
-
|
|
16711
|
+
BasePermissionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function BasePermissionService_Factory() { return new BasePermissionService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: BasePermissionService, providedIn: "root" });
|
|
16712
|
+
BasePermissionService.decorators = [
|
|
16886
16713
|
{ type: Injectable, args: [{
|
|
16887
16714
|
providedIn: 'root'
|
|
16888
16715
|
},] }
|
|
16889
16716
|
];
|
|
16890
|
-
|
|
16717
|
+
BasePermissionService.ctorParameters = () => [
|
|
16891
16718
|
{ type: HttpClient },
|
|
16892
16719
|
{ type: Injector },
|
|
16893
|
-
{ type: ModuleConfigService },
|
|
16894
|
-
{ type: UserService },
|
|
16895
|
-
{ type: OAuthService },
|
|
16896
|
-
{ type: ApplicationContextService }
|
|
16897
|
-
];
|
|
16898
|
-
|
|
16899
|
-
var sort_by;
|
|
16900
|
-
(function () {
|
|
16901
|
-
const defaultCompareFunc = function (a, b) {
|
|
16902
|
-
if (a == b)
|
|
16903
|
-
return 0;
|
|
16904
|
-
return a < b ? -1 : 1;
|
|
16905
|
-
};
|
|
16906
|
-
const getCompareFunc = function (primer, reverse) {
|
|
16907
|
-
const defaultCompare = defaultCompareFunc;
|
|
16908
|
-
let compare = defaultCompareFunc;
|
|
16909
|
-
if (primer) {
|
|
16910
|
-
compare = function (a, b) {
|
|
16911
|
-
return defaultCompare(primer(a), primer(b));
|
|
16912
|
-
};
|
|
16913
|
-
}
|
|
16914
|
-
if (reverse) {
|
|
16915
|
-
return function (a, b) {
|
|
16916
|
-
return -1 * compare(a, b);
|
|
16917
|
-
};
|
|
16918
|
-
}
|
|
16919
|
-
return compare;
|
|
16920
|
-
};
|
|
16921
|
-
sort_by = function (...args) {
|
|
16922
|
-
const fields = [], n_fields = args.length;
|
|
16923
|
-
let field, name, cmp;
|
|
16924
|
-
// preprocess sorting options
|
|
16925
|
-
for (let i = 0; i < n_fields; i++) {
|
|
16926
|
-
field = args[i];
|
|
16927
|
-
if (typeof field === 'string') {
|
|
16928
|
-
name = field;
|
|
16929
|
-
cmp = defaultCompareFunc;
|
|
16930
|
-
}
|
|
16931
|
-
else {
|
|
16932
|
-
name = field.name;
|
|
16933
|
-
cmp = getCompareFunc(field.primer, field.reverse);
|
|
16934
|
-
}
|
|
16935
|
-
fields.push({
|
|
16936
|
-
name: name,
|
|
16937
|
-
cmp: cmp
|
|
16938
|
-
});
|
|
16939
|
-
}
|
|
16940
|
-
// final comparison function
|
|
16941
|
-
return function (A, B) {
|
|
16942
|
-
let name, result;
|
|
16943
|
-
for (let i = 0; i < n_fields; i++) {
|
|
16944
|
-
result = 0;
|
|
16945
|
-
field = fields[i];
|
|
16946
|
-
name = field.name;
|
|
16947
|
-
result = field.cmp(A[name], B[name]);
|
|
16948
|
-
if (result !== 0)
|
|
16949
|
-
break;
|
|
16950
|
-
}
|
|
16951
|
-
return result;
|
|
16952
|
-
};
|
|
16953
|
-
};
|
|
16954
|
-
}());
|
|
16955
|
-
// multipleSort('idTinhThanh', 'idQuanHuyen')
|
|
16956
|
-
// multipleSort({name: 'idTinhThanh', reverse: true}, 'idQuanHuyen')
|
|
16957
|
-
// multipleSort({name: 'soThuTu', primer: parseInt}, 'idQuanHuyen') // parseInt là function
|
|
16958
|
-
const multipleSort = sort_by;
|
|
16959
|
-
|
|
16960
|
-
const moduleMap = {};
|
|
16961
|
-
function loadRemoteEntry(remoteEntry) {
|
|
16962
|
-
return new Promise((resolve, reject) => {
|
|
16963
|
-
if (moduleMap[remoteEntry]) {
|
|
16964
|
-
resolve();
|
|
16965
|
-
return;
|
|
16966
|
-
}
|
|
16967
|
-
const script = document.createElement('script');
|
|
16968
|
-
script.src = remoteEntry;
|
|
16969
|
-
script.onerror = reject;
|
|
16970
|
-
script.onload = () => {
|
|
16971
|
-
moduleMap[remoteEntry] = true;
|
|
16972
|
-
resolve(); // window is the global namespace
|
|
16973
|
-
};
|
|
16974
|
-
document.body.append(script);
|
|
16975
|
-
});
|
|
16976
|
-
}
|
|
16977
|
-
function lookupExposedModule(remoteName, exposedModule) {
|
|
16978
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16979
|
-
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
16980
|
-
yield __webpack_init_sharing__('default');
|
|
16981
|
-
const container = window[remoteName]; // or get the container somewhere else
|
|
16982
|
-
// Initialize the container, it may provide shared modules
|
|
16983
|
-
yield container.init(__webpack_share_scopes__.default);
|
|
16984
|
-
const factory = yield container.get(exposedModule);
|
|
16985
|
-
const Module = factory();
|
|
16986
|
-
return Module;
|
|
16987
|
-
});
|
|
16988
|
-
}
|
|
16989
|
-
function loadRemoteModule(options) {
|
|
16990
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16991
|
-
yield loadRemoteEntry(options.remoteEntry);
|
|
16992
|
-
return yield lookupExposedModule(options.remoteName, options.exposedModule);
|
|
16993
|
-
});
|
|
16994
|
-
}
|
|
16995
|
-
function loadRemotePageModule(remoteName, module, environment) {
|
|
16996
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16997
|
-
let remoteEntry = `${environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
16998
|
-
if (!environment.production) {
|
|
16999
|
-
remoteEntry = `${environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17000
|
-
}
|
|
17001
|
-
const options = {
|
|
17002
|
-
remoteName: remoteName,
|
|
17003
|
-
remoteEntry: remoteEntry,
|
|
17004
|
-
exposedModule: module,
|
|
17005
|
-
};
|
|
17006
|
-
return yield loadRemoteModule(options);
|
|
17007
|
-
});
|
|
17008
|
-
}
|
|
17009
|
-
|
|
17010
|
-
class FederationService {
|
|
17011
|
-
constructor(resolver, _moduleConfigService) {
|
|
17012
|
-
this.resolver = resolver;
|
|
17013
|
-
this._moduleConfigService = _moduleConfigService;
|
|
17014
|
-
this.environment = _moduleConfigService.getConfig().environment;
|
|
17015
|
-
}
|
|
17016
|
-
loadRemoteComponent(remoteName, componentName, viewContainerRef) {
|
|
17017
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17018
|
-
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17019
|
-
if (!this.environment.production) {
|
|
17020
|
-
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17021
|
-
}
|
|
17022
|
-
const options = {
|
|
17023
|
-
remoteName: remoteName,
|
|
17024
|
-
remoteEntry: remoteEntry,
|
|
17025
|
-
exposedModule: componentName,
|
|
17026
|
-
};
|
|
17027
|
-
const component = yield loadRemoteModule(options);
|
|
17028
|
-
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17029
|
-
const viewContainer = viewContainerRef.viewContainerRef;
|
|
17030
|
-
viewContainer.clear();
|
|
17031
|
-
const compRef = viewContainer.createComponent(componentFactory);
|
|
17032
|
-
return compRef;
|
|
17033
|
-
});
|
|
17034
|
-
}
|
|
17035
|
-
loadRemoteNewComponent(remoteName, componentName, viewContainerRef) {
|
|
17036
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17037
|
-
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17038
|
-
if (!this.environment.production) {
|
|
17039
|
-
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17040
|
-
}
|
|
17041
|
-
const options = {
|
|
17042
|
-
remoteName: remoteName,
|
|
17043
|
-
remoteEntry: remoteEntry,
|
|
17044
|
-
exposedModule: componentName,
|
|
17045
|
-
};
|
|
17046
|
-
const component = yield loadRemoteModule(options);
|
|
17047
|
-
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17048
|
-
viewContainerRef.clear();
|
|
17049
|
-
const compRef = viewContainerRef.createComponent(componentFactory);
|
|
17050
|
-
return compRef;
|
|
17051
|
-
});
|
|
17052
|
-
}
|
|
17053
|
-
}
|
|
17054
|
-
FederationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FederationService_Factory() { return new FederationService(i0.ɵɵinject(i0.ComponentFactoryResolver), i0.ɵɵinject(ModuleConfigService)); }, token: FederationService, providedIn: "root" });
|
|
17055
|
-
FederationService.decorators = [
|
|
17056
|
-
{ type: Injectable, args: [{
|
|
17057
|
-
providedIn: 'root'
|
|
17058
|
-
},] }
|
|
17059
|
-
];
|
|
17060
|
-
FederationService.ctorParameters = () => [
|
|
17061
|
-
{ type: ComponentFactoryResolver },
|
|
17062
16720
|
{ type: ModuleConfigService }
|
|
17063
16721
|
];
|
|
17064
16722
|
|
|
@@ -17909,300 +17567,662 @@ CanBoHoSoService.ctorParameters = () => [
|
|
|
17909
17567
|
{ type: CrudService }
|
|
17910
17568
|
];
|
|
17911
17569
|
|
|
17912
|
-
class
|
|
17570
|
+
class EntityWorkflowHistoryService extends BaseService {
|
|
17913
17571
|
constructor(http, injector, _moduleConfigService) {
|
|
17914
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.
|
|
17915
|
-
this.
|
|
17916
|
-
this.
|
|
17917
|
-
this.
|
|
17918
|
-
this.
|
|
17572
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/EntityWorkflowHistory`);
|
|
17573
|
+
this.entityName = 'EntityWorkflowHistory';
|
|
17574
|
+
this.serviceManagers = {};
|
|
17575
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint;
|
|
17576
|
+
this._moduleConfig = _moduleConfigService.getConfig();
|
|
17919
17577
|
}
|
|
17920
|
-
|
|
17921
|
-
|
|
17578
|
+
registerService(entityName, service) {
|
|
17579
|
+
this.serviceManagers[entityName] = service;
|
|
17922
17580
|
}
|
|
17923
|
-
|
|
17924
|
-
return
|
|
17581
|
+
getEndpointByService(service) {
|
|
17582
|
+
return `${service.endPoint}/${this._moduleConfig.environment.apiVersion}`;
|
|
17925
17583
|
}
|
|
17926
|
-
|
|
17927
|
-
|
|
17584
|
+
setCurrentServiceUri(tableName) {
|
|
17585
|
+
const service = this.serviceManagers[tableName];
|
|
17586
|
+
if (service == undefined) {
|
|
17587
|
+
(this._injector.get(NotifierService)).showWarning('Bạn chưa đăng ký base service cho entity workflow history');
|
|
17588
|
+
}
|
|
17589
|
+
this.serviceUri = `${this.getEndpointByService(service)}/EntityWorkflowHistory`;
|
|
17590
|
+
}
|
|
17591
|
+
getLastHistory(tableName, filters = []) {
|
|
17592
|
+
const service = this.serviceManagers[tableName];
|
|
17593
|
+
if (service == undefined) {
|
|
17594
|
+
(this._injector.get(NotifierService)).showWarning('Bạn chưa đăng ký base service cho entity workflow history');
|
|
17595
|
+
}
|
|
17596
|
+
const url = `${this.getEndpointByService(service)}/EntityWorkflowHistory/GetLastByFilter`;
|
|
17597
|
+
const gridInfo = {
|
|
17598
|
+
pageInfo: {
|
|
17599
|
+
page: 1,
|
|
17600
|
+
pageSize: 1
|
|
17601
|
+
},
|
|
17602
|
+
filters,
|
|
17603
|
+
sorts: [
|
|
17604
|
+
new Sort({ field: 'created', dir: 1 })
|
|
17605
|
+
]
|
|
17606
|
+
};
|
|
17607
|
+
return this.defaultPost(url, gridInfo);
|
|
17928
17608
|
}
|
|
17929
17609
|
}
|
|
17930
|
-
|
|
17931
|
-
|
|
17610
|
+
EntityWorkflowHistoryService.ɵprov = i0.ɵɵdefineInjectable({ factory: function EntityWorkflowHistoryService_Factory() { return new EntityWorkflowHistoryService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: EntityWorkflowHistoryService, providedIn: "root" });
|
|
17611
|
+
EntityWorkflowHistoryService.decorators = [
|
|
17932
17612
|
{ type: Injectable, args: [{
|
|
17933
17613
|
providedIn: 'root'
|
|
17934
17614
|
},] }
|
|
17935
17615
|
];
|
|
17936
|
-
|
|
17616
|
+
EntityWorkflowHistoryService.ctorParameters = () => [
|
|
17937
17617
|
{ type: HttpClient },
|
|
17938
17618
|
{ type: Injector },
|
|
17939
17619
|
{ type: ModuleConfigService }
|
|
17940
17620
|
];
|
|
17941
17621
|
|
|
17942
|
-
|
|
17943
|
-
|
|
17944
|
-
|
|
17945
|
-
|
|
17946
|
-
this.
|
|
17947
|
-
this.
|
|
17948
|
-
this.
|
|
17622
|
+
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
17623
|
+
const EXCEL_EXTENSION = '.xlsx';
|
|
17624
|
+
class ExportService {
|
|
17625
|
+
constructor(_http, _injector, _commonService, _moduleConfigService) {
|
|
17626
|
+
this._http = _http;
|
|
17627
|
+
this._injector = _injector;
|
|
17628
|
+
this._commonService = _commonService;
|
|
17629
|
+
this._moduleConfig = _moduleConfigService.getConfig();
|
|
17630
|
+
this.environment = this._moduleConfig.environment;
|
|
17631
|
+
this.serviceUri = `${this._moduleConfig.environment.apiDomain.templateEndpoint}/Export`;
|
|
17632
|
+
}
|
|
17633
|
+
objectToExcel(data, fileName, numOfHeaderRow) {
|
|
17634
|
+
return this._http
|
|
17635
|
+
.post(`${this.serviceUri}/ObjectToExcel?numOfHeaderRow=${numOfHeaderRow}`, data, { responseType: 'blob' })
|
|
17636
|
+
.pipe(catchError((err) => this._commonService.handleError(err, this._injector)))
|
|
17637
|
+
.subscribe(res => {
|
|
17638
|
+
this.saveAsExcelFile(res, fileName);
|
|
17639
|
+
});
|
|
17640
|
+
}
|
|
17641
|
+
saveAsExcelFile(buffer, fileName) {
|
|
17642
|
+
const data = new Blob([buffer], {
|
|
17643
|
+
type: EXCEL_TYPE
|
|
17644
|
+
});
|
|
17645
|
+
FileSaver__default.saveAs(data, fileName + '_' + new Date().getTime() + EXCEL_EXTENSION);
|
|
17646
|
+
}
|
|
17647
|
+
saveSpreadSheet(buffer, fileName) {
|
|
17648
|
+
const data = new Blob([buffer], {
|
|
17649
|
+
type: EXCEL_TYPE
|
|
17650
|
+
});
|
|
17651
|
+
FileSaver__default.saveAs(data, new Date().getTime() + '_' + fileName);
|
|
17949
17652
|
}
|
|
17950
17653
|
}
|
|
17951
|
-
|
|
17952
|
-
|
|
17654
|
+
ExportService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ExportService_Factory() { return new ExportService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(CommonService), i0.ɵɵinject(ModuleConfigService)); }, token: ExportService, providedIn: "root" });
|
|
17655
|
+
ExportService.decorators = [
|
|
17953
17656
|
{ type: Injectable, args: [{
|
|
17954
17657
|
providedIn: 'root'
|
|
17955
17658
|
},] }
|
|
17956
17659
|
];
|
|
17957
|
-
|
|
17660
|
+
ExportService.ctorParameters = () => [
|
|
17958
17661
|
{ type: HttpClient },
|
|
17959
17662
|
{ type: Injector },
|
|
17663
|
+
{ type: CommonService },
|
|
17960
17664
|
{ type: ModuleConfigService }
|
|
17961
17665
|
];
|
|
17962
17666
|
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
|
|
17667
|
+
const moduleMap = {};
|
|
17668
|
+
function loadRemoteEntry(remoteEntry) {
|
|
17669
|
+
return new Promise((resolve, reject) => {
|
|
17670
|
+
if (moduleMap[remoteEntry]) {
|
|
17671
|
+
resolve();
|
|
17672
|
+
return;
|
|
17673
|
+
}
|
|
17674
|
+
const script = document.createElement('script');
|
|
17675
|
+
script.src = remoteEntry;
|
|
17676
|
+
script.onerror = reject;
|
|
17677
|
+
script.onload = () => {
|
|
17678
|
+
moduleMap[remoteEntry] = true;
|
|
17679
|
+
resolve(); // window is the global namespace
|
|
17680
|
+
};
|
|
17681
|
+
document.body.append(script);
|
|
17682
|
+
});
|
|
17683
|
+
}
|
|
17684
|
+
function lookupExposedModule(remoteName, exposedModule) {
|
|
17685
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17686
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
17687
|
+
yield __webpack_init_sharing__('default');
|
|
17688
|
+
const container = window[remoteName]; // or get the container somewhere else
|
|
17689
|
+
// Initialize the container, it may provide shared modules
|
|
17690
|
+
yield container.init(__webpack_share_scopes__.default);
|
|
17691
|
+
const factory = yield container.get(exposedModule);
|
|
17692
|
+
const Module = factory();
|
|
17693
|
+
return Module;
|
|
17694
|
+
});
|
|
17695
|
+
}
|
|
17696
|
+
function loadRemoteModule(options) {
|
|
17697
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17698
|
+
yield loadRemoteEntry(options.remoteEntry);
|
|
17699
|
+
return yield lookupExposedModule(options.remoteName, options.exposedModule);
|
|
17700
|
+
});
|
|
17701
|
+
}
|
|
17702
|
+
function loadRemotePageModule(remoteName, module, environment) {
|
|
17703
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17704
|
+
let remoteEntry = `${environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17705
|
+
if (!environment.production) {
|
|
17706
|
+
remoteEntry = `${environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17707
|
+
}
|
|
17708
|
+
const options = {
|
|
17709
|
+
remoteName: remoteName,
|
|
17710
|
+
remoteEntry: remoteEntry,
|
|
17711
|
+
exposedModule: module,
|
|
17712
|
+
};
|
|
17713
|
+
return yield loadRemoteModule(options);
|
|
17714
|
+
});
|
|
17715
|
+
}
|
|
17716
|
+
|
|
17717
|
+
class FederationService {
|
|
17718
|
+
constructor(resolver, _moduleConfigService) {
|
|
17719
|
+
this.resolver = resolver;
|
|
17966
17720
|
this._moduleConfigService = _moduleConfigService;
|
|
17967
|
-
this.
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
this
|
|
17971
|
-
|
|
17972
|
-
if (!this.
|
|
17973
|
-
|
|
17721
|
+
this.environment = _moduleConfigService.getConfig().environment;
|
|
17722
|
+
}
|
|
17723
|
+
loadRemoteComponent(remoteName, componentName, viewContainerRef) {
|
|
17724
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17725
|
+
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17726
|
+
if (!this.environment.production) {
|
|
17727
|
+
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17728
|
+
}
|
|
17729
|
+
const options = {
|
|
17730
|
+
remoteName: remoteName,
|
|
17731
|
+
remoteEntry: remoteEntry,
|
|
17732
|
+
exposedModule: componentName,
|
|
17733
|
+
};
|
|
17734
|
+
const component = yield loadRemoteModule(options);
|
|
17735
|
+
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17736
|
+
const viewContainer = viewContainerRef.viewContainerRef;
|
|
17737
|
+
viewContainer.clear();
|
|
17738
|
+
const compRef = viewContainer.createComponent(componentFactory);
|
|
17739
|
+
return compRef;
|
|
17740
|
+
});
|
|
17741
|
+
}
|
|
17742
|
+
loadRemoteNewComponent(remoteName, componentName, viewContainerRef) {
|
|
17743
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17744
|
+
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17745
|
+
if (!this.environment.production) {
|
|
17746
|
+
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17747
|
+
}
|
|
17748
|
+
const options = {
|
|
17749
|
+
remoteName: remoteName,
|
|
17750
|
+
remoteEntry: remoteEntry,
|
|
17751
|
+
exposedModule: componentName,
|
|
17752
|
+
};
|
|
17753
|
+
const component = yield loadRemoteModule(options);
|
|
17754
|
+
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17755
|
+
viewContainerRef.clear();
|
|
17756
|
+
const compRef = viewContainerRef.createComponent(componentFactory);
|
|
17757
|
+
return compRef;
|
|
17758
|
+
});
|
|
17759
|
+
}
|
|
17760
|
+
}
|
|
17761
|
+
FederationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FederationService_Factory() { return new FederationService(i0.ɵɵinject(i0.ComponentFactoryResolver), i0.ɵɵinject(ModuleConfigService)); }, token: FederationService, providedIn: "root" });
|
|
17762
|
+
FederationService.decorators = [
|
|
17763
|
+
{ type: Injectable, args: [{
|
|
17764
|
+
providedIn: 'root'
|
|
17765
|
+
},] }
|
|
17766
|
+
];
|
|
17767
|
+
FederationService.ctorParameters = () => [
|
|
17768
|
+
{ type: ComponentFactoryResolver },
|
|
17769
|
+
{ type: ModuleConfigService }
|
|
17770
|
+
];
|
|
17771
|
+
|
|
17772
|
+
class PhanQuyenModel {
|
|
17773
|
+
constructor(init) {
|
|
17774
|
+
this.addRoleIds = [];
|
|
17775
|
+
this.removeRoleIds = [];
|
|
17776
|
+
this.addPermissionIds = [];
|
|
17777
|
+
this.removePermissionIds = [];
|
|
17778
|
+
for (const key in init) {
|
|
17779
|
+
this[key] = init[key];
|
|
17780
|
+
}
|
|
17781
|
+
}
|
|
17782
|
+
}
|
|
17783
|
+
class PermissionService extends BaseService {
|
|
17784
|
+
constructor(http, injector, _moduleConfigService, _userService, _oauthService, _appContext) {
|
|
17785
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/permission`);
|
|
17786
|
+
this._moduleConfigService = _moduleConfigService;
|
|
17787
|
+
this._userService = _userService;
|
|
17788
|
+
this._oauthService = _oauthService;
|
|
17789
|
+
this._appContext = _appContext;
|
|
17790
|
+
this.storage = sessionStorage;
|
|
17791
|
+
this.ignoreAdmin = false;
|
|
17792
|
+
this.delayCheckPermissions = [];
|
|
17793
|
+
this.appCode = null;
|
|
17794
|
+
this._config = this._moduleConfigService.getConfig();
|
|
17795
|
+
this.endPoint = this._config.environment.apiDomain.authorizationEndpoint;
|
|
17796
|
+
this.ignoreAdmin = this._config.environment.isIgnoreAdmin;
|
|
17797
|
+
this.appCode = this._config.appCode;
|
|
17798
|
+
}
|
|
17799
|
+
clearPermissionCacheAll() {
|
|
17800
|
+
var _a, _b, _c;
|
|
17801
|
+
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
17802
|
+
const lstApiEndpoint = [];
|
|
17803
|
+
const apiDomain = this._config.environment.apiDomain;
|
|
17804
|
+
for (const domainName in apiDomain) {
|
|
17805
|
+
if (domainName.startsWith('-') || domainName.startsWith('1') || domainName == 'gateway')
|
|
17806
|
+
continue;
|
|
17807
|
+
const realDomainName = domainName.split('Endpoint') ? domainName.split('Endpoint')[0] : domainName;
|
|
17808
|
+
lstApiEndpoint.push(realDomainName.toUpperCase());
|
|
17809
|
+
}
|
|
17810
|
+
return this.clearPermissionCache([...lstAppCodes, ...lstApiEndpoint]);
|
|
17811
|
+
}
|
|
17812
|
+
clearPermissionCache(lstModule) {
|
|
17813
|
+
const url = `${this.serviceUri}/ClearPermissionCache`;
|
|
17814
|
+
return this.defaultPost(url, lstModule);
|
|
17815
|
+
}
|
|
17816
|
+
getCurrentUserPermission() {
|
|
17817
|
+
const url = `${this.serviceUri}/GetCurrentUserPermission`;
|
|
17818
|
+
return this.defaultGet(url);
|
|
17819
|
+
}
|
|
17820
|
+
getAllBasePermission(userId) {
|
|
17821
|
+
var _a, _b, _c;
|
|
17822
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17823
|
+
const url = `${this.serviceUri}/GetAllBasePermission`;
|
|
17824
|
+
// return sớm vì đây là trường hợp lấy permission theo Id của User
|
|
17825
|
+
// ko set local storage vì sẽ làm hỏng quyền của người dùng hiện tại
|
|
17826
|
+
if (userId && userId != '' && userId != this._commonService.guidEmpty()) {
|
|
17827
|
+
return this.defaultGet(url + `?userId=${userId}`);
|
|
17828
|
+
}
|
|
17829
|
+
if (isDevMode()) {
|
|
17830
|
+
return;
|
|
17831
|
+
}
|
|
17832
|
+
const user = this._userService.getCurrentUser();
|
|
17833
|
+
if (user
|
|
17834
|
+
&& (user.issuperuser && user.issuperuser.toLowerCase() == 'true')
|
|
17835
|
+
|| (user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin)) {
|
|
17836
|
+
return;
|
|
17837
|
+
}
|
|
17838
|
+
const res = yield this.defaultGet(url);
|
|
17839
|
+
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
17840
|
+
// Nếu Có error lấy dữ liệu quyền tổng hợp thì quay về lấy dữ liệu quyền dựa vào từng module
|
|
17841
|
+
if (!res || !res.success || res.data == null) {
|
|
17842
|
+
const promiseArr = [];
|
|
17843
|
+
for (const code of lstAppCodes) {
|
|
17844
|
+
promiseArr.push(this.getServicePermission(code, true));
|
|
17845
|
+
}
|
|
17846
|
+
yield Promise.all(promiseArr);
|
|
17847
|
+
return;
|
|
17848
|
+
}
|
|
17849
|
+
// Set local storage cho permission của người dùng
|
|
17850
|
+
for (const service of lstAppCodes) {
|
|
17851
|
+
let permissions = [];
|
|
17852
|
+
const serviceCode = service.toUpperCase();
|
|
17853
|
+
for (const key in res.data) {
|
|
17854
|
+
if (key.toUpperCase() != serviceCode) {
|
|
17855
|
+
continue;
|
|
17856
|
+
}
|
|
17857
|
+
permissions = res.data[key];
|
|
17858
|
+
break;
|
|
17859
|
+
}
|
|
17860
|
+
const key = `AUTHORIZATION.${serviceCode}`;
|
|
17861
|
+
const storageItem = this.storage.getItem(key);
|
|
17862
|
+
if (storageItem != null) {
|
|
17863
|
+
this.storage.removeItem(key);
|
|
17864
|
+
}
|
|
17865
|
+
this.storage.setItem(key, JSON.stringify(permissions));
|
|
17866
|
+
}
|
|
17867
|
+
});
|
|
17868
|
+
}
|
|
17869
|
+
/**
|
|
17870
|
+
* Truyền vào danh sách permision cần check
|
|
17871
|
+
* @param lstPermissionCode những perrmision code cần check => nên dùng trong trường hợp check các button trong code
|
|
17872
|
+
* @returns trả ra các perrmisionCode có quyền
|
|
17873
|
+
*/
|
|
17874
|
+
getPermissionAuthorized(lstPermissionCode) {
|
|
17875
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
17876
|
+
const user = (yield this._userService.getCurrentUser());
|
|
17877
|
+
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
17878
|
+
resolve(lstPermissionCode);
|
|
17879
|
+
return;
|
|
17880
|
+
}
|
|
17881
|
+
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
17882
|
+
resolve(lstPermissionCode);
|
|
17883
|
+
return;
|
|
17884
|
+
}
|
|
17885
|
+
const result = [];
|
|
17886
|
+
for (const item of lstPermissionCode) {
|
|
17887
|
+
if (yield this.isAuthorizedPermission(item)) {
|
|
17888
|
+
result.push(item);
|
|
17889
|
+
}
|
|
17890
|
+
}
|
|
17891
|
+
resolve(result);
|
|
17892
|
+
}));
|
|
17893
|
+
}
|
|
17894
|
+
isAuthorizedPermission(permission) {
|
|
17895
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17896
|
+
let retryCount = 0;
|
|
17897
|
+
while (!this._oauthService.hasValidAccessToken()) {
|
|
17898
|
+
yield this._commonService.delay(100);
|
|
17899
|
+
retryCount++;
|
|
17900
|
+
if (retryCount > 50) {
|
|
17901
|
+
break;
|
|
17902
|
+
}
|
|
17903
|
+
}
|
|
17904
|
+
return yield this.checkPermission(this.appCode, permission);
|
|
17905
|
+
});
|
|
17906
|
+
}
|
|
17907
|
+
isAuthorized(service, permission, checForMenu = false) {
|
|
17908
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17909
|
+
this.root = this._appContext.getRootContext();
|
|
17910
|
+
let retryCount = 0;
|
|
17911
|
+
while (!this._oauthService.hasValidAccessToken()) {
|
|
17912
|
+
yield this._commonService.delay(100);
|
|
17913
|
+
retryCount++;
|
|
17914
|
+
if (retryCount > 50) {
|
|
17915
|
+
break;
|
|
17916
|
+
}
|
|
17917
|
+
}
|
|
17918
|
+
return yield this.checkPermission(service, permission, checForMenu);
|
|
17919
|
+
});
|
|
17920
|
+
}
|
|
17921
|
+
checkPermission(service, permissionToCheck, checkForMenu = false) {
|
|
17922
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17923
|
+
try {
|
|
17924
|
+
const user = this._userService.getCurrentUser();
|
|
17925
|
+
const valueIsDevMode = true;
|
|
17926
|
+
if (isDevMode() && valueIsDevMode) {
|
|
17927
|
+
return true;
|
|
17928
|
+
}
|
|
17929
|
+
if (user && user.issuperuser && user.issuperuser.toLowerCase() == 'true' && valueIsDevMode) {
|
|
17930
|
+
return true;
|
|
17931
|
+
}
|
|
17932
|
+
if (user && user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin && valueIsDevMode) {
|
|
17933
|
+
return true;
|
|
17934
|
+
}
|
|
17935
|
+
const userPermissions = yield this.getServicePermission(service);
|
|
17936
|
+
if (userPermissions && userPermissions.length > 0) {
|
|
17937
|
+
return checkForMenu
|
|
17938
|
+
? userPermissions.includes(permissionToCheck)
|
|
17939
|
+
: this._checkPermission(userPermissions, permissionToCheck);
|
|
17940
|
+
}
|
|
17941
|
+
else {
|
|
17942
|
+
// console.log(`Không có quyền với phân hệ [${service}]`);
|
|
17943
|
+
return false;
|
|
17944
|
+
}
|
|
17945
|
+
}
|
|
17946
|
+
catch (_a) {
|
|
17947
|
+
return false;
|
|
17948
|
+
}
|
|
17949
|
+
});
|
|
17950
|
+
}
|
|
17951
|
+
_checkPermission(userPermissions, permissionToCheck) {
|
|
17952
|
+
let isAuthorized = false;
|
|
17953
|
+
// check permission của người dùng
|
|
17954
|
+
// duyệt qua từng permission của người dùng
|
|
17955
|
+
for (const userPermission of userPermissions) {
|
|
17956
|
+
// biến để break khỏi vòng khi người dùng được authorized
|
|
17957
|
+
let breakOuterLoop = false;
|
|
17958
|
+
// pointer permission của người dùng
|
|
17959
|
+
let userPermissionPointer = 0;
|
|
17960
|
+
// pointer permission đang check
|
|
17961
|
+
let permissionToCheckPointer = 0;
|
|
17962
|
+
// mark co the check query param
|
|
17963
|
+
let aboutToCheckQueryParam = false;
|
|
17964
|
+
// check từng char của 2 mảng
|
|
17965
|
+
for (; permissionToCheckPointer < permissionToCheck.length;) {
|
|
17966
|
+
// nếu char là ký tự bắt đầu template => tịnh tiến pointer của 2 mảng
|
|
17967
|
+
let needRecheck = false;
|
|
17968
|
+
if (userPermission[userPermissionPointer] == '{') {
|
|
17969
|
+
// cho đến khi tìm được ký tự '/' tiếp theo thì dừng lại
|
|
17970
|
+
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
17971
|
+
if (userPermissionPointer == userPermission.length - 1) {
|
|
17972
|
+
break;
|
|
17973
|
+
}
|
|
17974
|
+
if (userPermission[userPermissionPointer] != '}') {
|
|
17975
|
+
continue;
|
|
17976
|
+
}
|
|
17977
|
+
if (userPermission[userPermissionPointer] === '?') {
|
|
17978
|
+
aboutToCheckQueryParam = true;
|
|
17979
|
+
}
|
|
17980
|
+
++userPermissionPointer; // tiến tiến đến ký tự sau kết thúc template
|
|
17981
|
+
// check trường hợp trường hợp chuỗi template có dạng "{template}acsekjf"
|
|
17982
|
+
// => cần check các ký tự sau template và trước ký tự '/'
|
|
17983
|
+
if (userPermission[userPermissionPointer] != '/' && (aboutToCheckQueryParam && userPermission[userPermissionPointer] != '&')) {
|
|
17984
|
+
needRecheck = true;
|
|
17985
|
+
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
17986
|
+
if (userPermissionPointer == userPermission.length - 1) {
|
|
17987
|
+
break;
|
|
17988
|
+
}
|
|
17989
|
+
if (userPermission[userPermissionPointer] != '/') {
|
|
17990
|
+
continue;
|
|
17991
|
+
}
|
|
17992
|
+
break;
|
|
17993
|
+
}
|
|
17994
|
+
}
|
|
17995
|
+
break;
|
|
17996
|
+
}
|
|
17997
|
+
for (; permissionToCheckPointer < permissionToCheck.length; permissionToCheckPointer++) {
|
|
17998
|
+
if (permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
17999
|
+
break;
|
|
18000
|
+
}
|
|
18001
|
+
if (permissionToCheck[permissionToCheckPointer] == '/' || (aboutToCheckQueryParam && permissionToCheck[permissionToCheckPointer] == '&')) {
|
|
18002
|
+
break;
|
|
18003
|
+
}
|
|
18004
|
+
}
|
|
18005
|
+
}
|
|
18006
|
+
let breakInnerLoop = false;
|
|
18007
|
+
if (needRecheck) {
|
|
18008
|
+
// check lại cho trường hợp chuỗi template có dạng "{template}acslekfj"
|
|
18009
|
+
// duyệt ngược lại cho đến khi gặp ký tự kết thúc template
|
|
18010
|
+
let tempUserPointer = userPermissionPointer;
|
|
18011
|
+
let tempToCheckPointer = permissionToCheckPointer;
|
|
18012
|
+
while (userPermission[tempUserPointer] != '}') {
|
|
18013
|
+
// ký tự khác nhau => break khỏi vòng kiểm tra trong
|
|
18014
|
+
if (userPermission[tempUserPointer].toLowerCase() != permissionToCheck[tempToCheckPointer].toLowerCase()) {
|
|
18015
|
+
breakInnerLoop = true;
|
|
18016
|
+
break;
|
|
18017
|
+
}
|
|
18018
|
+
tempUserPointer--;
|
|
18019
|
+
tempToCheckPointer--;
|
|
18020
|
+
}
|
|
18021
|
+
}
|
|
18022
|
+
if (breakInnerLoop) {
|
|
18023
|
+
break;
|
|
18024
|
+
}
|
|
18025
|
+
const userChar = userPermission[userPermissionPointer].toLowerCase();
|
|
18026
|
+
const toCheckChar = permissionToCheck[permissionToCheckPointer].toLowerCase();
|
|
18027
|
+
// nếu userPermission đang ở index cuối
|
|
18028
|
+
if (userPermissionPointer == userPermission.length - 1) {
|
|
18029
|
+
// check char cuối của 2 mảng (trừ khi là ký tự kết thúc template)
|
|
18030
|
+
// và cũng phải là char cuối của mảng permission cần check
|
|
18031
|
+
// => người dùng authorized và break khỏi vòng lặp ngoài cùng
|
|
18032
|
+
if ((userChar == '}' || userChar == toCheckChar)
|
|
18033
|
+
&& permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
18034
|
+
breakOuterLoop = true;
|
|
18035
|
+
isAuthorized = true;
|
|
18036
|
+
}
|
|
18037
|
+
break;
|
|
18038
|
+
}
|
|
18039
|
+
// check char có giống nhau không, không giống thì break khỏi vòng check
|
|
18040
|
+
if (userChar != toCheckChar) {
|
|
18041
|
+
break;
|
|
18042
|
+
}
|
|
18043
|
+
// nếu char giống nhau thì tiếp tục vòng lăp
|
|
18044
|
+
permissionToCheckPointer++;
|
|
18045
|
+
userPermissionPointer++;
|
|
17974
18046
|
}
|
|
17975
|
-
if (
|
|
17976
|
-
|
|
18047
|
+
if (breakOuterLoop) {
|
|
18048
|
+
break;
|
|
17977
18049
|
}
|
|
17978
|
-
|
|
17979
|
-
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
|
|
17983
|
-
|
|
17984
|
-
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
|
|
18050
|
+
}
|
|
18051
|
+
return isAuthorized;
|
|
18052
|
+
}
|
|
18053
|
+
_checkPermissionOld(userPermissions, permissionToCheck) {
|
|
18054
|
+
let isAuthorized = false;
|
|
18055
|
+
// check quyền theo cách cũ nếu trường họp là phân quyền module
|
|
18056
|
+
if (permissionToCheck.includes('MODULE')) {
|
|
18057
|
+
return userPermissions.includes(permissionToCheck);
|
|
18058
|
+
}
|
|
18059
|
+
for (const userPermission of userPermissions) {
|
|
18060
|
+
// Cắt chuỗi permission thành mảng để xem mỗi fragement có khớp nhau không
|
|
18061
|
+
const userPermissionFragments = userPermission.split('/');
|
|
18062
|
+
const permissionFragments = permissionToCheck.split('/');
|
|
18063
|
+
// Mảng khác độ dài thì thoát sớm
|
|
18064
|
+
if (userPermissionFragments.length != permissionFragments.length) {
|
|
18065
|
+
continue;
|
|
18066
|
+
}
|
|
18067
|
+
// biến flag ra hiệu người dùng authorized và out vòng
|
|
18068
|
+
let breakLoop = false;
|
|
18069
|
+
// nếu tất cả phần tử khớp nhau => permission này trùng và người dùng được authorized
|
|
18070
|
+
for (let index = 0; index < permissionFragments.length; index++) {
|
|
18071
|
+
const userFragement = userPermissionFragments[index];
|
|
18072
|
+
const permissionFragment = permissionFragments[index];
|
|
18073
|
+
// skip qua các phần tử có ký tự bắt đầu là '{'
|
|
18074
|
+
if (userFragement[0] == '{') {
|
|
18075
|
+
if (index == permissionFragments.length - 1) {
|
|
18076
|
+
isAuthorized = true;
|
|
18077
|
+
breakLoop = true;
|
|
18078
|
+
}
|
|
18079
|
+
continue;
|
|
18080
|
+
}
|
|
18081
|
+
if (userFragement.toLowerCase() != permissionFragment.toLowerCase()) {
|
|
18082
|
+
break;
|
|
18083
|
+
}
|
|
18084
|
+
if (index == permissionFragments.length - 1) {
|
|
18085
|
+
isAuthorized = true;
|
|
18086
|
+
breakLoop = true;
|
|
17989
18087
|
}
|
|
17990
18088
|
}
|
|
17991
|
-
if (
|
|
17992
|
-
|
|
18089
|
+
if (breakLoop) {
|
|
18090
|
+
break;
|
|
17993
18091
|
}
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
18092
|
+
}
|
|
18093
|
+
return isAuthorized;
|
|
17997
18094
|
}
|
|
17998
|
-
|
|
17999
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18000
|
-
|
|
18001
|
-
|
|
18095
|
+
isAuthorizedByPermissions(permissions, operator = 'OR', ignoreAdmin = false) {
|
|
18096
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
18097
|
+
const user = (yield this._userService.getCurrentUser());
|
|
18098
|
+
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
18099
|
+
resolve(true);
|
|
18100
|
+
return;
|
|
18002
18101
|
}
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
if (cauHinhWorkflows == null) {
|
|
18007
|
-
notifierService.showWarning('Dịch vụ workflow không phản hồi');
|
|
18008
|
-
return [];
|
|
18102
|
+
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
18103
|
+
resolve(true);
|
|
18104
|
+
return;
|
|
18009
18105
|
}
|
|
18010
|
-
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
|
|
18106
|
+
let isAuthorized = true;
|
|
18107
|
+
if (operator.toUpperCase() == 'OR') {
|
|
18108
|
+
isAuthorized = false;
|
|
18109
|
+
}
|
|
18110
|
+
permissions.forEach(item => {
|
|
18111
|
+
this.getServicePermission(item.service).then(permissionResult => {
|
|
18112
|
+
if (operator.toUpperCase() == 'OR') {
|
|
18113
|
+
if (permissionResult.includes(item.permission)) {
|
|
18114
|
+
isAuthorized = true;
|
|
18115
|
+
return;
|
|
18116
|
+
}
|
|
18021
18117
|
}
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
this.newFilter('code', Operator.in, workflowCodes)
|
|
18027
|
-
], new DropdownOptions({
|
|
18028
|
-
valueField: 'code',
|
|
18029
|
-
displayField: 'title',
|
|
18030
|
-
fieldPlus: 'data'
|
|
18031
|
-
})));
|
|
18032
|
-
workflows.forEach(item => {
|
|
18033
|
-
item.data = JSON.parse(item.data);
|
|
18034
|
-
const stateMachineData = item.data;
|
|
18035
|
-
stateMachineData.actions = {};
|
|
18036
|
-
stateMachineData.machines.forEach(machine => {
|
|
18037
|
-
stateMachineData.actions[machine.code] = [];
|
|
18038
|
-
stateMachineData.connections.forEach(conn => {
|
|
18039
|
-
if (conn.source == machine.id) {
|
|
18040
|
-
stateMachineData.actions[machine.code].push(conn);
|
|
18118
|
+
else {
|
|
18119
|
+
if (!permissionResult.includes(item.permission)) {
|
|
18120
|
+
isAuthorized = false;
|
|
18121
|
+
return;
|
|
18041
18122
|
}
|
|
18042
|
-
}
|
|
18123
|
+
}
|
|
18124
|
+
}, error => {
|
|
18125
|
+
reject(false);
|
|
18043
18126
|
});
|
|
18044
18127
|
});
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
if (!itemWorkflowSetting.idLoaiCongViec) {
|
|
18048
|
-
this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot] = itemWorkflowSetting;
|
|
18049
|
-
}
|
|
18050
|
-
else {
|
|
18051
|
-
this.dicWorkflowByLoaiCongViec[itemWorkflowSetting.idLoaiCongViec] = itemWorkflowSetting;
|
|
18052
|
-
}
|
|
18053
|
-
});
|
|
18054
|
-
return workflows;
|
|
18055
|
-
});
|
|
18128
|
+
resolve(isAuthorized);
|
|
18129
|
+
}));
|
|
18056
18130
|
}
|
|
18057
|
-
|
|
18131
|
+
getServicePermission(service, overrideLocalStorage = false) {
|
|
18058
18132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18059
|
-
const
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18133
|
+
const key = `AUTHORIZATION.${service.toUpperCase()}`;
|
|
18134
|
+
if (!overrideLocalStorage) {
|
|
18135
|
+
const storageItem = this.storage.getItem(key);
|
|
18136
|
+
if (storageItem && storageItem !== 'null') {
|
|
18137
|
+
const result = JSON.parse(storageItem);
|
|
18138
|
+
return result;
|
|
18139
|
+
}
|
|
18064
18140
|
}
|
|
18065
|
-
const
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
getItemLoaiCongViec(idLoaiCongViec) {
|
|
18070
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18071
|
-
if (!this.dicLoaiCongViec[idLoaiCongViec]) {
|
|
18072
|
-
this.dicLoaiCongViec[idLoaiCongViec] = (yield this.getDetail(idLoaiCongViec)).data;
|
|
18141
|
+
const url = `${this.serviceUri}/GetPermissionsByService?service=${service}`;
|
|
18142
|
+
const response = yield this.defaultGet(url);
|
|
18143
|
+
if (!response || !response.success) {
|
|
18144
|
+
return [];
|
|
18073
18145
|
}
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
DmLoaiCongViecService.decorators = [
|
|
18080
|
-
{ type: Injectable, args: [{
|
|
18081
|
-
providedIn: 'root'
|
|
18082
|
-
},] }
|
|
18083
|
-
];
|
|
18084
|
-
DmLoaiCongViecService.ctorParameters = () => [
|
|
18085
|
-
{ type: HttpClient },
|
|
18086
|
-
{ type: Injector },
|
|
18087
|
-
{ type: ModuleConfigService }
|
|
18088
|
-
];
|
|
18089
|
-
|
|
18090
|
-
class CongViecService extends BaseService {
|
|
18091
|
-
constructor(http, injector, _moduleConfigService, _dmLoaiCongViecService) {
|
|
18092
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CongViec_Chinh`);
|
|
18093
|
-
this._dmLoaiCongViecService = _dmLoaiCongViecService;
|
|
18094
|
-
this.serviceCode = 'congviec';
|
|
18095
|
-
this.entityName = 'CongViec_Chinh';
|
|
18096
|
-
this.objectName = 'công việc';
|
|
18097
|
-
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
18098
|
-
this._moduleConfig = _moduleConfigService.getConfig();
|
|
18099
|
-
}
|
|
18100
|
-
adjustSettingWorkflowForCrudList(setting) {
|
|
18101
|
-
this.useWorkflow = true;
|
|
18102
|
-
setting.isWorkflowTree = true;
|
|
18103
|
-
setting.baseService = this;
|
|
18104
|
-
setting.displayField = (item) => item.ten;
|
|
18105
|
-
setting.baseService.useWorkflow = true;
|
|
18106
|
-
setting.workflowConfigAdvance = {
|
|
18107
|
-
getWorkflowSetting: this.getWorkflowConfig.bind(this)
|
|
18108
|
-
};
|
|
18109
|
-
}
|
|
18110
|
-
getWorkflowConfig(rowData) {
|
|
18111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18112
|
-
return yield this._dmLoaiCongViecService.getWorkflowSettingByIdLoaiCongViec(rowData.idLoaiCongViec);
|
|
18146
|
+
if (overrideLocalStorage) {
|
|
18147
|
+
this.storage.removeItem(key);
|
|
18148
|
+
}
|
|
18149
|
+
this.storage.setItem(key, JSON.stringify(response.data));
|
|
18150
|
+
return response.data;
|
|
18113
18151
|
});
|
|
18114
18152
|
}
|
|
18115
|
-
|
|
18116
|
-
|
|
18117
|
-
|
|
18118
|
-
getDicIdByMenuState(data, tuNgay, denNgay) {
|
|
18119
|
-
return this.defaultPost(`${this.serviceUri}/GetDicIdByMenuState`, {
|
|
18120
|
-
lstTrangThai: data,
|
|
18121
|
-
tuNgay,
|
|
18122
|
-
denNgay
|
|
18123
|
-
});
|
|
18153
|
+
getPermissionIdsByModule(moduleCode, userId) {
|
|
18154
|
+
const url = `${this.serviceUri}/GetPermissionIdsByModule/${moduleCode}/${userId}`;
|
|
18155
|
+
return this.defaultGet(url);
|
|
18124
18156
|
}
|
|
18125
|
-
|
|
18126
|
-
const url = `${this.serviceUri}/
|
|
18157
|
+
phanQuyenNguoiDung(model) {
|
|
18158
|
+
const url = `${this.serviceUri}/PhanQuyenNguoiDung`;
|
|
18127
18159
|
return this.defaultPost(url, model);
|
|
18128
18160
|
}
|
|
18129
|
-
deleteBulkCongViecCon(ids) {
|
|
18130
|
-
const url = `${this.serviceUri}/DeleteBulkCongViecCon`;
|
|
18131
|
-
return this.defaultPost(url, ids);
|
|
18132
|
-
}
|
|
18133
|
-
getDataDashboardCaNhan(inputData) {
|
|
18134
|
-
const url = `${this.serviceUri}/GetDataDashboardCaNhan`;
|
|
18135
|
-
return this.defaultPost(url, inputData);
|
|
18136
|
-
}
|
|
18137
|
-
getDataDashboardByDonVi(inputData) {
|
|
18138
|
-
const url = `${this.serviceUri}/GetDataDashboardByDonVi`;
|
|
18139
|
-
return this.defaultPost(url, inputData);
|
|
18140
|
-
}
|
|
18141
|
-
getListTasksDashboard(dataFilter) {
|
|
18142
|
-
const url = `${this.serviceUri}/getListTasksDashboard`;
|
|
18143
|
-
return this.defaultPost(url, dataFilter);
|
|
18144
|
-
}
|
|
18145
18161
|
}
|
|
18146
|
-
|
|
18147
|
-
|
|
18162
|
+
PermissionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PermissionService_Factory() { return new PermissionService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(UserService), i0.ɵɵinject(i4.OAuthService), i0.ɵɵinject(ApplicationContextService)); }, token: PermissionService, providedIn: "root" });
|
|
18163
|
+
PermissionService.decorators = [
|
|
18148
18164
|
{ type: Injectable, args: [{
|
|
18149
18165
|
providedIn: 'root'
|
|
18150
18166
|
},] }
|
|
18151
18167
|
];
|
|
18152
|
-
|
|
18168
|
+
PermissionService.ctorParameters = () => [
|
|
18153
18169
|
{ type: HttpClient },
|
|
18154
18170
|
{ type: Injector },
|
|
18155
18171
|
{ type: ModuleConfigService },
|
|
18156
|
-
{ type:
|
|
18172
|
+
{ type: UserService },
|
|
18173
|
+
{ type: OAuthService },
|
|
18174
|
+
{ type: ApplicationContextService }
|
|
18157
18175
|
];
|
|
18158
18176
|
|
|
18159
|
-
class
|
|
18177
|
+
class WorkflowHistoryService extends BaseService {
|
|
18160
18178
|
constructor(http, injector, _moduleConfigService) {
|
|
18161
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.
|
|
18162
|
-
this.entityName = 'EntityWorkflowHistory';
|
|
18179
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/WorkflowHistory`);
|
|
18163
18180
|
this.serviceManagers = {};
|
|
18164
|
-
this.
|
|
18181
|
+
this.entityName = 'WorkflowHistory';
|
|
18182
|
+
this.serviceCode = 'workflow';
|
|
18183
|
+
this.apiDomain = _moduleConfigService.getConfig().environment.apiDomain;
|
|
18184
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint;
|
|
18165
18185
|
this._moduleConfig = _moduleConfigService.getConfig();
|
|
18186
|
+
this.apiVersion = _moduleConfigService.getConfig().environment.apiVersion;
|
|
18166
18187
|
}
|
|
18167
|
-
registerService(
|
|
18168
|
-
this.serviceManagers[
|
|
18188
|
+
registerService(settingKey, service) {
|
|
18189
|
+
this.serviceManagers[settingKey] = service;
|
|
18169
18190
|
}
|
|
18170
18191
|
getEndpointByService(service) {
|
|
18171
18192
|
return `${service.endPoint}/${this._moduleConfig.environment.apiVersion}`;
|
|
18172
18193
|
}
|
|
18173
|
-
|
|
18174
|
-
|
|
18175
|
-
|
|
18176
|
-
(this._injector.get(NotifierService)).showWarning('Bạn chưa đăng ký base service cho entity workflow history');
|
|
18177
|
-
}
|
|
18178
|
-
this.serviceUri = `${this.getEndpointByService(service)}/EntityWorkflowHistory`;
|
|
18194
|
+
changeEndpoint(baseService) {
|
|
18195
|
+
this.serviceUri = `${this.getEndpointByService(baseService)}/WorkflowHistory`;
|
|
18196
|
+
return this;
|
|
18179
18197
|
}
|
|
18180
|
-
|
|
18181
|
-
|
|
18182
|
-
|
|
18183
|
-
|
|
18198
|
+
getLastByItemId(itemId) {
|
|
18199
|
+
// return this.getDetailByFilter(
|
|
18200
|
+
// [
|
|
18201
|
+
// this.newFilter('itemId', Operator.equal, itemId)
|
|
18202
|
+
// ],
|
|
18203
|
+
// [{ field: 'time', dir: -1 }]
|
|
18204
|
+
// );
|
|
18205
|
+
return this.defaultPost(`${this.serviceUri}/GetLastByItemIdInMainThread/${itemId}`, {});
|
|
18206
|
+
}
|
|
18207
|
+
choYKien(model) {
|
|
18208
|
+
return this.defaultPost(`${this.serviceUri}/ChoYKien`, model);
|
|
18209
|
+
}
|
|
18210
|
+
getAllObjectRelated(serviceCode, entity, entityKey, fullApiUrl = null) {
|
|
18211
|
+
let apiUrl = fullApiUrl || this.apiDomain[`${serviceCode}Endpoint`];
|
|
18212
|
+
if (!apiUrl) {
|
|
18213
|
+
throw new Error(`Không tìm thấy api endpoint ứng với service ${serviceCode}`);
|
|
18184
18214
|
}
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
pageInfo: {
|
|
18188
|
-
page: 1,
|
|
18189
|
-
pageSize: 1
|
|
18190
|
-
},
|
|
18191
|
-
filters,
|
|
18192
|
-
sorts: [
|
|
18193
|
-
new Sort({ field: 'created', dir: 1 })
|
|
18194
|
-
]
|
|
18195
|
-
};
|
|
18196
|
-
return this.defaultPost(url, gridInfo);
|
|
18215
|
+
apiUrl = `${apiUrl}/${this.apiVersion}/WorkflowHistory/GetAllObjectRelated/${entity}/${entityKey}`;
|
|
18216
|
+
return this.defaultGet(apiUrl);
|
|
18197
18217
|
}
|
|
18198
18218
|
}
|
|
18199
|
-
|
|
18200
|
-
|
|
18219
|
+
WorkflowHistoryService.ɵprov = i0.ɵɵdefineInjectable({ factory: function WorkflowHistoryService_Factory() { return new WorkflowHistoryService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: WorkflowHistoryService, providedIn: "root" });
|
|
18220
|
+
WorkflowHistoryService.decorators = [
|
|
18201
18221
|
{ type: Injectable, args: [{
|
|
18202
18222
|
providedIn: 'root'
|
|
18203
18223
|
},] }
|
|
18204
18224
|
];
|
|
18205
|
-
|
|
18225
|
+
WorkflowHistoryService.ctorParameters = () => [
|
|
18206
18226
|
{ type: HttpClient },
|
|
18207
18227
|
{ type: Injector },
|
|
18208
18228
|
{ type: ModuleConfigService }
|
|
@@ -18349,83 +18369,66 @@ WorkflowPermissionDetailService.ctorParameters = () => [
|
|
|
18349
18369
|
{ type: ModuleConfigService }
|
|
18350
18370
|
];
|
|
18351
18371
|
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
getEndpointByService(service) {
|
|
18367
|
-
return `${service.endPoint}/${this._moduleConfig.environment.apiVersion}`;
|
|
18368
|
-
}
|
|
18369
|
-
changeEndpoint(baseService) {
|
|
18370
|
-
this.serviceUri = `${this.getEndpointByService(baseService)}/WorkflowHistory`;
|
|
18371
|
-
return this;
|
|
18372
|
-
}
|
|
18373
|
-
getLastByItemId(itemId) {
|
|
18374
|
-
// return this.getDetailByFilter(
|
|
18375
|
-
// [
|
|
18376
|
-
// this.newFilter('itemId', Operator.equal, itemId)
|
|
18377
|
-
// ],
|
|
18378
|
-
// [{ field: 'time', dir: -1 }]
|
|
18379
|
-
// );
|
|
18380
|
-
return this.defaultPost(`${this.serviceUri}/GetLastByItemIdInMainThread/${itemId}`, {});
|
|
18381
|
-
}
|
|
18382
|
-
choYKien(model) {
|
|
18383
|
-
return this.defaultPost(`${this.serviceUri}/ChoYKien`, model);
|
|
18384
|
-
}
|
|
18385
|
-
getAllObjectRelated(serviceCode, entity, entityKey, fullApiUrl = null) {
|
|
18386
|
-
let apiUrl = fullApiUrl || this.apiDomain[`${serviceCode}Endpoint`];
|
|
18387
|
-
if (!apiUrl) {
|
|
18388
|
-
throw new Error(`Không tìm thấy api endpoint ứng với service ${serviceCode}`);
|
|
18372
|
+
var sort_by;
|
|
18373
|
+
(function () {
|
|
18374
|
+
const defaultCompareFunc = function (a, b) {
|
|
18375
|
+
if (a == b)
|
|
18376
|
+
return 0;
|
|
18377
|
+
return a < b ? -1 : 1;
|
|
18378
|
+
};
|
|
18379
|
+
const getCompareFunc = function (primer, reverse) {
|
|
18380
|
+
const defaultCompare = defaultCompareFunc;
|
|
18381
|
+
let compare = defaultCompareFunc;
|
|
18382
|
+
if (primer) {
|
|
18383
|
+
compare = function (a, b) {
|
|
18384
|
+
return defaultCompare(primer(a), primer(b));
|
|
18385
|
+
};
|
|
18389
18386
|
}
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
}
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
];
|
|
18424
|
-
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18387
|
+
if (reverse) {
|
|
18388
|
+
return function (a, b) {
|
|
18389
|
+
return -1 * compare(a, b);
|
|
18390
|
+
};
|
|
18391
|
+
}
|
|
18392
|
+
return compare;
|
|
18393
|
+
};
|
|
18394
|
+
sort_by = function (...args) {
|
|
18395
|
+
const fields = [], n_fields = args.length;
|
|
18396
|
+
let field, name, cmp;
|
|
18397
|
+
// preprocess sorting options
|
|
18398
|
+
for (let i = 0; i < n_fields; i++) {
|
|
18399
|
+
field = args[i];
|
|
18400
|
+
if (typeof field === 'string') {
|
|
18401
|
+
name = field;
|
|
18402
|
+
cmp = defaultCompareFunc;
|
|
18403
|
+
}
|
|
18404
|
+
else {
|
|
18405
|
+
name = field.name;
|
|
18406
|
+
cmp = getCompareFunc(field.primer, field.reverse);
|
|
18407
|
+
}
|
|
18408
|
+
fields.push({
|
|
18409
|
+
name: name,
|
|
18410
|
+
cmp: cmp
|
|
18411
|
+
});
|
|
18412
|
+
}
|
|
18413
|
+
// final comparison function
|
|
18414
|
+
return function (A, B) {
|
|
18415
|
+
let name, result;
|
|
18416
|
+
for (let i = 0; i < n_fields; i++) {
|
|
18417
|
+
result = 0;
|
|
18418
|
+
field = fields[i];
|
|
18419
|
+
name = field.name;
|
|
18420
|
+
result = field.cmp(A[name], B[name]);
|
|
18421
|
+
if (result !== 0)
|
|
18422
|
+
break;
|
|
18423
|
+
}
|
|
18424
|
+
return result;
|
|
18425
|
+
};
|
|
18426
|
+
};
|
|
18427
|
+
}());
|
|
18428
|
+
// multipleSort('idTinhThanh', 'idQuanHuyen')
|
|
18429
|
+
// multipleSort({name: 'idTinhThanh', reverse: true}, 'idQuanHuyen')
|
|
18430
|
+
// multipleSort({name: 'soThuTu', primer: parseInt}, 'idQuanHuyen') // parseInt là function
|
|
18431
|
+
const multipleSort = sort_by;
|
|
18429
18432
|
|
|
18430
18433
|
class ListComponentBase extends ComponentBase {
|
|
18431
18434
|
constructor(_injector, _isTreeTable) {
|
|
@@ -19678,15 +19681,15 @@ class ListComponentBase extends ComponentBase {
|
|
|
19678
19681
|
const result = newArr.reduce((x, y) => y.colSpan + x, 0);
|
|
19679
19682
|
return result > a ? result : a;
|
|
19680
19683
|
}, 0);
|
|
19681
|
-
const startIndex = this.setting.hiddenCheckbox ? 0 : 1;
|
|
19682
19684
|
const endIndex = maxColSize - (this.setting.hiddenFunctionColumn ? 1 : 2);
|
|
19683
19685
|
for (let ind = 0; ind < lstRow.length; ind++) {
|
|
19684
19686
|
const arrTh = [...allTh[ind]];
|
|
19687
|
+
const startIndex = arrTh[0].className.includes('chkbox') ? 1 : 0;
|
|
19685
19688
|
if (startIndex > endIndex) {
|
|
19686
19689
|
return null;
|
|
19687
19690
|
}
|
|
19688
19691
|
result[ind] = (_a = result[ind]) !== null && _a !== void 0 ? _a : [];
|
|
19689
|
-
let colIndex =
|
|
19692
|
+
let colIndex = result[ind].length;
|
|
19690
19693
|
const numOfColSpan = arrTh.reduce((x, y) => x + y.colSpan - 1, 0);
|
|
19691
19694
|
for (let i = startIndex; i <= endIndex - numOfColSpan; i++) {
|
|
19692
19695
|
if (arrTh[i]) {
|
|
@@ -19848,6 +19851,7 @@ class ListComponentBase extends ComponentBase {
|
|
|
19848
19851
|
}
|
|
19849
19852
|
getValueCheckboxFormat(data) {
|
|
19850
19853
|
const checkBox = data.querySelector('p-checkbox');
|
|
19854
|
+
const input = data.querySelector('input');
|
|
19851
19855
|
if (checkBox) {
|
|
19852
19856
|
const value = data.querySelector('span.pi-check');
|
|
19853
19857
|
if (value) {
|
|
@@ -19857,6 +19861,9 @@ class ListComponentBase extends ComponentBase {
|
|
|
19857
19861
|
return 'Không';
|
|
19858
19862
|
}
|
|
19859
19863
|
}
|
|
19864
|
+
if (input) {
|
|
19865
|
+
return input.value;
|
|
19866
|
+
}
|
|
19860
19867
|
return '';
|
|
19861
19868
|
}
|
|
19862
19869
|
view(rowData) {
|
|
@@ -46015,34 +46022,37 @@ class TnTinymceComponent extends ComponentBase {
|
|
|
46015
46022
|
},
|
|
46016
46023
|
mobile: {
|
|
46017
46024
|
theme: 'silver',
|
|
46018
|
-
plugins: ['
|
|
46025
|
+
plugins: ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'],
|
|
46019
46026
|
}
|
|
46020
46027
|
};
|
|
46021
46028
|
if (mode == 'full') {
|
|
46022
46029
|
config.plugins = [
|
|
46023
|
-
'
|
|
46030
|
+
'advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus editFileNew addNews'
|
|
46024
46031
|
];
|
|
46025
46032
|
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table link editFileNew addNews | print removeformat undo redo | fullscreen ';
|
|
46026
46033
|
config.mobile.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
46027
|
-
return config;
|
|
46034
|
+
// return config;
|
|
46028
46035
|
}
|
|
46029
46036
|
else if (mode == 'medium') {
|
|
46030
|
-
config.plugins = ['
|
|
46037
|
+
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'];
|
|
46031
46038
|
config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table link | print removeformat undo redo | fullscreen';
|
|
46032
46039
|
config.mobile.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
46033
|
-
return config;
|
|
46040
|
+
// return config;
|
|
46034
46041
|
}
|
|
46035
46042
|
else if (mode == 'simple') {
|
|
46036
|
-
config.plugins = ['
|
|
46043
|
+
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'];
|
|
46037
46044
|
config.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
46038
46045
|
config.mobile.toolbar = 'fullscreen | bold italic Strikethrough forecolor backcolor | bullist numlist';
|
|
46039
|
-
return config;
|
|
46046
|
+
// return config;
|
|
46040
46047
|
}
|
|
46041
46048
|
else {
|
|
46042
|
-
config.plugins = ['
|
|
46049
|
+
config.plugins = ['advlist autolink lists link image charmap print preview anchor textcolor searchreplace visualblocks code fullscreen insertdatetime media table media code lists colorpicker imagetools tabfocus textcolor'];
|
|
46043
46050
|
// config.toolbar = 'formatselect | bold italic Strikethrough forecolor backcolor| alignleft aligncenter alignright alignjustify | bullist numlist';
|
|
46044
46051
|
config.toolbar = 'bold italic Strikethrough forecolor backcolor | bullist numlist | fullscreen';
|
|
46045
46052
|
}
|
|
46053
|
+
if ($this.control.isFullPage && !config.some(x => x == 'fullpage')) {
|
|
46054
|
+
config.plugins.push(' fullpage');
|
|
46055
|
+
}
|
|
46046
46056
|
config.paste_data_images = true;
|
|
46047
46057
|
return config;
|
|
46048
46058
|
}
|