{"version":3,"sources":["webpack:///./src/utils/auth-required.js","webpack:///./src/utils/logs.js","webpack:///./src/utils/debug.js","webpack:///./src/utils/upload.js","webpack:///./themeConfig.js","webpack:///./src/utils/notification.js","webpack:///./src/utils/auth-data.js","webpack:///./src/utils/index.js"],"names":["to","from","next","localStorage","getItem","removeItem","log","location","name","params","modes","$context","developing","includes","console","groupCollapsed","group","time","Date","clear","data","timeEnd","groupEnd","messages","setDebugStatus","process","VUE_APP_LOCAL_SERVER","BASE_URL","streamServer","fileServer","xRegisWestern","xRegisNation","config","fileExtension","csv","video","images","document","url","vdoOnDemandApi","vdoIntroductionApi","liveVdoApi","uploadFiles","uploadAvatar","downloadFile","noAvatarImage","noPhotoImage","prefixFileName","vdoOnDemand","vdoIntroduction","vdoLiveSet","operationName","teacherAvatar","studentAvatar","classAssignment","studentAssignment","classMaterial","courseOutline","baseUrl","getAvatarUrl","picturePath","getECode","getRStage","getXRegisStudentPhoto","studentId","xRegisUrl","getPhotoUrl","getClassRoomUrl","colors","primary","success","danger","warning","dark","themeConfig","disableCustomizer","disableThemeTour","footerType","hideScrollToTop","mainLayoutType","navbarColor","navbarType","routerTransition","rtl","sidebarCollapsed","theme","userInfoLocalStorageKey","Vue","use","Vuesax","notificationType","SUCCESS","INFO","WARNING","ERROR","newItemSuccess","value","title","i18n","t","text","color","position","notificationPosition","icon","updateItemSuccess","deleteItemSuccess","message","info","error","showStateNotification","vs","localData","JSON","parse","stringify","notify","showLocalNotification","type","serverResponseStatusSet","status","rsc","e_code","r_stage","getToken","stageParser","checkServerVersion","axios","get","APIServerPrisma2","response","String","appVersion","debug","logs"],"mappings":"gHAAe,gBAACA,EAAIC,EAAMC,GAEgB,OAAlCC,aAAaC,QAAQ,SAErBF,KAEAC,aAAaE,WAAW,SACxBH,EAAK,kB,oHCDN,SAASI,IAAqE,IAAhEC,EAAgE,uDAArD,CAAEC,KAAM,WAAaC,EAAgC,uDAAvB,GAAKC,EAAkB,uDAAV,CAAC,QACtEC,OAAS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qH,EACKR,KAAKC,MAAMO,GAAKC,OAGlB,MAGI5D,EAAY,WACvB,IAAI2D,EAAMtH,aAAaC,QAAQ,OAE/B,OAAIqH,EACKR,KAAKC,MAAMO,GAAKE,QAGlB,MAGIC,EAAWzH,aAAaC,QAAQ,SAEtC,SAASyH,EAAYF,GAC1B,OAAQA,GACN,IAAK,IACH,MAAO,SACT,IAAK,IACH,MAAO,OACT,IAAK,IACH,MAAO,UACT,IAAK,IACH,MAAO,MACT,IAAK,MACH,MAAO,GACT,QACE,MAAO,S,oLCmBN,SAAeG,IAAtB,+B,8DAAO,oHACoBC,OAAMC,IAAIC,sBAAmB,YADjD,cACGC,EADH,yBAEIC,OAAOD,EAAS9G,QAAUgH,iBAF9B,2C,wBAMA,IAAMC,EAAQ,kBAAM,6CAGzBC","file":"js/app~30ccc425.50705716.js","sourcesContent":["export default (to, from, next) => {\n // if (localStorage.getItem('user') != null && localStorage.getItem('user').length > 0) {\n if (localStorage.getItem('token') !== null) {\n // verify with firebase or jwt\n next();\n } else {\n localStorage.removeItem('token');\n next('/user/login');\n }\n}\n","import $context from \"@/app-context\";\n\nexport default {\n log\n}\n\nexport function log (location = { name: \"unknown\" }, params = { }, modes = [\"hide\"]) {\n if ($context.developing) {\n if (modes.includes(\"hide\")) {\n console.groupCollapsed(location.name);\n } else {\n console.group(location.name)\n }\n console.time(location.name);\n console.log(new Date);\n console.log(location);\n if (modes.includes(\"temp\")) {\n console.clear(); // [WIP]\n }\n if (params.data) {\n console.log(params.data);\n }\n console.timeEnd(location.name);\n console.groupEnd();\n }\n}\n","\nexport const log = (messages) => {\n if (\n messages !== null && typeof messages !== \"undefined\"\n && process.env.NODE_ENV !== \"production\"\n && process.env.NODE_ENV !== \"staging\"\n ) {\n const date = new Date();\n const time = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}:${date.getTime()}`;\n if (Object.prototype.hasOwnProperty.call(messages, \"title\")) {\n console.group(messages.title, \"@ \" + time);\n console.log(messages);\n console.groupEnd();\n } else {\n console.group(time);\n console.log(messages);\n }\n }\n};\n\nexport const setDebugStatus = () => {\n if (process.env.VUE_APP_LOCAL_SERVER === \"true\") {\n return true;\n }\n if (process.env.VUE_APP_DEPLOYMENT_STAGE === \"development\") {\n return true;\n }\n return false;\n};\n","const BASE_URL = process.env.BASE_URL || \"/\";\nconst streamServer = process.env.VUE_APP_STREAMING_SERVER || \"/\";\nconst fileServer = process.env.VUE_APP_FILE_SERVER || \"/\";\nconst xRegisWestern = process.env.VUE_APP_XREGIS_WESTERN_WEBAPP || \"https://xregis.western.ac.th\";\nconst xRegisNation = process.env.VUE_APP_XREGIS_NATION_WEBAPP || \"https://xregis.nation.ac.th\";\n\n\nimport {getECode, getRStage} from \"@/utils/auth-data\";\n\n// const e_code = !localStorage.getItem(\"rsc\") ? null : JSON.parse(localStorage.getItem(\"rsc\")).e_code;\n// const r_stage = !localStorage.getItem(\"rsc\") ? null : JSON.parse(localStorage.getItem(\"rsc\")).r_stage;\n\nexport const config = {\n fileExtension: {\n csv: '.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel',\n video: 'video/*',\n images: 'image/*',\n document: 'image/*,.csv,' +\n ' application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,' +\n ' application/vnd.ms-excel,' +\n ' .doc,' +\n ' .docx,' +\n ' .pdf,' +\n ' application/vnd.ms-powerpoint,' +\n ' application/mspowerpoint,' +\n ' application/x-mspowerpoint,' +\n ' application/vnd.openxmlformats-officedocument.presentationml.presentation',\n },\n url: {\n vdoOnDemandApi: `${streamServer}/upload`,\n vdoIntroductionApi: `${streamServer}/upload`,\n liveVdoApi: `${streamServer}upload-vdo-live-set`,\n uploadFiles: `${fileServer}/upload`,\n uploadAvatar: `${fileServer}/upload`,\n downloadFile: `${fileServer}/`,\n // downloadFile: `${fileServer}/${getECode()}/${getRStage()}/`,\n // downloadFile: `${fileServer}/${e_code}/${r_stage}/`,\n\n noAvatarImage: BASE_URL + 'static/images/no-avatar.png',\n noPhotoImage: BASE_URL + 'static/images/NoPhotoAvailable.jpg',\n xRegisWestern,\n xRegisNation,\n },\n prefixFileName: {\n vdoOnDemand: 'ODM',\n vdoIntroduction: 'VID',\n vdoLiveSet: 'VLS'\n },\n operationName:{\n teacherAvatar: 'image-upload',\n studentAvatar: 'image-upload',\n classAssignment: 'document-upload',\n studentAssignment: 'document-upload',\n classMaterial: 'document-upload',\n courseOutline: 'image-upload',\n },\n baseUrl: BASE_URL,\n streamServer: streamServer,\n};\n\nexport function getAvatarUrl(picturePath){\n if(picturePath){\n return `${config.url.downloadFile}${getECode()}/${getRStage()}/${picturePath}`;\n }else{\n return BASE_URL + 'static/images/no-avatar.png'\n }\n}\nexport function getXRegisStudentPhoto(studentId){\n if(studentId){\n const xRegisUrl = getECode() === 'x-studi-nation' ? xRegisNation:xRegisWestern\n return `${xRegisUrl}/stdphoto/${studentId}`;\n }else{\n return BASE_URL + 'static/images/no-avatar.png'\n }\n}\n\nexport function getPhotoUrl(picturePath){\n if(picturePath){\n // return config.url.downloadFile + picturePath;\n return `${config.url.downloadFile}${getECode()}/${getRStage()}/${picturePath}`;\n }else{\n return BASE_URL + 'static/images/NoPhotoAvailable.jpg'\n }\n}\n\nexport function getClassRoomUrl(picturePath){\n if(picturePath){\n // return config.url.downloadFile + picturePath;\n return `${config.url.downloadFile}${getECode()}/${getRStage()}/${picturePath}`;\n }else{\n return BASE_URL + 'static/images/classroom-placeholder.jpg'\n }\n}\n","/*=========================================================================================\n File Name: themeConfig.js\n Description: Theme configuration\n ----------------------------------------------------------------------------------------\n Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template\n Author: Pixinvent\n Author URL: hhttp://www.themeforest.net/user/pixinvent\n==========================================================================================*/\n\n// MAIN COLORS - VUESAX THEME COLORS\nlet colors = {\n primary: '#7367F0',\n success: '#28C76F',\n danger: '#EA5455',\n warning: '#FF9F43',\n dark: '#1E1E1E',\n};\n\n// CONFIGS\nconst themeConfig = {\n disableCustomizer: false, // options[Boolean] : true, false(default)\n disableThemeTour: false, // options[Boolean] : true, false(default)\n footerType: \"static\", // options[String] : static(default) / sticky / hidden\n hideScrollToTop: false, // options[Boolean] : true, false(default)\n mainLayoutType: \"vertical\", // options[String] : vertical(default) / horizontal\n navbarColor: \"#fff\", // options[String] : HEX color / rgb / rgba / Valid HTML Color name - (default: #fff)\n navbarType: \"floating\", // options[String] : floating(default) / static / sticky / hidden\n routerTransition: \"zoom-fade\", // options[String] : zoom-fade / slide-fade / fade-bottom / fade / zoom-out / none(default)\n rtl: false, // options[Boolean] : true, false(default)\n sidebarCollapsed: false, // options[Boolean] : true, false(default)\n theme: \"light\", // options[String] : \"light\"(default), \"dark\", \"semi-dark\"\n\n // Not required yet - WIP\n userInfoLocalStorageKey: \"userInfo\",\n\n // NOTE: themeTour will be disabled in screens < 1200. Please refer docs for more info.\n};\n\nimport Vue from 'vue'\nimport Vuesax from 'vuesax'\n\nVue.use(Vuesax, {theme: {colors}, rtl: themeConfig.rtl});\n\nexport default themeConfig\n","import {notificationPosition} from '@/constants/config';\nimport {i18n} from '@/setup/i18n-setup';\n\nexport const notificationType = {\n SUCCESS: 'success',\n INFO: 'info',\n WARNING: 'warning',\n ERROR: 'error',\n};\n\nexport const newItemSuccess = (value) => {\n return {\n title: i18n.t('notification.add-item-success-title'),\n text: i18n.t('notification.add-item-success-message', {value}),\n color: 'success',\n position: notificationPosition,\n icon:'check_circle'\n }\n};\n\nexport const updateItemSuccess = (value) => {\n return {\n title: i18n.t('notification.update-item-success-title'),\n text: i18n.t('notification.update-item-success-message', {value}),\n color: 'success',\n position: notificationPosition,\n icon:'check_circle'\n }\n};\n\nexport const deleteItemSuccess = (value) => {\n return {\n title: i18n.t('notification.delete-item-success-title'),\n text: i18n.t('notification.delete-item-success-message', {value}),\n color: 'success',\n position: notificationPosition,\n icon:'check_circle'\n }\n};\n\nexport const success = (title, message) => {\n return {\n title: i18n.t(title ? title : 'notification.general-info-title'),\n text: message,\n color: 'success',\n position: notificationPosition,\n icon: 'check_circle'\n }\n};\n\nexport const info = (title, message) => {\n return {\n title: i18n.t(title ? title : 'notification.general-info-title'),\n text: message,\n color: 'primary',\n position: notificationPosition,\n icon:'info'\n }\n};\n\nexport const warning = (title, message) => {\n return {\n title: i18n.t(title ? title : 'notification.general-warning-title'),\n text: message,\n color: 'warning',\n position: notificationPosition,\n icon:'warning'\n }\n};\n\nexport const error = (title, message) => {\n return {\n title: i18n.t(title ? title : 'notification.general-error-title'),\n text: message,\n color: 'danger',\n position: notificationPosition,\n icon:'error'\n }\n};\n\nexport const showStateNotification = (vs, data) => {\n if (data && data.title) {\n //clone state data to local data\n let localData = JSON.parse(JSON.stringify(data));\n\n vs.notify(localData);\n }\n\n};\n\nexport const showLocalNotification = (vs, title, message, type) => {\n if (type === notificationType.SUCCESS) {\n vs.notify(success(title, message));\n } else if (type === notificationType.INFO) {\n vs.notify(info(title, message));\n } else if (type === notificationType.WARNING) {\n vs.notify(warning(title, message));\n } else if (type === notificationType.ERROR) {\n vs.notify(error(title, message));\n }\n};\n\nexport const serverResponseStatusSet = (title, data) => {\n // WORKAROUND: TODO: Clear this code\n if (!data) {\n return;\n }\n\n let { success, error, message } = data.status;\n\n return {\n title: i18n.t(title ? title : 'notification.general-error-title'),\n // text: value ? value.replace(\"GraphQL error: \", \"\") : i18n.t('unknown-error'),\n text: message ? message : i18n.t('unknown-error'),\n color: error ? 'danger' : success ? 'success' : 'primary',\n position: notificationPosition,\n // iconPack: 'feather',\n // icon:'icon-alert-circle',\n }\n};\n","// export const getECode = !localStorage.getItem(\"rsc\") ? null : JSON.parse(localStorage.getItem(\"rsc\")).e_code;\n\n// export const getRStage = !localStorage.getItem(\"rsc\") ? null : JSON.parse(localStorage.getItem(\"rsc\")).r_stage;\n\nexport const getECode = () => {\n let rsc = localStorage.getItem(\"rsc\");\n\n if (rsc) {\n return JSON.parse(rsc).e_code;\n }\n\n return null;\n}\n\nexport const getRStage = () => {\n let rsc = localStorage.getItem(\"rsc\");\n\n if (rsc) {\n return JSON.parse(rsc).r_stage;\n }\n\n return null;\n}\n\nexport const getToken = localStorage.getItem(\"token\");\n\nexport function stageParser(r_stage) {\n switch (r_stage) {\n case \"0\":\n return \"test12\"\n case \"1\":\n return \"prod\"\n case \"8\":\n return \"staging\"\n case \"9\":\n return \"dev\"\n case \"nil\":\n return \"\"\n default:\n return \"dev\"\n }\n}\n","import logs from \"./logs\";\nimport axios from \"@/setup/axios-setup\";\nimport {appVersion, APIServerPrisma2} from \"@/constants/config\";\n\nexport const addCommas = nStr => {\n nStr += '';\n const x = nStr.split('.');\n let x1 = x[0];\n const x2 = x.length > 1 ? '.' + x[1] : '';\n const rgx = /(\\d+)(\\d{3})/;\n while (rgx.test(x1)) {\n x1 = x1.replace(rgx, '$1' + ',' + '$2')\n }\n return x1 + x2\n};\n\nexport const mapOrder = (array, order, key) => {\n array.sort(function (a, b) {\n const A = a[key];\n const B = b[key];\n if (order.indexOf(A + '') > order.indexOf(B + '')) {\n return 1\n } else {\n return -1\n }\n });\n return array\n};\n\nexport const getDateWithFormat = () => {\n const today = new Date();\n let dd = today.getDate();\n let mm = today.getMonth() + 1; // January is 0!\n\n const yyyy = today.getFullYear();\n if (dd < 10) {\n dd = '0' + dd\n }\n if (mm < 10) {\n mm = '0' + mm\n }\n return dd + '.' + mm + '.' + yyyy\n};\n\nexport const getCurrentTime = () => {\n const now = new Date();\n return now.getHours() + ':' + now.getMinutes()\n};\n\nexport function checkServerStatus({ store, router }) {\n store.dispatch(\"checkAPIServer\");\n setTimeout( ()=> {\n if (store.state.status.error) {\n store.commit(\"appCrash\", router);\n }\n }, 500);\n}\n\nexport async function checkServerVersion() {\n const response = await axios.get(APIServerPrisma2 + \"/version\");\n return String(response.data) === appVersion;\n\n}\n\nexport const debug = () => import(\"./debug\");\n\nexport default {\n logs,\n debug\n}\n"],"sourceRoot":""}