{ "version": 3, "sources": ["apps/frontend/src/app/printers/components/barcode-printer-print-dialog.component.ts"], "sourcesContent": ["import { Component, Inject } from '@angular/core';\nimport { MAT_LEGACY_DIALOG_DATA, MatLegacyDialogRef } from '@angular/material/legacy-dialog';\nimport { Entity } from '@proman/services/entity.service';\nimport { LocalStorageService } from '@proman/services/local-storage.service';\nimport { resourcesConfig } from '@proman/resources';\nimport { PrinterEntityInterface } from '@proman/resources/printer';\nimport { isArray, isDefined } from '@proman/utils';\nimport { ProductionOperation } from '@proman/interfaces/entity-interfaces';\nimport { ProductEntityInterface } from '@proman/resources/product';\n\n@Component({\n selector: 'pm-barcode-printer-print-dialog',\n template: `\n \n
\n \n \n
\n \n\n \n \n \n `\n})\n\nexport class BarcodePrinterPrintDialogComponent {\n barcodePrinterEntity: PrinterEntityInterface;\n productEntity: ProductEntityInterface;\n isAutoCloseDialog: boolean;\n\n constructor(\n @Inject(MAT_LEGACY_DIALOG_DATA) public data: any,\n private Entity: Entity,\n private dialogRef: MatLegacyDialogRef,\n private LocalStorage: LocalStorageService\n ) {\n this.barcodePrinterEntity = this.Entity.get('printer');\n this.productEntity = this.Entity.get('product');\n }\n\n print = (isClose?: boolean) => {\n\n if (isDefined(isClose)) {\n this.isAutoCloseDialog = isClose;\n }\n\n if (this.data.type === 'operation') {\n\n this.printOperation();\n\n } else if (this.data.type === this.productEntity.PRODUCTS) {\n\n this.printProduct();\n\n } else if (this.data.type === 'quant') {\n\n this.printQuant();\n\n } else if (this.data.type === 'warehouseLocation') {\n\n this.printWarehouseLocation();\n\n } else if (this.data.type === 'emit') {\n this.dialogRef.close({\n printer: this.LocalStorage.get('barcodePrinter'),\n barcode_template: this.LocalStorage.get('barcodeTemplate')\n });\n }\n\n };\n\n closeDialogCallback = () => {\n this.isAutoCloseDialog && this.dialogRef.close(1);\n };\n\n printOperation = () => {\n this.barcodePrinterEntity\n .printOperationTemplate({\n production_operation_id: isArray(this.data.operation) ? this.data.operation.map((op: ProductionOperation) => op.id) : this.data.operation.id,\n printer: this.LocalStorage.get('barcodePrinter'),\n barcode_template: this.LocalStorage.get('barcodeTemplate')\n })\n .then(this.closeDialogCallback);\n };\n\n printProduct = () => {\n this.barcodePrinterEntity\n .printProduct({\n id: this.data.product.id,\n printer: this.LocalStorage.get('barcodePrinter'),\n barcode_template: this.LocalStorage.get('barcodeTemplate')\n })\n .then(this.closeDialogCallback);\n };\n\n printQuant = () => {\n this.barcodePrinterEntity\n .printQuant({\n quant: this.data.quant.id,\n device: +this.LocalStorage.get('barcodePrinter'),\n barcode_template: this.LocalStorage.get('barcodeTemplate')\n })\n .then(this.closeDialogCallback);\n };\n\n printWarehouseLocation = () => {\n this.barcodePrinterEntity\n .printWarehouseLocation({\n warehouse_location: this.data.warehouseLocation.id,\n device: +this.LocalStorage.get('barcodePrinter'),\n barcode_template: this.LocalStorage.get('barcodeTemplate')\n })\n .then(() => this.dialogRef.close(1));\n };\n\n setAutocloseDialog(value: boolean) {\n this.isAutoCloseDialog = value;\n }\n\n}\n"], "mappings": "qTA+BaA,GAAkC,IAAA,CAAzC,MAAOA,CAAkC,CAK3CC,YAC2CC,EAC/BC,EACAC,EACAC,EAAiC,CAHF,KAAAH,KAAAA,EAC/B,KAAAC,OAAAA,EACA,KAAAC,UAAAA,EACA,KAAAC,aAAAA,EAMZ,KAAAC,MAASC,GAAqB,CAEtBC,EAAUD,CAAO,IACjB,KAAKE,kBAAoBF,GAGzB,KAAKL,KAAKQ,OAAS,YAEnB,KAAKC,eAAc,EAEZ,KAAKT,KAAKQ,OAAS,KAAKE,cAAcC,SAE7C,KAAKC,aAAY,EAEV,KAAKZ,KAAKQ,OAAS,QAE1B,KAAKK,WAAU,EAER,KAAKb,KAAKQ,OAAS,oBAE1B,KAAKM,uBAAsB,EAEpB,KAAKd,KAAKQ,OAAS,QAC1B,KAAKN,UAAUa,MAAM,CACjBC,QAAS,KAAKb,aAAac,IAAI,gBAAgB,EAC/CC,iBAAkB,KAAKf,aAAac,IAAI,iBAAi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mBAAmBC,EAAc,CAC7B,KAAK5B,kBAAoB4B,CAC7B,iDA5FSrC,GAAkCsC,EAM/BC,CAAsB,EAAAD,EAAAnC,CAAA,EAAAmC,EAAAE,CAAA,EAAAF,EAAAG,CAAA,CAAA,CAAA,CAAA,+BANzBzC,EAAkC0C,UAAA,CAAA,CAAA,iCAAA,CAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,OAAA,CAAA,CAAA,QAAA,eAAA,EAAA,CAAA,qBAAA,GAAA,WAAA,SAAA,EAAA,aAAA,OAAA,EAAA,CAAA,EAAA,QAAA,SAAA,UAAA,EAAA,CAAA,UAAA,UAAA,EAAA,UAAA,EAAA,CAAA,QAAA,aAAA,QAAA,SAAA,EAAA,SAAA,CAAA,EAAAC,SAAA,SAAAC,EAAAC,EAAA,CAAAD,EAAA,IAlBvCE,EAAA,EAAA,mBAAA,CAAA,EACAC,EAAA,EAAA,MAAA,CAAA,EACID,EAAA,EAAA,YAAA,EACAC,EAAA,EAAA,eAAA,CAAA,EAEaC,EAAA,WAAA,SAAAC,EAAA,CAAA,OAAYJ,EAAAZ,mBAAAgB,CAAA,CAA0B,CAAA,EAAEC,EAAA,EAAe,EAExEH,EAAA,EAAA,qBAAA,CAAA,EAAoBC,EAAA,WAAA,UAAA,CAAA,OAAYH,EAAA1C,MAAA,CAAO,CAAA,EAGnC4C,EAAA,EAAA,UAAA,CAAA,EAASC,EAAA,UAAA,UAAA,CAAA,OAAWH,EAAA1C,MAAM,EAAK,CAAC,CAAA,EAGhC+C,EAAA,EAAU,SAVIC,EAAA,CAAA,EAAAC,EAAA,QAAAP,EAAAvC,iBAAA,EAA2B,SAAA+C,EAAA,EAAAC,CAAA,CAAA,2DAexCzD,CAAkC,GAAA", "names": ["BarcodePrinterPrintDialogComponent", "constructor", "data", "Entity", "dialogRef", "LocalStorage", "print", "isClose", "isDefined", "isAutoCloseDialog", "type", "printOperation", "productEntity", "PRODUCTS", "printProduct", "printQuant", "printWarehouseLocation", "close", "printer", "get", "barcode_template", "closeDialogCallback", "barcodePrinterEntity", "printOperationTemplate", "production_operation_id", "isArray", "operation", "map", "op", "id", "then", "product", "quant", "device", "warehouse_location", "warehouseLocation", "setAutocloseDialog", "value", "\u0275\u0275directiveInject", "MAT_LEGACY_DIALOG_DATA", "MatLegacyDialogRef", "LocalStorageService", "selectors", "decls", "vars", "consts", "template", "rf", "ctx", "\u0275\u0275element", "\u0275\u0275elementStart", "\u0275\u0275listener", "$event", "\u0275\u0275elementEnd", "\u0275\u0275advance", "\u0275\u0275property", "\u0275\u0275pureFunction0", "_c0"] }