PageSourceSearch

https://sistema.cashlocal.com.br/6835.fa351f4ad4dd443cf764.js

js cashlocal.com.br collected 2026-10-02 00:47:13 UTC 67,310 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkbr_com_cashlocal=self.webpackChunkbr_com_cashlocal||[]).push([[6835],{25301:(z,I,i)=>{i.d(I,{Ql:()=>Z,Iu:()=>p});var h=i(60793),u=i(12057),c=i(24751);const U=function(m,C,y){return{"p-inputswitch p-component":!0,"p-inputswitch-checked":m,"p-disabled":C,"p-focus":y}},S={provide:c.JU,useExisting:(0,h.Gpc)(()=>Z),multi:!0};let Z=(()=>{class m{constructor(y){this.cd=y,this.onChange=new h.vpe,this.checked=!1,this.focused=!1,this.onModelChange=()=>{},this.onModelTouched=()=>{}}onClick(y,_){!this.disabled&&!this.readonly&&(y.preventDefault(),this.toggle(y),_.focus())}onInputChange(y){this.readonly||this.updateModel(y,y.target.checked)}toggle(y){this.updateModel(y,!this.checked)}updateModel(y,_){this.checked=_,this.onModelChange(this.checked),this.onChange.emit({originalEvent:y,checked:this.checked})}onFocus(y){this.focused=!0}onBlur(y){this.focused=!1,this.onModelTouched()}writeValue(y){this.checked=y,this.cd.markForCheck()}registerOnChange(y){this.onModelChange=y}registerOnTouched(y){this.onModelTouched=y}setDisabledState(y){this.disabled=y,this.cd.markForCheck()}}return m.\u0275fac=function(y){return new(y||m)(h.Y36(h.sBO))},m.\u0275cmp=h.Xpm({type:m,selectors:[["p-inputSwitch"]],inputs:{disabled:"disabled",style:"style",styleClass:"styleClass",tabindex:"tabindex",inputId:"inputId",name:"name",readonly:"readonly",ariaLabelledBy:"ariaLabelledBy"},outputs:{onChange:"onChange"},features:[h._Bn([S])],decls:5,vars:15,consts:[[3,"ngClass","ngStyle","click"],[1,"p-hidden-accessible"],["type","checkbox","role","switch",3,"checked","disabled","change","focus","blur"],["cb",""],[1,"p-inputswitch-slider"]],template:function(y,_){if(1&y){const J=h.EpF();h.TgZ(0,"div",0),h.NdJ("click",function(e){h.CHM(J);const V=h.MAs(3);return _.onClick(e,V)}),h.TgZ(1,"div",1),h.TgZ(2,"input",2,3),h.NdJ("change",function(e){return _.onInputChange(e)})("focus",function(e){return _.onFocus(e)})("blur",function(e){return _.onBlur(e)}),h.qZA(),h.qZA(),h._UZ(4,"span",4),h.qZA()}2&y&&(h.Tol(_.styleClass),h.Q6J("ngClass",h.kEZ(11,U,_.checked,_.disabled,_.focused))("ngStyle",_.style),h.xp6(2),h.Q6J("checked",_.checked)("disabled",_.disabled),h.uIk("id",_.inputId)("name",_.name)("tabindex",_.tabindex)("aria-checked",_.checked)("aria-labelledby",_.ariaLabelledBy))},directives:[u.mk,u.PC],styles:['.p-inputswitch{-ms-user-select:none;-webkit-user-select:none;display:inline-block;position:relative;user-select:none}.p-inputswitch-slider{bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0}.p-inputswitch-slider:before{content:"";position:absolute;top:50%}'],encapsulation:2,changeDetection:0}),m})(),p=(()=>{class m{}return m.\u0275fac=function(y){return new(y||m)},m.\u0275mod=h.oAB({type:m}),m.\u0275inj=h.cJS({imports:[[u.ez]]}),m})()},43771:(z,I,i)=>{i.d(I,{V:()=>S,W:()=>Z});var h=i(12057),u=i(60793);function c(p,m){if(1&p&&u._UZ(0,"span",3),2&p){const C=u.oxw();u.Q6J("ngClass",C.icon)}}const U=["*"];let S=(()=>{class p{containerClass(){return{"p-tag p-component":!0,"p-tag-info":"info"===this.severity,"p-tag-success":"success"===this.severity,"p-tag-warning":"warning"===this.severity,"p-tag-danger":"danger"===this.severity,"p-tag-rounded":this.rounded}}}return p.\u0275fac=function(C){return new(C||p)},p.\u0275cmp=u.Xpm({type:p,selectors:[["p-tag"]],inputs:{styleClass:"styleClass",style:"style",severity:"severity",value:"value",icon:"icon",rounded:"rounded"},ngContentSelectors:U,decls:5,vars:6,consts:[[3,"ngClass","ngStyle"],["class","p-tag-icon",3,"ngClass",4,"ngIf"],[1,"p-tag-value"],[1,"p-tag-icon",3,"ngClass"]],template:function(C,y){1&C&&(u.F$t(),u.TgZ(0,"span",0),u.Hsn(1),u.YNc(2,c,1,1,"span",1),u.TgZ(3,"span",2),u._uU(4),u.qZA(),u.qZA()),2&C&&(u.Tol(y.styleClass),u.Q6J("ngClass",y.containerClass())("ngStyle",y.style),u.xp6(2),u.Q6J("ngIf",y.icon),u.xp6(2),u.Oqu(y.value))},directives:[h.mk,h.PC,h.O5],styles:[".p-tag{align-items:center;display:inline-flex;justify-content:center}.p-tag-icon,.p-tag-icon.pi,.p-tag-value{line-height:1.5}.p-tag.p-tag-rounded{border-radius:10rem}"],encapsulation:2,changeDetection:0}),p})(),Z=(()=>{class p{}
1return p.\u0275fac=function(C){return new(C||p)},p.\u0275mod=u.oAB({type:p}),p.\u0275inj=u.cJS({imports:[[h.ez]]}),p})()},41576:(z,I,i)=>{i.r(I),i.d(I,{HardwaresModule:()=>T});var h=i(12057),u=i(84525),c=i(24751),U=i(27745),S=i(22691),Z=i(4207),p=i(43771),m=i(13928),C=i(50103),y=i(27965),_=i(96516),J=i(83473),A=i(33013),e=i(60793);let V=(()=>{class t{constructor(){this.statusTypes={ACTIVE:{text:"Ativo",class:"bg-success text-white"},INACTIVE:{text:"Inativo",class:"bg-danger text-white"},MAINTENANCE:{text:"Manuten\xe7\xe3o",class:"bg-warning text-dark"}}}onDeleteHardware(a){console.log("Hardware para deletar:",a)}onChangeStatus(a,o){console.log(`Mudar status do hardware ${a} para ${o}`)}}return t.\u0275fac=function(a){return new(a||t)},t.\u0275cmp=e.Xpm({type:t,selectors:[["app-hardwares"]],decls:1,vars:0,template:function(a,o){1&a&&e._UZ(0,"router-outlet")},directives:[u.lC],styles:[""]}),t})();var $=i(91680),D=i(25864);function r(t,s){if(1&t){const a=e.EpF();e.TgZ(0,"div",7),e.TgZ(1,"span",8),e._UZ(2,"i",9),e.TgZ(3,"input",10),e.NdJ("ngModelChange",function(l){return e.CHM(a),e.oxw().searchTerm=l})("input",function(){return e.CHM(a),e.oxw().filterHardwares()}),e.qZA(),e.qZA(),e.qZA()}if(2&t){const a=e.oxw();e.xp6(3),e.Q6J("ngModel",a.searchTerm)}}function k(t,s){1&t&&(e.TgZ(0,"tr"),e.TgZ(1,"th",11),e._uU(2,"C\xf3digo"),e.qZA(),e.TgZ(3,"th",12),e._uU(4,"Nome"),e.qZA(),e.TgZ(5,"th",13),e._uU(6,"N\xfamero de s\xe9rie"),e.qZA(),e.TgZ(7,"th",14),e._uU(8,"Status"),e.qZA(),e.TgZ(9,"th",15),e._uU(10,"Ve\xedculo Vinculado"),e.qZA(),e.TgZ(11,"th",16),e._uU(12,"A\xe7\xf5es"),e.qZA(),e.qZA())}function Y(t,s){if(1&t&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&t){const a=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.hij(" ",o.getVehiclePlate(a)," ")}}function O(t,s){1&t&&(e.TgZ(0,"span",22),e._uU(1," Sem v\xednculo "),e.qZA())}const P=function(t){return["edit",t]};function Q(t,s){if(1&t){const a=e.EpF();e.TgZ(0,"tr"),e.TgZ(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.qZA(),e.TgZ(5,"td"),e._uU(6),e.qZA(),e.TgZ(7,"td"),e._UZ(8,"p-tag",17),e.qZA(),e.TgZ(9,"td"),e.YNc(10,Y,2,1,"span",18),e.YNc(11,O,2,0,"span",19),e.qZA(),e.TgZ(12,"td"),e._UZ(13,"button",20),e.TgZ(14,"button",21),e.NdJ("click",function(){const d=e.CHM(a).$implicit;return e.oxw().onDelete(d._id)}),e.qZA(),e.qZA(),e.qZA()}if(2&t){const a=s.$implicit,o=e.oxw();e.xp6(2),e.Oqu(a.code),e.xp6(2),e.Oqu(a.name),e.xp6(2),e.Oqu(a.serialNumber),e.xp6(2),e.Q6J("severity",o.getStatusSeverity(a.status))("value",o.getStatusLabel(a.status)),e.xp6(2),e.Q6J("ngIf",a.vehicleLink),e.xp6(1),e.Q6J("ngIf",!a.vehicleLink),e.xp6(2),e.Q6J("routerLink",e.VKq(8,P,a._id))}}function j(t,s){1&t&&(e.TgZ(0,"tr"),e.TgZ(1,"td",23),e._uU(2," Nenhum hardware encontrado "),e.qZA(),e.qZA())}const W=function(){return[10,25,50]},K=function(){return["code","name","type"]};let X=(()=>{class t{constructor(a,o,l,d,f,b,E){this.messageService=a,this.confirmationService=o,this.hardwareService=l,this.vehicleService=d,this.router=f,this.route=b,this.cdRef=E,this.hardwares=[],this.filteredHardwares=[],this.loading=!1,this.vehicleMap={},this.searchTerm="",this.statusTypes={ACTIVE:{text:"Ativo",severity:"success"},INACTIVE:{text:"Inativo",severity:"danger"},MAINTENANCE:{text:"Em Manuten\xe7\xe3o",severity:"warning"}}}ngOnInit(){this.loadHardwares()}
1loadHardwares(){this.loading=!0,this.hardwareService.findAll().subscribe({next:a=>{this.hardwares=a,this.filteredHardwares=[...this.hardwares],this.loadVehicleLinks(a),this.loading=!1},error:a=>{console.error("Erro ao carregar hardwares:",a),this.messageService.add({severity:"error",summary:"Erro",detail:"Falha ao carregar hardwares"}),this.loading=!1}})}filterHardwares(){if(!this.searchTerm)return void(this.filteredHardwares=[...this.hardwares]);const a=this.searchTerm.toLowerCase();this.filteredHardwares=this.hardwares.filter(o=>{var l,d,f,b;return(null===(l=o.code)||void 0===l?void 0:l.toLowerCase().includes(a))||(null===(d=o.name)||void 0===d?void 0:d.toLowerCase().includes(a))||(null===(f=o.serialNumber)||void 0===f?void 0:f.toLowerCase().includes(a))||o.vehicleLink&&"object"==typeof o.vehicleLink&&(null===(b=o.vehicleLink.plate)||void 0===b?void 0:b.toLowerCase().includes(a))})}loadVehicleLinks(a){const o=a.map(l=>l.vehicleLink).filter(l=>l&&"string"==typeof l).map(l=>l);o.length>0&&this.vehicleService.findByIds(o).subscribe({next:l=>{this.vehicleMap={},l.forEach(d=>{d&&(this.vehicleMap[d._id]=d.plate)}),this.filteredHardwares=[...this.hardwares],this.cdRef.detectChanges()},error:l=>{console.error("Erro ao carregar ve\xedculos:",l)}})}getVehiclePlate(a){return a.vehicleLink?"object"==typeof a.vehicleLink&&a.vehicleLink.plate?a.vehicleLink.plate:"string"==typeof a.vehicleLink&&this.vehicleMap[a.vehicleLink]||"Sem v\xednculo":"Sem v\xednculo"}getStatusSeverity(a){var o;return(null===(o=this.statusTypes[a])||void 0===o?void 0:o.severity)||"info"}getStatusLabel(a){var o;return(null===(o=this.statusTypes[a])||void 0===o?void 0:o.text)||a}deleteHardware(a){const o=this.hardwares.find(l=>l._id===a);!o||this.confirmationService.confirm({message:`Tem certeza que deseja excluir o hardware ${o.code}?`,header:"Confirmar Exclus\xe3o",icon:"pi pi-exclamation-triangle",accept:()=>{this.loading=!0,this.hardwareService.remove(a).subscribe({next:()=>{this.messageService.add({severity:"success",summary:"Sucesso",detail:"Hardware exclu\xeddo com sucesso!"}),this.loadHardwares()},error:l=>{var d;console.error("Erro ao excluir hardware:",l),this.messageService.add({severity:"error",summary:"Erro",detail:(null===(d=l.error)||void 0===d?void 0:d.message)||"Falha ao excluir hardware"}),this.loading=!1}})}})}onDelete(a){this.deleteHardware(a)}editHardware(a){this.router.navigate(["edit",a],{relativeTo:this.route})}newHardware(){this.router.navigate(["new"],{relativeTo:this.route})}}return t.\u0275fac=function(a){return new(a||t)(e.Y36(A.ez),e.Y36(A.YP),e.Y36($.s),e.Y36(D.f),e.Y36(u.F0),e.Y36(u.gz),e.Y36(e.sBO))},t.\u0275cmp=e.Xpm({type:t,selectors:[["app-hardwares-list"]],features:[e._Bn([A.ez,A.YP])],decls:9,vars:9,consts:[["header","Hardwares"],["pButton","","type","button","icon","fa fa-plus","label","Novo Hardware","routerLink","new",1,"p-button-rounded","float"],["styleClass","p-datatable-sm",3,"value","loading","paginator","rows","showCurrentPageReport","rowsPerPageOptions","globalFilterFields"],["pTemplate","caption"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"table-header","p-d-flex","p-justify-end","p-mb-3"],[1,"p-input-icon-left"],[1,"fa","fa-search"],["pInputText","","placeholder","Pesquisar","type","text",3,"ngModel","ngModelChange","input"],["pSortableColumn","code",2,"width","150px"],["pSortableColumn","name",2,"width","150px"],["pSortableColumn","serialNumber",2,"width","150px"],["pSortableColumn","status",2,"width","150px"],["pSortableColumn","vehicleLink",2,"width","150px"],[2,"width","150px"],[3,"severity","value"],[4,"ngIf"],["class","p-text-secondary",4,"ngIf"],["pButton","","type","button","icon","fas fa-edit",1,"p-button-rounded","p-button-text",3,"routerLink"],["pButton","","type","button","icon","fas fa-trash",1,"p-button-rounded","p-button-text","p-button-danger","ml-2",3,"click"],[1,"p-text-secondary"],["colspan","6",1,"p-text-center"]],template:function(a,o){1&a&&(e.TgZ(0,"p-card",0),e._UZ(1,"button",1),e.TgZ(2,"p-table",2),e.YNc(3,r,4,1,"ng-template",3),e.YNc(4,k,13,0,"ng-template",4),e.YNc(5,Q,15,10,"ng-template",5),e.YNc(6,j,3,0,"ng-template",6),e.qZA(),e._UZ(7,"p-toast"),e._UZ(8,"p-confirmDialog"),e.qZA()),2&a&&(e.xp6(2),e.Q6J("value",o.filteredHardwares)("loading",o.loading)("paginator",!0)("rows",10)("showCurrentPageReport",!0)("rowsPerPageOptions",e.DdM(7,W))("globalFilterFields",e.DdM(8,K)))}
1,directives:[U.Z,Z.Hq,u.rH,S.iA,A.jx,y.FN,J.Q,c.Fj,m.o,c.JJ,c.On,S.lQ,p.V,h.O5],styles:[""]}),t})();var H=i(25917),G=i(88002),ee=i(5304),R=i(93065);function te(t,s){1&t&&(e.TgZ(0,"small",20),e._uU(1,"C\xf3digo \xe9 obrigat\xf3rio"),e.qZA())}function re(t,s){1&t&&(e.TgZ(0,"small",20),e._uU(1,"Nome \xe9 obrigat\xf3rio"),e.qZA())}function se(t,s){1&t&&(e.TgZ(0,"small",20),e._uU(1," N\xfamero de s\xe9rie \xe9 obrigat\xf3rio "),e.qZA())}function v(t,s){1&t&&(e.TgZ(0,"small",20),e._uU(1," N\xfamero de s\xe9rie deve ter pelo menos 1 caractere "),e.qZA())}function N(t,s){1&t&&(e.TgZ(0,"small",20),e._uU(1,"Status \xe9 obrigat\xf3rio"),e.qZA())}function g(t,s){1&t&&(e.TgZ(0,"small",20),e._uU(1,"Empresa \xe9 obrigat\xf3ria"),e.qZA())}const M=function(t){return{"ng-invalid":t}},ae=function(){return{width:"100%"}},oe=function(){return{width:"100%"}};let ne=(()=>{class t{constructor(a,o,l,d,f,b,E,w,L){this.fb=a,this.route=o,this.router=l,this.messageService=d,this.datePipe=f,this.cdRef=b,this.hardwareService=E,this.vehicleService=w,this.companyService=L,this.isEditMode=!1,this.isLoading=!1,this.searchingVehicle=!1,this.originalCode="",this.linkedVehicle=null,this.companySuggestions=[],this.statusOptions=[{label:"Ativo",value:"ACTIVE"},{label:"Inativo",value:"INACTIVE"},{label:"Em Manuten\xe7\xe3o",value:"MAINTENANCE"}],this.vehicleLinkOptions=[],this.form=this.fb.group({code:["",[c.kI.required],[this.validateCodeNotExists.bind(this)]],name:["",[c.kI.required]],serialNumber:["",[c.kI.required]],status:["ACTIVE",[c.kI.required]],vehicleLink:[{value:null,disabled:!1}],plateSearch:[""],company:[null,[c.kI.required]]})}ngOnInit(){this.initForm(),this.loadAvailableVehicles()}initForm(){this.isLoading=!0;const a=this.route.snapshot.params.id;a?(this.isEditMode=!0,this.loadHardware(a)):(this.isLoading=!1,this.cdRef.detectChanges())}validateCodeNotExists(a){const o=a.value;return this.isEditMode&&o===this.originalCode?(0,H.of)(null):this.hardwareService.checkCodeExists(o).pipe((0,G.U)(l=>l?{codeExists:!0}:null),(0,ee.K)(()=>(0,H.of)(null)))}loadAvailableVehicles(){this.isLoading=!0,this.vehicleService.getAllVehicles().subscribe({next:a=>{this.vehicleLinkOptions=a.map(o=>({label:o.plate+(o.modelName?" - "+o.modelName:""),value:o._id})),this.isLoading=!1,this.cdRef.detectChanges()},error:a=>{console.error("Erro ao carregar ve\xedculos:",a),this.messageService.add({severity:"error",summary:"Erro",detail:"N\xe3o foi poss\xedvel carregar a lista de ve\xedculos"}),this.isLoading=!1,this.cdRef.detectChanges()}})}loadHardware(a){this.isLoading=!0,this.hardwareService.findById(a).subscribe({next:o=>{var l;this.originalCode=o.code,this.form.patchValue({code:o.code,name:o.name,serialNumber:o.serialNumber,status:o.status,vehicleLink:(null===(l=o.vehicleLink)||void 0===l?void 0:l._id)||o.vehicleLink}),o.company&&("string"==typeof o.company?this.companyService.getById(o.company).subscribe({next:d=>{this.form.patchValue({company:d}),this.cdRef.detectChanges()},error:d=>{console.error("Erro ao carregar empresa:",d),this.cdRef.detectChanges()}}):this.form.patchValue({company:o.company})),o.vehicleLink&&this.vehicleService.findById(o.vehicleLink._id||o.vehicleLink).subscribe({next:f=>{var b;this.linkedVehicle=f,this.vehicleLinkOptions=[{label:f.plate+(f.modelName?" - "+f.modelName:""),value:f._id}],null===(b=this.form.get("vehicleLink"))||void 0===b||b.setValue(f._id),this.cdRef.detectChanges()},error:f=>{console.error("Erro ao carregar ve\xedculo vinculado:",f),this.cdRef.detectChanges()}}),this.isLoading=!1,this.cdRef.detectChanges()},error:o=>{console.error("Erro ao carregar hardware:",o),this.messageService.add({severity:"error",summary:"Erro",detail:"N\xe3o foi poss\xedvel carregar o hardware"}),this.isLoading=!1,this.cdRef.detectChanges()}})}searchVehicleByPlate(){var a;const o=null===(a=this.form.get("plateSearch"))||void 0===a?void 0:a.value;!o||(this.searchingVehicle=!0,this.vehicleService.findByPlate(o).subscribe({next:l=>{var d;l?(this.vehicleLinkOptions=[{label:`${l.plate} - ${l.modelName||""}`,value:l._id}],null===(d=this.form.get("vehicleLink"))||void 0===d||d.setValue(l._id),this.messageService.add({severity:"success",summary:"Sucesso",detail
1:"Ve\xedculo encontrado e selecionado"})):this.messageService.add({severity:"warn",summary:"Aviso",detail:"Nenhum ve\xedculo encontrado com esta placa"}),this.searchingVehicle=!1,this.cdRef.detectChanges()},error:l=>{var d;console.error("Erro ao buscar ve\xedculo:",l),this.messageService.add({severity:"error",summary:"Erro",detail:(null===(d=l.error)||void 0===d?void 0:d.message)||"Falha ao buscar ve\xedculo"}),this.searchingVehicle=!1,this.cdRef.detectChanges()}}))}searchCompany(a){this.companyService.getByName(a.query).subscribe({next:l=>{this.companySuggestions=l,this.cdRef.detectChanges()},error:l=>{console.error("Erro ao buscar empresas:",l),this.messageService.add({severity:"error",summary:"Erro",detail:"Erro ao buscar empresas"})}})}onSubmit(){if(this.form.valid){this.isLoading=!0;const a=this.form.value,o=Object.assign(Object.assign({},a),{vehicleLink:a.vehicleLink||null,company:a.company._id||a.company});this.isEditMode&&(o._id=this.route.snapshot.params.id),(this.isEditMode?this.hardwareService.update(o):this.hardwareService.create(o)).subscribe({next:()=>{this.messageService.add({severity:"success",summary:"Sucesso",detail:`Hardware ${this.isEditMode?"atualizado":"cadastrado"} com sucesso`}),this.router.navigate(["/separa/hardwares"])},error:d=>{var f;console.error("Erro ao salvar hardware:",d),this.messageService.add({severity:"error",summary:"Erro",detail:(null===(f=d.error)||void 0===f?void 0:f.message)||`N\xe3o foi poss\xedvel ${this.isEditMode?"atualizar":"cadastrar"} o hardware`}),this.isLoading=!1,this.cdRef.detectChanges()}})}else this.markAllAsTouched(),this.messageService.add({severity:"warn",summary:"Aten\xe7\xe3o",detail:"Por favor, preencha todos os campos obrigat\xf3rios"})}onCancel(){this.isLoading||this.router.navigate(["/separa/hardwares"])}markAllAsTouched(){Object.keys(this.form.controls).forEach(a=>{const o=this.form.get(a);null==o||o.markAsTouched({onlySelf:!0})})}formatDate(a){return a&&this.datePipe.transform(a,"yyyy-MM-dd")||""}}return t.\u0275fac=function(a){return new(a||t)(e.Y36(c.qu),e.Y36(u.gz),e.Y36(u.F0),e.Y36(A.ez),e.Y36(h.uU),e.Y36(e.sBO),e.Y36($.s),e.Y36(D.f),e.Y36(R.J))},t.\u0275cmp=e.Xpm({type:t,selectors:[["app-hardware-form"]],features:[e._Bn([h.uU,A.ez])],decls:37,vars:44,consts:[[3,"header"],[3,"formGroup","ngSubmit"],[1,"p-fluid","grid"],[1,"field","col-12","md:col-6"],["for","code"],["id","code","type","text","pInputText","","formControlName","code","placeholder","C\xf3digo do hardware",3,"ngClass"],["class","p-error",4,"ngIf"],["for","name"],["id","name","type","text","pInputText","","formControlName","name","placeholder","Nome do hardware",3,"ngClass"],["for","serialNumber"],["id","serialNumber","type","text","pInputText","","formControlName","serialNumber",3,"ngClass"],["for","vehicleLink"],["formControlName","vehicleLink","filterBy","label","appendTo","body","optionLabel","label","optionValue","value",3,"options","placeholder","showClear","filter"],["for","status"],["id","status","formControlName","status","optionLabel","label","optionValue","value","placeholder","Selecione o status",3,"options","showClear","ngClass"],["for","company"],["
1id","company","formControlName","company","field","name","placeholder","Selecione uma empresa",3,"suggestions","forceSelection","dropdown","ngClass","completeMethod"],[1,"flex","justify-content-end","gap-2","mt-6",2,"margin-top","2rem"],["pButton","","type","button","label","Cancelar","icon","pi pi-times",1,"p-button-text",3,"disabled","click"],["pButton","","type","submit","label","Salvar","icon","pi pi-check",3,"loading","disabled"],[1,"p-error"]],template:function(a,o){if(1&a&&(e.TgZ(0,"p-card",0),e.TgZ(1,"form",1),e.NdJ("ngSubmit",function(){return o.onSubmit()}),e.TgZ(2,"div",2),e.TgZ(3,"div",3),e.TgZ(4,"label",4),e._uU(5,"C\xf3digo"),e.qZA(),e._UZ(6,"input",5),e.YNc(7,te,2,0,"small",6),e.qZA(),e.TgZ(8,"div",3),e.TgZ(9,"label",7),e._uU(10,"Nome"),e.qZA(),e._UZ(11,"input",8),e.YNc(12,re,2,0,"small",6),e.qZA(),e.TgZ(13,"div",3),e.TgZ(14,"label",9),e._uU(15,"N\xfamero de S\xe9rie"),e.qZA(),e._UZ(16,"input",10),e.YNc(17,se,2,0,"small",6),e.YNc(18,v,2,0,"small",6),e.qZA(),e.TgZ(19,"div",3),e.TgZ(20,"label",11),e._uU(21,"Ve\xedculo Vinculado"),e.qZA(),e._UZ(22,"p-dropdown",12),e.qZA(),e.TgZ(23,"div",3),e.TgZ(24,"label",13),e._uU(25,"Status"),e.qZA(),e._UZ(26,"p-dropdown",14),e.YNc(27,N,2,0,"small",6),e.qZA(),e.TgZ(28,"div",3),e.TgZ(29,"label",15),e._uU(30,"Empresa"),e.qZA(),e.TgZ(31,"p-autoComplete",16),e.NdJ("completeMethod",function(d){return o.searchCompany(d)}),e.qZA(),e.YNc(32,g,2,0,"small",6),e.qZA(),e.qZA(),e.TgZ(33,"div",17),e.TgZ(34,"button",18),e.NdJ("click",function(){return o.onCancel()}),e.qZA(),e._UZ(35,"button",19),e.qZA(),e.qZA(),e.qZA(),e._UZ(36,"p-toast")),2&a){let l,d,f,b,E,w,L,x,F,B,q;e.Q6J("header",o.isEditMode?"Editar Hardware":"Novo Hardware"),e.xp6(1),e.Q6J("formGroup",o.form),e.xp6(5),e.Q6J("ngClass",e.VKq(31,M,(null==(l=o.form.get("code"))?null:l.invalid)&&(null==(l=o.form.get("code"))?null:l.touched))),e.xp6(1),e.Q6J("ngIf",(null==(d=o.form.get("code"))||null==d.errors?null:d.errors.required)&&(null==(d=o.form.get("code"))?null:d.touched)),e.xp6(4),e.Q6J("ngClass",e.VKq(33,M,(null==(f=o.form.get("name"))?null:f.invalid)&&(null==(f=o.form.get("name"))?null:f.touched))
1),e.xp6(1),e.Q6J("ngIf",(null==(b=o.form.get("name"))||null==b.errors?null:b.errors.required)&&(null==(b=o.form.get("name"))?null:b.touched)),e.xp6(4),e.Q6J("ngClass",e.VKq(35,M,(null==(E=o.form.get("serialNumber"))?null:E.invalid)&&(null==(E=o.form.get("serialNumber"))?null:E.touched))),e.xp6(1),e.Q6J("ngIf",(null==(w=o.form.get("serialNumber"))||null==w.errors?null:w.errors.required)&&(null==(w=o.form.get("serialNumber"))?null:w.touched)),e.xp6(1),e.Q6J("ngIf",(null==(L=o.form.get("serialNumber"))||null==L.errors?null:L.errors.minlength)&&(null==(L=o.form.get("serialNumber"))?null:L.touched)),e.xp6(4),e.Akn(e.DdM(37,ae)),e.Q6J("options",o.vehicleLinkOptions)("placeholder",o.linkedVehicle?o.linkedVehicle.plate+(o.linkedVehicle.modelName?" - "+o.linkedVehicle.modelName:""):"Selecione um ve\xedculo")("showClear",!0)("filter",!0),e.xp6(4),e.Akn(e.DdM(38,oe)),e.Q6J("options",o.statusOptions)("showClear",!0)("ngClass",e.VKq(39,M,(null==(x=o.form.get("status"))?null:x.invalid)&&(null==(x=o.form.get("status"))?null:x.touched))),e.xp6(1),e.Q6J("ngIf",(null==(F=o.form.get("status"))||null==F.errors?null:F.errors.required)&&(null==(F=o.form.get("status"))?null:F.touched)),e.xp6(4),e.Akn(e.DdM(41,oe)),e.Q6J("suggestions",o.companySuggestions)("forceSelection",!0)("dropdown",!0)("ngClass",e.VKq(42,M,(null==(B=o.form.get("company"))?null:B.invalid)&&(null==(B=o.form.get("company"))?null:B.touched))),e.xp6(1),e.Q6J("ngIf",(null==(q=o.form.get("company"))||null==q.errors?null:q.errors.required)&&(null==(q=o.form.get("company"))?null:q.touched)),e.xp6(2),e.Q6J("disabled",o.isLoading),e.xp6(1),e.Q6J("loading",o.isLoading)("disabled",o.isLoading)}},directives:[U.Z,c._Y,c.JL,c.sg,c.Fj,m.o,c.JJ,c.u,h.mk,h.O5,C.Lt,_.Qc,Z.Hq,y.FN],encapsulation:2,changeDetection:0}),t})();const ie=[{path:"",component:V,children:[{path:"",component:X},{path:"new",component:ne},{path:"edit/:id",component:ne}]}];let n=(()=>{class t{}return t.\u0275fac=function(a){return new(a||t)},t.\u0275mod=e.oAB({type:t}),t.\u0275inj=e.cJS({imports:[[u.Bz.forChild(ie)],u.Bz]}),t})(),T=(()=>{class t{}return t.\u0275fac=function(a){return new(a||t)},t.\u0275mod=e.oAB({type:t}),t.\u0275inj=e.cJS({providers:[A.ez],imports:[[h.ez,u.Bz,c.u5,c.UX,n,U.d,S.U$,Z.hJ,p.W,m.j,C.kW,y.EV,_.WN,J.D]]}),t})()},76835:(z,I,i)=>{i.r(I),i.d(I,{SeparaModule:()=>se});var h=i(12057),u=i(84525),c=i(60793);const S=[{path:"",component:(()=>{class v{}return v.\u0275fac=function(g){return new(g||v)},v.\u0275cmp=c.Xpm({type:v,selectors:[["app-separa"]],decls:1,vars:0,template:function(g,M){1&g&&c._UZ(0,"router-outlet")},directives:[u.lC],encapsulation:2}),v})(),children:[{path:"vehicles",loadChildren:()=>Promise.resolve().then(i.bind(i,31185)).then(v=>v.VehiclesModule)},{path:"tags",loadChildren:()=>Promise.resolve().then(i.bind(i,35709)).then(v=>v.TagsModule)},{path:"hardwares",loadChildren:()=>Promise.resolve().then(i.bind(i,41576)).then(v=>v.HardwaresModule)},{path:"reports",loadChildren:()=>i.e(209).then(i.bind(i,20209)).then(v=>v.ReportsModule)},{path:"",redirectTo:"tags",pathMatch:"full"}]}];let Z=(()=>{class v{}return v.\u0275fac=function(g){return new(g||v)},v.\u0275mod=c.oAB({type:v}),v.\u0275inj=c.cJS({imports:[[u.Bz.forChild(S)],u.Bz]}),v})();var p=i(24751),m=i(58497),C=i(4207),y=i(27745),_=i(13928),J=i(46543),A=i(50103),e=i(88598),V=i(12332),$=i(27965),D=i(22691),r=i(43771),k=i(47921),Y=i(83473),O=i(99287),P=i(60079),Q=i(33013);const j=[C.hJ,y.d,_.j,J.A,A.kW,e._8,V.nD,$.EV,D.U$,r.W,k.V,Y.D,O.z,P.l];let W=(()=>{class v{}return v.\u0275fac=function(g){return new(g||v)},v.\u0275mod=c.oAB({type:v}),v.\u0275inj=c.cJS({providers:[Q.ez,Q.YP],imports:[[h.ez,u.Bz,p.u5,p.UX,m.JF,...j],h.ez,u.Bz,p.u5,p.UX,m.JF,C.hJ,y.d,_.j,J.A,A.kW,e._8,V.nD,$.EV,D.U$,r.W,k.V,Y.D,O.z,P.l]}),v})();var K=i(35709),X=i(41576),H=i(31185),G=i(91680),ee=i(25864),R=i(92340);let te=(()=>{class v{constructor(g){this.http=g,this.baseUrl=`${R.N.server}/separa/tag`}findAll(){return this.http.get(this.baseUrl)}findById(g){return this.http.get(`${this.baseUrl}/${g}`)}findByCode(g){return this.http.get(`${this.baseUrl}/code/${g}`)}save(g){return g._id?this.http.put(`${this.baseUrl}/${g._id}`,g):this.http.post(this.baseUrl,g)}remove(g){return this.http.delete(`${this.baseUrl}/${g}`)}updateStatus(g,M){return this.http.patch(`${this.baseUrl}/${g}/status`,{status:M})}assignToVehicle(g,M){return this.http.patch(`${this.baseUrl}/${g}/assign`,{vehicleId:M})}findAvailable(){return this.http.get(`${this.baseUrl}/available`)}}return v.\u0275fac=function(g){return new(g||v)(c.LFG(m.eN))},v.\u0275prov=c.Yz7({token:v,factory:v.\u0275fac,providedIn:"root"}),v})(),re=(()=>{class v{constructor(g){this.http=g,this.baseUrl=`${R.N.server}/separa/report`}findAll(){return this.http.get(this.baseUrl)}findById(g){return this.http.get(`${this.baseUrl}/${g}`)}generate(g){return this.http.post(`${this.baseUrl}/generate`,g)}save(g){return g._id?this.http.put(`${this.baseUrl}/${g._id}`,g):this.http.post(this.baseUrl,g)}remove(g){return this.http.delete(`${this.baseUrl}/${g}`)}findByDateRange(g,M){return this.http.get(`${this.baseUrl}/range`,{params:{start:g.toISOString(),end:M.toISOString()}})}downloadReport(g){return this.http.get(`${this.baseUrl}/${g}/download`,{responseType:"blob"})}}return v.\u0275fac=function(g){return new(g||v)(c.LFG(m.eN))},v.\u0275prov=c.Yz7({token:v,factory:v.\u0275fac,providedIn:"root"}),v})(),se=(()=>{class v{}return v.\u0275fac=function(g){return new(g||v)},v.\u0275mod=c.oAB({type:v}),v.\u0275inj=c.cJS({providers:[G.s,ee.f,te,re],imports:[[W,Z,h.ez,K.TagsModule,X.HardwaresModule,H.VehiclesModule,u.Bz]]}),v})()},91680:(z,I,i)=>{i.d(I,{s:()=>U});var h=i(58497),u=i(92340),c=i(60793);let U=(()=>{class S{constructor(p){this.http=p,this.baseUrl=`${u.N.server}/separa/hardware`,this.headers=new h.WM({Authorization:localStorage.getItem("token")||"","x-company-id":localStorage.getItem("customer")||""})}checkCodeExists(p){return this.http.get(`${this.baseUrl}/check-code/${p}`,{headers:this.getHeaders()})}update(p){return this.http.put(`${this.baseUrl}/${p._id}`,p,{headers:this.getHeaders()})}create(p){return this.http.post(this.baseUrl,p,{headers:this.getHeaders()})}getHeaders(){return new h.WM({Authorization:localStorage.getItem("token")||"","x-company-id":localStorage.getItem("customer")||""})}findAll(){return this.http.get(this.baseUrl,{headers:this.getHeaders()})}findById(p){return this.http.get(`${this.baseUrl}/${p}`,{headers:this.getHeaders()})}findByIdWithVehicle(p){return this.http.get(`${this.baseUrl}/${p}/with-vehicle`,{headers:this.getHeaders()})}findAllWithVehicles(){return this.http.get(`${this.baseUrl}/with-vehicles`,{headers:this.getHeaders()})}findByCode(p){const m=localStorage.getItem("token"),C=new h.WM({Authorization:m});return this.http.get(`${this.baseUrl}/code/${p}`,{headers:C})}save(p){return p._id?this.http.put(`${this.baseUrl}/${p._id}`,p,{headers:this.getHeaders()}):this.http.post(this.baseUrl,p,{headers:this.getHeaders()})}remove(p){return this.http.delete(`${this.baseUrl}/${p}`,{headers:this.getHeaders()})}updateStatus(p,m){return this.http.patch(`${this.baseUrl}/${p}/status`,{status:m},{headers:this.getHeaders()})}hasVehicleLink(p){return this.http.get(`${this.baseUrl}/${p}/has-vehicle-link`,{headers:this.getHeaders()})}removeById(p){return this.http.delete(`${this.baseUrl}/${p}`,{headers:this.getHeaders()})}delete(p){return this.http.delete(`${this.baseUrl}/${p}`)}}return S.\u0275fac=function(p){return new(p||S)(c.LFG(h.eN))},S.\u0275prov=c.Yz7({token:S,factory:S.\u0275fac,providedIn:"root"}),S})()},25864:(z,I,i)=>{i.d(I,{f:()=>S});var h=i(58497),u=i(92340),c=i(22188),U=i(60793);let S=(()=>{class Z{constructor(m,C){this.http=m,this.selectedCompanyService=C,this.baseUrl=`${u.N.server}/separa/vehicle`}getHeaders(){const m=localStorage.getItem("token"),C=this.selectedCompanyService.getSelectedCompany();return new h.WM({Authorization:m||"","selected-company":C||""})}getAllVehicles(){return this.http.get(this.baseUrl,{headers:this.getHeaders()})}findByPlate(m){return this.http.get(`${this.baseUrl}/plate/${m}`,{headers:this.getHeaders()})}findAll(){return this.http.get(this.baseUrl,{headers:this.getHeaders()})}findById(m){return this.http.get(`${this.baseUrl}/${m}`,{headers:this.getHeaders()})}findByIds(m){return this.http.post(`${this.baseUrl}/batch`,{ids:m},{headers:this.getHeaders()})}save(m){return m._id?this.http.put(`${this.baseUrl}/${m._id}`,m,{headers:this.getHeaders()}):this.http.post(this.baseUrl,m,{headers:this.getHeaders()})}remove(m){return this.http.delete(`${this.baseUrl}/${m}`,{headers:this.getHeaders()})}updateStatus(m,C){return this.http.patch(`${this.baseUrl}/${m}/status`,{status:C},{headers:this.getHeaders()})}assignDriver(m,C){return this.http.patch(`${this.baseUrl}/${m}/driver`,{driverId:C},{headers:this.getHeaders()})}findAvailable(){return this.http.get(`${this.baseUrl}/available`,{headers:this.getHeaders()})}}
1return Z.\u0275fac=function(m){return new(m||Z)(U.LFG(h.eN),U.LFG(c.w))},Z.\u0275prov=U.Yz7({token:Z,factory:Z.\u0275fac,providedIn:"root"}),Z})()},35709:(z,I,i)=>{i.r(I),i.d(I,{TagsModule:()=>ie});var h=i(12057),u=i(24751),c=i(84525),U=i(58497),S=i(27745),Z=i(22691),p=i(4207),m=i(13928),C=i(50103),y=i(25301),_=i(27965),J=i(83473),A=i(88598),e=i(96516),V=i(33013),$=i(43771),D=i(92340),r=i(60793);let k=(()=>{class n{constructor(t){this.http=t,this.apiUrl=`${D.N.server}/separa/tag`}getHeaders(){return new U.WM({Authorization:localStorage.getItem("token")||"","x-company-id":localStorage.getItem("customer")||""})}getUsersPaginated(t=0,s=10,a){let o=`${this.apiUrl}/users?page=${t}&limit=${s}`;return a&&(o+=`&search=${a}`),this.http.get(o,{headers:this.getHeaders()})}findAll(){return this.http.get(this.apiUrl,{headers:this.getHeaders()})}findById(t){return this.http.get(`${this.apiUrl}/${t}`,{headers:this.getHeaders()})}create(t){return t._id&&"object"==typeof t._id&&(t._id=t._id.value||t._id._id),this.http.post(this.apiUrl,t,{headers:this.getHeaders()})}update(t,s){return t&&"object"==typeof t&&(t=t.value||t._id),s._id&&"object"==typeof s._id&&(s._id=s._id.value||s._id._id),s.company&&"object"==typeof s.company&&(s.company=s.company.value||s.company._id),this.http.put(`${this.apiUrl}/${t}`,s,{headers:this.getHeaders()})}delete(t){return t&&"object"==typeof t&&(t=t.value||t._id),this.http.delete(`${this.apiUrl}/${t}`,{headers:this.getHeaders()})}updateStatus(t,s){return t&&"object"==typeof t&&(t=t.value||t._id),this.http.put(`${this.apiUrl}/${t}/status`,{status:s},{headers:this.getHeaders()})}assignToVehicle(t,s){return t&&"object"==typeof t&&(t=t.value||t._id),this.http.put(`${this.apiUrl}/${t}/assign`,{vehicleId:s},{headers:this.getHeaders()})}findAvailable(){return this.http.get(`${this.apiUrl}/available`,{headers:this.getHeaders()})}getCompaniesPaginated(t=0,s=10,a){let o=`${this.apiUrl}/companies?page=${t}&limit=${s}`;return a&&(o+=`&search=${a}`),this.http.get(o,{headers:this.getHeaders()})}}return n.\u0275fac=function(t){return new(t||n)(r.LFG(U.eN))},n.\u0275prov=r.Yz7({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();function Y(n,T){if(1&n){const t=r.EpF();r.TgZ(0,"div",7),r.TgZ(1,"span",8),r._UZ(2,"i",9),r.TgZ(3,"input",10),r.NdJ("ngModelChange",function(a){return r.CHM(t),r.oxw().searchTerm=a})("input",function(){return r.CHM(t),r.oxw().filterTags()}),r.qZA(),r.qZA(),r.qZA()}if(2&n){const t=r.oxw();r.xp6(3),r.Q6J("ngModel",t.searchTerm)}}function O(n,T){1&n&&(r.TgZ(0,"tr"),r.TgZ(1,"th",11),r._uU(2,"C\xf3digo"),r.qZA(),r.TgZ(3,"th",12),r._uU(4,"N\xfamero de S\xe9rie"),r.qZA(),r.TgZ(5,"th",13),r._uU(6,"Status"),r.qZA(),r.TgZ(7,"th",14),r._uU(8,"V\xednculo"),r.qZA(),r.TgZ(9,"th",15),r._uU(10,"A\xe7\xf5es"),r.qZA(),r.qZA())}function P(n,T){if(1&n&&(r.TgZ(0,"span"),r._uU(1),r.qZA()),2&n){const t=r.oxw().$implicit;r.xp6(1),r.hij(" ",t.assignedTo.name," ")}}function Q(n,T){1&n&&(r.TgZ(0,"span",22),r._uU(1," Sem v\xednculo "),r.qZA())}const j=function(n){return["edit",n]};function W(n,T){if(1&n){const t=r.EpF();r.TgZ(0,"tr"),r.TgZ(1,"td",16),r._uU(2),r.qZA(),r.TgZ(3,"td",16),r._uU(4),r.qZA(),r.TgZ(5,"td"),r._UZ(6,"p-tag",17),r.qZA(),r.TgZ(7,"td"),r.YNc(8,P,2,1,"span",18),r.YNc(9,Q,2,0,"span",19),r.qZA(),r.TgZ(10,"td"),r._UZ(11,"button",20),r.TgZ(12,"button",21),r.NdJ("click",function(){const o=r.CHM(t).$implicit;return r.oxw().onDelete(o._id)}),r.qZA(),r.qZA(),r.qZA()}if(2&n){const t=T.$implicit,s=r.oxw();r.xp6(2),r.hij(" ",t.code," "),r.xp6(2),r.hij(" ",t.serialNumber," "),r.xp6(2),r.Q6J("severity",s.getStatusSeverity(t.status))("value",s.getStatusText(t.status)),r.x
1p6(2),r.Q6J("ngIf",t.assignedTo),r.xp6(1),r.Q6J("ngIf",!t.assignedTo),r.xp6(2),r.Q6J("routerLink",r.VKq(7,j,t._id))}}function K(n,T){1&n&&(r.TgZ(0,"tr"),r.TgZ(1,"td",23),r._uU(2," Nenhuma tag encontrada "),r.qZA(),r.qZA())}let X=(()=>{class n{constructor(t,s,a,o,l,d){this.messageService=t,this.confirmationService=s,this.tagsService=a,this.router=o,this.route=l,this.cdRef=d,this.tags=[],this.filteredTags=[],this.loading=!1,this.searchTerm="",this.isLoading=!1,this.statusTypes={ACTIVE:{text:"Ativo",severity:"success"},INACTIVE:{text:"Inativo",severity:"danger"}}}ngOnInit(){this.loadTags()}loadTags(){this.isLoading=!0,this.tagsService.findAll().subscribe({next:t=>{this.tags=t,this.filteredTags=[...this.tags],this.isLoading=!1,this.cdRef.detectChanges()},error:t=>{this.messageService.add({severity:"error",summary:"Erro",detail:"Falha ao carregar tags"}),this.isLoading=!1,this.cdRef.detectChanges()}})}filterTags(){if(!this.searchTerm)return void(this.filteredTags=[...this.tags]);const t=this.searchTerm.toLowerCase();this.filteredTags=this.tags.filter(s=>{var a,o,l;return(null===(a=s.code)||void 0===a?void 0:a.toLowerCase().includes(t))||(null===(o=s.serialNumber)||void 0===o?void 0:o.toLowerCase().includes(t))||s.assignedTo&&(null===(l=s.assignedTo.name)||void 0===l?void 0:l.toLowerCase().includes(t))})}getStatusSeverity(t){var s;return(null===(s=this.statusTypes[t])||void 0===s?void 0:s.severity)||"info"}getStatusText(t){var s;return(null===(s=this.statusTypes[t])||void 0===s?void 0:s.text)||t}onDelete(t){const s=this.tags.find(a=>a._id===t);if(s){if(s.assignedTo)return void this.messageService.add({severity:"warn",summary:"Aviso",detail:"N\xe3o \xe9 poss\xedvel excluir uma tag que possui v\xednculo com um usu\xe1rio. Por favor, remova o v\xednculo primeiro."});this.confirmationService.confirm({message:`Tem certeza que deseja excluir a tag ${s.code}?`,header:"Confirmar Exclus\xe3o",icon:"pi pi-exclamation-triangle",accept:()=>{this.loading=!0,this.tagsService.delete(t).subscribe({next:()=>{this.tags=this.tags.filter(a=>a._id!==t),this.filteredTags=this.filteredTags.filter(a=>a._id!==t),this.messageService.add({severity:"success",summary:"Sucesso",detail:"Tag exclu\xedda com sucesso!"}),this.loading=!1,this.cdRef.detectChanges()},error:a=>{var o;console.error("Erro ao excluir tag:",a),this.messageService.add({severity:"error",summary:"Erro",detail:(null===(o=a.error)||void 0===o?void 0:o.message)||"Erro ao excluir tag"}),this.loading=!1,this.cdRef.detectChanges()}})}})}}getLinkLabel(t){return t||"Nenhum"}editTag(t){this.router.navigate(["edit",t],{relativeTo:this.route})}newTag(){this.router.navigate(["new"],{relativeTo:this.route})}}return n.\u0275fac=function(t){return new(t||n)(r.Y36(V.ez),r.Y36(V.YP),r.Y36(k),r.Y36(c.F0),r.Y36(c.gz),r.Y36(r.sBO))},n.\u0275cmp=r.Xpm({type:n,selectors:[["app-tags-list"]],features:[r._Bn([V.ez,V.YP])],decls:9,vars:4,consts:[["header","Tags"],["pButton","","type","button","icon","fa fa-plus","label","Nova Tag","routerLink","new",1,"p-button-rounded","float"],["styleClass","p-datatable-sm",3,"value","loading","paginator","rows"],["pTemplate","caption"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"table-header","p-d-flex","p-justify-end","p-mb-3"],[1,"p-input-icon-left"],[1,"fa","fa-search"],["pInputText","","placeholder","Pesquisar","type","text",3,"ngModel","ngModelChange","input"],["pSortableColumn","code"],["pSortableColumn","serialNumber"],["pSortableColumn","status",2,"white-space","nowrap"],["pSortableColumn","assignedTo",2,"white-space","nowrap"],[2,"white-space","nowrap"],[2,"word-break","break-word","white-space","normal","max-width","1px"],[3,"severity","value"],[4,"ngIf"],["class","p-text-secondary",4,"ngIf"],["pButton","","type","button","icon","fas fa-edit",1,"p-button-rounded","p-button-text",3,"routerLink"],["pButton","","type","button","icon","fas fa-trash",1,"p-button-rounded","p-button-text","p-button-danger","ml-2",3,"click"],[1,"p-text-secondary"],["colspan","5",1,"p-text-center"]],template:function(t,s){1&t&&(r.TgZ(0,"p-card",0),r._UZ(1,"button",1),r.TgZ(2,"p-table",2),r.YNc(3,Y,4,1,"ng-template",3),r.YNc(4,O,11,0,"ng-template",4),r.YNc(5,W,13,9,"ng-template",5),r.YNc(6,K,3,0,"ng-template",6),r.qZA(),r.qZA(),r._UZ(7,"p-toast"),r._UZ(8,"p-confirmDialog")),2&t&&(r.xp6(2),r.Q6J("value",s.filteredTags)("loading",s.loading)("paginator",!0)("rows",10))},directives:[S.Z,p.Hq,c.rH,Z.iA,V.jx,_.FN,J.Q,u.Fj,m.o,u.JJ,u.On,Z.lQ,$.V,h.O5],encapsulation:2}),n})();var H=i(36021),G=i(93065);function ee(n,T){1&n&&(r.TgZ(0,"small",20),r._uU(1," C\xf3digo da tag \xe9 obrigat\xf3rio "),r.qZA())}function R(n,T){1&n&&(r.TgZ(0,"small",20),r._uU(1," N\xfamero de s\xe9rie \xe9 obrigat\xf3rio "),r.qZA())}function te(n,T){1&n&&(r.TgZ(0,"small",20),r._uU(1," N\xfamero de s\xe9rie deve ter pelo menos 1 caractere "),r.qZA())}function re(n,T){1&n&&(r.TgZ(0,"small",20),r._uU(1," Usu\xe1rio \xe9 obrigat\xf3rio "),r.qZA())}function se(n,T){1&n&&(r.TgZ(0,"small",20),r._uU(1,"Empresa \xe9 obrigat\xf3ria"),r.qZA())}function v(n,T){1&n&&(r.TgZ(0,"small",20),r._uU(1," Status \xe9 obrigat\xf3rio "),r.qZA())}function N(n,T){1&n&&(r.TgZ(0,"small",20),r._uU(1," Data de cria\xe7\xe3o \xe9 obrigat\xf3ria "),r.qZA())}const g=function(n){return{"ng-invalid":n}},M=function(){return{width:"100%"}};let ae=(()=>{class n{constructor(t,s,a,o,l,d,f,b,E){this.fb=t,this.route=s,this.router=a,this.messageService=o,this.datePipe=l,this.cdRef=
1d,this.tagsService=f,this.userService=b,this.companyService=E,this.isEditMode=!1,this.isLoading=!1,this.currentDate=new Date,this.linkOptions=[],this.companyOptions=[],this.companySuggestions=[],this.userSuggestions=[],this.selectedUser=null,this.selectedCompany=null,this.statusOptions=[{label:"Ativo",value:"ACTIVE"},{label:"Inativo",value:"INACTIVE"}],this.form=this.fb.group({_id:[null],tagCode:["",[u.kI.required]],serialNumber:["",[u.kI.required,u.kI.minLength(1)]],createdAt:[null,u.kI.required],link:[null],company:[null,u.kI.required],status:["ACTIVE",u.kI.required]})}ngOnInit(){console.log("Iniciando componente de formul\xe1rio de tags"),this.initForm()}searchUsers(t){if(!t.query)return this.userSuggestions=[],void this.cdRef.detectChanges();this.isLoading=!0,this.tagsService.getUsersPaginated(0,10,t.query).subscribe({next:s=>{this.userSuggestions=s.docs.map(a=>({label:a.name,value:a._id,name:a.name,document:a.mainDocument,email:a.email})),this.isLoading=!1,this.cdRef.detectChanges()},error:s=>{var a;console.error("Erro ao buscar usu\xe1rios:",s),this.messageService.add({severity:"error",summary:"Erro",detail:(null===(a=s.error)||void 0===a?void 0:a.message)||"Falha ao buscar usu\xe1rios"}),this.userSuggestions=[],this.isLoading=!1,this.cdRef.detectChanges()}})}searchCompany(t){if(!t.query)return this.companySuggestions=[],void this.cdRef.detectChanges();this.isLoading=!0,this.companyService.getByName(t.query).subscribe({next:s=>{this.companySuggestions=s.map(a=>{var o,l,d;return{label:a.name,value:a._id,name:a.name,document:a.mainDocument,city:null===(o=a.city)||void 0===o?void 0:o.name,state:null===(d=null===(l=a.city)||void 0===l?void 0:l.state)||void 0===d?void 0:d.initials}}),this.isLoading=!1,this.cdRef.detectChanges()},error:s=>{var a;console.error("Erro ao buscar empresas:",s),this.messageService.add({severity:"error",summary:"Erro",detail:(null===(a=s.error)||void 0===a?void 0:a.message)||"Falha ao buscar empresas"}),this.companySuggestions=[],this.isLoading=!1,this.cdRef.detectChanges()}})}initForm(){console.log("Inicializando formul\xe1rio"),this.isLoading=!0;const t=this.route.snapshot.params.id;console.log("ID da tag:",t),t?(this.isEditMode=!0,this.loadTag(t)):(this.form.patchValue({createdAt:new Date}),this.isLoading=!1,this.cdRef.detectChanges())}loadTag(t){console.log("Carregando tag:",t),this.isLoading=!0,this.tagsService.findById(t).subscribe({next:s=>{var a,o;console.log("Tag encontrada:",s);const l=s.createdAt?new Date(s.createdAt):new Date;if(s.assignedTo&&(this.selectedUser={label:s.assignedTo.name,value:s.assignedTo._id}),s.company){console.log("Buscando empresa da tag:",s.company);const d=null!==(o=null===(a=s.company)||void 0===a?void 0:a._id)&&void 0!==o?o:s.company;console.log("CompanyId tratado:",d),this.companyService.getById(d).subscribe({next:f=>{var b,E,w,L,x,F;console.log("Empresa encontrada:",f),this.selectedCompany={label:f.name,value:f._id,name:f.name,document:f.mainDocument,city:null===(b=f.city)||void 0===b?void 0:b.name,state:null===(w=null===(E=f.city)||void 0===E?void 0:E.state)||void 0===w?void 0:w.initials},this.form.patchValue({_id:s._id,tagCode:s.code,serialNumber:s.serialNumber,createdAt:l,link:s.assignedTo?{label:s.assignedTo.name,value:s.assignedTo._id}:null,company:{label:f.name,value:f._id,name:f.name,document:f.mainDocument,city:null===(L=f.city)||void 0===L?void 0:L.name,state:null===(F=null===(x=f.city)||void 0===x?void 0:x.state)||void 0===F?void 0:F.initials},status:s.status}),this.isLoading=!1,this.cdRef.detectChanges()},error:f=>{console.error("Erro ao buscar empresa:",f),this.messageService.add({severity:"error",summary:"Erro",detail:"Falha ao buscar empresa"}),this.isLoading=!1,this.cdRef.detectChanges()}})}else this.form.patchValue({_id:s._id,tagCode:s.code,serialNumber:s.serialNumber,createdAt:l,link:s.assignedTo?{label:s.assignedTo.name,value:s.assignedTo._id}:null,status:s.status}),this.isLoading=!1,this.cdRef.detectChanges()},error:s=>{console.error("Erro ao carregar tag:",s),this.messageService.add({severity:"error",summary:"Erro",detail:"Falha ao carregar tag"}),this.isLoading=!1,this.cdRef.detectChanges()}})}onSubmit(){var t,s;
1if(this.form.invalid)return void this.messageService.add({severity:"error",summary:"Erro",detail:"Por favor, preencha todos os campos obrigat\xf3rios"});this.isLoading=!0;const a=this.form.value;console.log("Dados do formul\xe1rio (raw):",a),console.log("Company value:",a.company),console.log("Company type:",typeof a.company);const o={code:a.tagCode,serialNumber:a.serialNumber,status:a.status,assignedTo:(null===(t=a.link)||void 0===t?void 0:t.value)||null,company:(null===(s=a.company)||void 0===s?void 0:s.value)||null,createdAt:a.createdAt instanceof Date?a.createdAt.toISOString():new Date(a.createdAt).toISOString()};console.log("Dados da tag a ser enviada:",o),console.log("Company no tagData:",o.company),console.log("Company type no tagData:",typeof o.company),(this.isEditMode?this.tagsService.update(a._id,o):this.tagsService.create(o)).subscribe({next:()=>{this.messageService.add({severity:"success",summary:"Sucesso",detail:`Tag ${this.isEditMode?"atualizada":"criada"} com sucesso!`}),this.router.navigate(["/separa/tags"])},error:d=>{console.error("Erro ao salvar tag:",d),console.error("Detalhes do erro:",d.error),this.messageService.add({severity:"error",summary:"Erro",detail:`Falha ao ${this.isEditMode?"atualizar":"criar"} tag`}),this.isLoading=!1,this.cdRef.detectChanges()}})}onCancel(){this.router.navigate(["/separa/tags"])}}return n.\u0275fac=function(t){return new(t||n)(r.Y36(u.qu),r.Y36(c.gz),r.Y36(c.F0),r.Y36(V.ez),r.Y36(h.uU),r.Y36(r.sBO),r.Y36(k),r.Y36(H.K),r.Y36(G.J))},n.\u0275cmp=r.Xpm({type:n,selectors:[["app-tags-form"]],features:[r._Bn([V.ez,h.uU])],decls:38,vars:49,consts:[[3,"header"],[3,"formGroup","ngSubmit"],[1,"p-fluid","grid"],[1,"field","col-12","md:col-6"],["for","tagCode"],["id","tagCode","type","text","pInputText","","formControlName","tagCode","placeholder","Informe o c\xf3digo da tag",3,"ngClass"],["class","p-error",4,"ngIf"],["for","serialNumber"],["id","serialNumber","type","text","pInputText","","formControlName","serialNumber",3,"ngClass"],["for","link"],["id","link","formControlName","link","field","label","placeholder","Selecione um usu\xe1rio",3,"suggestions","forceSelection","dropdown","ngClass","completeMethod"],["for","company"],["
1id","company","formControlName","company","field","name","placeholder","Selecione uma empresa",3,"suggestions","forceSelection","dropdown","ngClass","completeMethod"],["for","status"],["id","status","formControlName","status","optionLabel","label","optionValue","value","placeholder","Selecione o status",3,"options","showClear","ngClass"],["for","createdAt"],["id","createdAt","formControlName","createdAt","dateFormat","dd/mm/yy",3,"showIcon","readonlyInput","ngClass"],[1,"flex","justify-content-end","gap-2","mt-6",2,"margin-top","2rem"],["pButton","","type","button","label","Cancelar","icon","pi pi-times",1,"p-button-text",3,"disabled","click"],["pButton","","type","submit","label","Salvar","icon","pi pi-check",3,"loading","disabled"],[1,"p-error"]],template:function(t,s){if(1&t&&(r.TgZ(0,"p-card",0),r.TgZ(1,"form",1),r.NdJ("ngSubmit",function(){return s.onSubmit()}),r.TgZ(2,"div",2),r.TgZ(3,"div",3),r.TgZ(4,"label",4),r._uU(5,"C\xf3digo da Tag"),r.qZA(),r._UZ(6,"input",5),r.YNc(7,ee,2,0,"small",6),r.qZA(),r.TgZ(8,"div",3),r.TgZ(9,"label",7),r._uU(10,"N\xfamero de S\xe9rie"),r.qZA(),r._UZ(11,"input",8),r.YNc(12,R,2,0,"small",6),r.YNc(13,te,2,0,"small",6),r.qZA(),r.TgZ(14,"div",3),r.TgZ(15,"label",9),r._uU(16,"Usu\xe1rio Vinculado"),r.qZA(),r.TgZ(17,"p-autoComplete",10),r.NdJ("completeMethod",function(o){return s.searchUsers(o)}),r.qZA(),r.YNc(18,re,2,0,"small",6),r.qZA(),r.TgZ(19,"div",3),r.TgZ(20,"label",11),r._uU(21,"Empresa"),r.qZA(),r.TgZ(22,"p-autoComplete",12),r.NdJ("completeMethod",function(o){return s.searchCompany(o)}),r.qZA(),r.YNc(23,se,2,0,"small",6),r.qZA(),r.TgZ(24,"div",3),r.TgZ(25,"label",13),r._uU(26,"Status"),r.qZA(),r._UZ(27,"p-dropdown",14),r.YNc(28,v,2,0,"small",6),r.qZA(),r.TgZ(29,"div",3),r.TgZ(30,"label",15),r._uU(31,"Data de Cria\xe7\xe3o"),r.qZA(),r._UZ(32,"p-calendar",16),r.YNc(33,N,2,0,"small",6),r.qZA(),r.qZA(),r.TgZ(34,"div",17),r.TgZ(35,"button",18),r.NdJ("click",function(){return s.onCancel()}),r.qZA(),r._UZ(36,"button",19),r.qZA(),r.qZA(),r.qZA(),r._UZ(37,"p-toast")),2&t){let a,o,l,d,f,b,E,w,L,x,F,B,q;r.Q6J("header",s.isEditMode?"Editar Tag":"Nova Tag"),r.xp6(1),r.Q6J("formGroup",s.form),r.xp6(5),r.Q6J("ngClass",r.VKq(34,g,(null==(a=s.form.get("tagCode"))?null:a.invalid)&&(null==(a=s.form.get("tagCode"))?null:a.touched))),r.xp6(1),r.Q6J("ngIf",(null==(o=s.form.get("tagCode"))||null==o.errors?null:o.errors.required)&&(null==(o=s.form.get("tagCode"))?null:o.touched)),r.xp6(4),r.Q6J("ngClass",r.VKq(36,g,(null==(l=s.form.get("serialNumber"))?null:l.invalid)&&(null==(l=s.form.get("serialNumber"))?null:l.touched))),r.xp6(1),r.Q6J("ngIf",(null==(d=s.form.get("serialNumber"))||null==d.errors?null:d.errors.required)&&(null==(d=s.form.get("serialNumber"))?null:d.touched)),r.xp6(1),r.Q6J("ngIf",(null==(f=s.form.get("serialNumber"))||null==f.errors?null:f.errors.minlength)&&(null==(f=s.form.get("serialNumber"))?null:f.touched)),r.xp6(4),r.Akn(r.DdM(38,M)),r.Q6J("suggestions",s.userSuggestions)("forceSelection",!0)("dropdown",!0)("ngClass",r.VKq(39,g,(null==(b=s.form.get("link"))?null:b.invalid)&&(null==(b=s.form.get("link"))?null:b.touched))
1),r.xp6(1),r.Q6J("ngIf",(null==(E=s.form.get("link"))||null==E.errors?null:E.errors.required)&&(null==(E=s.form.get("link"))?null:E.touched)),r.xp6(4),r.Akn(r.DdM(41,M)),r.Q6J("suggestions",s.companySuggestions)("forceSelection",!0)("dropdown",!0)("ngClass",r.VKq(42,g,(null==(w=s.form.get("company"))?null:w.invalid)&&(null==(w=s.form.get("company"))?null:w.touched))),r.xp6(1),r.Q6J("ngIf",(null==(L=s.form.get("company"))||null==L.errors?null:L.errors.required)&&(null==(L=s.form.get("company"))?null:L.touched)),r.xp6(4),r.Akn(r.DdM(44,M)),r.Q6J("options",s.statusOptions)("showClear",!0)("ngClass",r.VKq(45,g,(null==(x=s.form.get("status"))?null:x.invalid)&&(null==(x=s.form.get("status"))?null:x.touched))),r.xp6(1),r.Q6J("ngIf",(null==(F=s.form.get("status"))||null==F.errors?null:F.errors.required)&&(null==(F=s.form.get("status"))?null:F.touched)),r.xp6(4),r.Q6J("showIcon",!0)("readonlyInput",!0)("ngClass",r.VKq(47,g,(null==(B=s.form.get("createdAt"))?null:B.invalid)&&(null==(B=s.form.get("createdAt"))?null:B.touched))),r.xp6(1),r.Q6J("ngIf",(null==(q=s.form.get("createdAt"))?null:q.invalid)&&(null==(q=s.form.get("createdAt"))?null:q.touched)),r.xp6(2),r.Q6J("disabled",s.isLoading),r.xp6(1),r.Q6J("loading",s.isLoading)("disabled",s.isLoading)}},directives:[S.Z,u._Y,u.JL,u.sg,u.Fj,m.o,u.JJ,u.u,h.mk,h.O5,e.Qc,C.Lt,A.f,p.Hq,_.FN],encapsulation:2}),n})();const oe=[{path:"",component:X,data:{title:"Lista de Tags"}},{path:"new",component:ae,data:{title:"Nova Tag"}},{path:"edit/:id",component:ae,data:{title:"Editar Tag"}}];let ne=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=r.oAB({type:n}),n.\u0275inj=r.cJS({imports:[[c.Bz.forChild(oe)],c.Bz]}),n})(),ie=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=r.oAB({type:n}),n.\u0275inj=r.cJS({providers:[V.YP,V.ez],imports:[[h.ez,u.u5,u.UX,c.Bz,U.JF,S.d,Z.U$,p.hJ,m.j,C.kW,y.Iu,_.EV,J.D,A._8,e.WN,ne,$.W]]}),n})()},31185:(z,I,i)=>{i.r(I),i.d(I,{VehiclesModule:()=>ie});var h=i(12057),u=i(84525),c=i(24751),U=i(27745),S=i(22691),Z=i(4207),p=i(43771),m=i(13928),C=i(50103),y=i(27965),_=i(96516),J=i(83473),A=i(33013),e=i(60793);let V=(()=>{class n{constructor(){this.vehicles=[],this.statusTypes={available:{text:"Dispon\xedvel",class:"bg-success"},in_use:{text:"Em uso",class:"bg-primary"},maintenance:{text:"Manuten\xe7\xe3o",class:"bg-warning text-dark"},inactive:{text:"Inativo",class:"bg-secondary"}},this.loading=!1}deleteVehicle(t){this.vehicles=this.vehicles.filter(s=>s.id!==t)}changeStatus(t,s){const a=this.vehicles.find(o=>o.id===t);a&&(a.status=s)}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=e.Xpm({type:n,selectors:[["app-vehicles"]],decls:1,vars:0,template:function(t,s){1&t&&e._UZ(0,"router-outlet")},directives:[u.lC],encapsulation:2}),n})();var $=i(25864),D=i(91680);function r(n,T){if(1&n){const t=e.EpF();e.TgZ(0,"div",7),e.TgZ(1,"span",8),e._UZ(2,"i",9),e.TgZ(3,"input",10),e.NdJ("ngModelChange",function(a){return e.CHM(t),e.oxw().searchTerm=a})("input",function(){return e.CHM(t),e.oxw().filterVehicles()}),e.qZA(),e.qZA(),e.qZA()}if(2&n){const t=e.oxw();e.xp6(3),e.Q6J("ngModel",t.searchTerm)}}function k(n,T){1&n&&(e.TgZ(0,"tr"),e.TgZ(1,"th",11),e._uU(2,"C\xf3digo"),e.qZA(),e.TgZ(3,"th",12),e._uU(4,"Placa"),e.qZA(),e.TgZ(5,"th",13),e._uU(6,"Modelo"),e.qZA(),e.TgZ(7,"th",14),e._uU(8,"Status"),e.qZA(),e.TgZ(9,"th",15),e._uU(10,"N\xb0 Hardware Vinculado"),e.qZA(),e.TgZ(11,"th",16),e._uU(12,"A\xe7\xf5es"),e.qZA(),e.qZA())}function Y(n,T){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&n){const t=e.oxw().$implicit,s=e.oxw();e.xp6(1),e.hij(" ",s.getHardwareCode(t)," ")}}function O(n,T){1&n&&(e.TgZ(0,"span",22),e._uU(1," Sem v\xednculo "),e.qZA())}const P=function(n){return["edit",n]};function Q(n,T){if(1&n){const t=e.EpF();e.TgZ(0,"tr"),e.TgZ(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.ALo(5,"uppercase"),e.qZA(),e.TgZ(6,"td"),e._uU(7),e.qZA(),e.TgZ(8,"td"),e._UZ(9,"p-tag",17),e.qZA(),e.TgZ(10,"td"),e.YNc(11,Y,2,1,"span",18),e.YNc(12,O,2,0,"span",19),e.qZA(),e.TgZ(13,"td"),e._UZ(14,"button",20),e.TgZ(15,"button",21),e.NdJ("click",function(){const o=e.CHM(t).$implicit;return e.oxw().deleteVehicle(o._id)}),e.qZA(),e.qZA(),e.qZA()}if(2&n){const t=T.$implicit,s=e.oxw();
1e.xp6(2),e.Oqu(t.code),e.xp6(2),e.Oqu(e.lcZ(5,8,t.plate)),e.xp6(3),e.Oqu(t.modelName),e.xp6(2),e.Q6J("severity",s.getStatusSeverity(t.status))("value",s.getStatusText(t.status)),e.xp6(2),e.Q6J("ngIf",t.hardwareLink),e.xp6(1),e.Q6J("ngIf",!t.hardwareLink),e.xp6(2),e.Q6J("routerLink",e.VKq(10,P,t._id))}}function j(n,T){1&n&&(e.TgZ(0,"tr"),e.TgZ(1,"td",23),e._uU(2," Nenhum ve\xedculo encontrado "),e.qZA(),e.qZA())}let W=(()=>{class n{constructor(t,s,a,o,l,d){this.messageService=t,this.confirmationService=s,this.vehicleService=a,this.hardwareService=o,this.router=l,this.route=d,this.vehicles=[],this.filteredVehicles=[],this.loading=!1,this.hardwareMap={},this.searchTerm="",this.statusTypes={ACTIVE:{text:"Ativo",severity:"success"},INACTIVE:{text:"Inativo",severity:"danger"},MAINTENANCE:{text:"Em Manuten\xe7\xe3o",severity:"warning"}}}ngOnInit(){this.loadVehicles()}loadVehicles(){this.loading=!0,this.vehicleService.findAll().subscribe({next:t=>{this.vehicles=t,this.filteredVehicles=[...this.vehicles],this.loading=!1},error:t=>{console.error("Erro ao carregar ve\xedculos:",t),this.messageService.add({severity:"error",summary:"Erro",detail:"Falha ao carregar ve\xedculos"}),this.loading=!1}})}filterVehicles(){if(!this.searchTerm)return void(this.filteredVehicles=[...this.vehicles]);const t=this.searchTerm.toLowerCase();this.filteredVehicles=this.vehicles.filter(s=>{var a,o,l;return(null===(a=s.code)||void 0===a?void 0:a.toLowerCase().includes(t))||(null===(o=s.plate)||void 0===o?void 0:o.toLowerCase().includes(t))||s.hardwareLink&&"object"==typeof s.hardwareLink&&(null===(l=s.hardwareLink.code)||void 0===l?void 0:l.toLowerCase().includes(t))})}loadHardwareLinks(t){this.hardwareService.findAllWithVehicles().subscribe({next:s=>{this.hardwareMap={},s.forEach(a=>{a.hardwareLink&&(this.hardwareMap[a.hardwareLink._id]=a.code)})},error:s=>{console.error("Erro ao carregar hardwares:",s)}})}getHardwareCode(t){return t.hardwareLink&&"string"!=typeof t.hardwareLink&&t.hardwareLink.code||"Sem v\xednculo"}getStatusSeverity(t){var s;return(null===(s=this.statusTypes[t])||void 0===s?void 0:s.severity)||"info"}getStatusText(t){var s;return(null===(s=this.statusTypes[t])||void 0===s?void 0:s.text)||t}deleteVehicle(t){const s=this.vehicles.find(a=>a._id===t);!s||this.confirmationService.confirm({message:`Tem certeza que deseja excluir o ve\xedculo ${s.code}?`,header:"Confirmar Exclus\xe3o",icon:"pi pi-exclamation-triangle",accept:()=>{this.loading=!0,this.vehicleService.remove(t).subscribe({next:()=>{this.messageService.add({severity:"success",summary:"Sucesso",detail:"Ve\xedculo exclu\xeddo com sucesso!"}),this.loadVehicles()},error:a=>{console.error("Erro ao excluir ve\xedculo:",a),this.messageService.add({severity:"error",summary:"Erro",detail:"Falha ao excluir ve\xedculo"}),this.loading=!1}})}})}editVehicle(t){this.router.navigate(["edit",t],{relativeTo:this.route})}newVehicle(){this.router.navigate(["new"],{relativeTo:this.route})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(A.ez),e.Y36(A.YP),e.Y36($.f),e.Y36(D.s),e.Y36(u.F0),e.Y36(u.gz))},n.\u0275cmp=e.Xpm({type:n,selectors:[["app-vehicles-list"]],features:[e._Bn([A.ez,A.YP])],decls:9,vars:4,consts:[["header","Ve\xedculos"],["pButton","","type","button","icon","fa fa-plus","label","Novo Ve\xedculo","routerLink","new",1,"p-button-rounded","float"],["styleClass","p-datatable-sm",3,"value","loading","paginator","rows"],["pTemplate","caption"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"table-header","p-d-flex","p-justify-end","p-mb-3"],[1,"p-input-icon-left"],[1,"fa","fa-search"],["pInputText","","placeholder","Pesquisar","type","text",3,"ngModel","ngModelChange","input"],["pSortableColumn","code",2,"width","120px"],["pSortableColumn","plate",2,"width","120px"],["pSortableColumn","modelName",2,"width","200px"],["pSortableColumn","status",2,"width","150px"],["pSortableColumn","hardwareLink",2,"width","250px"],[2,"width","120px"],[3,"severity","value"],[4,"ngIf"],["class","p-text-secondary",4,"ngIf"],["pButton","","type","button","icon","fas fa-edit","pTooltip","Editar","tooltipPosition","top",1,"p-button-rounded","p-button-text",3,"routerLink"],["pButton","","type","button","icon","fas fa-tras
1h","pTooltip","Excluir","tooltipPosition","top",1,"p-button-rounded","p-button-text","p-button-danger","ml-2",3,"click"],[1,"p-text-secondary"],["colspan","6",1,"p-text-center"]],template:function(t,s){1&t&&(e.TgZ(0,"p-card",0),e._UZ(1,"button",1),e.TgZ(2,"p-table",2),e.YNc(3,r,4,1,"ng-template",3),e.YNc(4,k,13,0,"ng-template",4),e.YNc(5,Q,16,12,"ng-template",5),e.YNc(6,j,3,0,"ng-template",6),e.qZA(),e.qZA(),e._UZ(7,"p-toast"),e._UZ(8,"p-confirmDialog")),2&t&&(e.xp6(2),e.Q6J("value",s.filteredVehicles)("loading",s.loading)("paginator",!0)("rows",10))},directives:[U.Z,Z.Hq,u.rH,S.iA,A.jx,y.FN,J.Q,c.Fj,m.o,c.JJ,c.On,S.lQ,p.V,h.O5],pipes:[h.gd],styles:[""]}),n})();var K=i(92340),X=i(58497),H=(()=>{return(n=H||(H={})).ACTIVE="ACTIVE",n.INACTIVE="INACTIVE",n.MAINTENANCE="MAINTENANCE",H;var n})();let G=(()=>{class n{constructor(t){this.http=t,this.baseUrl=`${K.N.server}/separa/vehicle`}findAll(){return this.http.get(this.baseUrl)}findById(t){return this.http.get(`${this.baseUrl}/${t}`)}findByCode(t){return this.http.get(`${this.baseUrl}/code/${t}`)}save(t){return t._id?this.http.put(`${this.baseUrl}/${t._id}`,t):this.http.post(this.baseUrl,t)}delete(t){return this.http.delete(`${this.baseUrl}/${t}`)}updateStatus(t,s){return this.http.put(`${this.baseUrl}/${t}/status`,{status:s})}getAvailableHardwares(t){return this.http.get(`${this.baseUrl}/available-hardwares`,{params:{search:t}})}hasHardwareLink(t){return this.http.get(`${this.baseUrl}/${t}/has-hardware-link`)}}return n.\u0275fac=function(t){return new(t||n)(e.LFG(X.eN))},n.\u0275prov=e.Yz7({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();var ee=i(93065);function R(n,T){1&n&&(e.TgZ(0,"small",20),e._uU(1,"C\xf3digo \xe9 obrigat\xf3rio"),e.qZA())}function te(n,T){1&n&&(e.TgZ(0,"small",20),e._uU(1,"Placa \xe9 obrigat\xf3ria"),e.qZA())}function re(n,T){1&n&&(e.TgZ(0,"small",20),e._uU(1,"Modelo \xe9 obrigat\xf3rio"),e.qZA())}function se(n,T){1&n&&(e.TgZ(0,"small",20),e._uU(1,"Empresa \xe9 obrigat\xf3ria"),e.qZA())}function v(n,T){1&n&&(e.TgZ(0,"small",20),e._uU(1,"Status \xe9 obrigat\xf3rio"),e.qZA())}const N=function(n){return{"ng-invalid":n}},g=function(){return{"background-color":"#f5f5f5",color:"#000",cursor:"not-allowed"}},M=function(){return{width:"100%"}};let ae=(()=>{class n{constructor(t,s,a,o,l,d){this.fb=t,this.vehicleService=s,this.companyService=a,this.route=o,this.router=l,this.messageService=d,this.isEdit=!1,this.loading=!1,this.statusOptions=[{label:"Ativo",value:H.ACTIVE},{label:"Inativo",value:H.INACTIVE},{label:"Manuten\xe7\xe3o",value:H.MAINTENANCE}],this.companySuggestions=[],this.form=this.fb.group({code:["",c.kI.required],plate:["",c.kI.required],modelName:["",c.kI.required],hardwareLink:[""],status:[H.ACTIVE,c.kI.required],company:[null,c.kI.required]})}ngOnInit(){const t=this.route.snapshot.paramMap.get("id");t&&(this.isEdit=!0,this.loadVehicle(t))}loadVehicle(t){this.loading=!0,this.vehicleService.findById(t).subscribe({next:s=>{const a=s.hardwareLink&&"object"==typeof s.hardwareLink?s.hardwareLink.code:s.hardwareLink||"";s.company&&"object"==typeof s.company?this.form.patchValue(Object.assign(Object.assign({},s),{company:s.company,hardwareLink:a})):s.company&&"string"==typeof s.company?this.companyService.getById(s.company).subscribe({next:o=>{this.form.patchValue(Object.assign(Object.assign({},s),{company:o,hardwareLink:a}))},error:o=>{console.error("Erro ao carregar empresa:",o),this.messageService.add({severity:"error",summary:"Erro",detail:"Erro ao carregar empresa"})}}):this.form.patchValue(Object.assign(Object.assign({},s),{hardwareLink:a})),this.loading=!1},error:s=>{console.error("Erro ao carregar ve\xedculo:",s),this.messageService.add({severity:"error",summary:"Erro",detail:"Erro ao carregar ve\xedculo"}),this.loading=!1}})}onSubmit(){var t,s;if(this.form.valid){const a=this.form.value,o=Object.assign(Object.assign({},a),{company:(null===(t=a.company)||void 0===t?void 0:t._id)||a.company,hardwareLink:(null===(s=a.hardwareLink)||void 0===s?void 0:s._id)||a.hardwareLink||null});delete o._id,delete o.createdAt,delete o.updatedAt,this.vehicleService.save(o).subscribe({next:()=>{this.messageService.add({severity:"success",summary:"Sucesso",detail
1:"Ve\xedculo salvo com sucesso!"}),this.router.navigate(["../"],{relativeTo:this.route})},error:d=>{console.error("Erro ao salvar ve\xedculo:",d),this.messageService.add({severity:"error",summary:"Erro",detail:"Erro ao salvar ve\xedculo. Por favor, tente novamente."})}})}}onCancel(){this.router.navigate(["/separa/vehicles"],{relativeTo:this.route})}searchCompany(t){this.companyService.getByName(t.query).subscribe({next:a=>{this.companySuggestions=a},error:a=>{console.error("Erro ao buscar empresas:",a),this.messageService.add({severity:"error",summary:"Erro",detail:"Erro ao buscar empresas"})}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(c.qu),e.Y36(G),e.Y36(ee.J),e.Y36(u.gz),e.Y36(u.F0),e.Y36(A.ez))},n.\u0275cmp=e.Xpm({type:n,selectors:[["app-vehicles-form"]],features:[e._Bn([A.ez])],decls:36,vars:39,consts:[[3,"header"],[3,"formGroup","ngSubmit"],[1,"p-fluid","grid"],[1,"field","col-12","md:col-6"],["for","code"],["id","code","type","text","pInputText","","formControlName","code","placeholder","C\xf3digo do ve\xedculo",3,"ngClass"],["class","p-error",4,"ngIf"],["for","plate"],["id","plate","type","text","pInputText","","formControlName","plate","placeholder","Placa do ve\xedculo",3,"ngClass"],["for","modelName"],["id","modelName","type","text","pInputText","","formControlName","modelName","placeholder","Modelo do ve\xedculo",3,"ngClass"],["for","hardwareLink"],["id","hardwareLink","type","text","pInputText","","formControlName","hardwareLink","readonly",""],["for","company"],["
1id","company","formControlName","company","field","name","placeholder","Selecione uma empresa",3,"suggestions","forceSelection","dropdown","ngClass","completeMethod"],["for","status"],["id","status","formControlName","status","optionLabel","label","optionValue","value","placeholder","Selecione o status",3,"options","showClear","ngClass"],[1,"flex","justify-content-end","gap-2","mt-6",2,"margin-top","2rem"],["pButton","","type","button","label","Cancelar","icon","pi pi-times",1,"p-button-text",3,"disabled","click"],["pButton","","type","submit","label","Salvar","icon","pi pi-check",3,"loading","disabled"],[1,"p-error"]],template:function(t,s){if(1&t&&(e.TgZ(0,"p-card",0),e.TgZ(1,"form",1),e.NdJ("ngSubmit",function(){return s.onSubmit()}),e.TgZ(2,"div",2),e.TgZ(3,"div",3),e.TgZ(4,"label",4),e._uU(5,"C\xf3digo"),e.qZA(),e._UZ(6,"input",5),e.YNc(7,R,2,0,"small",6),e.qZA(),e.TgZ(8,"div",3),e.TgZ(9,"label",7),e._uU(10,"Placa"),e.qZA(),e._UZ(11,"input",8),e.YNc(12,te,2,0,"small",6),e.qZA(),e.TgZ(13,"div",3),e.TgZ(14,"label",9),e._uU(15,"Modelo"),e.qZA(),e._UZ(16,"input",10),e.YNc(17,re,2,0,"small",6),e.qZA(),e.TgZ(18,"div",3),e.TgZ(19,"label",11),e._uU(20,"N\xfamero do Hardware Vinculado"),e.qZA(),e._UZ(21,"input",12),e.qZA(),e.TgZ(22,"div",3),e.TgZ(23,"label",13),e._uU(24,"Empresa"),e.qZA(),e.TgZ(25,"p-autoComplete",14),e.NdJ("completeMethod",function(o){return s.searchCompany(o)}),e.qZA(),e.YNc(26,se,2,0,"small",6),e.qZA(),e.TgZ(27,"div",3),e.TgZ(28,"label",15),e._uU(29,"Status"),e.qZA(),e._UZ(30,"p-dropdown",16),e.YNc(31,v,2,0,"small",6),e.qZA(),e.qZA(),e.TgZ(32,"div",17),e.TgZ(33,"button",18),e.NdJ("click",function(){return s.onCancel()}),e.qZA(),e._UZ(34,"button",19),e.qZA(),e.qZA(),e.qZA(),e._UZ(35,"p-toast")),2&t){let a,o,l,d,f,b,E,w,L,x;e.Q6J("header",s.isEdit?"Editar Ve\xedculo":"Novo Ve\xedculo"),e.xp6(1),e.Q6J("formGroup",s.form),e.xp6(5),e.Q6J("ngClass",e.VKq(26,N,(null==(a=s.form.get("code"))?null:a.invalid)&&(null==(a=s.form.get("code"))?null:a.touched))),e.xp6(1),e.Q6J("ngIf",(null==(o=s.form.get("code"))||null==o.errors?null:o.errors.required)&&(null==(o=s.form.get("code"))?null:o.touched)),e.xp6(4),e.Q6J("ngClass",e.VKq(28,N,(null==(l=s.form.get("plate"))?null:l.invalid)&&(null==(l=s.form.get("plate"))?null:l.touched))),e.xp6(1),e.Q6J("ngIf",(null==(d=s.form.get("plate"))||null==d.errors?null:d.errors.required)&&(null==(d=s.form.get("plate"))?null:d.touched)),e.xp6(4),e.Q6J("ngClass",e.VKq(30,N,(null==(f=s.form.get("modelName"))?null:f.invalid)&&(null==(f=s.form.get("modelName"))?null:f.touched))
1),e.xp6(1),e.Q6J("ngIf",(null==(b=s.form.get("modelName"))||null==b.errors?null:b.errors.required)&&(null==(b=s.form.get("modelName"))?null:b.touched)),e.xp6(4),e.Akn(e.DdM(32,g)),e.xp6(4),e.Akn(e.DdM(33,M)),e.Q6J("suggestions",s.companySuggestions)("forceSelection",!0)("dropdown",!0)("ngClass",e.VKq(34,N,(null==(E=s.form.get("company"))?null:E.invalid)&&(null==(E=s.form.get("company"))?null:E.touched))),e.xp6(1),e.Q6J("ngIf",(null==(w=s.form.get("company"))||null==w.errors?null:w.errors.required)&&(null==(w=s.form.get("company"))?null:w.touched)),e.xp6(4),e.Akn(e.DdM(36,M)),e.Q6J("options",s.statusOptions)("showClear",!0)("ngClass",e.VKq(37,N,(null==(L=s.form.get("status"))?null:L.invalid)&&(null==(L=s.form.get("status"))?null:L.touched))),e.xp6(1),e.Q6J("ngIf",(null==(x=s.form.get("status"))||null==x.errors?null:x.errors.required)&&(null==(x=s.form.get("status"))?null:x.touched)),e.xp6(2),e.Q6J("disabled",s.loading),e.xp6(1),e.Q6J("loading",s.loading)("disabled",s.loading)}},directives:[U.Z,c._Y,c.JL,c.sg,c.Fj,m.o,c.JJ,c.u,h.mk,h.O5,_.Qc,C.Lt,Z.Hq,y.FN],styles:[".p-field[_ngcontent-%COMP%]{margin-bottom:1rem}[_nghost-%COMP%]     .p-button{margin-left:.5rem}[_nghost-%COMP%]     .p-card .p-card-content{padding-top:1rem}"]}),n})();const oe=[{path:"",component:V,children:[{path:"",component:W},{path:"new",component:ae},{path:"edit/:id",component:ae}]}];let ne=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({imports:[[u.Bz.forChild(oe)],u.Bz]}),n})(),ie=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({providers:[A.ez],imports:[[h.ez,u.Bz,c.u5,c.UX,ne,U.d,S.U$,Z.hJ,p.W,m.j,C.kW,y.EV,_.WN,J.D]]}),n})()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.