{"version":3,"sources":["webpack:///./src/views/student/Memo.vue","webpack:///./src/views/student/Memo.vue?e98d","webpack:///./src/views/student/Memo.vue?5313","webpack:///./src/views/student/Memo.vue?eb72","webpack:///./src/views/widgets/Memo.vue?7ac6","webpack:///./src/views/widgets/Memo.vue","webpack:///./src/views/widgets/Memo.vue?e533","webpack:///./src/views/widgets/Memo.vue?8bd5","webpack:///./src/core/helpers/breadcrumb.ts"],"names":["class","memoType","memoTypeId","studentId","pageSize","name","components","MemoWidget","Memo","route","params","id","render","__scopeId","align","style","search","searchValue","size","placeholder","data","pagedMemos","default-sort","prop","order","label","width","moment","scope","row","create_date","format","created_by","default","user","role","user_id","src","title","handleDelete","layout","page-size","memoPageSize","total","memos","length","setPage","newMemo","memo","createMemo","props","String","Number","store","getters","currentUser","page","pageValue","filter","toLowerCase","includes","first_name","last_name","sort","x","y","Date","slice","val","confirm","then","ApiService","setHeader","delete","index","findIndex","d","splice","catch","response","console","log","errors","post","push","fire","text","icon","buttonsStyling","confirmButtonText","customClass","confirmButton","getMemo","memoTypeUrl","Promise","resolve","reject","get","Object","assign","Error","setCurrentPageBreadcrumbs","pageTitle","breadcrumbs","dispatch","SET_BREADCRUMB_ACTION","pageBreadcrumbPath","setCurrentPageTitle"],"mappings":"gMACOA,MAAM,sB,GAOJA,MAAM,4B,4GAPb,gCAaM,MAbN,EAaM,C,YAZJ,gCAIM,OAJDA,MAAM,uCAAqC,CAC9C,gCAEM,OAFDA,MAAM,kBAAgB,CACzB,gCAAmC,MAA/BA,MAAM,iBAAgB,Y,IAI9B,gCAKM,MALN,EAKM,CAJJ,yBAGoB,GAFdC,SAAS,UACFC,WAAY,EAAAC,UACnBC,SAAS,M,mECNN,+BAAgB,CAC7BC,KAAM,eACNC,WAAY,CACVC,WAAAC,EAAA,MAEF,QACE,MAAMC,EAAQ,iBACRN,EAAYM,EAAMC,OAAOC,GAM/B,OAJA,uBAAU,KACR,eAA0B,OAAQ,CAAC,cAG9B,CACLR,gB,UCfN,E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,EAAuBrE,IAClC,OAAMkE,SAAS,OAAQC,sBAAuB,CAC5CnE,MAAOA","file":"js/chunk-282cf258.4a4ba8fa.js","sourcesContent":["\r\n\r\n\r\n\r\n\r\n\r\n","\r\nimport { defineComponent, onMounted } from \"vue\";\r\nimport { setCurrentPageBreadcrumbs } from \"@/core/helpers/breadcrumb\";\r\nimport MemoWidget from \"@/views/widgets/Memo.vue\"\r\nimport { useRoute } from 'vue-router'\r\n\r\nexport default defineComponent({\r\n name: \"student-memo\",\r\n components: {\r\n MemoWidget\r\n },\r\n setup() {\r\n const route = useRoute();\r\n const studentId = route.params.id; \r\n \r\n onMounted(() => {\r\n setCurrentPageBreadcrumbs(\"Memo\", [\"Student\"]);\r\n });\r\n\r\n return {\r\n studentId\r\n };\r\n },\r\n});\r\n","import { render } from \"./Memo.vue?vue&type=template&id=0d1b9ace&scoped=true\"\nimport script from \"./Memo.vue?vue&type=script&lang=ts\"\nexport * from \"./Memo.vue?vue&type=script&lang=ts\"\n\nimport \"./Memo.vue?vue&type=style&index=0&id=0d1b9ace&scoped=true&lang=css\"\nscript.render = render\nscript.__scopeId = \"data-v-0d1b9ace\"\n\nexport default script","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader-v16/dist/index.js??ref--0-1!./Memo.vue?vue&type=style&index=0&id=0d1b9ace&scoped=true&lang=css\"","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader-v16/dist/index.js??ref--0-1!./Memo.vue?vue&type=style&index=0&id=c5cde19c&scoped=true&lang=css\"","\r\n\r\n\r\n\r\n","\r\nimport { defineComponent, reactive, computed, onBeforeMount } from \"vue\";\r\nimport { ElMessageBox } from \"element-plus\";\r\nimport ApiService from \"@/core/services/ApiService\";\r\nimport moment from \"moment\";\r\nimport { useStore } from \"vuex\";\r\nimport Swal from \"sweetalert2/dist/sweetalert2.js\";\r\n\r\nexport default defineComponent({\r\n name: \"memo\",\r\n components: {\r\n },\r\n props: {\r\n memoType: String,\r\n memoTypeId: Number,\r\n pageSize: Number,\r\n },\r\n setup(props) {\r\n const store = useStore();\r\n const user = store.getters.currentUser;\r\n const memos = reactive([] as any); \r\n const memoPageSize = props.pageSize ?? 5;\r\n let page = reactive({pageValue : 1});\r\n\r\n const pagedMemos = computed(()=>{\r\n return memos\r\n .filter(data => !search \r\n || data.memo.toLowerCase().includes(search.searchValue.toLowerCase())\r\n || (data.created_by.first_name + \" \" + data.created_by.last_name).toLowerCase().includes(search.searchValue.toLowerCase()))\r\n .sort((x, y) => +new Date(y.create_date) - +new Date(x.create_date))\r\n .slice(memoPageSize * page.pageValue - memoPageSize, memoPageSize * page.pageValue)\r\n })\r\n\r\n const setPage = (val) => {\r\n page.pageValue = val;\r\n }\r\n\r\n const handleDelete = (row) => {\r\n ElMessageBox.confirm('Are you sure to delete this memo?')\r\n .then(() => {\r\n ApiService.setHeader();\r\n ApiService.delete(\"memo/\"+row.id)\r\n .then(() => {\r\n let index = memos.findIndex(d => d.id === row.id);\r\n memos.splice(index,1); \r\n })\r\n .catch(({ response }) => {\r\n console.log('delete memo error => '+response.data.errors);\r\n });\r\n \r\n });\r\n };\r\n\r\n const search = reactive({searchValue : ''});\r\n const newMemo = reactive({memo : '', user_id : user.id});\r\n\r\n const createMemo = () =>{\r\n ApiService.setHeader();\r\n ApiService.post(\"memo\", newMemo as any)\r\n .then(({data}) =>{\r\n data.data['created_by'] = { name : user.name};\r\n memos.push(data.data);\r\n })\r\n .catch(({ response }) => {\r\n console.log('createMemo error => '+response.data.errors);\r\n Swal.fire({\r\n text: \"Failed to create the new memo\",\r\n icon: \"error\",\r\n buttonsStyling: false,\r\n confirmButtonText: \"Ok, got it!\",\r\n customClass: {\r\n confirmButton: \"btn btn-primary\",\r\n },\r\n });\r\n });\r\n\r\n newMemo.memo = '';\r\n }\r\n\r\n const getMemo = async () => {\r\n let memoTypeUrl = ''\r\n switch (props.memoType) {\r\n case 'Student':\r\n newMemo['student_id']=props.memoTypeId;\r\n memoTypeUrl = '/student/'+props.memoTypeId;\r\n break;\r\n case 'Subject':\r\n newMemo['subject_id']=props.memoTypeId;\r\n memoTypeUrl = '/subject/'+props.memoTypeId;\r\n break;\r\n case 'Agent':\r\n newMemo['agent_id']=props.memoTypeId;\r\n memoTypeUrl = '/agent/'+props.memoTypeId;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n await new Promise((resolve, reject) => { \r\n ApiService.setHeader(); \r\n ApiService.get(\"memo\"+memoTypeUrl)\r\n .then(({ data }) => {\r\n Object.assign(memos,data.data);\r\n resolve(data.data);\r\n })\r\n .catch(({ response }) => {\r\n console.log(response);\r\n reject(new Error ('getFinanceRecords error => '+response.data.errors));\r\n });\r\n });\r\n }\r\n\r\n onBeforeMount(() => {\r\n getMemo();\r\n })\r\n\r\n return {\r\n memos,\r\n pagedMemos,\r\n memoPageSize,\r\n page,\r\n search,\r\n newMemo,\r\n setPage,\r\n handleDelete,\r\n createMemo,\r\n moment,\r\n user\r\n };\r\n },\r\n});\r\n","import { render } from \"./Memo.vue?vue&type=template&id=c5cde19c&scoped=true\"\nimport script from \"./Memo.vue?vue&type=script&lang=ts\"\nexport * from \"./Memo.vue?vue&type=script&lang=ts\"\n\nimport \"./Memo.vue?vue&type=style&index=0&id=c5cde19c&scoped=true&lang=css\"\nscript.render = render\nscript.__scopeId = \"data-v-c5cde19c\"\n\nexport default script","import store from \"@/store\";\r\nimport { Actions } from \"@/store/enums/StoreEnums\";\r\n\r\n/**\r\n * Sets current page breadcrumbs\r\n * @param {string} pageTitle Current page title\r\n * @param {Array} breadcrumbs Current page breadcrumbs\r\n */\r\nexport const setCurrentPageBreadcrumbs = (\r\n pageTitle: string,\r\n breadcrumbs: Array\r\n): void => {\r\n store.dispatch(Actions.SET_BREADCRUMB_ACTION, {\r\n title: pageTitle,\r\n pageBreadcrumbPath: breadcrumbs,\r\n });\r\n};\r\n\r\n/**\r\n * Sets current page breadcrumbs\r\n * @param {string} title Current page title name\r\n */\r\nexport const setCurrentPageTitle = (title: string): void => {\r\n store.dispatch(Actions.SET_BREADCRUMB_ACTION, {\r\n title: title,\r\n });\r\n};\r\n"],"sourceRoot":""}