2 lines
No EOL
12 KiB
JavaScript
2 lines
No EOL
12 KiB
JavaScript
(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<e.length;c++){o=e[c][0],i=e[c][1],r=e[c][2];for(var l=!0,u=0;u<o.length;u++)(!1&r||a>=r)&&Object.keys(n.O).every((function(e){return n.O[e](o[u])}))?o.splice(u--,1):(l=!1,r<a&&(a=r));if(l){e.splice(c--,1);var s=i();void 0!==s&&(t=s)}}return t}r=r||0;for(var c=e.length;c>0&&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<s.length;c++){var f=s[c];if(f.getAttribute("src")==o||f.getAttribute("data-webpack")==t+r){l=f;break}}l||(u=!0,l=document.createElement("script"),l.charset="utf-8",l.timeout=120,n.nc&&l.setAttribute("nonce",n.nc),l.setAttribute("data-webpack",t+r),l.src=o),e[o]=[i];var d=function(t,n){l.onerror=l.onload=null,clearTimeout(m);var i=e[o];if(delete e[o],l.parentNode&&l.parentNode.removeChild(l),i&&i.forEach((function(e){return e(n)})),t)return t(n)},m=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),u&&document.head.appendChild(l)}}}(),function(){n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e}}(),function(){n.p="/"}(),function(){if("undefined"!==typeof document){var e=function(e,t,n,o,i){var r=document.createElement("link");r.rel="stylesheet",r.type="text/css";var a=function(n){if(r.onerror=r.onload=null,"load"===n.type)o();else{var a=n&&("load"===n.type?"missing":n.type),l=n&&n.target&&n.target.href||t,u=new Error("Loading CSS chunk "+e+" failed.\n("+l+")");u.code="CSS_CHUNK_LOAD_FAILED",u.type=a,u.request=l,r.parentNode.removeChild(r),i(u)}};return r.onerror=r.onload=a,r.href=t,n?n.parentNode.insertBefore(r,n.nextSibling):document.head.appendChild(r),r},t=function(e,t){for(var n=document.getElementsByTagName("link"),o=0;o<n.length;o++){var i=n[o],r=i.getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(r===e||r===t))return i}var a=document.getElementsByTagName("style");for(o=0;o<a.length;o++){i=a[o],r=i.getAttribute("data-href");if(r===e||r===t)return i}},o=function(o){return new Promise((function(i,r){var a=n.miniCssF(o),l=n.p+a;if(t(a,l))return i();e(o,l,null,i,r)}))},i={143:0};n.f.miniCss=function(e,t){var n={17:1,83:1,165:1,287:1,337:1,553:1,803:1,975:1};i[e]?t.push(i[e]):0!==i[e]&&n[e]&&t.push(i[e]=o(e).then((function(){i[e]=0}),(function(t){throw delete i[e],t})))}}}(),function(){var e={143:0};n.f.j=function(t,o){var i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)o.push(i[2]);else if(975!=t){var r=new Promise((function(n,o){i=e[t]=[n,o]}));o.push(i[2]=r);var a=n.p+n.u(t),l=new Error,u=function(o){if(n.o(e,t)&&(i=e[t],0!==i&&(e[t]=void 0),i)){var r=o&&("load"===o.type?"missing":o.type),a=o&&o.target&&o.target.src;l.message="Loading chunk "+t+" failed.\n("+r+": "+a+")",l.name="ChunkLoadError",l.type=r,l.request=a,i[1](l)}};n.l(a,u,"chunk-"+t,t)}else e[t]=0},n.O.j=function(t){return 0===e[t]};var t=function(t,o){var i,r,a=o[0],l=o[1],u=o[2],s=0;if(a.some((function(t){return 0!==e[t]}))){for(i in l)n.o(l,i)&&(n.m[i]=l[i]);if(u)var c=u(n)}for(t&&t(o);s<a.length;s++)r=a[s],n.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return n.O(c)},o=self["webpackChunkcmc_fe"]=self["webpackChunkcmc_fe"]||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))}();var o=n.O(void 0,[998],(function(){return n(8257)}));o=n.O(o)})();
|
|
//# sourceMappingURL=app.a93abe60.js.map
|