Pages.Folder = { _template: 'folder_doc.html', template: '
this is folder_doc.html
', data: function () { return { lang_choose: localStorage.getItem('lang_choose') || 'th', lang_txt: lang_folder, display: false, name_folder: this.$route.query.name || "", list_document: [], list_document2: [], txt_search: "", filter: { doc: "", signer: "", send: "", date: "", }, count_check: 0, selectDocument: [], mv_folder: [], selectFolder: "", list_folder:[], } }, mounted: function () { window.myApp = this this.list_doc(this.$route.query.name, this.$route.query.id) this.get_folder() }, filters: { date(value) { value = value || '' var date = new Date(value) var day = date.getDate() var month = date.getMonth() + 1 var year = date.getFullYear() value = day + "/" + month + "/" + year return value || "" }, time(value) { value = value || '' var date = new Date(value) var horus = date.getHours() var minutes = date.getMinutes() var seconds = date.getSeconds() value = horus + ":" + minutes + ":" + seconds return value || "" } }, methods: { move_list_folder:function(){ var that = this if(that.list_folder.length > 0){ for(i = 0 ; i 0) { var total = 0 for (i = 0; i < signer.length; i++) { if (signer[i].needToSign == true) { var f_owner = fields.filter(function (f) { return (signer[i].email == f.email) }) var f_sign = fields.filter(function (f) { return (signer[i].email == f.email && f.status == 1) }) if (f_sign.length == f_owner.length) { total = total + 1 } } else { total = total + 1 } } return total } else { return signer.length } }, my_status_signer: function (signer, fields, status) { if (fields && fields.length > 0 && status == 0 || !status) { var email = getUsername() || "N/A" if(!fields.length) fields = [] var my = fields.filter(function (f) { return (f.email == email && f.status == "0") }) var other = fields.filter(function (f) { return (f.email != email && f.status == "0") }) if (my.length > 0) return "0" else if (my.length == 0 && other.length > 0) return "1" else return "" } else { return "" } }, gotoDoc: function (id) { document.location.href = "#/document?id=" + id }, set_table: function () { var that = this setTimeout(function () { table = $('#table').DataTable({ paging: true, searching: false, ordering: false, info: false, lengthChange: true, responsive: true, lengthMenu: [ [20, 50, 100, -1], [20, 50, 100, "ทั้งหมด"] ], dom: '<"top"i>rt<"bottom"flp><"clear">', language: { lengthMenu: "_MENU_", }, fnDrawCallback: function( oSettings ) { var list = document.getElementsByClassName("checkfile") var list_check = [] for(i=0; i 0) { list.sort(function (a, b) { return b.createdDtm - a.createdDtm }) for(i=0;i < list.length;i++) { list[i].diff_date = that.cal_date(list[i].createdDtm) } that.list_document = list that.list_document2 = list that.set_table() } else { that.set_table() } }, error: function (request, status, error) { router.push({ path: '/dashboard'}) // alert("|" + status + ' |' + error); } }); }, remove_doc_folder:function(){ var that = this var data = [] for (j = 0; j < that.selectDocument.length; j++){ data.push({id_doc: that.selectDocument[j], id_folder: that.$route.query.id}) } $.ajax({ type: "POST", url: api_host + "remove_doc_folder", data: JSON.stringify(data), dataType: "json", success: function (res) { // table.destroy() // setTimeout(function(){ // that.list_doc(that.$route.query.name, that.$route.query.id) // }, 1500); // that.count_check = 0 // that.selectDocument = [] document.location.reload() }, error: function (request, status, error) { alert("|" + status + ' |' + error); } }); }, check_all: function(s) { var that = this var all = document.getElementById("check_all") var list = document.getElementsByClassName("checkfile") if(all.checked){ for(i=0; i< list.length; i++) { list[i].checked = all.checked that.selectDocument.push(list[i].value) } var uniqueChars = [...new Set(that.selectDocument)]; that.selectDocument = uniqueChars that.count_check = that.selectDocument.length } else { var list_select = [] for(i=0; i< list.length; i++) { var select = that.selectDocument.find(function(s) { return list[i].value == s }) if(select) list_select.push(select) list[i].checked = all.checked } var remove_select = that.selectDocument.filter(function(s) { return list_select.indexOf(s) == -1; }); that.selectDocument = remove_select that.count_check = that.selectDocument.length } }, t_onover: function (id) { var selected = document.getElementById(id) var tooltip = new bootstrap.Tooltip(selected) tooltip.show() }, } } routes.push({ path: '/folder_doc', component: Pages.Folder }) var lang_folder = { "inbox_title": { "th": "เอกสารที่ได้รับ", "en": "Inbox" }, "adv_search": { "th": "ค้นหาขั้นสูง", "en": "Advanced search" }, "clear": { "th": "ล้าง", "en": "Clear" }, "des_search": { "th": "ชื่อเอกสาร, ผู้ส่ง, อีเมล", "en": "Subject, Sender, Email" }, "doc_status": { "th": "สถานะเอกสาร", "en": "Document Status" }, "sign_status": { "th": "สถานะการเซ็น", "en": "Signing Status" }, "sender": { "th": "ผู้ส่ง", "en": "Sender" }, "year": { "th": "12 เดือนย้อนหลัง", "en": "Last 12 months" }, "six": { "th": "6 เดือนย้อนหลัง", "en": "Last 6 months" }, "month": { "th": "30 วัน", "en": "Last 30 days" }, "week": { "th": "1 สัปดาห์", "en": "Last 1 weeks" }, "day": { "th": "1 วัน", "en": "Last 1 days" }, "me": { "th": "ฉัน", "en": "Me" }, "notme": { "th": "ไม่ใช่ฉัน", "en": "Not me" }, "date": { "th": "วันที่", "en": "Date" }, "subject": { "th": "เรื่อง", "en": "Subject" }, "status": { "th": "สถานะ", "en": "Status" }, "date_time": { "th": "วัน-เวลา", "en": "Date & Time" }, "sign": { "th": "เซ็นเอกสาร", "en": "Sign" }, "signed": { "th": "เซ็นแล้ว", "en": "Signed" }, "notsign": { "th": "ยังไม่ได้เซ็น", "en": "Not Sign" }, "exp_date": { "th": "หมดอายุเมื่อ", "en": "Expiration Date" }, "doc_cancel": { "th": "เอกสารถูกยกเลิก", "en": "Cancelled." }, "exp": { "th": "(หมดอายุ)", "en": "(Expired)" }, "list": { "th": "รายการ", "en": "List" }, "incomplete": { "th": "ยังไม่สมบูรณ์", "en": "Incomplete" }, "exp_soon": { "th": "หมดอายุเร็วๆ นี้", "en": "Expired soon" }, "complete": { "th": "เสร็จสมบูรณ์", "en": "Complete" }, "move": { "th": "ย้าย", "en": "Move to folder" }, "select_move": { "th": "แฟ้มที่ต้องการย้าย", "en": "Select Folder to Move" }, "confirm_move": { "th": "ยืนยันย้าย", "en": "Confirm to Move" }, "wait": { "th": "กรุณารอสักครู่..", "en": "Please wait.." }, "des_create_folder": { "th": "โฟลเดอร์นี้ไม่มีเอกสาร", "en": "This folder is empty." }, "expose": { "th": "นำออก", "en": "Remove" }, "cancelled": { "th": "ถูกยกเลิก", "en": "Cancelled" }, "action_requi": { "th": "ที่ต้องดำเนินการ", "en": "Action Required" }, "waiting_other": { "th": "รอคนอื่นดำเนินการ", "en": "Waiting for Others" }, }