@colijnit/sharedcomponents 1.0.18 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/bundles/colijnit-sharedcomponents.umd.js +560 -83
  2. package/bundles/colijnit-sharedcomponents.umd.js.map +1 -1
  3. package/colijnit-sharedcomponents.d.ts +9 -7
  4. package/colijnit-sharedcomponents.metadata.json +1 -1
  5. package/esm2015/colijnit-sharedcomponents.js +10 -8
  6. package/esm2015/lib/assets/dictionary/text.properties.js +11 -0
  7. package/esm2015/lib/components/layout-switcher/layout-switcher.component.js +74 -0
  8. package/esm2015/lib/components/layout-switcher/layout-switcher.module.js +21 -0
  9. package/esm2015/lib/components/send-method-dialog/send-method-dialog.component.js +87 -17
  10. package/esm2015/lib/components/stock/stock.component.js +17 -4
  11. package/esm2015/lib/components/stock/stock.module.js +3 -3
  12. package/esm2015/lib/enum/icon.enum.js +4 -1
  13. package/esm2015/lib/enum/language-code.enum.js +8 -0
  14. package/esm2015/lib/model/icon-svg.js +4 -1
  15. package/esm2015/lib/service/dictionary.service.js +76 -0
  16. package/esm2015/lib/service/options.service.js +71 -0
  17. package/esm2015/lib/service/shared-connector.service.js +262 -0
  18. package/esm2015/lib/service/shared.service.js +30 -0
  19. package/esm2015/lib/service/stock.service.js +21 -26
  20. package/esm2015/lib/utils/string-utils.js +64 -0
  21. package/esm2015/public-api.js +4 -1
  22. package/fesm2015/colijnit-sharedcomponents.js +462 -58
  23. package/fesm2015/colijnit-sharedcomponents.js.map +1 -1
  24. package/lib/assets/dictionary/text.properties.d.ts +3 -0
  25. package/lib/components/layout-switcher/layout-switcher.component.d.ts +16 -0
  26. package/lib/components/layout-switcher/layout-switcher.module.d.ts +2 -0
  27. package/lib/components/layout-switcher/style/_layout.scss +96 -0
  28. package/lib/components/layout-switcher/style/_material-definition.scss +16 -0
  29. package/lib/components/layout-switcher/style/_theme.scss +6 -0
  30. package/lib/components/layout-switcher/style/material.scss +5 -0
  31. package/lib/components/send-method-dialog/send-method-dialog.component.d.ts +23 -6
  32. package/lib/components/send-method-dialog/style/_layout.scss +5 -0
  33. package/lib/components/stock/stock.component.d.ts +5 -1
  34. package/lib/enum/icon.enum.d.ts +3 -0
  35. package/lib/enum/language-code.enum.d.ts +6 -0
  36. package/lib/service/dictionary.service.d.ts +21 -0
  37. package/lib/service/options.service.d.ts +13 -0
  38. package/lib/service/{ione-connector-adapter.service.d.ts → shared-connector.service.d.ts} +5 -5
  39. package/lib/service/shared.service.d.ts +8 -0
  40. package/lib/service/stock.service.d.ts +2 -5
  41. package/lib/utils/string-utils.d.ts +22 -0
  42. package/package.json +1 -1
  43. package/public-api.d.ts +3 -0
  44. package/esm2015/lib/service/ione-connector-adapter.service.js +0 -265
@@ -1,12 +1,13 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
- import { EventEmitter, Component, ViewEncapsulation, ViewChild, ElementRef, Input, Output, HostBinding, NgModule, Injectable, HostListener } from '@angular/core';
3
+ import { EventEmitter, Component, ViewEncapsulation, ViewChild, ElementRef, Input, Output, HostBinding, NgModule, Injectable, ChangeDetectorRef, HostListener } from '@angular/core';
4
4
  import { trigger, state, style, transition, animate } from '@angular/animations';
5
5
  import { PDFDocument } from 'pdf-lib';
6
6
  import * as PDFJS from 'pdfjs-dist/legacy/build/pdf';
7
7
  import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.entry';
8
8
  import { CommonModule } from '@angular/common';
9
9
  import SignaturePad from 'signature_pad';
10
+ import { PrintStockStickers } from '@colijnit/sharedapi/build/model/print-stock-stickers';
10
11
  import { Articles } from '@colijnit/articleapi/build/articles';
11
12
  import { Sharedapi } from '@colijnit/sharedapi/build/sharedapi';
12
13
  import { Printer } from '@colijnit/sharedapi/build/model/report/printer.bo';
@@ -23,7 +24,6 @@ import { MapPropertyDecorator } from '@colijnit/articleapi/build/factory/decorat
23
24
  import { BooleanTextDecorator as BooleanTextDecorator$1 } from '@colijnit/articleapi/build/factory/decorators/boolean.decorator';
24
25
  import { JsonFieldFieldDecorator } from '@colijnit/articleapi/build/factory/decorators/json.decorator';
25
26
  import { ComplexArrayDecorator as ComplexArrayDecorator$1 } from '@colijnit/articleapi/build/factory/decorators/complex-array.decorator';
26
- import { PrintStockStickers } from '@colijnit/sharedapi/build/model/print-stock-stickers';
27
27
  import { ArticleStock } from '@colijnit/articleapi/build/model/article-stock.bo';
28
28
  import { StockHistoryBo } from '@colijnit/articleapi/build/model/stock-history.bo';
29
29
  import { StockStickersPrintLayoutsBo } from '@colijnit/sharedapi/build/model/report/stock-stickers-print-layouts.bo';
@@ -32,6 +32,7 @@ import { StockStatus } from '@colijnit/articleapi/build/model/stock-status.bo';
32
32
  import { StockManagementWarehouses } from '@colijnit/articleapi/build/model/stock-management-warehouses.bo';
