added missing fields

This commit is contained in:
roshelrao
2021-07-08 15:03:32 +05:30
parent 1332448d72
commit 5416bdb840
8 changed files with 149 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
var _lib = _interopRequireDefault(require("./lib"));
var _lib = require("./lib");
var _IceDataPipe = _interopRequireDefault(require("../../../../web/api/IceDataPipe"));
@@ -9,10 +9,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
function init(data) {
var modJsList = [];
modJsList.tabInvoices = new _lib["default"]('Invoices', 'Invoices', '', '');
modJsList.tabInvoices.setObjectTypeName('Invoices');
modJsList.tabInvoices.setDataPipe(new _IceDataPipe["default"](modJsList.tabVInvoices));
modJsList.tabInvoices.setAccess(data.permissions.Invoices);
modJsList.tabInvoices = new _lib.InvoiceAdapter('Invoice', 'Invoices', '', '');
modJsList.tabInvoices.setObjectTypeName('Invoice');
modJsList.tabInvoices.setDataPipe(new _IceDataPipe["default"](modJsList.tabInvoices));
modJsList.tabInvoices.setAccess(data.permissions.Invoice);
window.modJs = modJsList.tabInvoices;
window.modJsList = modJsList;
}
@@ -73,7 +73,7 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
this.formOnlyFields = {};
}*/
value: function getDataMapping() {
return ['id', 'paymentId', 'invoiceId', 'description', 'buyerName', 'buyerAddress', 'buyerPostalAddress', 'buyerVatId', 'buyerEmail', 'sellerName', 'sellerAddress', 'sellerVatId', 'amount', 'vat', 'vatRate', 'issuedDate', 'paidDate', 'status', 'acceptPayments', 'created', 'updated', 'link', 'paymentLink'];
return ['id', 'paymentId', 'invoiceId', 'description', 'buyerName', 'buyerAddress', 'buyerPostalAddress', 'buyerVatId', 'buyerEmail', 'sellerName', 'sellerAddress', 'sellerVatId', 'amount', 'vat', 'vatRate', 'issuedDate', 'dueDate', 'paidDate', 'status', 'acceptPayments', 'created', 'updated', 'link', 'paymentLink'];
}
}, {
key: "getHeaders",
@@ -129,6 +129,11 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
sTitle: 'Payment Link'
}];
}
}, {
key: "getCountryList",
value: function getCountryList() {
return [['DE', 'Germany'], ['LK', 'Sri Lanka']];
}
}, {
key: "getFormFields",
value: function getFormFields() {
@@ -159,14 +164,15 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
}], ['buyerCountry', {
"label": "Buyer Country",
"type": "select2",
"source": this.getCountryList()
"remote-source": ["Country", "code", "name"]
}], ['buyerVatId', {
"label": "Buyer Vat Id",
"type": "text",
"validation": "none"
}], ['buyerEmail', {
"label": "Buyer Email",
"type": "text"
"type": "text",
"validation": "email"
}], ['sellerName', {
"label": "Seller Name",
"type": "text"
@@ -176,7 +182,7 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
}], ['sellerCountry', {
"label": "Seller Country",
"type": "select2",
"source": this.getCountryList()
"remote-source": ["Country", "code", "name"]
}], ['sellerVatId', {
"label": "Seller Vat Id",
"type": "text"
@@ -196,6 +202,10 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
"label": "Issued Date",
"type": "datetime",
"validation": ""
}], ['dueDate', {
"label": "Due Date",
"type": "datetime",
"validation": ""
}], ['paidDate', {
"label": "Paid Date",
"type": "datetime",
@@ -222,19 +232,70 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
}], ['paymentLink', {
"label": "Payment Link",
"type": "placeholder"
}], ['items', {
label: 'Items',
type: 'datagroup',
form: [['description', {
label: 'Description',
type: 'textarea',
validation: ''
}], ['rate', {
label: 'Rate',
type: 'text',
validation: ''
}], ['qty', {
label: 'Quantity',
type: 'text',
validation: ''
}], ['lineTotal', {
label: 'Line Total',
type: 'text',
validation: ''
}]],
html: '<div id="#_id_#" class="panel panel-default"><div class="panel-body">#_delete_##_edit_#<span style="color:#999;font-size:13px;font-weight:bold">Date: #_date_#</span><hr/>#_note_#</div></div>',
validation: 'none',
columns: [{
title: 'Description',
dataIndex: 'description',
key: 'description'
}, {
title: 'Rate',
dataIndex: 'rate',
key: 'rate'
}, {
title: 'Quantity',
dataIndex: 'qty',
key: 'qty'
}, {
title: 'Line Total',
dataIndex: 'lineTotal',
key: 'lineTotal'
}],
'sort-function': function sortFunction(a, b) {
var t1 = Date.parse(a.date).getTime();
var t2 = Date.parse(b.date).getTime();
return t1 < t2;
},
'custom-validate-function': function customValidateFunction(data) {
var res = {};
res.valid = true;
data.date = new Date().toString('d-MMM-yyyy hh:mm tt');
res.params = data;
return res;
}
}]];
}
}, {
key: "getTableColumns",
value: function getTableColumns() {
return [{
title: 'Payment Id',
dataIndex: 'paymentId',
sorter: true
}, {
title: 'Invoice Id',
dataIndex: 'invoiceId',
sorter: true
}, {
title: 'Description',
dataIndex: 'description',
sorter: true
}];
}
}]);

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"label": "Invoices",
"menu": ["Invoices", "fa-file"],
"icon": "fa-files",
"icon": "fa-file",
"user_levels": [
"Admin",
"Manager",

View File

@@ -20,7 +20,7 @@ class Extension extends IceExtension
public function setupModuleClassDefinitions()
{
$this->addModelClass('Invoice');
}
public function setupRestEndPoints()

View File

@@ -27,12 +27,14 @@ create table Invoices
vat decimal(10,2) default 0.00 null,
vatRate decimal(10,2) default 0.00 null,
issuedDate datetime null,
dueDate datetime null,
paidDate datetime null,
created datetime null,
updated datetime null,
status enum('Pending', 'Paid', 'Processing', 'Draft', 'Sent', 'Canceled') collate utf8_unicode_ci default 'Pending' null,
acceptPayments tinyint default 0 null,
buyerEmail varchar(125) charset utf8 null,
items text charset utf8 null,
constraint invoiceId
unique (invoiceId)
)

