@adins/ucsearch 2.11.28 → 2.13.2

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.
@@ -691,25 +691,28 @@ class UCSearchComponent {
691
691
  return this.http.post(url, criteria);
692
692
  }
693
693
  /**
694
+ * @param {?=} IsExportExcel
694
695
  * @return {?}
695
696
  */
696
- searchClick() {
697
- // for(let i=0;i<this.countForm;i++){
698
- // if(this.configuration.component[i].type == "datepicker"){
699
- // if ((i != (this.countForm-1)) && (this.configuration.component[i].name != this.configuration.component[i+1].name)){
700
- // this.checkInputDate(this.configuration.component[i]);
701
- // }
702
- // }
703
- // }
704
- // if(this.dateWrong) return;
705
- // for(let i=0;i<this.countForm;i++){
706
- // if(this.configuration.component[i].type == "datepicker"){
707
- // if ((i != (this.countForm-1)) && (this.configuration.component[i].name != this.configuration.component[i+1].name)){
708
- // this.checkInputDate(this.configuration.component[i]);
709
- // }
710
- // }
711
- // }
712
- // if(this.dateWrong) return;
697
+ searchClick(IsExportExcel = false) {
698
+ /** @type {?} */
699
+ let filtered = this.configuration.component.filter((/**
700
+ * @param {?} item
701
+ * @param {?} i
702
+ * @param {?} arr
703
+ * @return {?}
704
+ */
705
+ (item, i, arr) => arr.findIndex((/**
706
+ * @param {?} x
707
+ * @return {?}
708
+ */
709
+ (x) => (x.name === item.name))) === i));
710
+ for (let i = 0; i < filtered.length; i++) {
711
+ if (filtered[i].type == "numeric") {
712
+ if (!this.checkValueGteLte(filtered[i]))
713
+ return;
714
+ }
715
+ }
713
716
  /** @type {?} */
714
717
  let order = null;
715
718
  if (this.configuration.orderby != null) {
@@ -719,7 +722,11 @@ class UCSearchComponent {
719
722
  };
720
723
  }
721
724
  this.pageNow = 1;
722
- this.search(this.apiUrl, this.pageNow, this.pageSize, order, this.arrCrit);
725
+ /** @type {?} */
726
+ let rowPerPage = this.pageSize;
727
+ if (IsExportExcel)
728
+ rowPerPage = 9999;
729
+ this.search(this.apiUrl, this.pageNow, rowPerPage, order, this.arrCrit, IsExportExcel);
723
730
  }
724
731
  /**
725
732
  * @return {?}
@@ -738,9 +745,10 @@ class UCSearchComponent {
738
745
  * @param {?} rowPerPage
739
746
  * @param {?} orderBy
740
747
  * @param {?=} addCrit
748
+ * @param {?=} IsExportExcel
741
749
  * @return {?}
742
750
  */
743
- search(apiUrl, pageNo, rowPerPage, orderBy, addCrit = new Array()) {
751
+ search(apiUrl, pageNo, rowPerPage, orderBy, addCrit = new Array(), IsExportExcel = false) {
744
752
  /** @type {?} */
745
753
  let request = new RequestCriteriaObj();
746
754
  /** @type {?} */
@@ -911,10 +919,8 @@ class UCSearchComponent {
911
919
  }
912
920
  }
913
921
  request.criteria = arrCrit;
914
- if (!this.searchInput.isJoinExAPI) {
915
- request.integrationObj = null;
916
- }
917
- else {
922
+ request.integrationObj = null;
923
+ if (this.searchInput.isJoinExAPI) {
918
924
  request.integrationObj = this.searchInput.integrationObj;
919
925
  }
920
926
  this.http.post(apiUrl, request).subscribe((/**
@@ -922,6 +928,11 @@ class UCSearchComponent {
922
928
  * @return {?}
923
929
  */
924
930
  (response) => {
931
+ if (IsExportExcel) {
932
+ this.ExcelData = response["Data"];
933
+ this.excelService.exportAsExcelFile(this.ExcelData, 'sample');
934
+ return;
935
+ }
925
936
  /** @type {?} */
926
937
  let qryPaging = {
927
938
  response: response,
@@ -982,6 +993,46 @@ class UCSearchComponent {
982
993
  }
983
994
  }));
984
995
  }
996
+ /**
997
+ * @param {?} component
998
+ * @return {?}
999
+ */
1000
+ checkValueGteLte(component) {
1001
+ //cek yg pakai restriction gte/lte/gt/lt
1002
+ /** @type {?} */
1003
+ let MinComponent = this.configuration.component.find((/**
1004
+ * @param {?} x
1005
+ * @return {?}
1006
+ */
1007
+ x => x.name == component.name && (x.restriction.toUpperCase() == "GTE"))) == undefined ? this.configuration.component.find((/**
1008
+ * @param {?} x
1009
+ * @return {?}
1010
+ */
1011
+ x => x.name == component.name && (x.restriction.toUpperCase() == "GT"))) : this.configuration.component.find((/**
1012
+ * @param {?} x
1013
+ * @return {?}
1014
+ */
1015
+ x => x.name == component.name && (x.restriction.toUpperCase() == "GTE")));
1016
+ /** @type {?} */
1017
+ let MaxComponent = this.configuration.component.find((/**
1018
+ * @param {?} x
1019
+ * @return {?}
1020
+ */
1021
+ x => x.name == component.name && (x.restriction.toUpperCase() == "LTE"))) == undefined ? this.configuration.component.find((/**
1022
+ * @param {?} x
1023
+ * @return {?}
1024
+ */
1025
+ x => x.name == component.name && (x.restriction.toUpperCase() == "LT"))) : this.configuration.component.find((/**
1026
+ * @param {?} x
1027
+ * @return {?}
1028
+ */
1029
+ x => x.name == component.name && (x.restriction.toUpperCase() == "LTE")));
1030
+ if (this.myForm.nativeElement[MinComponent.id].value > this.myForm.nativeElement[MaxComponent.id].value) {
1031
+ this.toastr.warning(MinComponent.label + " must be less than " + MaxComponent.label);
1032
+ return false;
1033
+ }
1034
+ return true;
1035
+ }
985
1036
  /**
986
1037
  * @param {?} element
987
1038
  * @return {?}
@@ -1002,33 +1053,26 @@ class UCSearchComponent {
1002
1053
  * @return {?}
1003
1054
  */
1004
1055
  exportAsXLSX() {
1005
- /** @type {?} */
1006
- let request = new RequestCriteriaObj();
1007
- request.pageNo = 1;
1008
- request.rowPerPage = 9999;
1009
- request.orderBy = null;
1010
- request.criteria = [];
1011
- request.queryString = this.configuration.querystring;
1012
- if (!this.searchInput.isJoinExAPI) {
1013
- request.integrationObj = null;
1014
- }
1015
- else {
1016
- request.integrationObj = this.searchInput.integrationObj;
1017
- }
1018
- this.http.post(this.apiUrl, request).subscribe((/**
1019
- * @param {?} response
1020
- * @return {?}
1021
- */
1022
- response => {
1023
- this.ExcelData = response["Data"];
1024
- this.excelService.exportAsExcelFile(this.ExcelData, 'sample');
1025
- }), (/**
1026
- * @param {?} error
1027
- * @return {?}
1028
- */
1029
- (error) => {
1030
- console.log(error);
1031
- }));
1056
+ this.searchClick(true);
1057
+ // let request = new RequestCriteriaObj();
1058
+ // request.pageNo = 1;
1059
+ // request.rowPerPage = 9999;
1060
+ // request.orderBy = null;
1061
+ // request.criteria = [];
1062
+ // request.queryString = this.configuration.querystring;
1063
+ // if (!this.searchInput.isJoinExAPI) {
1064
+ // request.integrationObj = null;
1065
+ // } else {
1066
+ // request.integrationObj = this.searchInput.integrationObj;
1067
+ // }
1068
+ // this.http.post(this.apiUrl, request).subscribe(
1069
+ // response => {
1070
+ // this.ExcelData = response["Data"];
1071
+ // this.excelService.exportAsExcelFile(this.ExcelData, 'sample');
1072
+ // },
1073
+ // (error) => {
1074
+ // console.log(error);
1075
+ // });
1032
1076
  }
1033
1077
  /**
1034
1078
  * @param {?} optValue
@@ -1095,8 +1139,12 @@ class UCSearchComponent {
1095
1139
  let ddl = component.options;
1096
1140
  /** @type {?} */
1097
1141
  let text = ddl[ddl.selectedIndex].value.trim();
1098
- if (text) {
1099
- this.searchInput.integrationObj.requestObj[wfKeyFilter] = text;
1142
+ /** @type {?} */
1143
+ let listValue = text.split(';');
1144
+ /** @type {?} */
1145
+ let listWfKey = wfKeyFilter.split(';');
1146
+ for (let i = 0; i < listValue.length; i++) {
1147
+ this.searchInput.integrationObj.requestObj[listWfKey[i]] = listValue[i];
1100
1148
  }
1101
1149
  }
1102
1150
  /**