var EcommerceProductsEdit=function(){var handleImages=function(){var uploader=new plupload.Uploader({runtimes:'html5,flash,silverlight,html4',browse_button:document.getElementById('tab_images_uploader_pickfiles'),container:document.getElementById('tab_images_uploader_container'),url:"assets/plugins/plupload/examples/upload.php",filters:{max_file_size:'10mb',mime_types:[{title:"Image files",extensions:"jpg,gif,png"},{title:"Zip files",extensions:"zip"}]},flash_swf_url:'assets/plugins/plupload/js/Moxie.swf',silverlight_xap_url:'assets/plugins/plupload/js/Moxie.xap',init:{PostInit:function(){$('#tab_images_uploader_filelist').html("");$('#tab_images_uploader_uploadfiles').click(function(){uploader.start();return false;});$('#tab_images_uploader_filelist').on('click','.added-files .remove',function(){uploader.removeFile($(this).parent('.added-files').attr("id"));$(this).parent('.added-files').remove();});},FilesAdded:function(up,files){plupload.each(files,function(file){$('#tab_images_uploader_filelist').append('<div class="alert alert-warning added-files" id="uploaded_file_'+file.id+'">'+file.name+'('+plupload.formatSize(file.size)+') <span class="status label label-info"></span>&nbsp;<a href="javascript:;" style="margin-top:-5px" class="remove pull-right btn btn-sm red"><i class="fa fa-times"></i> remove</a></div>');});},UploadProgress:function(up,file){$('#uploaded_file_'+file.id+' > .status').html(file.percent+'%');},FileUploaded:function(up,file,response){var response=$.parseJSON(response.response);if(response.result&&response.result=='OK'){var id=response.id;$('#uploaded_file_'+file.id+' > .status').removeClass("label-info").addClass("label-success").html('<i class="fa fa-check"></i> Done');}else{$('#uploaded_file_'+file.id+' > .status').removeClass("label-info").addClass("label-danger").html('<i class="fa fa-warning"></i> Failed');Metronic.alert({type:'danger',message:'One of uploads failed. Please retry.',closeInSeconds:10,icon:'warning'});}},Error:function(up,err){Metronic.alert({type:'danger',message:err.message,closeInSeconds:10,icon:'warning'});}}});uploader.init();}
var handleReviews=function(){var grid=new Datatable();grid.init({src:$("#datatable_reviews"),onSuccess:function(grid){},onError:function(grid){//
},loadingMessage:'Loading...',dataTable:{"lengthMenu":[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],"pageLength":10,"ajax":{"url":"demo/ecommerce_product_reviews.php",},"columnDefs":[{'orderable':true,'targets':[0]}],"order":[[0,"asc"]]}});}
var handleHistory=function(){var grid=new Datatable();grid.init({src:$("#datatable_history"),onSuccess:function(grid){},onError:function(grid){},loadingMessage:'Loading...',dataTable:{//
"lengthMenu":[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],"pageLength":10,"ajax":{"url":"demo/ecommerce_product_history.php",},"columnDefs":[{'orderable':true,'targets':[0]}],"order":[[0,"asc"]]}});}
var initComponents=function(){$('.date-picker').datepicker({rtl:Metronic.isRTL(),autoclose:true});$(".datetime-picker").datetimepicker({isRTL:Metronic.isRTL(),autoclose:true,todayBtn:true,pickerPosition:(Metronic.isRTL()?"bottom-right":"bottom-left"),minuteStep:10});$('.maxlength-handler').maxlength({limitReachedClass:"label label-danger",alwaysShow:true,threshold:5});}
return{init:function(){initComponents();handleImages();handleReviews();handleHistory();}};}();