diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js index 42dbe3078..0148d866d 100644 --- a/modules/entry/back/methods/entry/filter.js +++ b/modules/entry/back/methods/entry/filter.js @@ -10,76 +10,81 @@ module.exports = Self => { accepts: [ { arg: 'filter', - type: 'Object', + type: 'object', description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', http: {source: 'query'} }, { arg: 'search', - type: 'String', + type: 'string', description: 'Searchs the entry by id', http: {source: 'query'} }, { arg: 'id', - type: 'Integer', + type: 'integer', description: 'The entry id', http: {source: 'query'} }, { arg: 'created', - type: 'Date', + type: 'date', description: 'The created date to filter', http: {source: 'query'} }, { arg: 'travelFk', - type: 'Number', + type: 'number', description: 'The travel id to filter', http: {source: 'query'} }, { arg: 'companyFk', - type: 'Number', + type: 'number', description: 'The company to filter', http: {source: 'query'} }, { arg: 'isBooked', - type: 'Boolean', + type: 'boolean', description: 'The isBokked filter', http: {source: 'query'} }, { arg: 'isConfirmed', - type: 'Boolean', + type: 'boolean', description: 'The isConfirmed filter', http: {source: 'query'} }, { arg: 'isOrdered', - type: 'Boolean', + type: 'boolean', description: 'The isOrdered filter', http: {source: 'query'} }, { arg: 'ref', - type: 'String', + type: 'string', description: 'The ref filter', http: {source: 'query'} }, { arg: 'supplierFk', - type: 'Number', + type: 'number', description: 'The supplier id to filter', http: {source: 'query'} + }, { + arg: 'invoiceInFk', + type: 'number', + description: 'The invoiceIn id to filter', + http: {source: 'query'} }, { arg: 'currencyFk', - type: 'Number', + type: 'number', description: 'The currency id to filter', http: {source: 'query'} }, { arg: 'from', - type: 'Date', + type: 'date', description: `The from date filter` }, { arg: 'to', - type: 'Date', + type: 'date', description: `The to date filter` } ], returns: { - type: ['Object'], + type: ['object'], root: true }, http: { @@ -116,6 +121,7 @@ module.exports = Self => { case 'travelFk': case 'currencyFk': case 'supplierFk': + case 'invoiceInFk': param = `e.${param}`; return {[param]: value}; } diff --git a/modules/invoiceIn/back/methods/invoice-in/filter.js b/modules/invoiceIn/back/methods/invoice-in/filter.js index 20680f153..0b9825752 100644 --- a/modules/invoiceIn/back/methods/invoice-in/filter.js +++ b/modules/invoiceIn/back/methods/invoice-in/filter.js @@ -17,7 +17,7 @@ module.exports = Self => { { arg: 'search', type: 'string', - description: 'Searchs the invoiceOut by id', + description: 'Searchs the invoiceIn by id', http: {source: 'query'} }, { @@ -25,6 +25,11 @@ module.exports = Self => { type: 'string', description: 'The supplier reference' }, + { + arg: 'supplierFk', + type: 'number', + description: 'The supplier id' + }, { arg: 'fi', type: 'string', @@ -108,6 +113,7 @@ module.exports = Self => { case 'fi': return {[`s.${param}`]: value}; case 'supplierRef': + case 'supplierFk': case 'serialNumber': case 'serial': case 'issued': @@ -132,7 +138,7 @@ module.exports = Self => { ii.isBooked, ii.supplierRef, ii.docFk AS dmsFk, - s.id AS supplierFk, + ii.supplierFk, s.name AS supplierName, s.account, SUM(iid.amount) AS amount, diff --git a/modules/invoiceIn/back/models/invoice-in.json b/modules/invoiceIn/back/models/invoice-in.json index 3310c4346..9bd37e569 100644 --- a/modules/invoiceIn/back/models/invoice-in.json +++ b/modules/invoiceIn/back/models/invoice-in.json @@ -18,6 +18,9 @@ "serial": { "type": "string" }, + "supplierRef": { + "type": "string" + }, "issued": { "type": "date" }, diff --git a/modules/invoiceIn/front/card/index.js b/modules/invoiceIn/front/card/index.js index 8c53ea8b8..99e96ae90 100644 --- a/modules/invoiceIn/front/card/index.js +++ b/modules/invoiceIn/front/card/index.js @@ -3,7 +3,11 @@ import ModuleCard from 'salix/components/module-card'; class Controller extends ModuleCard { reload() { - const filter = {}; + const filter = { + include: { + relation: 'supplier' + } + }; this.$http.get(`InvoiceIns/${this.$params.id}`, {filter}) .then(res => this.invoiceIn = res.data); diff --git a/modules/invoiceIn/front/descriptor/index.html b/modules/invoiceIn/front/descriptor/index.html index e69de29bb..42a946913 100644 --- a/modules/invoiceIn/front/descriptor/index.html +++ b/modules/invoiceIn/front/descriptor/index.html @@ -0,0 +1,49 @@ + + + + Delete Invoice + + + +
+ + + + + + + + + {{$ctrl.invoiceIn.supplier.nickname}} + + +
+ +
+
+ + + + diff --git a/modules/invoiceIn/front/descriptor/index.js b/modules/invoiceIn/front/descriptor/index.js index 6b22dd62b..be507e0d4 100644 --- a/modules/invoiceIn/front/descriptor/index.js +++ b/modules/invoiceIn/front/descriptor/index.js @@ -10,6 +10,26 @@ class Controller extends Descriptor { this.entity = value; } + get entryFilter() { + if (this.invoiceIn) + return JSON.stringify({invoiceInFk: this.invoiceIn.id}); + + return null; + } + + get invoiceInFilter() { + if (this.invoiceIn) + return JSON.stringify({supplierFk: this.invoiceIn.supplierFk}); + + return null; + } + + deleteInvoiceIn() { + return this.$http.delete(`InvoiceIns/${this.id}`) + .then(() => this.$state.go('invoiceIn.index')) + .then(() => this.vnApp.showSuccess(this.$t('InvoiceIn deleted'))); + } + loadData() { const filter = { include: [ diff --git a/modules/invoiceIn/front/descriptor/locale/es.yml b/modules/invoiceIn/front/descriptor/locale/es.yml new file mode 100644 index 000000000..4788ec8aa --- /dev/null +++ b/modules/invoiceIn/front/descriptor/locale/es.yml @@ -0,0 +1,3 @@ +Entries list: Listado de entradas +Invoice list: Listado de facturas +InvoiceIn deleted: Factura eliminada \ No newline at end of file diff --git a/modules/invoiceIn/front/index/index.html b/modules/invoiceIn/front/index/index.html index c554dfd5f..acac61907 100644 --- a/modules/invoiceIn/front/index/index.html +++ b/modules/invoiceIn/front/index/index.html @@ -22,26 +22,28 @@ - + {{::invoiceIn.id}} {{::invoiceIn.supplierName}} - + {{::invoiceIn.supplierRef | dashIfEmpty}} - {{::invoiceIn.serialNumber}} - {{::invoiceIn.serial}} - {{::invoiceIn.account}} + {{::invoiceIn.serialNumber}} + {{::invoiceIn.serial}} + {{::invoiceIn.account}} {{::invoiceIn.issued | date:'dd/MM/yyyy' | dashIfEmpty}} - + {{::invoiceIn.awbCode}} {{::invoiceIn.amount | currency:'EUR'}} @@ -68,7 +70,7 @@ invoice-in="$ctrl.selectedinvoiceIn"> - - + -->