View File

@@ -1,13 +1,13 @@
import InvoiceAdapter from './lib';
import {InvoiceAdapter} from './lib';
import IceDataPipe from '../../../../web/api/IceDataPipe';
function init(data) {
const modJsList = [];
modJsList.tabInvoices =new InvoiceAdapter('Invoices', 'Invoices','','');
modJsList.tabInvoices.setObjectTypeName('Invoices');
modJsList.tabInvoices.setDataPipe(new IceDataPipe(modJsList.tabVInvoices));
modJsList.tabInvoices.setAccess(data.permissions.Invoices);
modJsList.tabInvoices =new InvoiceAdapter('Invoice', 'Invoices','','');
modJsList.tabInvoices.setObjectTypeName('Invoice');
modJsList.tabInvoices.setDataPipe(new IceDataPipe(modJsList.tabInvoices));
modJsList.tabInvoices.setAccess(data.permissions.Invoice);
window.modJs = modJsList.tabInvoices;
window.modJsList = modJsList;

View File

@@ -31,6 +31,7 @@ class InvoiceAdapter extends ReactModalAdapterBase {
'vat',
'vatRate',
'issuedDate',
'dueDate',
'paidDate',
'status',
'acceptPayments',
@@ -70,6 +71,13 @@ class InvoiceAdapter extends ReactModalAdapterBase {
];
}
getCountryList() {
return [
['DE', 'Germany'],
['LK', 'Sri Lanka'],
];
}
getFormFields() {
return [
[ 'id', {"label":"ID","type":"hidden"}],
@@ -79,17 +87,18 @@ class InvoiceAdapter extends ReactModalAdapterBase {
[ 'buyerName', {"label":"Buyer Name","type":"text"}],
[ 'buyerAddress', {"label":"Buyer Address","type":"textarea"}],
[ 'buyerPostalCode', {"label":"Buyer Postal Code","type":"text"}],
[ 'buyerCountry', {"label":"Buyer Country","type":"select2", "source": this.getCountryList()}],
[ 'buyerCountry', {"label":"Buyer Country","type":"select2", "remote-source": ["Country", "code", "name"]}],
[ 'buyerVatId', {"label":"Buyer Vat Id","type":"text","validation":"none"}],
[ 'buyerEmail', {"label":"Buyer Email","type":"text"}],
[ 'buyerEmail', {"label":"Buyer Email","type":"text","validation":"email"}],
[ 'sellerName', {"label":"Seller Name","type":"text"}],
[ 'sellerAddress', {"label":"Seller Address","type":"text"}],
[ 'sellerCountry', {"label":"Seller Country","type":"select2", "source": this.getCountryList()}],
[ 'sellerCountry', {"label":"Seller Country","type":"select2", "remote-source": ["Country", "code", "name"]}],
[ 'sellerVatId', {"label":"Seller Vat Id","type":"text"}],
[ 'amount', {"label":"Amount with VAT","type":"text", "validation":"float"}],
[ 'vat', {"label":"Vat","type":"text", "validation":"float"}],
[ 'vatRate', {"label":"Vat Rate","type":"text", "validation":"float"}],
[ 'issuedDate', {"label":"Issued Date","type":"datetime", "validation":""}],
[ 'dueDate', {"label":"Due Date","type":"datetime", "validation":""}],
[ 'paidDate', {"label":"Paid Date","type":"datetime", "validation":""}],
[ 'status', {"label":"Status","type":"select","source":[["Pending","Pending"],["Paid","Paid"],["Processing","Processing"],["Draft","Draft"],["Sent","Sent"],["Canceled","Canceled"]]}],
[ 'acceptPayments', {"label":"Accept Payments","type":"select","source":[["0","No"],["1","Yes"]]}],
@@ -97,19 +106,67 @@ class InvoiceAdapter extends ReactModalAdapterBase {
[ 'updated', {"label":"Updated","type":"datetime", "validation":""}],
[ 'link', {"label":"Link","type":"placeholder"}],
[ 'paymentLink', {"label":"Payment Link","type":"placeholder"}],
['items', {
label: 'Items',
type: 'datagroup',
form: [
['description', { label: 'Description', type: 'textarea', validation: '' }],
['rate', { label: 'Rate', type: 'text', validation: '' }],
['qty', { label: 'Quantity', type: 'text', validation: '' }],
['lineTotal', { label: 'Line Total', type: 'text', validation: '' }],
],
html: '<div id="#_id_#" class="panel panel-default"><div class="panel-body">#_delete_##_edit_#<span style="color:#999;font-size:13px;font-weight:bold">Date: #_date_#</span><hr/>#_note_#</div></div>',
validation: 'none',
columns: [
{
title: 'Description',
dataIndex: 'description',
key: 'description',
},
{
title: 'Rate',
dataIndex: 'rate',
key: 'rate',
},
{
title: 'Quantity',
dataIndex: 'qty',
key: 'qty',
},
{
title: 'Line Total',
dataIndex: 'lineTotal',
key: 'lineTotal',
},
],
'sort-function': function (a, b) {
const t1 = Date.parse(a.date).getTime();
const t2 = Date.parse(b.date).getTime();
return (t1 < t2);
},
'custom-validate-function': function (data) {
const res = {};
res.valid = true;
data.date = new Date().toString('d-MMM-yyyy hh:mm tt');
res.params = data;
return res;
},
}],
];
}
getTableColumns() {
return [
{
title: 'Payment Id',
dataIndex: 'paymentId',
title: 'Invoice Id',
dataIndex: 'invoiceId',
sorter: true,
},
{
title: 'Invoice Id',
dataIndex: 'invoiceId',
title: 'Description',
dataIndex: 'description',
sorter: true,
},
];

View File

@@ -105,6 +105,7 @@ class UserAdapter extends AdapterBase {
if (msg == null) {
const id = $(`#${this.getTableName()}_submit #id`).val();
params.csrf = $(`#${this.getTableName()}Form`).data('csrf');
if (id != null && id !== undefined && id !== '') {
params.id = id;
this.add(params, []);