{"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\";\nexport class AddLicenseComponent {\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.createLicense = licenseFormValue => {\n      if (this.licenseForm.valid) {\n        const license = {\n          ...licenseFormValue\n        };\n        this.repository.create('api/licenses', license).subscribe({\n          next: () => {\n            const config = {\n              initialState: {\n                modalHeaderText: 'Success Message',\n                modalBodyText: 'Lisans başarıyla oluşturuldu',\n                okButtonText: 'OK'\n              }\n            };\n            this.bsModalRef = this.modal.show(SuccessModalComponent, config);\n            this.bsModalRef.content.redirectOnOk.subscribe(() => this.redirectToLicenseList());\n          },\n          error: err => {\n            this.errorHandler.handleError(err);\n            this.errorMessage = this.errorHandler.errorMessage;\n          }\n        });\n      }\n    };\n    this.redirectToLicenseList = () => {\n      this.router.navigate(['/ui-components/licenses']);\n    };\n  }\n  ngOnInit() {\n    this.licenseForm = new FormGroup({\n      name: new FormControl('', [Validators.required]),\n      provider: new FormControl('', [Validators.required]),\n      expiryDate: new FormControl('', [Validators.required]),\n      licenseKey: new FormControl('', [Validators.required]),\n      description: new FormControl('')\n    });\n  }\n  static #_ = this.ɵfac = function AddLicenseComponent_Factory(t) {\n    return new (t || AddLicenseComponent)(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: AddLicenseComponent,\n    selectors: [[\"app-add-license\"]],\n    decls: 2,\n    vars: 0,\n    template: function AddLicenseComponent_Template(rf, ctx) {\n      if (rf & 1) {\n        i0.ɵɵelementStart(0, \"p\");\n        i0.ɵɵtext(1, \"add-licenses works!\");\n        i0.ɵɵelementEnd();\n      }\n    },\n    styles: [\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZVJvb3QiOiIifQ== */\"]\n  });\n}","map":{"version":3,"names":["FormGroup","FormControl","Validators","SuccessModalComponent","AddLicenseComponent","constructor","repository","errorHandler","router","modal","errorMessage","createLicense","licenseFormValue","licenseForm","valid","license","create","subscribe","next","config","initialState","modalHeaderText","modalBodyText","okButtonText","bsModalRef","show","content","redirectOnOk","redirectToLicenseList","error","err","handleError","navigate","ngOnInit","name","required","provider","expiryDate","licenseKey","description","_","i0","ɵɵdirectiveInject","i1","RepositoryService","i2","RepositoryErrorHandlerService","i3","Router","i4","BsModalService","_2","selectors","decls","vars","template","AddLicenseComponent_Template","rf","ctx","ɵɵelementStart","ɵɵtext","ɵɵelementEnd"],"sources":["C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\ui-components\\licenses\\add-licenses\\add-licenses.component.ts","C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\ui-components\\licenses\\add-licenses\\add-licenses.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-license',\r\n  templateUrl: './add-licenses.component.html',\r\n  styleUrls: ['./add-licenses.component.scss']\r\n})\r\nexport class AddLicenseComponent implements OnInit {\r\n  public licenseForm: 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.licenseForm = new FormGroup({\r\n      name: new FormControl('', [Validators.required]),\r\n      provider: new FormControl('', [Validators.required]),\r\n      expiryDate: new FormControl('', [Validators.required]),\r\n      licenseKey: new FormControl('', [Validators.required]),\r\n      description: new FormControl('')\r\n    });\r\n  }\r\n\r\n  createLicense = (licenseFormValue: any) => {\r\n    if (this.licenseForm.valid) {\r\n      const license: any = { ...licenseFormValue };\r\n\r\n      this.repository.create('api/licenses', license)\r\n        .subscribe({\r\n          next: () => {\r\n            const config: ModalOptions = {\r\n              initialState: {\r\n                modalHeaderText: 'Success Message',\r\n                modalBodyText: 'Lisans başarıyla oluşturuldu',\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.redirectToLicenseList());\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  redirectToLicenseList = () => {\r\n    this.router.navigate(['/ui-components/licenses']);\r\n  }\r\n}","<p>add-licenses works!</p>\r\n"],"mappings":"AAEA,SAASA,SAAS,EAAEC,WAAW,EAAEC,UAAU,QAAQ,gBAAgB;AAGnE,SAASC,qBAAqB,QAAQ,6DAA6D;;;;;;AASnG,OAAM,MAAOC,mBAAmB;EAK9BC,YACUC,UAA6B,EAC7BC,YAA2C,EAC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