/home/techb158/ileadtechnology.com/SSM/public/js/institute/document
Edit: /home/techb158/ileadtechnology.com/SSM/public/js/institute/document/index.js (21051B)
(window.webpackJsonp=window.webpackJsonp||[]).push([[251],{"1whF":function(t,e,s){"use strict";s.r(e);var i={components:{instituteDocumentForm:s("4RgY").a},data:function(){return{institute_documents:{total:0,data:[]},filter:{sort_by:"date_of_expiry",order:"desc",tag_id:[],expired:!1,expiring_in:0,keyword:"",page_length:helper.getConfig("page_length")},orderByOptions:[{value:"date_of_expiry",translation:i18n.institute.document_date_of_expiry},{value:"title",translation:i18n.institute.document_title},{value:"created_at",translation:i18n.general.created_at}],showCreatePanel:!1,showFilterPanel:!1,viewId:"",tag_options:[],selected_tags:null,institute_document:{},documents:[],showDetailModal:!1,help_topic:""}},mounted:function(){helper.hasPermission("list-institute-document")&&helper.hasPermission("create-institute-document")||(helper.notAccessibleMsg(),this.$router.push("/dashboard")),helper.hasPermission("list-institute-document")&&this.getInstituteDocuments(),helper.showDemoNotification(["institute"])},methods:{getConfig:function(t){return helper.getConfig(t)},hasPermission:function(t){return helper.hasPermission(t)},getInstituteDocuments:function(t){var e=this,s=this.$loading.show();"number"!=typeof t&&(t=1);var i=helper.getFilterURL(this.filter);axios.get("/api/institute/document?page="+t+i).then((function(t){e.institute_documents=t.institute_documents,e.tag_options=t.filters.tags,s.hide()})).catch((function(t){s.hide(),helper.showErrorMsg(t)}))},getInstituteDocument:function(){var t=this,e=this.$loading.show();axios.get("/api/institute/document/"+this.viewId).then((function(s){t.institute_document=s.institute_document,t.documents=s.documents,e.hide()})).catch((function(t){e.hide(),helper.showErrorMsg(t)}))},editInstituteDocument:function(t){this.$router.push("/institute/document/"+t.id+"/edit")},confirmDelete:function(t){var e=this;return function(s){return e.deleteInstituteDocument(t)}},deleteInstituteDocument:function(t){var e=this,s=this.$loading.show();axios.delete("/api/institute/document/"+t.id).then((function(t){toastr.success(t.message),e.getInstituteDocuments(),s.hide()})).catch((function(t){s.hide(),helper.showErrorMsg(t)}))},print:function(){var t=this.$loading.show();axios.post("/api/institute/document/print",{filter:this.filter}).then((function(e){var s=window.open("/print");t.hide(),s.document.write(e)})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},pdf:function(){var t=this,e=this.$loading.show();axios.post("/api/institute/document/pdf",{filter:this.filter}).then((function(s){e.hide(),window.open("/download/report/"+s+"?token="+t.authToken)})).catch((function(t){e.hide(),helper.showErrorMsg(t)}))},getStatus:function(t){return helper.getInstituteDocumentStatus(t)},showDetailAction:function(t){this.viewId=t.id,this.showDetailModal=!0},onTagSelect:function(t){this.filter.tag_id.push(t.slug)},onTagRemove:function(t){this.filter.tag_id.splice(this.filter.tag_id.indexOf(t.slug),1)}},filters:{moment:function(t){return helper.formatDate(t)},momentDateTime:function(t){return helper.formatDateTime(t)}},watch:{"filter.sort_by":function(t){this.getInstituteDocuments()},"filter.order":function(t){this.getInstituteDocuments()},"filter.page_length":function(t){this.getInstituteDocuments()},viewId:function(t){t?this.getInstituteDocument():(this.institute_document={},this.documents=[])}},computed:{authToken:function(){return helper.getAuthToken()}}},n=s("KHd+"),o=Object(n.a)(i,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("div",{staticClass:"page-titles"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-12 col-sm-6"},[s("h3",{staticClass:"text-themecolor"},[t._v(t._s(t.trans("institute.document"))+" \n "),t.institute_documents.total?s("span",{staticClass:"card-subtitle d-none d-sm-inline"},[t._v(t._s(t.trans("general.total_result_found",{count:t.institute_documents.total,from:t.institute_documents.from,to:t.institute_documents.to})))]):s("span",{staticClass:"card-subtitle d-none d-sm-inline"},[t._v(t._s(t.trans("general.no_result_found")))])])]),t._v(" "),s("div",{staticClass:"col-12 col-sm-6"},[s("div",{staticClass:"action-buttons pull-right"},[t.institute_documents.total&&!t.showCreatePanel&&t.hasPermission("create-institute-document")?s("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.trans("general.add_new"),expression:"trans('general.add_new')"}],staticClass:"btn btn-info btn-sm",on:{click:function(e){t.showCreatePanel=!t.showCreatePanel}}},[s("i",{staticClass:"fas fa-plus"}),t._v(" "),s("span",{staticClass:"d-none d-sm-inline"},[t._v(t._s(t.trans("institute.add_new_document")))])]):t._e(),t._v(" "),t.showFilterPanel?t._e():s("button",{staticClass:"btn btn-info btn-sm",on:{click:function(e){t.showFilterPanel=!t.showFilterPanel}}},[s("i",{staticClass:"fas fa-filter"}),t._v(" "),s("span",{staticClass:"d-none d-sm-inline"},[t._v(t._s(t.trans("general.filter")))])]),t._v(" "),s("sort-by",{attrs:{"order-by-options":t.orderByOptions,"sort-by":t.filter.sort_by,order:t.filter.order},on:{updateSortBy:function(e){t.filter.sort_by=e},updateOrder:function(e){t.filter.order=e}}}),t._v(" "),s("div",{staticClass:"btn-group"},[s("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.trans("general.more_option"),expression:"trans('general.more_option')"}],staticClass:"btn btn-info btn-sm dropdown-toggle no-caret ",attrs:{type:"button",role:"menu",id:"moreOption","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"}},[s("i",{staticClass:"fas fa-ellipsis-h"}),t._v(" "),s("span",{staticClass:"d-none d-sm-inline"})]),t._v(" "),s("div",{class:["dropdown-menu","ltr"==t.getConfig("direction")?"dropdown-menu-right":""],attrs:{"aria-labelledby":"moreOption"}},[s("button",{staticClass:"dropdown-item custom-dropdown",on:{click:t.print}},[s("i",{staticClass:"fas fa-print"}),t._v(" "+t._s(t.trans("general.print")))]),t._v(" "),s("button",{staticClass:"dropdown-item custom-dropdown",on:{click:t.pdf}},[s("i",{staticClass:"fas fa-file-pdf"}),t._v(" "+t._s(t.trans("general.generate_pdf")))])])]),t._v(" "),s("help-button",{on:{clicked:function(e){t.help_topic="institute.document"}}})],1)])])]),t._v(" "),s("div",{staticClass:"container-fluid"},[s("transition",{attrs:{name:"fade"}},[t.showFilterPanel?s("div",{staticClass:"card card-form"},[s("div",{staticClass:"card-body"},[s("h4",{staticClass:"card-title"},[t._v(t._s(t.trans("general.filter")))]),t._v(" "),s("div",{staticClass:"row"},[s("div",{staticClass:"col-12 col-sm-3"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("institute.document_keyword")))]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.filter.keyword,expression:"filter.keyword"}],staticClass:"form-control",attrs:{name:"keyword"},domProps:{value:t.filter.keyword},on:{input:function(e){e.target.composing||t.$set(t.filter,"keyword",e.target.value)}}})])]),t._v(" "),s("div",{staticClass:"col-12 col-sm-3"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("general.tags")))]),t._v(" "),s("v-select",{attrs:{label:"name","track-by":"slug",name:"tag_id",id:"tag_id",options:t.tag_options,placeholder:t.trans("general.select_tag"),multiple:!0,"close-on-select":!1,"clear-on-select":!1,"hide-selected":!0,selected:t.selected_tags},on:{select:t.onTagSelect,remove:t.onTagRemove},model:{value:t.selected_tags,callback:function(e){t.selected_tags=e},expression:"selected_tags"}},[t.tag_options.length?t._e():s("div",{staticClass:"multiselect__option",attrs:{slot:"afterList"},slot:"afterList"},[t._v("\n "+t._s(t.trans("general.no_option_found"))+"\n ")])])],1)]),t._v(" "),s("div",{staticClass:"col-12 col-sm-1"},[s("div",{staticClass:"form-group"},[s("div",[t._v(t._s(t.trans("institute.document_status_expired")))]),t._v(" "),s("switches",{staticClass:"m-t-20",attrs:{theme:"bootstrap",color:"success"},model:{value:t.filter.expired,callback:function(e){t.$set(t.filter,"expired",e)},expression:"filter.expired"}})],1)]),t._v(" "),t.filter.expired?t._e():s("div",{staticClass:"col-12 col-sm-3"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("institute.document_expiring_in_days")))]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.filter.expiring_in,expression:"filter.expiring_in"}],staticClass:"form-control",attrs:{type:"text",name:"expiring_in",placeholder:t.trans("institute.document_expiring_in_days")},domProps:{value:t.filter.expiring_in},on:{input:function(e){e.target.composing||t.$set(t.filter,"expiring_in",e.target.value)}}})])])]),t._v(" "),s("div",{staticClass:"card-footer text-right"},[s("button",{staticClass:"btn btn-danger",attrs:{type:"button"},on:{click:function(e){t.showFilterPanel=!1}}},[t._v(t._s(t.trans("general.cancel")))]),t._v(" "),s("button",{staticClass:"btn btn-info waves-effect waves-light",attrs:{type:"button"},on:{click:t.getInstituteDocuments}},[t._v(t._s(t.trans("general.filter")))])])])]):t._e()]),t._v(" "),t.hasPermission("create-institute-document")?s("transition",{attrs:{name:"fade"}},[t.showCreatePanel?s("div",{staticClass:"card card-form"},[s("div",{staticClass:"card-body"},[s("h4",{staticClass:"card-title"},[t._v(t._s(t.trans("institute.add_new_document")))]),t._v(" "),s("institute-document-form",{on:{completed:t.getInstituteDocuments,cancel:function(e){t.showCreatePanel=!t.showCreatePanel}}})],1)]):t._e()]):t._e(),t._v(" "),s("div",{staticClass:"card"},[s("div",{staticClass:"card-body"},[t.institute_documents.total?s("div",{staticClass:"table-responsive"},[s("table",{staticClass:"table table-sm"},[s("thead",[s("tr",[s("th",[t._v(t._s(t.trans("institute.document_title")))]),t._v(" "),s("th",[t._v(t._s(t.trans("institute.document_date_of_expiry")))]),t._v(" "),s("th",[t._v(t._s(t.trans("general.tags")))]),t._v(" "),s("th",[t._v(t._s(t.trans("institute.document_description")))]),t._v(" "),s("th",{staticClass:"table-option"},[t._v(t._s(t.trans("general.action")))])])]),t._v(" "),s("tbody",t._l(t.institute_documents.data,(function(e){return s("tr",[s("td",[t._v(t._s(e.title))]),t._v(" "),s("td",[e.date_of_expiry?s("span",[t._v("\n "+t._s(t._f("moment")(e.date_of_expiry))+"\n "),s("span",{class:["label","label-"+t.getStatus(e).color]},[t._v(t._s(t.trans("institute."+t.getStatus(e).status,{day:t.getStatus(e).day})))])]):s("span",[t._v("-")])]),t._v(" "),s("td",t._l(e.tags,(function(e){return s("span",{staticClass:"label label-success",staticStyle:{"margin-right":"3px"}},[t._v(t._s(e.name))])})),0),t._v(" "),s("td",[t._v(t._s(e.description))]),t._v(" "),s("td",{staticClass:"table-option"},[s("div",{staticClass:"btn-group"},[s("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.trans("institute.view_document"),expression:"trans('institute.view_document')"}],staticClass:"btn btn-success btn-sm",on:{click:function(s){return s.preventDefault(),t.showDetailAction(e)}}},[s("i",{staticClass:"fas fa-arrow-circle-right"})]),t._v(" "),s("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.trans("institute.edit_document"),expression:"trans('institute.edit_document')"}],staticClass:"btn btn-info btn-sm",on:{click:function(s){return s.preventDefault(),t.editInstituteDocument(e)}}},[s("i",{staticClass:"fas fa-edit"})]),t._v(" "),s("button",{directives:[{name:"confirm",rawName:"v-confirm",value:{ok:t.confirmDelete(e)},expression:"{ok: confirmDelete(institute_document)}"},{name:"tooltip",rawName:"v-tooltip",value:t.trans("institute.delete_document"),expression:"trans('institute.delete_document')"}],key:e.id,staticClass:"btn btn-danger btn-sm"},[s("i",{staticClass:"fas fa-trash"})])])])])})),0)])]):t._e(),t._v(" "),t.institute_documents.total?t._e():s("module-info",{attrs:{module:"institute",title:"document_module_title",description:"document_module_description",icon:"list"}},[s("div",{attrs:{slot:"btn"},slot:"btn"},[!t.showCreatePanel&&t.hasPermission("create-institute-document")?s("button",{staticClass:"btn btn-info btn-md",on:{click:function(e){t.showCreatePanel=!t.showCreatePanel}}},[s("i",{staticClass:"fas fa-plus"}),t._v(" "+t._s(t.trans("general.add_new")))]):t._e()])]),t._v(" "),s("pagination-record",{attrs:{"page-length":t.filter.page_length,records:t.institute_documents},on:{"update:pageLength":function(e){return t.$set(t.filter,"page_length",e)},"update:page-length":function(e){return t.$set(t.filter,"page_length",e)},updateRecords:t.getInstituteDocuments}})],1)])],1),t._v(" "),t.showDetailModal?s("transition",{attrs:{name:"modal"}},[s("div",{staticClass:"modal-mask"},[s("div",{staticClass:"modal-wrapper"},[s("div",{staticClass:"modal-container modal-lg"},[s("div",{staticClass:"modal-header"},[t._t("header",[t._v("\n "+t._s(t.institute_document.title)+"\n "),s("span",{staticClass:"float-right pointer",on:{click:function(e){t.showDetailModal=!1}}},[t._v("x")])])],2),t._v(" "),s("div",{staticClass:"modal-body"},[t._t("body",[t.institute_document.date_of_expiry?s("div",[t._v("\n "+t._s(t.trans("institute.document_date_of_expiry"))+": "+t._s(t._f("moment")(t.institute_document.date_of_expiry))+"\n "),s("span",{class:["label","label-"+t.getStatus(t.institute_document).color]},[t._v(t._s(t.trans("institute."+t.getStatus(t.institute_document).status,{day:t.getStatus(t.institute_document).day})))])]):t._e(),t._v(" "),s("div",{staticClass:"m-t-20",domProps:{innerHTML:t._s(t.institute_document.description)}}),t._v(" "),t.documents.length?s("div",[s("ul",{staticClass:"m-t-10 upload-file-list"},t._l(t.documents,(function(e){return s("li",{staticClass:"upload-file-list-item"},[s("a",{staticClass:"no-link-color",attrs:{href:"/institute/document/"+t.institute_document.id+"/attachment/"+e.uuid+"/download?token="+t.authToken}},[s("i",{class:["file-icon","fas","fa-lg",e.file_info.icon]}),t._v(" "),s("span",{staticClass:"upload-file-list-item-size"},[t._v(t._s(e.file_info.size))]),t._v(" "+t._s(e.user_filename)+" ")])])})),0)]):t._e(),t._v(" "),s("hr"),t._v(" "),s("p",[s("i",{staticClass:"far fa-clock"}),t._v(" "),s("small",[t._v(t._s(t.trans("general.created_at"))+" "+t._s(t._f("momentDateTime")(t.institute_document.created_at)))]),t._v(" "),s("span",{staticClass:"pull-right"},[s("i",{staticClass:"far fa-clock"}),t._v(" "),s("small",[t._v(t._s(t.trans("general.updated_at"))+" "+t._s(t._f("momentDateTime")(t.institute_document.updated_at)))])])]),t._v(" "),s("div",{staticClass:"clearfix"})])],2)])])])]):t._e(),t._v(" "),s("right-panel",{attrs:{topic:t.help_topic}})],1)}),[],!1,null,null,null);e.default=o.exports},"4RgY":function(t,e,s){"use strict";var i={components:{},props:["id"],data:function(){return{instituteDocumentForm:new Form({title:"",tags:[],date_of_expiry:"",description:"",upload_token:""}),tag_options:[],clearAttachment:!1,module_id:""}},mounted:function(){this.instituteDocumentForm.upload_token=this.$uuid.v4(),this.getPreRequisite(),this.id&&this.getDocument()},methods:{proceed:function(){this.id?this.updateDocument():this.storeDocument()},getPreRequisite:function(){var t=this,e=this.$loading.show();axios.get("/api/institute/document/pre-requisite").then((function(s){t.tag_options=s.tags,e.hide()})).catch((function(t){e.hide(),helper.showErrorMsg(t)}))},storeDocument:function(){var t=this,e=this.$loading.show();this.instituteDocumentForm.date_of_expiry=helper.toDate(this.instituteDocumentForm.date_of_expiry),this.instituteDocumentForm.post("/api/institute/document").then((function(s){toastr.success(s.message),t.clearAttachment=!t.clearAttachment,t.$emit("completed"),t.instituteDocumentForm.upload_token=t.$uuid.v4(),e.hide()})).catch((function(t){e.hide(),helper.showErrorMsg(t)}))},getDocument:function(){var t=this,e=this.$loading.show();axios.get("/api/institute/document/"+this.id).then((function(s){t.instituteDocumentForm.title=s.institute_document.title,t.instituteDocumentForm.date_of_expiry=s.institute_document.date_of_expiry,s.institute_document.tags.forEach((function(e){t.instituteDocumentForm.tags.push({name:e.name,slug:e.slug})})),t.instituteDocumentForm.description=s.institute_document.description,t.instituteDocumentForm.upload_token=s.institute_document.upload_token,t.module_id=s.institute_document.id,e.hide()})).catch((function(s){e.hide(),t.$router.push("/institute/document")}))},updateDocument:function(){var t=this,e=this.$loading.show();this.instituteDocumentForm.date_of_expiry=helper.toDate(this.instituteDocumentForm.date_of_expiry),this.instituteDocumentForm.patch("/api/institute/document/"+this.id).then((function(s){toastr.success(s.message),t.$emit("completed"),e.hide(),t.$router.push("/institute/document")})).catch((function(t){e.hide(),helper.showErrorMsg(t)}))},addTag:function(t){var e={name:t,slug:t.substring(0,2)+Math.floor(1e7*Math.random())};this.tag_options.push(e),this.instituteDocumentForm.tags.push(e)}},watch:{}},n=s("KHd+"),o=Object(n.a)(i,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("form",{on:{submit:function(e){return e.preventDefault(),t.proceed(e)},keydown:function(e){return t.instituteDocumentForm.errors.clear(e.target.name)}}},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-12 col-sm-6"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("institute.document_title")))]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.instituteDocumentForm.title,expression:"instituteDocumentForm.title"}],staticClass:"form-control",attrs:{type:"text",name:"title",placeholder:t.trans("institute.document_title")},domProps:{value:t.instituteDocumentForm.title},on:{input:function(e){e.target.composing||t.$set(t.instituteDocumentForm,"title",e.target.value)}}}),t._v(" "),s("show-error",{attrs:{"form-name":t.instituteDocumentForm,"prop-name":"title"}})],1)]),t._v(" "),s("div",{staticClass:"col-12 col-sm-3"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("general.tags")))]),t._v(" "),s("v-select",{attrs:{"tag-placeholder":t.trans("general.add_this_as_new_tag"),placeholder:t.trans("general.search_or_add_a_tag"),label:"name","track-by":"slug",options:t.tag_options,name:"tag",multiple:!0,taggable:!0},on:{tag:t.addTag},model:{value:t.instituteDocumentForm.tags,callback:function(e){t.$set(t.instituteDocumentForm,"tags",e)},expression:"instituteDocumentForm.tags"}}),t._v(" "),s("show-error",{attrs:{"form-name":t.instituteDocumentForm,"prop-name":"tag"}})],1)]),t._v(" "),s("div",{staticClass:"col-12 col-sm-3"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("institute.document_date_of_expiry")))]),t._v(" "),s("datepicker",{attrs:{bootstrapStyling:!0,placeholder:t.trans("institute.document_date_of_expiry")},on:{selected:function(e){return t.instituteDocumentForm.errors.clear("date_of_expiry")}},model:{value:t.instituteDocumentForm.date_of_expiry,callback:function(e){t.$set(t.instituteDocumentForm,"date_of_expiry",e)},expression:"instituteDocumentForm.date_of_expiry"}}),t._v(" "),s("show-error",{attrs:{"form-name":t.instituteDocumentForm,"prop-name":"date_of_expiry"}})],1)]),t._v(" "),s("div",{staticClass:"col-12 col-sm-12"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("institute.document_description")))]),t._v(" "),s("autosize-textarea",{attrs:{rows:"2",name:"description",placeholder:t.trans("institute.document_description")},model:{value:t.instituteDocumentForm.description,callback:function(e){t.$set(t.instituteDocumentForm,"description",e)},expression:"instituteDocumentForm.description"}}),t._v(" "),s("show-error",{attrs:{"form-name":t.instituteDocumentForm,"prop-name":"description"}})],1)])]),t._v(" "),s("div",{staticClass:"row"},[s("div",{staticClass:"col-12"},[s("label",[t._v(" ")]),t._v(" "),s("div",{staticClass:"form-group"},[s("file-upload-input",{attrs:{"button-text":t.trans("general.upload_document"),token:t.instituteDocumentForm.upload_token,module:"institute_document","clear-file":t.clearAttachment,"module-id":t.module_id}})],1)])]),t._v(" "),s("div",{staticClass:"card-footer text-right"},[s("router-link",{directives:[{name:"show",rawName:"v-show",value:t.id,expression:"id"}],staticClass:"btn btn-danger waves-effect waves-light ",attrs:{to:"/institute/document"}},[t._v(t._s(t.trans("general.cancel")))]),t._v(" "),t.id?t._e():s("button",{staticClass:"btn btn-danger waves-effect waves-light ",attrs:{type:"button"},on:{click:function(e){return t.$emit("cancel")}}},[t._v(t._s(t.trans("general.cancel")))]),t._v(" "),s("button",{staticClass:"btn btn-info waves-effect waves-light",attrs:{type:"submit"}},[t.id?s("span",[t._v(t._s(t.trans("general.update")))]):s("span",[t._v(t._s(t.trans("general.save")))])])],1)])])}),[],!1,null,null,null);e.a=o.exports}}]);
//# sourceMappingURL=index.js.map?id=fafdcf0d5189c73b6ae2