added print files uploader
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<header class="main-header">
|
||||
|
||||
<!-- Logo -->
|
||||
<a href="index2.html" class="logo">
|
||||
<a href="{{ url('/admin') }}" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini"><b>C</b></span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
|
||||
@@ -114,7 +114,26 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||
width: 45px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
#image_preview img {
|
||||
height: 65px;
|
||||
width: 100%;
|
||||
}
|
||||
/* div#image_preview {
|
||||
column-count: 4;
|
||||
}
|
||||
*/
|
||||
.print-file-name{
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
border-top: 1px solid #e2e2e2;
|
||||
}
|
||||
|
||||
.print-file-holder{
|
||||
border: 1px solid #e2e2e2;
|
||||
margin-bottom: 10px;
|
||||
height: 100px;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<!--
|
||||
@@ -1222,6 +1241,22 @@ desired effect
|
||||
submitHandler: submitFormEditVisualizer
|
||||
});
|
||||
|
||||
$("#frm_upload_print_files").validate({
|
||||
rules: {},
|
||||
messages: {},
|
||||
errorPlacement: function(error, element) {
|
||||
var placement = $(element).data('error');
|
||||
if (placement) {
|
||||
$(placement).append(error);
|
||||
}else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
},
|
||||
submitHandler: submitFormUploadPrintFiles
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).on('button click', '#btn_delete_visualizer', function() {
|
||||
|
||||
if (!confirm("Are you sure you want to delete this Visualizer?")) {
|
||||
@@ -1282,7 +1317,25 @@ desired effect
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#uploadPrintFiles").change(function(){
|
||||
$('#image_preview').html("");
|
||||
var total_file=document.getElementById("uploadPrintFiles").files.length;
|
||||
|
||||
|
||||
for(var i=0;i<total_file;i++)
|
||||
{
|
||||
$('#image_preview').append("<div class='col-sm-3'> " +
|
||||
"<div class='print-file-holder'> " +
|
||||
"<img class='svg-print-file-preview' src='"+URL.createObjectURL(event.target.files[i])+"'> " +
|
||||
"<div class='print-file-name'>"+event.target.files[i]['name']+
|
||||
"</div> " +
|
||||
"</div> " +
|
||||
"</div>");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}); // end document ready
|
||||
|
||||
@@ -1472,7 +1525,36 @@ desired effect
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function submitFormUploadPrintFiles(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ url('admin/upload-print-file/save') }}",
|
||||
data: new FormData($('#frm_upload_print_files')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: 'json',
|
||||
beforeSend: function(xhr){
|
||||
$("#submitSaveBtn").attr('disabled', true);
|
||||
$("#submitSaveBtn").html('<i class="fa fa-spinner fa-spin"></i> Saving...');
|
||||
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
success: function (response) {
|
||||
console.log(response)
|
||||
if(response.success){
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function submitFormCreateStore(){
|
||||
$.ajax({
|
||||
|
||||
Reference in New Issue
Block a user