Adding the action manager for the extension
This commit is contained in:
99
extensions/invoices/dist/invoices.js
vendored
99
extensions/invoices/dist/invoices.js
vendored
@@ -22,8 +22,16 @@ window.initAdminInvoices = init;
|
|||||||
},{"../../../../web/api/IceDataPipe":8,"./lib":2}],2:[function(require,module,exports){
|
},{"../../../../web/api/IceDataPipe":8,"./lib":2}],2:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var _react = _interopRequireDefault(require("react"));
|
||||||
|
|
||||||
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||||
|
|
||||||
|
var _antd = require("antd");
|
||||||
|
|
||||||
var _ReactModalAdapterBase = _interopRequireDefault(require("../../../../web/api/ReactModalAdapterBase"));
|
var _ReactModalAdapterBase = _interopRequireDefault(require("../../../../web/api/ReactModalAdapterBase"));
|
||||||
|
|
||||||
|
var _icons = require("@ant-design/icons");
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||||
|
|
||||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||||
@@ -64,14 +72,6 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
|
|||||||
|
|
||||||
_createClass(InvoiceAdapter, [{
|
_createClass(InvoiceAdapter, [{
|
||||||
key: "getDataMapping",
|
key: "getDataMapping",
|
||||||
|
|
||||||
/*constructor(endPoint, tab, filter, orderBy) {
|
|
||||||
super(endPoint, tab, filter, orderBy);
|
|
||||||
this.fieldNameMap = {};
|
|
||||||
this.hiddenFields = {};
|
|
||||||
this.tableFields = {};
|
|
||||||
this.formOnlyFields = {};
|
|
||||||
}*/
|
|
||||||
value: function getDataMapping() {
|
value: function getDataMapping() {
|
||||||
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'];
|
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'];
|
||||||
}
|
}
|
||||||
@@ -298,13 +298,78 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
|
|||||||
sorter: true
|
sorter: true
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
/* getActionButtonsHtml(id, data) {
|
}, {
|
||||||
let html = '<div style="width:80px;"><img class="tableActionButton" src="_BASE_images/download.png" style="cursor:pointer;" rel="tooltip" title="Download" onclick="modJs.edit(_id_);return false;"></img></div>';
|
key: "getTableActionButtonJsx",
|
||||||
html = html.replace(/_id_/g, id);
|
value: function getTableActionButtonJsx(adapter) {
|
||||||
html = html.replace(/_BASE_/g, this.baseUrl);
|
return function (text, record) {
|
||||||
return html;
|
return /*#__PURE__*/_react["default"].createElement(_antd.Space, {
|
||||||
}*/
|
size: "middle"
|
||||||
|
}, adapter.hasAccess('save') && adapter.showEdit && /*#__PURE__*/_react["default"].createElement(_antd.Tag, {
|
||||||
|
color: "green",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return modJs.edit(record.id);
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
cursor: 'pointer'
|
||||||
|
}
|
||||||
|
}, /*#__PURE__*/_react["default"].createElement(_icons.EditOutlined, null), " ".concat(adapter.gt('Edit'))), adapter.hasAccess('element') && /*#__PURE__*/_react["default"].createElement(_antd.Tag, {
|
||||||
|
color: "blue",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return modJs.viewElement(record.id);
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
cursor: 'pointer'
|
||||||
|
}
|
||||||
|
}, /*#__PURE__*/_react["default"].createElement(_icons.MonitorOutlined, null), " ".concat(adapter.gt('View'))), adapter.hasAccess('delete') && adapter.showDelete && /*#__PURE__*/_react["default"].createElement(_antd.Tag, {
|
||||||
|
color: "volcano",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return modJs.deleteRow(record.id);
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
cursor: 'pointer'
|
||||||
|
}
|
||||||
|
}, /*#__PURE__*/_react["default"].createElement(_icons.DeleteOutlined, null), " ".concat(adapter.gt('Delete'))), adapter.hasAccess('save') && /*#__PURE__*/_react["default"].createElement(_antd.Tag, {
|
||||||
|
color: "cyan",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return modJs.copyRow(record.id);
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
cursor: 'pointer'
|
||||||
|
}
|
||||||
|
}, /*#__PURE__*/_react["default"].createElement(_icons.CopyOutlined, null), " ".concat(adapter.gt('Copy'))), /*#__PURE__*/_react["default"].createElement(_antd.Tag, {
|
||||||
|
color: "green",
|
||||||
|
onClick: function onClick() {
|
||||||
|
return modJs.printInvoice(record.id);
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
cursor: 'pointer'
|
||||||
|
}
|
||||||
|
}, /*#__PURE__*/_react["default"].createElement(_icons.PrinterOutlined, null), " ".concat(adapter.gt('Print'))));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "printInvoice",
|
||||||
|
value: function printInvoice(id) {
|
||||||
|
var params = {};
|
||||||
|
params.id = id;
|
||||||
|
var reqJson = JSON.stringify(params);
|
||||||
|
var callBackData = [];
|
||||||
|
callBackData.callBackData = [];
|
||||||
|
callBackData.callBackSuccess = 'printInvoiceSuccessCallback';
|
||||||
|
callBackData.callBackFail = 'printInvoiceFailCallback';
|
||||||
|
this.customAction('printInvoice', 'extension=invoices', reqJson, callBackData);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "printInvoiceSuccessCallback",
|
||||||
|
value: function printInvoiceSuccessCallback(callBackData) {
|
||||||
|
this.showMessage('Success', 'Printing Done');
|
||||||
|
this.get([]);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "printInvoiceFailCallback",
|
||||||
|
value: function printInvoiceFailCallback(callBackData) {
|
||||||
|
this.showMessage('Error', callBackData);
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
return InvoiceAdapter;
|
return InvoiceAdapter;
|
||||||
@@ -314,7 +379,7 @@ module.exports = {
|
|||||||
InvoiceAdapter: InvoiceAdapter
|
InvoiceAdapter: InvoiceAdapter
|
||||||
};
|
};
|
||||||
|
|
||||||
},{"../../../../web/api/ReactModalAdapterBase":11}],3:[function(require,module,exports){
|
},{"../../../../web/api/ReactModalAdapterBase":11,"@ant-design/icons":"@ant-design/icons","antd":"antd","react":"react","react-dom":"react-dom"}],3:[function(require,module,exports){
|
||||||
// shim for using process in browser
|
// shim for using process in browser
|
||||||
var process = module.exports = {};
|
var process = module.exports = {};
|
||||||
|
|
||||||
@@ -3106,7 +3171,7 @@ var ModuleBase = /*#__PURE__*/function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(e){
|
}catch(e){
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
extensions/invoices/dist/invoices.js.map
vendored
2
extensions/invoices/dist/invoices.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once __DIR__.'/src/Invoices/Extension.php';
|
require_once __DIR__.'/src/Invoices/Extension.php';
|
||||||
|
require_once __DIR__.'/src/Invoices/Manager.php';
|
||||||
require_once __DIR__.'/src/Invoices/Migration.php';
|
require_once __DIR__.'/src/Invoices/Migration.php';
|
||||||
require_once __DIR__.'/src/Invoices/Model/Invoice.php';
|
require_once __DIR__.'/src/Invoices/Model/Invoice.php';
|
||||||
@@ -9,5 +9,6 @@
|
|||||||
],
|
],
|
||||||
"model_namespace": "\\Invoices\\Model",
|
"model_namespace": "\\Invoices\\Model",
|
||||||
"manager": "\\Invoices\\Extension",
|
"manager": "\\Invoices\\Extension",
|
||||||
|
"action": "\\Invoices\\Manager",
|
||||||
"headless": false
|
"headless": false
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,8 @@ namespace Invoices;
|
|||||||
|
|
||||||
use Classes\Authorizable;
|
use Classes\Authorizable;
|
||||||
use Classes\BaseService;
|
use Classes\BaseService;
|
||||||
use Classes\FileService;
|
|
||||||
use Classes\IceResponse;
|
use Classes\IceResponse;
|
||||||
use Classes\Pdf\PdfBuilder;
|
use Classes\Pdf\PdfBuilder;
|
||||||
//use Employees\Common\Model\Employee;
|
|
||||||
use Invoices\Model\Invoice;
|
use Invoices\Model\Invoice;
|
||||||
use Invoices\Pdf\InvoicePdf;
|
use Invoices\Pdf\InvoicePdf;
|
||||||
|
|
||||||
|
|||||||
15
extensions/invoices/src/Invoices/Manager.php
Normal file
15
extensions/invoices/src/Invoices/Manager.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Invoices;
|
||||||
|
|
||||||
|
use Classes\IceResponse;
|
||||||
|
use Classes\SubActionManager;
|
||||||
|
|
||||||
|
class Manager extends SubActionManager
|
||||||
|
{
|
||||||
|
public function printInvoice($req)
|
||||||
|
{
|
||||||
|
$id = $req->id;
|
||||||
|
return new IceResponse(IceResponse::SUCCESS, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import { Space, Tag } from 'antd';
|
||||||
import ReactModalAdapterBase from '../../../../web/api/ReactModalAdapterBase';
|
import ReactModalAdapterBase from '../../../../web/api/ReactModalAdapterBase';
|
||||||
|
import {
|
||||||
|
EditOutlined, DeleteOutlined, CopyOutlined, MonitorOutlined, PrinterOutlined,
|
||||||
|
} from '@ant-design/icons';
|
||||||
/**
|
/**
|
||||||
* VatInvoiceAdapter
|
* VatInvoiceAdapter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class InvoiceAdapter extends ReactModalAdapterBase {
|
class InvoiceAdapter extends ReactModalAdapterBase {
|
||||||
/*constructor(endPoint, tab, filter, orderBy) {
|
|
||||||
super(endPoint, tab, filter, orderBy);
|
|
||||||
this.fieldNameMap = {};
|
|
||||||
this.hiddenFields = {};
|
|
||||||
this.tableFields = {};
|
|
||||||
this.formOnlyFields = {};
|
|
||||||
}*/
|
|
||||||
|
|
||||||
getDataMapping() {
|
getDataMapping() {
|
||||||
return [
|
return [
|
||||||
@@ -172,6 +170,67 @@ class InvoiceAdapter extends ReactModalAdapterBase {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTableActionButtonJsx(adapter) {
|
||||||
|
return (text, record) => (
|
||||||
|
<Space size="middle">
|
||||||
|
{adapter.hasAccess('save') && adapter.showEdit
|
||||||
|
&& (
|
||||||
|
<Tag color="green" onClick={() => modJs.edit(record.id)} style={{ cursor: 'pointer' }}>
|
||||||
|
<EditOutlined />
|
||||||
|
{` ${adapter.gt('Edit')}`}
|
||||||
|
</Tag>
|
||||||
|
)}
|
||||||
|
{adapter.hasAccess('element')
|
||||||
|
&& (
|
||||||
|
<Tag color="blue" onClick={() => modJs.viewElement(record.id)} style={{ cursor: 'pointer' }}>
|
||||||
|
<MonitorOutlined />
|
||||||
|
{` ${adapter.gt('View')}`}
|
||||||
|
</Tag>
|
||||||
|
)}
|
||||||
|
{adapter.hasAccess('delete') && adapter.showDelete
|
||||||
|
&& (
|
||||||
|
<Tag color="volcano" onClick={() => modJs.deleteRow(record.id)} style={{ cursor: 'pointer' }}>
|
||||||
|
<DeleteOutlined />
|
||||||
|
{` ${adapter.gt('Delete')}`}
|
||||||
|
</Tag>
|
||||||
|
)}
|
||||||
|
{adapter.hasAccess('save')
|
||||||
|
&& (
|
||||||
|
<Tag color="cyan" onClick={() => modJs.copyRow(record.id)} style={{ cursor: 'pointer' }}>
|
||||||
|
<CopyOutlined />
|
||||||
|
{` ${adapter.gt('Copy')}`}
|
||||||
|
</Tag>
|
||||||
|
)}
|
||||||
|
<Tag color="green" onClick={() => modJs.printInvoice(record.id)} style={{ cursor: 'pointer' }}>
|
||||||
|
<PrinterOutlined />
|
||||||
|
{` ${adapter.gt('Print')}`}
|
||||||
|
</Tag>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
printInvoice(id) {
|
||||||
|
const params = {};
|
||||||
|
params.id = id;
|
||||||
|
const reqJson = JSON.stringify(params);
|
||||||
|
const callBackData = [];
|
||||||
|
callBackData.callBackData = [];
|
||||||
|
callBackData.callBackSuccess = 'printInvoiceSuccessCallback';
|
||||||
|
callBackData.callBackFail = 'printInvoiceFailCallback';
|
||||||
|
|
||||||
|
this.customAction('printInvoice', 'extension=invoices', reqJson, callBackData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printInvoiceSuccessCallback(callBackData) {
|
||||||
|
this.showMessage('Success', 'Printing Done');
|
||||||
|
this.get([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printInvoiceFailCallback(callBackData) {
|
||||||
|
this.showMessage('Error', callBackData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports ={InvoiceAdapter};
|
module.exports ={InvoiceAdapter};
|
||||||
Reference in New Issue
Block a user