cmc_fe/dist/js/app.a93abe60.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2023-01-19 13:44:49 +01:00
(function(){"use strict";var e={8257:function(e,t,n){var o=n(9242),i=n(3396);function r(e,t,n,o,r,a){const l=(0,i.up)("CMCApp");return(0,i.wg)(),(0,i.j4)(l)}var a=n(7139),l=n(7718),u=n(1666),s=n(3140);function c(e,t,n,o,r,c){const f=(0,i.up)("MyNav"),d=(0,i.up)("router-view");return(0,i.wg)(),(0,i.j4)(l.q,null,{default:(0,i.w5)((()=>[(0,i.Wm)(f,{user:r.user,site_info:r.site_info},null,8,["user","site_info"]),(0,i.Wm)(s.O,{class:"ma-4"},{default:(0,i.w5)((()=>[(0,i.Wm)(d,{site_info:r.site_info,user_info:r.user_info},null,8,["site_info","user_info"])])),_:1}),(0,i.Wm)(u.c,null,{default:(0,i.w5)((()=>[(0,i._)("sub",null,(0,a.zw)(r.site_info.name)+" v"+(0,a.zw)(r.site_info.version),1)])),_:1})])),_:1})}n(7658);var f=n(588),d=n(9156),m=n(7312),p=n(9234),g=n(8649),h=n(8777),v=n(9657),_=n(5030);function b(e,t,n,r,l,u){return(0,i.wg)(),(0,i.iD)(i.HY,null,[(0,i.Wm)(f.L,{color:"yellow"},{default:(0,i.w5)((()=>[n.user.logged_in?((0,i.wg)(),(0,i.j4)(d.g,{key:0,variant:"text",onClick:t[0]||(t[0]=(0,o.iM)((e=>l.drawer=!l.drawer),["stop"]))})):(0,i.kq)("",!0),(0,i.Wm)(_.q,null,{default:(0,i.w5)((()=>[(0,i.Uk)((0,a.zw)(n.site_info.name),1)])),_:1}),(0,i.Wm)(p.C),n.user.logged_in?((0,i.wg)(),(0,i.j4)(m.T,{key:1,variant:"text"},{default:(0,i.w5)((()=>[(0,i.Uk)("Hi "+(0,a.zw)(n.user.first_name),1)])),_:1})):(0,i.kq)("",!0)])),_:1}),n.user.logged_in?((0,i.wg)(),(0,i.j4)(v.V,{key:0,modelValue:l.drawer,"onUpdate:modelValue":t[1]||(t[1]=e=>l.drawer=e),theme:"dark"},{default:(0,i.w5)((()=>[(0,i.Wm)(g.i,null,{default:(0,i.w5)((()=>[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(l.items,(e=>((0,i.wg)(),(0,i.iD)(i.HY,{key:e.title},[e.children?((0,i.wg)(),(0,i.j4)(h.l,{key:0,title:e.title},{default:(0,i.w5)((()=>[(0,i.Wm)(g.i,null,{default:(0,i.w5)((()=>[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.children,(e=>((0,i.wg)(),(0,i.j4)(h.l,{key:e.title,title:e.title,to:e.value},null,8,["title","to"])))),128))])),_:2},1024)])),_:2},1032,["title"])):((0,i.wg)(),(0,i.j4)(h.l,{key:1,title:e.title,to:e.value},null,8,["title","to"]))],64)))),128))])),_:1})])),_:1},8,["modelValue"])):(0,i.kq)("",!0)],64)}var w={name:"MyNav",props:{site_info:{},user:{logged_in:!1,first_name:"null"}},watch:{"user.logged_in"(e){this.items=e?this.get_menu():[]}},data(){return{items:[],drawer:null}},created(){"/login"!=window.location.pathname&&(this.items=this.get_menu())},methods:{get_menu(){let e=[];return e.push({title:"Dashboard",value:"/about"}),e.push({title:"Customers",value:"/customers",children:[{title:"List",value:"/customers/list"},{title:"Contracts",value:"/customers/contracts/list"},{title:"Complaints",value:"/customers/complaints/list"},{title:"Medicated Feeds",value:"/customers/medicated-feeds/list"}]}),e.push({title:"Sales Orders",value:"/sop",children:[{title:"Printed",value:"/sop/printed"}]}),e.push({title:"Logout",value:"/logout"}),e}}},y=n(89);const k=(0,y.Z)(w,[["render",b]]);var O=k,j=n(6943),P={name:"App",components:{MyNav:O},data(){return{site_info:{name:"Loading...",features:{}},user:{first_name:"",last_name:"",email:"",token:"",logged_in:!1},user_info:{}}},watch:{"user.logged_in"(e){console.log("Login status is "+e)},"site_info.name"(){document.title=this.site_info.name}},methods:{checkLoginStatus(){let e=this.$api_url+"/users/check_login";console.log("Checking login status..."),j.Z.post(e).then((e=>{this.user.logged_in=e.data.logged_in,this.user.first_name=e.data.user.first_name,this.user.logged_in?(console.log("Logged in."),"/login"==window.location.pathname&&this.$router.push("/"),this.getUserInfo()):(console.log("Not logged in."),this.$router.push("/login"))})).catch((e=>{console.log("Error checking login status..."+e),this.$router.push("/login")}))},async getSiteInfo(){j.Z.get(this.$api_url+"/info").then((e=>{this.site_info=e.data})).catch((e=>console.log(e)))},async getUserInfo(){let e=this.$api_url+"/users/info";console.log(e),j.Z.get(e).then((e=>{this.user_info=e.data})).catch((e=>{console.log(e)}))}},created(){this.getSiteInfo(),"/login"!=window.location.pathname&&this.checkLoginStatus()}};const C=(0,y.Z)(P,[["render",c]]);var L=C,S={components:{CMCA
//# sourceMappingURL=app.a93abe60.js.map