{"ast":null,"code":"import { FormGroup, FormControl, Validators } from '@angular/forms';\nimport { SuccessModalComponent } from 'src/app/shared/modals/success-modal/success-modal.component';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"src/app/shared/services/repository.service\";\nimport * as i2 from \"src/app/shared/services/repository-error-handler.service\";\nimport * as i3 from \"@angular/router\";\nimport * as i4 from \"ngx-bootstrap/modal\";\nfunction AddPrinterComponent_mat_error_9_Template(rf, ctx) {\n  if (rf & 1) {\n    i0.ɵɵelementStart(0, \"mat-error\");\n    i0.ɵɵtext(1, \"Model Gerekli\");\n    i0.ɵɵelementEnd();\n  }\n}\nfunction AddPrinterComponent_mat_error_12_Template(rf, ctx) {\n  if (rf & 1) {\n    i0.ɵɵelementStart(0, \"mat-error\");\n    i0.ɵɵtext(1, \"Lokasyon Bilgisi Gerekli\");\n    i0.ɵɵelementEnd();\n  }\n}\nfunction AddPrinterComponent_mat_error_15_Template(rf, ctx) {\n  if (rf & 1) {\n    i0.ɵɵelementStart(0, \"mat-error\");\n    i0.ɵɵtext(1, \"IP Adresi Gerekli\");\n    i0.ɵɵelementEnd();\n  }\n}\nexport class AddPrinterComponent {\n  constructor(repository, errorHandler, router, modal) {\n    this.repository = repository;\n    this.errorHandler = errorHandler;\n    this.router = router;\n    this.modal = modal;\n    this.errorMessage = '';\n    this.createPrinter = printerFormValue => {\n      if (this.printerForm.valid) {\n        const printer = {\n          model: printerFormValue.model,\n          location: printerFormValue.location,\n          ipAddress: printerFormValue.ipAddress\n        };\n        this.repository.create('api/printers', printer).subscribe({\n          next: () => {\n            const config = {\n              initialState: {\n                modalHeaderText: 'Success Message',\n                modalBodyText: 'Printer created successfully',\n                okButtonText: 'OK'\n              }\n            };\n            this.bsModalRef = this.modal.show(SuccessModalComponent, config);\n            this.bsModalRef.content.redirectOnOk.subscribe(() => this.redirectToPrinterList());\n          },\n          error: err => {\n            this.errorHandler.handleError(err);\n            this.errorMessage = this.errorHandler.errorMessage;\n          }\n        });\n      }\n    };\n    this.redirectToPrinterList = () => {\n      this.router.navigate(['/ui-components/printer']);\n      //window.location.href = '/ui-components/printer';\n    };\n  }\n  ngOnInit() {\n    this.printerForm = new FormGroup({\n      model: new FormControl('', [Validators.required, Validators.maxLength(60)]),\n      location: new FormControl('', [Validators.required]),\n      ipAddress: new FormControl('', [Validators.required, Validators.pattern('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$')])\n    });\n  }\n  static #_ = this.ɵfac = function AddPrinterComponent_Factory(t) {\n    return new (t || AddPrinterComponent)(i0.ɵɵdirectiveInject(i1.RepositoryService), i0.ɵɵdirectiveInject(i2.RepositoryErrorHandlerService), i0.ɵɵdirectiveInject(i3.Router), i0.ɵɵdirectiveInject(i4.BsModalService));\n  };\n  static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n    type: AddPrinterComponent,\n    selectors: [[\"app-add-printer\"]],\n    decls: 21,\n    vars: 5,\n    consts: [[\"fxLayout\", \"row wrap\", \"fxLayoutAlign\", \"center center\"], [\"fxFlex\", \"500px\", \"fxFlex.xs\", \"100%\", 1, \"b-1\", \"shadow-none\"], [\"autocomplete\", \"off\", \"novalidate\", \"\", 3, \"ngSubmit\", \"formGroup\"], [\"appearance\", \"outline\", 1, \"w-100\"], [\"matInput\", \"\", \"placeholder\", \"Model\", \"formControlName\", \"model\"], [4, \"ngIf\"], [\"matInput\", \"\", \"placeholder\", \"Location\", \"formControlName\", \"location\"], [\"matInput\", \"\", \"placeholder\", \"IP Address\", \"formControlName\", \"ipAddress\"], [\"mat-flat-button\", \"\", \"color\", \"primary\", 1, \"w-100\", \"action-button\", 3, \"disabled\"], [\"type\", \"button\", \"mat-flat-button\", \"\", \"color\", \"warn\", 1, \"w-100\", 3, \"click\"]],\n    template: function AddPrinterComponent_Template(rf, ctx) {\n      if (rf & 1) {\n        i0.ɵɵelementStart(0, \"section\", 0)(1, \"mat-card\", 1)(2, \"mat-card-header\")(3, \"mat-card-title\");\n        i0.ɵɵtext(4, \"Yeni Yaz\\u0131c\\u0131 Ekle\");\n        i0.ɵɵelementEnd()();\n        i0.ɵɵelementStart(5, \"form\", 2);\n        i0.ɵɵlistener(\"ngSubmit\", function AddPrinterComponent_Template_form_ngSubmit_5_listener() {\n          return ctx.createPrinter(ctx.printerForm.value);\n        });\n        i0.ɵɵelementStart(6, \"mat-card-content\")(7, \"mat-form-field\", 3);\n        i0.ɵɵelement(8, \"input\", 4);\n        i0.ɵɵtemplate(9, AddPrinterComponent_mat_error_9_Template, 2, 0, \"mat-error\", 5);\n        i0.ɵɵelementEnd();\n        i0.ɵɵelementStart(10, \"mat-form-field\", 3);\n        i0.ɵɵelement(11, \"input\", 6);\n        i0.ɵɵtemplate(12, AddPrinterComponent_mat_error_12_Template, 2, 0, \"mat-error\", 5);\n        i0.ɵɵelementEnd();\n        i0.ɵɵelementStart(13, \"mat-form-field\", 3);\n        i0.ɵɵelement(14, \"input\", 7);\n        i0.ɵɵtemplate(15, AddPrinterComponent_mat_error_15_Template, 2, 0, \"mat-error\", 5);\n        i0.ɵɵelementEnd()();\n        i0.ɵɵelementStart(16, \"mat-card-actions\")(17, \"button\", 8);\n        i0.ɵɵtext(18, \"Ekle\");\n        i0.ɵɵelementEnd();\n        i0.ɵɵelementStart(19, \"button\", 9);\n        i0.ɵɵlistener(\"click\", function AddPrinterComponent_Template_button_click_19_listener() {\n          return ctx.redirectToPrinterList();\n        });\n        i0.ɵɵtext(20, \"\\u0130ptal\");\n        i0.ɵɵelementEnd()()()()();\n      }\n      if (rf & 2) {\n        i0.ɵɵadvance(5);\n        i0.ɵɵproperty(\"formGroup\", ctx.printerForm);\n        i0.ɵɵadvance(4);\n        i0.ɵɵproperty(\"ngIf\", ctx.printerForm.get(\"model\").invalid);\n        i0.ɵɵadvance(3);\n        i0.ɵɵproperty(\"ngIf\", ctx.printerForm.get(\"location\").invalid);\n        i0.ɵɵadvance(3);\n        i0.ɵɵproperty(\"ngIf\", ctx.printerForm.get(\"ipAddress\").invalid);\n        i0.ɵɵadvance(2);\n        i0.ɵɵproperty(\"disabled\", !ctx.printerForm.valid);\n      }\n    },\n    styles: [\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZVJvb3QiOiIifQ== */\"]\n  });\n}","map":{"version":3,"names":["FormGroup","FormControl","Validators","SuccessModalComponent","i0","ɵɵelementStart","ɵɵtext","ɵɵelementEnd","AddPrinterComponent","constructor","repository","errorHandler","router","modal","errorMessage","createPrinter","printerFormValue","printerForm","valid","printer","model","location","ipAddress","create","subscribe","next","config","initialState","modalHeaderText","modalBodyText","okButtonText","bsModalRef","show","content","redirectOnOk","redirectToPrinterList","error","err","handleError","navigate","ngOnInit","required","maxLength","pattern","_","ɵɵdirectiveInject","i1","RepositoryService","i2","RepositoryErrorHandlerService","i3","Router","i4","BsModalService","_2","selectors","decls","vars","consts","template","AddPrinterComponent_Template","rf","ctx","ɵɵlistener","AddPrinterComponent_Template_form_ngSubmit_5_listener","value","ɵɵelement","ɵɵtemplate","AddPrinterComponent_mat_error_9_Template","AddPrinterComponent_mat_error_12_Template","AddPrinterComponent_mat_error_15_Template","AddPrinterComponent_Template_button_click_19_listener","ɵɵadvance","ɵɵproperty","get","invalid"],"sources":["C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\ui-components\\printer\\add-printer\\add-printer.component.ts","C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\ui-components\\printer\\add-printer\\add-printer.component.html"],"sourcesContent":["import { HttpErrorResponse } from '@angular/common/http';\r\nimport { Component, OnInit } from '@angular/core';\r\nimport { FormGroup, FormControl, Validators } from '@angular/forms';\r\nimport { Router } from '@angular/router';\r\nimport { BsModalRef, BsModalService, ModalOptions } from 'ngx-bootstrap/modal';\r\nimport { SuccessModalComponent } from 'src/app/shared/modals/success-modal/success-modal.component';\r\nimport { RepositoryErrorHandlerService } from 'src/app/shared/services/repository-error-handler.service';\r\nimport { RepositoryService } from 'src/app/shared/services/repository.service';\r\n\r\n@Component({\r\n  selector: 'app-add-printer',\r\n  templateUrl: './add-printer.component.html',\r\n  styleUrls: ['./add-printer.component.scss']\r\n})\r\nexport class AddPrinterComponent implements OnInit {\r\n  public printerForm: FormGroup;\r\n  public errorMessage: string = '';\r\n  public bsModalRef?: BsModalRef;\r\n\r\n  constructor(\r\n    private repository: RepositoryService,\r\n    private errorHandler: RepositoryErrorHandlerService,\r\n    private router: Router,\r\n    private modal: BsModalService\r\n  ) { }\r\n\r\n  ngOnInit(): void {\r\n    this.printerForm = new FormGroup({\r\n      model: new FormControl('', [Validators.required, Validators.maxLength(60)]),\r\n      location: new FormControl('', [Validators.required]),\r\n      ipAddress: new FormControl('', [Validators.required, Validators.pattern('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$')])\r\n    });\r\n  }\r\n\r\n  createPrinter = (printerFormValue: any) => {\r\n    if (this.printerForm.valid) {\r\n      const printer: any = {\r\n        model: printerFormValue.model,\r\n        location: printerFormValue.location,\r\n        ipAddress: printerFormValue.ipAddress\r\n      };\r\n\r\n      this.repository.create('api/printers', printer)\r\n        .subscribe({\r\n          next: () => {\r\n            const config: ModalOptions = {\r\n              initialState: {\r\n                modalHeaderText: 'Success Message',\r\n                modalBodyText: 'Printer created successfully',\r\n                okButtonText: 'OK'\r\n              }\r\n            };\r\n\r\n            this.bsModalRef = this.modal.show(SuccessModalComponent, config);\r\n            this.bsModalRef.content.redirectOnOk.subscribe(() => this.redirectToPrinterList());\r\n          },\r\n          error: (err: HttpErrorResponse) => {\r\n            this.errorHandler.handleError(err);\r\n            this.errorMessage = this.errorHandler.errorMessage;\r\n          }\r\n        });\r\n    }\r\n  }\r\n\r\n  redirectToPrinterList = () => {\r\n    this.router.navigate(['/ui-components/printer']);\r\n    //window.location.href = '/ui-components/printer';\r\n  };\r\n}\r\n","<section fxLayout=\"row wrap\" fxLayoutAlign=\"center center\">\r\n  <mat-card fxFlex=\"500px\" fxFlex.xs=\"100%\" class=\"b-1 shadow-none\">\r\n    <mat-card-header>\r\n      <mat-card-title>Yeni Yazıcı Ekle</mat-card-title>\r\n    </mat-card-header>\r\n    <form [formGroup]=\"printerForm\" autocomplete=\"off\" novalidate (ngSubmit)=\"createPrinter(printerForm.value)\">\r\n      <mat-card-content>\r\n        <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n          <input matInput placeholder=\"Model\" formControlName=\"model\">\r\n          <mat-error *ngIf=\"printerForm.get('model')!.invalid\">Model Gerekli</mat-error>\r\n        </mat-form-field>\r\n\r\n        <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n          <input matInput placeholder=\"Location\" formControlName=\"location\">\r\n          <mat-error *ngIf=\"printerForm.get('location')!.invalid\">Lokasyon Bilgisi Gerekli</mat-error>\r\n        </mat-form-field>\r\n\r\n        <mat-form-field appearance=\"outline\" class=\"w-100\">\r\n          <input matInput placeholder=\"IP Address\" formControlName=\"ipAddress\">\r\n          <mat-error *ngIf=\"printerForm.get('ipAddress')!.invalid\">IP Adresi Gerekli</mat-error>\r\n        </mat-form-field>\r\n      </mat-card-content>\r\n\r\n      <mat-card-actions>\r\n        <button mat-flat-button color=\"primary\" class=\"w-100 action-button\" [disabled]=\"!printerForm.valid\">Ekle</button>\r\n        <button type=\"button\" mat-flat-button color=\"warn\" class=\"w-100\" (click)=\"redirectToPrinterList()\">İptal</button>\r\n      </mat-card-actions>\r\n    </form>\r\n  </mat-card>\r\n</section>\r\n"],"mappings":"AAEA,SAASA,SAAS,EAAEC,WAAW,EAAEC,UAAU,QAAQ,gBAAgB;AAGnE,SAASC,qBAAqB,QAAQ,6DAA6D;;;;;;;;ICIzFC,EAAA,CAAAC,cAAA,gBAAqD;IAAAD,EAAA,CAAAE,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