Mini Shell
import{_ as d,j as _,g as u,h as p,a as g,i as o,c as n,b as e,t as i,k as l,l as h,o as c,p as m,f}from"./index-9sqZWoEd.js";const I={data(){return{moment:_,img2:u,img1:p,loadedScripts:!1,userData:null,activities:null,quickNews:null,model_scans:null}},mounted(){this.$root.isLoading=!0,this.getUserData(),this.getActivities(),this.getQuickNews(),this.getAIScans(),this.$root.loadScripts()},methods:{redirectTo(s){this.$router.push(s)},async refreshToken(s){try{const t=await this.$http.post("api/token/refresh",{refresh:this.$store.state.refresh});t.data.access?(this.$store.commit("setAccess",t.data.access),g.defaults.headers.common.Authorization=`Bearer ${t.data.access}`,await s()):this.$router.push("/login")}catch(t){console.error("Failed to refresh token",t),this.$router.push("/login")}},async getUserData(){this.$root.isLoading=!0;try{const s=await this.$http.get("accounts/userdata");this.userData=s.data,this.$root.profileInfo={name:this.userData.first_name,image:this.userData.profile_image_url},this.$root.isLoading=!1}catch(s){if(this.$root.isLoading=!1,s.response){const t=s.response.status;t===401?await this.refreshToken(this.getUserData):(console.error(`Error ${t}: ${s.response.data.message}`),o.error(`Error ${t}: ${s.response.data.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}else s.request?(console.error("No response received:",s.request),o.error("No response received. Please try again later.",{autoClose:3e3,position:o.POSITION.TOP_RIGHT})):(console.error("Error",s),o.error(`Error: ${s.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}},async getActivities(){try{const s=await this.$http.get("api/v1/activities");this.activities=s.data.data}catch(s){if(s.response){const t=s.response.status;t===401?await this.refreshToken(this.getActivities):(console.error(`Error ${t}: ${s.response.data.message}`),o.error(`Error ${t}: ${s.response.data.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}else s.request?(console.error("No response received:",s.request),o.error("No response received. Please try again later.",{autoClose:3e3,position:o.POSITION.TOP_RIGHT})):(console.error("Error",s),o.error(`Error: ${s.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}},async getQuickNews(){try{const s=await this.$http.get("api/v1/quick-news");this.quickNews=s.data.data}catch(s){if(s.response){const t=s.response.status;t===401?await this.refreshToken(this.getQuickNews):(console.error(`Error ${t}: ${s.response.data.message}`),o.error(`Error ${t}: ${s.response.data.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}else s.request?(console.error("No response received:",s.request),o.error("No response received. Please try again later.",{autoClose:3e3,position:o.POSITION.TOP_RIGHT})):(console.error("Error",s),o.error(`Error: ${s.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}},async getAIScans(){try{const s=await this.$http.get("api/v1/model");console.log(s.data),this.model_scans=s.data.data}catch(s){if(s.response){const t=s.response.status;t===401?await this.refreshToken(this.getAIScans):(console.error(`Error ${t}: ${s.response.data.message}`),o.error(`Error ${t}: ${s.response.data.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}else s.request?(console.error("No response received:",s.request),o.error("No response received. Please try again later.",{autoClose:3e3,position:o.POSITION.TOP_RIGHT})):(console.error("Error",s),o.error(`Error: ${s.message}`,{autoClose:3e3,position:o.POSITION.TOP_RIGHT}))}}}},a=s=>(m("data-v-0771dc56"),s=s(),f(),s),v={class:"home"},T={class:"container"},O={key:0},P=a(()=>e("div",{class:"heading flex1"},[e("h3",null," PROFILE"),e("p",null,"Dashboard / Profile")],-1)),$={class:"content flex"},N={class:"content_left"},k={class:"top"},S={class:"wlecome flex1"},w=a(()=>e("div",{class:"text"},[e("h3",null,"Welcome Back !"),e("label",null,"Ukubona Dashboard")],-1)),y={class:"img"},D=["src"],x={key:0,class:"profile flex1"},E={class:"box"},b={class:"image"},C=["src"],R={class:"text"},G={key:0,class:"box"},H=a(()=>e("label",null,"Saved FIles",-1)),q=a(()=>e("br",null,null,-1)),A=a(()=>e("button",null,[h(" Change Password "),e("i",{class:"fas fa-chevron-down"})],-1)),B={class:"content_right"},L={class:"right_top grid"},U={class:"rbox flex1"},F={class:"text"},Q=a(()=>e("h4",null,"total AI Results",-1)),V={key:0},j={key:1},z=a(()=>e("div",{class:"icon"},[e("span",{class:"material-icons"}," library_books ")],-1)),W={class:"rbox flex1"},J={class:"text"},K=a(()=>e("h4",null,"Available AI models",-1)),M=a(()=>e("div",{class:"icon"},[e("span",{class:"material-icons"}," widgets ")],-1));function X(s,t,Y,Z,r,ss){return c(),n("main",null,[e("section",v,[e("div",T,[r.userData?(c(),n("h3",O,i(r.userData.hospital.name),1)):l("",!0),P,e("div",$,[e("div",N,[e("div",k,[e("div",S,[w,e("div",y,[e("img",{src:r.img2,alt:""},null,8,D)])]),r.userData?(c(),n("div",x,[e("div",E,[e("div",b,[e("img",{src:r.userData.profile_image_url,alt:""},null,8,C)]),e("div",R,[e("p",null,i(r.userData.last_name)+" "+i(r.userData.first_name),1),e("label",null,i(r.userData.role),1)])]),r.userData?(c(),n("div",G,[e("p",null,i(r.userData.saved_files),1),H,h(),q,A])):l("",!0)])):l("",!0)])]),e("div",B,[e("div",L,[e("div",U,[e("div",F,[Q,r.userData?(c(),n("h2",V,i(r.userData.total_scans),1)):(c(),n("h2",j,"..."))]),z]),e("div",W,[e("div",J,[K,e("h2",null,i(s.$store.state.total_models),1)]),M])])])])])])])}const os=d(I,[["render",X],["__scopeId","data-v-0771dc56"]]);export{os as default};