invoice module
This commit is contained in:
Vendored
+48
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Listen for Xdebug",
|
||||||
|
"type": "php",
|
||||||
|
"request": "launch",
|
||||||
|
"port": 9003
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Launch currently open script",
|
||||||
|
"type": "php",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"cwd": "${fileDirname}",
|
||||||
|
"port": 0,
|
||||||
|
"runtimeArgs": [
|
||||||
|
"-dxdebug.start_with_request=yes"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"XDEBUG_MODE": "debug,develop",
|
||||||
|
"XDEBUG_CONFIG": "client_port=${port}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Launch Built-in web server",
|
||||||
|
"type": "php",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeArgs": [
|
||||||
|
"-dxdebug.mode=debug",
|
||||||
|
"-dxdebug.start_with_request=yes",
|
||||||
|
"-S",
|
||||||
|
"localhost:0"
|
||||||
|
],
|
||||||
|
"program": "",
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"port": 9003,
|
||||||
|
"serverReadyAction": {
|
||||||
|
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
|
||||||
|
"uriFormat": "http://localhost:%s",
|
||||||
|
"action": "openExternally"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+24622
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
@@ -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};
|
||||||
Vendored
+47031
-4
File diff suppressed because one or more lines are too long
Vendored
+531
-1
File diff suppressed because one or more lines are too long
Vendored
+10479
-4
File diff suppressed because one or more lines are too long
Vendored
+37477
-5
File diff suppressed because one or more lines are too long
Vendored
+34095
-34095
File diff suppressed because one or more lines are too long
Vendored
+91750
-5
File diff suppressed because one or more lines are too long
Vendored
+39547
-2
File diff suppressed because one or more lines are too long
Vendored
+92733
-5
File diff suppressed because one or more lines are too long
Vendored
+15464
-2
File diff suppressed because one or more lines are too long
Vendored
+28918
-10
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user