Adding the action manager for the extension

This commit is contained in:
ddave committed 2021-07-16 08:17:30 +02:00
1 parent 9a1ee350c3
commit 72c8b4774c
7 files changed
+168 -29

No files matched your search

+82 -17
View File
@@ -22,8 +22,16 @@ window.initAdminInvoices = init;
},{"../../../../web/api/IceDataPipe":8,"./lib":2}],2:[function(require,module,exports){
"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 _icons = require("@ant-design/icons");
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); }
@@ -64,14 +72,6 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
_createClass(InvoiceAdapter, [{
key: "getDataMapping",
/*constructor(endPoint, tab, filter, orderBy) {
super(endPoint, tab, filter, orderBy);
this.fieldNameMap = {};
this.hiddenFields = {};
this.tableFields = {};
this.formOnlyFields = {};
}*/
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'];
}
@@ -298,13 +298,78 @@ var InvoiceAdapter = /*#__PURE__*/function (_ReactModalAdapterBas) {
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>';
html = html.replace(/_id_/g, id);
html = html.replace(/_BASE_/g, this.baseUrl);
return html;
}*/
}, {
key: "getTableActionButtonJsx",
value: function getTableActionButtonJsx(adapter) {
return function (text, record) {
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;
@@ -314,7 +379,7 @@ module.exports = {
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
var process = module.exports = {};
@@ -3106,7 +3171,7 @@ var ModuleBase = /*#__PURE__*/function () {
}
}
}catch(e){
}
}
return null;
}
*/
+1 -1
View File
@@ -1 +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
{"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
+1
View File
@@ -1,5 +1,6 @@
<?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/Model/Invoice.php';
+1
View File
@@ -9,5 +9,6 @@
],
"model_namespace": "\\Invoices\\Model",
"manager": "\\Invoices\\Extension",
"action": "\\Invoices\\Manager",
"headless": false
}
@@ -3,10 +3,8 @@ namespace Invoices;
use Classes\Authorizable;
use Classes\BaseService;
use Classes\FileService;
use Classes\IceResponse;
use Classes\Pdf\PdfBuilder;
//use Employees\Common\Model\Employee;
use Invoices\Model\Invoice;
use Invoices\Pdf\InvoicePdf;
@@ -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);
}
}
+68 -9
View File
@@ -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 {
EditOutlined, DeleteOutlined, CopyOutlined, MonitorOutlined, PrinterOutlined,
} from '@ant-design/icons';
/**
* 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 [
@@ -171,7 +169,68 @@ 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};