33
33
  import { StockLocation } from '@colijnit/articleapi/build/model/stock-location.bo';
34
34
  import { ArticleTransaction } from '@colijnit/articleapi/build/model/article-transaction.bo';
35
+ import { BehaviorSubject } from 'rxjs';
35
36
  import { GetStockHistoryRequest } from '@colijnit/articleapi/build/model/get-stock-history-request';
36
37
  import { ArticleStock as ArticleStock$1 } from '@colijnit/articleapi/build/model/article-stock';
37
38
  import { CoDialogPromptModule, InputCheckboxModule, InputComboBoxModule, IconModule, InputNumberPickerModule, CoDialogWizardModule, ButtonModule, CoGridModule, InputRadioButtonModule, DropDownModule, SimpleGridModule, ImageModule, InputTextModule, InputTextareaModule } from '@colijnit/corecomponents_v12';
@@ -1049,23 +1050,234 @@ class BusinessObjectFactory {
1049
1050
  }
1050
1051
  }
1051
1052
 
1052
- class IoneConnectorAdapterService {
1053
+ var LanguageCode;
1054
+ (function (LanguageCode) {
1055
+ LanguageCode["Dutch"] = "nl-NL";
1056
+ LanguageCode["English"] = "en-GB";
1057
+ LanguageCode["German"] = "de-DE";
1058
+ LanguageCode["French"] = "fr-FR";
1059
+ })(LanguageCode || (LanguageCode = {}));
1060
+
1061
+ // Static utility functions holder related to strings.
1062
+ class StringUtils {
1063
+ /**
1064
+ * Returns a new string where given placeholder in given source string are replaced by given replacement texts.
1065
+ *
1066
+ * Example usage:
1067
+ *
1068
+ * source = "ABCDABCD"
1069
+ * placeholder = "BC"
1070
+ * replacementTexts = "Z", "Z" (REST arguments)
1071
+ * OUTPUT = "AZDAZD"
1072
+ *
1073
+ * @param {string} source
1074
+ * @param {string} placeholder
1075
+ * @param {string} replacementTexts If only one is given, this function replaces all placeholders with that single replacementText.
1076
+ * If more are given, placeholders without a corresponding replacementText will remain their original placeholder characters.
1077
+ */
1078
+ static ReplaceOccurrencesIn(source, placeholder, ...replacementTexts) {
1079
+ // parameter guards
1080
+ if (!(source)) {
1081
+ return undefined;
1082
+ }
1083
+ if (!placeholder || replacementTexts.length === 0) {
1084
+ return source;
1085
+ }
1086
+ let outString = source;
1087
+ // one replacementText means replace for all
1088
+ if (replacementTexts.length === 1) {
1089
+ // "g" is the g flag to replace globally
1090
+ outString = outString.replace(placeholder, replacementTexts[0]);
1091
+ }
1092
+ else {
1093
+ // replace occurence i by replacementTexts[i], one at a time in loop (there might be a faster way..)
1094
+ for (let i = 0, len = replacementTexts.length; i < len; i++) {
1095
+ outString = outString.replace(placeholder, replacementTexts[i]);
1096
+ }
1097
+ }
1098
+ return outString;
1099
+ }
1100
+ // Returns the given argument as a string. Returns given defaultValue if conversion of argument to string was impossible.
1101
+ static ParseString(arg, defaultValue = "") {
1102
+ if (!StringUtils.IsString(arg)) {
1103
+ if (arg && typeof arg.toString === "function") {
1104
+ arg = arg.toString();
1105
+ }
1106
+ else {
1107
+ arg = defaultValue;
1108
+ }
1109
+ }
1110
+ return arg;
1111
+ }
1112
+ static IsString(str) {
1113
+ return typeof str === 'string';
1114
+ }
1115
+ // Returns whether given str is a string and has a length > 0.
1116
+ static IsStringWithLength(str) {
1117
+ return str && StringUtils.IsString(str) && str.length > 0;
1118
+ }
1119
+ // Returns given string, escaped for use as string literal in regular expressions.
1120
+ static _escapeRegExp(str) {
1121
+ return str; // .replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^$\|]/g, "\\$&");
1122
+ }
1123
+ }
1124
+
1125
+ class Dictionary {
1053
1126
  constructor() {
1054
- this._boFactory = new BusinessObjectFactory();
1127
+ this.strings = {
1128
+ "nl": {},
1129
+ "de": {},
1130
+ "fr": {},
1131
+ "en": {},
1132
+ };
1133
+ }
1134
+ }
1135
+
1136
+ // The localization service, providing peers with text translation functionality.
1137
+ class DictionaryService {
1138
+ constructor() {
1139
+ this.dictionaryUrl = "js/browser/res/dictionary/";
1140
+ // private _dictionaryPromise: Map<LanguageCode, Promise<{ [key: string]: string }>> = new Map<LanguageCode, Promise<{ [key: string]: string }>>();
1141
+ this._dictionaries = new Map();
1142
+ // Some dictionary values have one or more '|~' texts in them, meant to be replaced with client-side given texts.
1143
+ this._placeholder = "|~";
1144
+ }
1145
+ get language() {
1146
+ return this._language;
1055
1147
  }
1056
- connect(options) {
1148
+ set rootUrl(value) {
1149
+ this._rootUrl = value;
1150
+ this._dictBasePath = this._rootUrl + "/" + this.dictionaryUrl;
1151
+ }
1152
+ // Loads the dictionary for given language in memory.
1153
+ setDictionary(language) {
1057
1154
  return __awaiter(this, void 0, void 0, function* () {
1058
- if (this.options === undefined) {
1059
- this.options = options;
1060
- this.connector = new Articles(options);
1061
- this.sharedConnector = new Sharedapi(options);
1062
- this.options.session = this.connector.session && this.sharedConnector.session;
1155
+ this._language = language || LanguageCode.Dutch;
1156
+ this._loadDictionary();
1157
+ });
1158
+ }
1159
+ _loadDictionary() {
1160
+ if (!this._dictionaries.has(this._language)) {
1161
+ const dictionary = new Dictionary();
1162
+ // eslint-disable-next-line no-magic-numbers
1163
+ if (dictionary.strings[this._language.substr(0, 2).toLowerCase()] !== undefined) {
1164
+ // eslint-disable-next-line no-magic-numbers
1165
+ this._dictionaries.set(this._language, dictionary.strings[this._language.substr(0, 2).toLowerCase()]);
1063
1166
  }
1167
+ }
1168
+ }
1169
+ /**
1170
+ * Returns the localized text for the given dictionary key.
1171
+ * @param {string} key
1172
+ * @param {boolean} [upperCaseFirst = true] False for first letter lowercase, true for first letter uppercase for returned dict val
1173
+ * @param {string[]} replacementTexts Rest params for replacement of '|~' in returned dict value
1174
+ * @returns {string} The translated text for given dictionary key
1175
+ */
1176
+ get(key, upperCaseFirst = true, ...replacementTexts) {
1177
+ if (!StringUtils.IsStringWithLength(key)) {
1178
+ return key || "";
1179
+ }
1180
+ if (this.language === undefined) {
1181
+ this._language = LanguageCode.Dutch;
1182
+ this._loadDictionary();
1183
+ }
1184
+ let text = this._dictionaries.get(this.language)[key];
1185
+ text = StringUtils.IsStringWithLength(text) ? text : key;
1186
+ if (upperCaseFirst) {
1187
+ text = text.charAt(0).toUpperCase() + text.slice(1);
1188
+ }
1189
+ else {
1190
+ text = text.charAt(0).toLowerCase() + text.slice(1);
1191
+ }
1192
+ if (replacementTexts.length > 0) {
1193
+ text = StringUtils.ReplaceOccurrencesIn(text, this._placeholder, ...replacementTexts);
1194
+ }
1195
+ return text;
1196
+ }
1197
+ }
1198
+ DictionaryService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DictionaryService_Factory() { return new DictionaryService(); }, token: DictionaryService, providedIn: "root" });
1199
+ DictionaryService.decorators = [
1200
+ { type: Injectable, args: [{
1201
+ providedIn: "root"
1202
+ },] }
1203
+ ];
1204
+ DictionaryService.ctorParameters = () => [];
1205
+
1206
+ class OptionsService {
1207
+ constructor(_dictionary) {
1208
+ this._dictionary = _dictionary;
1209
+ this.optionsInitialized = new BehaviorSubject(false);
1210
+ this.optionsLoaded = new BehaviorSubject(false);
1211
+ }
1212
+ set options(value) {
1213
+ this._options = value;
1214
+ }
1215
+ get options() {
1216
+ return this._options;
1217
+ }
1218
+ createSettingsFromObject(obj) {
1219
+ return __awaiter(this, void 0, void 0, function* () {
1220
+ this.options = new Object();
1221
+ if (obj.hasOwnProperty("url")) {
1222
+ this.options.url = obj["url"];
1223
+ }
1224
+ if (obj.hasOwnProperty("schema")) {
1225
+ this.options.schema = obj["schema"];
1226
+ }
1227
+ if (obj.hasOwnProperty("version")) {
1228
+ this.options.version = obj["version"];
1229
+ }
1230
+ if (obj.hasOwnProperty("languageCode")) {
1231
+ this.options.languageCode = obj["languageCode"];
1232
+ }
1233
+ else {
1234
+ this.options.languageCode = "NL";
1235
+ }
1236
+ if (obj.hasOwnProperty("username")) {
1237
+ this.options.username = obj["username"];
1238
+ }
1239
+ if (obj.hasOwnProperty("password")) {
1240
+ this.options.password = obj["password"];
1241
+ }
1242
+ if (obj.hasOwnProperty("session")) {
1243
+ this.options.session = obj["session"];
1244
+ }
1245
+ if (obj.hasOwnProperty("useLoginEncryption")) {
1246
+ this.options.useLoginEncryption = obj["useLoginEncryption"];
1247
+ }
1248
+ this.optionsLoaded.next(true);
1064
1249
  });
1065
1250
  }
1066
- disconnect() {
1251
+ initialize(options) {
1067
1252
  return __awaiter(this, void 0, void 0, function* () {
1068
- this.options = undefined;
1253
+ if (options) {
1254
+ yield this.createSettingsFromObject(options);
1255
+ yield this._dictionary.setDictionary(this.options.languageCode);
1256
+ this.optionsInitialized.next(true);
1257
+ }
1258
+ });
1259
+ }
1260
+ }
1261
+ OptionsService.ɵprov = i0.ɵɵdefineInjectable({ factory: function OptionsService_Factory() { return new OptionsService(i0.ɵɵinject(DictionaryService)); }, token: OptionsService, providedIn: "root" });
1262
+ OptionsService.decorators = [
1263
+ { type: Injectable, args: [{
1264
+ providedIn: "root"
1265
+ },] }
1266
+ ];
1267
+ OptionsService.ctorParameters = () => [
1268
+ { type: DictionaryService }
1269
+ ];
1270
+
1271
+ class SharedConnectorService {
1272
+ constructor(_optionsService) {
1273
+ this._optionsService = _optionsService;
1274
+ this._boFactory = new BusinessObjectFactory();
1275
+ }
1276
+ connect() {
1277
+ return __awaiter(this, void 0, void 0, function* () {
1278
+ this.connector = new Articles(this._optionsService.options);
1279
+ this.sharedConnector = new Sharedapi(this._optionsService.options);
1280
+ this._optionsService.options.session = this.connector.session && this.sharedConnector.session;
1069
1281
  });
1070
1282
  }
1071
1283
  getAllPrinters(showAll = true) {
@@ -1290,40 +1502,62 @@ class IoneConnectorAdapterService {
1290
1502
  return this.connector.commit();
1291
1503
  }
1292
1504
  }
1293
- IoneConnectorAdapterService.ɵprov = i0.ɵɵdefineInjectable({ factory: function IoneConnectorAdapterService_Factory() { return new IoneConnectorAdapterService(); }, token: IoneConnectorAdapterService, providedIn: "root" });
1294
- IoneConnectorAdapterService.decorators = [
1505
+ SharedConnectorService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SharedConnectorService_Factory() { return new SharedConnectorService(i0.ɵɵinject(OptionsService)); }, token: SharedConnectorService, providedIn: "root" });
1506
+ SharedConnectorService.decorators = [
1295
1507
  { type: Injectable, args: [{
1296
1508
  providedIn: "root"
1297
1509
  },] }
1298
1510
  ];
1299
- IoneConnectorAdapterService.ctorParameters = () => [];
1511
+ SharedConnectorService.ctorParameters = () => [
1512
+ { type: OptionsService }
1513
+ ];
1300
1514
 
1301
- class StockService {
1302
- constructor(_connector) {
1303
- this._connector = _connector;
1304
- this.printSticker = new PrintStockStickers();
1515
+ class SharedService {
1516
+ constructor(options, connector) {
1517
+ this.options = options;
1518
+ this.connector = connector;
1305
1519
  }
1306
- connectConnector(options) {
1307
- this._connector.connect(options);
1520
+ init(options) {
1521
+ return __awaiter(this, void 0, void 0, function* () {
1522
+ yield this.options.initialize(options);
1523
+ this.connector.connect();
1524
+ });
1525
+ }
1526
+ }
1527
+ SharedService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SharedService_Factory() { return new SharedService(i0.ɵɵinject(OptionsService), i0.ɵɵinject(SharedConnectorService)); }, token: SharedService, providedIn: "root" });
1528
+ SharedService.decorators = [
1529
+ { type: Injectable, args: [{
1530
+ providedIn: "root"
1531
+ },] }
1532
+ ];
1533
+ SharedService.ctorParameters = () => [
1534
+ { type: OptionsService },
1535
+ { type: SharedConnectorService }
1536
+ ];
1537
+
1538
+ class StockService extends SharedService {
1539
+ constructor() {
1540
+ super(...arguments);
1541
+ this.printSticker = new PrintStockStickers();
1308
1542
  }
1309
1543
  getPrintStockStickers(data) {
1310
1544
  return __awaiter(this, void 0, void 0, function* () {
1311
- yield this._connector.getPrintStockStickers(data);
1545
+ yield this.connector.getPrintStockStickers(data);
1312
1546
  });
1313
1547
  }
1314
1548
  getAllPrinters(showAll = true) {
1315
1549
  return __awaiter(this, void 0, void 0, function* () {
1316
- return yield this._connector.getAllPrinters(showAll);
1550
+ return yield this.connector.getAllPrinters(showAll);
1317
1551
  });
1318
1552
  }
1319
1553
  getStockHistory(data) {
1320
1554
  return __awaiter(this, void 0, void 0, function* () {
1321
- return yield this._connector.getStockHistory(data);
1555
+ return yield this.connector.getStockHistory(data);
1322
1556
  });
1323
1557
  }
1324
1558
  getStockInformation(data) {
1325
1559
  return __awaiter(this, void 0, void 0, function* () {
1326
- return yield this._connector.getStockInformation(data);
1560
+ return yield this.connector.getStockInformation(data);
1327
1561
  });
1328
1562
  }
1329
1563
  // public async getStockStickerPrintLayouts(data: StockStickersPrintLayoutsBo): Promise<StockStickersPrintLayoutsBo[]> {
@@ -1331,70 +1565,78 @@ class StockService {
1331
1565
  // }
1332
1566
  getArticleDetails(data) {
1333
1567
  return __awaiter(this, void 0, void 0, function* () {
1334
- return yield this._connector.getArticleDetails(data);
1568
+ return yield this.connector.getArticleDetails(data);
1335
1569
  });
1336
1570
  }
1337
1571
  updateArticleDetails(data) {
1338
1572
  return __awaiter(this, void 0, void 0, function* () {
1339
- return yield this._connector.updateArticleDetails(data);
1573
+ return yield this.connector.updateArticleDetails(data);
1340
1574
  });
1341
1575
  }
1342
1576
  getStockState() {
1343
1577
  return __awaiter(this, void 0, void 0, function* () {
1344
- return yield this._connector.getStockStatus();
1578
+ return yield this.connector.getStockStatus();
1345
1579
  });
1346
1580
  }
1347
1581
  getStockStickerTemplates(data) {
1348
1582
  return __awaiter(this, void 0, void 0, function* () {
1349
- return yield this._connector.getStockStickerTemplates(data);
1583
+ return yield this.connector.getStockStickerTemplates(data);
1350
1584
  });
1351
1585
  }
1352
1586
  getStockManagementWarehouses() {
1353
1587
  return __awaiter(this, void 0, void 0, function* () {
1354
- return yield this._connector.getStockManagementWarehouses();
1588
+ return yield this.connector.getStockManagementWarehouses();
1355
1589
  });
1356
1590
  }
1357
1591
  getStockManagementLocations(warehouseNo) {
1358
1592
  return __awaiter(this, void 0, void 0, function* () {
1359
- return yield this._connector.getStockManagementLocations(warehouseNo);
1593
+ return yield this.connector.getStockManagementLocations(warehouseNo);
1360
1594
  });
1361
1595
  }
1362
1596
  getArticleTransaction(data) {
1363
1597
  return __awaiter(this, void 0, void 0, function* () {
1364
- return yield this._connector.getArticleTransaction(data);
1598
+ return yield this.connector.getArticleTransaction(data);
1365
1599
  });
1366
1600
  }
1367
1601
  lockArticleDetails(data) {
1368
1602
  return __awaiter(this, void 0, void 0, function* () {
1369
- return yield this._connector.lockArticleDetails(data);
1603
+ return yield this.connector.lockArticleDetails(data);
1370
1604
  });
1371
1605
  }
1372
1606
  commit() {
1373
- return this._connector.commit();
1607
+ return this.connector.commit();
1374
1608
  }
1375
1609
  }
1376
- StockService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StockService_Factory() { return new StockService(i0.ɵɵinject(IoneConnectorAdapterService)); }, token: StockService, providedIn: "root" });
1610
+ StockService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StockService_Factory() { return new StockService(i0.ɵɵinject(OptionsService), i0.ɵɵinject(SharedConnectorService)); }, token: StockService, providedIn: "root" });
1377
1611
  StockService.decorators = [
1378
1612
  { type: Injectable, args: [{
1379
1613
  providedIn: 'root',
1380
1614
  },] }
1381
- ];
1382
- StockService.ctorParameters = () => [
1383
- { type: IoneConnectorAdapterService }
1384
1615
  ];
