File manager - Edit - /home/autoph/public_html/projects/document_tracking/public/js/document.js
Back
function toastRNoTime(message, type, btnType){ toastr.options = { "closeButton": false, "debug": false, "newestOnTop": false, "progressBar": false, "positionClass": "toast-top-right", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "5000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" } switch (type){ case 'success': toastr.success(message) toastr.options.onHidden = function(){ $('#return_sender').attr("disabled", true); } break; case 'info': toastr.info(message) break; case 'warning': toastr.warning(message) break; case 'error': toastr.error(message) break; } } function toastRWithTime(message, type, btnType){ toastr.options = { "closeButton": false, "debug": false, "newestOnTop": false, "progressBar": true, "positionClass": "toast-top-right", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "5000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" } switch (type){ case 'success': toastr.success(message) break; case 'info': toastr.info(message) break; case 'warning': toastr.warning(message) break; case 'error': toastr.error(message) break; } } $(document).ready(function(){ var access_token = localStorage.getItem("token"); if(access_token == null){ window.location.assign('/'); } $.ajax({ type: "GET", url: "api/v2/document/fetchall", dataType: 'json', headers:{ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'), 'Authorization': 'Bearer ' + access_token}, success: function(data){ if(data.data.length == 0){ $('#progress_display').show(); } console.log(data.data); $.each(data.data, function(key, value){ console.log(data.data); var id = value.id; var tr = $("<tr>"); tr.append($("<td>").html(value.ctr_no)); tr.append($("<td>").html(value.dc_ttl)); tr.append($("<td>").html(value.shrt_dsc)); tr.append($("<td>").html(value.lng_dsc)); tr.append($("<td>").html(moment(value.c_at).format("dddd, MMMM Do YYYY, h:mm:ss a"))); tr.append($("<td>").html(moment(value.d_dt).format("dddd, MMMM Do YYYY, h:mm:ss a"))); tr.append($("<td align='center'><a href='#' id='deleteBtn' data-id="+ id + ">Remove</a></td>>")); $("#documentshow").append(tr); }); }, error: function(error){ } }); $('#cc_checkbox').change(function(){ if($(this).is(':checked')){ $('#cc_select').show(); } else { $('#cc_select').hide(); } }); $("#rowAdder").click(function () { newRowAdd = '<div id="row"> <div class="input-group m-3">' + '<div class="input-group-prepend">' + '<button class="btn btn-primary" id="DeleteRow" type="button">' + '<i class="bi bi-trash"></i> Delete</button> </div>' + '<input type="file" class="form-control m-input" name="documents[]" id="documents"> </div> </div>'; $('#newinput').append(newRowAdd); }); $("body").on("click", "#DeleteRow", function () { $(this).parents("#row").remove(); }); $('#document_save').click(function(e){ $form = $('#create-document')[0]; docs = new FormData($form); e.preventDefault(); // console.log(values); $.ajax({ type: "POST", url: "api/document", datatype: "json", data: docs, processData: false, // tell jQuery not to process the data contentType: false, // tell jQuery not to set contentType headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'), 'Authorization': 'Bearer ' + access_token}, success: function(response){ toastRNoTime("file created successfuly","success"); $('#exampleModal').hide('hide'); location.reload(); console.log(response); }, error: function(e){ alert("something went wrong. Please try again"); } }); }); });
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings