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