import{b as D,c as p,d as _,e as V,f as A,i as u,l as O,o as j,q as P,r as q,s as B,t as H,x as R}from"./chunk-CGR7IOZB.js";import{a as T}from"./chunk-6753ERK4.js";import{Ba as t,Ca as e,Da as n,Gc as x,Hc as F,Ja as f,Jb as y,Jc as G,M as m,N as l,Ta as r,ab as g,ba as c,ca as d,fd as k,gc as b,ha as S,ld as E,nd as I,oc as w,od as L,qa as s,qd as M,rb as v,rd as N,vb as h}from"./chunk-7SK34GC7.js";import"./chunk-JKOY2XUY.js";var U=()=>({"minWidth.%":50}),te=(()=>{class a{constructor(o,i){this.apiService=o,this.router=i,this.authForm=new A({username:new u("",[p.required]),password:new u("",[p.required]),type:new u("",[p.required])})}authenticate(){this.authForm.valid?this.apiService.login(this.authForm.value).subscribe({next:o=>{o.result?(sessionStorage.setItem("token",o.data.token),sessionStorage.setItem("stype",o.data.stype),sessionStorage.setItem("storename",o.data.storename),this.router.navigate(["/store/dashboard"]).then(()=>{window.location.reload()})):console.log(o)},error:()=>{}}):(console.log("Form is invalid"),this.authForm.markAllAsTouched())}static{this.\u0275fac=function(i){return new(i||a)(d(T),d(y))}}static{this.\u0275cmp=S({type:a,selectors:[["app-login"]],decls:35,vars:5,consts:[[1,"bg-light","dark:bg-transparent","min-vh-100","d-flex","flex-row","align-items-center"],["breakpoint","md"],[1,"justify-content-center"],["lg","10","xl","8"],[1,"p-4",3,"ngStyle"],["src","../../../assets/images/logos/1732341978.png","alt","","srcset","",1,"login-image"],[3,"ngSubmit","formGroup"],[1,"text-body-secondary"],[1,"mb-3"],["cInputGroupText",""],["cIcon","","name","cilUser"],["formControlName","type","id","",1,"form-control"],["value",""],["value","sowner"],["autoComplete","username","formControlName","username","cFormControl","","placeholder","Username"],[1,"mb-4"],["cIcon","","name","cilLockLocked"],["autoComplete","current-password","cFormControl","","formControlName","password","placeholder","Password","type","password"],["xs","6"],["cButton","","type","submit","color","primary",1,"px-4"],["xs","6",1,"text-right"],[1,"text-white","py-5","login-bg",3,"ngStyle"]],template:function(i,C){i&1&&(t(0,"div",0)(1,"c-container",1)(2,"c-row",2)(3,"c-col",3)(4,"c-card-group")(5,"c-card",4)(6,"c-card-body"),n(7,"img",5),t(8,"form",6),f("ngSubmit",function(){return C.authenticate()}),t(9,"h1"),r(10,"Login"),e(),t(11,"p",7),r(12,"Sign In to your account"),e(),t(13,"c-input-group",8)(14,"span",9),m(),n(15,"svg",10),e(),l(),t(16,"select",11)(17,"option",12),r(18,"--select user type--"),e(),t(19,"option",13),r(20,"Store Admin"),e()()(),t(21,"c-input-group",8)(22,"span",9),m(),n(23,"svg",10),e(),l(),n(24,"input",14),e(),t(25,"c-input-group",15)(26,"span",9),m(),n(27,"svg",16),e(),l(),n(28,"input",17),e(),t(29,"c-row")(30,"c-col",18)(31,"button",19),r(32," Login "),e()(),n(33,"c-col",20),e()()()(),n(34,"c-card",21),e()()()()()),i&2&&(c(5),s("ngStyle",g(3,U)),c(3),s("formGroup",C.authForm),c(26),s("ngStyle",g(4,U)))},dependencies:[L,R,O,B,H,D,q,_,V,j,P,N,M,G,x,F,k,I,b,E,w,v,h],styles:['.login-image[_ngcontent-%COMP%]{width:100px}.login-bg[_ngcontent-%COMP%]{position:relative;background-image:url("./media/background-LVYSGGTY.jpg");overflow-y:hidden;background-repeat:no-repeat;background-position:center}.login-bg[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0;background-color:#0006;z-index:1}']})}}return a})();export{te as LoginComponent};