1385
1616
 
1386
1617
  class StockComponent {
1387
- constructor(stockService) {
1618
+ constructor(stockService, _optionsService) {
1388
1619
  this.stockService = stockService;
1620
+ this._optionsService = _optionsService;
1389
1621
  this.handleStickerClicked = new EventEmitter();
1390
1622
  this.showStockInformationGrid = true;
1391
1623
  this.showStockLocation = false;
1392
1624
  this.showStockTransfer = false;
1393
1625
  this.allAvailableStock = 0;
1394
1626
  this.allTechnicalStock = 0;
1627
+ this._publicOptions = true;
1395
1628
  }
1396
1629
  set options(value) {
1397
- this.stockService.connectConnector(value);
1630
+ if (value) {
1631
+ if (typeof value === "string") {
1632
+ this._options = JSON.parse(value);
1633
+ }
1634
+ else {
1635
+ this._options = value;
1636
+ }
1637
+ this._publicOptions = true;
1638
+ this._optionsService.initialize(this._options).then();
1639
+ }
1398
1640
  }
1399
1641
  set article(article) {
1400
1642
  this.articleExtended = article;
@@ -1477,7 +1719,8 @@ StockComponent.decorators = [
1477
1719
  },] }
1478
1720
  ];
1479
1721
  StockComponent.ctorParameters = () => [
1480
- { type: StockService }
1722
+ { type: StockService },
1723
+ { type: OptionsService }
1481
1724
  ];
