invoice module
This commit is contained in:
1 parent
9f47df5613
commit
1332448d72
21 files changed
+422992
-34133
No files matched your search
Vendored
+24622
File diff suppressed because it is too large.
Load diff
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["node_modules/browser-pack/_prelude.js","extensions/invoices/web/js/index.js","extensions/invoices/web/js/lib.js","node_modules/process/browser.js","web/api-common/RequestCache.js","web/api/AdapterBase.js","web/api/FormValidation.js","web/api/IceApiClient.js","web/api/IceDataPipe.js","web/api/MasterDataReader.js","web/api/ModuleBase.js","web/api/ReactModalAdapterBase.js","web/components/IceColorPick.js","web/components/IceDataGroup.js","web/components/IceForm.js","web/components/IceFormModal.js","web/components/IceLabel.js","web/components/IceSelect.js","web/components/IceSignature.js","web/components/IceStepForm.js","web/components/IceStepFromModal.js","web/components/IceTable.js","web/components/IceUpload.js","web/node_modules/@icons/material/CheckIcon.js","web/node_modules/@icons/material/UnfoldMoreHorizontalIcon.js","web/node_modules/axios/index.js","web/node_modules/axios/lib/adapters/xhr.js","web/node_modules/axios/lib/axios.js","web/node_modules/axios/lib/cancel/Cancel.js","web/node_modules/axios/lib/cancel/CancelToken.js","web/node_modules/axios/lib/cancel/isCancel.js","web/node_modules/axios/lib/core/Axios.js","web/node_modules/axios/lib/core/InterceptorManager.js","web/node_modules/axios/lib/core/buildFullPath.js","web/node_modules/axios/lib/core/createError.js","web/node_modules/axios/lib/core/dispatchRequest.js","web/node_modules/axios/lib/core/enhanceError.js","web/node_modules/axios/lib/core/mergeConfig.js","web/node_modules/axios/lib/core/settle.js","web/node_modules/axios/lib/core/transformData.js","web/node_modules/axios/lib/defaults.js","web/node_modules/axios/lib/helpers/bind.js","web/node_modules/axios/lib/helpers/buildURL.js","web/node_modules/axios/lib/helpers/combineURLs.js","web/node_modules/axios/lib/helpers/cookies.js","web/node_modules/axios/lib/helpers/isAbsoluteURL.js","web/node_modules/axios/lib/helpers/isURLSameOrigin.js","web/node_modules/axios/lib/helpers/normalizeHeaderName.js","web/node_modules/axios/lib/helpers/parseHeaders.js","web/node_modules/axios/lib/helpers/spread.js","web/node_modules/axios/lib/utils.js","web/node_modules/lodash/_DataView.js","web/node_modules/lodash/_Hash.js","web/node_modules/lodash/_ListCache.js","web/node_modules/lodash/_Map.js","web/node_modules/lodash/_MapCache.js","web/node_modules/lodash/_Promise.js","web/node_modules/lodash/_Set.js","web/node_modules/lodash/_SetCache.js","web/node_modules/lodash/_Stack.js","web/node_modules/lodash/_Symbol.js","web/node_modules/lodash/_Uint8Array.js","web/node_modules/lodash/_WeakMap.js","web/node_modules/lodash/_apply.js","web/node_modules/lodash/_arrayEach.js","web/node_modules/lodash/_arrayFilter.js","web/node_modules/lodash/_arrayLikeKeys.js","web/node_modules/lodash/_arrayMap.js","web/node_modules/lodash/_arrayPush.js","web/node_modules/lodash/_arraySome.js","web/node_modules/lodash/_assignMergeValue.js","web/node_modules/lodash/_assignValue.js","web/node_modules/lodash/_assocIndexOf.js","web/node_modules/lodash/_baseAssign.js","web/node_modules/lodash/_baseAssignIn.js","web/node_modules/lodash/_baseAssignValue.js","web/node_modules/lodash/_baseClone.js","web/node_modules/lodash/_baseCreate.js","web/node_modules/lodash/_baseEach.js","web/node_modules/lodash/_baseFor.js","web/node_modules/lodash/_baseForOwn.js","web/node_modules/lodash/_baseGet.js","web/node_modules/lodash/_baseGetAllKeys.js","web/node_modules/lodash/_baseGetTag.js","web/node_modules/lodash/_baseHasIn.js","web/node_modules/lodash/_baseIsArguments.js","web/node_modules/lodash/_baseIsEqual.js","web/node_modules/lodash/_baseIsEqualDeep.js","web/node_modules/lodash/_baseIsMap.js","web/node_modules/lodash/_baseIsMatch.js","web/node_modules/lodash/_baseIsNative.js","web/node_modules/lodash/_baseIsSet.js","web/node_modules/lodash/_baseIsTypedArray.js","web/node_modules/lodash/_baseIteratee.js","web/node_modules/lodash/_baseKeys.js","web/node_modules/lodash/_baseKeysIn.js","web/node_modules/lodash/_baseMap.js","web/node_modules/lodash/_baseMatches.js","web/node_modules/lodash/_baseMatchesProperty.js","web/node_modules/lodash/_baseMerge.js","web/node_modules/lodash/_baseMergeDeep.js","web/node_modules/lodash/_baseProperty.js","web/node_modules/lodash/_basePropertyDeep.js","web/node_modules/lodash/_baseRest.js","web/node_modules/lodash/_baseSetToString.js","web/node_modules/lodash/_baseTimes.js","web/node_modules/lodash/_baseToString.js","web/node_modules/lodash/_baseUnary.js","web/node_modules/lodash/_cacheHas.js","web/node_modules/lodash/_castFunction.js","web/node_modules/lodash/_castPath.js","web/node_modules/lodash/_cloneArrayBuffer.js","web/node_modules/lodash/_cloneBuffer.js","web/node_modules/lodash/_cloneDataView.js","web/node_modules/lodash/_cloneRegExp.js","web/node_modules/lodash/_cloneSymbol.js","web/node_modules/lodash/_cloneTypedArray.js","web/node_modules/lodash/_copyArray.js","web/node_modules/lodash/_copyObject.js","web/node_modules/lodash/_copySymbols.js","web/node_modules/lodash/_copySymbolsIn.js","webLine truncated
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/src/Invoices/Extension.php';
|
||||
require_once __DIR__.'/src/Invoices/Migration.php';
|
||||
require_once __DIR__.'/src/Invoices/Model/Invoice.php';
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"label": "Invoices",
|
||||
"menu": ["Invoices", "fa-file"],
|
||||
"icon": "fa-files",
|
||||
"user_levels": [
|
||||
"Admin",
|
||||
"Manager",
|
||||
"User"
|
||||
],
|
||||
"model_namespace": "\\Invoices\\Model",
|
||||
"manager": "\\Invoices\\Extension",
|
||||
"headless": false
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Invoices;
|
||||
|
||||
use Classes\IceExtension;
|
||||
|
||||
class Extension extends IceExtension
|
||||
{
|
||||
|
||||
public function install() {
|
||||
$migration = new Migration();
|
||||
return $migration->up();
|
||||
|
||||
}
|
||||
|
||||
public function uninstall() {
|
||||
$migration = new Migration();
|
||||
return $migration->down();
|
||||
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function setupRestEndPoints()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace Invoices;
|
||||
|
||||
use Classes\Migration\AbstractMigration;
|
||||
|
||||
class Migration extends AbstractMigration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
create table Invoices
|
||||
(
|
||||
id bigint auto_increment primary key,
|
||||
paymentId bigint not null,
|
||||
invoiceId bigint not null,
|
||||
description varchar(500) charset utf8 not null,
|
||||
buyerName varchar(200) charset utf8 not null,
|
||||
buyerAddress varchar(200) charset utf8 not null,
|
||||
buyerPostalCode varchar(200) charset utf8 not null,
|
||||
buyerCountry varchar(200) charset utf8 not null,
|
||||
buyerVatId varchar(50) charset utf8 not null,
|
||||
sellerName varchar(200) charset utf8 not null,
|
||||
sellerAddress varchar(200) null,
|
||||
sellerCountry varchar(200) charset utf8 not null,
|
||||
sellerVatId varchar(50) charset utf8 not null,
|
||||
amount decimal(10,2) default 0.00 null,
|
||||
vat decimal(10,2) default 0.00 null,
|
||||
vatRate decimal(10,2) default 0.00 null,
|
||||
issuedDate 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,
|
||||
constraint invoiceId
|
||||
unique (invoiceId)
|
||||
)
|
||||
collate=utf8mb4_unicode_ci;
|
||||
SQL;
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
DROP TABLE IF EXISTS `Invoices`;
|
||||
SQL;
|
||||
return $this->executeQuery($sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Invoices\Model;
|
||||
|
||||
use Classes\ModuleAccess;
|
||||
use Model\BaseModel;
|
||||
|
||||
class Invoice extends BaseModel
|
||||
{
|
||||
public $table = 'Invoices';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getModuleAccess()
|
||||
{
|
||||
return [
|
||||
new ModuleAccess('employees', 'admin'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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};
|
||||
Reference in new issue
Block a user