diff --git a/front/core/components/multi-check/locale/en.yml b/front/core/components/multi-check/locale/en.yml
new file mode 100644
index 000000000..ea52dcf8f
--- /dev/null
+++ b/front/core/components/multi-check/locale/en.yml
@@ -0,0 +1 @@
+SelectAllRows: Select the {{rows}} row(s)
\ No newline at end of file
diff --git a/front/core/components/multi-check/locale/es.yml b/front/core/components/multi-check/locale/es.yml
new file mode 100644
index 000000000..5365c3392
--- /dev/null
+++ b/front/core/components/multi-check/locale/es.yml
@@ -0,0 +1,3 @@
+SelectAllRows: Seleccionar las {{rows}} fila(s)
+All: Se han seleccionado
+row(s) have been selected.: fila(s).
\ No newline at end of file
diff --git a/front/core/components/multi-check/multi-check.html b/front/core/components/multi-check/multi-check.html
index fb950aaff..17b7598c3 100644
--- a/front/core/components/multi-check/multi-check.html
+++ b/front/core/components/multi-check/multi-check.html
@@ -2,4 +2,23 @@
ng-model="$ctrl.checked"
indeterminate="$ctrl.isIndeterminate"
translate-attr="{title: 'Check all'}">
-
\ No newline at end of file
+
+
+
+
+
+ All
+
+ {{$ctrl.rows}}
+
+ row(s) have been selected.
+
+ {{$ctrl.AllRowsCount}}
+
+
+
\ No newline at end of file
diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js
index afa1bc3c4..42ceb1887 100644
--- a/front/core/components/multi-check/multi-check.js
+++ b/front/core/components/multi-check/multi-check.js
@@ -138,6 +138,27 @@ export default class MultiCheck extends FormInput {
});
}
+ countRows() {
+ if (!this.model || !this.model.data) return;
+ const data = this.model.data;
+ const params = {
+ filter: {
+ where: this.model.userParams,
+ limit: null
+ }
+ };
+
+ this.$http.get(this.model.url, {params})
+ .then(res => {
+ this.AllRows = res.data;
+ this.AllRowsCount = this.$t('SelectAllRows', {
+ rows: res.data.length
+ });
+ });
+ this.rows = data.length;
+ this.checkedDummy = data.length;
+ }
+
/**
* Toggles checked property on
* all instances
@@ -158,7 +179,9 @@ ngModule.vnComponent('vnMultiCheck', {
checkField: '@?',
checkAll: '=?',
checked: '=?',
- disabled: ''
+ disabled: '',
+ checkDummy: '',
+ checkedDummy: '=?'
}
});
diff --git a/front/core/components/multi-check/style.scss b/front/core/components/multi-check/style.scss
index 79c2397bc..7a4d10675 100644
--- a/front/core/components/multi-check/style.scss
+++ b/front/core/components/multi-check/style.scss
@@ -1,5 +1,17 @@
+@import "variables";
vn-multi-check {
.vn-check {
margin-bottom: 12px
}
+
+ vn-list{
+ padding: 50px;
+ }
+ vn-menu{
+ padding: 50px;
+ }
+
+}
+.bold{
+ font-weight: bold;
}
\ No newline at end of file
diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js
index fb0397d2b..3a856e87c 100644
--- a/modules/entry/back/methods/entry/editLatestBuys.js
+++ b/modules/entry/back/methods/entry/editLatestBuys.js
@@ -19,6 +19,11 @@ module.exports = Self => {
type: ['Object'],
required: true,
description: `the buys which will be modified`
+ },
+ {
+ arg: 'filter',
+ type: ['object'],
+ description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string'
}],
returns: {
type: 'Object',
@@ -30,8 +35,9 @@ module.exports = Self => {
}
});
- Self.editLatestBuys = async(field, newValue, lines, options) => {
+ Self.editLatestBuys = async(field, newValue, lines, filter, options) => {
let tx;
+ console.log(filter);
const myOptions = {};
if (typeof options == 'object')
@@ -64,8 +70,16 @@ module.exports = Self => {
const models = Self.app.models;
const model = models[modelName];
-
try {
+ let result;
+ console.log(filter);
+
+ if (filter) {
+ result = await model.upsertWithWhere(filter, value, myOptions);
+ if (tx) await tx.commit();
+ return result;
+ }
+
const promises = [];
const targets = lines.map(line => {
@@ -74,11 +88,10 @@ module.exports = Self => {
const value = {};
value[field] = newValue;
-
for (let target of targets)
promises.push(model.upsertWithWhere({id: target}, value, myOptions));
- const result = await Promise.all(promises);
+ result = await Promise.all(promises);
if (tx) await tx.commit();
diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html
index 4eeeeedce..3b9c12860 100644
--- a/modules/entry/front/latest-buys/index.html
+++ b/modules/entry/front/latest-buys/index.html
@@ -31,7 +31,9 @@
+ check-field="$checked"
+ check-dummy="$ctrl.checkDummy"
+ checked-dummy="$ctrl.checkedDummy">
Picture |
diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js
index 385e7e4b6..477aa6ad7 100644
--- a/modules/entry/front/latest-buys/index.js
+++ b/modules/entry/front/latest-buys/index.js
@@ -89,11 +89,13 @@ export default class Controller extends Section {
get checked() {
const buys = this.$.model.data || [];
- const checkedBuys = [];
+ let checkedBuys = [];
for (let buy of buys) {
if (buy.$checked)
checkedBuys.push(buy);
}
+ if (this.checkedDummy)
+ checkedBuys = this.checkedDummy;
return checkedBuys;
}
@@ -149,11 +151,12 @@ export default class Controller extends Section {
const rowsToEdit = [];
for (let row of this.checked)
rowsToEdit.push({id: row.id, itemFk: row.itemFk});
-
+ console.log(this.editFilter);
const data = {
field: this.editedColumn.field,
newValue: this.editedColumn.newValue,
- lines: rowsToEdit
+ lines: rowsToEdit,
+ filter: this.editFilter
};
return this.$http.post('Buys/editLatestBuys', data)
@@ -162,6 +165,11 @@ export default class Controller extends Section {
this.$.model.refresh();
});
}
+
+ checkDummy() {
+ console.log('editFilter', this.model.userParams);
+ this.editFilter = this.model.userParams;
+ }
}
ngModule.component('vnEntryLatestBuys', {