NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

odoo.define('point_of_purchase.PurchaseOrdersPopupSign', function (require) {
'use strict';

const { useState } = owl.hooks;
const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup');
const Registries = require('point_of_sale.Registries');
const { _lt } = require('@web/core/l10n/translation');

class PurchaseOrdersPopupSign extends AbstractAwaitablePopup {
constructor() {
super(...arguments);
this.signatureData = useState({});
this.signaturePad = null // Reference to the signature drawing pad
this.drawSignature();
// const signaturePadElement = $('.signature-pad'); // Replace with your HTML structure
}

async drawSignature() {
debugger;
// console.log($('.signature-pad'),"TTTTTTTTTTTTTTTTTTT");
// console.log(signaturePad,"TTTTTTTTTTTTTTTTTTT");
if (!this.signaturePad) {
const signaturePadElement = $('.signature-pad'); // Replace with your HTML structure
$(".signature-pad").jSignature({});
// this.signaturePad = new SignaturePad(signaturePadElement, {
// Configure signature pad options if needed
// });
}
}

async confirmSignature() {
debugger;
const signatureDataUrl = this.signaturePad.toDataURL(); // Get the signature as a data URL
this.signatureData.value = signatureDataUrl; // Save the signature data
this.trigger('close-popup', { confirmed: true });
}
}
PurchaseOrdersPopupSign.template = 'PurchaseOrdersPopupSign';
PurchaseOrdersPopupSign.defaultProps = {
confirmText: _lt('Confirm'),
cancelText: _lt('Cancel'),
title: _lt('Select'),
body: '',
list: [],
};

Registries.Component.add(PurchaseOrdersPopupSign);

return PurchaseOrdersPopupSign;
});

//
//odoo.define('point_of_purchase.PurchaseOrdersPopupSign', function (require) {
// "use strict";
//
// var core = require('web.core');
// var BasicFields= require('web.basic_fields');
// var FormController = require('web.FormController');
// var Registry = require('web.field_registry');
// var utils = require('web.utils');
// var session = require('web.session');
// var field_utils = require('web.field_utils');
//
// var _t = core._t;
// var QWeb = core.qweb;
//
// var FieldSignature = BasicFields.FieldBinaryImage.extend( {
// template: 'FieldSignature',
// events: _.extend({}, BasicFields.FieldBinaryImage.prototype.events, {
// 'click .save_sign': '_on_save_sign',
// 'click #sign_clean': '_on_clear_sign',
// }),
// jsLibs: ['/point_of_purchase/lib/jSignatureCustom.js'],
// init: function (parent, name, record) {
// this._super.apply(this, arguments);
// this.sign_options = {
// 'decor-color': '#D1D0CE',
// 'color': '#000',
// 'background-color': '#fff',
// 'height': '150',
// 'width': '550',
// };
// this.empty_sign = [];
// },
// start: function () {
// var self = this;
// this.$(".signature").jSignature("init", this.sign_options);
// this.$(".signature").attr( {
// "tabindex": "0",
// 'height': "100",
// });
// this.empty_sign = this.$(".signature").jSignature("getData",
// 'image');
// self._render();
// },
// _on_clear_sign: function () {
// this.$(".signature > canvas").remove();
// this.$('> img').remove();
// this.$(".signature").attr("tabindex", "0");
// var sign_options = {
// 'decor-color': '#D1D0CE',
// 'color': '#000',
// 'background-color': '#fff',
// 'height': '150',
// 'width': '550',
// 'clear': true,
// };
// this.$(".signature").jSignature(sign_options);
// this.$(".signature").focus();
// this._setValue(false);
// },
// _on_save_sign: function (value_) {
// var self = this;
// this.$('> img').remove();
// var signature = this.$(".signature").jSignature("getData", 'image');
// var is_empty = signature ?
// self.empty_sign[1] === signature[1] :
// false;
// if (!is_empty && typeof signature !== "undefined" && signature[1]) {
// this._setValue(signature[1]);
// }
// },
// _render: function () {
// var self = this;
// var url = this.placeholder;
// if (this.value && !utils.is_bin_size(this.value)) {
// url = 'data:image/png;base64,' + this.value;
// } else if (this.value) {
// url = session.url('/web/image', {
// model: this.model,
// id: JSON.stringify(this.res_id),
// field: this.nodeOptions.preview_image || this.name,
// unique:
// field_utils.format.datetime(
// this.recordData.__last_update).replace(/[^0-9]/g, ''),
// });
// } else {
// url = this.placeholder;
// }
// if (this.mode === "readonly") {
// var $img = $(QWeb.render("FieldBinaryImage-img", {
// widget: self,
// url: url,
// }));
// this.$('> img').remove();
// this.$(".signature").hide();
// this.$el.prepend($img);
// $img.on('error', function () {
// self._clearFile();
// $img.attr('src', self.placeholder);
// self.displayNotification({message:_t("Image Could not display the selected image."),type: 'danger'});
// });
// } else if (this.mode === "edit") {
// this.$('> img').remove();
// if (this.value) {
// var field_name = this.nodeOptions.preview_image ?
// this.nodeOptions.preview_image :
// this.name;
// self._rpc( {
// model: this.model,
// method: 'read',
// args: [this.res_id, [field_name]],
// }).then(function (data) {
// if (data) {
// var field_desc = _.values(_.pick(data[0],
// field_name));
// self.$(".signature").jSignature("clear");
// self.$(".signature").jSignature("setData",
// 'data:image/png;base64,' + field_desc[0]);
// }
// });
// } else {
// this.$('> img').remove();
// this.$('.signature > canvas').remove();
// var sign_options = {
// 'decor-color': '#D1D0CE',
// 'color': '#000',
// 'background-color': '#fff',
// 'height': '150',
// 'width': '550',
// };
// this.$(".signature").jSignature("init", sign_options);
// }
// } else if (this.mode === 'create') {
// this.$('> img').remove();
// this.$('> canvas').remove();
// if (!this.value) {
// this.$(".signature").empty().jSignature("init", {
// 'decor-color': '#D1D0CE',
// 'color': '#000',
// 'background-color': '#fff',
// 'height': '150',
// 'width': '550',
// });
// }
// }
// },
// });
//
// FormController.include( {
// saveRecord: function () {
// this.$('.save_sign').click();
// return this._super.apply(this, arguments);
// },
// });
//
// Registry.add('signature', FieldSignature);
//
//
//});
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.