"use strict";(self.webpackChunknexopos_4x=self.webpackChunknexopos_4x||[]).push([[179],{6179:(e,s,t)=>{t.r(s),t.d(s,{default:()=>l});var i=t(7389),n=t(2277),r=t(7266),a=t(9671);const o={name:"ns-login",data:function(){return{fields:[],xXsrfToken:null,validation:new r.Z,isSubitting:!1}},mounted:function(){var e=this;(0,n.D)([a.ih.get("/api/nexopos/v4/fields/ns.password-lost"),a.ih.get("/sanctum/csrf-cookie")]).subscribe((function(s){e.fields=e.validation.createFields(s[0]),e.xXsrfToken=a.ih.response.config.headers["X-XSRF-TOKEN"],setTimeout((function(){return a.kq.doAction("ns-login-mounted",e)}),100)}),(function(e){a.kX.error(e.message||(0,i.__)("An unexpected error occured."),(0,i.__)("OK"),{duration:0}).subscribe()}))},methods:{__:i.__,requestRecovery:function(){var e=this;if(!this.validation.validateFields(this.fields))return a.kX.error((0,i.__)("Unable to proceed the form is not valid.")).subscribe();this.validation.disableFields(this.fields),a.kq.applyFilters("ns-password-lost-submit",!0)&&(this.isSubitting=!0,a.ih.post("/auth/password-lost",this.validation.getValue(this.fields),{headers:{"X-XSRF-TOKEN":this.xXsrfToken}}).subscribe((function(e){a.kX.success(e.message).subscribe(),setTimeout((function(){document.location=e.data.redirectTo}),500)}),(function(s){e.isSubitting=!1,e.validation.enableFields(e.fields),s.data&&e.validation.triggerFieldsErrors(e.fields,s.data),a.kX.error(s.message).subscribe()})))}}};const l=(0,t(1900).Z)(o,(function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",{staticClass:"bg-white rounded shadow overflow-hidden transition-all duration-100"},[t("div",{staticClass:"p-3 -my-2"},[e.fields.length>0?t("div",{staticClass:"py-2 fade-in-entrance anim-duration-300"},e._l(e.fields,(function(e,s){return t("ns-field",{key:s,attrs:{field:e}})})),1):e._e()]),e._v(" "),0===e.fields.length?t("div",{staticClass:"flex items-center justify-center py-10"},[t("ns-spinner",{attrs:{border:"4",size:"16"}})],1):e._e(),e._v(" "),t("div",{staticClass:"flex w-full items-center justify-center py-4"},[t("a",{staticClass:"hover:underline text-blue-600 text-sm",attrs:{href:"/sign-in"}},[e._v(e._s(e.__("Remember Your Password ?")))])]),e._v(" "),t("div",{staticClass:"flex justify-between items-center bg-gray-200 p-3"},[t("div",[t("ns-button",{staticClass:"justify-between",attrs:{type:"info"},on:{click:function(s){return e.requestRecovery()}}},[e.isSubitting?t("ns-spinner",{staticClass:"mr-2",attrs:{size:"6",border:"2"}}):e._e(),e._v(" "),t("span",[e._v(e._s(e.__("Submit")))])],1)],1),e._v(" "),t("div",[t("ns-link",{attrs:{href:"/sign-up",type:"success"}},[e._v(e._s(e.__("Register")))])],1)])])}),[],!1,null,null,null).exports}}]);