$(document).ready(function(){
var $form_group_prefix = '_form_group_for_';
var $field_prefix = 'form_field_';
var $error_class = 'has-error animated rubberBand';
var s = '';
var p = 'C-10-RPF56';
var id = '1765734663';
var fileName = '';
var filesList = [];
window.mivauploadformHtml = `
File Upload
`;
$('body').append(mivauploadformHtml);
setTimeout(function(){
$('#mivauploadmodal-1765734663').modal({
show:false,
keyboard:true,
backdrop:'static',
});
},10);
$('#mivafileupload').closest('.product_attribute_container').html(``);
$('body').on('click','#openUploadModal-1765734663',function(e){
e.preventDefault();
var email = '';
var el = null;
$('#__product_attr_col input, #__product_attr_col select').each(function(){
if($(this).hasClass('email-field')){
email = $(this).val();
el = $(this);
}
});
if(email!=""){
$('#email-1765734663').val();
}
$('#mivauploadmodal-1765734663').modal('show');
});
$('body').on('click','#submitdyn-1765734663',function(){
var email = $('#email-1765734663').val().trim();
if(email == ''){
showError("please enter your email address");
return;
}
if(!validate_email(email)){
showError("please enter a valid email address");
return;
}
$('#__product_attr_col input, #__product_attr_col select').each(function(){
if($(this).hasClass('email-field')){
$(this).val(email);
}
});
if($('#filetoupload-1765734663').val()==''){
showError("please add your file for upload");
return;
}
fileName = $('#filetoupload-1765734663').val();
sendData();
});
function validate_email(email) {
if(email==''){return false;}
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
function field_error($this,$message=''){
if($message!=''){
alert($message);
}
var $id = $this.attr('id');
var $p = $this.closest('.form-group');
$('#'+$form_group_prefix+$id).addClass($error_class);
$this.focus();
$this.select();
if($p){
$('html, body').animate({
scrollTop: $p.offset().top-40
}, 200);
}
return false;
}
function sendData(){
var formData = new FormData($('#mivafileuploadform-1765734663')[0]);
var loc = `https://www.all-stickers.com/stickercom/miva-upload-2/index.php?_s=${s}&product=${p}`;
if(window.location.hostname == 'localhost'){
loc = `http://localhost/stickercom/miva-upload-2/index.php?_s=${s}&product=${p}`;
}
$('#message-1765734663').html(`
Your File was uploaded Successfully, you can upload more files if needed just select a new file below. To complete your order close this window and continue filling out your information. We will send you an artwork proof for your approval before processing your payment.
`);
$('#filetoupload-1765734663').val('');
$('#submitdyn-1765734663').html("Upload another file");
var t = fileName.split("\\");
filesList.push(t[t.length-1]);
fileName = '';
$("#filelist-1765734663").html(`
Files uploaded
${filesList.join('
')}
`);
}
// formSuccess(data);
},
});
}
function showError(message){
$("#message-1765734663").html(`