1482
1725
  StockComponent.propDecorators = {
1483
1726
  stock: [{ type: ViewChild, args: [StockComponent,] }],
@@ -1544,8 +1787,11 @@ StockInformationComponent.propDecorators = {
1544
1787
 
1545
1788
  /** AUTO GENERATED FILE. DO NOT CHANGE.. OR YOU WILL SUFFER THE CONSEQUENCES OF YOUR ACTIONS **/
1546
1789
  const IconSvg = {
1790
+ "angle_left_solid": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\"><path fill=\"#183153\" d=\"M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z\"/></svg>",
1791
+ "angle_right_solid": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 320 512\"><path fill=\"#183153\" d=\"M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z\"/></svg>",
1547
1792
  "arrow_fat_right": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><polygon points=\"37.5 25 25.2 12.7 25.2 20.35 12.5 20.35 12.5 29.66 25.2 29.66 25.2 37.3 37.5 25\" fill=\"#484f60\"/></svg>",
1548
1793
  "arrow_point_right": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 51 51\" enable-background=\"new 0 0 51 51\"><path fill=\"#484F5F\" d=\"M19.1,14.3l14.7,9.6c0.1,0.1,0.2,0.2,0.2,0.4v2.4c0,0.2-0.1,0.3-0.2,0.4l-14.7,9.6c-0.2,0.2-0.5,0.1-0.7-0.1l-1.4-2.1c-0.2-0.2-0.1-0.5,0.1-0.7l12-7.8c0.3-0.2,0.3-0.6,0-0.8l-12-7.8c-0.2-0.2-0.3-0.5-0.1-0.7l1.4-2.1C18.6,14.2,18.9,14.2,19.1,14.3z\"/></svg>",
1794
+ "bring_forward_regular": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path fill=\"#183153\" d=\"M224 464H448C456.8 464 464 456.8 464 448V224C464 215.2 456.8 208 448 208H384V160H448C483.3 160 512 188.7 512 224V448C512 483.3 483.3 512 448 512H224C188.7 512 160 483.3 160 448V384H208V448C208 456.8 215.2 464 224 464zM64 352C28.65 352 0 323.3 0 288V64C0 28.65 28.65 0 64 0H288C323.3 0 352 28.65 352 64V288C352 323.3 323.3 352 288 352H64z\"/></svg>",
1549
1795
  "delete_left_regular": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\"><path d=\"M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z\"/></svg>",
1550
1796
  "delivery_truck": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><rect x=\"15.35\" y=\"16.56\" width=\"15.14\" height=\"10.94\" transform=\"translate(-1.83 2.08) rotate(-5)\" fill=\"#484f60\"/><path d=\"M38.5,18.1l-6.9.61L32.41,28l-7.63.67a3.76,3.76,0,0,1,1.43,2.25l7.25-.63A3.83,3.83,0,0,1,41,29.6l1-.1-.52-6Zm.29,5.84-3.91.34a.51.51,0,0,1-.55-.46L34,20.1a.49.49,0,0,1,.45-.54l2.27-.2a.5.5,0,0,1,.48.25l2,3.59A.5.5,0,0,1,38.79,23.94Z\" fill=\"#484f60\"/><path d=\"M19.66,29.09a3.8,3.8,0,0,0-1,2.46l-.74.07-1.82-.94L16,29.41Z\" fill=\"#484f60\"/><path d=\"M34.56,30.62a2.74,2.74,0,1,0,2.49-3A2.73,2.73,0,0,0,34.56,30.62Z\" fill=\"#484f60\"/><path d=\"M19.74,31.91a2.74,2.74,0,1,0,2.49-3A2.74,2.74,0,0,0,19.74,31.91Z\" fill=\"#484f60\"/><rect x=\"7.96\" y=\"17.63\" width=\"5\" height=\"1\" transform=\"translate(-1.54 0.98) rotate(-5)\" fill=\"#484f60\"/><rect x=\"11.02\" y=\"29.71\" width=\"3\" height=\"1\" transform=\"translate(-2.59 1.21) rotate(-5)\" fill=\"#484f60\"/><rect x=\"9.48\" y=\"23.53\" width=\"4\" height=\"1\" transform=\"matrix(1, -0.09, 0.09, 1, -2.05, 1.09)\" fill=\"#484f60\"/></svg>",
1551
1797
  "email": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\"><path d=\"M31.79,38.45A17.82,17.82,0,0,1,23.86,40,13.09,13.09,0,0,1,10.41,26.42C10.41,17.63,16.83,10,26.53,10c7.63,0,13.06,5.21,13.06,12.46,0,6.33-3.53,10.3-8.19,10.3a3.42,3.42,0,0,1-3.71-3.32h-.08A6.5,6.5,0,0,1,22,32.76c-2.75,0-4.82-2.11-4.82-5.65a9.85,9.85,0,0,1,10.13-10,12.89,12.89,0,0,1,5.13,1l-1.3,8c-.43,2.54-.13,3.71,1.08,3.75,1.85.09,4.18-2.28,4.18-7.28,0-5.65-3.62-10-10.3-10S13.73,17.76,13.73,26c0,7.25,4.57,11.3,11,11.3A14.81,14.81,0,0,0,31,36ZM28,20.65a5.34,5.34,0,0,0-1.33-.18c-2.85,0-5.09,2.81-5.09,6.12,0,1.64.73,2.68,2.16,2.68,1.59,0,3.27-2,3.66-4.53Z\" fill=\"#484f60\"/></svg>",
@@ -1604,8 +1850,11 @@ IconCacheService.ctorParameters = () => [
1604
1850
  /** AUTO GENERATED FILE. DO NOT CHANGE.. OR YOU WILL SUFFER THE CONSEQUENCES OF YOUR ACTIONS **/
1605
1851
  var Icon;
1606
1852
  (function (Icon) {
1853
+ Icon["AngleLeftSolid"] = "angle_left_solid";
1854
+ Icon["AngleRightSolid"] = "angle_right_solid";
1607
1855
  Icon["ArrowFatRight"] = "arrow_fat_right";
1608
1856
  Icon["ArrowPointRight"] = "arrow_point_right";
1857
+ Icon["BringForwardRegular"] = "bring_forward_regular";
1609
1858
  Icon["DeleteLeftRegular"] = "delete_left_regular";
1610
1859
  Icon["DeliveryTruck"] = "delivery_truck";
1611
1860
  Icon["Email"] = "email";
@@ -2150,41 +2399,77 @@ var SendOption;
2150
2399
  })(SendOption || (SendOption = {}));
2151
2400
 
2152
2401
  class SendMethodDialogComponent {
2153
- constructor(iconCacheService, stockService) {
2402
+ constructor(iconCacheService, stockService, _optionsService, _dictionary, _changeDetector) {
2154
2403
  this.iconCacheService = iconCacheService;
2155
2404
  this.stockService = stockService;
2405
+ this._optionsService = _optionsService;
2406
+ this._dictionary = _dictionary;
2407
+ this._changeDetector = _changeDetector;
2156
2408
  this.icons = Icon;
2157
2409
  this.sendOption = SendOption;
2410
+ this.showEmailOption = true;
2411
+ this.showPrintOption = true;
2412
+ this.showPdfOption = true;
2413
+ this.showXmlOption = true;
2158
2414
  this.sendOptions = [
2159
2415
  { option: SendOption.Email,
2160
- iconName: this.icons.Email },
2416
+ iconName: this.icons.Email,
2417
+ show: this.showEmailOption,
2418
+ },
2161
2419
  { option: SendOption.Print,
2162
- iconName: this.icons.Print },
2420
+ iconName: this.icons.Print,
2421
+ show: this.showPrintOption,
2422
+ },
2163
2423
  { option: SendOption.Pdf,
2164
- iconName: this.icons.Pdf },
2424
+ iconName: this.icons.Pdf,
2425
+ show: this.showPdfOption,
2426
+ },
2165
2427
  { option: SendOption.Xml,
2166
- iconName: this.icons.Xml }
2428
+ iconName: this.icons.Xml,
2429
+ show: this.showXmlOption,
2430
+ }
2167
2431
  ];
2168
2432
  this.activeSendOption = SendOption.Email;
2169
2433
  this.showStandardPrinterOptions = false;
2170
2434
  this.showPrinterSelections = false;
2171
2435
  this.showExitButton = true;
2172
2436
  this.printTemplatesField = { text: "name", value: "reportId" };
2437
+ this.upAndLoaded = false;
2173
2438
  this.emails = ['lars.vdv@colijn-it.nl', 'david@colijn-it.nl', 'ruben@colijn-it.nl'];
2174
2439
  this.models = [false, false, true];
2175
2440
  this.layouts = ['Layout 1', 'Layout 2', 'Layout 3'];
2176
2441
  this.showDialog = false;
2177
2442
  this.startSignatureClicked = new EventEmitter();
2178
2443
  this.printButtonClicked = new EventEmitter();
2444
+ this._subscriptions = [];
2445
+ this._publicOptions = true;
2446
+ this._subscriptions.push(this._optionsService.optionsLoaded.subscribe(loaded => this._handleSettingsLoaded(loaded)));
2179
2447
  }
2180
2448
  set options(value) {
2181
- this.stockService.connectConnector(value);
2449
+ if (value) {
2450
+ if (typeof value === "string") {
2451
+ this._options = JSON.parse(value);
2452
+ }
2453
+ else {
2454
+ this._options = value;
2455
+ }
2456
+ this._publicOptions = true;
2457
+ this._optionsService.initialize(this._options).then();
2458
+ }
2182
2459
  }
2460
+ get options() {
2461
+ return this._options;
2462
+ }
2463
+ set articleData(data) {
2464
+ this.stockService.printSticker.goodId = data.goodId;
2465
+ this.stockService.printSticker.warehouse = data.warehouseNo;
2466
+ }
2467
+ ;
2183
2468
  showClass() {
2184
2469
  return true;
2185
2470
  }
2186
- ngAfterViewInit() {
2187
- this.getPrintTemplates();
2471
+ ngOnDestroy() {
2472
+ this._subscriptions.forEach(subscription => subscription.unsubscribe());
2188
2473
  }
2189
2474
  getPrinters() {
2190
2475
  return __awaiter(this, void 0, void 0, function* () {
@@ -2200,7 +2485,11 @@ class SendMethodDialogComponent {
2200
2485
  this.startSignatureClicked.emit();
2201
2486
  }
2202
2487
  handlePrintClicked() {
2203
- this.printButtonClicked.emit();
2488
+ // this.printButtonClicked.emit();
2489
+ console.log(this.stockService.printSticker);
2490
+ if (this.stockService.printSticker.printerName) {
2491
+ this.stockService.getPrintStockStickers(this.stockService.printSticker);
2492
+ }
2204
2493
  }
2205
2494
  togglePrinterSelection() {
2206
2495
  this.getPrinters();
@@ -2219,9 +2508,31 @@ class SendMethodDialogComponent {
2219
2508
  this.showPrinterSelections = !this.showPrinterSelections;
2220
2509
  }
2221
2510
  getPrintTemplates() {
2222
- const data = new StockStickersPrintLayoutsBo();
2223
- this.stockService.getStockStickerTemplates(data).then((templates) => {
2224
- this.printTemplates = templates;
2511
+ if (!this.printTemplates) {
2512
+ const data = new StockStickersPrintLayoutsBo();
2513
+ this.stockService.getStockStickerTemplates(data).then((templates) => {
2514
+ this.printTemplates = templates;
2515
+ });
2516
+ }
2517
+ }
2518
+ _handleSettingsLoaded(loaded) {
2519
+ return __awaiter(this, void 0, void 0, function* () {
2520
+ if (loaded) {
2521
+ yield this._initConnection().then();
2522
+ this.upAndLoaded = true;
2523
+ }
2524
+ });
2525
+ }
2526
+ _initConnection() {
2527
+ return __awaiter(this, void 0, void 0, function* () {
2528
+ // await this._connector.connect(this._optionsService.options);
2529
+ if (this._optionsService.options.url) {
2530
+ this._dictionary.rootUrl = this._optionsService.options.url.replace("/ajaxservice", "");
2531
+ }
2532
+ yield this._dictionary.setDictionary(this._optionsService.options.languageCode);
2533
+ setTimeout(() => {
2534
+ this._changeDetector.detectChanges();
2535
+ });
2225
2536
  });
2226
2537
  }
2227
2538
  }
@@ -2271,13 +2582,12 @@ SendMethodDialogComponent.decorators = [
2271
2582
  </div>
2272
2583
  </div>
2273
2584
 
2274
- <div class="email-option-content" *ngIf="activeSendOption === sendOption.Print">
2585
+ <div class="email-option-content" *ngIf="activeSendOption === sendOption.Print" (click)="getPrintTemplates()">
2275
2586
  <div class="lov-wrapper">
2276
2587
  <co-input-combo-box
2277
2588
  [(model)]="stockService.printSticker.reportId"
2278
2589
  [collection]="printTemplates"
2279
2590
  [fields]="printTemplatesField"
2280
- [forceReadonly]="true"
2281
2591
  placeholder="Layout"
2282
2592
  ></co-input-combo-box>
2283
2593
  </div>
@@ -2361,9 +2671,16 @@ SendMethodDialogComponent.decorators = [
2361
2671
  ];
2362
2672
  SendMethodDialogComponent.ctorParameters = () => [
2363
2673
  { type: IconCacheService },
2364
- { type: StockService }
2674
+ { type: StockService },
2675
+ { type: OptionsService },
2676
+ { type: DictionaryService },
2677
+ { type: ChangeDetectorRef }
2365
2678
  ];
2366
2679
  SendMethodDialogComponent.propDecorators = {
2680
+ showEmailOption: [{ type: Input }],
2681
+ showPrintOption: [{ type: Input }],
2682
+ showPdfOption: [{ type: Input }],
2683
+ showXmlOption: [{ type: Input }],
2367
2684
  options: [{ type: Input }],
2368
2685
  showDialog: [{ type: Input }],
2369
2686
  headerTitle: [{ type: Input }],
@@ -2498,7 +2815,7 @@ StockModule.decorators = [
2498
2815
  ],
2499
2816
  providers: [
2500
2817
  StockService,
2501
- IoneConnectorAdapterService
2818
+ SharedConnectorService
2502
2819
  ]
2503
2820
  },] }
2504
2821
  ];
@@ -2739,6 +3056,93 @@ KeyPadModule.decorators = [
2739
3056
  },] }
2740
3057
  ];
2741
3058
 
3059
+ class LayoutSwitcherComponent {
3060
+ constructor(iconCacheService) {
3061
+ this.iconCacheService = iconCacheService;
3062
+ this.icon = Icon;
3063
+ this.layoutItems = [];
3064
+ this.layoutSwitchEmit = new EventEmitter();
3065
+ this.showMaskSidebar = false;
3066
+ this._activeIndex = 0;
3067
+ }
3068
+ showClass() {
3069
+ return true;
3070
+ }
3071
+ get activeIndex() {
3072
+ return this._activeIndex;
3073
+ }
3074
+ set activeIndex(index) {
3075
+ this._activeIndex = index;
3076
+ this.toggleMaskSidebar();
3077
+ this.layoutSwitchEmit.emit(this.layoutItems[index]);
3078
+ }
3079
+ toggleMaskSidebar() {
3080
+ this.showMaskSidebar = !this.showMaskSidebar;
3081
+ }
3082
+ }
3083
+ LayoutSwitcherComponent.decorators = [
3084
+ { type: Component, args: [{
3085
+ selector: "layout-switcher",
3086
+ template: `
3087
+ <div class="mask-wrapper" [class.mask-wrapper-active]='showMaskSidebar' @showHideSidebar>
3088
+ <div class="icon-wrapper" (click)="toggleMaskSidebar()">
3089
+ <co-icon class="icon-mask" [iconData]="iconCacheService.getIcon(icon.BringForwardRegular)" [@positionIcon]="showMaskSidebar"></co-icon>
3090
+
3091
+ <co-icon class='icon-mask-sidebar-handle' [@positionHandle]='showMaskSidebar' [iconData]="showMaskSidebar ? iconCacheService.getIcon(this.icon.AngleLeftSolid) : iconCacheService.getIcon(this.icon.AngleRightSolid)"></co-icon>
3092
+ </div>
3093
+
3094
+ <div class="mask-content" *ngIf="showMaskSidebar" @showHideSidebar>
3095
+ <span *ngFor='let item of this.layoutItems' [class.active]="this.activeIndex === this.layoutItems.indexOf(item)" [textContent]="item" (click)='activeIndex = this.layoutItems.indexOf(item)' ></span>
3096
+ </div>
3097
+ </div>
3098
+
3099
+ `,
3100
+ animations: [
3101
+ trigger("showHideSidebar", [
3102
+ state("void", style({ "width": "0" })),
3103
+ state("*", style({ "width": "*" })),
3104
+ transition("void <=> *", animate(200))
3105
+ ]),
3106
+ trigger("positionIcon", [
3107
+ state("true", style({ "left": "70px" })),
3108
+ state("false", style({ "left": "10px" })),
3109
+ transition("true <=> false", animate(200))
3110
+ ]),
3111
+ trigger("positionHandle", [
3112
+ state("true", style({ "left": "15px" })),
3113
+ state("false", style({ "left": "75px" })),
3114
+ transition("true <=> false", animate(200))
3115
+ ])
3116
+ ],
3117
+ encapsulation: ViewEncapsulation.None
3118
+ },] }
3119
+ ];
3120
+ LayoutSwitcherComponent.ctorParameters = () => [
3121
+ { type: IconCacheService }
3122
+ ];
3123
+ LayoutSwitcherComponent.propDecorators = {
3124
+ showClass: [{ type: HostBinding, args: ['class.layout-switcher',] }],
3125
+ layoutItems: [{ type: Input }],
3126
+ layoutSwitchEmit: [{ type: Output }]
3127
+ };
3128
+
3129
+ class LayoutSwitcherModule {
3130
+ }
3131
+ LayoutSwitcherModule.decorators = [
3132
+ { type: NgModule, args: [{
3133
+ imports: [
3134
+ CommonModule,
3135
+ IconModule
3136
+ ],
3137
+ declarations: [
3138
+ LayoutSwitcherComponent,
3139
+ ],
3140
+ exports: [
3141
+ LayoutSwitcherComponent
3142
+ ]
3143
+ },] }
3144
+ ];
3145
+
2742
3146
  /*
2743
3147
  * Public API Surface of sharedcomponents
2744
3148
  */
@@ -2747,5 +3151,5 @@ KeyPadModule.decorators = [
2747
3151
  * Generated bundle index. Do not edit.
2748
3152
  */
2749
3153
 
2750
- export { DocsignComponent, DocsignModule, KeyPadComponent, KeyPadModule, SendMethodDialogComponent, SendMethodDialogModule, StockComponent, StockModule, SignatureComponent as ɵa, SignaturesComponent as ɵb, StockService as ɵc, IoneConnectorAdapterService as ɵd, IconCacheService as ɵe, StockInformationComponent as ɵf, StockInformationGridComponent as ɵg, StockLocationComponent as ɵh, StockTransferComponent as ɵi, StockChangeAmountComponent as ɵj };
3154
+ export { DocsignComponent, DocsignModule, KeyPadComponent, KeyPadModule, LayoutSwitcherComponent, LayoutSwitcherModule, SendMethodDialogComponent, SendMethodDialogModule, SharedService, StockComponent, StockModule, SignatureComponent as ɵa, SignaturesComponent as ɵb, StockService as ɵc, OptionsService as ɵd, DictionaryService as ɵe, SharedConnectorService as ɵf, IconCacheService as ɵg, StockInformationComponent as ɵh, StockInformationGridComponent as ɵi, StockLocationComponent as ɵj, StockTransferComponent as ɵk, StockChangeAmountComponent as ɵl };
2751
3155
  //# sourceMappingURL=colijnit-sharedcomponents.js.map