{"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 \"@angular/router\";\nimport * as i3 from \"ngx-bootstrap/modal\";\nexport class AddAssignmentsComponent {\n  constructor(repository, router, modal) {\n    this.repository = repository;\n    this.router = router;\n    this.modal = modal;\n    this.createAssignment = assignmentFormValue => {\n      if (this.assignmentForm.valid) {\n        const assignment = {\n          ...assignmentFormValue\n        };\n        this.repository.create('api/deviceassignments/manual', assignment).subscribe({\n          next: () => {\n            const config = {\n              initialState: {\n                modalHeaderText: 'Başarı Mesajı',\n                modalBodyText: 'Atama başarıyla eklendi',\n                okButtonText: 'Tamam'\n              }\n            };\n            this.bsModalRef = this.modal.show(SuccessModalComponent, config);\n            this.bsModalRef.content.redirectOnOk.subscribe(() => this.redirectToAssignmentsList());\n          },\n          error: err => {\n            console.error('Atama eklenirken hata oluştu:', err);\n          }\n        });\n      }\n    };\n    this.redirectToAssignmentsList = () => {\n      this.router.navigate(['/ui-components/assignments']);\n    };\n  }\n  ngOnInit() {\n    this.assignmentForm = new FormGroup({\n      deviceName: new FormControl('', [Validators.required]),\n      deviceBrand: new FormControl('', [Validators.required]),\n      deviceCategory: new FormControl('', [Validators.required]),\n      employeeName: new FormControl('', [Validators.required]),\n      employeeNumber: new FormControl('', [Validators.required])\n    });\n  }\n  static #_ = this.ɵfac = function AddAssignmentsComponent_Factory(t) {\n    return new (t || AddAssignmentsComponent)(i0.ɵɵdirectiveInject(i1.RepositoryService), i0.ɵɵdirectiveInject(i2.Router), i0.ɵɵdirectiveInject(i3.BsModalService));\n  };\n  static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n    type: AddAssignmentsComponent,\n    selectors: [[\"app-add-assignments\"]],\n    decls: 2,\n    vars: 0,\n    template: function AddAssignmentsComponent_Template(rf, ctx) {\n      if (rf & 1) {\n        i0.ɵɵelementStart(0, \"p\");\n        i0.ɵɵtext(1, \"add-assignments 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","AddAssignmentsComponent","constructor","repository","router","modal","createAssignment","assignmentFormValue","assignmentForm","valid","assignment","create","subscribe","next","config","initialState","modalHeaderText","modalBodyText","okButtonText","bsModalRef","show","content","redirectOnOk","redirectToAssignmentsList","error","err","console","navigate","ngOnInit","deviceName","required","deviceBrand","deviceCategory","employeeName","employeeNumber","_","i0","ɵɵdirectiveInject","i1","RepositoryService","i2","Router","i3","BsModalService","_2","selectors","decls","vars","template","AddAssignmentsComponent_Template","rf","ctx","ɵɵelementStart","ɵɵtext","ɵɵelementEnd"],"sources":["C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\ui-components\\assign\\assignments\\add-assignments\\add-assignments.component.ts","C:\\Users\\Cem\\Desktop\\InventryUI-Client\\src\\app\\pages\\ui-components\\assign\\assignments\\add-assignments\\add-assignments.component.html"],"sourcesContent":["import { 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 { RepositoryService } from 'src/app/shared/services/repository.service';\r\nimport { SuccessModalComponent } from 'src/app/shared/modals/success-modal/success-modal.component';\r\n\r\n@Component({\r\n  selector: 'app-add-assignments',\r\n  templateUrl: './add-assignments.component.html',\r\n  styleUrls: ['./add-assignments.component.scss']\r\n})\r\nexport class AddAssignmentsComponent implements OnInit {\r\n  public assignmentForm: FormGroup;\r\n  public bsModalRef?: BsModalRef;\r\n\r\n  constructor(\r\n    private repository: RepositoryService,\r\n    private router: Router,\r\n    private modal: BsModalService\r\n  ) {}\r\n\r\n  ngOnInit(): void {\r\n    this.assignmentForm = new FormGroup({\r\n      deviceName: new FormControl('', [Validators.required]),\r\n      deviceBrand: new FormControl('', [Validators.required]),\r\n      deviceCategory: new FormControl('', [Validators.required]),\r\n      employeeName: new FormControl('', [Validators.required]),\r\n      employeeNumber: new FormControl('', [Validators.required])\r\n    });\r\n  }\r\n\r\n  createAssignment = (assignmentFormValue: any) => {\r\n    if (this.assignmentForm.valid) {\r\n      const assignment: any = { ...assignmentFormValue };\r\n\r\n      this.repository.create('api/deviceassignments/manual', assignment)\r\n        .subscribe({\r\n          next: () => {\r\n            const config: ModalOptions = {\r\n              initialState: {\r\n                modalHeaderText: 'Başarı Mesajı',\r\n                modalBodyText: 'Atama başarıyla eklendi',\r\n                okButtonText: 'Tamam'\r\n              }\r\n            };\r\n            this.bsModalRef = this.modal.show(SuccessModalComponent, config);\r\n            this.bsModalRef.content.redirectOnOk.subscribe(() => this.redirectToAssignmentsList());\r\n          },\r\n          error: (err) => {\r\n            console.error('Atama eklenirken hata oluştu:', err);\r\n          }\r\n        });\r\n    }\r\n  }\r\n\r\n  redirectToAssignmentsList = () => {\r\n    this.router.navigate(['/ui-components/assignments']);\r\n  }\r\n}\r\n","<p>add-assignments works!</p>\r\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,WAAW,EAAEC,UAAU,QAAQ,gBAAgB;AAInE,SAASC,qBAAqB,QAAQ,6DAA6D;;;;;AAOnG,OAAM,MAAOC,uBAAuB;EAIlCC,YACUC,UAA6B,EAC7BC,MAAc,EACdC,KAAqB;IAFrB,KAAAF,UAAU,GAAVA,UAAU;IACV,KAAAC,MAAM,GAANA,MAAM;IACN,KAAAC,KAAK,GAALA,KAAK;IAaf,KAAAC,gBAAgB,GAAIC,mBAAwB,IAAI;MAC9C,IAAI,IAAI,CAACC,cAAc,CAACC,KAAK,EAAE;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