PageSourceSearch

https://creden.co/company/components/exportDoc.js?v=2_09

js creden.co collected 2026-09-29 14:38:52 UTC 16,846 bytes, 418 lines download raw bytes

1Pages.exportDoc = {
2    _template: 'exportDoc.html',
3    template: '<div>this is exportDoc.html</div>',
4    data: function () {
5        return {
6            lang_choose: localStorage.getItem('lang_choose') || 'en',
7            lang_bar: lang_company_exportDoc,
8            company_detail: company_detail,
9            documents: [],
10            showlist: true,
11            selectDocument: [],
12            selectFolder: [],
13            lengthDoc: -1,
14            count_check: 0,
15            mv_folder: [],
16            is_ldd: false,
17        }
18    },
19    mounted: function () {
20        this.get_doc_list();
21        this.check_is_ldd();
22        window.app = this;
23        this.openBar();
24
25        if (JSON.parse(localStorage.getItem("register_obj")).adminEmail) {
26            this.get_folder();
27        }
28    },
29
30    methods: {
31        check: function () {
32            var that = this;
33            $(".tab-del").addClass("hidden")
34            $("#checkall").change(function () {
35                var checked = $(this).is(':checked');
36                if (checked) {
37                    window.app.selectDocument = [];
38                    $(".checkfile").each(function () {
39                        $(this).prop("checked", true);
40                        $(".tab-del").removeClass("hidden")
41                        $(".tab-del").slideDown("slow");
42                    });
43                    for (i = 0; i < that.documents.length; i++) {
44                        that.selectDocument.push(that.documents[i]._id);
45                        that.count_check = that.documents.length
46                    }
47                } else {
48                    $(".checkfile").each(function () {
49                        $(this).prop("checked", false);
50                        // $(".tab-del").slideUp();
51                    });
52                    that.selectDocument = [];
53                    that.count_check = 0
54                }
55            });
56        },
57        check_is_ldd:function () {
58            //LDD Start
59            var that = this
60            var ldd = document.location.href
61            if(ldd.indexOf('esign.ldd') != -1) {
62                that.is_ldd = true
63            }
64            // END LDD
65        },
66        openBar: function () {
67            var that = this;
68
69            $(".tab-del").addClass("hidden")
70
71            if ($(".checkfile").is(':checked')) {
72                if (window.innerWidth > 991) {
73                    $(".tab-del").removeClass("hidden")
74                    $(".tab-del").slideDown("slow");
75                    
76                }
77            }
78            else {
79                $(".tab-del").slideUp();
80                that.count_check = 0
81            }
82            that.count_check = that.selectDocument.length
83
84        },
85        move_folder: function (id_doc, id_folder) {
86            var that = this
87            var data = []
88            var alert_move =""
89            var alert_move_success = ""
90            var aler_selecFol=""
91            if (this.lang_choose == 'th') {
92                alert_move = "ต้องการย้ายเอกสารหรือไม่"
93                alert_move_success = "ย้ายเอกสารเรียบร้อย"
94                aler_selecFol = "กรุณาเลือกแฟ้มเอกสาร"
95            } else {
96                alert_move = "Do you want to move document?"
97                alert_move_success = "Move document success"
98                aler_selecFol = "Please select folder"
99            }
100
101            if(that.selectFolder.length>0){
102
103                var conf = confirm(alert_move)
104            
105            if (conf == true) {
106                
107                for (i = 0; i < that.selectFolder.length; i++) {
108                    for (j = 0; j < that.selectDocument.length; j++) {
109                        console.log(that.selectFolder[i] + "||" + that.selectDocument[j]);
110                        data.push({ id_doc: that.selectDocument[j], id_folder: that.selectFolder[i] })
111                    }
112                }
113                $.ajax({
114                    type: "POST",
115                    url: document.location.origin + "/capi/move_folder",
116                    data: JSON.stringify(data),
117                    dataType: "json",
118                    success: function (res) {
119                        console.log(res.error_msg)
120                        document.location.reload()
121                        if (window.innerWidth > 991) {
122
123                            alert(alert_move_success)
124                            
125                        }else{
126                            $('#exampleModalLong').modal('toggle');
127                        }
128
129                    },
130                    error: function (request, status, error) {
131                        alert("|" + status + ' |' + error);
132                    }
133                });
134
135            }
136            }else{
137                
138                if (window.innerWidth > 991) {
139                    alert(aler_selecFol)
140                }else{
141                    alert(aler_selecFol)
142                }
143            }
144            
145           
146
147        },
148        get_folder: function () {
149            var that = this
150            var adminEmail = JSON.parse(localStorage.getItem("register_obj")).adminEmail || ""
151            that.mv_folder = []
152            // setTimeout(function(){ 
153
154            if (adminEmail) {
155                var data = { owner_folder: adminEmail }
156
157                $.ajax({
158                    type: "POST",
159                    url: document.location.origin + "/capi/get_folder",
160                    data: JSON.stringify(data),
161                    dataType: "json",
162                    success: function (res) {
163                        that.mv_folder = res.data
164                        // console.log(that.mv_folder)
165
166                    },
167                    error: function (request, status, error) {
168                        alert("|" + status + ' |' + error);
169                    }
170                });
171            }
172
173
174            //  }, 3000);
175
176        },
177        
178        get_doc_list: function () {
179            var that = this
180            var data = { company_id: company_detail.company_id, email: getUsername(), cat: 'owner' };
181            $.ajax({
182                type: "POST",
183                url: document.location.origin + "/capi/list_doc_company_by_category",
184                data: JSON.stringify(data),
185                dataType: "json",
186                success: function (res) {
187                    // console.log(res.data)
188                    var all_doc = res.data
189                    if(!all_doc.length) all_doc = []
190                   var chkcancel_doc = all_doc.filter(function(a){
191                        return a.status != 3 
192                    })
193                    that.documents = chkcancel_doc
194                    that.lengthDoc = that.documents.length;
195                    if(that.lengthDoc == undefined){
196                        that.lengthDoc = 0;
197                      }
198                    for (i = 0; i < that.documents.length; i++) {
199                        var dateTime1 = that.documents[i].time.substr(0, 10);
200                        var dateTime2 = that.documents[i].time.substr(11, 17);
201                        var signers = that.documents[i].signers.length
202
203                        that.documents[i].dTime1 = dateTime1;
204                        that.documents[i].dTime2 = dateTime2;
205                        that.documents[i].countsigner = signers;
206
207                        dateTime1 = "";
208                        dateTime2 = "";
209
210                        var chk_status = 0; 
211
212                        var chk_status_user = 0;
213                        for( j = 0; j < that.documents[i].fields.length ; j++ ){
214
215                            if(that.documents[i].fields[j].status == 1){
216                               if(that.documents[i].fields[j].email ==  getUsername()){
217                                    chk_status_user = 1
218                                }
219                            }else if(that.documents[i].fields[j].status == 0){
220                                if(that.documents[i].fields[j].email ==  getUsername()){
221                                    chk_status_user = 3
222                                }
223                               
224                            }
225
226                        } 
227                        var u_sign =that.documents[i].signers
228                            if(!u_sign.length) u_sign = []
229                            var chk_needtosign = u_sign.filter(function(u){
230                                return that.documents[i].signers.email == getUsername() && that.documents[i].signers.needToSign == false
231                            }).length
232
233                            if(chk_needtosign == 0 && chk_status_user == 0){
234                                chk_status_user = 2
235                            }
236                        
237                        that.documents[i].statusUser = chk_status_user
238
239
240
241// ---------------------------------------------------------------------------------------------------------
242
243                        for( j = 0; j < that.documents[i].signers.length ; j++ ){
244                        var fields_m = that.documents[i].fields
245                        
246                        if(!fields_m.length) fields_m = [] 
247
248                        var mail_sign = fields_m.filter(function(a){
249                            return that.documents[i].signers[j].email == a.email
250                        })
251
252                        var field_sign = fields_m.filter(function(a){
253                            return a.status == 1 && that.documents[i].signers[j].email == a.email
254                        })
255                        
256                           
257                            if(mail_sign.length == field_sign.length){
258                                 chk_status =  chk_status+1
259                            }else{
260                                 chk_status =  chk_status+0
261                            }
262                                
263                        } 
264
265                        that.documents[i].statusComp = chk_status
266                        if(chk_status == signers ){
267                            that.documents[i].status = 1
268                        }
269// ---------------------------------------------------------------------------------------------------------
270                    }
271                    that.documents.reverse();
272                },
273                error: function (request, status, error) {
274                    alert("|" + status + ' |' + error);
275                }
276            });
277        },delTash: function (id, subject) {
278
279            var that = this;
280            var url = api_host + 'delete_doc'
281            var langtextalert = ''
282            var alert_succes = ""
283            if (this.lang_choose == 'th') {
284                langtextalert = "คุณยืนยันที่จะลบข้อมูลอีเมล์นี้ใช่หรือไม่"
285                alert_succes = "ลบเอกสารเรียบร้อย"
286            } else {
287                langtextalert = "Do you confirm to delete this email information?"
288                alert_succes = "Document deleted"
289            }
290            var r = confirm(langtextalert);
291            if (r == true) {
292                txt = "You pressed OK!";
293                that = this;
294               
295                for (i = 0; i <that.documents.length; i++) {
296                    for( j = 0; j < that.selectDocument.length; j++)
297                    {
298                        if(that.documents[i]._id == that.selectDocument[j]){
299                         
300     
301                            $.ajax({
302                             url: url,
303                             type: "POST",
304                             data: 'id=' + that.documents[i].id + '&email=' + getUsername(),
305                            
306                             dataType: "json",
307                             success: function (result) {
308                                 that.get_doc_list();
309                                 if (window.innerWidth < 991) {
310                                    $('#close_modal_alldoc').click();
311                                    document.location.reload()
312                                }else{
313                                    that.close_tab();
314                                    get_dashboard()
315                                }
316                             },
317                             error: function (error) {
318                                 alert("Something went wrong!" + error);
319                             }
320                         })
321     
322     
323                        } 
324                    }
325                 }
326
327              
328            } else {
329                txt = "You pressed Cancel!";
330            }
331        },
332        close_tab: function(){
333            var that = this;
334            $(".tab-del").slideUp();
335                that.count_check = 0
336                that.selectDocument = []
337            $(".checkfile").each(function () {
338                $(this).prop("checked", false);
339            });
340            $("#checkall").prop("checked", false);
341        },
342        delTash2: function (id, subject) {
343            var that = this;
344            var url = api_host + 'delete_doc'
345            var r = confirm("คุณยืนยันที่จะลบข้อมูลอีเมล์นี้ใช่หรือไม่");
346            if (r == true) {
347                txt = "You pressed OK!";
348                $.ajax({
349                    url: url,
350                    type: "POST",
351                    data: 'id=' + id + '&email=' + getUsername(),
352                    success: function (result) {
353                        that.get_doc_list();
354                    },
355                    error: function (error) {
356                        alert("Something went wrong!" + error);
357                    }
358                })
359            } else {
360                txt = "You pressed Cancel!";
361            }
362        },
363        showSelect: function () {
364            // alert("fdfsfsdf")
365            $('.selectFile-mobile').removeClass("hidden");
366            $('#btn-selct').addClass("hidden");
367
368            $('.colInput').addClass("col-2");
369            $('.colInput').removeClass("col-0");
370
371            $('.colSubject').addClass("col-10");
372            $('.colSubject').removeClass("col-12");
373
374        },
375        cancleSelect: function () {
376            $('.selectFile-mobile').addClass("hidden");
377            $('#btn-selct').removeClass("hidden");
378
379            $('.colInput').addClass("col-0");
380            $('.colInput').removeClass("col-2");
381
382            $('.colSubject').addClass("col-12");
383            $('.colSubject').removeClass("col-10");
384
385        },
386        goKyc: function (ref_no) {
387            router.push({path:"document",query:{id:ref_no,p:'exportDocument'}})
388        }
389    }
390}
391
392routes.push({ path: '/exportDocument', component: Pages.exportDoc })
393//----------------------------------------------------------------------
394var lang_company_exportDoc = {
395    "exportDoc": { "th": "เอกสารที่ส่งออก", "en": "Sent" },
396    "notDoc": { "th": "คุณยังไม่มีเอกสารที่ส่งออก", "en": "You don't have any documents exported." },
397    "createDoc": { "th": "สร้างเอกสาร", "en": "Create document"},    
398    "subject": { "th": "เรื่อง", "en": "Subject" },
399    "currentbook": { "th": "เลขที่หนังสือ", "en": "Current number" },
400    "status": { "th": "สถานะ", "en": "Status" },
401    "date": { "th": "วันที่", "en": "Date" },
402    "form": { "th": "จาก", "en": "form" },
403    "sucsig": { "th": "สมบูรณ์", "en": "Complete" },
404    "notsucsig": { "th": "ยังไม่สมบูรณ์", "en": "Incomplete" },
405    "all": { "th": "ทั้งหมด", "en": "All" },
406    "signingorder": { "th": "ลำดับการเซ็น", "en": "Signing order" },
407    "signed": { "th": "คุณเซ็นแล้ว", "en": "Signed" },
408    "unsigned": { "th": "คุณยังไม่เซ็น", "en": "Unsigned" },
409    "select": { "th": "รายการ", "en": "Select" },
410    "selectFolder": { "th": "เลือกแฟ้มเอกสาร", "en": "Select Folder" },
411    "folder2": { "th": "แฟ้มที่มี", "en": "Folder" },
412    "move": { "th": "ย้ายไปที่", "en": "Move" },
413    "del": { "th": "ลบ", "en": "delete" },
414    "manage": { "th": "จัดการ", "en": "Manage" },
415    "cancel": { "th": "ยกเลิก", "en": "Cancel" },
416    "select2": { "th": "เลือก", "en": "Select" },
417    "viewonly": { "th": "ดูอย่างเดียว", "en": "View only" },
418}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.