(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:{CMCApp:L}};const E=(0,y.Z)(S,[["render",r]]);var A=E,N=(n(9773),n(8957)),Z=(0,N.Rd)();async function D(){const e=await n.e(461).then(n.t.bind(n,3657,23));e.load({google:{families:["Roboto:100,300,400,500,700,900&display=swap"]}})}var M=n(2483);const T={class:"home"};function $(e,t,n,o,r,a){return(0,i.wg)(),(0,i.iD)("div",T," Dashboard ")}var x={name:"HomeView",components:{}};const U=(0,y.Z)(x,[["render",$]]);var W=U;const q=()=>n.e(463).then(n.bind(n,4463)),H=()=>Promise.all([n.e(165),n.e(803)]).then(n.bind(n,7803)),I=()=>n.e(823).then(n.bind(n,1823)),B=()=>Promise.all([n.e(165),n.e(975),n.e(17)]).then(n.bind(n,9017)),F=()=>Promise.all([n.e(165),n.e(975),n.e(577),n.e(189),n.e(121),n.e(83)]).then(n.bind(n,6705)),R=()=>Promise.all([n.e(165),n.e(975),n.e(189),n.e(287)]).then(n.bind(n,8765)),V=()=>Promise.all([n.e(165),n.e(975),n.e(577),n.e(189),n.e(121),n.e(337)]).then(n.bind(n,9522)),z=()=>Promise.all([n.e(165),n.e(975),n.e(577),n.e(553)]).then(n.bind(n,6553)),Y=[{path:"/",name:"home",component:W},{path:"/about",name:"about",component:q},{path:"/login",name:"login",component:H},{path:"/logout",name:"logout",component:I},{path:"/customers/list",name:"customerlist",component:B},{path:"/customers/contracts/list",name:"contractlist",component:F},{path:"/customers/medicated-feeds/list",name:"medfeedslist",component:V},{path:"/customers/complaints/list",name:"complaintslist",component:R},{path:"/sop/printed",name:"sopprinted",component:z}],K=(0,M.p7)({history:(0,M.PO)("/"),routes:Y});var X=K,G=n(1723),J=n(9024),Q=n(6314);j.Z.defaults.headers.common["X-Authentication"]=`Bearer ${localStorage.getItem("access_token")}`,D();const ee=(0,o.ri)(A).use(X).use(Z).use(G.Z).use(Q.ZP).component("DatePicker",J.Z);var te=window.location.protocol+"//"+window.location.host+"/api/v1";let ne;console.log("URL :"+te),j.Z.get(te+"/info").then((e=>{console.log("URL :"+te),ne=e.data,ee.config.globalProperties.$api_url=te,ee.config.globalProperties.$site_info=ne,ee.mount("#app")})).catch((e=>{console.log("Error : "+e),te="http://localhost:3000/api/v1",console.log("Trying to use URL : "+te),ee.config.globalProperties.$api_url=te,ee.config.globalProperties.$site_info=ne,ee.mount("#app")}))}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={id:o,loaded:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}n.m=e,function(){n.amdD=function(){throw new Error("define cannot be used indirect")}}(),function(){n.amdO={}}(),function(){var e=[];n.O=function(t,o,i,r){if(!o){var a=1/0;for(c=0;c=r)&&Object.keys(n.O).every((function(e){return n.O[e](o[u])}))?o.splice(u--,1):(l=!1,r0&&e[c-1][2]>r;c--)e[c]=e[c-1];e[c]=[o,i,r]}}(),function(){n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,{a:t}),t}}(),function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};n.t=function(o,i){if(1&i&&(o=this(o)),8&i)return o;if("object"===typeof o&&o){if(4&i&&o.__esModule)return o;if(16&i&&"function"===typeof o.then)return o}var r=Object.create(null);n.r(r);var a={};e=e||[null,t({}),t([]),t(t)];for(var l=2&i&&o;"object"==typeof l&&!~e.indexOf(l);l=t(l))Object.getOwnPropertyNames(l).forEach((function(e){a[e]=function(){return o[e]}}));return a["default"]=function(){return o},n.d(r,a),r}}(),function(){n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}}(),function(){n.f={},n.e=function(e){return Promise.all(Object.keys(n.f).reduce((function(t,o){return n.f[o](e,t),t}),[]))}}(),function(){n.u=function(e){return"js/"+(461===e?"webfontloader":e)+"."+{17:"e124ae12",83:"37aa53f6",121:"5997df3e",165:"211e8e0a",189:"d48eb76c",287:"3d3496d6",337:"7acf902b",461:"95ddae74",463:"dd239b65",553:"fb74f1fb",577:"f88c2014",803:"d5052a11",823:"8ba5256b",975:"0adc4ef0"}[e]+".js"}}(),function(){n.miniCssF=function(e){return"css/"+e+"."+{17:"ae3c234a",83:"46f88035",165:"83e5555a",287:"b8b74994",337:"1da97b3f",553:"c3657471",803:"be0ee137",975:"9ad07ca2"}[e]+".css"}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){var e={},t="cmc_fe:";n.l=function(o,i,r,a){if(e[o])e[o].push(i);else{var l,u;if(void 0!==r)for(var s=document.getElementsByTagName("script"),c=0;c