| @@ -1,7 +1,7 @@ | |||||
| const axios = require('axios').default; | const axios = require('axios').default; | ||||
| async function summaryList(token){ | async function summaryList(token){ | ||||
| const response = await axios.get(process.env.backend_url+'/api/pintar-summaries?populate=*',{ | |||||
| const response = await axios.get(process.env.backend_url+'/api/pintar-summaries?populate=*&sort[0]=id:desc',{ | |||||
| headers: {'Authorization': `Bearer ${token}`} | headers: {'Authorization': `Bearer ${token}`} | ||||
| }).catch((e)=>{ | }).catch((e)=>{ | ||||
| console.log(e.response.body); | console.log(e.response.body); | ||||
| @@ -47,7 +47,7 @@ async function paginationSummary(pageSize,page,id,token){ | |||||
| <th scope="row">${((obj.meta.pagination.page-1)*pageSize)+indx+1}</th> | <th scope="row">${((obj.meta.pagination.page-1)*pageSize)+indx+1}</th> | ||||
| <td>${i.attributes.company.data.attributes.Name}</td> | <td>${i.attributes.company.data.attributes.Name}</td> | ||||
| <td>${i.attributes.division.data.attributes.Name}</td> | <td>${i.attributes.division.data.attributes.Name}</td> | ||||
| <td>${i.attributes.Title??'-'}</td> | |||||
| <td>${i.attributes.Presented?moment(i.attributes.Presented,'MM/DD/YYYY').format('DD-MMM-YYYY'):'-'}</td> | |||||
| <td>${imgs}</td> | <td>${imgs}</td> | ||||
| <td>${(i.attributes.Video.data)?"<a href='"+i.attributes.Video.data.attributes.url+"' target='_blank'>video</a>":'-'}</td> | <td>${(i.attributes.Video.data)?"<a href='"+i.attributes.Video.data.attributes.url+"' target='_blank'>video</a>":'-'}</td> | ||||
| <td>${i.attributes.Name??'-'}</td> | <td>${i.attributes.Name??'-'}</td> | ||||
| @@ -885,3 +885,20 @@ $('#btnSharing').click(e => { | |||||
| e.preventDefault(); | e.preventDefault(); | ||||
| showForm('Sharing'); | showForm('Sharing'); | ||||
| }); | }); | ||||
| $('.exportSummary').click(async e => { | |||||
| e.preventDefault(); | |||||
| window.html2canvas = html2canvas; | |||||
| var doc = new jspdf.jsPDF('p', 'pt'); | |||||
| var source = window.document.getElementById("summaryTable"); | |||||
| await doc.html( | |||||
| source, | |||||
| { | |||||
| callback:function(pdf){ | |||||
| pdf.save(`${$('#summaryMaterial').text()}.pdf`); | |||||
| }, | |||||
| html2canvas: { scale: 0.75 }, | |||||
| } | |||||
| ); | |||||
| }); | |||||
| @@ -37,5 +37,7 @@ | |||||
| </body> | </body> | ||||
| <% include partials/modal/modal-register %> | <% include partials/modal/modal-register %> | ||||
| <% include partials/modal/modal-reset-password %> | <% include partials/modal/modal-reset-password %> | ||||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js" integrity="sha512-BNaRQnYJYiPSqHHDb58B0yaPfCu+Wgds8Gp/gU33kqBtgNS4tSPHuGibyoeqMV/TJlSKda6FXzoEyYGjTe+vXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> | |||||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> | |||||
| <script src="/js/main.js"></script> | <script src="/js/main.js"></script> | ||||
| </html> | </html> | ||||
| @@ -86,7 +86,7 @@ | |||||
| <form action="/user/change" method="POST"> | <form action="/user/change" method="POST"> | ||||
| <input name='user' type="hidden" value="<%= locals.users[i].id %>"> | <input name='user' type="hidden" value="<%= locals.users[i].id %>"> | ||||
| <input name='editor' type="hidden" value="<%= role == 'Sub-Admin'?1:0 %>"> | <input name='editor' type="hidden" value="<%= role == 'Sub-Admin'?1:0 %>"> | ||||
| <button type="submit" class="btn btn-primary btn-sm">Ubah</button> | |||||
| <!-- <button type="submit" class="btn btn-primary btn-sm">Ubah</button> --> | |||||
| </form> | </form> | ||||
| <% } %> | <% } %> | ||||
| </td> | </td> | ||||
| @@ -16,10 +16,10 @@ | |||||
| <th scope="col">No</th> | <th scope="col">No</th> | ||||
| <th scope="col">Company</th> | <th scope="col">Company</th> | ||||
| <th scope="col">Divisi</th> | <th scope="col">Divisi</th> | ||||
| <th scope="col">Materi</th> | |||||
| <th scope="col">Tanggal</th> | |||||
| <th class="text-center" scope="col">Gambar</th> | <th class="text-center" scope="col">Gambar</th> | ||||
| <th scope="col">Video</th> | <th scope="col">Video</th> | ||||
| <th scope="col">Presenter</th> | |||||
| <th scope="col">Oleh</th> | |||||
| <th scope="col">Peserta</th> | <th scope="col">Peserta</th> | ||||
| </tr> | </tr> | ||||
| </thead> | </thead> | ||||
| @@ -29,9 +29,11 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="modal-footer"> | |||||
| <div class="modal-footer justify-content-between"> | |||||
| <button type="button" class="btn btn-success btn-sm exportSummary">Export Pdf</button> | |||||
| <div> | |||||
| <nav aria-label="..."> | <nav aria-label="..."> | ||||
| <ul id="summaryPagination" class="pagination justify-content-end mb-0"> | |||||
| <ul id="summaryPagination" class="pagination mb-0"> | |||||
| <li class="page-item disabled"> | <li class="page-item disabled"> | ||||
| <a class="page-link" href="#" tabindex="-1"> | <a class="page-link" href="#" tabindex="-1"> | ||||
| <i class="fas fa-angle-left"></i> | <i class="fas fa-angle-left"></i> | ||||