invoice module

This commit is contained in:
roshelrao
2021-07-01 15:51:04 +05:30
parent 9f47df5613
commit 1332448d72
21 changed files with 422992 additions and 34133 deletions

View File

@@ -0,0 +1,38 @@
<?php
/*$user = \Classes\BaseService::getInstance()->getCurrentUser();
echo "Welcome ".$user->username."<br/>";
echo "Invoices <br/>";
*/
use Classes\PermissionManager;
use Invoices\Model\Invoice;
?><div class="span9">
<ul class="nav nav-tabs" id="modTab" style="margin-bottom:0px;margin-left:5px;border-bottom: none;">
<li class="active"><a id="tabInvoices" href="#tabPageInvoices"><?=t('Invoices')?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabPageInvoices">
<div id="InvoicesTable" class="reviewBlock" data-content="List" style="padding-left:5px;"></div>
<div id="InvoicesForm"></div>
<div id="InvoicesFilterForm"></div>
</div>
</div>
</div>
<div id="dataGroup"></div>
<?php
$moduleData = [
'user_level' => $user->user_level,
'permissions' => [
'Invoice' => PermissionManager::checkGeneralAccess(new Invoice()),
]
];
?>
<script>
initAdminInvoices(<?=json_encode($moduleData)?>);
</script>

View File

@@ -0,0 +1,17 @@
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);
window.modJs = modJsList.tabInvoices;
window.modJsList = modJsList;
}
window.initAdminInvoices = init;

View File

@@ -0,0 +1,119 @@
import ReactModalAdapterBase from '../../../../web/api/ReactModalAdapterBase';
/**
* VatInvoiceAdapter
*/
class InvoiceAdapter extends ReactModalAdapterBase {
/*constructor(endPoint, tab, filter, orderBy) {
super(endPoint, tab, filter, orderBy);
this.fieldNameMap = {};
this.hiddenFields = {};
this.tableFields = {};
this.formOnlyFields = {};
}*/
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'
];
}
getHeaders() {
return [
{ sTitle: 'ID', bVisible: false },
{ sTitle: 'Payment Id' },
{ sTitle: 'Invoice ID' },
{ sTitle: 'Description' },
{ sTitle: 'Buyer Name' },
{ sTitle: 'Buyer Address' },
{ sTitle: 'Buyer Postal Code' },
{ sTitle: 'Buyer Country' },
{ sTitle: 'Buyer Vat Id' },
{ sTitle: 'Buyer Email' },
{ sTitle: 'Seller Name' },
{ sTitle: 'Seller Country' },
{ sTitle: 'Seller Vat Id' },
{ sTitle: 'Amount' },
{ sTitle: 'Vat' },
{ sTitle: 'Vat Rate' },
{ sTitle: 'Issued Date' },
{ sTitle: 'Paid Date' },
{ sTitle: 'Status' },
{ sTitle: 'Accept Payments' },
{ sTitle: 'Created' },
{ sTitle: 'Updated' },
{ sTitle: 'Link' },
{ sTitle: 'Payment Link' },
];
}
getFormFields() {
return [
[ 'id', {"label":"ID","type":"hidden"}],
[ 'paymentId', {"label":"Payment Id","type":"text","validation":"int"}],
[ 'invoiceId', {"label":"Invoice Id","type":"text","validation":"int"}],
[ 'description', {"label":"Description","type":"textarea","validation":"none"}],
[ '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()}],
[ 'buyerVatId', {"label":"Buyer Vat Id","type":"text","validation":"none"}],
[ 'buyerEmail', {"label":"Buyer Email","type":"text"}],
[ 'sellerName', {"label":"Seller Name","type":"text"}],
[ 'sellerAddress', {"label":"Seller Address","type":"text"}],
[ 'sellerCountry', {"label":"Seller Country","type":"select2", "source": this.getCountryList()}],
[ '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":""}],
[ '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"]]}],
[ 'created', {"label":"Created","type":"datetime", "validation":""}],
[ 'updated', {"label":"Updated","type":"datetime", "validation":""}],
[ 'link', {"label":"Link","type":"placeholder"}],
[ 'paymentLink', {"label":"Payment Link","type":"placeholder"}],
];
}
getTableColumns() {
return [
{
title: 'Payment Id',
dataIndex: 'paymentId',
sorter: true,
},
{
title: 'Invoice Id',
dataIndex: 'invoiceId',
sorter: true,
},
];
}
}
module.exports ={InvoiceAdapter};