eLBati
2015-11-26 16:07:01 +01:00
parent e2bb37fe8f
commit fdc4c37931

View File

@@ -1,4 +1,5 @@
openerp.web_widget_digital_signature = function(instance) { openerp.web_widget_digital_signature = function(instance) {
"use strict";
var _t = instance.web._t; var _t = instance.web._t;
var QWeb = instance.web.qweb; var QWeb = instance.web.qweb;
var images = {} var images = {}
@@ -57,22 +58,22 @@ openerp.web_widget_digital_signature = function(instance) {
this.$el.find('> canvas').remove(); this.$el.find('> canvas').remove();
if(! this.get('value')){ if(! this.get('value')){
this.$el.find('> img').remove(); this.$el.find('> img').remove();
$(this.$el[0]).find(".signature").signature(sign_options); this.$el.find(".signature").signature(sign_options);
}else if(this.get('value')){ }else if(this.get('value')){
this.$el.prepend($img); this.$el.prepend($img);
} }
} }
$(this.$el[0]).find('.clear_sign').click(function(){ this.$el.find('.clear_sign').click(function(){
self.$el.find('> img').remove(); self.$el.find('> img').remove();
images[self.name] = "" images[self.name] = ""
$(self.$el[0]).find(".signature").show(); self.$el.find(".signature").show();
$(self.$el[0]).find(".signature").signature('clear'); self.$el.find(".signature").signature('clear');
}); });
$('.save_sign').click(function(){ $('.save_sign').click(function(){
var val var val
if($(self.$el[0]).find(".signature").hasClass( "kbw-signature" ) && ! $(self.$el[0]).find(".signature").signature('isEmpty')){ if(self.$el.find(".signature").hasClass( "kbw-signature" ) && ! self.$el.find(".signature").signature('isEmpty')){
$(self.$el[0]).find(".signature").hide(); self.$el.find(".signature").hide();
val = $(self.$el[0]).find(".signature > canvas")[0].toDataURL(); val = self.$el.find(".signature > canvas")[0].toDataURL();
images[self.name] = val.split(',')[1] images[self.name] = val.split(',')[1]
var $img = $(QWeb.render("FieldBinaryImage-extend", { widget: self, url: val })); var $img = $(QWeb.render("FieldBinaryImage-extend", { widget: self, url: val }));
self.$el.find('> img').remove(); self.$el.find('> img').remove();