ngx-techlify-checksheet 18.0.0
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/README.md +24 -0
- package/esm2022/lib/@shared/file-upload-button/file-upload-button.component.mjs +50 -0
- package/esm2022/lib/@shared/index.mjs +2 -0
- package/esm2022/lib/@shared/material.module.mjs +171 -0
- package/esm2022/lib/@shared/shared.module.mjs +54 -0
- package/esm2022/lib/checksheet/checksheet-form/checksheet-form.component.mjs +161 -0
- package/esm2022/lib/checksheet/checksheet-form-button/checksheet-form-button.component.mjs +58 -0
- package/esm2022/lib/checksheet/checksheet-format-list/checksheet-format-list.component.mjs +123 -0
- package/esm2022/lib/checksheet/checksheet-format-question.service.mjs +18 -0
- package/esm2022/lib/checksheet/checksheet-format.service.mjs +24 -0
- package/esm2022/lib/checksheet/checksheet-list/checksheet-list.component.mjs +138 -0
- package/esm2022/lib/checksheet/checksheet-node-view/checksheet-node-view.component.mjs +59 -0
- package/esm2022/lib/checksheet/checksheet-question/checksheet-question.component.mjs +174 -0
- package/esm2022/lib/checksheet/checksheet-question-form/checksheet-question-form.component.mjs +148 -0
- package/esm2022/lib/checksheet/checksheet-question-list/checksheet-question-list.component.mjs +161 -0
- package/esm2022/lib/checksheet/checksheet-report/checksheet-report.component.mjs +242 -0
- package/esm2022/lib/checksheet/checksheet-review-button/checksheet-review-button.component.mjs +68 -0
- package/esm2022/lib/checksheet/checksheet-routing.module.mjs +44 -0
- package/esm2022/lib/checksheet/checksheet-submission-answer.service.mjs +18 -0
- package/esm2022/lib/checksheet/checksheet-submission-delete-button/checksheet-submission-delete-button.component.mjs +52 -0
- package/esm2022/lib/checksheet/checksheet-submission-file/checksheet-submission-file-delete-button/checksheet-submission-file-delete-button.component.mjs +55 -0
- package/esm2022/lib/checksheet/checksheet-submission-file/checksheet-submission-files/checksheet-submission-files.component.mjs +67 -0
- package/esm2022/lib/checksheet/checksheet-submission-file-upload/checksheet-submisison-file-upload.component.mjs +46 -0
- package/esm2022/lib/checksheet/checksheet-submission-file.service.mjs +18 -0
- package/esm2022/lib/checksheet/checksheet-submission-form/checksheet-submission-form.component.mjs +131 -0
- package/esm2022/lib/checksheet/checksheet-submission-form-button/checksheet-submission-form-button.component.mjs +58 -0
- package/esm2022/lib/checksheet/checksheet-submission-list/checksheet-submission-list.component.mjs +107 -0
- package/esm2022/lib/checksheet/checksheet-submission-review-button/checksheet-submission-review-button.component.mjs +68 -0
- package/esm2022/lib/checksheet/checksheet-submission-view/checksheet-submission-view.component.mjs +142 -0
- package/esm2022/lib/checksheet/checksheet-submission.service.mjs +36 -0
- package/esm2022/lib/checksheet/checksheet-submittable.type.mjs +2 -0
- package/esm2022/lib/checksheet/checksheet-view/checksheet-view.component.mjs +140 -0
- package/esm2022/lib/checksheet/checksheet.module.mjs +131 -0
- package/esm2022/lib/checksheet/checksheet.service.mjs +44 -0
- package/esm2022/lib/checksheet/mechanical-issue-form/mechanical-issue-form.component.mjs +73 -0
- package/esm2022/ngx-techlify-checksheet.mjs +5 -0
- package/esm2022/public-api.mjs +9 -0
- package/fesm2022/ngx-techlify-checksheet.mjs +2550 -0
- package/fesm2022/ngx-techlify-checksheet.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/@shared/file-upload-button/file-upload-button.component.d.ts +20 -0
- package/lib/@shared/index.d.ts +1 -0
- package/lib/@shared/material.module.d.ts +40 -0
- package/lib/@shared/shared.module.d.ts +14 -0
- package/lib/checksheet/checksheet-form/checksheet-form.component.d.ts +45 -0
- package/lib/checksheet/checksheet-form-button/checksheet-form-button.component.d.ts +29 -0
- package/lib/checksheet/checksheet-format-list/checksheet-format-list.component.d.ts +19 -0
- package/lib/checksheet/checksheet-format-question.service.d.ts +7 -0
- package/lib/checksheet/checksheet-format.service.d.ts +10 -0
- package/lib/checksheet/checksheet-list/checksheet-list.component.d.ts +31 -0
- package/lib/checksheet/checksheet-node-view/checksheet-node-view.component.d.ts +25 -0
- package/lib/checksheet/checksheet-question/checksheet-question.component.d.ts +34 -0
- package/lib/checksheet/checksheet-question-form/checksheet-question-form.component.d.ts +38 -0
- package/lib/checksheet/checksheet-question-list/checksheet-question-list.component.d.ts +26 -0
- package/lib/checksheet/checksheet-report/checksheet-report.component.d.ts +47 -0
- package/lib/checksheet/checksheet-review-button/checksheet-review-button.component.d.ts +32 -0
- package/lib/checksheet/checksheet-routing.module.d.ts +7 -0
- package/lib/checksheet/checksheet-submission-answer.service.d.ts +7 -0
- package/lib/checksheet/checksheet-submission-delete-button/checksheet-submission-delete-button.component.d.ts +24 -0
- package/lib/checksheet/checksheet-submission-file/checksheet-submission-file-delete-button/checksheet-submission-file-delete-button.component.d.ts +24 -0
- package/lib/checksheet/checksheet-submission-file/checksheet-submission-files/checksheet-submission-files.component.d.ts +17 -0
- package/lib/checksheet/checksheet-submission-file-upload/checksheet-submisison-file-upload.component.d.ts +13 -0
- package/lib/checksheet/checksheet-submission-file.service.d.ts +7 -0
- package/lib/checksheet/checksheet-submission-form/checksheet-submission-form.component.d.ts +27 -0
- package/lib/checksheet/checksheet-submission-form-button/checksheet-submission-form-button.component.d.ts +29 -0
- package/lib/checksheet/checksheet-submission-list/checksheet-submission-list.component.d.ts +24 -0
- package/lib/checksheet/checksheet-submission-review-button/checksheet-submission-review-button.component.d.ts +32 -0
- package/lib/checksheet/checksheet-submission-view/checksheet-submission-view.component.d.ts +37 -0
- package/lib/checksheet/checksheet-submission.service.d.ts +22 -0
- package/lib/checksheet/checksheet-submittable.type.d.ts +1 -0
- package/lib/checksheet/checksheet-view/checksheet-view.component.d.ts +37 -0
- package/lib/checksheet/checksheet.module.d.ts +34 -0
- package/lib/checksheet/checksheet.service.d.ts +25 -0
- package/lib/checksheet/mechanical-issue-form/mechanical-issue-form.component.d.ts +21 -0
- package/package.json +45 -0
- package/public-api.d.ts +5 -0
|
@@ -0,0 +1,2550 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, Inject, EventEmitter, Input, Output, ViewEncapsulation, NgModule } from '@angular/core';
|
|
3
|
+
import * as i4 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i6$2 from '@angular/router';
|
|
6
|
+
import { RouterModule } from '@angular/router';
|
|
7
|
+
import * as i2 from '@angular/forms';
|
|
8
|
+
import { Validators, ReactiveFormsModule, FormControl, FormsModule } from '@angular/forms';
|
|
9
|
+
import * as i1 from 'ngx-techlify-core';
|
|
10
|
+
import { TechlifyServiceBaseClass, MaterialModule as MaterialModule$1, TechlifyListingControllerInterface, ActionPopupComponent, TechlifyFormComponentInterface, DateValidator, Timeline, LoaderModule, ActionPopupModule, SearchableSelectorModule, NoteModule, EntityFilesViewAllModule, ExportExcelModule, TimelineFilterModule } from 'ngx-techlify-core';
|
|
11
|
+
import * as i3$1 from 'ngx-spinner';
|
|
12
|
+
import * as i1$1 from '@angular/material/dialog';
|
|
13
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
14
|
+
import * as i6 from '@angular/flex-layout/flex';
|
|
15
|
+
import * as i8 from '@angular/material/button';
|
|
16
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
17
|
+
import * as i7 from '@angular/material/card';
|
|
18
|
+
import { MatCardModule } from '@angular/material/card';
|
|
19
|
+
import * as i10 from '@angular/material/form-field';
|
|
20
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
21
|
+
import * as i12 from '@angular/material/input';
|
|
22
|
+
import { MatInputModule } from '@angular/material/input';
|
|
23
|
+
import * as i8$1 from '@angular/material/progress-bar';
|
|
24
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
25
|
+
import * as i11 from 'ngx-editor';
|
|
26
|
+
import { Editor, NgxEditorModule } from 'ngx-editor';
|
|
27
|
+
import * as i3 from '@angular/material/icon';
|
|
28
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
29
|
+
import * as i9$2 from 'ngx-infinite-scroll';
|
|
30
|
+
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
|
31
|
+
import { __decorate } from 'tslib';
|
|
32
|
+
import { debounceTime } from 'rxjs/operators';
|
|
33
|
+
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
|
|
34
|
+
import * as i4$1 from '@angular/material/checkbox';
|
|
35
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
36
|
+
import * as i9 from '@angular/material/datepicker';
|
|
37
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
38
|
+
import * as i9$1 from '@angular/material/radio';
|
|
39
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
40
|
+
import { map, forkJoin, debounceTime as debounceTime$1, distinctUntilChanged } from 'rxjs';
|
|
41
|
+
import * as i6$1 from '@angular/material/table';
|
|
42
|
+
import { MatTableModule } from '@angular/material/table';
|
|
43
|
+
import * as i6$3 from '@angular/material/tooltip';
|
|
44
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
45
|
+
import * as i7$1 from '@angular/material/core';
|
|
46
|
+
import { MatCommonModule, MatLineModule, MatNativeDateModule, MatOptionModule, MatPseudoCheckboxModule, MatRippleModule } from '@angular/material/core';
|
|
47
|
+
import * as i12$1 from '@angular/material/select';
|
|
48
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
49
|
+
import moment from 'moment';
|
|
50
|
+
import * as i13 from '@angular/material/sort';
|
|
51
|
+
import { MatSortModule } from '@angular/material/sort';
|
|
52
|
+
import * as i15 from 'ngx-permissions';
|
|
53
|
+
import { NgxPermissionsModule } from 'ngx-permissions';
|
|
54
|
+
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
55
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
56
|
+
import { MatBadgeModule } from '@angular/material/badge';
|
|
57
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
58
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
59
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
60
|
+
import { MatExpansionModule } from '@angular/material/expansion';
|
|
61
|
+
import { MatGridListModule } from '@angular/material/grid-list';
|
|
62
|
+
import { MatListModule } from '@angular/material/list';
|
|
63
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
64
|
+
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
65
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
66
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
67
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
68
|
+
import { MatSliderModule } from '@angular/material/slider';
|
|
69
|
+
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
70
|
+
import { MatStepperModule } from '@angular/material/stepper';
|
|
71
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
|
72
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
73
|
+
import { MatTreeModule } from '@angular/material/tree';
|
|
74
|
+
|
|
75
|
+
class ChecksheetFormatService extends TechlifyServiceBaseClass {
|
|
76
|
+
constructor(httpService) {
|
|
77
|
+
super(httpService, 'checksheet-formats');
|
|
78
|
+
}
|
|
79
|
+
copy(model) {
|
|
80
|
+
return this.http.post(`api/checksheet-formats-copy/${model.id}`, {});
|
|
81
|
+
}
|
|
82
|
+
unpublish(model) {
|
|
83
|
+
return this.http.put(`api/checksheet-formats/${model.id}/unpublish`, {});
|
|
84
|
+
}
|
|
85
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatService, deps: [{ token: i1.HttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
86
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatService, providedIn: 'root' });
|
|
87
|
+
}
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatService, decorators: [{
|
|
89
|
+
type: Injectable,
|
|
90
|
+
args: [{
|
|
91
|
+
providedIn: 'root'
|
|
92
|
+
}]
|
|
93
|
+
}], ctorParameters: () => [{ type: i1.HttpService }] });
|
|
94
|
+
|
|
95
|
+
class ChecksheetFormatQuestionService extends TechlifyServiceBaseClass {
|
|
96
|
+
constructor(httpService) {
|
|
97
|
+
super(httpService, 'checksheet-format-questions');
|
|
98
|
+
}
|
|
99
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatQuestionService, deps: [{ token: i1.HttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
100
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatQuestionService, providedIn: 'root' });
|
|
101
|
+
}
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatQuestionService, decorators: [{
|
|
103
|
+
type: Injectable,
|
|
104
|
+
args: [{
|
|
105
|
+
providedIn: 'root'
|
|
106
|
+
}]
|
|
107
|
+
}], ctorParameters: () => [{ type: i1.HttpService }] });
|
|
108
|
+
|
|
109
|
+
const errorMessages$4 = {
|
|
110
|
+
label: {
|
|
111
|
+
required: 'Question is required'
|
|
112
|
+
},
|
|
113
|
+
type_id: {
|
|
114
|
+
required: 'Question Type is required'
|
|
115
|
+
},
|
|
116
|
+
value: {
|
|
117
|
+
required: 'Answer is required'
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
class ChecksheetQuestionFormComponent {
|
|
121
|
+
dialogRef;
|
|
122
|
+
data;
|
|
123
|
+
fb;
|
|
124
|
+
formValidatorService;
|
|
125
|
+
alertService;
|
|
126
|
+
checksheetFormatQuestionService;
|
|
127
|
+
updateMode;
|
|
128
|
+
questionFormGroup;
|
|
129
|
+
questionFormFirstAttempt;
|
|
130
|
+
editor;
|
|
131
|
+
isSaving = false;
|
|
132
|
+
constructor(dialogRef, data, fb, formValidatorService, alertService, checksheetFormatQuestionService) {
|
|
133
|
+
this.dialogRef = dialogRef;
|
|
134
|
+
this.data = data;
|
|
135
|
+
this.fb = fb;
|
|
136
|
+
this.formValidatorService = formValidatorService;
|
|
137
|
+
this.alertService = alertService;
|
|
138
|
+
this.checksheetFormatQuestionService = checksheetFormatQuestionService;
|
|
139
|
+
this.createForm();
|
|
140
|
+
}
|
|
141
|
+
/** Method to create a form **/
|
|
142
|
+
createForm() {
|
|
143
|
+
this.questionFormGroup = this.fb.group({
|
|
144
|
+
id: [''],
|
|
145
|
+
label: ['', Validators.compose([Validators.required])],
|
|
146
|
+
type_id: ['', Validators.required],
|
|
147
|
+
format_id: ['', Validators.required],
|
|
148
|
+
answers: this.fb.array([]),
|
|
149
|
+
rank: [1]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
createAnswer() {
|
|
153
|
+
return this.fb.group({
|
|
154
|
+
id: '',
|
|
155
|
+
question_id: '',
|
|
156
|
+
value: ['', Validators.required],
|
|
157
|
+
rank: [1]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
ngOnDestroy() {
|
|
161
|
+
this.editor.destroy();
|
|
162
|
+
}
|
|
163
|
+
ngOnInit() {
|
|
164
|
+
this.editor = new Editor();
|
|
165
|
+
if (this.data.update) {
|
|
166
|
+
this.updateMode = true;
|
|
167
|
+
}
|
|
168
|
+
this.questionFormGroup.patchValue(this.data.question);
|
|
169
|
+
if (this.data.question.type_id === 1 ||
|
|
170
|
+
this.data.question.type_id === 2 ||
|
|
171
|
+
this.data.question.type_id === 7) {
|
|
172
|
+
this.data.question.answers.forEach((answer) => {
|
|
173
|
+
const form = this.createAnswer();
|
|
174
|
+
form.patchValue(answer);
|
|
175
|
+
this.answerFormArray.push(form);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
submit() {
|
|
180
|
+
this.questionFormFirstAttempt = true;
|
|
181
|
+
this.answerFormArray.controls.forEach((fb) => {
|
|
182
|
+
fb.markAllAsTouched();
|
|
183
|
+
});
|
|
184
|
+
if (this.questionFormGroup.valid) {
|
|
185
|
+
const model = this.questionFormGroup.value;
|
|
186
|
+
const params = { with: 'answers,type' };
|
|
187
|
+
this.isSaving = true;
|
|
188
|
+
let request = this.updateMode
|
|
189
|
+
? this.checksheetFormatQuestionService.update(model, params)
|
|
190
|
+
: this.checksheetFormatQuestionService.store(model, params);
|
|
191
|
+
request.subscribe({
|
|
192
|
+
next: (result) => {
|
|
193
|
+
this.isSaving = false;
|
|
194
|
+
this.dialogRef.close(result?.item);
|
|
195
|
+
this.alertService.addAlert('Question saved successfully!', 'success');
|
|
196
|
+
},
|
|
197
|
+
error: () => { this.isSaving = false; }
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
cancel() {
|
|
202
|
+
this.dialogRef.close();
|
|
203
|
+
}
|
|
204
|
+
get isChoiceTypeSelected() {
|
|
205
|
+
return (this.questionFormGroup.get('type_id')?.value === 1 ||
|
|
206
|
+
this.questionFormGroup.get('type_id')?.value === 2 ||
|
|
207
|
+
this.questionFormGroup.get('type_id')?.value === 7);
|
|
208
|
+
}
|
|
209
|
+
get answerFormArray() {
|
|
210
|
+
return this.questionFormGroup.get('answers');
|
|
211
|
+
}
|
|
212
|
+
addAnswer() {
|
|
213
|
+
this.answerFormArray.push(this.createAnswer());
|
|
214
|
+
}
|
|
215
|
+
questionChange(value) {
|
|
216
|
+
this.answerFormArray.clear();
|
|
217
|
+
if (value === 1 || value === 2 || value === 7) {
|
|
218
|
+
this.addAnswer();
|
|
219
|
+
this.addAnswer();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**Method to evaluate form fields*/
|
|
223
|
+
isFieldValid(field, formGroup = this.questionFormGroup) {
|
|
224
|
+
return this.formValidatorService.isFieldValid(field, formGroup, this.questionFormFirstAttempt);
|
|
225
|
+
}
|
|
226
|
+
/**Method to find error in form fields*/
|
|
227
|
+
getErrorMessage(field, formGroup = this.questionFormGroup) {
|
|
228
|
+
return this.formValidatorService.getErrorMessage(field, formGroup, errorMessages$4);
|
|
229
|
+
}
|
|
230
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetQuestionFormComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2.UntypedFormBuilder }, { token: i1.FormValidatorService }, { token: i1.AlertService }, { token: ChecksheetFormatQuestionService }], target: i0.ɵɵFactoryTarget.Component });
|
|
231
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetQuestionFormComponent, selector: "app-checksheet-question-form", ngImport: i0, template: "<form [formGroup]=\"questionFormGroup\" (ngSubmit)=\"submit()\">\n <div fxLayout=\"column\" class=\"mat-typography\">\n <div mat-dialog-title class=\"text-center\">\n <div>Checksheet Question</div>\n </div>\n\n <div mat-dialog-content fxLayout=\"row wrap\" fxLayoutAlign=\"space-between\">\n <div fxFlex=\"100%\" class=\"mt-2\">Question</div>\n <div fxFlex=\"100%\" class=\"mt-3 border\">\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor-menu [editor]=\"editor\"> </ngx-editor-menu>\n <ngx-editor [editor]=\"editor\" formControlName=\"label\"></ngx-editor>\n </div>\n </div>\n <div class=\"text-danger my-1\" fxFlex=\"100%\" *ngIf=\"isFieldValid('label')\">\n {{ getErrorMessage('label') }}\n </div>\n\n <mat-form-field fxFlex=\"100%\" class=\"mt-2\">\n <mat-label>Question Type</mat-label>\n <app-searchable-selector\n apiUrl=\"api/checksheet-question-types\"\n [enableSearch]=\"false\"\n formControlName=\"type_id\"\n (selectionChange)=\"questionChange($event)\"\n ></app-searchable-selector>\n <mat-error *ngIf=\"isFieldValid('type_id')\">\n {{ getErrorMessage('type_id') }}\n </mat-error>\n </mat-form-field>\n\n <div\n fxFlex=\"100%\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n *ngIf=\"isChoiceTypeSelected\"\n >\n <div fxLayout=\"row\" fxLayoutAlign=\"center center\">\n <h3 class=\"m-0\">Answers</h3>\n <button\n mat-icon-button\n color=\"primary\"\n type=\"button\"\n (click)=\"addAnswer()\"\n >\n <mat-icon>add</mat-icon>\n </button>\n </div>\n\n <ng-container\n formArrayName=\"answers\"\n *ngFor=\"let answer of answerFormArray.controls; let i = index\"\n >\n <form\n [formGroupName]=\"i\"\n fxLayout=\"row\"\n fxLayoutAlign=\"center center\"\n fxLayoutGap=\"0.5rem\"\n >\n <mat-form-field>\n <input\n matInput\n formControlName=\"value\"\n placeholder=\"Answer\"\n autocomplete=\"off\"\n required\n />\n <mat-error *ngIf=\"isFieldValid('value', answer)\"\n >{{ getErrorMessage('value', answer) }}\n </mat-error>\n </mat-form-field>\n\n <button\n [disabled]=\"questionFormGroup.get('answers')?.value?.length <= 2\"\n mat-icon-button\n color=\"primary\"\n type=\"button\"\n (click)=\"answerFormArray.removeAt(i)\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n </form>\n </ng-container>\n </div>\n\n <div\n class=\"my-2\"\n fxLayout=\"row\"\n fxLayoutGap=\"30px\"\n fxLayoutAlign=\"end\"\n fxFlex=\"100%\"\n >\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"button\"\n (click)=\"cancel()\"\n >\n Cancel\n </button>\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"submit\"\n color=\"primary\"\n >\n Save\n </button>\n </div>\n </div>\n </div>\n</form>\n", styles: [":host ::ng-deep .ck.ck-content{min-height:200px!important}::ng-deep .ck.ck-balloon-panel{z-index:10000!important}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i6.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i1.SearchableSelectorComponent, selector: "app-searchable-selector", inputs: ["valueField", "titleField", "subtitleField", "apiUrl", "multiple", "selectedValue", "enableSearch", "add", "addConfig", "edit", "editConfig", "sort", "sortBy", "searchField", "itemComponent", "items", "apiDataProperty", "cache", "perPage", "inDataSearch", "panelWidth", "focusSearchOnOpen", "required", "disabled", "value"], outputs: ["selectedValueChange", "selectionChange", "itemsChange"] }, { kind: "component", type: i11.NgxEditorComponent, selector: "ngx-editor", inputs: ["editor", "outputFormat", "placeholder"], outputs: ["focusOut", "focusIn"] }, { kind: "component", type: i11.MenuComponent, selector: "ngx-editor-menu", inputs: ["toolbar", "colorPresets", "disabled", "editor", "customMenuRef", "dropdownPlacement"] }] });
|
|
232
|
+
}
|
|
233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetQuestionFormComponent, decorators: [{
|
|
234
|
+
type: Component,
|
|
235
|
+
args: [{ selector: 'app-checksheet-question-form', template: "<form [formGroup]=\"questionFormGroup\" (ngSubmit)=\"submit()\">\n <div fxLayout=\"column\" class=\"mat-typography\">\n <div mat-dialog-title class=\"text-center\">\n <div>Checksheet Question</div>\n </div>\n\n <div mat-dialog-content fxLayout=\"row wrap\" fxLayoutAlign=\"space-between\">\n <div fxFlex=\"100%\" class=\"mt-2\">Question</div>\n <div fxFlex=\"100%\" class=\"mt-3 border\">\n <div class=\"NgxEditor__Wrapper\">\n <ngx-editor-menu [editor]=\"editor\"> </ngx-editor-menu>\n <ngx-editor [editor]=\"editor\" formControlName=\"label\"></ngx-editor>\n </div>\n </div>\n <div class=\"text-danger my-1\" fxFlex=\"100%\" *ngIf=\"isFieldValid('label')\">\n {{ getErrorMessage('label') }}\n </div>\n\n <mat-form-field fxFlex=\"100%\" class=\"mt-2\">\n <mat-label>Question Type</mat-label>\n <app-searchable-selector\n apiUrl=\"api/checksheet-question-types\"\n [enableSearch]=\"false\"\n formControlName=\"type_id\"\n (selectionChange)=\"questionChange($event)\"\n ></app-searchable-selector>\n <mat-error *ngIf=\"isFieldValid('type_id')\">\n {{ getErrorMessage('type_id') }}\n </mat-error>\n </mat-form-field>\n\n <div\n fxFlex=\"100%\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n *ngIf=\"isChoiceTypeSelected\"\n >\n <div fxLayout=\"row\" fxLayoutAlign=\"center center\">\n <h3 class=\"m-0\">Answers</h3>\n <button\n mat-icon-button\n color=\"primary\"\n type=\"button\"\n (click)=\"addAnswer()\"\n >\n <mat-icon>add</mat-icon>\n </button>\n </div>\n\n <ng-container\n formArrayName=\"answers\"\n *ngFor=\"let answer of answerFormArray.controls; let i = index\"\n >\n <form\n [formGroupName]=\"i\"\n fxLayout=\"row\"\n fxLayoutAlign=\"center center\"\n fxLayoutGap=\"0.5rem\"\n >\n <mat-form-field>\n <input\n matInput\n formControlName=\"value\"\n placeholder=\"Answer\"\n autocomplete=\"off\"\n required\n />\n <mat-error *ngIf=\"isFieldValid('value', answer)\"\n >{{ getErrorMessage('value', answer) }}\n </mat-error>\n </mat-form-field>\n\n <button\n [disabled]=\"questionFormGroup.get('answers')?.value?.length <= 2\"\n mat-icon-button\n color=\"primary\"\n type=\"button\"\n (click)=\"answerFormArray.removeAt(i)\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n </form>\n </ng-container>\n </div>\n\n <div\n class=\"my-2\"\n fxLayout=\"row\"\n fxLayoutGap=\"30px\"\n fxLayoutAlign=\"end\"\n fxFlex=\"100%\"\n >\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"button\"\n (click)=\"cancel()\"\n >\n Cancel\n </button>\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"submit\"\n color=\"primary\"\n >\n Save\n </button>\n </div>\n </div>\n </div>\n</form>\n", styles: [":host ::ng-deep .ck.ck-content{min-height:200px!important}::ng-deep .ck.ck-balloon-panel{z-index:10000!important}\n"] }]
|
|
236
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
237
|
+
type: Inject,
|
|
238
|
+
args: [MAT_DIALOG_DATA]
|
|
239
|
+
}] }, { type: i2.UntypedFormBuilder }, { type: i1.FormValidatorService }, { type: i1.AlertService }, { type: ChecksheetFormatQuestionService }] });
|
|
240
|
+
|
|
241
|
+
class ChecksheetSubmissionAnswerService extends TechlifyServiceBaseClass {
|
|
242
|
+
constructor(httpService) {
|
|
243
|
+
super(httpService, 'checksheet-submission-answers');
|
|
244
|
+
}
|
|
245
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionAnswerService, deps: [{ token: i1.HttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
246
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionAnswerService, providedIn: 'root' });
|
|
247
|
+
}
|
|
248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionAnswerService, decorators: [{
|
|
249
|
+
type: Injectable,
|
|
250
|
+
args: [{
|
|
251
|
+
providedIn: 'root'
|
|
252
|
+
}]
|
|
253
|
+
}], ctorParameters: () => [{ type: i1.HttpService }] });
|
|
254
|
+
|
|
255
|
+
class FileUploadButtonComponent {
|
|
256
|
+
entityFileService;
|
|
257
|
+
config;
|
|
258
|
+
uploaded = new EventEmitter();
|
|
259
|
+
DEFAULT_FILE_ID = 'file-upload-button';
|
|
260
|
+
isUploading;
|
|
261
|
+
constructor(entityFileService) {
|
|
262
|
+
this.entityFileService = entityFileService;
|
|
263
|
+
}
|
|
264
|
+
async onFileChange(event) {
|
|
265
|
+
if (event.target.files && event.target.files.length) {
|
|
266
|
+
const fileArray = Array.from(event.target.files);
|
|
267
|
+
const fileInput = document.getElementById(this.config?.fileId ?? this.DEFAULT_FILE_ID);
|
|
268
|
+
fileInput.value = '';
|
|
269
|
+
this.isUploading = true;
|
|
270
|
+
const results = await this.uploadFiles(fileArray);
|
|
271
|
+
this.uploaded.emit(results);
|
|
272
|
+
this.isUploading = false;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
selectFiles(event) {
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
document
|
|
278
|
+
.getElementById(this.config?.fileId ?? this.DEFAULT_FILE_ID)
|
|
279
|
+
?.click();
|
|
280
|
+
}
|
|
281
|
+
async uploadFiles(files) {
|
|
282
|
+
const uploadPromises = files.map((file) => this.entityFileService.uploadEntityFile(file));
|
|
283
|
+
return await Promise.all(uploadPromises);
|
|
284
|
+
}
|
|
285
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FileUploadButtonComponent, deps: [{ token: i1.EntityFileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
286
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FileUploadButtonComponent, isStandalone: true, selector: "app-file-upload-button", inputs: { config: "config" }, outputs: { uploaded: "uploaded" }, ngImport: i0, template: "<button\n [disabled]=\"isUploading\"\n mat-stroked-button\n type=\"button\"\n (click)=\"selectFiles($event)\"\n>\n <mat-icon>attachment</mat-icon> Attach\n</button>\n\n<input\n type=\"file\"\n id=\"{{ config.fileId ?? DEFAULT_FILE_ID }}\"\n [accept]=\"config.accept ?? '*'\"\n (change)=\"onFileChange($event)\"\n [multiple]=\"config.multiple ?? false\"\n class=\"d-none\"\n/>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FileUploadButtonComponent, decorators: [{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [{ selector: 'app-file-upload-button', standalone: true, imports: [CommonModule, MatButtonModule, MatIconModule], template: "<button\n [disabled]=\"isUploading\"\n mat-stroked-button\n type=\"button\"\n (click)=\"selectFiles($event)\"\n>\n <mat-icon>attachment</mat-icon> Attach\n</button>\n\n<input\n type=\"file\"\n id=\"{{ config.fileId ?? DEFAULT_FILE_ID }}\"\n [accept]=\"config.accept ?? '*'\"\n (change)=\"onFileChange($event)\"\n [multiple]=\"config.multiple ?? false\"\n class=\"d-none\"\n/>\n" }]
|
|
291
|
+
}], ctorParameters: () => [{ type: i1.EntityFileService }], propDecorators: { config: [{
|
|
292
|
+
type: Input
|
|
293
|
+
}], uploaded: [{
|
|
294
|
+
type: Output
|
|
295
|
+
}] } });
|
|
296
|
+
|
|
297
|
+
class ChecksheetSubmissionFileService extends TechlifyServiceBaseClass {
|
|
298
|
+
constructor(httpService) {
|
|
299
|
+
super(httpService, 'checksheet-submission-files');
|
|
300
|
+
}
|
|
301
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFileService, deps: [{ token: i1.HttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
302
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFileService, providedIn: 'root' });
|
|
303
|
+
}
|
|
304
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFileService, decorators: [{
|
|
305
|
+
type: Injectable,
|
|
306
|
+
args: [{
|
|
307
|
+
providedIn: 'root'
|
|
308
|
+
}]
|
|
309
|
+
}], ctorParameters: () => [{ type: i1.HttpService }] });
|
|
310
|
+
|
|
311
|
+
class ChecksheetSubmissionFileUploadComponent {
|
|
312
|
+
checksheetSubmissionFileService;
|
|
313
|
+
submissionId;
|
|
314
|
+
questionId;
|
|
315
|
+
uploaded = new EventEmitter();
|
|
316
|
+
constructor(checksheetSubmissionFileService) {
|
|
317
|
+
this.checksheetSubmissionFileService = checksheetSubmissionFileService;
|
|
318
|
+
}
|
|
319
|
+
onUploadComplete(uploadedFiles) {
|
|
320
|
+
const uploadObservables = uploadedFiles.map((file) => {
|
|
321
|
+
const data = {
|
|
322
|
+
file_name: file.item.file_name,
|
|
323
|
+
file_url: file.item.url,
|
|
324
|
+
submission_id: this.submissionId,
|
|
325
|
+
question_id: this.questionId
|
|
326
|
+
};
|
|
327
|
+
return this.checksheetSubmissionFileService
|
|
328
|
+
.store(data)
|
|
329
|
+
.pipe(map((response) => response?.item));
|
|
330
|
+
});
|
|
331
|
+
forkJoin(uploadObservables).subscribe({
|
|
332
|
+
next: (checksheetSubmissionFiles) => {
|
|
333
|
+
this.uploaded.emit(checksheetSubmissionFiles);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFileUploadComponent, deps: [{ token: ChecksheetSubmissionFileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
338
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionFileUploadComponent, isStandalone: true, selector: "app-checksheet-submission-file-upload", inputs: { submissionId: "submissionId", questionId: "questionId" }, outputs: { uploaded: "uploaded" }, ngImport: i0, template: "<app-file-upload-button\n (uploaded)=\"onUploadComplete($event)\"\n [config]=\"{ fileId: 'question-' + questionId }\"\n></app-file-upload-button>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FileUploadButtonComponent, selector: "app-file-upload-button", inputs: ["config"], outputs: ["uploaded"] }] });
|
|
339
|
+
}
|
|
340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFileUploadComponent, decorators: [{
|
|
341
|
+
type: Component,
|
|
342
|
+
args: [{ selector: 'app-checksheet-submission-file-upload', standalone: true, imports: [CommonModule, FileUploadButtonComponent], template: "<app-file-upload-button\n (uploaded)=\"onUploadComplete($event)\"\n [config]=\"{ fileId: 'question-' + questionId }\"\n></app-file-upload-button>\n" }]
|
|
343
|
+
}], ctorParameters: () => [{ type: ChecksheetSubmissionFileService }], propDecorators: { submissionId: [{
|
|
344
|
+
type: Input
|
|
345
|
+
}], questionId: [{
|
|
346
|
+
type: Input
|
|
347
|
+
}], uploaded: [{
|
|
348
|
+
type: Output
|
|
349
|
+
}] } });
|
|
350
|
+
|
|
351
|
+
class ChecksheetSubmissionFileDeleteButtonComponent {
|
|
352
|
+
matDialog;
|
|
353
|
+
checksheetSubmissionFileService;
|
|
354
|
+
checksheetSubmissionFile;
|
|
355
|
+
deleted = new EventEmitter();
|
|
356
|
+
isDeleting = false;
|
|
357
|
+
constructor(matDialog, checksheetSubmissionFileService) {
|
|
358
|
+
this.matDialog = matDialog;
|
|
359
|
+
this.checksheetSubmissionFileService = checksheetSubmissionFileService;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Show delete confirmation dialog.
|
|
363
|
+
*
|
|
364
|
+
* @param templateRef
|
|
365
|
+
*/
|
|
366
|
+
openDialog(templateRef) {
|
|
367
|
+
this.matDialog.open(templateRef, { width: '400px' });
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Send request to delete the model.
|
|
371
|
+
*/
|
|
372
|
+
deleteModel() {
|
|
373
|
+
this.isDeleting = true;
|
|
374
|
+
this.checksheetSubmissionFileService
|
|
375
|
+
.delete(this.checksheetSubmissionFile)
|
|
376
|
+
.subscribe({
|
|
377
|
+
next: () => {
|
|
378
|
+
this.isDeleting = false;
|
|
379
|
+
this.deleted.emit();
|
|
380
|
+
this.matDialog.closeAll();
|
|
381
|
+
},
|
|
382
|
+
error: () => (this.isDeleting = false)
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFileDeleteButtonComponent, deps: [{ token: i1$1.MatDialog }, { token: ChecksheetSubmissionFileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
386
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionFileDeleteButtonComponent, isStandalone: true, selector: "app-checksheet-submission-file-delete-button", inputs: { checksheetSubmissionFile: "checksheetSubmissionFile" }, outputs: { deleted: "deleted" }, ngImport: i0, template: "<mat-icon class=\"cursor-pointer\" (click)=\"openDialog(deleteTemplate)\">\n delete\n</mat-icon>\n\n<ng-template #deleteTemplate>\n <h3 mat-dialog-title>Delete Checksheet Attachment</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to delete the file?</p>\n </div>\n <div\n mat-dialog-actions\n class=\"d-flex justify-content-end gap-2 align-items-center\"\n >\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n mat-flat-button\n mat-dialog-close\n >\n Cancel\n </button>\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n (click)=\"deleteModel()\"\n mat-raised-button\n color=\"warn\"\n >\n Delete\n </button>\n </div>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MaterialModule$1 }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }] });
|
|
387
|
+
}
|
|
388
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFileDeleteButtonComponent, decorators: [{
|
|
389
|
+
type: Component,
|
|
390
|
+
args: [{ selector: 'app-checksheet-submission-file-delete-button', standalone: true, imports: [CommonModule, MatIconModule, MaterialModule$1], template: "<mat-icon class=\"cursor-pointer\" (click)=\"openDialog(deleteTemplate)\">\n delete\n</mat-icon>\n\n<ng-template #deleteTemplate>\n <h3 mat-dialog-title>Delete Checksheet Attachment</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to delete the file?</p>\n </div>\n <div\n mat-dialog-actions\n class=\"d-flex justify-content-end gap-2 align-items-center\"\n >\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n mat-flat-button\n mat-dialog-close\n >\n Cancel\n </button>\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n (click)=\"deleteModel()\"\n mat-raised-button\n color=\"warn\"\n >\n Delete\n </button>\n </div>\n</ng-template>\n" }]
|
|
391
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialog }, { type: ChecksheetSubmissionFileService }], propDecorators: { checksheetSubmissionFile: [{
|
|
392
|
+
type: Input
|
|
393
|
+
}], deleted: [{
|
|
394
|
+
type: Output
|
|
395
|
+
}] } });
|
|
396
|
+
|
|
397
|
+
class ChecksheetSubmissionFilesComponent extends TechlifyListingControllerInterface {
|
|
398
|
+
formBuilder;
|
|
399
|
+
checksheetSubmissionFileService;
|
|
400
|
+
submissionId;
|
|
401
|
+
questionId;
|
|
402
|
+
displayedColumns = ['No', 'File', 'Actions'];
|
|
403
|
+
constructor(formBuilder, checksheetSubmissionFileService) {
|
|
404
|
+
super();
|
|
405
|
+
this.formBuilder = formBuilder;
|
|
406
|
+
this.checksheetSubmissionFileService = checksheetSubmissionFileService;
|
|
407
|
+
this.lastPage = 0;
|
|
408
|
+
this.filterForm = this.formBuilder.group({
|
|
409
|
+
search: [''],
|
|
410
|
+
submission_ids: [''],
|
|
411
|
+
question_ids: ['']
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
ngOnInit() {
|
|
415
|
+
this.filterForm.patchValue({
|
|
416
|
+
submission_ids: this.submissionId ?? '',
|
|
417
|
+
question_ids: this.questionId ?? ''
|
|
418
|
+
}, { emitEvent: false });
|
|
419
|
+
this.listenForChanges();
|
|
420
|
+
this.loadData();
|
|
421
|
+
}
|
|
422
|
+
loadData() {
|
|
423
|
+
const params = {
|
|
424
|
+
...this.filterForm.value,
|
|
425
|
+
perPage: this.perPage,
|
|
426
|
+
page: this.page
|
|
427
|
+
};
|
|
428
|
+
this.isWorking = true;
|
|
429
|
+
this.checksheetSubmissionFileService.index(params).subscribe({
|
|
430
|
+
next: (response) => {
|
|
431
|
+
this.models = this.models.concat(response?.data);
|
|
432
|
+
this.lastPage = response?.last_page;
|
|
433
|
+
},
|
|
434
|
+
complete: () => (this.isWorking = false)
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFilesComponent, deps: [{ token: i2.FormBuilder }, { token: ChecksheetSubmissionFileService }], target: i0.ɵɵFactoryTarget.Component });
|
|
438
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionFilesComponent, isStandalone: true, selector: "app-checksheet-submission-files", inputs: { submissionId: "submissionId", questionId: "questionId" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"p-0\">\n <mat-card-content\n class=\"p-2 mb-0 d-flex justify-content-between align-items-center\"\n >\n <div>\n <h3 class=\"mb-0\">Files</h3>\n </div>\n <form [formGroup]=\"filterForm\">\n <mat-form-field>\n <mat-label>Search</mat-label>\n <input\n formControlName=\"search\"\n type=\"text\"\n matInput\n placeholder=\"Search\"\n />\n </mat-form-field>\n </form>\n </mat-card-content>\n <mat-card-content class=\"p-0\">\n <table mat-table [dataSource]=\"models\" class=\"w-100\">\n <!-- No Column -->\n <ng-container matColumnDef=\"No\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = index\">{{ i + 1 }}</td>\n </ng-container>\n\n <!-- Title Column -->\n <ng-container matColumnDef=\"Title\">\n <th mat-header-cell *matHeaderCellDef>Title</th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.title }}</td>\n </ng-container>\n\n <!-- Details Column -->\n <ng-container matColumnDef=\"Details\">\n <th mat-header-cell *matHeaderCellDef>Details</th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.description }}</td>\n </ng-container>\n\n <!-- File Column -->\n <ng-container matColumnDef=\"File\">\n <th mat-header-cell *matHeaderCellDef>File</th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.file_name }}</td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"Actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element\">\n <div class=\"d-flex justify-content-start align-items-center gap-2\">\n <a\n class=\"text-decoration-none cursor-pointer text-dark\"\n [href]=\"element?.file_url\"\n target=\"_blank\"\n >\n <span class=\"material-symbols-outlined\"> visibility </span>\n </a>\n\n <app-checksheet-submission-file-delete-button\n [checksheetSubmissionFile]=\"element\"\n (deleted)=\"reload()\"\n ></app-checksheet-submission-file-delete-button>\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isWorking\"></mat-progress-bar>\n </mat-card-content>\n</mat-card>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MaterialModule$1 }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i6$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i7.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i8$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: ChecksheetSubmissionFileDeleteButtonComponent, selector: "app-checksheet-submission-file-delete-button", inputs: ["checksheetSubmissionFile"], outputs: ["deleted"] }] });
|
|
439
|
+
}
|
|
440
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFilesComponent, decorators: [{
|
|
441
|
+
type: Component,
|
|
442
|
+
args: [{ selector: 'app-checksheet-submission-files', standalone: true, imports: [CommonModule, MaterialModule$1, MatProgressBarModule, ReactiveFormsModule, ChecksheetSubmissionFileDeleteButtonComponent], template: "<mat-card class=\"p-0\">\n <mat-card-content\n class=\"p-2 mb-0 d-flex justify-content-between align-items-center\"\n >\n <div>\n <h3 class=\"mb-0\">Files</h3>\n </div>\n <form [formGroup]=\"filterForm\">\n <mat-form-field>\n <mat-label>Search</mat-label>\n <input\n formControlName=\"search\"\n type=\"text\"\n matInput\n placeholder=\"Search\"\n />\n </mat-form-field>\n </form>\n </mat-card-content>\n <mat-card-content class=\"p-0\">\n <table mat-table [dataSource]=\"models\" class=\"w-100\">\n <!-- No Column -->\n <ng-container matColumnDef=\"No\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = index\">{{ i + 1 }}</td>\n </ng-container>\n\n <!-- Title Column -->\n <ng-container matColumnDef=\"Title\">\n <th mat-header-cell *matHeaderCellDef>Title</th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.title }}</td>\n </ng-container>\n\n <!-- Details Column -->\n <ng-container matColumnDef=\"Details\">\n <th mat-header-cell *matHeaderCellDef>Details</th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.description }}</td>\n </ng-container>\n\n <!-- File Column -->\n <ng-container matColumnDef=\"File\">\n <th mat-header-cell *matHeaderCellDef>File</th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.file_name }}</td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"Actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element\">\n <div class=\"d-flex justify-content-start align-items-center gap-2\">\n <a\n class=\"text-decoration-none cursor-pointer text-dark\"\n [href]=\"element?.file_url\"\n target=\"_blank\"\n >\n <span class=\"material-symbols-outlined\"> visibility </span>\n </a>\n\n <app-checksheet-submission-file-delete-button\n [checksheetSubmissionFile]=\"element\"\n (deleted)=\"reload()\"\n ></app-checksheet-submission-file-delete-button>\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isWorking\"></mat-progress-bar>\n </mat-card-content>\n</mat-card>\n" }]
|
|
443
|
+
}], ctorParameters: () => [{ type: i2.FormBuilder }, { type: ChecksheetSubmissionFileService }], propDecorators: { submissionId: [{
|
|
444
|
+
type: Input
|
|
445
|
+
}], questionId: [{
|
|
446
|
+
type: Input
|
|
447
|
+
}] } });
|
|
448
|
+
|
|
449
|
+
let ChecksheetQuestionComponent = class ChecksheetQuestionComponent {
|
|
450
|
+
checksheetSubmissionAnswerService;
|
|
451
|
+
questionInfo;
|
|
452
|
+
index;
|
|
453
|
+
submissionView;
|
|
454
|
+
submissionId;
|
|
455
|
+
disableInput;
|
|
456
|
+
fileEntityId;
|
|
457
|
+
editor;
|
|
458
|
+
isWorking = false;
|
|
459
|
+
isWorkingChange = new EventEmitter();
|
|
460
|
+
submittedAnswer = new FormControl('');
|
|
461
|
+
constructor(checksheetSubmissionAnswerService) {
|
|
462
|
+
this.checksheetSubmissionAnswerService = checksheetSubmissionAnswerService;
|
|
463
|
+
}
|
|
464
|
+
ngOnInit() {
|
|
465
|
+
console.log(this.disableInput, this.submissionView);
|
|
466
|
+
this.editor = new Editor();
|
|
467
|
+
this.submittedAnswer.valueChanges
|
|
468
|
+
.pipe(debounceTime(1000))
|
|
469
|
+
.subscribe((val) => {
|
|
470
|
+
if (this.questionInfo?.type_id === 1) {
|
|
471
|
+
this.saveAnswer({ answer_id: val });
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
this.saveAnswer({ details: val });
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
if (this.submissionView) {
|
|
478
|
+
// load the answer for current submission question
|
|
479
|
+
this.loadAnswer();
|
|
480
|
+
}
|
|
481
|
+
this.fileEntityId = this.questionInfo.id;
|
|
482
|
+
}
|
|
483
|
+
onMultiSelectAnswerChange() {
|
|
484
|
+
const answerIds = this.questionInfo.answers
|
|
485
|
+
.filter((item) => item.isChecked)
|
|
486
|
+
.map((item) => item.id);
|
|
487
|
+
this.saveAnswer({ answer_ids: answerIds });
|
|
488
|
+
}
|
|
489
|
+
onMultiSelectYesNoAnswerChange(event, answer) {
|
|
490
|
+
this.saveAnswer({ answer_id: answer?.id, details: event.value });
|
|
491
|
+
}
|
|
492
|
+
getSubmittedMCQAnswer(answers = [], answer_id = null) {
|
|
493
|
+
if (answer_id) {
|
|
494
|
+
const submittedAnswer = answers.find((x) => x.id === answer_id);
|
|
495
|
+
if (submittedAnswer) {
|
|
496
|
+
return submittedAnswer?.value || '';
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return '';
|
|
500
|
+
}
|
|
501
|
+
getSubmittedMSQAnswer() {
|
|
502
|
+
return (this.questionInfo?.answers)
|
|
503
|
+
.filter((answer) => answer?.isChecked)
|
|
504
|
+
?.map((answer) => answer.value)
|
|
505
|
+
?.join(', ');
|
|
506
|
+
}
|
|
507
|
+
loadAnswer() {
|
|
508
|
+
const params = {
|
|
509
|
+
submission_ids: this.submissionId,
|
|
510
|
+
question_ids: this.questionInfo?.id
|
|
511
|
+
};
|
|
512
|
+
this.isWorking = true;
|
|
513
|
+
this.checksheetSubmissionAnswerService.index(params).subscribe({
|
|
514
|
+
next: (response) => {
|
|
515
|
+
this.isWorking = false;
|
|
516
|
+
const answers = response?.data;
|
|
517
|
+
if (this.questionInfo?.type_id === 1 && answers?.length > 0) {
|
|
518
|
+
this.submittedAnswer.setValue(answers[0]?.answer_id, {
|
|
519
|
+
emitEvent: false
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
else if (this.questionInfo?.type_id === 2) {
|
|
523
|
+
this.submittedAnswer.setValue(answers, { emitEvent: false });
|
|
524
|
+
this.questionInfo.answers = (this.questionInfo?.answers).map((answer) => {
|
|
525
|
+
return {
|
|
526
|
+
...answer,
|
|
527
|
+
isChecked: answers.some((item) => item.answer_id === answer.id)
|
|
528
|
+
};
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
else if ((this.questionInfo?.type_id === 3 ||
|
|
532
|
+
this.questionInfo?.type_id === 4 ||
|
|
533
|
+
this.questionInfo?.type_id === 5 ||
|
|
534
|
+
this.questionInfo?.type_id === 6) &&
|
|
535
|
+
answers?.length > 0) {
|
|
536
|
+
this.submittedAnswer.setValue(answers[0].details || '', {
|
|
537
|
+
emitEvent: false
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
else if (this.questionInfo?.type_id === 7) {
|
|
541
|
+
this.submittedAnswer.setValue(answers, { emitEvent: false });
|
|
542
|
+
this.questionInfo.answers = (this.questionInfo?.answers).map((answer) => {
|
|
543
|
+
const result = answers.find((item) => item.answer_id === answer.id);
|
|
544
|
+
return {
|
|
545
|
+
...answer,
|
|
546
|
+
selectedValue: result ? Boolean(Number(result?.details)) : null
|
|
547
|
+
};
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
error: () => (this.isWorking = false)
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Send request to save the question answers.
|
|
556
|
+
*
|
|
557
|
+
* @param answerData
|
|
558
|
+
* @private
|
|
559
|
+
*/
|
|
560
|
+
saveAnswer(answerData) {
|
|
561
|
+
const data = {
|
|
562
|
+
question_id: this.questionInfo?.id,
|
|
563
|
+
submission_id: this.submissionId,
|
|
564
|
+
answer_id: answerData?.answer_id,
|
|
565
|
+
answer_ids: answerData?.answer_ids,
|
|
566
|
+
question_type_id: this.questionInfo?.type_id,
|
|
567
|
+
details: answerData?.details
|
|
568
|
+
};
|
|
569
|
+
this.isWorking = true;
|
|
570
|
+
this.checksheetSubmissionAnswerService.store(data).subscribe({
|
|
571
|
+
next: () => {
|
|
572
|
+
this.isWorking = false;
|
|
573
|
+
},
|
|
574
|
+
error: () => (this.isWorking = false)
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetQuestionComponent, deps: [{ token: ChecksheetSubmissionAnswerService }], target: i0.ɵɵFactoryTarget.Component });
|
|
578
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetQuestionComponent, selector: "app-checksheet-question", inputs: { questionInfo: "questionInfo", index: "index", submissionView: "submissionView", submissionId: "submissionId", disableInput: "disableInput", isWorking: "isWorking" }, outputs: { isWorkingChange: "isWorkingChange" }, ngImport: i0, template: "<div\n fxLayout=\"column\"\n fxLayoutGap=\"0.5rem\"\n class=\"mat-typography\"\n *ngIf=\"!submissionView\"\n>\n <div fxLayout=\"row\" fxLayoutGap=\"0.5rem\" class=\"font-weight-bold\">\n <div>{{ index + 1 }}.</div>\n <div [innerHTML]=\"questionInfo?.label\"></div>\n </div>\n <div fxLayout=\"row\" fxLayoutGap=\"0.5rem\">\n <small>{{ questionInfo?.type?.title }}</small>\n </div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 1\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3\"\n >\n <mat-radio-group class=\"answer-radio-group\" [disabled]=\"true\">\n <mat-radio-button\n class=\"answer-radio-button\"\n *ngFor=\"let answer of questionInfo?.answers\"\n [value]=\"answer.id\"\n >\n {{ answer.value }}\n </mat-radio-button>\n </mat-radio-group>\n </div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 2\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3\"\n >\n <div\n fxLayout=\"row\"\n fxLayoutAlign=\"start center\"\n *ngFor=\"let answer of questionInfo?.answers; let i = index\"\n >\n <mat-checkbox [disabled]=\"true\" fxFlex=\"80%\"\n >{{ i + 1 }} ) {{ answer.value }}</mat-checkbox\n >\n </div>\n </div>\n\n <div\n *ngIf=\"\n questionInfo?.type_id === 3 ||\n questionInfo?.type_id === 5 ||\n questionInfo?.type_id === 6\n \"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3 w-50 border short-answer\"\n ></div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 4\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3 w-50 border long-answer\"\n ></div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 7\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3\"\n >\n <ol>\n <li *ngFor=\"let answer of questionInfo?.answers\">\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <div>{{ answer?.value }} -</div>\n <mat-radio-group [disabled]=\"true\" fxLayout=\"row\">\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" value=\"1\"\n >Yes\n </mat-radio-button>\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" value=\"0\"\n >No\n </mat-radio-button>\n </mat-radio-group>\n </div>\n </li>\n </ol>\n </div>\n</div>\n\n<div *ngIf=\"submissionView\">\n <div class=\"d-flex justify-content-between align-items-center gap-3 mb-2\">\n <div class=\"d-flex align-items-center gap-2\">\n <strong>{{ index + 1 }}.</strong>\n <strong [innerHTML]=\"questionInfo?.label\"></strong>\n <app-checksheet-submission-file-upload\n [submissionId]=\"submissionId\"\n [questionId]=\"questionInfo?.id\"\n (uploaded)=\"checksheetSubmissionFilesComponent.reload()\"\n class=\"ml-3\"\n ></app-checksheet-submission-file-upload>\n </div>\n <span class=\"badge badge-primary\">{{ questionInfo?.type?.title }}</span>\n </div>\n <div class=\"d-flex justify-content-between align-items-start gap-1\">\n <div *ngIf=\"questionInfo?.type_id === 1\" class=\"d-flex flex-column gap-2\">\n <mat-radio-group\n class=\"answer-radio-group\"\n [disabled]=\"disableInput\"\n *ngIf=\"!disableInput\"\n [formControl]=\"submittedAnswer\"\n >\n <mat-radio-button\n class=\"answer-radio-button\"\n *ngFor=\"let answer of questionInfo?.answers\"\n [value]=\"answer.id\"\n >\n {{ answer.value }}\n </mat-radio-button>\n </mat-radio-group>\n <span *ngIf=\"disableInput\">\n <b>Answer:</b>\n {{\n getSubmittedMCQAnswer(\n questionInfo?.answers,\n this.submittedAnswer.value\n )\n }}\n </span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 2\" class=\"d-flex flex-column gap-2\">\n <ng-container *ngIf=\"!disableInput\">\n <div\n fxLayout=\"row\"\n fxLayoutAlign=\"start center\"\n *ngFor=\"let answer of questionInfo?.answers; let i = index\"\n >\n <mat-checkbox\n (change)=\"onMultiSelectAnswerChange()\"\n [disabled]=\"disableInput\"\n [(ngModel)]=\"answer.isChecked\"\n fxFlex=\"80%\"\n >\n {{ i + 1 }}\n )\n {{ answer.value }}\n </mat-checkbox>\n </div>\n </ng-container>\n\n <span *ngIf=\"disableInput\">\n <b>Answers:</b>\n {{ getSubmittedMSQAnswer() }}\n </span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 3 || questionInfo?.type_id === 4\">\n <div class=\"NgxEditor__Wrapper mb-2\" *ngIf=\"!disableInput\">\n <ngx-editor-menu [editor]=\"editor\"> </ngx-editor-menu>\n <ngx-editor\n [editor]=\"editor\"\n [formControl]=\"submittedAnswer\"\n ></ngx-editor>\n </div>\n <div *ngIf=\"disableInput\" [innerHtml]=\"submittedAnswer.value\"></div>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 5\">\n <mat-form-field *ngIf=\"!disableInput\">\n <mat-label>Answer</mat-label>\n <input\n matInput\n type=\"number\"\n size=\"10\"\n [formControl]=\"submittedAnswer\"\n />\n </mat-form-field>\n <span *ngIf=\"disableInput\">{{ submittedAnswer.value }}</span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 6\">\n <mat-form-field *ngIf=\"!disableInput\">\n <input\n matInput\n [matDatepicker]=\"picker\"\n placeholder=\"Date\"\n [formControl]=\"submittedAnswer\"\n (focus)=\"picker.open()\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n <span *ngIf=\"disableInput\">{{ submittedAnswer.value | date }}</span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 7 && !disableInput\">\n <ol>\n <li *ngFor=\"let answer of questionInfo?.answers\">\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <div>{{ answer?.value }} -</div>\n <mat-radio-group\n fxLayout=\"row\"\n (change)=\"onMultiSelectYesNoAnswerChange($event, answer)\"\n [disabled]=\"disableInput\"\n [value]=\"answer.selectedValue\"\n >\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" [value]=\"true\">\n Yes\n </mat-radio-button>\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" [value]=\"false\">\n No\n </mat-radio-button>\n </mat-radio-group>\n </div>\n </li>\n </ol>\n </div>\n\n <app-checksheet-submission-files\n class=\"w-50\"\n #checksheetSubmissionFilesComponent\n [submissionId]=\"submissionId\"\n [questionId]=\"questionInfo?.id\"\n ></app-checksheet-submission-files>\n </div>\n\n <ng-container *ngIf=\"questionInfo?.type_id === 7 && disableInput\">\n <div *ngFor=\"let answer of questionInfo?.answers\">\n {{ answer?.value }} - {{ answer?.selectedValue ? 'Yes' : 'No' }}\n </div>\n </ng-container>\n\n <mat-progress-bar *ngIf=\"isWorking\" mode=\"indeterminate\"></mat-progress-bar>\n</div>\n", styles: [".answer-radio-group{display:flex;flex-direction:column;margin:15px 0}.answer-radio-button{margin:5px}:host ::ng-deep .short-answer .ck.ck-content{min-height:100px!important}:host ::ng-deep .long-answer .ck.ck-content{min-height:200px!important}.scroll-container{max-height:650px;overflow-y:auto}.small-margin{margin-top:2px}:host ::ng-deep .yes-no .mat-radio-label-content{padding-left:3px}.main{display:block;position:relative;padding-left:24px;margin-bottom:15px;cursor:pointer}input[type=checkbox]{visibility:hidden}.geekmark{position:absolute;top:2px;left:0;height:15px;width:15px;background-color:#fff}.main input:checked~.geekmark{background-color:green}.geekmark:after{content:\"\";position:absolute;display:none}.main input:checked~.geekmark:after{display:block}.main .geekmark:after{left:5px;bottom:3px;width:6px;height:10px;border:solid white;border-width:0 4px 4px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}img{max-width:500px!important;max-height:500px!important}p{margin-bottom:0!important}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i6.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "component", type: i4$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i9.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i9.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i9.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i8$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i9$1.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i9$1.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i11.NgxEditorComponent, selector: "ngx-editor", inputs: ["editor", "outputFormat", "placeholder"], outputs: ["focusOut", "focusIn"] }, { kind: "component", type: i11.MenuComponent, selector: "ngx-editor-menu", inputs: ["toolbar", "colorPresets", "disabled", "editor", "customMenuRef", "dropdownPlacement"] }, { kind: "component", type: ChecksheetSubmissionFileUploadComponent, selector: "app-checksheet-submission-file-upload", inputs: ["submissionId", "questionId"], outputs: ["uploaded"] }, { kind: "component", type: ChecksheetSubmissionFilesComponent, selector: "app-checksheet-submission-files", inputs: ["submissionId", "questionId"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }], encapsulation: i0.ViewEncapsulation.None });
|
|
579
|
+
};
|
|
580
|
+
ChecksheetQuestionComponent = __decorate([
|
|
581
|
+
UntilDestroy()
|
|
582
|
+
], ChecksheetQuestionComponent);
|
|
583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetQuestionComponent, decorators: [{
|
|
584
|
+
type: Component,
|
|
585
|
+
args: [{ selector: 'app-checksheet-question', encapsulation: ViewEncapsulation.None, template: "<div\n fxLayout=\"column\"\n fxLayoutGap=\"0.5rem\"\n class=\"mat-typography\"\n *ngIf=\"!submissionView\"\n>\n <div fxLayout=\"row\" fxLayoutGap=\"0.5rem\" class=\"font-weight-bold\">\n <div>{{ index + 1 }}.</div>\n <div [innerHTML]=\"questionInfo?.label\"></div>\n </div>\n <div fxLayout=\"row\" fxLayoutGap=\"0.5rem\">\n <small>{{ questionInfo?.type?.title }}</small>\n </div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 1\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3\"\n >\n <mat-radio-group class=\"answer-radio-group\" [disabled]=\"true\">\n <mat-radio-button\n class=\"answer-radio-button\"\n *ngFor=\"let answer of questionInfo?.answers\"\n [value]=\"answer.id\"\n >\n {{ answer.value }}\n </mat-radio-button>\n </mat-radio-group>\n </div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 2\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3\"\n >\n <div\n fxLayout=\"row\"\n fxLayoutAlign=\"start center\"\n *ngFor=\"let answer of questionInfo?.answers; let i = index\"\n >\n <mat-checkbox [disabled]=\"true\" fxFlex=\"80%\"\n >{{ i + 1 }} ) {{ answer.value }}</mat-checkbox\n >\n </div>\n </div>\n\n <div\n *ngIf=\"\n questionInfo?.type_id === 3 ||\n questionInfo?.type_id === 5 ||\n questionInfo?.type_id === 6\n \"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3 w-50 border short-answer\"\n ></div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 4\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3 w-50 border long-answer\"\n ></div>\n\n <div\n *ngIf=\"questionInfo?.type_id === 7\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n class=\"mr-3\"\n >\n <ol>\n <li *ngFor=\"let answer of questionInfo?.answers\">\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <div>{{ answer?.value }} -</div>\n <mat-radio-group [disabled]=\"true\" fxLayout=\"row\">\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" value=\"1\"\n >Yes\n </mat-radio-button>\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" value=\"0\"\n >No\n </mat-radio-button>\n </mat-radio-group>\n </div>\n </li>\n </ol>\n </div>\n</div>\n\n<div *ngIf=\"submissionView\">\n <div class=\"d-flex justify-content-between align-items-center gap-3 mb-2\">\n <div class=\"d-flex align-items-center gap-2\">\n <strong>{{ index + 1 }}.</strong>\n <strong [innerHTML]=\"questionInfo?.label\"></strong>\n <app-checksheet-submission-file-upload\n [submissionId]=\"submissionId\"\n [questionId]=\"questionInfo?.id\"\n (uploaded)=\"checksheetSubmissionFilesComponent.reload()\"\n class=\"ml-3\"\n ></app-checksheet-submission-file-upload>\n </div>\n <span class=\"badge badge-primary\">{{ questionInfo?.type?.title }}</span>\n </div>\n <div class=\"d-flex justify-content-between align-items-start gap-1\">\n <div *ngIf=\"questionInfo?.type_id === 1\" class=\"d-flex flex-column gap-2\">\n <mat-radio-group\n class=\"answer-radio-group\"\n [disabled]=\"disableInput\"\n *ngIf=\"!disableInput\"\n [formControl]=\"submittedAnswer\"\n >\n <mat-radio-button\n class=\"answer-radio-button\"\n *ngFor=\"let answer of questionInfo?.answers\"\n [value]=\"answer.id\"\n >\n {{ answer.value }}\n </mat-radio-button>\n </mat-radio-group>\n <span *ngIf=\"disableInput\">\n <b>Answer:</b>\n {{\n getSubmittedMCQAnswer(\n questionInfo?.answers,\n this.submittedAnswer.value\n )\n }}\n </span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 2\" class=\"d-flex flex-column gap-2\">\n <ng-container *ngIf=\"!disableInput\">\n <div\n fxLayout=\"row\"\n fxLayoutAlign=\"start center\"\n *ngFor=\"let answer of questionInfo?.answers; let i = index\"\n >\n <mat-checkbox\n (change)=\"onMultiSelectAnswerChange()\"\n [disabled]=\"disableInput\"\n [(ngModel)]=\"answer.isChecked\"\n fxFlex=\"80%\"\n >\n {{ i + 1 }}\n )\n {{ answer.value }}\n </mat-checkbox>\n </div>\n </ng-container>\n\n <span *ngIf=\"disableInput\">\n <b>Answers:</b>\n {{ getSubmittedMSQAnswer() }}\n </span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 3 || questionInfo?.type_id === 4\">\n <div class=\"NgxEditor__Wrapper mb-2\" *ngIf=\"!disableInput\">\n <ngx-editor-menu [editor]=\"editor\"> </ngx-editor-menu>\n <ngx-editor\n [editor]=\"editor\"\n [formControl]=\"submittedAnswer\"\n ></ngx-editor>\n </div>\n <div *ngIf=\"disableInput\" [innerHtml]=\"submittedAnswer.value\"></div>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 5\">\n <mat-form-field *ngIf=\"!disableInput\">\n <mat-label>Answer</mat-label>\n <input\n matInput\n type=\"number\"\n size=\"10\"\n [formControl]=\"submittedAnswer\"\n />\n </mat-form-field>\n <span *ngIf=\"disableInput\">{{ submittedAnswer.value }}</span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 6\">\n <mat-form-field *ngIf=\"!disableInput\">\n <input\n matInput\n [matDatepicker]=\"picker\"\n placeholder=\"Date\"\n [formControl]=\"submittedAnswer\"\n (focus)=\"picker.open()\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n <span *ngIf=\"disableInput\">{{ submittedAnswer.value | date }}</span>\n </div>\n\n <div *ngIf=\"questionInfo?.type_id === 7 && !disableInput\">\n <ol>\n <li *ngFor=\"let answer of questionInfo?.answers\">\n <div fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <div>{{ answer?.value }} -</div>\n <mat-radio-group\n fxLayout=\"row\"\n (change)=\"onMultiSelectYesNoAnswerChange($event, answer)\"\n [disabled]=\"disableInput\"\n [value]=\"answer.selectedValue\"\n >\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" [value]=\"true\">\n Yes\n </mat-radio-button>\n <mat-radio-button class=\"mt-1 ml-2 yes-no\" [value]=\"false\">\n No\n </mat-radio-button>\n </mat-radio-group>\n </div>\n </li>\n </ol>\n </div>\n\n <app-checksheet-submission-files\n class=\"w-50\"\n #checksheetSubmissionFilesComponent\n [submissionId]=\"submissionId\"\n [questionId]=\"questionInfo?.id\"\n ></app-checksheet-submission-files>\n </div>\n\n <ng-container *ngIf=\"questionInfo?.type_id === 7 && disableInput\">\n <div *ngFor=\"let answer of questionInfo?.answers\">\n {{ answer?.value }} - {{ answer?.selectedValue ? 'Yes' : 'No' }}\n </div>\n </ng-container>\n\n <mat-progress-bar *ngIf=\"isWorking\" mode=\"indeterminate\"></mat-progress-bar>\n</div>\n", styles: [".answer-radio-group{display:flex;flex-direction:column;margin:15px 0}.answer-radio-button{margin:5px}:host ::ng-deep .short-answer .ck.ck-content{min-height:100px!important}:host ::ng-deep .long-answer .ck.ck-content{min-height:200px!important}.scroll-container{max-height:650px;overflow-y:auto}.small-margin{margin-top:2px}:host ::ng-deep .yes-no .mat-radio-label-content{padding-left:3px}.main{display:block;position:relative;padding-left:24px;margin-bottom:15px;cursor:pointer}input[type=checkbox]{visibility:hidden}.geekmark{position:absolute;top:2px;left:0;height:15px;width:15px;background-color:#fff}.main input:checked~.geekmark{background-color:green}.geekmark:after{content:\"\";position:absolute;display:none}.main input:checked~.geekmark:after{display:block}.main .geekmark:after{left:5px;bottom:3px;width:6px;height:10px;border:solid white;border-width:0 4px 4px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}img{max-width:500px!important;max-height:500px!important}p{margin-bottom:0!important}\n"] }]
|
|
586
|
+
}], ctorParameters: () => [{ type: ChecksheetSubmissionAnswerService }], propDecorators: { questionInfo: [{
|
|
587
|
+
type: Input
|
|
588
|
+
}], index: [{
|
|
589
|
+
type: Input
|
|
590
|
+
}], submissionView: [{
|
|
591
|
+
type: Input
|
|
592
|
+
}], submissionId: [{
|
|
593
|
+
type: Input
|
|
594
|
+
}], disableInput: [{
|
|
595
|
+
type: Input
|
|
596
|
+
}], isWorking: [{
|
|
597
|
+
type: Input
|
|
598
|
+
}], isWorkingChange: [{
|
|
599
|
+
type: Output
|
|
600
|
+
}] } });
|
|
601
|
+
|
|
602
|
+
class ChecksheetQuestionListComponent {
|
|
603
|
+
spinnerService;
|
|
604
|
+
alertService;
|
|
605
|
+
dialog;
|
|
606
|
+
dataManager;
|
|
607
|
+
checksheet = {};
|
|
608
|
+
checksheetChange = new EventEmitter();
|
|
609
|
+
submission;
|
|
610
|
+
disableInput;
|
|
611
|
+
questions = [];
|
|
612
|
+
constructor(spinnerService, alertService, dialog, dataManager) {
|
|
613
|
+
this.spinnerService = spinnerService;
|
|
614
|
+
this.alertService = alertService;
|
|
615
|
+
this.dialog = dialog;
|
|
616
|
+
this.dataManager = dataManager;
|
|
617
|
+
}
|
|
618
|
+
ngOnInit() {
|
|
619
|
+
this.questions = this.checksheet?.questions || [];
|
|
620
|
+
}
|
|
621
|
+
onScroll() { }
|
|
622
|
+
editQuestion(question, index) {
|
|
623
|
+
const dialogRef = this.dialog.open(ChecksheetQuestionFormComponent, {
|
|
624
|
+
width: '800px',
|
|
625
|
+
data: {
|
|
626
|
+
update: true,
|
|
627
|
+
question: question
|
|
628
|
+
},
|
|
629
|
+
autoFocus: false
|
|
630
|
+
});
|
|
631
|
+
dialogRef.afterClosed().subscribe((result) => {
|
|
632
|
+
if (result) {
|
|
633
|
+
question = result;
|
|
634
|
+
this.questions[index] = question;
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
addQuestion() {
|
|
639
|
+
const dialogRef = this.dialog.open(ChecksheetQuestionFormComponent, {
|
|
640
|
+
width: '800px',
|
|
641
|
+
data: {
|
|
642
|
+
question: {
|
|
643
|
+
format_id: this.checksheet.id
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
autoFocus: false
|
|
647
|
+
});
|
|
648
|
+
dialogRef.afterClosed().subscribe((result) => {
|
|
649
|
+
if (result) {
|
|
650
|
+
this.questions.push(result);
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
async moveQuestionUp(index) {
|
|
655
|
+
if (index < this.questions.length) {
|
|
656
|
+
this.spinnerService.show();
|
|
657
|
+
try {
|
|
658
|
+
if (index <= 0) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
const q1 = this.questions[index];
|
|
662
|
+
const q2 = this.questions[index - 1];
|
|
663
|
+
await this.dataManager.PUT(`api/checksheet-format-questions/${q1.id}`, {
|
|
664
|
+
...q1,
|
|
665
|
+
rank: index - 1
|
|
666
|
+
});
|
|
667
|
+
await this.dataManager.PUT(`api/checksheet-format-questions/${q2.id}`, {
|
|
668
|
+
...q2,
|
|
669
|
+
rank: index
|
|
670
|
+
});
|
|
671
|
+
this.questions[index] = q2;
|
|
672
|
+
this.questions[index - 1] = q1;
|
|
673
|
+
}
|
|
674
|
+
catch (error) {
|
|
675
|
+
this.alertService.addAlert('Unable to move question, try later', 'warn');
|
|
676
|
+
}
|
|
677
|
+
finally {
|
|
678
|
+
this.spinnerService.hide();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
async moveQuestionDown(index) {
|
|
683
|
+
if (index < this.questions.length) {
|
|
684
|
+
this.spinnerService.show();
|
|
685
|
+
try {
|
|
686
|
+
const q1 = this.questions[index];
|
|
687
|
+
const q2 = this.questions[index + 1];
|
|
688
|
+
await this.dataManager.PUT(`api/checksheet-format-questions/${q1.id}`, {
|
|
689
|
+
...q1,
|
|
690
|
+
rank: index + 1
|
|
691
|
+
});
|
|
692
|
+
await this.dataManager.PUT(`api/checksheet-format-questions/${q2.id}`, {
|
|
693
|
+
...q2,
|
|
694
|
+
rank: index
|
|
695
|
+
});
|
|
696
|
+
this.questions[index] = q2;
|
|
697
|
+
this.questions[index + 1] = q1;
|
|
698
|
+
}
|
|
699
|
+
catch (error) {
|
|
700
|
+
this.alertService.addAlert('Unable to move question, try later', 'warn');
|
|
701
|
+
}
|
|
702
|
+
finally {
|
|
703
|
+
this.spinnerService.hide();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
deleteQuestion(question) {
|
|
708
|
+
const dialogRef = this.dialog.open(ActionPopupComponent, {
|
|
709
|
+
width: '400px',
|
|
710
|
+
data: {
|
|
711
|
+
title: 'Delete Question',
|
|
712
|
+
message: `Are you sure to delete the question?`
|
|
713
|
+
},
|
|
714
|
+
autoFocus: false
|
|
715
|
+
});
|
|
716
|
+
dialogRef.afterClosed().subscribe(async (result) => {
|
|
717
|
+
if (result) {
|
|
718
|
+
//Action confirmed
|
|
719
|
+
try {
|
|
720
|
+
this.spinnerService.show();
|
|
721
|
+
await this.dataManager.DELETE(`api/checksheet-format-questions/${question.id}`);
|
|
722
|
+
this.questions = this.questions.filter((x) => x.id !== question.id);
|
|
723
|
+
}
|
|
724
|
+
catch (error) {
|
|
725
|
+
this.alertService.addAlert('Unable to delete question, try later', 'warn');
|
|
726
|
+
}
|
|
727
|
+
finally {
|
|
728
|
+
this.spinnerService.hide();
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetQuestionListComponent, deps: [{ token: i3$1.NgxSpinnerService }, { token: i1.AlertService }, { token: i1$1.MatDialog }, { token: i1.DataManager }], target: i0.ɵɵFactoryTarget.Component });
|
|
734
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetQuestionListComponent, selector: "app-checksheet-question-list", inputs: { checksheet: "checksheet", submission: "submission", disableInput: "disableInput" }, outputs: { checksheetChange: "checksheetChange" }, ngImport: i0, template: "<ng-container *ngIf=\"checksheet?.id\">\n <button\n *ngIf=\"!disableInput\"\n type=\"button\"\n mat-raised-button\n color=\"primary\"\n (click)=\"addQuestion()\"\n class=\"mb-2\"\n >\n Add Question\n </button>\n\n <div\n class=\"d-flex flex-column gap-3 mat-typography scroll-container\"\n infiniteScroll\n [infiniteScrollDistance]=\"1\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [scrollWindow]=\"false\"\n >\n <mat-card\n class=\"d-flex flex-column gap-3\"\n *ngFor=\"let question of questions; let i = index\"\n >\n <div\n class=\"d-flex flex-row gap-3 justify-content-end\"\n *ngIf=\"!disableInput\"\n >\n <mat-icon class=\"cursor-pointer\" (click)=\"deleteQuestion(question)\">\n delete\n </mat-icon>\n <mat-icon class=\"cursor-pointer\" (click)=\"editQuestion(question, i)\">\n edit\n </mat-icon>\n <mat-icon\n class=\"cursor-pointer\"\n *ngIf=\"i > 0\"\n (click)=\"moveQuestionUp(i)\"\n >\n arrow_upward\n </mat-icon>\n <mat-icon\n class=\"cursor-pointer\"\n *ngIf=\"i < questions.length - 1\"\n (click)=\"moveQuestionDown(i)\"\n >\n arrow_downward\n </mat-icon>\n </div>\n\n <div>\n <app-checksheet-question\n [questionInfo]=\"question\"\n [index]=\"i\"\n ></app-checksheet-question>\n </div>\n </mat-card>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"submission?.id\">\n <div fxLayout=\"column\" fxLayoutGap=\"1rem\" class=\"mat-typography\">\n <mat-card\n fxLayout=\"column\"\n fxLayoutGap=\"0.5rem\"\n class=\"w-100\"\n *ngFor=\"let question of submission.format.questions; let i = index\"\n >\n <app-checksheet-question\n [questionInfo]=\"question\"\n [index]=\"i\"\n [submissionView]=\"true\"\n [submissionId]=\"submission.id\"\n [disableInput]=\"disableInput\"\n >\n </app-checksheet-question>\n </mat-card>\n </div>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i9$2.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "component", type: ChecksheetQuestionComponent, selector: "app-checksheet-question", inputs: ["questionInfo", "index", "submissionView", "submissionId", "disableInput", "isWorking"], outputs: ["isWorkingChange"] }] });
|
|
735
|
+
}
|
|
736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetQuestionListComponent, decorators: [{
|
|
737
|
+
type: Component,
|
|
738
|
+
args: [{ selector: 'app-checksheet-question-list', template: "<ng-container *ngIf=\"checksheet?.id\">\n <button\n *ngIf=\"!disableInput\"\n type=\"button\"\n mat-raised-button\n color=\"primary\"\n (click)=\"addQuestion()\"\n class=\"mb-2\"\n >\n Add Question\n </button>\n\n <div\n class=\"d-flex flex-column gap-3 mat-typography scroll-container\"\n infiniteScroll\n [infiniteScrollDistance]=\"1\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [scrollWindow]=\"false\"\n >\n <mat-card\n class=\"d-flex flex-column gap-3\"\n *ngFor=\"let question of questions; let i = index\"\n >\n <div\n class=\"d-flex flex-row gap-3 justify-content-end\"\n *ngIf=\"!disableInput\"\n >\n <mat-icon class=\"cursor-pointer\" (click)=\"deleteQuestion(question)\">\n delete\n </mat-icon>\n <mat-icon class=\"cursor-pointer\" (click)=\"editQuestion(question, i)\">\n edit\n </mat-icon>\n <mat-icon\n class=\"cursor-pointer\"\n *ngIf=\"i > 0\"\n (click)=\"moveQuestionUp(i)\"\n >\n arrow_upward\n </mat-icon>\n <mat-icon\n class=\"cursor-pointer\"\n *ngIf=\"i < questions.length - 1\"\n (click)=\"moveQuestionDown(i)\"\n >\n arrow_downward\n </mat-icon>\n </div>\n\n <div>\n <app-checksheet-question\n [questionInfo]=\"question\"\n [index]=\"i\"\n ></app-checksheet-question>\n </div>\n </mat-card>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"submission?.id\">\n <div fxLayout=\"column\" fxLayoutGap=\"1rem\" class=\"mat-typography\">\n <mat-card\n fxLayout=\"column\"\n fxLayoutGap=\"0.5rem\"\n class=\"w-100\"\n *ngFor=\"let question of submission.format.questions; let i = index\"\n >\n <app-checksheet-question\n [questionInfo]=\"question\"\n [index]=\"i\"\n [submissionView]=\"true\"\n [submissionId]=\"submission.id\"\n [disableInput]=\"disableInput\"\n >\n </app-checksheet-question>\n </mat-card>\n </div>\n</ng-container>\n" }]
|
|
739
|
+
}], ctorParameters: () => [{ type: i3$1.NgxSpinnerService }, { type: i1.AlertService }, { type: i1$1.MatDialog }, { type: i1.DataManager }], propDecorators: { checksheet: [{
|
|
740
|
+
type: Input
|
|
741
|
+
}], checksheetChange: [{
|
|
742
|
+
type: Output
|
|
743
|
+
}], submission: [{
|
|
744
|
+
type: Input
|
|
745
|
+
}], disableInput: [{
|
|
746
|
+
type: Input
|
|
747
|
+
}] } });
|
|
748
|
+
|
|
749
|
+
const errorMessages$3 = {
|
|
750
|
+
title: {
|
|
751
|
+
required: 'The title is required.'
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
class ChecksheetFormComponent {
|
|
755
|
+
formValidatorService;
|
|
756
|
+
fb;
|
|
757
|
+
spinnerService;
|
|
758
|
+
alertService;
|
|
759
|
+
location;
|
|
760
|
+
errorHandler;
|
|
761
|
+
dataManager;
|
|
762
|
+
dialog;
|
|
763
|
+
route;
|
|
764
|
+
checksheetFormatService;
|
|
765
|
+
checksheetForm;
|
|
766
|
+
updateMode;
|
|
767
|
+
checksheet;
|
|
768
|
+
isSaving = false;
|
|
769
|
+
id;
|
|
770
|
+
disableInput;
|
|
771
|
+
isLoading = false;
|
|
772
|
+
constructor(formValidatorService, fb, spinnerService, alertService, location, errorHandler, dataManager, dialog, route, checksheetFormatService) {
|
|
773
|
+
this.formValidatorService = formValidatorService;
|
|
774
|
+
this.fb = fb;
|
|
775
|
+
this.spinnerService = spinnerService;
|
|
776
|
+
this.alertService = alertService;
|
|
777
|
+
this.location = location;
|
|
778
|
+
this.errorHandler = errorHandler;
|
|
779
|
+
this.dataManager = dataManager;
|
|
780
|
+
this.dialog = dialog;
|
|
781
|
+
this.route = route;
|
|
782
|
+
this.checksheetFormatService = checksheetFormatService;
|
|
783
|
+
this.id = parseInt(this.route.snapshot.params?.['checksheetId']);
|
|
784
|
+
this.createForm();
|
|
785
|
+
}
|
|
786
|
+
ngOnInit() {
|
|
787
|
+
if (this.disableInput) {
|
|
788
|
+
this.checksheetForm.disable();
|
|
789
|
+
}
|
|
790
|
+
if (this.id) {
|
|
791
|
+
this.updateMode = true;
|
|
792
|
+
this.loadChecksheetFormat();
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Create a check-sheet form.
|
|
797
|
+
* @private
|
|
798
|
+
*/
|
|
799
|
+
createForm() {
|
|
800
|
+
this.checksheetForm = this.fb.group({
|
|
801
|
+
id: [''],
|
|
802
|
+
title: ['', Validators.required]
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
/**Method to evaluate form fields*/
|
|
806
|
+
isFieldValid(field) {
|
|
807
|
+
return this.formValidatorService.isFieldValid(field, this.checksheetForm);
|
|
808
|
+
}
|
|
809
|
+
/**Method to find error in form fields*/
|
|
810
|
+
getErrorMessage(field) {
|
|
811
|
+
return this.formValidatorService.getErrorMessage(field, this.checksheetForm, errorMessages$3);
|
|
812
|
+
}
|
|
813
|
+
submit() {
|
|
814
|
+
this.checksheetForm.markAllAsTouched();
|
|
815
|
+
if (this.checksheetForm.invalid) {
|
|
816
|
+
this.alertService.addAlert('Please check the form for errors.', 'error');
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const model = { ...this.checksheetForm.value };
|
|
820
|
+
this.isSaving = true;
|
|
821
|
+
let request = this.updateMode
|
|
822
|
+
? this.checksheetFormatService.update(model)
|
|
823
|
+
: this.checksheetFormatService.store(model);
|
|
824
|
+
request.subscribe({
|
|
825
|
+
next: (result) => {
|
|
826
|
+
this.isSaving = false;
|
|
827
|
+
if (!this.updateMode) {
|
|
828
|
+
this.checksheet = result.item;
|
|
829
|
+
this.checksheetForm.patchValue({ ...this.checksheet });
|
|
830
|
+
}
|
|
831
|
+
this.updateMode = true;
|
|
832
|
+
this.alertService.addAlert('Checksheet saved successfully', 'success');
|
|
833
|
+
},
|
|
834
|
+
error: (error) => {
|
|
835
|
+
this.isSaving = false;
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
publishChecksheet() {
|
|
840
|
+
const dialogRef = this.dialog.open(ActionPopupComponent, {
|
|
841
|
+
width: '400px',
|
|
842
|
+
data: {
|
|
843
|
+
title: 'Publish Checksheet',
|
|
844
|
+
message: `Review the checksheet completely before publishing, you cannot alter once it is published. Are you sure to publish the Checksheet?`
|
|
845
|
+
},
|
|
846
|
+
autoFocus: false
|
|
847
|
+
});
|
|
848
|
+
dialogRef.afterClosed().subscribe(async (result) => {
|
|
849
|
+
if (result) {
|
|
850
|
+
//Action confirmed
|
|
851
|
+
try {
|
|
852
|
+
this.spinnerService.show();
|
|
853
|
+
const model = this.checksheetForm.value;
|
|
854
|
+
model.is_published = true;
|
|
855
|
+
const result = await this.dataManager.PUT(`api/checksheet-formats/${model.id}`, model);
|
|
856
|
+
this.alertService.addAlert('Checksheet successfully published', 'success');
|
|
857
|
+
this.location.back();
|
|
858
|
+
}
|
|
859
|
+
catch (error) {
|
|
860
|
+
this.errorHandler.handleError(error, 'Unable to publish checksheet, try later');
|
|
861
|
+
}
|
|
862
|
+
finally {
|
|
863
|
+
this.spinnerService.hide();
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
loadChecksheetFormat() {
|
|
869
|
+
this.isLoading = true;
|
|
870
|
+
const params = { with: 'questions.answers,questions.type' };
|
|
871
|
+
this.checksheetFormatService.show(this.id, params).subscribe({
|
|
872
|
+
next: (result) => {
|
|
873
|
+
this.isLoading = false;
|
|
874
|
+
this.checksheetForm.patchValue(result?.item);
|
|
875
|
+
this.checksheet = result?.item;
|
|
876
|
+
},
|
|
877
|
+
error: () => {
|
|
878
|
+
this.isLoading = false;
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormComponent, deps: [{ token: i1.FormValidatorService }, { token: i2.UntypedFormBuilder }, { token: i3$1.NgxSpinnerService }, { token: i1.AlertService }, { token: i4.Location }, { token: i1.ErrorHandlerService }, { token: i1.DataManager }, { token: i1$1.MatDialog }, { token: i6$2.ActivatedRoute }, { token: ChecksheetFormatService }], target: i0.ɵɵFactoryTarget.Component });
|
|
883
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetFormComponent, selector: "app-checksheet-form", inputs: { disableInput: "disableInput" }, ngImport: i0, template: "<div fxLayout=\"column\" fxLayoutGap=\"0.5rem\">\n <h2>Checksheet Form</h2>\n\n <div\n class=\"d-flex justify-content-start align-items-start gap-3\"\n *ngIf=\"!isLoading\"\n >\n <div style=\"width: calc(70% - 1rem)\" *ngIf=\"checksheet\">\n <app-checksheet-question-list\n class=\"w-100\"\n [(checksheet)]=\"checksheet\"\n [disableInput]=\"disableInput\"\n >\n </app-checksheet-question-list>\n </div>\n <mat-card style=\"width: calc(30% - 1rem)\">\n <mat-card-content>\n <h3>Checksheet Info</h3>\n <form\n [formGroup]=\"checksheetForm\"\n (submit)=\"submit()\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n >\n <mat-form-field>\n <input\n matInput\n formControlName=\"title\"\n placeholder=\"Title\"\n autocomplete=\"off\"\n required\n />\n <mat-error *ngIf=\"isFieldValid('title')\">\n {{ getErrorMessage('title') }}\n </mat-error>\n </mat-form-field>\n\n <div\n class=\"my-2\"\n fxLayout=\"row\"\n fxLayoutGap=\"15px\"\n fxLayoutAlign=\"end\"\n *ngIf=\"!disableInput\"\n >\n <button\n [disabled]=\"isSaving\"\n mat-flat-button\n type=\"button\"\n (click)=\"location.back()\"\n >\n Cancel\n </button>\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"submit\"\n color=\"primary\"\n >\n Save\n </button>\n\n <button\n mat-raised-button\n [disabled]=\"isSaving\"\n color=\"accent\"\n *ngIf=\"updateMode\"\n type=\"button\"\n (click)=\"publishChecksheet()\"\n >\n Publish\n </button>\n </div>\n </form>\n </mat-card-content>\n </mat-card>\n </div>\n\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isLoading\"></mat-progress-bar>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i7.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i8$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: ChecksheetQuestionListComponent, selector: "app-checksheet-question-list", inputs: ["checksheet", "submission", "disableInput"], outputs: ["checksheetChange"] }] });
|
|
884
|
+
}
|
|
885
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormComponent, decorators: [{
|
|
886
|
+
type: Component,
|
|
887
|
+
args: [{ selector: 'app-checksheet-form', template: "<div fxLayout=\"column\" fxLayoutGap=\"0.5rem\">\n <h2>Checksheet Form</h2>\n\n <div\n class=\"d-flex justify-content-start align-items-start gap-3\"\n *ngIf=\"!isLoading\"\n >\n <div style=\"width: calc(70% - 1rem)\" *ngIf=\"checksheet\">\n <app-checksheet-question-list\n class=\"w-100\"\n [(checksheet)]=\"checksheet\"\n [disableInput]=\"disableInput\"\n >\n </app-checksheet-question-list>\n </div>\n <mat-card style=\"width: calc(30% - 1rem)\">\n <mat-card-content>\n <h3>Checksheet Info</h3>\n <form\n [formGroup]=\"checksheetForm\"\n (submit)=\"submit()\"\n fxLayout=\"column\"\n fxLayoutGap=\"0.25rem\"\n >\n <mat-form-field>\n <input\n matInput\n formControlName=\"title\"\n placeholder=\"Title\"\n autocomplete=\"off\"\n required\n />\n <mat-error *ngIf=\"isFieldValid('title')\">\n {{ getErrorMessage('title') }}\n </mat-error>\n </mat-form-field>\n\n <div\n class=\"my-2\"\n fxLayout=\"row\"\n fxLayoutGap=\"15px\"\n fxLayoutAlign=\"end\"\n *ngIf=\"!disableInput\"\n >\n <button\n [disabled]=\"isSaving\"\n mat-flat-button\n type=\"button\"\n (click)=\"location.back()\"\n >\n Cancel\n </button>\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"submit\"\n color=\"primary\"\n >\n Save\n </button>\n\n <button\n mat-raised-button\n [disabled]=\"isSaving\"\n color=\"accent\"\n *ngIf=\"updateMode\"\n type=\"button\"\n (click)=\"publishChecksheet()\"\n >\n Publish\n </button>\n </div>\n </form>\n </mat-card-content>\n </mat-card>\n </div>\n\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isLoading\"></mat-progress-bar>\n</div>\n" }]
|
|
888
|
+
}], ctorParameters: () => [{ type: i1.FormValidatorService }, { type: i2.UntypedFormBuilder }, { type: i3$1.NgxSpinnerService }, { type: i1.AlertService }, { type: i4.Location }, { type: i1.ErrorHandlerService }, { type: i1.DataManager }, { type: i1$1.MatDialog }, { type: i6$2.ActivatedRoute }, { type: ChecksheetFormatService }], propDecorators: { disableInput: [{
|
|
889
|
+
type: Input
|
|
890
|
+
}] } });
|
|
891
|
+
|
|
892
|
+
class ChecksheetFormatListComponent extends TechlifyListingControllerInterface {
|
|
893
|
+
dialog;
|
|
894
|
+
service;
|
|
895
|
+
alertService;
|
|
896
|
+
displayedColumns = [
|
|
897
|
+
'index',
|
|
898
|
+
'title',
|
|
899
|
+
'questions',
|
|
900
|
+
'submissions',
|
|
901
|
+
'is_published',
|
|
902
|
+
'actions'
|
|
903
|
+
];
|
|
904
|
+
constructor(dialog, service, alertService) {
|
|
905
|
+
super();
|
|
906
|
+
this.dialog = dialog;
|
|
907
|
+
this.service = service;
|
|
908
|
+
this.alertService = alertService;
|
|
909
|
+
}
|
|
910
|
+
ngOnInit() {
|
|
911
|
+
this.loadData();
|
|
912
|
+
}
|
|
913
|
+
deactivateChecksheet(checksheet) {
|
|
914
|
+
const dialogRef = this.dialog.open(ActionPopupComponent, {
|
|
915
|
+
width: '400px',
|
|
916
|
+
data: {
|
|
917
|
+
title: 'Deactivate Checksheet',
|
|
918
|
+
message: `Are you sure to proceed deactivate the ${checksheet.title}?`
|
|
919
|
+
},
|
|
920
|
+
autoFocus: false
|
|
921
|
+
});
|
|
922
|
+
dialogRef.afterClosed().subscribe(async (result) => {
|
|
923
|
+
if (result) {
|
|
924
|
+
this.service.delete(checksheet).subscribe({
|
|
925
|
+
next: () => {
|
|
926
|
+
this.alertService.addAlert('Checksheet deactivated successfully!', 'success');
|
|
927
|
+
this.models = this.models.filter((x) => x.id !== checksheet.id);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
copyChecksheet(checksheet) {
|
|
934
|
+
const dialogRef = this.dialog.open(ActionPopupComponent, {
|
|
935
|
+
width: '400px',
|
|
936
|
+
data: {
|
|
937
|
+
title: 'Copy Checksheet',
|
|
938
|
+
message: `Are you sure to proceed copy the ${checksheet.title}?`
|
|
939
|
+
},
|
|
940
|
+
autoFocus: false
|
|
941
|
+
});
|
|
942
|
+
dialogRef.afterClosed().subscribe(async (result) => {
|
|
943
|
+
if (result) {
|
|
944
|
+
this.service.copy(checksheet).subscribe({
|
|
945
|
+
next: () => {
|
|
946
|
+
this.alertService.addAlert('Checksheet copied successfully!', 'success');
|
|
947
|
+
this.reload();
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
unpublishChecksheet(checksheet) {
|
|
954
|
+
const dialogRef = this.dialog.open(ActionPopupComponent, {
|
|
955
|
+
width: '400px',
|
|
956
|
+
data: {
|
|
957
|
+
title: 'Unpublish Checksheet',
|
|
958
|
+
message: `Are you sure to unpublish the format ${checksheet.title}?
|
|
959
|
+
This checksheet format would no longer be available to team members to create submissions for. `
|
|
960
|
+
},
|
|
961
|
+
autoFocus: false
|
|
962
|
+
});
|
|
963
|
+
dialogRef.afterClosed().subscribe(async (result) => {
|
|
964
|
+
if (result) {
|
|
965
|
+
this.service.unpublish(checksheet).subscribe({
|
|
966
|
+
next: () => {
|
|
967
|
+
this.alertService.addAlert('Checksheet unpublished successfully!', 'success');
|
|
968
|
+
this.reload();
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
loadData() {
|
|
975
|
+
this.isWorking = true;
|
|
976
|
+
const params = {
|
|
977
|
+
sort_by: 'created_at|DESC',
|
|
978
|
+
withCount: 'questions,submissions',
|
|
979
|
+
page: this.page,
|
|
980
|
+
perPage: this.perPage,
|
|
981
|
+
};
|
|
982
|
+
this.service.index(params).subscribe({
|
|
983
|
+
next: (response) => {
|
|
984
|
+
this.models = this.models?.concat(response?.data);
|
|
985
|
+
this.lastPage = response?.last_page;
|
|
986
|
+
this.isWorking = false;
|
|
987
|
+
},
|
|
988
|
+
error: () => {
|
|
989
|
+
this.isWorking = false;
|
|
990
|
+
},
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatListComponent, deps: [{ token: i1$1.MatDialog }, { token: ChecksheetFormatService }, { token: i1.AlertService }], target: i0.ɵɵFactoryTarget.Component });
|
|
994
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetFormatListComponent, selector: "app-checksheet-format-list", usesInheritance: true, ngImport: i0, template: "<mat-card>\n <mat-card-content>\n <div class=\"d-flex justify-content-start align-items-center gap-2\">\n <h3 class=\"mb-0\">Checksheet Formats</h3>\n <a [routerLink]=\"['../checksheet-form']\" class=\"text-decoration-none text-dark mt-2\">\n <mat-icon>add</mat-icon>\n </a>\n </div>\n </mat-card-content>\n</mat-card>\n\n<mat-card class=\"mt-3\">\n <mat-card-content class=\"p-0\">\n <table\n mat-table [dataSource]=\"models\" class=\"w-100\"\n infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\" (scrolled)=\"onScroll()\"\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = index\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Title Column -->\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef>Title</th>\n <td mat-cell *matCellDef=\"let element\">{{ element.title }} <br /></td>\n </ng-container>\n\n <!-- Questions Column -->\n <ng-container matColumnDef=\"questions\">\n <th mat-header-cell *matHeaderCellDef>Questions</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.questions_count }}\n </td>\n </ng-container>\n\n <!-- Submissions Column -->\n <ng-container matColumnDef=\"submissions\">\n <th mat-header-cell *matHeaderCellDef>Submissions</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.submissions_count }}\n </td>\n </ng-container>\n\n <!-- is Published Column -->\n <ng-container matColumnDef=\"is_published\">\n <th mat-header-cell *matHeaderCellDef>Published</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.is_published ? 'Yes' : 'No' }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element\">\n <div class=\"d-flex justify-content-start align-items-center gap-2\">\n <a\n [routerLink]=\"['../checksheet-view/', element?.id]\"\n class=\"text-decoration-none text-dark\"\n >\n <mat-icon>search</mat-icon>\n </a>\n\n <a\n *ngIf=\"!element.is_published\"\n [routerLink]=\"['../checksheet-form/', element?.id]\"\n class=\"text-decoration-none text-dark\"\n >\n <mat-icon>edit</mat-icon>\n </a>\n\n <mat-icon\n class=\"cursor-pointer text-dark\"\n *ngIf=\"!element.submissions_count\"\n (click)=\"$event.stopPropagation(); deactivateChecksheet(element)\"\n >\n delete\n </mat-icon>\n\n <a\n *ngIf=\"!element.is_published\"\n [routerLink]=\"['../checksheet-view/', element?.id]\"\n (click)=\"$event.stopPropagation(); copyChecksheet(element)\"\n class=\"text-decoration-none text-dark\"\n matTooltip=\"Copy\"\n >\n <mat-icon>content_copy</mat-icon>\n </a>\n\n <mat-icon\n class=\"cursor-pointer text-dark\"\n *ngIf=\"element.is_published\"\n (click)=\"$event.stopPropagation(); unpublishChecksheet(element)\"\n matTooltip=\"Unpublish\"\n >\n unpublished\n </mat-icon>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isWorking\"></mat-progress-bar>\n </mat-card-content>\n</mat-card>\n", styles: [".scroll-container{max-height:800px;overflow-y:auto}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i7.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i6$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i6$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i6$3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: i9$2.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }] });
|
|
995
|
+
}
|
|
996
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormatListComponent, decorators: [{
|
|
997
|
+
type: Component,
|
|
998
|
+
args: [{ selector: 'app-checksheet-format-list', template: "<mat-card>\n <mat-card-content>\n <div class=\"d-flex justify-content-start align-items-center gap-2\">\n <h3 class=\"mb-0\">Checksheet Formats</h3>\n <a [routerLink]=\"['../checksheet-form']\" class=\"text-decoration-none text-dark mt-2\">\n <mat-icon>add</mat-icon>\n </a>\n </div>\n </mat-card-content>\n</mat-card>\n\n<mat-card class=\"mt-3\">\n <mat-card-content class=\"p-0\">\n <table\n mat-table [dataSource]=\"models\" class=\"w-100\"\n infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\" (scrolled)=\"onScroll()\"\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = index\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Title Column -->\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef>Title</th>\n <td mat-cell *matCellDef=\"let element\">{{ element.title }} <br /></td>\n </ng-container>\n\n <!-- Questions Column -->\n <ng-container matColumnDef=\"questions\">\n <th mat-header-cell *matHeaderCellDef>Questions</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.questions_count }}\n </td>\n </ng-container>\n\n <!-- Submissions Column -->\n <ng-container matColumnDef=\"submissions\">\n <th mat-header-cell *matHeaderCellDef>Submissions</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.submissions_count }}\n </td>\n </ng-container>\n\n <!-- is Published Column -->\n <ng-container matColumnDef=\"is_published\">\n <th mat-header-cell *matHeaderCellDef>Published</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.is_published ? 'Yes' : 'No' }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element\">\n <div class=\"d-flex justify-content-start align-items-center gap-2\">\n <a\n [routerLink]=\"['../checksheet-view/', element?.id]\"\n class=\"text-decoration-none text-dark\"\n >\n <mat-icon>search</mat-icon>\n </a>\n\n <a\n *ngIf=\"!element.is_published\"\n [routerLink]=\"['../checksheet-form/', element?.id]\"\n class=\"text-decoration-none text-dark\"\n >\n <mat-icon>edit</mat-icon>\n </a>\n\n <mat-icon\n class=\"cursor-pointer text-dark\"\n *ngIf=\"!element.submissions_count\"\n (click)=\"$event.stopPropagation(); deactivateChecksheet(element)\"\n >\n delete\n </mat-icon>\n\n <a\n *ngIf=\"!element.is_published\"\n [routerLink]=\"['../checksheet-view/', element?.id]\"\n (click)=\"$event.stopPropagation(); copyChecksheet(element)\"\n class=\"text-decoration-none text-dark\"\n matTooltip=\"Copy\"\n >\n <mat-icon>content_copy</mat-icon>\n </a>\n\n <mat-icon\n class=\"cursor-pointer text-dark\"\n *ngIf=\"element.is_published\"\n (click)=\"$event.stopPropagation(); unpublishChecksheet(element)\"\n matTooltip=\"Unpublish\"\n >\n unpublished\n </mat-icon>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isWorking\"></mat-progress-bar>\n </mat-card-content>\n</mat-card>\n", styles: [".scroll-container{max-height:800px;overflow-y:auto}\n"] }]
|
|
999
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialog }, { type: ChecksheetFormatService }, { type: i1.AlertService }] });
|
|
1000
|
+
|
|
1001
|
+
class ChecksheetService extends TechlifyServiceBaseClass {
|
|
1002
|
+
dataManager;
|
|
1003
|
+
constructor(httpService, dataManager) {
|
|
1004
|
+
super(httpService, 'checksheets');
|
|
1005
|
+
this.dataManager = dataManager;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Sent request to submit the Checksheet.
|
|
1009
|
+
*
|
|
1010
|
+
* @param submissionId
|
|
1011
|
+
* @param params
|
|
1012
|
+
*/
|
|
1013
|
+
submit(submissionId, params) {
|
|
1014
|
+
return this.http.put('api/checksheets/' + submissionId + '/submit', {}, { params });
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Send request to submit the Checksheet review.
|
|
1018
|
+
*
|
|
1019
|
+
* @param submissionId
|
|
1020
|
+
* @param params
|
|
1021
|
+
*/
|
|
1022
|
+
review(submissionId, params) {
|
|
1023
|
+
return this.http.put('api/checksheets/' + submissionId + '/review', {}, { params });
|
|
1024
|
+
}
|
|
1025
|
+
async getMechanicalIssues(submissionId) {
|
|
1026
|
+
return this.dataManager.GET(`api/checksheets/` + submissionId + `/mechanical-issues`);
|
|
1027
|
+
}
|
|
1028
|
+
async createMechanicalIssues(submissionId, data) {
|
|
1029
|
+
return this.dataManager.POST(`api/checksheets/` + submissionId + `/mechanical-issues`, data);
|
|
1030
|
+
}
|
|
1031
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetService, deps: [{ token: i1.HttpService }, { token: i1.DataManager }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1032
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetService, providedIn: 'root' });
|
|
1033
|
+
}
|
|
1034
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetService, decorators: [{
|
|
1035
|
+
type: Injectable,
|
|
1036
|
+
args: [{
|
|
1037
|
+
providedIn: 'root'
|
|
1038
|
+
}]
|
|
1039
|
+
}], ctorParameters: () => [{ type: i1.HttpService }, { type: i1.DataManager }] });
|
|
1040
|
+
|
|
1041
|
+
class ChecksheetSubmissionFormComponent extends TechlifyFormComponentInterface {
|
|
1042
|
+
fb;
|
|
1043
|
+
checksheetSubmissionService;
|
|
1044
|
+
alertService;
|
|
1045
|
+
dialog;
|
|
1046
|
+
submittableType;
|
|
1047
|
+
submittableId;
|
|
1048
|
+
cancelled = new EventEmitter();
|
|
1049
|
+
saved = new EventEmitter();
|
|
1050
|
+
updateMode;
|
|
1051
|
+
checksheetSubmission;
|
|
1052
|
+
isSaving = false;
|
|
1053
|
+
constructor(formValidatorService, fb, checksheetSubmissionService, alertService, dialog) {
|
|
1054
|
+
super(formValidatorService);
|
|
1055
|
+
this.fb = fb;
|
|
1056
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
1057
|
+
this.alertService = alertService;
|
|
1058
|
+
this.dialog = dialog;
|
|
1059
|
+
this.errorMessages = {
|
|
1060
|
+
date: {
|
|
1061
|
+
required: 'The date field is required.'
|
|
1062
|
+
},
|
|
1063
|
+
format_id: {
|
|
1064
|
+
required: 'The checksheet format is required.'
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
this.createForm();
|
|
1068
|
+
}
|
|
1069
|
+
createForm() {
|
|
1070
|
+
this.form = this.fb.group({
|
|
1071
|
+
id: [''],
|
|
1072
|
+
date: ['', Validators.compose([Validators.required, DateValidator()])],
|
|
1073
|
+
format_id: ['', Validators.required],
|
|
1074
|
+
submittable_type: ['fixed-asset'],
|
|
1075
|
+
submittable_id: ['', Validators.required],
|
|
1076
|
+
details: ['']
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
ngOnInit() {
|
|
1080
|
+
// Set the submittable type and id and make it readonly
|
|
1081
|
+
if (this.submittableType && this.submittableId) {
|
|
1082
|
+
this.form.patchValue({
|
|
1083
|
+
submittable_type: this.submittableType,
|
|
1084
|
+
submittable_id: this.submittableId
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
// Set the Checksheet to form
|
|
1088
|
+
if (this.checksheetSubmission) {
|
|
1089
|
+
this.updateMode = true;
|
|
1090
|
+
this.form.patchValue({
|
|
1091
|
+
...this.checksheetSubmission,
|
|
1092
|
+
date: new Date(this.checksheetSubmission?.date)
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
submit() {
|
|
1097
|
+
if (this.form.invalid) {
|
|
1098
|
+
this.alertService.addAlert('Please check the form for errors', 'error');
|
|
1099
|
+
}
|
|
1100
|
+
const data = { ...this.form.value };
|
|
1101
|
+
const request = this.updateMode
|
|
1102
|
+
? this.checksheetSubmissionService.update(data)
|
|
1103
|
+
: this.checksheetSubmissionService.store(data);
|
|
1104
|
+
this.isSaving = true;
|
|
1105
|
+
request.subscribe({
|
|
1106
|
+
next: (response) => {
|
|
1107
|
+
this.isSaving = false;
|
|
1108
|
+
this.saved.emit(response?.item);
|
|
1109
|
+
},
|
|
1110
|
+
error: () => {
|
|
1111
|
+
this.isSaving = false;
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
submitChecksheet() {
|
|
1116
|
+
const dialogRef = this.dialog.open(ActionPopupComponent, {
|
|
1117
|
+
width: '400px',
|
|
1118
|
+
data: {
|
|
1119
|
+
title: 'Submit Checksheet',
|
|
1120
|
+
message: `Review the checksheet completely before submitting, you cannot alter once it is submitted. Are you sure to submit the Checksheet?`
|
|
1121
|
+
},
|
|
1122
|
+
autoFocus: false
|
|
1123
|
+
});
|
|
1124
|
+
dialogRef.afterClosed().subscribe(async (result) => {
|
|
1125
|
+
if (result) {
|
|
1126
|
+
// Action confirmed
|
|
1127
|
+
this.checksheetSubmissionService
|
|
1128
|
+
.submit(this.checksheetSubmission?.id)
|
|
1129
|
+
.subscribe({
|
|
1130
|
+
next: (response) => {
|
|
1131
|
+
this.alertService.addAlert('The Checksheet submitted!', 'success');
|
|
1132
|
+
this.saved.emit(response?.item);
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFormComponent, deps: [{ token: i1.FormValidatorService }, { token: i2.UntypedFormBuilder }, { token: ChecksheetService }, { token: i1.AlertService }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
1139
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionFormComponent, selector: "app-checksheet-submission-form", inputs: { submittableType: "submittableType", submittableId: "submittableId", checksheetSubmission: "checksheetSubmission" }, outputs: { cancelled: "cancelled", saved: "saved" }, usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\n <div fxLayout=\"column\" class=\"mat-typography\">\n <h3>Checksheet</h3>\n\n <mat-form-field>\n <mat-label>Date</mat-label>\n <input\n matInput\n [matDatepicker]=\"picker\"\n placeholder=\"Date (MM/DD/YYYY)\"\n formControlName=\"date\"\n autocomplete=\"off\"\n required\n (focus)=\"picker.open()\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n <mat-error *ngIf=\"isFieldValid('date')\"\n >{{ getErrorMessage('date') }}\n </mat-error>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet Format</mat-label>\n <app-searchable-selector\n formControlName=\"format_id\"\n apiUrl=\"api/checksheet-formats?is_published=1\"\n [enableSearch]=\"true\"\n >\n </app-searchable-selector>\n <mat-error *ngIf=\"isFieldValid('format_id')\"\n >{{ getErrorMessage('format_id') }}\n </mat-error>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet For</mat-label>\n <mat-select formControlName=\"submittable_type\">\n <mat-option value=\"fixed-asset\">Fixed Asset</mat-option>\n </mat-select>\n </mat-form-field>\n\n <mat-form-field\n *ngIf=\"form.get('submittable_type')?.value === 'fixed-asset'\"\n >\n <mat-label>Fixed Asset</mat-label>\n <app-searchable-selector\n apiUrl=\"api/accounting-plus/fixed-assets\"\n titleField=\"name\"\n formControlName=\"submittable_id\"\n ></app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Details</mat-label>\n <textarea\n matInput\n placeholder=\"Details\"\n formControlName=\"details\"\n ></textarea>\n </mat-form-field>\n <div class=\"d-flex justify-content-end align-items-center gap-2\">\n <button\n [disabled]=\"isSaving\"\n mat-flat-button\n type=\"button\"\n (click)=\"cancelled.emit()\"\n >\n Cancel\n </button>\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"submit\"\n color=\"primary\"\n >\n Save\n </button>\n <button\n *ngIf=\"checksheetSubmission?.id\"\n [disabled]=\"isSaving\"\n mat-raised-button\n (click)=\"submitChecksheet()\"\n type=\"button\"\n color=\"accent\"\n >\n Submit\n </button>\n </div>\n </div>\n</form>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "component", type: i7$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i9.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i9.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i9.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i10.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i12$1.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i1.SearchableSelectorComponent, selector: "app-searchable-selector", inputs: ["valueField", "titleField", "subtitleField", "apiUrl", "multiple", "selectedValue", "enableSearch", "add", "addConfig", "edit", "editConfig", "sort", "sortBy", "searchField", "itemComponent", "items", "apiDataProperty", "cache", "perPage", "inDataSearch", "panelWidth", "focusSearchOnOpen", "required", "disabled", "value"], outputs: ["selectedValueChange", "selectionChange", "itemsChange"] }] });
|
|
1140
|
+
}
|
|
1141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFormComponent, decorators: [{
|
|
1142
|
+
type: Component,
|
|
1143
|
+
args: [{ selector: 'app-checksheet-submission-form', template: "<form [formGroup]=\"form\" (submit)=\"submit()\">\n <div fxLayout=\"column\" class=\"mat-typography\">\n <h3>Checksheet</h3>\n\n <mat-form-field>\n <mat-label>Date</mat-label>\n <input\n matInput\n [matDatepicker]=\"picker\"\n placeholder=\"Date (MM/DD/YYYY)\"\n formControlName=\"date\"\n autocomplete=\"off\"\n required\n (focus)=\"picker.open()\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n <mat-error *ngIf=\"isFieldValid('date')\"\n >{{ getErrorMessage('date') }}\n </mat-error>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet Format</mat-label>\n <app-searchable-selector\n formControlName=\"format_id\"\n apiUrl=\"api/checksheet-formats?is_published=1\"\n [enableSearch]=\"true\"\n >\n </app-searchable-selector>\n <mat-error *ngIf=\"isFieldValid('format_id')\"\n >{{ getErrorMessage('format_id') }}\n </mat-error>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet For</mat-label>\n <mat-select formControlName=\"submittable_type\">\n <mat-option value=\"fixed-asset\">Fixed Asset</mat-option>\n </mat-select>\n </mat-form-field>\n\n <mat-form-field\n *ngIf=\"form.get('submittable_type')?.value === 'fixed-asset'\"\n >\n <mat-label>Fixed Asset</mat-label>\n <app-searchable-selector\n apiUrl=\"api/accounting-plus/fixed-assets\"\n titleField=\"name\"\n formControlName=\"submittable_id\"\n ></app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Details</mat-label>\n <textarea\n matInput\n placeholder=\"Details\"\n formControlName=\"details\"\n ></textarea>\n </mat-form-field>\n <div class=\"d-flex justify-content-end align-items-center gap-2\">\n <button\n [disabled]=\"isSaving\"\n mat-flat-button\n type=\"button\"\n (click)=\"cancelled.emit()\"\n >\n Cancel\n </button>\n <button\n [disabled]=\"isSaving\"\n mat-raised-button\n type=\"submit\"\n color=\"primary\"\n >\n Save\n </button>\n <button\n *ngIf=\"checksheetSubmission?.id\"\n [disabled]=\"isSaving\"\n mat-raised-button\n (click)=\"submitChecksheet()\"\n type=\"button\"\n color=\"accent\"\n >\n Submit\n </button>\n </div>\n </div>\n</form>\n" }]
|
|
1144
|
+
}], ctorParameters: () => [{ type: i1.FormValidatorService }, { type: i2.UntypedFormBuilder }, { type: ChecksheetService }, { type: i1.AlertService }, { type: i1$1.MatDialog }], propDecorators: { submittableType: [{
|
|
1145
|
+
type: Input
|
|
1146
|
+
}], submittableId: [{
|
|
1147
|
+
type: Input
|
|
1148
|
+
}], cancelled: [{
|
|
1149
|
+
type: Output
|
|
1150
|
+
}], saved: [{
|
|
1151
|
+
type: Output
|
|
1152
|
+
}], checksheetSubmission: [{
|
|
1153
|
+
type: Input
|
|
1154
|
+
}] } });
|
|
1155
|
+
|
|
1156
|
+
const errorMessages$2 = {
|
|
1157
|
+
date_from: {
|
|
1158
|
+
required: 'Start date is required',
|
|
1159
|
+
invalidDate: 'Invalid date'
|
|
1160
|
+
},
|
|
1161
|
+
date_to: {
|
|
1162
|
+
required: 'End date is required',
|
|
1163
|
+
invalidDate: 'Invalid date'
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
let ChecksheetReportComponent = class ChecksheetReportComponent {
|
|
1167
|
+
spinnerService;
|
|
1168
|
+
alertService;
|
|
1169
|
+
router;
|
|
1170
|
+
dataManager;
|
|
1171
|
+
currentUserService;
|
|
1172
|
+
dialog;
|
|
1173
|
+
formValidator;
|
|
1174
|
+
fb;
|
|
1175
|
+
datePipe;
|
|
1176
|
+
checksheetSubmissionList = [];
|
|
1177
|
+
pageEvent = { page: 1, perPage: 25, lastPage: 1 };
|
|
1178
|
+
filters;
|
|
1179
|
+
vehicle;
|
|
1180
|
+
displayedColumns = [
|
|
1181
|
+
'index',
|
|
1182
|
+
'date',
|
|
1183
|
+
'vehicle',
|
|
1184
|
+
'created_at',
|
|
1185
|
+
'reviewer.name',
|
|
1186
|
+
'mechanical_issues',
|
|
1187
|
+
'notes'
|
|
1188
|
+
];
|
|
1189
|
+
filterFormGroup;
|
|
1190
|
+
constructor(spinnerService, alertService, router, dataManager, currentUserService, dialog, formValidator, fb, datePipe) {
|
|
1191
|
+
this.spinnerService = spinnerService;
|
|
1192
|
+
this.alertService = alertService;
|
|
1193
|
+
this.router = router;
|
|
1194
|
+
this.dataManager = dataManager;
|
|
1195
|
+
this.currentUserService = currentUserService;
|
|
1196
|
+
this.dialog = dialog;
|
|
1197
|
+
this.formValidator = formValidator;
|
|
1198
|
+
this.fb = fb;
|
|
1199
|
+
this.datePipe = datePipe;
|
|
1200
|
+
this.filters = {};
|
|
1201
|
+
this.filters.sort_by = 'created_at|DESC';
|
|
1202
|
+
this.createForm();
|
|
1203
|
+
}
|
|
1204
|
+
get excelData() {
|
|
1205
|
+
if (this.checksheetSubmissionList.length <= 0) {
|
|
1206
|
+
return [];
|
|
1207
|
+
}
|
|
1208
|
+
return this.checksheetSubmissionList.map((item) => {
|
|
1209
|
+
return {
|
|
1210
|
+
Date: item?.date ? new Date(item?.date).toDateString() : '',
|
|
1211
|
+
Vehicle: item?.vehicle?.title_field,
|
|
1212
|
+
Driver: item?.creator?.name,
|
|
1213
|
+
'Time Submitted': item?.created_at
|
|
1214
|
+
? this.datePipe.transform(new Date(item?.created_at), 'yyyy-MM-dd HH:mm')
|
|
1215
|
+
: '',
|
|
1216
|
+
'Verified By ': item?.reviewer?.name,
|
|
1217
|
+
'Mechanical Issues': (item?.mechanical_issues || []).reduce((a, v) => `${a}${v?.details_without_html}, `, ''),
|
|
1218
|
+
Notes: item?.comments
|
|
1219
|
+
};
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
ngOnInit() {
|
|
1223
|
+
this.filterFormGroup.valueChanges
|
|
1224
|
+
.pipe(debounceTime(500), untilDestroyed(this))
|
|
1225
|
+
.subscribe((x) => {
|
|
1226
|
+
let model = this.filterFormGroup.value;
|
|
1227
|
+
model.date_from = model.date_from
|
|
1228
|
+
? this.datePipe.transform(model.date_from, 'yyyy-MM-dd')
|
|
1229
|
+
: '';
|
|
1230
|
+
model.date_to = model.date_to
|
|
1231
|
+
? this.datePipe.transform(model.date_to, 'yyyy-MM-dd')
|
|
1232
|
+
: '';
|
|
1233
|
+
this.filters = { ...this.filters, ...model };
|
|
1234
|
+
this.reload();
|
|
1235
|
+
});
|
|
1236
|
+
this.fetchChecksheetSubmissionsDetails();
|
|
1237
|
+
}
|
|
1238
|
+
createForm() {
|
|
1239
|
+
this.filterFormGroup = this.fb.group({
|
|
1240
|
+
date_from: ['', Validators.compose([DateValidator()])],
|
|
1241
|
+
date_to: ['', Validators.compose([DateValidator()])],
|
|
1242
|
+
status_id: [''],
|
|
1243
|
+
model_id: [''],
|
|
1244
|
+
creator_id: [''],
|
|
1245
|
+
reviewer_id: [''],
|
|
1246
|
+
checksheet_format_id: [''],
|
|
1247
|
+
driver_assigned_customer_id: [''],
|
|
1248
|
+
vehicle_assigned_customer_id: ['']
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
get currentUserId() {
|
|
1252
|
+
return this.currentUserService.getUser().id;
|
|
1253
|
+
}
|
|
1254
|
+
createChecksheetSubmission() {
|
|
1255
|
+
const dialogRef = this.dialog.open(ChecksheetSubmissionFormComponent, {
|
|
1256
|
+
width: '400px',
|
|
1257
|
+
data: {
|
|
1258
|
+
submission: {},
|
|
1259
|
+
vehicle: this.vehicle
|
|
1260
|
+
},
|
|
1261
|
+
autoFocus: false
|
|
1262
|
+
});
|
|
1263
|
+
dialogRef.afterClosed().subscribe((result) => {
|
|
1264
|
+
if (result) {
|
|
1265
|
+
//Action confirmed
|
|
1266
|
+
this.editChecksheetSubmission(result);
|
|
1267
|
+
}
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
deactivateChecksheetSubmission(checksheetSubmission) {
|
|
1271
|
+
const dialogRef = this.dialog.open(ActionPopupComponent, {
|
|
1272
|
+
width: '400px',
|
|
1273
|
+
data: {
|
|
1274
|
+
title: 'Deactivate Submissions',
|
|
1275
|
+
message: `Are you sure to proceed deactivate?`
|
|
1276
|
+
},
|
|
1277
|
+
autoFocus: false
|
|
1278
|
+
});
|
|
1279
|
+
dialogRef.afterClosed().subscribe(async (result) => {
|
|
1280
|
+
if (result) {
|
|
1281
|
+
//Action confirmed
|
|
1282
|
+
try {
|
|
1283
|
+
this.spinnerService.show();
|
|
1284
|
+
await this.dataManager.DELETE(`api/checksheets/${checksheetSubmission.id}`);
|
|
1285
|
+
this.checksheetSubmissionList = this.checksheetSubmissionList.filter((x) => x.id !== checksheetSubmission.id);
|
|
1286
|
+
}
|
|
1287
|
+
catch (error) {
|
|
1288
|
+
this.alertService.addAlert('Unable to deactivate Checksheet, try later', 'warn');
|
|
1289
|
+
}
|
|
1290
|
+
finally {
|
|
1291
|
+
this.spinnerService.hide();
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
editChecksheetSubmission(checksheetSubmission) {
|
|
1297
|
+
this.router.navigate([
|
|
1298
|
+
'vehicles/checksheets/checksheets/view',
|
|
1299
|
+
checksheetSubmission.id
|
|
1300
|
+
], { queryParams: { is_vehicle_view: true } });
|
|
1301
|
+
}
|
|
1302
|
+
viewChecksheetSubmission(checksheetSubmission) {
|
|
1303
|
+
this.router.navigate([
|
|
1304
|
+
'vehicles/checksheets/checksheets-view',
|
|
1305
|
+
checksheetSubmission.id
|
|
1306
|
+
]);
|
|
1307
|
+
}
|
|
1308
|
+
reviewChecksheetSubmission(checksheetSubmission) {
|
|
1309
|
+
this.router.navigate([
|
|
1310
|
+
'vehicles/checksheets/checksheets/review',
|
|
1311
|
+
checksheetSubmission.id
|
|
1312
|
+
]);
|
|
1313
|
+
}
|
|
1314
|
+
onScroll() {
|
|
1315
|
+
if (this.pageEvent.page < this.pageEvent.lastPage) {
|
|
1316
|
+
this.pageEvent.page += 1;
|
|
1317
|
+
}
|
|
1318
|
+
this.fetchChecksheetSubmissionsDetails();
|
|
1319
|
+
}
|
|
1320
|
+
async fetchChecksheetSubmissionsDetails() {
|
|
1321
|
+
this.spinnerService.show();
|
|
1322
|
+
if (this.vehicle) {
|
|
1323
|
+
this.filters.model_id = this.vehicle.id;
|
|
1324
|
+
}
|
|
1325
|
+
try {
|
|
1326
|
+
const result = await this.dataManager.GET(`api/checksheets`, {
|
|
1327
|
+
...this.pageEvent,
|
|
1328
|
+
...this.filters
|
|
1329
|
+
});
|
|
1330
|
+
this.checksheetSubmissionList = this.checksheetSubmissionList.concat(result.data);
|
|
1331
|
+
this.pageEvent.page = result.current_page;
|
|
1332
|
+
this.pageEvent.lastPage = result.last_page;
|
|
1333
|
+
}
|
|
1334
|
+
catch (error) {
|
|
1335
|
+
this.alertService.addAlert('Unable to get Checksheets, try later', 'warn');
|
|
1336
|
+
}
|
|
1337
|
+
finally {
|
|
1338
|
+
this.spinnerService.hide();
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
reload() {
|
|
1342
|
+
this.pageEvent = { page: 1, perPage: 25, lastPage: 1 };
|
|
1343
|
+
this.checksheetSubmissionList = [];
|
|
1344
|
+
this.fetchChecksheetSubmissionsDetails();
|
|
1345
|
+
}
|
|
1346
|
+
getFieldValue(field) {
|
|
1347
|
+
return this.filterFormGroup.get(field)?.value;
|
|
1348
|
+
}
|
|
1349
|
+
resetFieldValue(field, event) {
|
|
1350
|
+
event.stopPropagation();
|
|
1351
|
+
this.filterFormGroup.get(field)?.setValue('');
|
|
1352
|
+
}
|
|
1353
|
+
/** Method to evaluate form fields*/
|
|
1354
|
+
isFieldValid(field) {
|
|
1355
|
+
return this.formValidator.isFieldValid(field, this.filterFormGroup, true);
|
|
1356
|
+
}
|
|
1357
|
+
/** Method to find error in form fields*/
|
|
1358
|
+
getErrorMessage(field) {
|
|
1359
|
+
return this.formValidator.getErrorMessage(field, this.filterFormGroup, errorMessages$2);
|
|
1360
|
+
}
|
|
1361
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetReportComponent, deps: [{ token: i3$1.NgxSpinnerService }, { token: i1.AlertService }, { token: i6$2.Router }, { token: i1.DataManager }, { token: i1.CurrentUserService }, { token: i1$1.MatDialog }, { token: i1.FormValidatorService }, { token: i2.UntypedFormBuilder }, { token: i4.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
|
|
1362
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetReportComponent, selector: "app-checksheet-report", inputs: { vehicle: "vehicle" }, ngImport: i0, template: "<div\n fxLayout=\"column\"\n fxLayoutAlign=\"start\"\n fxLayoutGap=\"1.5rem\"\n class=\"mat-typography m-4\"\n>\n <div fxLayout fxLayoutAlign=\"center center\">\n <h3 class=\"m-0 font-weight-bold mr-3\">\n Checksheet Report\n\n <app-export-excel-button\n class=\"ml-2\"\n elementId=\"pdfable-section\"\n name=\"checksheet-report-download\"\n [data]=\"excelData\"\n >\n </app-export-excel-button>\n </h3>\n </div>\n\n <form\n fxLayout=\"row wrap d-print-none\"\n fxLayoutGap=\"1rem\"\n [formGroup]=\"filterFormGroup\"\n >\n <mat-form-field>\n <input\n matInput\n [matDatepicker]=\"picker\"\n placeholder=\"Start Date (MM/DD/YYYY)\"\n formControlName=\"date_from\"\n autocomplete=\"off\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n <mat-error *ngIf=\"isFieldValid('date_from')\"\n >{{ getErrorMessage('date_from') }}\n </mat-error>\n <button\n mat-button\n *ngIf=\"getFieldValue('date_from')\"\n matSuffix\n mat-icon-button\n (click)=\"resetFieldValue('date_from', $event)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field>\n <input\n matInput\n [matDatepicker]=\"p2\"\n placeholder=\"End Date (MM/DD/YYYY)\"\n formControlName=\"date_to\"\n autocomplete=\"off\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"p2\"></mat-datepicker-toggle>\n <mat-datepicker #p2></mat-datepicker>\n <mat-error *ngIf=\"isFieldValid('date_to')\"\n >{{ getErrorMessage('date_to') }}\n </mat-error>\n <button\n mat-button\n *ngIf=\"getFieldValue('date_to')\"\n matSuffix\n mat-icon-button\n (click)=\"resetFieldValue('date_to', $event)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Status</mat-label>\n <app-searchable-selector\n formControlName=\"status_id\"\n apiUrl=\"api/checksheet-submission-statuses\"\n [enableSearch]=\"false\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('status_id')\"\n (click)=\"resetFieldValue('status_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field *ngIf=\"!vehicle\">\n <mat-label>Vehicle</mat-label>\n <app-searchable-selector\n formControlName=\"model_id\"\n apiUrl=\"api/vehicles\"\n [enableSearch]=\"true\"\n titleField=\"title_field\"\n [sort]=\"false\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('model_id')\"\n (click)=\"resetFieldValue('model_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Creator</mat-label>\n <app-searchable-selector\n formControlName=\"creator_id\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('creator_id')\"\n (click)=\"resetFieldValue('creator_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Reviewer</mat-label>\n <app-searchable-selector\n formControlName=\"reviewer_id\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('reviewer_id')\"\n (click)=\"resetFieldValue('reviewer_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet Format</mat-label>\n <app-searchable-selector\n formControlName=\"checksheet_format_id\"\n apiUrl=\"api/checksheet-formats?is_published=true\"\n [enableSearch]=\"true\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('checksheet_format_id')\"\n (click)=\"resetFieldValue('checksheet_format_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Vehicle Assigned Customer</mat-label>\n <app-searchable-selector\n formControlName=\"vehicle_assigned_customer_id\"\n apiUrl=\"api/customers\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('vehicle_assigned_customer_id')\"\n (click)=\"resetFieldValue('vehicle_assigned_customer_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <!-- <mat-form-field>\n <mat-label>Driver Assigned Customer</mat-label>\n <app-searchable-selector formControlName=\"driver_assigned_customer_id\" apiUrl=\"api/customers\"\n [enableSearch]=\"true\" titleField=\"name\">\n </app-searchable-selector>\n <mat-icon matSuffix *ngIf=\"getFieldValue('driver_assigned_customer_id')\"\n (click)=\"resetFieldValue('driver_assigned_customer_id', $event)\">\n close</mat-icon>\n </mat-form-field> -->\n </form>\n\n <div\n id=\"pdfable-section\"\n class=\"scroll-container\"\n infiniteScroll\n [infiniteScrollDistance]=\"2\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [scrollWindow]=\"false\"\n >\n <table\n mat-table\n [dataSource]=\"checksheetSubmissionList\"\n class=\"w-100\"\n multiTemplateDataRows\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Date Column -->\n <ng-container matColumnDef=\"date\">\n <th mat-header-cell *matHeaderCellDef>Date</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.date | date : 'mediumDate' }}\n </td>\n </ng-container>\n\n <!-- Vehicle Column -->\n <ng-container matColumnDef=\"vehicle\">\n <th mat-header-cell *matHeaderCellDef>Vehicle</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.vehicle?.title_field }}\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"created_at\">\n <th mat-header-cell *matHeaderCellDef>Submitted On</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.created_at | date : 'mediumDate' }}\n {{ element.created_at | date : 'shortTime' }} <br />\n <small>by {{ element.creator?.name }}</small>\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"reviewer.name\">\n <th mat-header-cell *matHeaderCellDef>Verified By</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.reviewer?.name }} <br />\n <small *ngIf=\"element.reviewed_at\">\n on {{ element.reviewed_at | date : 'mediumDate' }}\n {{ element.reviewed_at | date : 'shortTime' }}\n </small>\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"mechanical_issues\">\n <th mat-header-cell *matHeaderCellDef>Mechanical Issues</th>\n <td mat-cell *matCellDef=\"let element\" class=\"w-50\">\n <ul>\n <li\n *ngFor=\"let issue of element?.mechanical_issues\"\n [innerHTML]=\"issue.details_without_html\"\n ></li>\n </ul>\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"notes\">\n <th mat-header-cell *matHeaderCellDef>Notes</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.comments }}\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i9.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i9.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i9.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i10.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i6$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i6$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i9$2.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "component", type: i1.SearchableSelectorComponent, selector: "app-searchable-selector", inputs: ["valueField", "titleField", "subtitleField", "apiUrl", "multiple", "selectedValue", "enableSearch", "add", "addConfig", "edit", "editConfig", "sort", "sortBy", "searchField", "itemComponent", "items", "apiDataProperty", "cache", "perPage", "inDataSearch", "panelWidth", "focusSearchOnOpen", "required", "disabled", "value"], outputs: ["selectedValueChange", "selectionChange", "itemsChange"] }, { kind: "component", type: i1.ExportExcelButtonComponent, selector: "app-export-excel-button", inputs: ["name", "data"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }] });
|
|
1363
|
+
};
|
|
1364
|
+
ChecksheetReportComponent = __decorate([
|
|
1365
|
+
UntilDestroy()
|
|
1366
|
+
], ChecksheetReportComponent);
|
|
1367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetReportComponent, decorators: [{
|
|
1368
|
+
type: Component,
|
|
1369
|
+
args: [{ selector: 'app-checksheet-report', template: "<div\n fxLayout=\"column\"\n fxLayoutAlign=\"start\"\n fxLayoutGap=\"1.5rem\"\n class=\"mat-typography m-4\"\n>\n <div fxLayout fxLayoutAlign=\"center center\">\n <h3 class=\"m-0 font-weight-bold mr-3\">\n Checksheet Report\n\n <app-export-excel-button\n class=\"ml-2\"\n elementId=\"pdfable-section\"\n name=\"checksheet-report-download\"\n [data]=\"excelData\"\n >\n </app-export-excel-button>\n </h3>\n </div>\n\n <form\n fxLayout=\"row wrap d-print-none\"\n fxLayoutGap=\"1rem\"\n [formGroup]=\"filterFormGroup\"\n >\n <mat-form-field>\n <input\n matInput\n [matDatepicker]=\"picker\"\n placeholder=\"Start Date (MM/DD/YYYY)\"\n formControlName=\"date_from\"\n autocomplete=\"off\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n <mat-error *ngIf=\"isFieldValid('date_from')\"\n >{{ getErrorMessage('date_from') }}\n </mat-error>\n <button\n mat-button\n *ngIf=\"getFieldValue('date_from')\"\n matSuffix\n mat-icon-button\n (click)=\"resetFieldValue('date_from', $event)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field>\n <input\n matInput\n [matDatepicker]=\"p2\"\n placeholder=\"End Date (MM/DD/YYYY)\"\n formControlName=\"date_to\"\n autocomplete=\"off\"\n />\n <mat-datepicker-toggle matSuffix [for]=\"p2\"></mat-datepicker-toggle>\n <mat-datepicker #p2></mat-datepicker>\n <mat-error *ngIf=\"isFieldValid('date_to')\"\n >{{ getErrorMessage('date_to') }}\n </mat-error>\n <button\n mat-button\n *ngIf=\"getFieldValue('date_to')\"\n matSuffix\n mat-icon-button\n (click)=\"resetFieldValue('date_to', $event)\"\n >\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Status</mat-label>\n <app-searchable-selector\n formControlName=\"status_id\"\n apiUrl=\"api/checksheet-submission-statuses\"\n [enableSearch]=\"false\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('status_id')\"\n (click)=\"resetFieldValue('status_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field *ngIf=\"!vehicle\">\n <mat-label>Vehicle</mat-label>\n <app-searchable-selector\n formControlName=\"model_id\"\n apiUrl=\"api/vehicles\"\n [enableSearch]=\"true\"\n titleField=\"title_field\"\n [sort]=\"false\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('model_id')\"\n (click)=\"resetFieldValue('model_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Creator</mat-label>\n <app-searchable-selector\n formControlName=\"creator_id\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('creator_id')\"\n (click)=\"resetFieldValue('creator_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Reviewer</mat-label>\n <app-searchable-selector\n formControlName=\"reviewer_id\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('reviewer_id')\"\n (click)=\"resetFieldValue('reviewer_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet Format</mat-label>\n <app-searchable-selector\n formControlName=\"checksheet_format_id\"\n apiUrl=\"api/checksheet-formats?is_published=true\"\n [enableSearch]=\"true\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('checksheet_format_id')\"\n (click)=\"resetFieldValue('checksheet_format_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Vehicle Assigned Customer</mat-label>\n <app-searchable-selector\n formControlName=\"vehicle_assigned_customer_id\"\n apiUrl=\"api/customers\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n >\n </app-searchable-selector>\n <mat-icon\n matSuffix\n *ngIf=\"getFieldValue('vehicle_assigned_customer_id')\"\n (click)=\"resetFieldValue('vehicle_assigned_customer_id', $event)\"\n >\n close</mat-icon\n >\n </mat-form-field>\n\n <!-- <mat-form-field>\n <mat-label>Driver Assigned Customer</mat-label>\n <app-searchable-selector formControlName=\"driver_assigned_customer_id\" apiUrl=\"api/customers\"\n [enableSearch]=\"true\" titleField=\"name\">\n </app-searchable-selector>\n <mat-icon matSuffix *ngIf=\"getFieldValue('driver_assigned_customer_id')\"\n (click)=\"resetFieldValue('driver_assigned_customer_id', $event)\">\n close</mat-icon>\n </mat-form-field> -->\n </form>\n\n <div\n id=\"pdfable-section\"\n class=\"scroll-container\"\n infiniteScroll\n [infiniteScrollDistance]=\"2\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [scrollWindow]=\"false\"\n >\n <table\n mat-table\n [dataSource]=\"checksheetSubmissionList\"\n class=\"w-100\"\n multiTemplateDataRows\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Date Column -->\n <ng-container matColumnDef=\"date\">\n <th mat-header-cell *matHeaderCellDef>Date</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.date | date : 'mediumDate' }}\n </td>\n </ng-container>\n\n <!-- Vehicle Column -->\n <ng-container matColumnDef=\"vehicle\">\n <th mat-header-cell *matHeaderCellDef>Vehicle</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.vehicle?.title_field }}\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"created_at\">\n <th mat-header-cell *matHeaderCellDef>Submitted On</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.created_at | date : 'mediumDate' }}\n {{ element.created_at | date : 'shortTime' }} <br />\n <small>by {{ element.creator?.name }}</small>\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"reviewer.name\">\n <th mat-header-cell *matHeaderCellDef>Verified By</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.reviewer?.name }} <br />\n <small *ngIf=\"element.reviewed_at\">\n on {{ element.reviewed_at | date : 'mediumDate' }}\n {{ element.reviewed_at | date : 'shortTime' }}\n </small>\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"mechanical_issues\">\n <th mat-header-cell *matHeaderCellDef>Mechanical Issues</th>\n <td mat-cell *matCellDef=\"let element\" class=\"w-50\">\n <ul>\n <li\n *ngFor=\"let issue of element?.mechanical_issues\"\n [innerHTML]=\"issue.details_without_html\"\n ></li>\n </ul>\n </td>\n </ng-container>\n\n <!-- Category Column -->\n <ng-container matColumnDef=\"notes\">\n <th mat-header-cell *matHeaderCellDef>Notes</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.comments }}\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n </div>\n</div>\n" }]
|
|
1370
|
+
}], ctorParameters: () => [{ type: i3$1.NgxSpinnerService }, { type: i1.AlertService }, { type: i6$2.Router }, { type: i1.DataManager }, { type: i1.CurrentUserService }, { type: i1$1.MatDialog }, { type: i1.FormValidatorService }, { type: i2.UntypedFormBuilder }, { type: i4.DatePipe }], propDecorators: { vehicle: [{
|
|
1371
|
+
type: Input
|
|
1372
|
+
}] } });
|
|
1373
|
+
|
|
1374
|
+
class ChecksheetFormButtonComponent {
|
|
1375
|
+
matDialog;
|
|
1376
|
+
alertService;
|
|
1377
|
+
router;
|
|
1378
|
+
submittableType = 'fixed-asset';
|
|
1379
|
+
submittableId;
|
|
1380
|
+
saved = new EventEmitter();
|
|
1381
|
+
constructor(matDialog, alertService, router) {
|
|
1382
|
+
this.matDialog = matDialog;
|
|
1383
|
+
this.alertService = alertService;
|
|
1384
|
+
this.router = router;
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Open Checksheet form.
|
|
1388
|
+
*
|
|
1389
|
+
* @param templateRef
|
|
1390
|
+
*/
|
|
1391
|
+
openForm(templateRef) {
|
|
1392
|
+
this.matDialog.open(templateRef, { width: '500px' });
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* Handle Checksheet save event.
|
|
1396
|
+
*
|
|
1397
|
+
* @param checksheetSubmission
|
|
1398
|
+
*/
|
|
1399
|
+
onSaved(checksheetSubmission) {
|
|
1400
|
+
this.saved.emit(checksheetSubmission);
|
|
1401
|
+
this.matDialog.closeAll();
|
|
1402
|
+
this.alertService.addAlert('The Checksheet is saved successfully!', 'success');
|
|
1403
|
+
this.router.navigate([
|
|
1404
|
+
'fixed-assets/checksheets/checksheets',
|
|
1405
|
+
checksheetSubmission?.id,
|
|
1406
|
+
'view'
|
|
1407
|
+
]);
|
|
1408
|
+
}
|
|
1409
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormButtonComponent, deps: [{ token: i1$1.MatDialog }, { token: i1.AlertService }, { token: i6$2.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
1410
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetFormButtonComponent, selector: "app-checksheet-form-button", inputs: { submittableType: "submittableType", submittableId: "submittableId" }, outputs: { saved: "saved" }, ngImport: i0, template: "<span\n *ngIf=\"submittableId\"\n class=\"material-symbols-outlined text-secondary\"\n matTooltip=\"Add Checksheet\"\n (click)=\"openForm(formTemplate)\"\n>\n assignment_turned_in\n</span>\n<mat-icon\n *ngIf=\"!submittableId\"\n class=\"cursor-pointer text-secondary\"\n (click)=\"openForm(formTemplate)\"\n>\n add\n</mat-icon>\n\n<ng-template #formTemplate>\n <app-checksheet-submission-form\n mat-dialog-content\n (cancelled)=\"matDialog.closeAll()\"\n (saved)=\"onSaved($event)\"\n [submittableType]=\"submittableType\"\n [submittableId]=\"submittableId\"\n ></app-checksheet-submission-form>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6$3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: ChecksheetSubmissionFormComponent, selector: "app-checksheet-submission-form", inputs: ["submittableType", "submittableId", "checksheetSubmission"], outputs: ["cancelled", "saved"] }] });
|
|
1411
|
+
}
|
|
1412
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetFormButtonComponent, decorators: [{
|
|
1413
|
+
type: Component,
|
|
1414
|
+
args: [{ selector: 'app-checksheet-form-button', template: "<span\n *ngIf=\"submittableId\"\n class=\"material-symbols-outlined text-secondary\"\n matTooltip=\"Add Checksheet\"\n (click)=\"openForm(formTemplate)\"\n>\n assignment_turned_in\n</span>\n<mat-icon\n *ngIf=\"!submittableId\"\n class=\"cursor-pointer text-secondary\"\n (click)=\"openForm(formTemplate)\"\n>\n add\n</mat-icon>\n\n<ng-template #formTemplate>\n <app-checksheet-submission-form\n mat-dialog-content\n (cancelled)=\"matDialog.closeAll()\"\n (saved)=\"onSaved($event)\"\n [submittableType]=\"submittableType\"\n [submittableId]=\"submittableId\"\n ></app-checksheet-submission-form>\n</ng-template>\n" }]
|
|
1415
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialog }, { type: i1.AlertService }, { type: i6$2.Router }], propDecorators: { submittableType: [{
|
|
1416
|
+
type: Input
|
|
1417
|
+
}], submittableId: [{
|
|
1418
|
+
type: Input
|
|
1419
|
+
}], saved: [{
|
|
1420
|
+
type: Output
|
|
1421
|
+
}] } });
|
|
1422
|
+
|
|
1423
|
+
class ChecksheetSubmissionDeleteButtonComponent {
|
|
1424
|
+
matDialog;
|
|
1425
|
+
checksheetSubmissionService;
|
|
1426
|
+
checksheetSubmission;
|
|
1427
|
+
deleted = new EventEmitter();
|
|
1428
|
+
isDeleting = false;
|
|
1429
|
+
constructor(matDialog, checksheetSubmissionService) {
|
|
1430
|
+
this.matDialog = matDialog;
|
|
1431
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Show delete confirmation dialog.
|
|
1435
|
+
*
|
|
1436
|
+
* @param templateRef
|
|
1437
|
+
*/
|
|
1438
|
+
openDialog(templateRef) {
|
|
1439
|
+
this.matDialog.open(templateRef, { width: '400px' });
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Send request to delete the model.
|
|
1443
|
+
*/
|
|
1444
|
+
deleteModel() {
|
|
1445
|
+
this.isDeleting = true;
|
|
1446
|
+
this.checksheetSubmissionService
|
|
1447
|
+
.delete(this.checksheetSubmission)
|
|
1448
|
+
.subscribe({
|
|
1449
|
+
next: () => {
|
|
1450
|
+
this.isDeleting = false;
|
|
1451
|
+
this.deleted.emit();
|
|
1452
|
+
this.matDialog.closeAll();
|
|
1453
|
+
},
|
|
1454
|
+
error: () => (this.isDeleting = false)
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionDeleteButtonComponent, deps: [{ token: i1$1.MatDialog }, { token: ChecksheetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1458
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionDeleteButtonComponent, selector: "app-checksheet-submission-delete-button", inputs: { checksheetSubmission: "checksheetSubmission" }, outputs: { deleted: "deleted" }, ngImport: i0, template: "<mat-icon class=\"cursor-pointer\" (click)=\"openDialog(deleteTemplate)\">\n delete\n</mat-icon>\n\n<ng-template #deleteTemplate>\n <h3 mat-dialog-title>Delete Checksheet</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to delete the Checksheet?</p>\n </div>\n <div\n mat-dialog-actions\n class=\"d-flex justify-content-end gap-2 align-items-center\"\n >\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n mat-flat-button\n mat-dialog-close\n >\n Cancel\n </button>\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n (click)=\"deleteModel()\"\n mat-raised-button\n color=\"warn\"\n >\n Delete\n </button>\n </div>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
1459
|
+
}
|
|
1460
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionDeleteButtonComponent, decorators: [{
|
|
1461
|
+
type: Component,
|
|
1462
|
+
args: [{ selector: 'app-checksheet-submission-delete-button', template: "<mat-icon class=\"cursor-pointer\" (click)=\"openDialog(deleteTemplate)\">\n delete\n</mat-icon>\n\n<ng-template #deleteTemplate>\n <h3 mat-dialog-title>Delete Checksheet</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to delete the Checksheet?</p>\n </div>\n <div\n mat-dialog-actions\n class=\"d-flex justify-content-end gap-2 align-items-center\"\n >\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n mat-flat-button\n mat-dialog-close\n >\n Cancel\n </button>\n <button\n [disabled]=\"isDeleting\"\n type=\"button\"\n (click)=\"deleteModel()\"\n mat-raised-button\n color=\"warn\"\n >\n Delete\n </button>\n </div>\n</ng-template>\n" }]
|
|
1463
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialog }, { type: ChecksheetService }], propDecorators: { checksheetSubmission: [{
|
|
1464
|
+
type: Input
|
|
1465
|
+
}], deleted: [{
|
|
1466
|
+
type: Output
|
|
1467
|
+
}] } });
|
|
1468
|
+
|
|
1469
|
+
class ChecksheetReviewButtonComponent {
|
|
1470
|
+
matDialog;
|
|
1471
|
+
credentialsService;
|
|
1472
|
+
checksheetSubmissionService;
|
|
1473
|
+
alertService;
|
|
1474
|
+
submission;
|
|
1475
|
+
viewType = 'icon';
|
|
1476
|
+
requestParams;
|
|
1477
|
+
reviewed = new EventEmitter();
|
|
1478
|
+
user;
|
|
1479
|
+
isWorking = false;
|
|
1480
|
+
constructor(matDialog, credentialsService, checksheetSubmissionService, alertService) {
|
|
1481
|
+
this.matDialog = matDialog;
|
|
1482
|
+
this.credentialsService = credentialsService;
|
|
1483
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
1484
|
+
this.alertService = alertService;
|
|
1485
|
+
this.user = this.credentialsService.credentials?.user;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Show the review dialog.
|
|
1489
|
+
*
|
|
1490
|
+
* @param templateRef
|
|
1491
|
+
*/
|
|
1492
|
+
openDialog(templateRef) {
|
|
1493
|
+
this.matDialog.open(templateRef, { width: '400px' });
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Review checksheet.
|
|
1497
|
+
*/
|
|
1498
|
+
reviewChecksheet() {
|
|
1499
|
+
this.isWorking = true;
|
|
1500
|
+
this.checksheetSubmissionService
|
|
1501
|
+
.review(this.submission?.id, this.requestParams)
|
|
1502
|
+
.subscribe({
|
|
1503
|
+
next: (response) => {
|
|
1504
|
+
this.matDialog.closeAll();
|
|
1505
|
+
this.isWorking = false;
|
|
1506
|
+
this.reviewed.next(response?.item);
|
|
1507
|
+
this.alertService.addAlert('The Checksheet marked as reviewed.', 'success');
|
|
1508
|
+
},
|
|
1509
|
+
error: () => (this.isWorking = false)
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetReviewButtonComponent, deps: [{ token: i1$1.MatDialog }, { token: i1.CredentialsService }, { token: ChecksheetService }, { token: i1.AlertService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1513
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetReviewButtonComponent, selector: "app-checksheet-review-button", inputs: { submission: "submission", viewType: "viewType", requestParams: "requestParams" }, outputs: { reviewed: "reviewed" }, ngImport: i0, template: "<ng-container\n *ngIf=\"submission?.status_id === 2 && submission?.creator_id !== user?.id\"\n>\n <button\n *ngIf=\"viewType === 'button'\"\n mat-raised-button\n color=\"primary\"\n type=\"button\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n Review\n </button>\n\n <mat-icon\n *ngIf=\"viewType === 'icon'\"\n class=\"cursor-pointer\"\n matTooltip=\"Review\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n rate_review\n </mat-icon>\n</ng-container>\n\n<ng-template #reviewTemplate>\n <h3 mat-dialog-title>Review Checksheet</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to mark the Checksheet as Reviewed?</p>\n </div>\n <div mat-dialog-actions class=\"d-flex justify-content-end align-items-center\">\n <button [disabled]=\"isWorking\" mat-flat-button mat-dialog-close>\n Cancel\n </button>\n <button\n [disabled]=\"isWorking\"\n mat-raised-button\n color=\"primary\"\n (click)=\"reviewChecksheet()\"\n >\n Review\n </button>\n </div>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6$3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] });
|
|
1514
|
+
}
|
|
1515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetReviewButtonComponent, decorators: [{
|
|
1516
|
+
type: Component,
|
|
1517
|
+
args: [{ selector: 'app-checksheet-review-button', template: "<ng-container\n *ngIf=\"submission?.status_id === 2 && submission?.creator_id !== user?.id\"\n>\n <button\n *ngIf=\"viewType === 'button'\"\n mat-raised-button\n color=\"primary\"\n type=\"button\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n Review\n </button>\n\n <mat-icon\n *ngIf=\"viewType === 'icon'\"\n class=\"cursor-pointer\"\n matTooltip=\"Review\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n rate_review\n </mat-icon>\n</ng-container>\n\n<ng-template #reviewTemplate>\n <h3 mat-dialog-title>Review Checksheet</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to mark the Checksheet as Reviewed?</p>\n </div>\n <div mat-dialog-actions class=\"d-flex justify-content-end align-items-center\">\n <button [disabled]=\"isWorking\" mat-flat-button mat-dialog-close>\n Cancel\n </button>\n <button\n [disabled]=\"isWorking\"\n mat-raised-button\n color=\"primary\"\n (click)=\"reviewChecksheet()\"\n >\n Review\n </button>\n </div>\n</ng-template>\n" }]
|
|
1518
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialog }, { type: i1.CredentialsService }, { type: ChecksheetService }, { type: i1.AlertService }], propDecorators: { submission: [{
|
|
1519
|
+
type: Input
|
|
1520
|
+
}], viewType: [{
|
|
1521
|
+
type: Input
|
|
1522
|
+
}], requestParams: [{
|
|
1523
|
+
type: Input
|
|
1524
|
+
}], reviewed: [{
|
|
1525
|
+
type: Output
|
|
1526
|
+
}] } });
|
|
1527
|
+
|
|
1528
|
+
let ChecksheetListComponent = class ChecksheetListComponent extends TechlifyListingControllerInterface {
|
|
1529
|
+
alertService;
|
|
1530
|
+
fb;
|
|
1531
|
+
checksheetSubmissionService;
|
|
1532
|
+
requestHelperService;
|
|
1533
|
+
activatedRoute;
|
|
1534
|
+
displayedColumns = [
|
|
1535
|
+
'index',
|
|
1536
|
+
'date',
|
|
1537
|
+
'format.title',
|
|
1538
|
+
'for',
|
|
1539
|
+
'creator.name',
|
|
1540
|
+
'reviewer.name',
|
|
1541
|
+
'status.title',
|
|
1542
|
+
'actions'
|
|
1543
|
+
];
|
|
1544
|
+
with = 'format,creator,reviewer,status,submittable';
|
|
1545
|
+
constructor(alertService, fb, checksheetSubmissionService, requestHelperService, activatedRoute) {
|
|
1546
|
+
super();
|
|
1547
|
+
this.alertService = alertService;
|
|
1548
|
+
this.fb = fb;
|
|
1549
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
1550
|
+
this.requestHelperService = requestHelperService;
|
|
1551
|
+
this.activatedRoute = activatedRoute;
|
|
1552
|
+
this.createForm();
|
|
1553
|
+
}
|
|
1554
|
+
ngOnInit() {
|
|
1555
|
+
this.updateFormWithQueryParams();
|
|
1556
|
+
this.subscribeToFormChanges();
|
|
1557
|
+
this.subscribeToRouteChanges();
|
|
1558
|
+
}
|
|
1559
|
+
createForm() {
|
|
1560
|
+
this.filterForm = this.fb.group({
|
|
1561
|
+
search: [''],
|
|
1562
|
+
duration: [Timeline.ALL],
|
|
1563
|
+
date_from: [''],
|
|
1564
|
+
date_to: [''],
|
|
1565
|
+
status_ids: [''],
|
|
1566
|
+
creator_ids: [''],
|
|
1567
|
+
reviewer_ids: [''],
|
|
1568
|
+
format_ids: [''],
|
|
1569
|
+
sort_by: ['created_at|DESC'],
|
|
1570
|
+
with: [this.with]
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
loadData() {
|
|
1574
|
+
this.isWorking = true;
|
|
1575
|
+
const params = {
|
|
1576
|
+
...this.requestHelperService.convertToFormData(this.filterForm.value),
|
|
1577
|
+
perPage: this.perPage,
|
|
1578
|
+
page: this.page
|
|
1579
|
+
};
|
|
1580
|
+
this.checksheetSubmissionService.index(params).subscribe({
|
|
1581
|
+
next: (response) => {
|
|
1582
|
+
this.models = this.models.concat(response?.data);
|
|
1583
|
+
this.lastPage = response?.last_page;
|
|
1584
|
+
this.isWorking = false;
|
|
1585
|
+
},
|
|
1586
|
+
error: () => (this.isWorking = false)
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
onDurationChange(timelineValue) {
|
|
1590
|
+
let { date_to, date_from } = timelineValue;
|
|
1591
|
+
this.filterForm.patchValue({
|
|
1592
|
+
date_from: date_from ? moment(date_from).format('YYYY-MM-DD') : '',
|
|
1593
|
+
date_to: date_to ? moment(date_to).format('YYYY-MM-DD') : ''
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Handle Checksheet delete event.
|
|
1598
|
+
*/
|
|
1599
|
+
onDeleted() {
|
|
1600
|
+
this.alertService.addAlert('Checksheet deleted successfully!', 'success');
|
|
1601
|
+
this.reload();
|
|
1602
|
+
}
|
|
1603
|
+
updateFormWithQueryParams() {
|
|
1604
|
+
this.requestHelperService.updateFormWithQueryParams(this.filterForm, {});
|
|
1605
|
+
}
|
|
1606
|
+
subscribeToFormChanges() {
|
|
1607
|
+
this.filterForm.valueChanges.pipe(debounceTime$1(800)).subscribe({
|
|
1608
|
+
next: () => {
|
|
1609
|
+
this.requestHelperService.updateQueryParams(this.requestHelperService.convertToFormData(this.filterForm.value));
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
subscribeToRouteChanges() {
|
|
1614
|
+
this.activatedRoute.queryParams
|
|
1615
|
+
.pipe(debounceTime$1(500), distinctUntilChanged())
|
|
1616
|
+
.subscribe(() => {
|
|
1617
|
+
this.reload();
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
onSortChange(sort) {
|
|
1621
|
+
let { active, direction } = sort;
|
|
1622
|
+
if (!active)
|
|
1623
|
+
active = 'id';
|
|
1624
|
+
if (!direction)
|
|
1625
|
+
direction = 'desc';
|
|
1626
|
+
this.filterForm.get('sort_by')?.setValue(active + '|' + direction);
|
|
1627
|
+
}
|
|
1628
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetListComponent, deps: [{ token: i1.AlertService }, { token: i2.UntypedFormBuilder }, { token: ChecksheetService }, { token: i1.RequestHelperService }, { token: i6$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
1629
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetListComponent, selector: "app-checksheet-list", usesInheritance: true, ngImport: i0, template: "<mat-card>\n <mat-card-content class=\"d-flex justify-content-between align-items-center gap-2\">\n <div class=\"d-flex justify-content-center align-items-center gap-2\">\n <h3 class=\"m-0 font-weight-bold\">Checksheets</h3>\n <app-checksheet-form-button class=\"mt-1\"></app-checksheet-form-button>\n <a\n [routerLink]=\"['checksheet-formats']\"\n mat-raised-button\n >\n Formats\n </a>\n </div>\n\n <form fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" [formGroup]=\"filterForm\">\n <mat-form-field>\n <mat-label>Search</mat-label>\n <input matInput formControlName=\"search\" placeholder=\"Search Checksheets\">\n </mat-form-field>\n\n <app-timeline-filter\n formControlName=\"duration\"\n (selectionChange)=\"onDurationChange($event)\"\n [dateFrom]=\"filterForm.value?.date_from\"\n [dateTo]=\"filterForm.value?.date_to\"\n appearance=\"fill\"\n ></app-timeline-filter>\n\n <mat-form-field>\n <mat-label>Status</mat-label>\n <app-searchable-selector\n formControlName=\"status_ids\"\n apiUrl=\"api/checksheet-submission-statuses\"\n [enableSearch]=\"false\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Creator</mat-label>\n <app-searchable-selector\n formControlName=\"creator_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Reviewer</mat-label>\n <app-searchable-selector\n formControlName=\"reviewer_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Format</mat-label>\n <app-searchable-selector\n formControlName=\"format_ids\"\n apiUrl=\"api/checksheet-formats?is_published=1\"\n [enableSearch]=\"true\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n </form>\n </mat-card-content>\n</mat-card>\n\n<mat-card\n class=\"p-0 mt-3\"\n infiniteScroll\n [infiniteScrollDistance]=\"2\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [fromRoot]=\"true\"\n>\n <table\n mat-table\n [dataSource]=\"models\"\n class=\"w-100\"\n multiTemplateDataRows\n aria-describedby=\"Checksheets\"\n matSort\n (matSortChange)=\"onSortChange($event)\"\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Format Column -->\n <ng-container matColumnDef=\"format.title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Format</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.format?.title }}\n </td>\n </ng-container>\n\n <!-- Creator Column -->\n <ng-container matColumnDef=\"creator.name\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Creator</th>\n <td mat-cell *matCellDef=\"let element\">\n <p class=\"mb-0\">{{ element?.creator?.name }}</p>\n <small class=\"text-secondary\">{{ element?.created_at | date }}</small>\n </td>\n </ng-container>\n\n <!-- Reviewer Column -->\n <ng-container matColumnDef=\"reviewer.name\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Reviewer</th>\n <td mat-cell *matCellDef=\"let element\">\n <p class=\"mb-0\">{{ element?.reviewer?.name }}</p>\n <small class=\"text-secondary\" *ngIf=\"element?.reviewed_at\">{{ element?.reviewed_at | date }}</small>\n </td>\n </ng-container>\n\n <!-- For Column -->\n <ng-container matColumnDef=\"for\">\n <th mat-header-cell *matHeaderCellDef>For</th>\n <td mat-cell *matCellDef=\"let element\">\n <a\n class=\"mb-0 text-decoration-none text-dark\"\n *ngIf=\"element?.submittable\"\n [routerLink]=\"['/fixed-assets/', element?.submittable_id, 'read']\"\n >\n {{ element?.submittable?.name }}\n </a> <br>\n <small class=\"text-secondary\" *ngIf=\"element?.submittable_type\">{{ element?.submittable_type }}</small>\n </td>\n </ng-container>\n\n <!-- Status Column -->\n <ng-container matColumnDef=\"status.title\">\n <th mat-header-cell *matHeaderCellDef>Status</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.status?.title }}\n </td>\n </ng-container>\n\n <!-- Date Column -->\n <ng-container matColumnDef=\"date\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Date</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.date | date }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element;\">\n <div class=\"d-flex gap-2\">\n <mat-icon\n [routerLink]=\"['../checksheets-view', element?.id]\"\n class=\"cursor-pointer\"\n >\n visibility\n </mat-icon>\n\n <mat-icon\n *ngIf=\"element.status_id === 1\"\n [routerLink]=\"[element?.id, 'view']\"\n class=\"cursor-pointer\"\n >\n edit\n </mat-icon>\n <app-checksheet-review-button\n [submission]=\"element\"\n [requestParams]=\"{ with: this.with }\"\n (reviewed)=\"reload()\"\n ></app-checksheet-review-button>\n <app-checksheet-submission-delete-button\n [checksheetSubmission]=\"element\"\n (deleted)=\"onDeleted()\"\n ></app-checksheet-submission-delete-button>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar *ngIf=\"isWorking\" mode=\"indeterminate\"></mat-progress-bar>\n</mat-card>\n", styles: [".scroll-container{max-height:800px;overflow-y:auto}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "component", type: i8.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i7.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i12.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i8$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i13.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i13.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i6$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i6$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i15.NgxPermissionsDirective, selector: "[ngxPermissionsOnly],[ngxPermissionsExcept]", inputs: ["ngxPermissionsOnly", "ngxPermissionsOnlyThen", "ngxPermissionsOnlyElse", "ngxPermissionsExcept", "ngxPermissionsExceptElse", "ngxPermissionsExceptThen", "ngxPermissionsThen", "ngxPermissionsElse", "ngxPermissionsOnlyAuthorisedStrategy", "ngxPermissionsOnlyUnauthorisedStrategy", "ngxPermissionsExceptUnauthorisedStrategy", "ngxPermissionsExceptAuthorisedStrategy", "ngxPermissionsUnauthorisedStrategy", "ngxPermissionsAuthorisedStrategy"], outputs: ["permissionsAuthorized", "permissionsUnauthorized"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i9$2.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "component", type: i1.SearchableSelectorComponent, selector: "app-searchable-selector", inputs: ["valueField", "titleField", "subtitleField", "apiUrl", "multiple", "selectedValue", "enableSearch", "add", "addConfig", "edit", "editConfig", "sort", "sortBy", "searchField", "itemComponent", "items", "apiDataProperty", "cache", "perPage", "inDataSearch", "panelWidth", "focusSearchOnOpen", "required", "disabled", "value"], outputs: ["selectedValueChange", "selectionChange", "itemsChange"] }, { kind: "component", type: i1.TimelineFilterComponent, selector: "app-timeline-filter", inputs: ["defaultValue", "required", "disabled", "value", "timelines", "dateFrom", "dateTo", "appearance", "showClearButton", "form", "labelText"], outputs: ["selectionChange"] }, { kind: "component", type: ChecksheetFormButtonComponent, selector: "app-checksheet-form-button", inputs: ["submittableType", "submittableId"], outputs: ["saved"] }, { kind: "component", type: ChecksheetSubmissionDeleteButtonComponent, selector: "app-checksheet-submission-delete-button", inputs: ["checksheetSubmission"], outputs: ["deleted"] }, { kind: "component", type: ChecksheetReviewButtonComponent, selector: "app-checksheet-review-button", inputs: ["submission", "viewType", "requestParams"], outputs: ["reviewed"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }] });
|
|
1630
|
+
};
|
|
1631
|
+
ChecksheetListComponent = __decorate([
|
|
1632
|
+
UntilDestroy()
|
|
1633
|
+
], ChecksheetListComponent);
|
|
1634
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetListComponent, decorators: [{
|
|
1635
|
+
type: Component,
|
|
1636
|
+
args: [{ selector: 'app-checksheet-list', template: "<mat-card>\n <mat-card-content class=\"d-flex justify-content-between align-items-center gap-2\">\n <div class=\"d-flex justify-content-center align-items-center gap-2\">\n <h3 class=\"m-0 font-weight-bold\">Checksheets</h3>\n <app-checksheet-form-button class=\"mt-1\"></app-checksheet-form-button>\n <a\n [routerLink]=\"['checksheet-formats']\"\n mat-raised-button\n >\n Formats\n </a>\n </div>\n\n <form fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" [formGroup]=\"filterForm\">\n <mat-form-field>\n <mat-label>Search</mat-label>\n <input matInput formControlName=\"search\" placeholder=\"Search Checksheets\">\n </mat-form-field>\n\n <app-timeline-filter\n formControlName=\"duration\"\n (selectionChange)=\"onDurationChange($event)\"\n [dateFrom]=\"filterForm.value?.date_from\"\n [dateTo]=\"filterForm.value?.date_to\"\n appearance=\"fill\"\n ></app-timeline-filter>\n\n <mat-form-field>\n <mat-label>Status</mat-label>\n <app-searchable-selector\n formControlName=\"status_ids\"\n apiUrl=\"api/checksheet-submission-statuses\"\n [enableSearch]=\"false\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Creator</mat-label>\n <app-searchable-selector\n formControlName=\"creator_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Reviewer</mat-label>\n <app-searchable-selector\n formControlName=\"reviewer_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Format</mat-label>\n <app-searchable-selector\n formControlName=\"format_ids\"\n apiUrl=\"api/checksheet-formats?is_published=1\"\n [enableSearch]=\"true\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n </form>\n </mat-card-content>\n</mat-card>\n\n<mat-card\n class=\"p-0 mt-3\"\n infiniteScroll\n [infiniteScrollDistance]=\"2\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [fromRoot]=\"true\"\n>\n <table\n mat-table\n [dataSource]=\"models\"\n class=\"w-100\"\n multiTemplateDataRows\n aria-describedby=\"Checksheets\"\n matSort\n (matSortChange)=\"onSortChange($event)\"\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Format Column -->\n <ng-container matColumnDef=\"format.title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Format</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.format?.title }}\n </td>\n </ng-container>\n\n <!-- Creator Column -->\n <ng-container matColumnDef=\"creator.name\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Creator</th>\n <td mat-cell *matCellDef=\"let element\">\n <p class=\"mb-0\">{{ element?.creator?.name }}</p>\n <small class=\"text-secondary\">{{ element?.created_at | date }}</small>\n </td>\n </ng-container>\n\n <!-- Reviewer Column -->\n <ng-container matColumnDef=\"reviewer.name\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Reviewer</th>\n <td mat-cell *matCellDef=\"let element\">\n <p class=\"mb-0\">{{ element?.reviewer?.name }}</p>\n <small class=\"text-secondary\" *ngIf=\"element?.reviewed_at\">{{ element?.reviewed_at | date }}</small>\n </td>\n </ng-container>\n\n <!-- For Column -->\n <ng-container matColumnDef=\"for\">\n <th mat-header-cell *matHeaderCellDef>For</th>\n <td mat-cell *matCellDef=\"let element\">\n <a\n class=\"mb-0 text-decoration-none text-dark\"\n *ngIf=\"element?.submittable\"\n [routerLink]=\"['/fixed-assets/', element?.submittable_id, 'read']\"\n >\n {{ element?.submittable?.name }}\n </a> <br>\n <small class=\"text-secondary\" *ngIf=\"element?.submittable_type\">{{ element?.submittable_type }}</small>\n </td>\n </ng-container>\n\n <!-- Status Column -->\n <ng-container matColumnDef=\"status.title\">\n <th mat-header-cell *matHeaderCellDef>Status</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.status?.title }}\n </td>\n </ng-container>\n\n <!-- Date Column -->\n <ng-container matColumnDef=\"date\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Date</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.date | date }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element;\">\n <div class=\"d-flex gap-2\">\n <mat-icon\n [routerLink]=\"['../checksheets-view', element?.id]\"\n class=\"cursor-pointer\"\n >\n visibility\n </mat-icon>\n\n <mat-icon\n *ngIf=\"element.status_id === 1\"\n [routerLink]=\"[element?.id, 'view']\"\n class=\"cursor-pointer\"\n >\n edit\n </mat-icon>\n <app-checksheet-review-button\n [submission]=\"element\"\n [requestParams]=\"{ with: this.with }\"\n (reviewed)=\"reload()\"\n ></app-checksheet-review-button>\n <app-checksheet-submission-delete-button\n [checksheetSubmission]=\"element\"\n (deleted)=\"onDeleted()\"\n ></app-checksheet-submission-delete-button>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar *ngIf=\"isWorking\" mode=\"indeterminate\"></mat-progress-bar>\n</mat-card>\n", styles: [".scroll-container{max-height:800px;overflow-y:auto}\n"] }]
|
|
1637
|
+
}], ctorParameters: () => [{ type: i1.AlertService }, { type: i2.UntypedFormBuilder }, { type: ChecksheetService }, { type: i1.RequestHelperService }, { type: i6$2.ActivatedRoute }] });
|
|
1638
|
+
|
|
1639
|
+
class ChecksheetNodeViewComponent {
|
|
1640
|
+
location;
|
|
1641
|
+
route;
|
|
1642
|
+
checksheetSubmissionService;
|
|
1643
|
+
submission;
|
|
1644
|
+
submissionId;
|
|
1645
|
+
isLoading = false;
|
|
1646
|
+
with = 'format.questions.answers,format.questions.type,creator,reviewer,status';
|
|
1647
|
+
constructor(location, route, checksheetSubmissionService) {
|
|
1648
|
+
this.location = location;
|
|
1649
|
+
this.route = route;
|
|
1650
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
1651
|
+
this.submissionId = parseInt(this.route.snapshot.params?.['submissionId']);
|
|
1652
|
+
}
|
|
1653
|
+
ngOnInit() {
|
|
1654
|
+
if (this.submissionId) {
|
|
1655
|
+
this.loadSubmission();
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
loadSubmission() {
|
|
1659
|
+
const params = {
|
|
1660
|
+
with: this.with
|
|
1661
|
+
};
|
|
1662
|
+
this.isLoading = true;
|
|
1663
|
+
this.checksheetSubmissionService.show(this.submissionId, params).subscribe({
|
|
1664
|
+
next: (response) => {
|
|
1665
|
+
this.submission = response?.item;
|
|
1666
|
+
this.isLoading = false;
|
|
1667
|
+
},
|
|
1668
|
+
error: () => (this.isLoading = false)
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* On Checksheet reviewed.
|
|
1673
|
+
*
|
|
1674
|
+
* @param model
|
|
1675
|
+
*/
|
|
1676
|
+
onUpdated(model) {
|
|
1677
|
+
this.submission = model;
|
|
1678
|
+
}
|
|
1679
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetNodeViewComponent, deps: [{ token: i4.Location }, { token: i6$2.ActivatedRoute }, { token: ChecksheetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1680
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetNodeViewComponent, selector: "app-checksheet-node-view", ngImport: i0, template: "<div\n fxLayout=\"column\"\n fxLayoutGap=\"0.5rem\"\n id=\"pdfable-section\"\n *ngIf=\"submission\"\n>\n <div fxLayout fxLayoutAlign=\"start center\">\n <h2 class=\"m-auto\">Checksheet</h2>\n </div>\n\n <div fxLayout=\"column\">\n <mat-card class=\"w-100\">\n <h4>Date: {{ submission?.date | date }}</h4>\n <h4>Format: {{ submission?.format?.title }}</h4>\n <h4>Creator: {{ submission?.creator?.name }}</h4>\n <h4 *ngIf=\"submission?.reviewer\">\n Reviewer: {{ submission?.reviewer?.name }}\n </h4>\n <h4 *ngIf=\"submission?.status\">\n Status: {{ submission?.status?.title }}\n </h4>\n\n <div\n class=\"my-2 d-print-none\"\n fxLayout=\"row\"\n fxLayoutGap=\"5px\"\n fxLayoutAlign=\"center\"\n >\n <app-checksheet-review-button\n [submission]=\"submission\"\n viewType=\"button\"\n [requestParams]=\"{ with: this.with }\"\n (reviewed)=\"onUpdated($event)\"\n ></app-checksheet-review-button>\n </div>\n </mat-card>\n </div>\n\n <div fxLayout=\"column\" *ngIf=\"submission\">\n <h2>Submission</h2>\n <app-checksheet-question-list\n class=\"w-100 pt-0 pr-4\"\n [submission]=\"submission\"\n [disableInput]=\"true\"\n >\n </app-checksheet-question-list>\n </div>\n\n <app-note-list\n *ngIf=\"submission?.id\"\n [relatedModelId]=\"submission?.id\"\n modelType=\"ChecksheetSubmission\"\n ></app-note-list>\n</div>\n\n<mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i8$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i1.NoteListComponent, selector: "app-note-list", inputs: ["relatedModelId", "modelType", "readonly", "labelText", "commentsView", "viewMode"] }, { kind: "component", type: ChecksheetQuestionListComponent, selector: "app-checksheet-question-list", inputs: ["checksheet", "submission", "disableInput"], outputs: ["checksheetChange"] }, { kind: "component", type: ChecksheetReviewButtonComponent, selector: "app-checksheet-review-button", inputs: ["submission", "viewType", "requestParams"], outputs: ["reviewed"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }] });
|
|
1681
|
+
}
|
|
1682
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetNodeViewComponent, decorators: [{
|
|
1683
|
+
type: Component,
|
|
1684
|
+
args: [{ selector: 'app-checksheet-node-view', template: "<div\n fxLayout=\"column\"\n fxLayoutGap=\"0.5rem\"\n id=\"pdfable-section\"\n *ngIf=\"submission\"\n>\n <div fxLayout fxLayoutAlign=\"start center\">\n <h2 class=\"m-auto\">Checksheet</h2>\n </div>\n\n <div fxLayout=\"column\">\n <mat-card class=\"w-100\">\n <h4>Date: {{ submission?.date | date }}</h4>\n <h4>Format: {{ submission?.format?.title }}</h4>\n <h4>Creator: {{ submission?.creator?.name }}</h4>\n <h4 *ngIf=\"submission?.reviewer\">\n Reviewer: {{ submission?.reviewer?.name }}\n </h4>\n <h4 *ngIf=\"submission?.status\">\n Status: {{ submission?.status?.title }}\n </h4>\n\n <div\n class=\"my-2 d-print-none\"\n fxLayout=\"row\"\n fxLayoutGap=\"5px\"\n fxLayoutAlign=\"center\"\n >\n <app-checksheet-review-button\n [submission]=\"submission\"\n viewType=\"button\"\n [requestParams]=\"{ with: this.with }\"\n (reviewed)=\"onUpdated($event)\"\n ></app-checksheet-review-button>\n </div>\n </mat-card>\n </div>\n\n <div fxLayout=\"column\" *ngIf=\"submission\">\n <h2>Submission</h2>\n <app-checksheet-question-list\n class=\"w-100 pt-0 pr-4\"\n [submission]=\"submission\"\n [disableInput]=\"true\"\n >\n </app-checksheet-question-list>\n </div>\n\n <app-note-list\n *ngIf=\"submission?.id\"\n [relatedModelId]=\"submission?.id\"\n modelType=\"ChecksheetSubmission\"\n ></app-note-list>\n</div>\n\n<mat-progress-bar *ngIf=\"isLoading\" mode=\"indeterminate\"></mat-progress-bar>\n" }]
|
|
1685
|
+
}], ctorParameters: () => [{ type: i4.Location }, { type: i6$2.ActivatedRoute }, { type: ChecksheetService }] });
|
|
1686
|
+
|
|
1687
|
+
const errorMessages$1 = {
|
|
1688
|
+
date: {
|
|
1689
|
+
required: 'Date is required',
|
|
1690
|
+
invalid: 'Invalid date'
|
|
1691
|
+
},
|
|
1692
|
+
model_id: {
|
|
1693
|
+
required: 'Vehicle is required'
|
|
1694
|
+
},
|
|
1695
|
+
checksheet_format_id: {
|
|
1696
|
+
required: 'Checksheet Format is required'
|
|
1697
|
+
},
|
|
1698
|
+
status_id: {
|
|
1699
|
+
required: 'Status is required'
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
class ChecksheetViewComponent {
|
|
1703
|
+
formValidatorService;
|
|
1704
|
+
fb;
|
|
1705
|
+
spinnerService;
|
|
1706
|
+
alertService;
|
|
1707
|
+
location;
|
|
1708
|
+
errorHandler;
|
|
1709
|
+
dataManager;
|
|
1710
|
+
dialog;
|
|
1711
|
+
route;
|
|
1712
|
+
checksheetSubmissionService;
|
|
1713
|
+
checksheetSubmissionForm;
|
|
1714
|
+
submission;
|
|
1715
|
+
selectedFormat;
|
|
1716
|
+
submissionId;
|
|
1717
|
+
constructor(formValidatorService, fb, spinnerService, alertService, location, errorHandler, dataManager, dialog, route, checksheetSubmissionService) {
|
|
1718
|
+
this.formValidatorService = formValidatorService;
|
|
1719
|
+
this.fb = fb;
|
|
1720
|
+
this.spinnerService = spinnerService;
|
|
1721
|
+
this.alertService = alertService;
|
|
1722
|
+
this.location = location;
|
|
1723
|
+
this.errorHandler = errorHandler;
|
|
1724
|
+
this.dataManager = dataManager;
|
|
1725
|
+
this.dialog = dialog;
|
|
1726
|
+
this.route = route;
|
|
1727
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
1728
|
+
this.submissionId = parseInt(this.route.snapshot.params['submissionId']);
|
|
1729
|
+
this.createForm();
|
|
1730
|
+
}
|
|
1731
|
+
ngOnInit() {
|
|
1732
|
+
if (this.submissionId) {
|
|
1733
|
+
const params = {
|
|
1734
|
+
with: 'format.questions.type,format.questions.answers'
|
|
1735
|
+
};
|
|
1736
|
+
this.checksheetSubmissionService
|
|
1737
|
+
.show(this.submissionId, params)
|
|
1738
|
+
.subscribe({
|
|
1739
|
+
next: (response) => {
|
|
1740
|
+
this.submission = response?.item;
|
|
1741
|
+
this.selectedFormat = this.submission?.format;
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
createForm() {
|
|
1747
|
+
this.checksheetSubmissionForm = this.fb.group({
|
|
1748
|
+
id: [''],
|
|
1749
|
+
date: ['', Validators.compose([Validators.required, DateValidator()])],
|
|
1750
|
+
reviewer_id: [''],
|
|
1751
|
+
model_id: ['', Validators.required],
|
|
1752
|
+
model: ['vehicle'],
|
|
1753
|
+
status_id: [''],
|
|
1754
|
+
comments: [''],
|
|
1755
|
+
checksheet_format_id: ['', Validators.required]
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
redirectBack() {
|
|
1759
|
+
this.location.back();
|
|
1760
|
+
}
|
|
1761
|
+
/**Method to evaluate form fields*/
|
|
1762
|
+
isFieldValid(field) {
|
|
1763
|
+
return this.formValidatorService.isFieldValid(field, this.checksheetSubmissionForm);
|
|
1764
|
+
}
|
|
1765
|
+
/**Method to find error in form fields*/
|
|
1766
|
+
getErrorMessage(field) {
|
|
1767
|
+
return this.formValidatorService.getErrorMessage(field, this.checksheetSubmissionForm, errorMessages$1);
|
|
1768
|
+
}
|
|
1769
|
+
async submit() {
|
|
1770
|
+
if (this.checksheetSubmissionForm.valid) {
|
|
1771
|
+
this.spinnerService.show();
|
|
1772
|
+
let result;
|
|
1773
|
+
const model = this.checksheetSubmissionForm.value;
|
|
1774
|
+
const submission = (await this.dataManager.GET(`api/checksheets/${this.submission.id}`)).item;
|
|
1775
|
+
//Submission Validation for MSQYN
|
|
1776
|
+
let validSubmission = true;
|
|
1777
|
+
(submission.format.questions || [])
|
|
1778
|
+
.filter((question) => question.type_id === 7)
|
|
1779
|
+
.forEach((question) => {
|
|
1780
|
+
if (question?.submitted_answers == null ||
|
|
1781
|
+
(question?.answers || []).length >
|
|
1782
|
+
(question?.submitted_answer?.msq_answer || []).length) {
|
|
1783
|
+
this.alertService.addAlert(`Answer all the required Yes/No Question`, 'warn');
|
|
1784
|
+
validSubmission = false;
|
|
1785
|
+
return;
|
|
1786
|
+
}
|
|
1787
|
+
});
|
|
1788
|
+
if (!validSubmission) {
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1791
|
+
try {
|
|
1792
|
+
result = await this.dataManager.PUT(`api/checksheets/${model.id}`, model);
|
|
1793
|
+
this.alertService.addAlert('Checksheet saved successfully', 'success');
|
|
1794
|
+
}
|
|
1795
|
+
catch (error) {
|
|
1796
|
+
this.errorHandler.handleError(error, 'Unable to save Checksheet, try later');
|
|
1797
|
+
}
|
|
1798
|
+
finally {
|
|
1799
|
+
this.spinnerService.hide();
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
onSaved() {
|
|
1804
|
+
this.alertService.addAlert('Checksheet saved successfully!', 'success');
|
|
1805
|
+
this.redirectBack();
|
|
1806
|
+
}
|
|
1807
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetViewComponent, deps: [{ token: i1.FormValidatorService }, { token: i2.UntypedFormBuilder }, { token: i3$1.NgxSpinnerService }, { token: i1.AlertService }, { token: i4.Location }, { token: i1.ErrorHandlerService }, { token: i1.DataManager }, { token: i1$1.MatDialog }, { token: i6$2.ActivatedRoute }, { token: ChecksheetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1808
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetViewComponent, selector: "app-checksheet-view", ngImport: i0, template: "<app-checksheet-form [disableInput]=\"false\"></app-checksheet-form>\n", styles: [""], dependencies: [{ kind: "component", type: ChecksheetFormComponent, selector: "app-checksheet-form", inputs: ["disableInput"] }] });
|
|
1809
|
+
}
|
|
1810
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetViewComponent, decorators: [{
|
|
1811
|
+
type: Component,
|
|
1812
|
+
args: [{ selector: 'app-checksheet-view', template: "<app-checksheet-form [disableInput]=\"false\"></app-checksheet-form>\n" }]
|
|
1813
|
+
}], ctorParameters: () => [{ type: i1.FormValidatorService }, { type: i2.UntypedFormBuilder }, { type: i3$1.NgxSpinnerService }, { type: i1.AlertService }, { type: i4.Location }, { type: i1.ErrorHandlerService }, { type: i1.DataManager }, { type: i1$1.MatDialog }, { type: i6$2.ActivatedRoute }, { type: ChecksheetService }] });
|
|
1814
|
+
|
|
1815
|
+
const errorMessages = {
|
|
1816
|
+
date: {
|
|
1817
|
+
required: 'Date is required',
|
|
1818
|
+
invalid: 'Invalid date'
|
|
1819
|
+
},
|
|
1820
|
+
model_id: {
|
|
1821
|
+
required: 'Vehicle is required'
|
|
1822
|
+
},
|
|
1823
|
+
checksheet_format_id: {
|
|
1824
|
+
required: 'Checksheet Format is required'
|
|
1825
|
+
},
|
|
1826
|
+
status_id: {
|
|
1827
|
+
required: 'Status is required'
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
class ChecksheetSubmissionViewComponent {
|
|
1831
|
+
formValidatorService;
|
|
1832
|
+
fb;
|
|
1833
|
+
spinnerService;
|
|
1834
|
+
alertService;
|
|
1835
|
+
location;
|
|
1836
|
+
errorHandler;
|
|
1837
|
+
dataManager;
|
|
1838
|
+
dialog;
|
|
1839
|
+
route;
|
|
1840
|
+
service;
|
|
1841
|
+
checksheetSubmissionForm;
|
|
1842
|
+
submission;
|
|
1843
|
+
selectedFormat;
|
|
1844
|
+
submissionId;
|
|
1845
|
+
constructor(formValidatorService, fb, spinnerService, alertService, location, errorHandler, dataManager, dialog, route, service) {
|
|
1846
|
+
this.formValidatorService = formValidatorService;
|
|
1847
|
+
this.fb = fb;
|
|
1848
|
+
this.spinnerService = spinnerService;
|
|
1849
|
+
this.alertService = alertService;
|
|
1850
|
+
this.location = location;
|
|
1851
|
+
this.errorHandler = errorHandler;
|
|
1852
|
+
this.dataManager = dataManager;
|
|
1853
|
+
this.dialog = dialog;
|
|
1854
|
+
this.route = route;
|
|
1855
|
+
this.service = service;
|
|
1856
|
+
this.submissionId = parseInt(this.route.snapshot.params['submissionId']);
|
|
1857
|
+
this.createForm();
|
|
1858
|
+
}
|
|
1859
|
+
ngOnInit() {
|
|
1860
|
+
if (this.submissionId) {
|
|
1861
|
+
const params = {
|
|
1862
|
+
with: 'format.questions.type,format.questions.answers'
|
|
1863
|
+
};
|
|
1864
|
+
this.service
|
|
1865
|
+
.show(this.submissionId, params)
|
|
1866
|
+
.subscribe({
|
|
1867
|
+
next: (response) => {
|
|
1868
|
+
this.submission = response?.item;
|
|
1869
|
+
this.selectedFormat = this.submission?.format;
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
redirectBack() {
|
|
1875
|
+
this.location.back();
|
|
1876
|
+
}
|
|
1877
|
+
/**Method to evaluate form fields*/
|
|
1878
|
+
isFieldValid(field) {
|
|
1879
|
+
return this.formValidatorService.isFieldValid(field, this.checksheetSubmissionForm);
|
|
1880
|
+
}
|
|
1881
|
+
/**Method to find error in form fields*/
|
|
1882
|
+
getErrorMessage(field) {
|
|
1883
|
+
return this.formValidatorService.getErrorMessage(field, this.checksheetSubmissionForm, errorMessages);
|
|
1884
|
+
}
|
|
1885
|
+
async submit() {
|
|
1886
|
+
if (this.checksheetSubmissionForm.valid) {
|
|
1887
|
+
this.spinnerService.show();
|
|
1888
|
+
let result;
|
|
1889
|
+
const model = this.checksheetSubmissionForm.value;
|
|
1890
|
+
const submission = (await this.dataManager.GET(`api/checksheet-submissions/${this.submission.id}`)).item;
|
|
1891
|
+
//Submission Validation for MSQYN
|
|
1892
|
+
let validSubmission = true;
|
|
1893
|
+
(submission.format.questions || [])
|
|
1894
|
+
.filter((question) => question.type_id === 7)
|
|
1895
|
+
.forEach((question) => {
|
|
1896
|
+
if (question?.submitted_answers == null ||
|
|
1897
|
+
(question?.answers || []).length >
|
|
1898
|
+
(question?.submitted_answer?.msq_answer || []).length) {
|
|
1899
|
+
this.alertService.addAlert(`Answer all the required Yes/No Question`, 'warn');
|
|
1900
|
+
validSubmission = false;
|
|
1901
|
+
return;
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
if (!validSubmission) {
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
try {
|
|
1908
|
+
result = await this.dataManager.PUT(`api/checksheet-submissions/${model.id}`, model);
|
|
1909
|
+
this.alertService.addAlert('Checksheet Submission saved successfully', 'success');
|
|
1910
|
+
}
|
|
1911
|
+
catch (error) {
|
|
1912
|
+
this.errorHandler.handleError(error, 'Unable to save checksheet submission, try later');
|
|
1913
|
+
}
|
|
1914
|
+
finally {
|
|
1915
|
+
this.spinnerService.hide();
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
onSaved() {
|
|
1920
|
+
this.alertService.addAlert('Checksheet submission saved successfully!', 'success');
|
|
1921
|
+
this.redirectBack();
|
|
1922
|
+
}
|
|
1923
|
+
createForm() {
|
|
1924
|
+
this.checksheetSubmissionForm = this.fb.group({
|
|
1925
|
+
id: [''],
|
|
1926
|
+
date: ['', Validators.compose([Validators.required, DateValidator()])],
|
|
1927
|
+
reviewer_id: [''],
|
|
1928
|
+
model_id: ['', Validators.required],
|
|
1929
|
+
model: ['vehicle'],
|
|
1930
|
+
status_id: [''],
|
|
1931
|
+
comments: [''],
|
|
1932
|
+
checksheet_format_id: ['', Validators.required]
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionViewComponent, deps: [{ token: i1.FormValidatorService }, { token: i2.UntypedFormBuilder }, { token: i3$1.NgxSpinnerService }, { token: i1.AlertService }, { token: i4.Location }, { token: i1.ErrorHandlerService }, { token: i1.DataManager }, { token: i1$1.MatDialog }, { token: i6$2.ActivatedRoute }, { token: ChecksheetService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1936
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionViewComponent, selector: "app-checksheet-submission-view", ngImport: i0, template: "<div>\n <h2 class=\"m-0\">Checksheet</h2>\n\n <div class=\"d-flex justify-content-start align-items-start gap-1\">\n <app-checksheet-question-list\n *ngIf=\"submission\"\n class=\"w-100 p-4\"\n [submission]=\"submission\"\n style=\"width: calc(70% - 1rem)\"\n >\n </app-checksheet-question-list>\n <div style=\"width: calc(30% - 1rem)\">\n <mat-card class=\"w-100\" *ngIf=\"submission\">\n <app-checksheet-submission-form\n (cancelled)=\"redirectBack()\"\n (saved)=\"onSaved()\"\n [checksheetSubmission]=\"submission\"\n ></app-checksheet-submission-form>\n </mat-card>\n <mat-card class=\"mt-2 p-0\" *ngIf=\"submission?.id\">\n <app-note-list\n [relatedModelId]=\"submission?.id\"\n modelType=\"ChecksheetSubmission\"\n ></app-note-list>\n </mat-card>\n </div>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i1.NoteListComponent, selector: "app-note-list", inputs: ["relatedModelId", "modelType", "readonly", "labelText", "commentsView", "viewMode"] }, { kind: "component", type: ChecksheetQuestionListComponent, selector: "app-checksheet-question-list", inputs: ["checksheet", "submission", "disableInput"], outputs: ["checksheetChange"] }, { kind: "component", type: ChecksheetSubmissionFormComponent, selector: "app-checksheet-submission-form", inputs: ["submittableType", "submittableId", "checksheetSubmission"], outputs: ["cancelled", "saved"] }] });
|
|
1937
|
+
}
|
|
1938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionViewComponent, decorators: [{
|
|
1939
|
+
type: Component,
|
|
1940
|
+
args: [{ selector: 'app-checksheet-submission-view', template: "<div>\n <h2 class=\"m-0\">Checksheet</h2>\n\n <div class=\"d-flex justify-content-start align-items-start gap-1\">\n <app-checksheet-question-list\n *ngIf=\"submission\"\n class=\"w-100 p-4\"\n [submission]=\"submission\"\n style=\"width: calc(70% - 1rem)\"\n >\n </app-checksheet-question-list>\n <div style=\"width: calc(30% - 1rem)\">\n <mat-card class=\"w-100\" *ngIf=\"submission\">\n <app-checksheet-submission-form\n (cancelled)=\"redirectBack()\"\n (saved)=\"onSaved()\"\n [checksheetSubmission]=\"submission\"\n ></app-checksheet-submission-form>\n </mat-card>\n <mat-card class=\"mt-2 p-0\" *ngIf=\"submission?.id\">\n <app-note-list\n [relatedModelId]=\"submission?.id\"\n modelType=\"ChecksheetSubmission\"\n ></app-note-list>\n </mat-card>\n </div>\n </div>\n</div>\n" }]
|
|
1941
|
+
}], ctorParameters: () => [{ type: i1.FormValidatorService }, { type: i2.UntypedFormBuilder }, { type: i3$1.NgxSpinnerService }, { type: i1.AlertService }, { type: i4.Location }, { type: i1.ErrorHandlerService }, { type: i1.DataManager }, { type: i1$1.MatDialog }, { type: i6$2.ActivatedRoute }, { type: ChecksheetService }] });
|
|
1942
|
+
|
|
1943
|
+
const routes = [
|
|
1944
|
+
{ path: 'checksheet-format-list', component: ChecksheetFormatListComponent },
|
|
1945
|
+
{ path: 'checksheet-report', component: ChecksheetReportComponent },
|
|
1946
|
+
{ path: 'checksheet-form', component: ChecksheetFormComponent },
|
|
1947
|
+
{ path: 'checksheet-view/:checksheetId', component: ChecksheetViewComponent },
|
|
1948
|
+
{ path: 'checksheet-form/:checksheetId', component: ChecksheetFormComponent },
|
|
1949
|
+
{
|
|
1950
|
+
path: 'checksheets',
|
|
1951
|
+
component: ChecksheetListComponent
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
path: 'checksheets-view/:submissionId',
|
|
1955
|
+
component: ChecksheetNodeViewComponent
|
|
1956
|
+
},
|
|
1957
|
+
{
|
|
1958
|
+
path: 'checksheets/:submissionId/view',
|
|
1959
|
+
component: ChecksheetSubmissionViewComponent
|
|
1960
|
+
},
|
|
1961
|
+
{ path: '**', redirectTo: 'checksheet-format-list', pathMatch: 'full' }
|
|
1962
|
+
];
|
|
1963
|
+
class ChecksheetRoutingModule {
|
|
1964
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1965
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetRoutingModule, imports: [i6$2.RouterModule], exports: [RouterModule] });
|
|
1966
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] });
|
|
1967
|
+
}
|
|
1968
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetRoutingModule, decorators: [{
|
|
1969
|
+
type: NgModule,
|
|
1970
|
+
args: [{
|
|
1971
|
+
imports: [RouterModule.forChild(routes)],
|
|
1972
|
+
exports: [RouterModule]
|
|
1973
|
+
}]
|
|
1974
|
+
}] });
|
|
1975
|
+
|
|
1976
|
+
class MechanicalIssueFormComponent {
|
|
1977
|
+
dialogRef;
|
|
1978
|
+
data;
|
|
1979
|
+
service;
|
|
1980
|
+
errorHandler;
|
|
1981
|
+
spinnerService;
|
|
1982
|
+
submission;
|
|
1983
|
+
mechanicalIssues;
|
|
1984
|
+
constructor(dialogRef, data, service, errorHandler, spinnerService) {
|
|
1985
|
+
this.dialogRef = dialogRef;
|
|
1986
|
+
this.data = data;
|
|
1987
|
+
this.service = service;
|
|
1988
|
+
this.errorHandler = errorHandler;
|
|
1989
|
+
this.spinnerService = spinnerService;
|
|
1990
|
+
}
|
|
1991
|
+
ngOnInit() {
|
|
1992
|
+
if (!this.data?.submission) {
|
|
1993
|
+
// do some error
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
this.submission = this.data.submission;
|
|
1997
|
+
this.loadMechanicalIssues();
|
|
1998
|
+
}
|
|
1999
|
+
async loadMechanicalIssues() {
|
|
2000
|
+
let result = await this.service.getMechanicalIssues(this.submission.id);
|
|
2001
|
+
console.log(result);
|
|
2002
|
+
this.mechanicalIssues = result.data;
|
|
2003
|
+
this.mechanicalIssues.forEach((element) => {
|
|
2004
|
+
element.is_selected = true;
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
async submit() {
|
|
2008
|
+
let result;
|
|
2009
|
+
try {
|
|
2010
|
+
this.spinnerService.show();
|
|
2011
|
+
let data = {
|
|
2012
|
+
submission_id: this.submission,
|
|
2013
|
+
issues: this.mechanicalIssues
|
|
2014
|
+
};
|
|
2015
|
+
result = await this.service.createMechanicalIssues(this.submission.id, data);
|
|
2016
|
+
}
|
|
2017
|
+
catch (error) {
|
|
2018
|
+
this.errorHandler.handleError(error);
|
|
2019
|
+
}
|
|
2020
|
+
finally {
|
|
2021
|
+
this.spinnerService.hide();
|
|
2022
|
+
if (result) {
|
|
2023
|
+
this.dialogRef.close(result.item);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MechanicalIssueFormComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: ChecksheetService }, { token: i1.ErrorHandlerService }, { token: i3$1.NgxSpinnerService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2028
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: MechanicalIssueFormComponent, selector: "app-mechanical-issue-form", ngImport: i0, template: "<div>\n <h4>Mechanical Issues Form</h4>\n <form>\n <div *ngFor=\"let issue of mechanicalIssues\">\n <mat-checkbox name=\"mechanicalIssues[]\" [(ngModel)]=\"issue.is_selected\">\n {{issue.question.label}}: {{issue.answer.value}}\n </mat-checkbox>\n </div>\n <div>\n <button mat-raised-button type=\"submit\" color=\"primary\" (click)=\"submit()\">Save</button>\n </div>\n </form>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
2029
|
+
}
|
|
2030
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MechanicalIssueFormComponent, decorators: [{
|
|
2031
|
+
type: Component,
|
|
2032
|
+
args: [{ selector: 'app-mechanical-issue-form', template: "<div>\n <h4>Mechanical Issues Form</h4>\n <form>\n <div *ngFor=\"let issue of mechanicalIssues\">\n <mat-checkbox name=\"mechanicalIssues[]\" [(ngModel)]=\"issue.is_selected\">\n {{issue.question.label}}: {{issue.answer.value}}\n </mat-checkbox>\n </div>\n <div>\n <button mat-raised-button type=\"submit\" color=\"primary\" (click)=\"submit()\">Save</button>\n </div>\n </form>\n</div>" }]
|
|
2033
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
2034
|
+
type: Inject,
|
|
2035
|
+
args: [MAT_DIALOG_DATA]
|
|
2036
|
+
}] }, { type: ChecksheetService }, { type: i1.ErrorHandlerService }, { type: i3$1.NgxSpinnerService }] });
|
|
2037
|
+
|
|
2038
|
+
/*
|
|
2039
|
+
* This module imports and re-exports all Angular Material modules for convenience,
|
|
2040
|
+
* so only 1 module import is needed in your feature modules.
|
|
2041
|
+
* See https://material.angular.io/guide/getting-started#step-3-import-the-component-modules.
|
|
2042
|
+
*
|
|
2043
|
+
* To optimize your production builds, you should only import the components used in your app.
|
|
2044
|
+
*/
|
|
2045
|
+
class MaterialModule {
|
|
2046
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2047
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: MaterialModule, exports: [MatAutocompleteModule,
|
|
2048
|
+
MatBadgeModule,
|
|
2049
|
+
MatButtonModule,
|
|
2050
|
+
MatButtonToggleModule,
|
|
2051
|
+
MatCardModule,
|
|
2052
|
+
MatCheckboxModule,
|
|
2053
|
+
MatChipsModule,
|
|
2054
|
+
MatCommonModule,
|
|
2055
|
+
MatDatepickerModule,
|
|
2056
|
+
MatDialogModule,
|
|
2057
|
+
MatDividerModule,
|
|
2058
|
+
MatExpansionModule,
|
|
2059
|
+
MatFormFieldModule,
|
|
2060
|
+
MatGridListModule,
|
|
2061
|
+
MatIconModule,
|
|
2062
|
+
MatInputModule,
|
|
2063
|
+
MatLineModule,
|
|
2064
|
+
MatListModule,
|
|
2065
|
+
MatMenuModule,
|
|
2066
|
+
MatNativeDateModule,
|
|
2067
|
+
MatOptionModule,
|
|
2068
|
+
MatPaginatorModule,
|
|
2069
|
+
MatProgressBarModule,
|
|
2070
|
+
MatProgressSpinnerModule,
|
|
2071
|
+
MatPseudoCheckboxModule,
|
|
2072
|
+
MatRadioModule,
|
|
2073
|
+
MatRippleModule,
|
|
2074
|
+
MatSelectModule,
|
|
2075
|
+
MatSidenavModule,
|
|
2076
|
+
MatSlideToggleModule,
|
|
2077
|
+
MatSliderModule,
|
|
2078
|
+
MatSnackBarModule,
|
|
2079
|
+
MatSortModule,
|
|
2080
|
+
MatStepperModule,
|
|
2081
|
+
MatTableModule,
|
|
2082
|
+
MatTabsModule,
|
|
2083
|
+
MatToolbarModule,
|
|
2084
|
+
MatTooltipModule,
|
|
2085
|
+
MatTreeModule] });
|
|
2086
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MaterialModule, imports: [MatAutocompleteModule,
|
|
2087
|
+
MatBadgeModule,
|
|
2088
|
+
MatButtonModule,
|
|
2089
|
+
MatButtonToggleModule,
|
|
2090
|
+
MatCardModule,
|
|
2091
|
+
MatCheckboxModule,
|
|
2092
|
+
MatChipsModule,
|
|
2093
|
+
MatCommonModule,
|
|
2094
|
+
MatDatepickerModule,
|
|
2095
|
+
MatDialogModule,
|
|
2096
|
+
MatDividerModule,
|
|
2097
|
+
MatExpansionModule,
|
|
2098
|
+
MatFormFieldModule,
|
|
2099
|
+
MatGridListModule,
|
|
2100
|
+
MatIconModule,
|
|
2101
|
+
MatInputModule,
|
|
2102
|
+
MatLineModule,
|
|
2103
|
+
MatListModule,
|
|
2104
|
+
MatMenuModule,
|
|
2105
|
+
MatNativeDateModule,
|
|
2106
|
+
MatOptionModule,
|
|
2107
|
+
MatPaginatorModule,
|
|
2108
|
+
MatProgressBarModule,
|
|
2109
|
+
MatProgressSpinnerModule,
|
|
2110
|
+
MatPseudoCheckboxModule,
|
|
2111
|
+
MatRadioModule,
|
|
2112
|
+
MatRippleModule,
|
|
2113
|
+
MatSelectModule,
|
|
2114
|
+
MatSidenavModule,
|
|
2115
|
+
MatSlideToggleModule,
|
|
2116
|
+
MatSliderModule,
|
|
2117
|
+
MatSnackBarModule,
|
|
2118
|
+
MatSortModule,
|
|
2119
|
+
MatStepperModule,
|
|
2120
|
+
MatTableModule,
|
|
2121
|
+
MatTabsModule,
|
|
2122
|
+
MatToolbarModule,
|
|
2123
|
+
MatTooltipModule,
|
|
2124
|
+
MatTreeModule] });
|
|
2125
|
+
}
|
|
2126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MaterialModule, decorators: [{
|
|
2127
|
+
type: NgModule,
|
|
2128
|
+
args: [{
|
|
2129
|
+
exports: [
|
|
2130
|
+
MatAutocompleteModule,
|
|
2131
|
+
MatBadgeModule,
|
|
2132
|
+
MatButtonModule,
|
|
2133
|
+
MatButtonToggleModule,
|
|
2134
|
+
MatCardModule,
|
|
2135
|
+
MatCheckboxModule,
|
|
2136
|
+
MatChipsModule,
|
|
2137
|
+
MatCommonModule,
|
|
2138
|
+
MatDatepickerModule,
|
|
2139
|
+
MatDialogModule,
|
|
2140
|
+
MatDividerModule,
|
|
2141
|
+
MatExpansionModule,
|
|
2142
|
+
MatFormFieldModule,
|
|
2143
|
+
MatGridListModule,
|
|
2144
|
+
MatIconModule,
|
|
2145
|
+
MatInputModule,
|
|
2146
|
+
MatLineModule,
|
|
2147
|
+
MatListModule,
|
|
2148
|
+
MatMenuModule,
|
|
2149
|
+
MatNativeDateModule,
|
|
2150
|
+
MatOptionModule,
|
|
2151
|
+
MatPaginatorModule,
|
|
2152
|
+
MatProgressBarModule,
|
|
2153
|
+
MatProgressSpinnerModule,
|
|
2154
|
+
MatPseudoCheckboxModule,
|
|
2155
|
+
MatRadioModule,
|
|
2156
|
+
MatRippleModule,
|
|
2157
|
+
MatSelectModule,
|
|
2158
|
+
MatSidenavModule,
|
|
2159
|
+
MatSlideToggleModule,
|
|
2160
|
+
MatSliderModule,
|
|
2161
|
+
MatSnackBarModule,
|
|
2162
|
+
MatSortModule,
|
|
2163
|
+
MatStepperModule,
|
|
2164
|
+
MatTableModule,
|
|
2165
|
+
MatTabsModule,
|
|
2166
|
+
MatToolbarModule,
|
|
2167
|
+
MatTooltipModule,
|
|
2168
|
+
MatTreeModule
|
|
2169
|
+
]
|
|
2170
|
+
}]
|
|
2171
|
+
}] });
|
|
2172
|
+
|
|
2173
|
+
class SharedModule {
|
|
2174
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2175
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, imports: [FlexLayoutModule,
|
|
2176
|
+
MaterialModule,
|
|
2177
|
+
CommonModule], exports: [FlexLayoutModule,
|
|
2178
|
+
MaterialModule,
|
|
2179
|
+
NgxPermissionsModule,
|
|
2180
|
+
FormsModule,
|
|
2181
|
+
ReactiveFormsModule,
|
|
2182
|
+
InfiniteScrollModule,
|
|
2183
|
+
RouterModule,
|
|
2184
|
+
LoaderModule] });
|
|
2185
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, imports: [FlexLayoutModule,
|
|
2186
|
+
MaterialModule,
|
|
2187
|
+
CommonModule, FlexLayoutModule,
|
|
2188
|
+
MaterialModule,
|
|
2189
|
+
NgxPermissionsModule,
|
|
2190
|
+
FormsModule,
|
|
2191
|
+
ReactiveFormsModule,
|
|
2192
|
+
InfiniteScrollModule,
|
|
2193
|
+
RouterModule,
|
|
2194
|
+
LoaderModule] });
|
|
2195
|
+
}
|
|
2196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: SharedModule, decorators: [{
|
|
2197
|
+
type: NgModule,
|
|
2198
|
+
args: [{
|
|
2199
|
+
imports: [
|
|
2200
|
+
FlexLayoutModule,
|
|
2201
|
+
MaterialModule,
|
|
2202
|
+
CommonModule
|
|
2203
|
+
],
|
|
2204
|
+
exports: [
|
|
2205
|
+
FlexLayoutModule,
|
|
2206
|
+
MaterialModule,
|
|
2207
|
+
NgxPermissionsModule,
|
|
2208
|
+
FormsModule,
|
|
2209
|
+
ReactiveFormsModule,
|
|
2210
|
+
InfiniteScrollModule,
|
|
2211
|
+
RouterModule,
|
|
2212
|
+
LoaderModule
|
|
2213
|
+
]
|
|
2214
|
+
}]
|
|
2215
|
+
}] });
|
|
2216
|
+
|
|
2217
|
+
class ChecksheetSubmissionFormButtonComponent {
|
|
2218
|
+
matDialog;
|
|
2219
|
+
alertService;
|
|
2220
|
+
router;
|
|
2221
|
+
submittableType = 'fixed-asset';
|
|
2222
|
+
submittableId;
|
|
2223
|
+
saved = new EventEmitter();
|
|
2224
|
+
constructor(matDialog, alertService, router) {
|
|
2225
|
+
this.matDialog = matDialog;
|
|
2226
|
+
this.alertService = alertService;
|
|
2227
|
+
this.router = router;
|
|
2228
|
+
}
|
|
2229
|
+
/**
|
|
2230
|
+
* Open checksheet submission form.
|
|
2231
|
+
*
|
|
2232
|
+
* @param templateRef
|
|
2233
|
+
*/
|
|
2234
|
+
openForm(templateRef) {
|
|
2235
|
+
this.matDialog.open(templateRef, { width: '500px' });
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Handle checksheet submission save event.
|
|
2239
|
+
*
|
|
2240
|
+
* @param checksheetSubmission
|
|
2241
|
+
*/
|
|
2242
|
+
onSaved(checksheetSubmission) {
|
|
2243
|
+
this.saved.emit(checksheetSubmission);
|
|
2244
|
+
this.matDialog.closeAll();
|
|
2245
|
+
this.alertService.addAlert('The checksheet submission is saved successfully!', 'success');
|
|
2246
|
+
this.router.navigate([
|
|
2247
|
+
'fixed-assets/checksheets/checksheet-submissions',
|
|
2248
|
+
checksheetSubmission?.id,
|
|
2249
|
+
'view'
|
|
2250
|
+
]);
|
|
2251
|
+
}
|
|
2252
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFormButtonComponent, deps: [{ token: i1$1.MatDialog }, { token: i1.AlertService }, { token: i6$2.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
2253
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionFormButtonComponent, selector: "app-checksheet-submission-form-button", inputs: { submittableType: "submittableType", submittableId: "submittableId" }, outputs: { saved: "saved" }, ngImport: i0, template: "<span\n *ngIf=\"submittableId\"\n class=\"material-symbols-outlined text-secondary\"\n matTooltip=\"Add Checksheet Submission\"\n (click)=\"openForm(formTemplate)\"\n>\n assignment_turned_in\n</span>\n<mat-icon\n *ngIf=\"!submittableId\"\n class=\"cursor-pointer text-secondary\"\n (click)=\"openForm(formTemplate)\"\n>\n add\n</mat-icon>\n\n<ng-template #formTemplate>\n <app-checksheet-submission-form\n mat-dialog-content\n (cancelled)=\"matDialog.closeAll()\"\n (saved)=\"onSaved($event)\"\n [submittableType]=\"submittableType\"\n [submittableId]=\"submittableId\"\n ></app-checksheet-submission-form>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6$3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: ChecksheetSubmissionFormComponent, selector: "app-checksheet-submission-form", inputs: ["submittableType", "submittableId", "checksheetSubmission"], outputs: ["cancelled", "saved"] }] });
|
|
2254
|
+
}
|
|
2255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionFormButtonComponent, decorators: [{
|
|
2256
|
+
type: Component,
|
|
2257
|
+
args: [{ selector: 'app-checksheet-submission-form-button', template: "<span\n *ngIf=\"submittableId\"\n class=\"material-symbols-outlined text-secondary\"\n matTooltip=\"Add Checksheet Submission\"\n (click)=\"openForm(formTemplate)\"\n>\n assignment_turned_in\n</span>\n<mat-icon\n *ngIf=\"!submittableId\"\n class=\"cursor-pointer text-secondary\"\n (click)=\"openForm(formTemplate)\"\n>\n add\n</mat-icon>\n\n<ng-template #formTemplate>\n <app-checksheet-submission-form\n mat-dialog-content\n (cancelled)=\"matDialog.closeAll()\"\n (saved)=\"onSaved($event)\"\n [submittableType]=\"submittableType\"\n [submittableId]=\"submittableId\"\n ></app-checksheet-submission-form>\n</ng-template>\n" }]
|
|
2258
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialog }, { type: i1.AlertService }, { type: i6$2.Router }], propDecorators: { submittableType: [{
|
|
2259
|
+
type: Input
|
|
2260
|
+
}], submittableId: [{
|
|
2261
|
+
type: Input
|
|
2262
|
+
}], saved: [{
|
|
2263
|
+
type: Output
|
|
2264
|
+
}] } });
|
|
2265
|
+
|
|
2266
|
+
class ChecksheetSubmissionService extends TechlifyServiceBaseClass {
|
|
2267
|
+
constructor(httpService) {
|
|
2268
|
+
super(httpService, 'checksheet-submissions');
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Sent request to submit the checksheet submission.
|
|
2272
|
+
*
|
|
2273
|
+
* @param submissionId
|
|
2274
|
+
* @param params
|
|
2275
|
+
*/
|
|
2276
|
+
submit(submissionId, params) {
|
|
2277
|
+
return this.http.put('api/checksheet-submissions/' + submissionId + '/submit', {}, { params });
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Send request to submit the checksheet submission review.
|
|
2281
|
+
*
|
|
2282
|
+
* @param submissionId
|
|
2283
|
+
* @param params
|
|
2284
|
+
*/
|
|
2285
|
+
review(submissionId, params) {
|
|
2286
|
+
return this.http.put('api/checksheet-submissions/' + submissionId + '/review', {}, { params });
|
|
2287
|
+
}
|
|
2288
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionService, deps: [{ token: i1.HttpService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2289
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionService, providedIn: 'root' });
|
|
2290
|
+
}
|
|
2291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionService, decorators: [{
|
|
2292
|
+
type: Injectable,
|
|
2293
|
+
args: [{
|
|
2294
|
+
providedIn: 'root'
|
|
2295
|
+
}]
|
|
2296
|
+
}], ctorParameters: () => [{ type: i1.HttpService }] });
|
|
2297
|
+
|
|
2298
|
+
class ChecksheetSubmissionReviewButtonComponent {
|
|
2299
|
+
matDialog;
|
|
2300
|
+
credentialsService;
|
|
2301
|
+
checksheetSubmissionService;
|
|
2302
|
+
alertService;
|
|
2303
|
+
submission;
|
|
2304
|
+
viewType = 'icon';
|
|
2305
|
+
requestParams;
|
|
2306
|
+
reviewed = new EventEmitter();
|
|
2307
|
+
user;
|
|
2308
|
+
isWorking = false;
|
|
2309
|
+
constructor(matDialog, credentialsService, checksheetSubmissionService, alertService) {
|
|
2310
|
+
this.matDialog = matDialog;
|
|
2311
|
+
this.credentialsService = credentialsService;
|
|
2312
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
2313
|
+
this.alertService = alertService;
|
|
2314
|
+
this.user = this.credentialsService.credentials?.user;
|
|
2315
|
+
}
|
|
2316
|
+
/**
|
|
2317
|
+
* Show the review dialog.
|
|
2318
|
+
*
|
|
2319
|
+
* @param templateRef
|
|
2320
|
+
*/
|
|
2321
|
+
openDialog(templateRef) {
|
|
2322
|
+
this.matDialog.open(templateRef, { width: '400px' });
|
|
2323
|
+
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Review checksheet.
|
|
2326
|
+
*/
|
|
2327
|
+
reviewChecksheet() {
|
|
2328
|
+
this.isWorking = true;
|
|
2329
|
+
this.checksheetSubmissionService
|
|
2330
|
+
.review(this.submission?.id, this.requestParams)
|
|
2331
|
+
.subscribe({
|
|
2332
|
+
next: (response) => {
|
|
2333
|
+
this.matDialog.closeAll();
|
|
2334
|
+
this.isWorking = false;
|
|
2335
|
+
this.reviewed.next(response?.item);
|
|
2336
|
+
this.alertService.addAlert('The checksheet submission marked as reviewed.', 'success');
|
|
2337
|
+
},
|
|
2338
|
+
error: () => (this.isWorking = false)
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionReviewButtonComponent, deps: [{ token: i1$1.MatDialog }, { token: i1.CredentialsService }, { token: ChecksheetSubmissionService }, { token: i1.AlertService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2342
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionReviewButtonComponent, selector: "app-checksheet-submission-review-button", inputs: { submission: "submission", viewType: "viewType", requestParams: "requestParams" }, outputs: { reviewed: "reviewed" }, ngImport: i0, template: "<ng-container\n *ngIf=\"submission?.status_id === 2 && submission?.creator_id !== user?.id\"\n>\n <button\n *ngIf=\"viewType === 'button'\"\n mat-raised-button\n color=\"primary\"\n type=\"button\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n Review\n </button>\n\n <mat-icon\n *ngIf=\"viewType === 'icon'\"\n class=\"cursor-pointer\"\n matTooltip=\"Review\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n rate_review\n </mat-icon>\n</ng-container>\n\n<ng-template #reviewTemplate>\n <h3 mat-dialog-title>Review Checksheet Submission</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to mark the checksheet submission as Reviewed?</p>\n </div>\n <div mat-dialog-actions class=\"d-flex justify-content-end align-items-center\">\n <button [disabled]=\"isWorking\" mat-flat-button mat-dialog-close>\n Cancel\n </button>\n <button\n [disabled]=\"isWorking\"\n mat-raised-button\n color=\"primary\"\n (click)=\"reviewChecksheet()\"\n >\n Review\n </button>\n </div>\n</ng-template>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i8.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6$3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] });
|
|
2343
|
+
}
|
|
2344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionReviewButtonComponent, decorators: [{
|
|
2345
|
+
type: Component,
|
|
2346
|
+
args: [{ selector: 'app-checksheet-submission-review-button', template: "<ng-container\n *ngIf=\"submission?.status_id === 2 && submission?.creator_id !== user?.id\"\n>\n <button\n *ngIf=\"viewType === 'button'\"\n mat-raised-button\n color=\"primary\"\n type=\"button\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n Review\n </button>\n\n <mat-icon\n *ngIf=\"viewType === 'icon'\"\n class=\"cursor-pointer\"\n matTooltip=\"Review\"\n (click)=\"openDialog(reviewTemplate)\"\n >\n rate_review\n </mat-icon>\n</ng-container>\n\n<ng-template #reviewTemplate>\n <h3 mat-dialog-title>Review Checksheet Submission</h3>\n <div mat-dialog-content>\n <p>Are you sure you want to mark the checksheet submission as Reviewed?</p>\n </div>\n <div mat-dialog-actions class=\"d-flex justify-content-end align-items-center\">\n <button [disabled]=\"isWorking\" mat-flat-button mat-dialog-close>\n Cancel\n </button>\n <button\n [disabled]=\"isWorking\"\n mat-raised-button\n color=\"primary\"\n (click)=\"reviewChecksheet()\"\n >\n Review\n </button>\n </div>\n</ng-template>\n" }]
|
|
2347
|
+
}], ctorParameters: () => [{ type: i1$1.MatDialog }, { type: i1.CredentialsService }, { type: ChecksheetSubmissionService }, { type: i1.AlertService }], propDecorators: { submission: [{
|
|
2348
|
+
type: Input
|
|
2349
|
+
}], viewType: [{
|
|
2350
|
+
type: Input
|
|
2351
|
+
}], requestParams: [{
|
|
2352
|
+
type: Input
|
|
2353
|
+
}], reviewed: [{
|
|
2354
|
+
type: Output
|
|
2355
|
+
}] } });
|
|
2356
|
+
|
|
2357
|
+
let ChecksheetSubmissionListComponent = class ChecksheetSubmissionListComponent extends TechlifyListingControllerInterface {
|
|
2358
|
+
alertService;
|
|
2359
|
+
fb;
|
|
2360
|
+
checksheetSubmissionService;
|
|
2361
|
+
requestHelperService;
|
|
2362
|
+
displayedColumns = [
|
|
2363
|
+
'index',
|
|
2364
|
+
'date',
|
|
2365
|
+
'format.title',
|
|
2366
|
+
'creator.name',
|
|
2367
|
+
'reviewer.name',
|
|
2368
|
+
'status.title',
|
|
2369
|
+
'actions'
|
|
2370
|
+
];
|
|
2371
|
+
with = 'format,creator,reviewer,status';
|
|
2372
|
+
constructor(alertService, fb, checksheetSubmissionService, requestHelperService) {
|
|
2373
|
+
super();
|
|
2374
|
+
this.alertService = alertService;
|
|
2375
|
+
this.fb = fb;
|
|
2376
|
+
this.checksheetSubmissionService = checksheetSubmissionService;
|
|
2377
|
+
this.requestHelperService = requestHelperService;
|
|
2378
|
+
this.createForm();
|
|
2379
|
+
}
|
|
2380
|
+
ngOnInit() {
|
|
2381
|
+
this.loadData();
|
|
2382
|
+
this.filterForm.valueChanges
|
|
2383
|
+
.pipe(debounceTime$1(800))
|
|
2384
|
+
.subscribe(() => this.reload());
|
|
2385
|
+
}
|
|
2386
|
+
createForm() {
|
|
2387
|
+
this.filterForm = this.fb.group({
|
|
2388
|
+
duration: [Timeline.ALL],
|
|
2389
|
+
date_from: [''],
|
|
2390
|
+
date_to: [''],
|
|
2391
|
+
status_ids: [''],
|
|
2392
|
+
creator_ids: [''],
|
|
2393
|
+
reviewer_ids: [''],
|
|
2394
|
+
format_ids: [''],
|
|
2395
|
+
sort_by: ['created_at|DESC'],
|
|
2396
|
+
with: [this.with]
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
loadData() {
|
|
2400
|
+
this.isWorking = true;
|
|
2401
|
+
const params = {
|
|
2402
|
+
...this.requestHelperService.convertToFormData(this.filterForm.value),
|
|
2403
|
+
perPage: this.perPage,
|
|
2404
|
+
page: this.page
|
|
2405
|
+
};
|
|
2406
|
+
this.checksheetSubmissionService.index(params).subscribe({
|
|
2407
|
+
next: (response) => {
|
|
2408
|
+
this.models = this.models.concat(response?.data);
|
|
2409
|
+
this.lastPage = response?.last_page;
|
|
2410
|
+
this.isWorking = false;
|
|
2411
|
+
},
|
|
2412
|
+
error: () => (this.isWorking = false)
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
onDurationChange(timelineValue) {
|
|
2416
|
+
let { date_to, date_from } = timelineValue;
|
|
2417
|
+
this.filterForm.patchValue({
|
|
2418
|
+
date_from: date_from ? moment(date_from).format('YYYY-MM-DD') : '',
|
|
2419
|
+
date_to: date_to ? moment(date_to).format('YYYY-MM-DD') : ''
|
|
2420
|
+
});
|
|
2421
|
+
}
|
|
2422
|
+
/**
|
|
2423
|
+
* Handle checksheet submission delete event.
|
|
2424
|
+
*/
|
|
2425
|
+
onDeleted() {
|
|
2426
|
+
this.alertService.addAlert('Checksheet submission deleted successfully!', 'success');
|
|
2427
|
+
this.reload();
|
|
2428
|
+
}
|
|
2429
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionListComponent, deps: [{ token: i1.AlertService }, { token: i2.UntypedFormBuilder }, { token: ChecksheetSubmissionService }, { token: i1.RequestHelperService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2430
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ChecksheetSubmissionListComponent, selector: "app-checksheet-submission-list", usesInheritance: true, ngImport: i0, template: "<div class=\"d-flex justify-content-center align-items-center gap-3\">\n <h3 class=\"m-0 font-weight-bold\">Checksheet Submissions</h3>\n <app-checksheet-submission-form-button></app-checksheet-submission-form-button>\n</div>\n\n<mat-card class=\"mt-3\">\n <mat-card-content>\n <form fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" [formGroup]=\"filterForm\">\n <app-timeline-filter\n formControlName=\"duration\"\n (selectionChange)=\"onDurationChange($event)\"\n [dateFrom]=\"filterForm.value?.date_from\"\n [dateTo]=\"filterForm.value?.date_to\"\n appearance=\"fill\"\n ></app-timeline-filter>\n\n <mat-form-field>\n <mat-label>Status</mat-label>\n <app-searchable-selector\n formControlName=\"status_ids\"\n apiUrl=\"api/checksheet-submission-statuses\"\n [enableSearch]=\"false\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Creator</mat-label>\n <app-searchable-selector\n formControlName=\"creator_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Reviewer</mat-label>\n <app-searchable-selector\n formControlName=\"reviewer_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet Format</mat-label>\n <app-searchable-selector\n formControlName=\"format_ids\"\n apiUrl=\"api/checksheet-formats?is_published=1\"\n [enableSearch]=\"true\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n </form>\n </mat-card-content>\n</mat-card>\n\n<mat-card\n class=\"p-0 mt-3\"\n infiniteScroll\n [infiniteScrollDistance]=\"2\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [fromRoot]=\"true\"\n>\n <table\n mat-table\n [dataSource]=\"models\"\n class=\"w-100\"\n multiTemplateDataRows\n aria-describedby=\"Checksheet Submissions\"\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Checksheet Format Column -->\n <ng-container matColumnDef=\"format.title\">\n <th mat-header-cell *matHeaderCellDef>Checksheet Format</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.format?.title }}\n </td>\n </ng-container>\n\n <!-- Creator Column -->\n <ng-container matColumnDef=\"creator.name\">\n <th mat-header-cell *matHeaderCellDef>Creator</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.creator?.name }}\n </td>\n </ng-container>\n\n <!-- Reviewer Column -->\n <ng-container matColumnDef=\"reviewer.name\">\n <th mat-header-cell *matHeaderCellDef>Reviewer</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.reviewer?.name }}\n </td>\n </ng-container>\n\n <!-- Status Column -->\n <ng-container matColumnDef=\"status.title\">\n <th mat-header-cell *matHeaderCellDef>Status</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.status?.title }}\n </td>\n </ng-container>\n\n <!-- Date Column -->\n <ng-container matColumnDef=\"date\">\n <th mat-header-cell *matHeaderCellDef>Date</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.date | date }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element;\">\n <div class=\"d-flex gap-2\">\n <mat-icon\n [routerLink]=\"['../checksheet-submissions-view', element?.id]\"\n class=\"cursor-pointer\"\n >\n visibility\n </mat-icon>\n\n <mat-icon\n *ngIf=\"element.status_id === 1\"\n [routerLink]=\"[element?.id, 'view']\"\n class=\"cursor-pointer\"\n >\n edit\n </mat-icon>\n <app-checksheet-submission-review-button\n [submission]=\"element\"\n [requestParams]=\"{ with: this.with }\"\n (reviewed)=\"reload()\"\n ></app-checksheet-submission-review-button>\n <app-checksheet-submission-delete-button\n [checksheetSubmission]=\"element\"\n (deleted)=\"onDeleted()\"\n ></app-checksheet-submission-delete-button>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar *ngIf=\"isWorking\" mode=\"indeterminate\"></mat-progress-bar>\n</mat-card>\n", styles: [".scroll-container{max-height:800px;overflow-y:auto}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i6.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i6.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "component", type: i7.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i7.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i6$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i6$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i15.NgxPermissionsDirective, selector: "[ngxPermissionsOnly],[ngxPermissionsExcept]", inputs: ["ngxPermissionsOnly", "ngxPermissionsOnlyThen", "ngxPermissionsOnlyElse", "ngxPermissionsExcept", "ngxPermissionsExceptElse", "ngxPermissionsExceptThen", "ngxPermissionsThen", "ngxPermissionsElse", "ngxPermissionsOnlyAuthorisedStrategy", "ngxPermissionsOnlyUnauthorisedStrategy", "ngxPermissionsExceptUnauthorisedStrategy", "ngxPermissionsExceptAuthorisedStrategy", "ngxPermissionsUnauthorisedStrategy", "ngxPermissionsAuthorisedStrategy"], outputs: ["permissionsAuthorized", "permissionsUnauthorized"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i9$2.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "component", type: i1.SearchableSelectorComponent, selector: "app-searchable-selector", inputs: ["valueField", "titleField", "subtitleField", "apiUrl", "multiple", "selectedValue", "enableSearch", "add", "addConfig", "edit", "editConfig", "sort", "sortBy", "searchField", "itemComponent", "items", "apiDataProperty", "cache", "perPage", "inDataSearch", "panelWidth", "focusSearchOnOpen", "required", "disabled", "value"], outputs: ["selectedValueChange", "selectionChange", "itemsChange"] }, { kind: "component", type: i1.TimelineFilterComponent, selector: "app-timeline-filter", inputs: ["defaultValue", "required", "disabled", "value", "timelines", "dateFrom", "dateTo", "appearance", "showClearButton", "form", "labelText"], outputs: ["selectionChange"] }, { kind: "component", type: ChecksheetSubmissionDeleteButtonComponent, selector: "app-checksheet-submission-delete-button", inputs: ["checksheetSubmission"], outputs: ["deleted"] }, { kind: "component", type: ChecksheetSubmissionFormButtonComponent, selector: "app-checksheet-submission-form-button", inputs: ["submittableType", "submittableId"], outputs: ["saved"] }, { kind: "component", type: ChecksheetSubmissionReviewButtonComponent, selector: "app-checksheet-submission-review-button", inputs: ["submission", "viewType", "requestParams"], outputs: ["reviewed"] }, { kind: "pipe", type: i4.DatePipe, name: "date" }] });
|
|
2431
|
+
};
|
|
2432
|
+
ChecksheetSubmissionListComponent = __decorate([
|
|
2433
|
+
UntilDestroy()
|
|
2434
|
+
], ChecksheetSubmissionListComponent);
|
|
2435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetSubmissionListComponent, decorators: [{
|
|
2436
|
+
type: Component,
|
|
2437
|
+
args: [{ selector: 'app-checksheet-submission-list', template: "<div class=\"d-flex justify-content-center align-items-center gap-3\">\n <h3 class=\"m-0 font-weight-bold\">Checksheet Submissions</h3>\n <app-checksheet-submission-form-button></app-checksheet-submission-form-button>\n</div>\n\n<mat-card class=\"mt-3\">\n <mat-card-content>\n <form fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" [formGroup]=\"filterForm\">\n <app-timeline-filter\n formControlName=\"duration\"\n (selectionChange)=\"onDurationChange($event)\"\n [dateFrom]=\"filterForm.value?.date_from\"\n [dateTo]=\"filterForm.value?.date_to\"\n appearance=\"fill\"\n ></app-timeline-filter>\n\n <mat-form-field>\n <mat-label>Status</mat-label>\n <app-searchable-selector\n formControlName=\"status_ids\"\n apiUrl=\"api/checksheet-submission-statuses\"\n [enableSearch]=\"false\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Creator</mat-label>\n <app-searchable-selector\n formControlName=\"creator_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field *ngxPermissionsOnly=\"['user_read']\">\n <mat-label>Reviewer</mat-label>\n <app-searchable-selector\n formControlName=\"reviewer_ids\"\n apiUrl=\"api/users\"\n [enableSearch]=\"true\"\n titleField=\"name\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n\n <mat-form-field>\n <mat-label>Checksheet Format</mat-label>\n <app-searchable-selector\n formControlName=\"format_ids\"\n apiUrl=\"api/checksheet-formats?is_published=1\"\n [enableSearch]=\"true\"\n [multiple]=\"true\"\n >\n </app-searchable-selector>\n </mat-form-field>\n </form>\n </mat-card-content>\n</mat-card>\n\n<mat-card\n class=\"p-0 mt-3\"\n infiniteScroll\n [infiniteScrollDistance]=\"2\"\n [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\"\n [fromRoot]=\"true\"\n>\n <table\n mat-table\n [dataSource]=\"models\"\n class=\"w-100\"\n multiTemplateDataRows\n aria-describedby=\"Checksheet Submissions\"\n >\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Checksheet Format Column -->\n <ng-container matColumnDef=\"format.title\">\n <th mat-header-cell *matHeaderCellDef>Checksheet Format</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.format?.title }}\n </td>\n </ng-container>\n\n <!-- Creator Column -->\n <ng-container matColumnDef=\"creator.name\">\n <th mat-header-cell *matHeaderCellDef>Creator</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.creator?.name }}\n </td>\n </ng-container>\n\n <!-- Reviewer Column -->\n <ng-container matColumnDef=\"reviewer.name\">\n <th mat-header-cell *matHeaderCellDef>Reviewer</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.reviewer?.name }}\n </td>\n </ng-container>\n\n <!-- Status Column -->\n <ng-container matColumnDef=\"status.title\">\n <th mat-header-cell *matHeaderCellDef>Status</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.status?.title }}\n </td>\n </ng-container>\n\n <!-- Date Column -->\n <ng-container matColumnDef=\"date\">\n <th mat-header-cell *matHeaderCellDef>Date</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element.date | date }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef>Actions</th>\n <td mat-cell *matCellDef=\"let element;\">\n <div class=\"d-flex gap-2\">\n <mat-icon\n [routerLink]=\"['../checksheet-submissions-view', element?.id]\"\n class=\"cursor-pointer\"\n >\n visibility\n </mat-icon>\n\n <mat-icon\n *ngIf=\"element.status_id === 1\"\n [routerLink]=\"[element?.id, 'view']\"\n class=\"cursor-pointer\"\n >\n edit\n </mat-icon>\n <app-checksheet-submission-review-button\n [submission]=\"element\"\n [requestParams]=\"{ with: this.with }\"\n (reviewed)=\"reload()\"\n ></app-checksheet-submission-review-button>\n <app-checksheet-submission-delete-button\n [checksheetSubmission]=\"element\"\n (deleted)=\"onDeleted()\"\n ></app-checksheet-submission-delete-button>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n <mat-progress-bar *ngIf=\"isWorking\" mode=\"indeterminate\"></mat-progress-bar>\n</mat-card>\n", styles: [".scroll-container{max-height:800px;overflow-y:auto}\n"] }]
|
|
2438
|
+
}], ctorParameters: () => [{ type: i1.AlertService }, { type: i2.UntypedFormBuilder }, { type: ChecksheetSubmissionService }, { type: i1.RequestHelperService }] });
|
|
2439
|
+
|
|
2440
|
+
class ChecksheetModule {
|
|
2441
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2442
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetModule, declarations: [ChecksheetFormatListComponent,
|
|
2443
|
+
ChecksheetFormComponent,
|
|
2444
|
+
ChecksheetQuestionFormComponent,
|
|
2445
|
+
ChecksheetQuestionComponent,
|
|
2446
|
+
ChecksheetQuestionListComponent,
|
|
2447
|
+
ChecksheetListComponent,
|
|
2448
|
+
ChecksheetSubmissionFormComponent,
|
|
2449
|
+
ChecksheetViewComponent,
|
|
2450
|
+
ChecksheetNodeViewComponent,
|
|
2451
|
+
MechanicalIssueFormComponent,
|
|
2452
|
+
ChecksheetReportComponent,
|
|
2453
|
+
ChecksheetFormButtonComponent,
|
|
2454
|
+
ChecksheetSubmissionDeleteButtonComponent,
|
|
2455
|
+
ChecksheetReviewButtonComponent,
|
|
2456
|
+
ChecksheetSubmissionViewComponent,
|
|
2457
|
+
ChecksheetSubmissionFormButtonComponent,
|
|
2458
|
+
ChecksheetSubmissionListComponent,
|
|
2459
|
+
ChecksheetSubmissionReviewButtonComponent], imports: [CommonModule,
|
|
2460
|
+
ChecksheetRoutingModule,
|
|
2461
|
+
SharedModule,
|
|
2462
|
+
InfiniteScrollModule,
|
|
2463
|
+
ActionPopupModule,
|
|
2464
|
+
SearchableSelectorModule,
|
|
2465
|
+
NoteModule,
|
|
2466
|
+
NgxEditorModule,
|
|
2467
|
+
MatRadioModule,
|
|
2468
|
+
EntityFilesViewAllModule,
|
|
2469
|
+
ExportExcelModule,
|
|
2470
|
+
MatProgressBarModule,
|
|
2471
|
+
TimelineFilterModule,
|
|
2472
|
+
ChecksheetSubmissionFileUploadComponent,
|
|
2473
|
+
ChecksheetSubmissionFilesComponent,
|
|
2474
|
+
SharedModule], exports: [ChecksheetListComponent,
|
|
2475
|
+
ChecksheetFormButtonComponent] });
|
|
2476
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetModule, imports: [CommonModule,
|
|
2477
|
+
ChecksheetRoutingModule,
|
|
2478
|
+
SharedModule,
|
|
2479
|
+
InfiniteScrollModule,
|
|
2480
|
+
ActionPopupModule,
|
|
2481
|
+
SearchableSelectorModule,
|
|
2482
|
+
NoteModule,
|
|
2483
|
+
NgxEditorModule,
|
|
2484
|
+
MatRadioModule,
|
|
2485
|
+
EntityFilesViewAllModule,
|
|
2486
|
+
ExportExcelModule,
|
|
2487
|
+
MatProgressBarModule,
|
|
2488
|
+
TimelineFilterModule,
|
|
2489
|
+
ChecksheetSubmissionFileUploadComponent,
|
|
2490
|
+
ChecksheetSubmissionFilesComponent,
|
|
2491
|
+
SharedModule] });
|
|
2492
|
+
}
|
|
2493
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ChecksheetModule, decorators: [{
|
|
2494
|
+
type: NgModule,
|
|
2495
|
+
args: [{
|
|
2496
|
+
declarations: [
|
|
2497
|
+
ChecksheetFormatListComponent,
|
|
2498
|
+
ChecksheetFormComponent,
|
|
2499
|
+
ChecksheetQuestionFormComponent,
|
|
2500
|
+
ChecksheetQuestionComponent,
|
|
2501
|
+
ChecksheetQuestionListComponent,
|
|
2502
|
+
ChecksheetListComponent,
|
|
2503
|
+
ChecksheetSubmissionFormComponent,
|
|
2504
|
+
ChecksheetViewComponent,
|
|
2505
|
+
ChecksheetNodeViewComponent,
|
|
2506
|
+
MechanicalIssueFormComponent,
|
|
2507
|
+
ChecksheetReportComponent,
|
|
2508
|
+
ChecksheetFormButtonComponent,
|
|
2509
|
+
ChecksheetSubmissionDeleteButtonComponent,
|
|
2510
|
+
ChecksheetReviewButtonComponent,
|
|
2511
|
+
ChecksheetSubmissionViewComponent,
|
|
2512
|
+
ChecksheetSubmissionFormButtonComponent,
|
|
2513
|
+
ChecksheetSubmissionListComponent,
|
|
2514
|
+
ChecksheetSubmissionReviewButtonComponent
|
|
2515
|
+
],
|
|
2516
|
+
imports: [
|
|
2517
|
+
CommonModule,
|
|
2518
|
+
ChecksheetRoutingModule,
|
|
2519
|
+
SharedModule,
|
|
2520
|
+
InfiniteScrollModule,
|
|
2521
|
+
ActionPopupModule,
|
|
2522
|
+
SearchableSelectorModule,
|
|
2523
|
+
NoteModule,
|
|
2524
|
+
NgxEditorModule,
|
|
2525
|
+
MatRadioModule,
|
|
2526
|
+
EntityFilesViewAllModule,
|
|
2527
|
+
ExportExcelModule,
|
|
2528
|
+
MatProgressBarModule,
|
|
2529
|
+
TimelineFilterModule,
|
|
2530
|
+
ChecksheetSubmissionFileUploadComponent,
|
|
2531
|
+
ChecksheetSubmissionFilesComponent,
|
|
2532
|
+
SharedModule
|
|
2533
|
+
],
|
|
2534
|
+
exports: [
|
|
2535
|
+
ChecksheetListComponent,
|
|
2536
|
+
ChecksheetFormButtonComponent
|
|
2537
|
+
]
|
|
2538
|
+
}]
|
|
2539
|
+
}] });
|
|
2540
|
+
|
|
2541
|
+
/*
|
|
2542
|
+
* Public API Surface of ngx-techlify-checksheet
|
|
2543
|
+
*/
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* Generated bundle index. Do not edit.
|
|
2547
|
+
*/
|
|
2548
|
+
|
|
2549
|
+
export { ChecksheetFormButtonComponent, ChecksheetListComponent, ChecksheetModule, ChecksheetSubmissionFormButtonComponent, ChecksheetSubmissionListComponent };
|
|
2550
|
+
//# sourceMappingURL=ngx-techlify-checksheet.mjs.map
|