|
@@ -66,20 +66,30 @@ function init_components_part(input){
|
|
|
},
|
|
|
skin : function(item){
|
|
|
var html = '';
|
|
|
-
|
|
|
- var re = new RegExp(partPicker.val(),"gi");
|
|
|
+ name = item.name;
|
|
|
+
|
|
|
|
|
|
name = item.name.replace(re, function (x) {
|
|
|
return '<strong>'+x+'</strong>';
|
|
|
- });
|
|
|
+ });*/
|
|
|
|
|
|
- html += '<div class="part-logo d-inline mr-2"><img src="'+item.picture+'" class="avatar-mini avatar-rounded"></div>';
|
|
|
+ html += '<div class="part-logo d-inline mr-2"><img src="data:'+item.picture+'" class="avatar-mini avatar-rounded"></div>';
|
|
|
html += '<div class="user-infos d-inline"><span>'+name+'</span>';
|
|
|
html += '<div class="clear"></div>';
|
|
|
|
|
|
return html;
|
|
|
},
|
|
|
+ highlight : function(item){
|
|
|
+ return item;
|
|
|
+ },
|
|
|
onClick : function(selected,element){
|
|
|
+ console.log(selected,element);
|
|
|
+ var li = $(element).closest('li');
|
|
|
+ li.attr('data-part',selected.id);
|
|
|
+ li.find('.price input').val(selected.price);
|
|
|
+ li.find('.brand input').val(selected.brand);
|
|
|
+ li.find('.part-image').css('background','url(data:'+selected.picture+') 0% 0% / cover');
|
|
|
+ li.find('.part-image').attr('data-stream','data:'+selected.picture);
|
|
|
input.val(selected.id);
|
|
|
input.trigger('change');
|
|
|
},
|
|
@@ -106,21 +116,23 @@ function init_components_dropimage(input){
|
|
|
input.css('cursor','pointer');
|
|
|
}
|
|
|
|
|
|
+
|
|
|
input.click(function(e){
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
|
|
|
|
picker.trigger('click');
|
|
|
picker.change(function(){
|
|
|
+ preloader(true);
|
|
|
var file = picker.get(0).files[0];
|
|
|
var reader = new FileReader();
|
|
|
reader.addEventListener("load", function () {
|
|
|
-
|
|
|
+
|
|
|
input.attr('src',reader.result);
|
|
|
if(input.attr('data-callback')!=""){
|
|
|
var callback = input.attr('data-callback');
|
|
|
-
|
|
|
window[callback](input,reader.result);
|
|
|
+ preloader(false);
|
|
|
}
|
|
|
|
|
|
}, false);
|
|
@@ -132,16 +144,25 @@ function init_components_dropimage(input){
|
|
|
e.stopPropagation();
|
|
|
})
|
|
|
input.on('drop', function (e) {
|
|
|
+ preloader(true);
|
|
|
var droppedFiles = e.originalEvent.dataTransfer.files;
|
|
|
var reader = new FileReader();
|
|
|
reader.readAsDataURL(droppedFiles[0]);
|
|
|
reader.onload = function () {
|
|
|
|
|
|
input.attr('src',reader.result);
|
|
|
+ if(input.attr('data-callback')!=""){
|
|
|
+ var callback = input.attr('data-callback');
|
|
|
+ window[callback](input,reader.result);
|
|
|
+ preloader(false);
|
|
|
+ }
|
|
|
};
|
|
|
reader.onerror = function (error) {
|
|
|
console.log('Error: ', error);
|
|
|
+ preloader(false);
|
|
|
};
|
|
|
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+
|