@unipin/angular-applet 17.2.0 → 17.2.1
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/esm2022/lib/components/approval/form/approval-form.component.mjs +22 -14
- package/esm2022/lib/components/approval/list/approval-list.component.mjs +12 -8
- package/esm2022/lib/components/audit/detail/audit-detail.component.mjs +2 -2
- package/esm2022/lib/components/containers/applet-container/applet-container.component.mjs +1 -1
- package/esm2022/lib/components/containers/colum-header-container/column-header-container.component.mjs +3 -3
- package/esm2022/lib/components/containers/column-container/column-container.component.mjs +1 -1
- package/esm2022/lib/components/containers/list-container/list-pagination-container/list-pagination-container.component.mjs +1 -1
- package/esm2022/lib/components/containers/list-container/list-snapshot-container/list-snapshot-container.component.mjs +1 -1
- package/esm2022/lib/components/forms/image-picker/form-image-picker.component.mjs +2 -2
- package/esm2022/lib/components/forms/textarea/form-textarea.component.mjs +5 -4
- package/fesm2022/unipin-angular-applet.mjs +303 -293
- package/fesm2022/unipin-angular-applet.mjs.map +1 -1
- package/lib/components/approval/list/approval-list.component.d.ts +1 -1
- package/lib/components/containers/colum-header-container/column-header-container.component.d.ts +1 -1
- package/lib/components/forms/textarea/form-textarea.component.d.ts +2 -2
- package/package.json +1 -1
|
@@ -502,7 +502,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
502
502
|
|
|
503
503
|
class ColumnHeaderContainerComponent {
|
|
504
504
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ColumnHeaderContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
505
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ColumnHeaderContainerComponent, isStandalone: true, selector: "up-column-header-container", inputs: { header: "header", prevUrl: "prevUrl" }, host: { classAttribute: "d-flex flex-column h-100" }, ngImport: i0, template: "<div class=\"d-flex justify-content-between align-items-center border-bottom py-1 ps-1 pe-4 flex-shrink-0\">\n\t<div class=\"flex-grow-1 d-flex align-items-center pe-3\">\n\t\t<ion-buttons>\n\t\t\t<ion-button routerLink=\"{{ prevUrl }}\">\n\t\t\t\t<ion-icon slot=\"icon-only\" name=\"close\" />\n\t\t\t</ion-button>\n\t\t</ion-buttons>\n\
|
|
505
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ColumnHeaderContainerComponent, isStandalone: true, selector: "up-column-header-container", inputs: { header: "header", prevUrl: "prevUrl" }, host: { classAttribute: "d-flex flex-column h-100" }, ngImport: i0, template: "<div class=\"d-flex justify-content-between align-items-center border-bottom py-1 ps-1 pe-4 flex-shrink-0\">\n\t<div class=\"flex-grow-1 d-flex align-items-center pe-3\">\n\t\t<ion-buttons>\n\t\t\t<ion-button routerLink=\"{{ prevUrl }}\">\n\t\t\t\t<ion-icon slot=\"icon-only\" name=\"close\" />\n\t\t\t</ion-button>\n\t\t</ion-buttons>\n\n\t\t<div class=\"f20 fw-medium\">{{ header }}</div>\n\t</div>\n\n\t<ng-content select=\"[button]\" />\n</div>\n\n<div class=\"p-1 flex-grow-1 overflow-auto\">\n\t<ng-content/>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i1.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "directive", type: i1.RouterLinkDelegate, selector: ":not(a):not(area)[routerLink]" }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
506
506
|
}
|
|
507
507
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ColumnHeaderContainerComponent, decorators: [{
|
|
508
508
|
type: Component,
|
|
@@ -511,7 +511,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
511
511
|
}, imports: [
|
|
512
512
|
IonicModule,
|
|
513
513
|
RouterModule
|
|
514
|
-
], template: "<div class=\"d-flex justify-content-between align-items-center border-bottom py-1 ps-1 pe-4 flex-shrink-0\">\n\t<div class=\"flex-grow-1 d-flex align-items-center pe-3\">\n\t\t<ion-buttons>\n\t\t\t<ion-button routerLink=\"{{ prevUrl }}\">\n\t\t\t\t<ion-icon slot=\"icon-only\" name=\"close\" />\n\t\t\t</ion-button>\n\t\t</ion-buttons>\n\
|
|
514
|
+
], template: "<div class=\"d-flex justify-content-between align-items-center border-bottom py-1 ps-1 pe-4 flex-shrink-0\">\n\t<div class=\"flex-grow-1 d-flex align-items-center pe-3\">\n\t\t<ion-buttons>\n\t\t\t<ion-button routerLink=\"{{ prevUrl }}\">\n\t\t\t\t<ion-icon slot=\"icon-only\" name=\"close\" />\n\t\t\t</ion-button>\n\t\t</ion-buttons>\n\n\t\t<div class=\"f20 fw-medium\">{{ header }}</div>\n\t</div>\n\n\t<ng-content select=\"[button]\" />\n</div>\n\n<div class=\"p-1 flex-grow-1 overflow-auto\">\n\t<ng-content/>\n</div>\n" }]
|
|
515
515
|
}], propDecorators: { header: [{
|
|
516
516
|
type: Input
|
|
517
517
|
}], prevUrl: [{
|
|
@@ -1070,7 +1070,6 @@ class FormTextareaComponent {
|
|
|
1070
1070
|
this.required = false;
|
|
1071
1071
|
this.disabled = false;
|
|
1072
1072
|
this.isTouched = false;
|
|
1073
|
-
this.value = '';
|
|
1074
1073
|
this.onChange = (_val) => { };
|
|
1075
1074
|
this.onTouched = () => { };
|
|
1076
1075
|
}
|
|
@@ -1100,7 +1099,7 @@ class FormTextareaComponent {
|
|
|
1100
1099
|
}
|
|
1101
1100
|
}
|
|
1102
1101
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FormTextareaComponent, deps: [{ token: 'label', attribute: true }, { token: 'placeholder', attribute: true }, { token: 'autocomplete', attribute: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1103
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: FormTextareaComponent, isStandalone: true, selector: "up-textarea", inputs: { required: "required", disabled: "disabled" }, host: { classAttribute: "d-block" }, providers: [
|
|
1102
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: FormTextareaComponent, isStandalone: true, selector: "up-textarea", inputs: { value: "value", required: "required", disabled: "disabled" }, host: { classAttribute: "d-block" }, providers: [
|
|
1104
1103
|
{
|
|
1105
1104
|
multi: true,
|
|
1106
1105
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -1138,7 +1137,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
1138
1137
|
}] }, { type: undefined, decorators: [{
|
|
1139
1138
|
type: Attribute,
|
|
1140
1139
|
args: ['autocomplete']
|
|
1141
|
-
}] }, { type: i0.ChangeDetectorRef }], propDecorators: {
|
|
1140
|
+
}] }, { type: i0.ChangeDetectorRef }], propDecorators: { value: [{
|
|
1141
|
+
type: Input
|
|
1142
|
+
}], required: [{
|
|
1142
1143
|
type: Input
|
|
1143
1144
|
}], disabled: [{
|
|
1144
1145
|
type: Input
|
|
@@ -1194,7 +1195,7 @@ class FormImagePickerComponent {
|
|
|
1194
1195
|
this.onChanged = (_val) => { };
|
|
1195
1196
|
this.onTouched = () => { };
|
|
1196
1197
|
}
|
|
1197
|
-
registerOnChange(fn) { this.
|
|
1198
|
+
registerOnChange(fn) { this.onChanged = fn; }
|
|
1198
1199
|
registerOnTouched(fn) { this.onTouched = fn; }
|
|
1199
1200
|
clear(ev) {
|
|
1200
1201
|
this.writeValue('');
|
|
@@ -1982,7 +1983,7 @@ class AuditDetailComponent {
|
|
|
1982
1983
|
return regex.test(str);
|
|
1983
1984
|
}
|
|
1984
1985
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditDetailComponent, deps: [{ token: i1$3.FormBuilder }, { token: AuditService }, { token: i1$2.ActivatedRoute }, { token: i1.NavController }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1985
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: AuditDetailComponent, isStandalone: true, selector: "up-audit-detail", ngImport: i0, template: "<up-tab-group class=\"h-100\">\n <up-tab-content header=\"Detail\" fragment=\"detail\">\n <form [formGroup]=\"form\" class=\"px-4 pb-4\" *ngIf=\"!isLoading; else loading\">\n <div class=\"d-flex align-items-center gap-2 pb-3\">\n <ion-icon name=\"information-circle\" />\n <h5 class=\"m-0\">Information</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-lg-4\" label=\"Action\" formControlName=\"action\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Source IP\" formControlName=\"sourceIp\" />\n </div>\n </div>\n \n <up-input class=\"mb-4\" label=\"User Name\" formControlName=\"userName\" />\n <up-textarea class=\"mb-4\" label=\"Description\" formControlName=\"description\" />\n\n <div class=\"d-flex align-items-center gap-2 pb-3 pt-2\">\n <ion-icon name=\"laptop\" />\n <h5 class=\"m-0\">System Information</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Action Date\" formControlName=\"createdAt\" />\n <up-input class=\"mb-lg-4\" label=\"Source Platform\" formControlName=\"sourcePlatform\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"MS Source\" formControlName=\"msSource\" />\n <up-input class=\"mb-4\" label=\"Function\" formControlName=\"function\" />\n </div>\n </div>\n </form>\n\n <ng-template #loading>\n <ion-skeleton-text class=\"sk-input mx-4 mb-4\" *ngFor=\"let i of [0,1,2,3,4,5,6]\" />\n </ng-template> \n </up-tab-content>\n\n <up-tab-content header=\"Attributes\" fragment=\"attributes\">\n <up-pagination-grid id=\"grid-audit-detail\" rowModelType=\"clientSide\" [config]=\"gridConfig\" (onGridReady)=\"setGridApi($event)\" />\n </up-tab-content>\n</up-tab-group>\n", styles: ["ion-icon{font-size:24px;margin-right:5px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonSkeletonText, selector: "ion-skeleton-text", inputs: ["animated"] }, { kind: "component", type: GridPaginationComponent, selector: "up-pagination-grid", inputs: ["config", "rowData", "id", "rowModelType", "rowSelection"], outputs: ["onRowClick", "onGridReady", "onSelectionChanged"] }, { kind: "ngmodule", type: TabsComponentModule }, { kind: "component", type: TabGroupComponent, selector: "up-tab-group", outputs: ["onChange"] }, { kind: "component", type: TabContentComponent, selector: "up-tab-content", inputs: ["header"] }, { kind: "component", type: FormInputComponent, selector: "up-input", inputs: ["label", "value", "required", "disabled"], outputs: ["onInput"] }, { kind: "component", type: FormTextareaComponent, selector: "up-textarea", inputs: ["required", "disabled"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
|
|
1986
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: AuditDetailComponent, isStandalone: true, selector: "up-audit-detail", ngImport: i0, template: "<up-tab-group class=\"h-100\">\n <up-tab-content header=\"Detail\" fragment=\"detail\">\n <form [formGroup]=\"form\" class=\"px-4 pb-4\" *ngIf=\"!isLoading; else loading\">\n <div class=\"d-flex align-items-center gap-2 pb-3\">\n <ion-icon name=\"information-circle\" />\n <h5 class=\"m-0\">Information</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-lg-4\" label=\"Action\" formControlName=\"action\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Source IP\" formControlName=\"sourceIp\" />\n </div>\n </div>\n \n <up-input class=\"mb-4\" label=\"User Name\" formControlName=\"userName\" />\n <up-textarea class=\"mb-4\" label=\"Description\" formControlName=\"description\" />\n\n <div class=\"d-flex align-items-center gap-2 pb-3 pt-2\">\n <ion-icon name=\"laptop\" />\n <h5 class=\"m-0\">System Information</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Action Date\" formControlName=\"createdAt\" />\n <up-input class=\"mb-lg-4\" label=\"Source Platform\" formControlName=\"sourcePlatform\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"MS Source\" formControlName=\"msSource\" />\n <up-input class=\"mb-4\" label=\"Function\" formControlName=\"function\" />\n </div>\n </div>\n </form>\n\n <ng-template #loading>\n <ion-skeleton-text class=\"sk-input mx-4 mb-4\" *ngFor=\"let i of [0,1,2,3,4,5,6]\" />\n </ng-template> \n </up-tab-content>\n\n <up-tab-content header=\"Attributes\" fragment=\"attributes\">\n <up-pagination-grid id=\"grid-audit-detail\" rowModelType=\"clientSide\" [config]=\"gridConfig\" (onGridReady)=\"setGridApi($event)\" />\n </up-tab-content>\n</up-tab-group>\n", styles: ["ion-icon{font-size:24px;margin-right:5px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonSkeletonText, selector: "ion-skeleton-text", inputs: ["animated"] }, { kind: "component", type: GridPaginationComponent, selector: "up-pagination-grid", inputs: ["config", "rowData", "id", "rowModelType", "rowSelection"], outputs: ["onRowClick", "onGridReady", "onSelectionChanged"] }, { kind: "ngmodule", type: TabsComponentModule }, { kind: "component", type: TabGroupComponent, selector: "up-tab-group", outputs: ["onChange"] }, { kind: "component", type: TabContentComponent, selector: "up-tab-content", inputs: ["header"] }, { kind: "component", type: FormInputComponent, selector: "up-input", inputs: ["label", "value", "required", "disabled"], outputs: ["onInput"] }, { kind: "component", type: FormTextareaComponent, selector: "up-textarea", inputs: ["value", "required", "disabled"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
|
|
1986
1987
|
}
|
|
1987
1988
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: AuditDetailComponent, decorators: [{
|
|
1988
1989
|
type: Component,
|
|
@@ -1997,292 +1998,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
1997
1998
|
], template: "<up-tab-group class=\"h-100\">\n <up-tab-content header=\"Detail\" fragment=\"detail\">\n <form [formGroup]=\"form\" class=\"px-4 pb-4\" *ngIf=\"!isLoading; else loading\">\n <div class=\"d-flex align-items-center gap-2 pb-3\">\n <ion-icon name=\"information-circle\" />\n <h5 class=\"m-0\">Information</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-lg-4\" label=\"Action\" formControlName=\"action\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Source IP\" formControlName=\"sourceIp\" />\n </div>\n </div>\n \n <up-input class=\"mb-4\" label=\"User Name\" formControlName=\"userName\" />\n <up-textarea class=\"mb-4\" label=\"Description\" formControlName=\"description\" />\n\n <div class=\"d-flex align-items-center gap-2 pb-3 pt-2\">\n <ion-icon name=\"laptop\" />\n <h5 class=\"m-0\">System Information</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Action Date\" formControlName=\"createdAt\" />\n <up-input class=\"mb-lg-4\" label=\"Source Platform\" formControlName=\"sourcePlatform\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"MS Source\" formControlName=\"msSource\" />\n <up-input class=\"mb-4\" label=\"Function\" formControlName=\"function\" />\n </div>\n </div>\n </form>\n\n <ng-template #loading>\n <ion-skeleton-text class=\"sk-input mx-4 mb-4\" *ngFor=\"let i of [0,1,2,3,4,5,6]\" />\n </ng-template> \n </up-tab-content>\n\n <up-tab-content header=\"Attributes\" fragment=\"attributes\">\n <up-pagination-grid id=\"grid-audit-detail\" rowModelType=\"clientSide\" [config]=\"gridConfig\" (onGridReady)=\"setGridApi($event)\" />\n </up-tab-content>\n</up-tab-group>\n", styles: ["ion-icon{font-size:24px;margin-right:5px}\n"] }]
|
|
1998
1999
|
}], ctorParameters: () => [{ type: i1$3.FormBuilder }, { type: AuditService }, { type: i1$2.ActivatedRoute }, { type: i1.NavController }] });
|
|
1999
2000
|
|
|
2000
|
-
class ApprovalService {
|
|
2001
|
-
constructor(apollo) {
|
|
2002
|
-
this.apollo = apollo;
|
|
2003
|
-
this.baseAttr = `guid createdAt entity remark sourcePlatform status type`;
|
|
2004
|
-
}
|
|
2005
|
-
query(input, extraAttr = '', fetchPolicy) {
|
|
2006
|
-
return this.apollo.query({
|
|
2007
|
-
fetchPolicy,
|
|
2008
|
-
variables: { input },
|
|
2009
|
-
query: gql `
|
|
2010
|
-
query QueryApproval($input: ApprovalCriteria) {
|
|
2011
|
-
approvalMsApprovals(input: $input) {
|
|
2012
|
-
data {
|
|
2013
|
-
${this.baseAttr}
|
|
2014
|
-
${extraAttr}
|
|
2015
|
-
}
|
|
2016
|
-
${input.page === 0 ? 'totalRecord' : ''}
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
`
|
|
2020
|
-
});
|
|
2021
|
-
}
|
|
2022
|
-
request(variables) {
|
|
2023
|
-
return this.apollo.mutate({
|
|
2024
|
-
variables,
|
|
2025
|
-
mutation: gql `
|
|
2026
|
-
mutation ${variables.isApprove ? 'ApproveApproval' : 'DeclineApproval'}($approvalGroupGuid: String, $guid: String, $isApprove: Boolean, $reason: String) {
|
|
2027
|
-
approvalMsApproveOrDeclineRequest(approvalGroupGuid: $approvalGroupGuid, guid: $guid, isApprove: $isApprove, reason: $reason)
|
|
2028
|
-
}
|
|
2029
|
-
`
|
|
2030
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalService, deps: [{ token: i1$1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2033
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalService, providedIn: 'root' }); }
|
|
2034
|
-
}
|
|
2035
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalService, decorators: [{
|
|
2036
|
-
type: Injectable,
|
|
2037
|
-
args: [{
|
|
2038
|
-
providedIn: 'root'
|
|
2039
|
-
}]
|
|
2040
|
-
}], ctorParameters: () => [{ type: i1$1.Apollo }] });
|
|
2041
|
-
|
|
2042
|
-
class ApprovalListComponent {
|
|
2043
|
-
constructor(entities, router, route, service, alertCtrl) {
|
|
2044
|
-
this.entities = entities;
|
|
2045
|
-
this.router = router;
|
|
2046
|
-
this.route = route;
|
|
2047
|
-
this.service = service;
|
|
2048
|
-
this.alertCtrl = alertCtrl;
|
|
2049
|
-
this.gridConfig = {
|
|
2050
|
-
noRowText: 'Approval not found',
|
|
2051
|
-
colDefs: [
|
|
2052
|
-
{ headerName: 'Entity', field: 'entity', checkboxSelection: true },
|
|
2053
|
-
{ headerName: 'Remark', field: 'remark' },
|
|
2054
|
-
{ headerName: 'Source Platform', field: 'sourcePlatform' },
|
|
2055
|
-
{ headerName: 'Status', field: 'status', maxWidth: 100 },
|
|
2056
|
-
{ headerName: 'Type', field: 'type', maxWidth: 100 },
|
|
2057
|
-
{ headerName: 'Created Date', field: 'createdAt', sort: 'desc', valueFormatter: ({ value }) => value ? formatDate(value, 'dd MMM yyyy HH:mm', 'en-US') : '' }
|
|
2058
|
-
],
|
|
2059
|
-
getData: (page, pageSize, sortBy, dir) => {
|
|
2060
|
-
const policy = this.input.page === page ? 'no-cache' : undefined;
|
|
2061
|
-
this.input.page = page;
|
|
2062
|
-
this.input.sortBy = sortBy;
|
|
2063
|
-
this.input.pageSize = pageSize;
|
|
2064
|
-
this.input.sortDirection = dir;
|
|
2065
|
-
return this.service.query(this.input, '', policy).pipe(map(({ data: { approvalMsApprovals: { data, totalRecord: t } } }) => ({ data, totalRecord: t })));
|
|
2066
|
-
}
|
|
2067
|
-
};
|
|
2068
|
-
this.filterConfig = {
|
|
2069
|
-
mode: 'advanced',
|
|
2070
|
-
fields: [
|
|
2071
|
-
{ key: 'type', label: 'Type', type: 'select', options: [
|
|
2072
|
-
{ label: 'Creation', value: ['CREATION'] },
|
|
2073
|
-
{ label: 'Deletion', value: ['DELETION'] },
|
|
2074
|
-
{ label: 'Linkage', value: ['LINKAGE'] },
|
|
2075
|
-
{ label: 'Unlink', value: ['UNLINK'] },
|
|
2076
|
-
{ label: 'Update', value: ['UPDATE'] }
|
|
2077
|
-
] }
|
|
2078
|
-
]
|
|
2079
|
-
};
|
|
2080
|
-
this.btnConfig = [
|
|
2081
|
-
{ label: 'Approve', icon: 'checkmark', description: 'Approve the approvals', disabled: true, onClick: this.multipleApproval.bind(this) },
|
|
2082
|
-
{ label: 'Decline', icon: 'close', description: 'Decline the approvals', color: 'danger', disabled: true, onClick: this.multipleApproval.bind(this) }
|
|
2083
|
-
];
|
|
2084
|
-
this.input = { page: 0, pageSize: 50, entity: this.entities };
|
|
2085
|
-
}
|
|
2086
|
-
setGridApi({ api }) { this.gridApi = api; }
|
|
2087
|
-
openDetail(data) {
|
|
2088
|
-
this.router.navigate([`/approval/${data.guid}`], { preserveFragment: true });
|
|
2089
|
-
}
|
|
2090
|
-
selectApprovals() {
|
|
2091
|
-
this.btnConfig[0].disabled = this.btnConfig[1].disabled = this.gridApi.getSelectedRows().length <= 1;
|
|
2092
|
-
}
|
|
2093
|
-
search({ data }) {
|
|
2094
|
-
this.input.type = data?.type;
|
|
2095
|
-
this.gridApi.refreshInfiniteCache();
|
|
2096
|
-
}
|
|
2097
|
-
multipleApproval(btn) {
|
|
2098
|
-
btn.toggleLoading();
|
|
2099
|
-
this.router.navigate([`/approval/approval-group`], {
|
|
2100
|
-
preserveFragment: true,
|
|
2101
|
-
queryParams: {
|
|
2102
|
-
isApprove: btn.color !== 'danger',
|
|
2103
|
-
guids: this.gridApi.getSelectedRows().map(({ guid }) => guid),
|
|
2104
|
-
}
|
|
2105
|
-
});
|
|
2106
|
-
}
|
|
2107
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalListComponent, deps: [{ token: 'ENTITIES' }, { token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: ApprovalService }, { token: i1.AlertController }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2108
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ApprovalListComponent, isStandalone: true, selector: "up-approval-list", host: { classAttribute: "d-flex flex-column h-100 w-100" }, ngImport: i0, template: "<div class=\"d-flex align-items-center justify-content-between gap-4 p-4 flex-shrink-0 flex-wrap\">\n <div class=\"flex-grow-1 d-flex align-items-center gap-3\">\n <h3 class=\"m-0\">Approval</h3>\n\n <up-btn-group id=\"approval-list\" [config]=\"btnConfig\" />\n </div>\n\n <div class=\"flex-shrink-0 flex-grow-1\">\n <up-filter placeholder=\"Type to search\" id=\"filter-approval-list\" [config]=\"filterConfig\" (onSearch)=\"search($event)\" />\n </div>\n</div>\n\n<div class=\"flex-grow-1 px-1 pb-1\">\n <up-pagination-grid [config]=\"gridConfig\" id=\"grid-approval-list\" rowSelection=\"multiple\" (onGridReady)=\"setGridApi($event)\" (onRowClick)=\"openDetail($event)\" (onSelectionChanged)=\"selectApprovals()\" />\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: FilterComponent, selector: "up-filter", inputs: ["id", "config"], outputs: ["onSearch"] }, { kind: "component", type: ButtonGroupComponent, selector: "up-btn-group", inputs: ["config"] }, { kind: "component", type: GridPaginationComponent, selector: "up-pagination-grid", inputs: ["config", "rowData", "id", "rowModelType", "rowSelection"], outputs: ["onRowClick", "onGridReady", "onSelectionChanged"] }] }); }
|
|
2109
|
-
}
|
|
2110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalListComponent, decorators: [{
|
|
2111
|
-
type: Component,
|
|
2112
|
-
args: [{ standalone: true, selector: 'up-approval-list', host: {
|
|
2113
|
-
class: 'd-flex flex-column h-100 w-100'
|
|
2114
|
-
}, imports: [
|
|
2115
|
-
FilterComponent,
|
|
2116
|
-
ButtonGroupComponent,
|
|
2117
|
-
GridPaginationComponent
|
|
2118
|
-
], template: "<div class=\"d-flex align-items-center justify-content-between gap-4 p-4 flex-shrink-0 flex-wrap\">\n <div class=\"flex-grow-1 d-flex align-items-center gap-3\">\n <h3 class=\"m-0\">Approval</h3>\n\n <up-btn-group id=\"approval-list\" [config]=\"btnConfig\" />\n </div>\n\n <div class=\"flex-shrink-0 flex-grow-1\">\n <up-filter placeholder=\"Type to search\" id=\"filter-approval-list\" [config]=\"filterConfig\" (onSearch)=\"search($event)\" />\n </div>\n</div>\n\n<div class=\"flex-grow-1 px-1 pb-1\">\n <up-pagination-grid [config]=\"gridConfig\" id=\"grid-approval-list\" rowSelection=\"multiple\" (onGridReady)=\"setGridApi($event)\" (onRowClick)=\"openDetail($event)\" (onSelectionChanged)=\"selectApprovals()\" />\n</div>\n" }]
|
|
2119
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
2120
|
-
type: Inject,
|
|
2121
|
-
args: ['ENTITIES']
|
|
2122
|
-
}] }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: ApprovalService }, { type: i1.AlertController }] });
|
|
2123
|
-
|
|
2124
|
-
class ApprovalFormComponent {
|
|
2125
|
-
constructor(router, ch, service, gridService, alertCtrl, permService) {
|
|
2126
|
-
this.router = router;
|
|
2127
|
-
this.ch = ch;
|
|
2128
|
-
this.service = service;
|
|
2129
|
-
this.gridService = gridService;
|
|
2130
|
-
this.alertCtrl = alertCtrl;
|
|
2131
|
-
this.permService = permService;
|
|
2132
|
-
this.isLoading = true;
|
|
2133
|
-
this.btnConfig = [];
|
|
2134
|
-
this.data = [];
|
|
2135
|
-
}
|
|
2136
|
-
ngOnDestroy() { this.sub?.unsubscribe(); }
|
|
2137
|
-
setGuid(guids, isApprove) {
|
|
2138
|
-
if (guids.length === 1)
|
|
2139
|
-
this.guid = guids[0];
|
|
2140
|
-
this.btnConfig.length = 0;
|
|
2141
|
-
this.setLoading(true);
|
|
2142
|
-
this.sub = this.service.query({ guids }, 'permission').subscribe({
|
|
2143
|
-
next: ({ data: { approvalMsApprovals: { data } } }) => {
|
|
2144
|
-
if (!data || data.length === 0) {
|
|
2145
|
-
this.router.navigateByUrl('approval');
|
|
2146
|
-
return;
|
|
2147
|
-
}
|
|
2148
|
-
this.data = data;
|
|
2149
|
-
if (data.length > 1) {
|
|
2150
|
-
let dataCount = 0;
|
|
2151
|
-
data.map(({ permission }) => {
|
|
2152
|
-
const perm = permission.split('.');
|
|
2153
|
-
if (this.permService.checkPermission(perm[0], perm[1], perm[2]))
|
|
2154
|
-
dataCount++;
|
|
2155
|
-
if (dataCount === data.length)
|
|
2156
|
-
isApprove ? this.btnConfig.push({ label: 'Approve', icon: 'checkmark', description: 'Approve the approval', disabled: false, onClick: this.request.bind(this) }) : this.btnConfig.push({ label: 'Decline', icon: 'close', description: 'Decline the approval', color: 'danger', disabled: false, onClick: this.request.bind(this) });
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
else {
|
|
2160
|
-
const perm = data[0].permission.split('.');
|
|
2161
|
-
if (this.permService.checkPermission(perm[0], perm[1], perm[2])) {
|
|
2162
|
-
this.btnConfig.push({ label: 'Approve', icon: 'checkmark', description: 'Approve the approval', disabled: false, onClick: this.request.bind(this) }, { label: 'Decline', icon: 'close', description: 'Decline the approval', color: 'danger', disabled: false, onClick: this.request.bind(this) });
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
this.setLoading(false);
|
|
2166
|
-
},
|
|
2167
|
-
error: ({ message }) => {
|
|
2168
|
-
this.showAlert('Error', message);
|
|
2169
|
-
this.router.navigateByUrl('approval');
|
|
2170
|
-
}
|
|
2171
|
-
});
|
|
2172
|
-
}
|
|
2173
|
-
request(btn) {
|
|
2174
|
-
const isApprove = btn.color !== 'danger';
|
|
2175
|
-
this.showAlert('Confirm', `Are you sure want to ${isApprove ? 'approve the approval?' : 'decline the approval? Please input the reason if you want to decline.'}`, [
|
|
2176
|
-
{ text: 'Cancel', handler: () => btn.toggleLoading() },
|
|
2177
|
-
{
|
|
2178
|
-
text: `${isApprove ? 'Approve' : 'Decline'}`,
|
|
2179
|
-
handler: ({ reason }) => {
|
|
2180
|
-
this.sub?.unsubscribe();
|
|
2181
|
-
const variables = {
|
|
2182
|
-
...(this.guid ? { guid: this.guid } : { approvalGroupGuid: '' }),
|
|
2183
|
-
isApprove,
|
|
2184
|
-
reason
|
|
2185
|
-
};
|
|
2186
|
-
this.sub = this.service.request(variables).subscribe({
|
|
2187
|
-
next: () => {
|
|
2188
|
-
this.showAlert('Success', `Approval ${isApprove ? 'approved' : 'declined'}`);
|
|
2189
|
-
this.router.navigateByUrl('approval');
|
|
2190
|
-
this.gridService.refreshGridCache('grid-approval-list');
|
|
2191
|
-
},
|
|
2192
|
-
error: ({ message }) => {
|
|
2193
|
-
btn.toggleLoading();
|
|
2194
|
-
this.showAlert('Error', message);
|
|
2195
|
-
}
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
], [{ name: 'reason', type: 'textarea', placeholder: 'Reason' }]);
|
|
2200
|
-
}
|
|
2201
|
-
setLoading(b) {
|
|
2202
|
-
this.isLoading = b;
|
|
2203
|
-
this.ch.markForCheck();
|
|
2204
|
-
}
|
|
2205
|
-
async showAlert(header, message, buttons = ['OK'], inputs = []) { (await this.alertCtrl.create({ header, message, buttons, inputs })).present(); }
|
|
2206
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalFormComponent, deps: [{ token: i1$2.Router }, { token: i0.ChangeDetectorRef }, { token: ApprovalService }, { token: GridService }, { token: i1.AlertController }, { token: PermissionService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2207
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ApprovalFormComponent, isStandalone: true, selector: "up-approval-form", inputs: { isLoading: "isLoading" }, host: { classAttribute: "px-4 d-block" }, ngImport: i0, template: "<ng-container *ngIf=\"!isLoading; else loading\">\n <div *ngFor=\"let d of data, let i = index\">\n <div class=\"d-flex align-items-center gap-2 pb-3 pt-2\" *ngIf=\"data.length > 1\">\n <ion-icon name=\"document\" />\n <h5 class=\"m-0\">Approval {{ i + 1 }}</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Entity\" [disabled]=\"true\" [value]=\"d.entity\" />\n <up-input class=\"mb-4\" label=\"Remark\" [disabled]=\"true\" [value]=\"d.remark\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Created At\" [disabled]=\"true\" [value]=\"d.createdAt | date:'dd MMM yyyy HH:mm'\" />\n <up-input class=\"mb-4\" label=\"Status\" [disabled]=\"true\" [value]=\"d.status\" />\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n </div>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonSkeletonText, selector: "ion-skeleton-text", inputs: ["animated"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }, { kind: "component", type: FormInputComponent, selector: "up-input", inputs: ["label", "value", "required", "disabled"], outputs: ["onInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2208
|
-
}
|
|
2209
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalFormComponent, decorators: [{
|
|
2210
|
-
type: Component,
|
|
2211
|
-
args: [{ standalone: true, selector: 'up-approval-form', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2212
|
-
class: 'px-4 d-block'
|
|
2213
|
-
}, imports: [
|
|
2214
|
-
IonicModule,
|
|
2215
|
-
CommonModule,
|
|
2216
|
-
FormInputComponent
|
|
2217
|
-
], template: "<ng-container *ngIf=\"!isLoading; else loading\">\n <div *ngFor=\"let d of data, let i = index\">\n <div class=\"d-flex align-items-center gap-2 pb-3 pt-2\" *ngIf=\"data.length > 1\">\n <ion-icon name=\"document\" />\n <h5 class=\"m-0\">Approval {{ i + 1 }}</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Entity\" [disabled]=\"true\" [value]=\"d.entity\" />\n <up-input class=\"mb-4\" label=\"Remark\" [disabled]=\"true\" [value]=\"d.remark\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Created At\" [disabled]=\"true\" [value]=\"d.createdAt | date:'dd MMM yyyy HH:mm'\" />\n <up-input class=\"mb-4\" label=\"Status\" [disabled]=\"true\" [value]=\"d.status\" />\n </div>\n </div>\n </div>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n </div>\n</ng-template>\n" }]
|
|
2218
|
-
}], ctorParameters: () => [{ type: i1$2.Router }, { type: i0.ChangeDetectorRef }, { type: ApprovalService }, { type: GridService }, { type: i1.AlertController }, { type: PermissionService }], propDecorators: { isLoading: [{
|
|
2219
|
-
type: Input
|
|
2220
|
-
}] } });
|
|
2221
|
-
|
|
2222
|
-
class ApprovalDetailComponent {
|
|
2223
|
-
constructor(router, activatedRoute) {
|
|
2224
|
-
this.router = router;
|
|
2225
|
-
this.activatedRoute = activatedRoute;
|
|
2226
|
-
this.btnConfig = [];
|
|
2227
|
-
this.guid = '';
|
|
2228
|
-
}
|
|
2229
|
-
ngOnInit() {
|
|
2230
|
-
this.sub = this.activatedRoute.queryParams.subscribe((params) => {
|
|
2231
|
-
if (params) {
|
|
2232
|
-
this.guids = params['guids'];
|
|
2233
|
-
this.isApprove = params['isApprove'] === 'true';
|
|
2234
|
-
}
|
|
2235
|
-
});
|
|
2236
|
-
}
|
|
2237
|
-
ngAfterViewInit() {
|
|
2238
|
-
if (this.guids) {
|
|
2239
|
-
this.setChildGuid('');
|
|
2240
|
-
this.changeTab(this.activatedRoute.snapshot.fragment);
|
|
2241
|
-
}
|
|
2242
|
-
else {
|
|
2243
|
-
this.setChildGuid(this.activatedRoute.children[0].snapshot.params['guid']);
|
|
2244
|
-
this.changeTab(this.activatedRoute.snapshot.fragment);
|
|
2245
|
-
this.sub = this.router.events.pipe(filter((e) => e instanceof NavigationEnd)).subscribe({
|
|
2246
|
-
next: () => {
|
|
2247
|
-
const newGuid = this.activatedRoute.children[0].snapshot.params['guid'];
|
|
2248
|
-
if (this.guid !== newGuid) {
|
|
2249
|
-
this.guid = newGuid;
|
|
2250
|
-
this.setChildGuid(this.guid);
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
ngOnDestroy() { this.sub.unsubscribe(); }
|
|
2257
|
-
changeTab(f) {
|
|
2258
|
-
switch (f) {
|
|
2259
|
-
default:
|
|
2260
|
-
this.btnConfig = this.formComponent?.btnConfig ?? [];
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
setChildGuid(guid) {
|
|
2264
|
-
this.formComponent?.setGuid(this.guids ?? [guid], this.isApprove);
|
|
2265
|
-
}
|
|
2266
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalDetailComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2267
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ApprovalDetailComponent, isStandalone: true, selector: "up-approval-detail", host: { classAttribute: "d-block h-100" }, viewQueries: [{ propertyName: "formComponent", first: true, predicate: ApprovalFormComponent, descendants: true }], ngImport: i0, template: "<up-column-header-container header=\"Approval Detail\" prevUrl=\"/approval\" class=\"bg-white\">\n <up-btn-group id=\"button\" *ngIf=\"!formComponent?.isLoading; else loading\" [config]=\"btnConfig\" />\n\n <ng-template #loading>\n <ion-skeleton-text id=\"button\" class=\"m-0 sk-btn\" />\n </ng-template>\n\n <up-tab-group class=\"h-100\" (onChange)=\"changeTab($event)\">\n <up-tab-content header=\"Detail\" fragment=\"detail\">\n <up-approval-form />\n </up-tab-content>\n </up-tab-group>\n</up-column-header-container>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonSkeletonText, selector: "ion-skeleton-text", inputs: ["animated"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TabsComponentModule }, { kind: "component", type: TabGroupComponent, selector: "up-tab-group", outputs: ["onChange"] }, { kind: "component", type: TabContentComponent, selector: "up-tab-content", inputs: ["header"] }, { kind: "component", type: ButtonGroupComponent, selector: "up-btn-group", inputs: ["config"] }, { kind: "component", type: ColumnHeaderContainerComponent, selector: "up-column-header-container", inputs: ["header", "prevUrl"] }, { kind: "component", type: ApprovalFormComponent, selector: "up-approval-form", inputs: ["isLoading"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2268
|
-
}
|
|
2269
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalDetailComponent, decorators: [{
|
|
2270
|
-
type: Component,
|
|
2271
|
-
args: [{ standalone: true, selector: 'up-approval-detail', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2272
|
-
class: 'd-block h-100'
|
|
2273
|
-
}, imports: [
|
|
2274
|
-
IonicModule,
|
|
2275
|
-
CommonModule,
|
|
2276
|
-
TabsComponentModule,
|
|
2277
|
-
ButtonGroupComponent,
|
|
2278
|
-
ColumnHeaderContainerComponent,
|
|
2279
|
-
ApprovalFormComponent
|
|
2280
|
-
], template: "<up-column-header-container header=\"Approval Detail\" prevUrl=\"/approval\" class=\"bg-white\">\n <up-btn-group id=\"button\" *ngIf=\"!formComponent?.isLoading; else loading\" [config]=\"btnConfig\" />\n\n <ng-template #loading>\n <ion-skeleton-text id=\"button\" class=\"m-0 sk-btn\" />\n </ng-template>\n\n <up-tab-group class=\"h-100\" (onChange)=\"changeTab($event)\">\n <up-tab-content header=\"Detail\" fragment=\"detail\">\n <up-approval-form />\n </up-tab-content>\n </up-tab-group>\n</up-column-header-container>\n" }]
|
|
2281
|
-
}], ctorParameters: () => [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }], propDecorators: { formComponent: [{
|
|
2282
|
-
type: ViewChild,
|
|
2283
|
-
args: [ApprovalFormComponent]
|
|
2284
|
-
}] } });
|
|
2285
|
-
|
|
2286
2001
|
var AlertTypeEnum;
|
|
2287
2002
|
(function (AlertTypeEnum) {
|
|
2288
2003
|
AlertTypeEnum["PasswordReset"] = "PASSWORD_RESET";
|
|
@@ -2544,6 +2259,301 @@ var VoucherGroupType;
|
|
|
2544
2259
|
VoucherGroupType["Import"] = "IMPORT";
|
|
2545
2260
|
})(VoucherGroupType || (VoucherGroupType = {}));
|
|
2546
2261
|
|
|
2262
|
+
class ApprovalService {
|
|
2263
|
+
constructor(apollo) {
|
|
2264
|
+
this.apollo = apollo;
|
|
2265
|
+
this.baseAttr = `guid createdAt entity remark sourcePlatform status type`;
|
|
2266
|
+
}
|
|
2267
|
+
query(input, extraAttr = '', fetchPolicy) {
|
|
2268
|
+
return this.apollo.query({
|
|
2269
|
+
fetchPolicy,
|
|
2270
|
+
variables: { input },
|
|
2271
|
+
query: gql `
|
|
2272
|
+
query QueryApproval($input: ApprovalCriteria) {
|
|
2273
|
+
approvalMsApprovals(input: $input) {
|
|
2274
|
+
data {
|
|
2275
|
+
${this.baseAttr}
|
|
2276
|
+
${extraAttr}
|
|
2277
|
+
}
|
|
2278
|
+
${input.page === 0 ? 'totalRecord' : ''}
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
`
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
request(variables) {
|
|
2285
|
+
return this.apollo.mutate({
|
|
2286
|
+
variables,
|
|
2287
|
+
mutation: gql `
|
|
2288
|
+
mutation ${variables.isApprove ? 'ApproveApproval' : 'DeclineApproval'}($approvalGroupGuid: String, $guid: String, $isApprove: Boolean, $reason: String) {
|
|
2289
|
+
approvalMsApproveOrDeclineRequest(approvalGroupGuid: $approvalGroupGuid, guid: $guid, isApprove: $isApprove, reason: $reason)
|
|
2290
|
+
}
|
|
2291
|
+
`
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalService, deps: [{ token: i1$1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2295
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalService, providedIn: 'root' }); }
|
|
2296
|
+
}
|
|
2297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalService, decorators: [{
|
|
2298
|
+
type: Injectable,
|
|
2299
|
+
args: [{
|
|
2300
|
+
providedIn: 'root'
|
|
2301
|
+
}]
|
|
2302
|
+
}], ctorParameters: () => [{ type: i1$1.Apollo }] });
|
|
2303
|
+
|
|
2304
|
+
class ApprovalListComponent {
|
|
2305
|
+
constructor(entities, router, route, service, alertCtrl) {
|
|
2306
|
+
this.entities = entities;
|
|
2307
|
+
this.router = router;
|
|
2308
|
+
this.route = route;
|
|
2309
|
+
this.service = service;
|
|
2310
|
+
this.alertCtrl = alertCtrl;
|
|
2311
|
+
this.gridConfig = {
|
|
2312
|
+
noRowText: 'Approval not found',
|
|
2313
|
+
colDefs: [
|
|
2314
|
+
{ headerName: 'Entity', field: 'entity', checkboxSelection: true },
|
|
2315
|
+
{ headerName: 'Remark', field: 'remark' },
|
|
2316
|
+
{ headerName: 'Source Platform', field: 'sourcePlatform' },
|
|
2317
|
+
{ headerName: 'Status', field: 'status', maxWidth: 100, cellRenderer: ({ value }) => value ? `<div class="badge m-auto bg-${value === ApprovalStatusEnum.Pending ? 'warning' : value === ApprovalStatusEnum.Approved ? 'success' : 'danger'}">${value}</div>` : '' },
|
|
2318
|
+
{ headerName: 'Type', field: 'type', maxWidth: 100 },
|
|
2319
|
+
{ headerName: 'Created Date', field: 'createdAt', sort: 'desc', valueFormatter: ({ value }) => value ? formatDate(value, 'dd MMM yyyy HH:mm', 'en-US') : '' }
|
|
2320
|
+
],
|
|
2321
|
+
getData: (page, pageSize, sortBy, dir) => {
|
|
2322
|
+
const policy = this.input.page === page ? 'no-cache' : undefined;
|
|
2323
|
+
this.input.page = page;
|
|
2324
|
+
this.input.sortBy = sortBy;
|
|
2325
|
+
this.input.pageSize = pageSize;
|
|
2326
|
+
this.input.sortDirection = dir;
|
|
2327
|
+
return this.service.query(this.input, '', policy).pipe(map(({ data: { approvalMsApprovals: { data, totalRecord: t } } }) => ({ data, totalRecord: t })));
|
|
2328
|
+
}
|
|
2329
|
+
};
|
|
2330
|
+
this.filterConfig = {
|
|
2331
|
+
mode: 'advanced',
|
|
2332
|
+
fields: [
|
|
2333
|
+
{ key: 'status', label: 'Status', type: 'select', options: [
|
|
2334
|
+
{ label: 'Approved', value: ['APPROVED'] },
|
|
2335
|
+
{ label: 'Declined', value: ['DECLINED'] },
|
|
2336
|
+
{ label: 'Pending', value: ['PENDING'] }
|
|
2337
|
+
] },
|
|
2338
|
+
{ key: 'type', label: 'Type', type: 'select', options: [
|
|
2339
|
+
{ label: 'Creation', value: ['CREATION'] },
|
|
2340
|
+
{ label: 'Deletion', value: ['DELETION'] },
|
|
2341
|
+
{ label: 'Linkage', value: ['LINKAGE'] },
|
|
2342
|
+
{ label: 'Unlink', value: ['UNLINK'] },
|
|
2343
|
+
{ label: 'Update', value: ['UPDATE'] }
|
|
2344
|
+
] }
|
|
2345
|
+
]
|
|
2346
|
+
};
|
|
2347
|
+
this.btnConfig = [
|
|
2348
|
+
{ label: 'Approve', icon: 'checkmark', description: 'Approve the approvals', disabled: true, onClick: this.multipleApproval.bind(this) },
|
|
2349
|
+
{ label: 'Decline', icon: 'close', description: 'Decline the approvals', color: 'danger', disabled: true, onClick: this.multipleApproval.bind(this) }
|
|
2350
|
+
];
|
|
2351
|
+
this.input = { page: 0, pageSize: 50, entity: this.entities };
|
|
2352
|
+
}
|
|
2353
|
+
setGridApi({ api }) { this.gridApi = api; }
|
|
2354
|
+
openDetail({ guid }) { this.router.navigate([`/approval/${guid}`], { preserveFragment: true }); }
|
|
2355
|
+
selectApprovals() { this.btnConfig[0].disabled = this.btnConfig[1].disabled = this.gridApi.getSelectedRows().length <= 1; }
|
|
2356
|
+
search({ data }) {
|
|
2357
|
+
this.input.type = data?.type;
|
|
2358
|
+
this.input.status = data?.status;
|
|
2359
|
+
this.gridApi.getSelectedNodes().forEach((e) => e.setSelected(false));
|
|
2360
|
+
this.gridApi.refreshInfiniteCache();
|
|
2361
|
+
}
|
|
2362
|
+
multipleApproval(btn) {
|
|
2363
|
+
btn.toggleLoading();
|
|
2364
|
+
this.router.navigate([`/approval/approval-group`], {
|
|
2365
|
+
preserveFragment: true,
|
|
2366
|
+
queryParams: {
|
|
2367
|
+
isApprove: btn.color !== 'danger',
|
|
2368
|
+
guids: this.gridApi.getSelectedRows().map(({ guid }) => guid),
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
2372
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalListComponent, deps: [{ token: 'ENTITIES' }, { token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: ApprovalService }, { token: i1.AlertController }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2373
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ApprovalListComponent, isStandalone: true, selector: "up-approval-list", host: { classAttribute: "d-flex flex-column h-100 w-100" }, ngImport: i0, template: "<div class=\"d-flex align-items-center justify-content-between gap-4 p-4 flex-shrink-0 flex-wrap\">\n <div class=\"flex-grow-1 d-flex align-items-center gap-3\">\n <h3 class=\"m-0\">Approval</h3>\n\n <up-btn-group id=\"approval-list\" [config]=\"btnConfig\" />\n </div>\n\n <div class=\"flex-shrink-0 flex-grow-1\">\n <up-filter placeholder=\"Type to search\" id=\"filter-approval-list\" [config]=\"filterConfig\" (onSearch)=\"search($event)\" />\n </div>\n</div>\n\n<div class=\"flex-grow-1 px-1 pb-1\">\n <up-pagination-grid [config]=\"gridConfig\" id=\"grid-approval-list\" rowSelection=\"multiple\" (onGridReady)=\"setGridApi($event)\" (onRowClick)=\"openDetail($event)\" (onSelectionChanged)=\"selectApprovals()\" />\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: FilterComponent, selector: "up-filter", inputs: ["id", "config"], outputs: ["onSearch"] }, { kind: "component", type: ButtonGroupComponent, selector: "up-btn-group", inputs: ["config"] }, { kind: "component", type: GridPaginationComponent, selector: "up-pagination-grid", inputs: ["config", "rowData", "id", "rowModelType", "rowSelection"], outputs: ["onRowClick", "onGridReady", "onSelectionChanged"] }] }); }
|
|
2374
|
+
}
|
|
2375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalListComponent, decorators: [{
|
|
2376
|
+
type: Component,
|
|
2377
|
+
args: [{ standalone: true, selector: 'up-approval-list', host: {
|
|
2378
|
+
class: 'd-flex flex-column h-100 w-100'
|
|
2379
|
+
}, imports: [
|
|
2380
|
+
FilterComponent,
|
|
2381
|
+
ButtonGroupComponent,
|
|
2382
|
+
GridPaginationComponent
|
|
2383
|
+
], template: "<div class=\"d-flex align-items-center justify-content-between gap-4 p-4 flex-shrink-0 flex-wrap\">\n <div class=\"flex-grow-1 d-flex align-items-center gap-3\">\n <h3 class=\"m-0\">Approval</h3>\n\n <up-btn-group id=\"approval-list\" [config]=\"btnConfig\" />\n </div>\n\n <div class=\"flex-shrink-0 flex-grow-1\">\n <up-filter placeholder=\"Type to search\" id=\"filter-approval-list\" [config]=\"filterConfig\" (onSearch)=\"search($event)\" />\n </div>\n</div>\n\n<div class=\"flex-grow-1 px-1 pb-1\">\n <up-pagination-grid [config]=\"gridConfig\" id=\"grid-approval-list\" rowSelection=\"multiple\" (onGridReady)=\"setGridApi($event)\" (onRowClick)=\"openDetail($event)\" (onSelectionChanged)=\"selectApprovals()\" />\n</div>\n" }]
|
|
2384
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
2385
|
+
type: Inject,
|
|
2386
|
+
args: ['ENTITIES']
|
|
2387
|
+
}] }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: ApprovalService }, { type: i1.AlertController }] });
|
|
2388
|
+
|
|
2389
|
+
class ApprovalFormComponent {
|
|
2390
|
+
constructor(router, ch, service, gridService, alertCtrl, permService) {
|
|
2391
|
+
this.router = router;
|
|
2392
|
+
this.ch = ch;
|
|
2393
|
+
this.service = service;
|
|
2394
|
+
this.gridService = gridService;
|
|
2395
|
+
this.alertCtrl = alertCtrl;
|
|
2396
|
+
this.permService = permService;
|
|
2397
|
+
this.isLoading = true;
|
|
2398
|
+
this.btnConfig = [];
|
|
2399
|
+
this.data = [];
|
|
2400
|
+
}
|
|
2401
|
+
ngOnDestroy() { this.sub?.unsubscribe(); }
|
|
2402
|
+
setGuid(guids, isApprove) {
|
|
2403
|
+
if (guids.length === 1)
|
|
2404
|
+
this.guid = guids[0];
|
|
2405
|
+
this.btnConfig.length = 0;
|
|
2406
|
+
this.setLoading(true);
|
|
2407
|
+
this.sub = this.service.query({ guids, status: [ApprovalStatusEnum.Approved, ApprovalStatusEnum.Declined, ApprovalStatusEnum.Pending] }, 'permission reason').subscribe({
|
|
2408
|
+
next: ({ data: { approvalMsApprovals: { data } } }) => {
|
|
2409
|
+
if (!data || data.length === 0) {
|
|
2410
|
+
this.router.navigateByUrl('approval');
|
|
2411
|
+
return;
|
|
2412
|
+
}
|
|
2413
|
+
this.data = data;
|
|
2414
|
+
if (data.length > 1) {
|
|
2415
|
+
let dataCount = 0;
|
|
2416
|
+
data.map(({ permission, status }) => {
|
|
2417
|
+
if (status === ApprovalStatusEnum.Pending) {
|
|
2418
|
+
const perm = permission.split('.');
|
|
2419
|
+
if (this.permService.checkPermission(perm[0], perm[1], perm[2]))
|
|
2420
|
+
dataCount++;
|
|
2421
|
+
if (dataCount === data.length)
|
|
2422
|
+
isApprove ? this.btnConfig.push({ label: 'Approve', icon: 'checkmark', description: 'Approve the approval(s)', disabled: false, onClick: this.request.bind(this) }) : this.btnConfig.push({ label: 'Decline', icon: 'close', description: 'Decline the approval', color: 'danger', disabled: false, onClick: this.request.bind(this) });
|
|
2423
|
+
}
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
else {
|
|
2427
|
+
const { status, permission } = data[0];
|
|
2428
|
+
if (status === ApprovalStatusEnum.Pending) {
|
|
2429
|
+
const perm = permission.split('.');
|
|
2430
|
+
if (this.permService.checkPermission(perm[0], perm[1], perm[2])) {
|
|
2431
|
+
this.btnConfig.push({ label: 'Approve', icon: 'checkmark', description: 'Approve the approval', disabled: false, onClick: this.request.bind(this) }, { label: 'Decline', icon: 'close', description: 'Decline the approval', color: 'danger', disabled: false, onClick: this.request.bind(this) });
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
this.setLoading(false);
|
|
2436
|
+
},
|
|
2437
|
+
error: ({ message }) => {
|
|
2438
|
+
this.showAlert('Error', message);
|
|
2439
|
+
this.router.navigateByUrl('approval');
|
|
2440
|
+
}
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
request(btn) {
|
|
2444
|
+
const isApprove = btn.color !== 'danger';
|
|
2445
|
+
this.showAlert('Confirm', `Are you sure want to ${isApprove ? 'approve the approval?' : 'decline the approval? Please input the reason if you want to decline.'}`, [
|
|
2446
|
+
{ text: 'Cancel', handler: () => btn.toggleLoading() },
|
|
2447
|
+
{
|
|
2448
|
+
text: `${isApprove ? 'Approve' : 'Decline'}`,
|
|
2449
|
+
handler: ({ reason }) => {
|
|
2450
|
+
this.sub?.unsubscribe();
|
|
2451
|
+
const variables = {
|
|
2452
|
+
...(this.guid ? { guid: this.guid } : { approvalGroupGuid: '' }),
|
|
2453
|
+
isApprove,
|
|
2454
|
+
reason
|
|
2455
|
+
};
|
|
2456
|
+
this.sub = this.service.request(variables).subscribe({
|
|
2457
|
+
next: () => {
|
|
2458
|
+
this.showAlert('Success', `Approval ${isApprove ? 'approved' : 'declined'}`);
|
|
2459
|
+
this.router.navigateByUrl('approval');
|
|
2460
|
+
this.gridService.refreshGridCache('grid-approval-list');
|
|
2461
|
+
},
|
|
2462
|
+
error: ({ message }) => {
|
|
2463
|
+
btn.toggleLoading();
|
|
2464
|
+
this.showAlert('Error', message);
|
|
2465
|
+
}
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
], [{ name: 'reason', type: 'textarea', placeholder: 'Reason' }]);
|
|
2470
|
+
}
|
|
2471
|
+
setLoading(b) {
|
|
2472
|
+
this.isLoading = b;
|
|
2473
|
+
this.ch.markForCheck();
|
|
2474
|
+
}
|
|
2475
|
+
async showAlert(header, message, buttons = ['OK'], inputs = []) { (await this.alertCtrl.create({ header, message, buttons, inputs })).present(); }
|
|
2476
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalFormComponent, deps: [{ token: i1$2.Router }, { token: i0.ChangeDetectorRef }, { token: ApprovalService }, { token: GridService }, { token: i1.AlertController }, { token: PermissionService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2477
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ApprovalFormComponent, isStandalone: true, selector: "up-approval-form", inputs: { isLoading: "isLoading" }, host: { classAttribute: "px-4 d-block" }, ngImport: i0, template: "<ng-container *ngIf=\"!isLoading; else loading\">\n <div *ngFor=\"let d of data, let i = index\">\n <div class=\"d-flex align-items-center gap-2 pb-3 pt-2\" *ngIf=\"data.length > 1\">\n <ion-icon name=\"document\" />\n <h5 class=\"m-0\">Approval {{ i + 1 }}</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Entity\" [disabled]=\"true\" [value]=\"d.entity\" />\n <up-input class=\"mb-4\" label=\"Remark\" [disabled]=\"true\" [value]=\"d.remark\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Created At\" [disabled]=\"true\" [value]=\"d.createdAt | date:'dd MMM yyyy HH:mm'\" />\n <up-input class=\"mb-4\" label=\"Status\" [disabled]=\"true\" [value]=\"d.status\" />\n </div>\n </div>\n\n <up-textarea class=\"mb-4\" label=\"Reason\" [disabled]=\"true\" [value]=\"d.reason\" *ngIf=\"d.status !== 'PENDING'\" />\n </div>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n </div>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonSkeletonText, selector: "ion-skeleton-text", inputs: ["animated"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }, { kind: "component", type: FormInputComponent, selector: "up-input", inputs: ["label", "value", "required", "disabled"], outputs: ["onInput"] }, { kind: "component", type: FormTextareaComponent, selector: "up-textarea", inputs: ["value", "required", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2478
|
+
}
|
|
2479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalFormComponent, decorators: [{
|
|
2480
|
+
type: Component,
|
|
2481
|
+
args: [{ standalone: true, selector: 'up-approval-form', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2482
|
+
class: 'px-4 d-block'
|
|
2483
|
+
}, imports: [
|
|
2484
|
+
IonicModule,
|
|
2485
|
+
CommonModule,
|
|
2486
|
+
FormInputComponent,
|
|
2487
|
+
FormTextareaComponent
|
|
2488
|
+
], template: "<ng-container *ngIf=\"!isLoading; else loading\">\n <div *ngFor=\"let d of data, let i = index\">\n <div class=\"d-flex align-items-center gap-2 pb-3 pt-2\" *ngIf=\"data.length > 1\">\n <ion-icon name=\"document\" />\n <h5 class=\"m-0\">Approval {{ i + 1 }}</h5>\n </div>\n\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Entity\" [disabled]=\"true\" [value]=\"d.entity\" />\n <up-input class=\"mb-4\" label=\"Remark\" [disabled]=\"true\" [value]=\"d.remark\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <up-input class=\"mb-4\" label=\"Created At\" [disabled]=\"true\" [value]=\"d.createdAt | date:'dd MMM yyyy HH:mm'\" />\n <up-input class=\"mb-4\" label=\"Status\" [disabled]=\"true\" [value]=\"d.status\" />\n </div>\n </div>\n\n <up-textarea class=\"mb-4\" label=\"Reason\" [disabled]=\"true\" [value]=\"d.reason\" *ngIf=\"d.status !== 'PENDING'\" />\n </div>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"d-flex flex-column flex-lg-row gap-4\">\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n\n <div class=\"flex-grow-1\">\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n <ion-skeleton-text class=\"m-0 mb-4 sk-input\" />\n </div>\n </div>\n</ng-template>\n" }]
|
|
2489
|
+
}], ctorParameters: () => [{ type: i1$2.Router }, { type: i0.ChangeDetectorRef }, { type: ApprovalService }, { type: GridService }, { type: i1.AlertController }, { type: PermissionService }], propDecorators: { isLoading: [{
|
|
2490
|
+
type: Input
|
|
2491
|
+
}] } });
|
|
2492
|
+
|
|
2493
|
+
class ApprovalDetailComponent {
|
|
2494
|
+
constructor(router, activatedRoute) {
|
|
2495
|
+
this.router = router;
|
|
2496
|
+
this.activatedRoute = activatedRoute;
|
|
2497
|
+
this.btnConfig = [];
|
|
2498
|
+
this.guid = '';
|
|
2499
|
+
}
|
|
2500
|
+
ngOnInit() {
|
|
2501
|
+
this.sub = this.activatedRoute.queryParams.subscribe((params) => {
|
|
2502
|
+
if (params) {
|
|
2503
|
+
this.guids = params['guids'];
|
|
2504
|
+
this.isApprove = params['isApprove'] === 'true';
|
|
2505
|
+
}
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2508
|
+
ngAfterViewInit() {
|
|
2509
|
+
if (this.guids) {
|
|
2510
|
+
this.setChildGuid('');
|
|
2511
|
+
this.changeTab(this.activatedRoute.snapshot.fragment);
|
|
2512
|
+
}
|
|
2513
|
+
else {
|
|
2514
|
+
this.setChildGuid(this.activatedRoute.children[0].snapshot.params['guid']);
|
|
2515
|
+
this.changeTab(this.activatedRoute.snapshot.fragment);
|
|
2516
|
+
this.sub = this.router.events.pipe(filter((e) => e instanceof NavigationEnd)).subscribe({
|
|
2517
|
+
next: () => {
|
|
2518
|
+
const newGuid = this.activatedRoute.children[0].snapshot.params['guid'];
|
|
2519
|
+
if (this.guid !== newGuid) {
|
|
2520
|
+
this.guid = newGuid;
|
|
2521
|
+
this.setChildGuid(this.guid);
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
ngOnDestroy() { this.sub.unsubscribe(); }
|
|
2528
|
+
changeTab(f) {
|
|
2529
|
+
switch (f) {
|
|
2530
|
+
default:
|
|
2531
|
+
this.btnConfig = this.formComponent?.btnConfig ?? [];
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
setChildGuid(guid) {
|
|
2535
|
+
this.formComponent?.setGuid(this.guids ?? [guid], this.isApprove);
|
|
2536
|
+
}
|
|
2537
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalDetailComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2538
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: ApprovalDetailComponent, isStandalone: true, selector: "up-approval-detail", host: { classAttribute: "d-block h-100" }, viewQueries: [{ propertyName: "formComponent", first: true, predicate: ApprovalFormComponent, descendants: true }], ngImport: i0, template: "<up-column-header-container header=\"Approval Detail\" prevUrl=\"/approval\" class=\"bg-white\">\n <up-btn-group id=\"button\" *ngIf=\"!formComponent?.isLoading; else loading\" [config]=\"btnConfig\" />\n\n <ng-template #loading>\n <ion-skeleton-text id=\"button\" class=\"m-0 sk-btn\" />\n </ng-template>\n\n <up-tab-group class=\"h-100\" (onChange)=\"changeTab($event)\">\n <up-tab-content header=\"Detail\" fragment=\"detail\">\n <up-approval-form />\n </up-tab-content>\n </up-tab-group>\n</up-column-header-container>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonSkeletonText, selector: "ion-skeleton-text", inputs: ["animated"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TabsComponentModule }, { kind: "component", type: TabGroupComponent, selector: "up-tab-group", outputs: ["onChange"] }, { kind: "component", type: TabContentComponent, selector: "up-tab-content", inputs: ["header"] }, { kind: "component", type: ButtonGroupComponent, selector: "up-btn-group", inputs: ["config"] }, { kind: "component", type: ColumnHeaderContainerComponent, selector: "up-column-header-container", inputs: ["header", "prevUrl"] }, { kind: "component", type: ApprovalFormComponent, selector: "up-approval-form", inputs: ["isLoading"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2539
|
+
}
|
|
2540
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ApprovalDetailComponent, decorators: [{
|
|
2541
|
+
type: Component,
|
|
2542
|
+
args: [{ standalone: true, selector: 'up-approval-detail', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2543
|
+
class: 'd-block h-100'
|
|
2544
|
+
}, imports: [
|
|
2545
|
+
IonicModule,
|
|
2546
|
+
CommonModule,
|
|
2547
|
+
TabsComponentModule,
|
|
2548
|
+
ButtonGroupComponent,
|
|
2549
|
+
ColumnHeaderContainerComponent,
|
|
2550
|
+
ApprovalFormComponent
|
|
2551
|
+
], template: "<up-column-header-container header=\"Approval Detail\" prevUrl=\"/approval\" class=\"bg-white\">\n <up-btn-group id=\"button\" *ngIf=\"!formComponent?.isLoading; else loading\" [config]=\"btnConfig\" />\n\n <ng-template #loading>\n <ion-skeleton-text id=\"button\" class=\"m-0 sk-btn\" />\n </ng-template>\n\n <up-tab-group class=\"h-100\" (onChange)=\"changeTab($event)\">\n <up-tab-content header=\"Detail\" fragment=\"detail\">\n <up-approval-form />\n </up-tab-content>\n </up-tab-group>\n</up-column-header-container>\n" }]
|
|
2552
|
+
}], ctorParameters: () => [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }], propDecorators: { formComponent: [{
|
|
2553
|
+
type: ViewChild,
|
|
2554
|
+
args: [ApprovalFormComponent]
|
|
2555
|
+
}] } });
|
|
2556
|
+
|
|
2547
2557
|
class ProfileService {
|
|
2548
2558
|
constructor(apollo) {
|
|
2549
2559
|
this.apollo = apollo;
|