tnx-shared 5.1.429 → 5.1.431

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.
@@ -6261,7 +6261,7 @@
6261
6261
  CrudService.prototype.getRefDataInDatasource = function (dataSource, schemas, callBackAfterGetRefDataDropdown) {
6262
6262
  if (callBackAfterGetRefDataDropdown === void 0) { callBackAfterGetRefDataDropdown = null; }
6263
6263
  return __awaiter(this, void 0, void 0, function () {
6264
- var dicData, schemas_1, schemas_1_1, schema, promise, data, lstData, _loop_1, this_1, index;
6264
+ var schemaHasOrder, dicData, schemas_1, schemas_1_1, schema, promise, data, lstData, _loop_1, this_1, index;
6265
6265
  var e_1, _a;
6266
6266
  return __generator(this, function (_b) {
6267
6267
  switch (_b.label) {
@@ -6270,6 +6270,12 @@
6270
6270
  return [2 /*return*/];
6271
6271
  if (!schemas || !schemas.length)
6272
6272
  return [2 /*return*/];
6273
+ schemaHasOrder = schemas.filter(function (x) { return Number.isInteger(x.order); });
6274
+ if (!schemaHasOrder) return [3 /*break*/, 2];
6275
+ return [4 /*yield*/, this.getRefDataInDatasourceWithOrder(dataSource, schemaHasOrder, callBackAfterGetRefDataDropdown)];
6276
+ case 1: return [2 /*return*/, _b.sent()];
6277
+ case 2:
6278
+ schemas = schemas.filter(function (x) { return !Number.isInteger(x.order); });
6273
6279
  dicData = [];
6274
6280
  try {
6275
6281
  // preprocess schema, them schema vao arr voi index = schema.order
@@ -6332,10 +6338,103 @@
6332
6338
  };
6333
6339
  this_1 = this;
6334
6340
  index = 0;
6341
+ _b.label = 3;
6342
+ case 3:
6343
+ if (!(index < lstData.length)) return [3 /*break*/, 6];
6344
+ return [5 /*yield**/, _loop_1(index)];
6345
+ case 4:
6346
+ _b.sent();
6347
+ _b.label = 5;
6348
+ case 5:
6349
+ index++;
6350
+ return [3 /*break*/, 3];
6351
+ case 6: return [2 /*return*/];
6352
+ }
6353
+ });
6354
+ });
6355
+ };
6356
+ CrudService.prototype.getRefDataInDatasourceWithOrder = function (dataSource, schemas, callBackAfterGetRefDataDropdown) {
6357
+ if (callBackAfterGetRefDataDropdown === void 0) { callBackAfterGetRefDataDropdown = null; }
6358
+ return __awaiter(this, void 0, void 0, function () {
6359
+ var dicData, _loop_2, schemas_2, schemas_2_1, schema, lstData, _loop_3, this_2, index;
6360
+ var e_2, _a;
6361
+ var _this = this;
6362
+ return __generator(this, function (_b) {
6363
+ switch (_b.label) {
6364
+ case 0:
6365
+ schemas.sort(function (a, b) { return a.order - b.order; });
6366
+ dicData = [];
6367
+ _loop_2 = function (schema) {
6368
+ var funcGetPromise = function (__dataSource) {
6369
+ return schema.baseService ? _this.processSchemaWithBaseService(schema, __dataSource) : new Promise(function (resolve) { return resolve(true); });
6370
+ };
6371
+ var data = dicData[schema.order];
6372
+ if (data == null) {
6373
+ dicData[schema.order] = {
6374
+ promises: [funcGetPromise],
6375
+ schemas: [schema]
6376
+ };
6377
+ return "continue";
6378
+ }
6379
+ data.schemas.push(schema);
6380
+ data.promises.push(funcGetPromise);
6381
+ };
6382
+ try {
6383
+ // preprocess schema, them schema vao arr voi index = schema.order
6384
+ for (schemas_2 = __values(schemas), schemas_2_1 = schemas_2.next(); !schemas_2_1.done; schemas_2_1 = schemas_2.next()) {
6385
+ schema = schemas_2_1.value;
6386
+ _loop_2(schema);
6387
+ }
6388
+ }
6389
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
6390
+ finally {
6391
+ try {
6392
+ if (schemas_2_1 && !schemas_2_1.done && (_a = schemas_2.return)) _a.call(schemas_2);
6393
+ }
6394
+ finally { if (e_2) throw e_2.error; }
6395
+ }
6396
+ lstData = Object.values(dicData);
6397
+ _loop_3 = function (index) {
6398
+ var data, promises, schemaDatas, promiseAll, arrRes;
6399
+ return __generator(this, function (_a) {
6400
+ switch (_a.label) {
6401
+ case 0:
6402
+ data = lstData[index];
6403
+ if (data == null) {
6404
+ return [2 /*return*/, "continue"];
6405
+ }
6406
+ promises = data.promises;
6407
+ schemaDatas = data.schemas;
6408
+ if (promises.length === 0) {
6409
+ return [2 /*return*/, "continue"];
6410
+ }
6411
+ promiseAll = promises.map(function (x) { return x(dataSource); });
6412
+ return [4 /*yield*/, Promise.all(promiseAll)];
6413
+ case 1:
6414
+ arrRes = _a.sent();
6415
+ schemaDatas.forEach(function (schema, resIndex) {
6416
+ var schemaData = arrRes[resIndex] === true ? schema.dataSource : arrRes[resIndex];
6417
+ if (schema.callbackDataFinish) {
6418
+ schema.callbackDataFinish({
6419
+ data: schemaData
6420
+ });
6421
+ }
6422
+ schema.dataSource = schemaData;
6423
+ if (callBackAfterGetRefDataDropdown) {
6424
+ callBackAfterGetRefDataDropdown(schema.field);
6425
+ }
6426
+ });
6427
+ this_2.mergeRefDatasToDatasource(dataSource, schemaDatas);
6428
+ return [2 /*return*/];
6429
+ }
6430
+ });
6431
+ };
6432
+ this_2 = this;
6433
+ index = 0;
6335
6434
  _b.label = 1;
6336
6435
  case 1:
6337
6436
  if (!(index < lstData.length)) return [3 /*break*/, 4];
6338
- return [5 /*yield**/, _loop_1(index)];
6437
+ return [5 /*yield**/, _loop_3(index)];
6339
6438
  case 2:
6340
6439
  _b.sent();
6341
6440
  _b.label = 3;
@@ -6391,12 +6490,12 @@
6391
6490
  return schema.funcGetLabel ? schema.funcGetLabel : function (item) { return item[schema.displayFieldInGrid] || item[schema.displayField] || item['ten']; };
6392
6491
  };
6393
6492
  CrudService.prototype.mergeRefDatasToDatasource = function (dataSource, schemas, callBackAfterGetRefDataDropdown) {
6394
- var e_2, _a, e_3, _b;
6493
+ var e_3, _a, e_4, _b;
6395
6494
  try {
6396
6495
  // #region set default function
6397
6496
  for (var dataSource_1 = __values(dataSource), dataSource_1_1 = dataSource_1.next(); !dataSource_1_1.done; dataSource_1_1 = dataSource_1.next()) {
6398
6497
  var rowData = dataSource_1_1.value;
6399
- var _loop_2 = function (schema) {
6498
+ var _loop_4 = function (schema) {
6400
6499
  var data = schema.dataSource;
6401
6500
  var field = schema.field;
6402
6501
  if (!data || !data.length) {
@@ -6409,7 +6508,7 @@
6409
6508
  if (fieldData == null) {
6410
6509
  return "continue";
6411
6510
  }
6412
- var funcGetLabel = this_2.getFuntionGetLabel(schema);
6511
+ var funcGetLabel = this_3.getFuntionGetLabel(schema);
6413
6512
  var funcSetValueRow = schema.funcSetValueRow
6414
6513
  ? schema.funcSetValueRow
6415
6514
  : function (rowItem, data) {
@@ -6447,7 +6546,7 @@
6447
6546
  // #endregion
6448
6547
  if (schema.multiple) {
6449
6548
  var ids_1 = [];
6450
- this_2.mapValueMultiple(ids_1, fieldData, schema);
6549
+ this_3.mapValueMultiple(ids_1, fieldData, schema);
6451
6550
  var refItems = data.filter(function (i) { return ids_1.some(function (q) { return schema.funcCompare(i, q); }); });
6452
6551
  if (refItems.length > 0) {
6453
6552
  rowData['str' + field] = funcGetRefDataRow(refItems);
@@ -6459,31 +6558,31 @@
6459
6558
  }
6460
6559
  funcGetRefDataSingle(rowData);
6461
6560
  };
6462
- var this_2 = this;
6561
+ var this_3 = this;
6463
6562
  try {
6464
- for (var schemas_2 = (e_3 = void 0, __values(schemas)), schemas_2_1 = schemas_2.next(); !schemas_2_1.done; schemas_2_1 = schemas_2.next()) {
6465
- var schema = schemas_2_1.value;
6466
- _loop_2(schema);
6563
+ for (var schemas_3 = (e_4 = void 0, __values(schemas)), schemas_3_1 = schemas_3.next(); !schemas_3_1.done; schemas_3_1 = schemas_3.next()) {
6564
+ var schema = schemas_3_1.value;
6565
+ _loop_4(schema);
6467
6566
  }
6468
6567
  }
6469
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
6568
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
6470
6569
  finally {
6471
6570
  try {
6472
- if (schemas_2_1 && !schemas_2_1.done && (_b = schemas_2.return)) _b.call(schemas_2);
6571
+ if (schemas_3_1 && !schemas_3_1.done && (_b = schemas_3.return)) _b.call(schemas_3);
6473
6572
  }
6474
- finally { if (e_3) throw e_3.error; }
6573
+ finally { if (e_4) throw e_4.error; }
6475
6574
  }
6476
6575
  // if (callBackAfterGetRefDataDropdown) {
6477
6576
  // callBackAfterGetRefDataDropdown(rowData);
6478
6577
  // }
6479
6578
  }
6480
6579
  }
6481
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
6580
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
6482
6581
  finally {
6483
6582
  try {
6484
6583
  if (dataSource_1_1 && !dataSource_1_1.done && (_a = dataSource_1.return)) _a.call(dataSource_1);
6485
6584
  }
6486
- finally { if (e_2) throw e_2.error; }
6585
+ finally { if (e_3) throw e_3.error; }
6487
6586
  }
6488
6587
  };
6489
6588
  CrudService.prototype.mergeRefDataToDatasource = function (dataSource, schema, data) {
@@ -6971,7 +7070,7 @@
6971
7070
  }
6972
7071
  };
6973
7072
  CrudService.prototype.getValueFilter = function (filter, model, rootModel) {
6974
- var e_4, _a;
7073
+ var e_5, _a;
6975
7074
  var _this = this;
6976
7075
  var sourceField = filter.sourceField;
6977
7076
  var subField = filter.subField;
@@ -7017,12 +7116,12 @@
7017
7116
  }
7018
7117
  }
7019
7118
  }
7020
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
7119
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
7021
7120
  finally {
7022
7121
  try {
7023
7122
  if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
7024
7123
  }
7025
- finally { if (e_4) throw e_4.error; }
7124
+ finally { if (e_5) throw e_5.error; }
7026
7125
  }
7027
7126
  return tryGetBySubField(temp[subField]);
7028
7127
  }
@@ -42785,6 +42884,95 @@
42785
42884
  CanBoHoSoService.prototype.getListTreeDonViQuanLyByUser = function () {
42786
42885
  return this.defaultGet(this.serviceUri + "/GetListTreeDonViQuanLyByUser");
42787
42886
  };
42887
+ CanBoHoSoService.prototype.getModelSchemas = function () {
42888
+ return [
42889
+ new ModelSchema({
42890
+ field: 'code',
42891
+ name: 'Mã',
42892
+ fullName: 'Mã',
42893
+ description: 'Mã',
42894
+ }),
42895
+ new ModelSchema({
42896
+ field: 'id',
42897
+ name: 'id',
42898
+ fullName: 'id',
42899
+ description: 'id',
42900
+ }),
42901
+ new ModelSchema({
42902
+ field: 'idHocVien',
42903
+ name: 'id',
42904
+ fullName: 'id',
42905
+ description: 'id',
42906
+ }),
42907
+ new ModelSchema({
42908
+ field: 'hoVaTen',
42909
+ name: 'Họ và tên',
42910
+ fullName: 'Họ và tên',
42911
+ description: 'Họ và tên',
42912
+ }),
42913
+ new ModelSchema({
42914
+ field: 'ngaySinh',
42915
+ name: 'Ngày sinh',
42916
+ fullName: 'Ngày sinh',
42917
+ description: 'Ngày sinh',
42918
+ }),
42919
+ new ModelSchema({
42920
+ field: 'dienThoaiDiDong',
42921
+ name: 'Số điện thoại',
42922
+ fullName: 'Số điện thoại',
42923
+ description: 'Số điện thoại',
42924
+ }),
42925
+ new ModelSchema({
42926
+ field: 'email',
42927
+ name: 'Email',
42928
+ fullName: 'Email',
42929
+ description: 'Email',
42930
+ }),
42931
+ new ModelSchema({
42932
+ field: 'donViChucVus',
42933
+ name: 'Đơn vị - Chức vụ',
42934
+ fullName: 'Đơn vị - Chức vụ',
42935
+ description: 'Đơn vị - Chức vụ',
42936
+ })
42937
+ ];
42938
+ };
42939
+ CanBoHoSoService.prototype.getColumnSchemaBase = function () {
42940
+ return [
42941
+ new ColumnSchemaBase({
42942
+ field: 'code',
42943
+ width: '150px'
42944
+ }),
42945
+ new ColumnSchemaBase({
42946
+ field: 'idHocVien',
42947
+ includeSelect: false,
42948
+ visible: false
42949
+ }),
42950
+ new ColumnSchemaBase({
42951
+ field: 'hoVaTen',
42952
+ width: '200px'
42953
+ }),
42954
+ new ColumnSchemaBase({
42955
+ field: 'ngaySinh',
42956
+ dataType: 'date',
42957
+ width: '110px'
42958
+ }),
42959
+ new ColumnSchemaBase({
42960
+ field: 'dienThoaiDiDong',
42961
+ width: '110px'
42962
+ }),
42963
+ new ColumnSchemaBase({
42964
+ field: 'email',
42965
+ width: '180px'
42966
+ }),
42967
+ new ColumnSchemaBase({
42968
+ field: 'donViChucVus',
42969
+ allowFilter: false,
42970
+ sort: false,
42971
+ includeSelect: false,
42972
+ width: '250px'
42973
+ })
42974
+ ];
42975
+ };
42788
42976
  return CanBoHoSoService;
42789
42977
  }(BaseService));
42790
42978
  CanBoHoSoService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CanBoHoSoService_Factory() { return new CanBoHoSoService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: CanBoHoSoService, providedIn: "root" });