Your Payment Proof Attachment is Uploaded Successfully +
+Best regards,
+ ++ Let your customer can attach the proof of payment. +
++ User can upload both image and pdf files while creating quotation or in the payment screen.
++ User can display already uploaded files. +
++ My account --> Quotations to Review +
++ User can see the uploaded files. +
++ User can update transaction receipt and see the added receipts. +
++ Admin can see the uploaded files in the backend. Also, the mail will be sent to the customer. +
++ Customer can attach files in the "my account" screen and "payment" screen.
++ Customer can upload both image and pdf files.
++ Customer can upload multiple files.
++ It is available for all manual transactions. +
++ Admin can see the uploaded file in the sale order section.
++ This module enables customers to upload and attach proof documents or files directly from the website when placing orders or submitting requests. It streamlines the process of providing necessary documentation for verification. +
++ Customers can easily attach proof documents during their interaction on the website (e.g., order form, inquiry form, or any relevant section) by using the "Attach File" button, which supports multiple file formats like PDF, PNG, JPEG, etc. +
++ The module supports common file types such as PDFs, images (JPEG, PNG), and Word documents (DOC, DOCX), depending on the website settings. +
++ Yes, the maximum file size for attachments can be configured by the website administrator. If a customer attempts to upload a file that exceeds this limit, an error message will be displayed. +
+There is no attachments for this sale order.
") + } + }) + } +}) diff --git a/payment_proof_attachment/static/src/js/payment_screen.js b/payment_proof_attachment/static/src/js/payment_screen.js new file mode 100755 index 000000000..918d7e733 --- /dev/null +++ b/payment_proof_attachment/static/src/js/payment_screen.js @@ -0,0 +1,88 @@ +/** @odoo-module **/ +import publicWidget from "@web/legacy/js/public/public_widget"; +import { rpc } from "@web/core/network/rpc"; + +publicWidget.registry.PaymentProof = publicWidget.Widget.extend({ +// init() { +// this.rpc = this.env.services.rpc; +// }, + selector: '.payment_screen', + events: { + 'click #btnShowModal': '_onClickShowModal', + 'click .close_modal': '_onClickCloseModal', + 'change #payment_proof': '_onChangePaymentProof', + 'click #payment_proof_cart_update': '_onClickUpdateAttachment', + 'click #paymentScreenBtnShowReceipt': '_onClickShowReceipt', + 'click #refresh_payment_receipt': '_onClickShowReceipt', + }, + /** + *for closing the modal dialog + */ + _onClickShowModal: function () { + this.el.querySelector('#myModal').style.display = 'block'; +// document.querySelector('#wrapwrap').style.overflow = 'hidden'; + }, + /** + *for closing the modal dialog + */ + _onClickCloseModal: function () { + this.el.querySelector('#myModal').style.display = 'none'; +// document.querySelector('#wrapwrap').style.overflow = 'auto'; + }, + /** + *getting content from the uploaded file + */ + _onChangePaymentProof: function (ev) { + const files = ev.target.files; + var fileList = []; + for (let i = 0; i < files.length; i++) { + var reader = new FileReader(); + var reader_content = reader.readAsDataURL(files[i]); + reader.onload = function (reader_content) { + var dataURL = reader_content.target.result.split(',')[1]; + var fileName = files[i].name; + fileList.push({ + name: fileName, + content: dataURL + }); + } + } + this.fileList = fileList; + }, + /** + *transfer the content to python in payment screen + */ + _onClickUpdateAttachment: function (ev) { + var self = this; + this.el.querySelector('#myModal').style.display = 'none'; + if (self.fileList) { + rpc('/payment_proof/submit', { + 'attachments': this.fileList + }).then(function () { + self.fileList = "" + self.$el.find("#payment_proof").val("") + }); + } + }, + /** + *getting updated attachments + */ + _onClickShowReceipt: function () { + var self = this; + this.$el.find('#updated_receipt').css("display", "block") + this.$el.find('#paymentScreenBtnShowReceipt').css("display", "none") + rpc('/my_account_screen/show_updated', {}).then(function (attachment_ids) { + if (attachment_ids.length > 0) { + self.$el.find("#showing_updated_receipt").empty(); + $(attachment_ids).each(function (attachment_id) { + var id = "/web/content/" + attachment_ids[attachment_id]['id'] + var name = attachment_ids[attachment_id]['name'] + self.$el.find('#showing_updated_receipt').append("" + name + "+