2595 - Added invoiceIn module #545
|
@ -0,0 +1 @@
|
|||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) VALUES ('InvoiceIn', '*', '*', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -29,7 +29,7 @@ export default class Contextmenu {
|
|||
if (!event.defaultPrevented)
|
||||
event.preventDefault();
|
||||
|
||||
if (!this.isFilterEnabled()) return;
|
||||
if (!this.isMenuEnabled()) return;
|
||||
|
||||
const parent = this.$.contextmenu;
|
||||
parent.style.top = event.pageY + 'px';
|
||||
|
@ -121,13 +121,31 @@ export default class Contextmenu {
|
|||
return isEnabled != 'false';
|
||||
}
|
||||
|
||||
isMenuEnabled() {
|
||||
if (!this.rowHeader) return true;
|
||||
const isEnabled = this.rowHeader.getAttribute('menu-enabled');
|
||||
|
||||
return isEnabled != 'false';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if filter
|
||||
* by selection is allowed
|
||||
* by selection is enabled and
|
||||
* the menu can be interacted
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isFilterAllowed() {
|
||||
return this.isActionAllowed() && this.isFilterEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the
|
||||
* context menu can be interacted
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isActionAllowed() {
|
||||
if (!this.target) return false;
|
||||
const isTableCell = this.target.closest('vn-td, .vn-td');
|
||||
|
||||
|
@ -179,9 +197,13 @@ export default class Contextmenu {
|
|||
if (!where) return;
|
||||
|
||||
const whereKeys = Object.keys(where);
|
||||
for (let key of whereKeys)
|
||||
for (let key of whereKeys) {
|
||||
removeProp(where, filterKey, key);
|
||||
|
||||
if (!Object.keys(where))
|
||||
delete userFilter.where;
|
||||
}
|
||||
|
||||
function removeProp(instance, findProp, prop) {
|
||||
if (prop == findProp)
|
||||
delete instance[prop];
|
||||
|
@ -208,6 +230,16 @@ export default class Contextmenu {
|
|||
const userParams = this.model.userParams;
|
||||
this.model.applyFilter(null, userParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the current field
|
||||
* value to the clipboard
|
||||
*/
|
||||
copyValue() {
|
||||
console.log(this.field);
|
||||
if (navigator && navigator.clipboard)
|
||||
navigator.clipboard.writeText(this.fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
Contextmenu.$inject = ['$element', '$scope', '$transclude'];
|
||||
|
|
|
@ -60,11 +60,6 @@ module.exports = Self => {
|
|||
type: 'number',
|
||||
description: 'The account number'
|
||||
},
|
||||
{
|
||||
arg: 'hasPdf',
|
||||
type: 'boolean',
|
||||
description: 'Whether the the invoice has PDF or not',
|
||||
},
|
||||
{
|
||||
arg: 'isBooked',
|
||||
type: 'boolean',
|
||||
|
@ -90,12 +85,9 @@ module.exports = Self => {
|
|||
return /^\d+$/.test(value)
|
||||
? {'ii.id': value}
|
||||
: {'s.name': {like: `%${value}%`}};
|
||||
case 'hasPdf':
|
||||
return {'i.hasPdf': value};
|
||||
case 'account':
|
||||
case 'fi':
|
||||
return {[`s.${param}`]: value};
|
||||
case 'amount':
|
||||
case 'supplierRef':
|
||||
case 'serialNumber':
|
||||
case 'serial':
|
||||
|
@ -130,13 +122,25 @@ module.exports = Self => {
|
|||
LEFT JOIN company co ON co.id = ii.companyFk`
|
||||
);
|
||||
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
const sqlWhere = conn.makeWhere(filter.where);
|
||||
|
||||
stmt.merge(sqlWhere);
|
||||
stmt.merge(`GROUP BY ii.id`);
|
||||
|
||||
const amount = ctx.args.amount;
|
||||
if (amount) {
|
||||
stmt.merge({
|
||||
sql: `HAVING SUM(iid.amount) = ?`,
|
||||
params: [amount],
|
||||
});
|
||||
}
|
||||
|
||||
stmt.merge(conn.makePagination(filter));
|
||||
|
||||
let itemsIndex = stmts.push(stmt) - 1;
|
||||
|
||||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
console.log(sql.sql);
|
||||
let result = await conn.executeStmt(sql);
|
||||
return itemsIndex === 0 ? result : result[itemsIndex];
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<vn-th field="account">Account</vn-th>
|
||||
<vn-th field="issued" expand>Issued</vn-th>
|
||||
<vn-th field="isBooked" center>Is booked</vn-th>
|
||||
<vn-th field="amount">Amount</vn-th>
|
||||
<vn-th field="amount" filter-enabled="false">Amount</vn-th>
|
||||
<vn-th></vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
|
@ -93,6 +93,7 @@
|
|||
Remove all filters
|
||||
</vn-item>
|
||||
<vn-item translate
|
||||
ng-if="contextmenu.isActionAllowed()"
|
||||
ng-click="contextmenu.copyValue()" >
|
||||
Copy value
|
||||
</vn-item>
|
||||
|
|
|
@ -30,6 +30,8 @@ export default class Controller extends Section {
|
|||
case 'account':
|
||||
case 'fi':
|
||||
return {[`s.${param}`]: value};
|
||||
default:
|
||||
return {[param]: value};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,5 +109,10 @@
|
|||
ng-click="contextmenu.removeAllFilters()" >
|
||||
Remove all filters
|
||||
</vn-item>
|
||||
<vn-item translate
|
||||
ng-if="contextmenu.isActionAllowed()"
|
||||
ng-click="contextmenu.copyValue()" >
|
||||
Copy value
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
</vn-contextmenu>
|
|
@ -153,5 +153,10 @@
|
|||
ng-click="contextmenu.removeAllFilters()" >
|
||||
Remove all filters
|
||||
</vn-item>
|
||||
<vn-item translate
|
||||
ng-if="contextmenu.isActionAllowed()"
|
||||
ng-click="contextmenu.copyValue()" >
|
||||
Copy value
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
</vn-contextmenu>
|
|
@ -213,5 +213,10 @@
|
|||
ng-click="contextmenu.removeAllFilters()" >
|
||||
Remove all filters
|
||||
</vn-item>
|
||||
<vn-item translate
|
||||
ng-if="contextmenu.isActionAllowed()"
|
||||
ng-click="contextmenu.copyValue()" >
|
||||
Copy value
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
</vn-contextmenu>
|
|
@ -9,4 +9,5 @@ Filter by selection: Filtro por selección
|
|||
Exclude selection: Excluir selección
|
||||
Remove filter: Quitar filtro por selección
|
||||
Remove all filters: Eliminar todos los filtros
|
||||
Copy value: Copiar valor
|
||||
No verified data: Sin datos comprobados
|
|
@ -106,5 +106,10 @@
|
|||
ng-click="contextmenu.removeAllFilters()" >
|
||||
Remove all filters
|
||||
</vn-item>
|
||||
<vn-item translate
|
||||
ng-if="contextmenu.isActionAllowed()"
|
||||
ng-click="contextmenu.copyValue()" >
|
||||
Copy value
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
</vn-contextmenu>
|
Loading…
Reference in New Issue