diff --git a/client/core/src/multi-check/multi-check.js b/client/core/src/multi-check/multi-check.js
index 52761d8980..14e14760e9 100644
--- a/client/core/src/multi-check/multi-check.js
+++ b/client/core/src/multi-check/multi-check.js
@@ -1,17 +1,24 @@
import {module} from '../module';
import './multi-check.scss';
-/*
-* @description Draw checkbox with a drop-down and multi options
-* @param {Array} options - List of options shown in drop-down
-* @param {Array} models - Elements to check / unCheck
-* @param {String=} className - Optional css class name
-*/
+/**
+ * Draw checkbox with a drop-down and multi options
+ * @param {Array} options List of options shown in drop-down
+ * @param {Array} models Elements to check / unCheck
+ * @param {String} className Optional css class name
+ */
export default class MultiCheck {
constructor() {
this._checkAll = 0;
+ this._models = [];
this.type = {};
this.showDropDown = false;
}
+ get models() {
+ return this._models;
+ }
+ set models(value) {
+ this._models = value;
+ }
get checkAll() {
return this._checkAll;
}
@@ -20,24 +27,25 @@ export default class MultiCheck {
this.switchChecks();
}
switchChecks() {
- this.models.forEach(
- el => {
- let checked;
- if (this.type.id && this.type.id !== 'all' && this.type.id !== 'any') {
- if (this.type.id.length > 3 && this.type.id.substr(0, 3) === 'no-') {
- checked = el[this.type.id.replace('no-', '')] ? false : true;
- } else if (this.type.id.length > 6 && this.type.id.substr(0, 6) === 'equal-') {
- let label = this.type.id.replace('equal-', '');
- checked = (el[label] && el[label] === this.type.name);
+ if (this.models)
+ this.models.forEach(
+ el => {
+ let checked;
+ if (this.type.id && this.type.id !== 'all' && this.type.id !== 'any') {
+ if (this.type.id.length > 3 && this.type.id.substr(0, 3) === 'no-') {
+ checked = el[this.type.id.replace('no-', '')] == null;
+ } else if (this.type.id.length > 6 && this.type.id.substr(0, 6) === 'equal-') {
+ let label = this.type.id.replace('equal-', '');
+ checked = (el[label] && el[label] === this.type.name);
+ } else {
+ checked = el[this.type.id] != null;
+ }
} else {
- checked = el[this.type.id] ? true : false;
+ checked = this.checkAll === 1;
}
- } else {
- checked = this.checkAll === 1;
+ el.checked = checked;
}
- el.checked = checked;
- }
- );
+ );
}
$onChanges() {
this.type = {};
diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html
index fd39539305..6ca4e261bd 100644
--- a/client/production/src/index/index.html
+++ b/client/production/src/index/index.html
@@ -13,7 +13,7 @@
icon="keyboard_arrow_down"
ng-click="$ctrl.moreFilters($event)">
-
+
@@ -49,58 +49,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{::ticket.ticketFk}}
- {{::ticket.agency}}
- {{::ticket.salesPerson | ucwords}}
- {{ticket.hour}}
- {{ticket.state}}
- {{::ticket.lines}}
- {{::ticket.m3}}
- {{::ticket.boxes}}
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js
index 264f8ae3ad..b1755e0213 100644
--- a/client/production/src/index/index.js
+++ b/client/production/src/index/index.js
@@ -9,26 +9,21 @@ export default class ProductionIndex {
this.vnPopover = vnPopover;
this.vnApp = vnApp;
this.$translate = $translate;
- this.fakeIndex = {
- filter: {
- page: 1,
- size: 25
- }
- };
- this.order = {};
this.filter = {};
- this.order = {};
-
this.tickets = [];
this.states = [];
- this.lines = 0;
- this.meters = 0;
- this.totalFilter = 0;
+ this.ticketsSelected = [];
this.actions = {
state: null,
worker: null,
- hour: null
+ hours: null
};
+ this.footer = {
+ total: null,
+ lines: null,
+ meters: null
+ };
+
this.hourItems = [];
this.child = undefined;
this.warehouse = {
@@ -71,20 +66,19 @@ export default class ProductionIndex {
// End Actions Callbacks
doAction(action) {
- let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]:checked');
- if (checks.length) {
- let ids = [];
- let index = [];
- let tickets = [];
- this.tickets.forEach(
- (val, i) => {
- if (val.checked) {
- ids.push(val.ticketFk);
- index.push(i);
- tickets.push({ticketFk: val.ticketFk, salesPersonFk: val.salesPersonFk});
- }
+ let ids = [];
+ let index = [];
+ let tickets = [];
+ this.tickets.forEach(
+ (val, i) => {
+ if (val.checked) {
+ ids.push(val.ticketFk);
+ index.push(i);
+ tickets.push({ticketFk: val.ticketFk, salesPersonFk: val.salesPersonFk});
}
- );
+ }
+ );
+ if (tickets.length) {
switch (action) {
case 'changeState' :
this._changeState(ids, this.actions.state.id, this.actions.state.name, index);
@@ -115,7 +109,7 @@ export default class ProductionIndex {
event.preventDefault();
}
onChildSubmit(filter) {
- this.filterTickets(filter);
+ this.searchTickets(filter);
this.onChildCancel();
}
onChildCancel() {
@@ -124,39 +118,28 @@ export default class ProductionIndex {
delete this.child;
}
// END modals and actions modals
- searchTickets() {
- let filters = Object.assign({}, {
- where: this.filter
- }, {
- page: this.fakeIndex.filter.page,
- limit: this.fakeIndex.filter.size
- });
- if (this.order.field) {
- filters.order = this.order.field + ' ' + this.order.dir;
- }
- this.$http.get('/production/api/FakeProductions/list?filter=' + JSON.stringify(filters)).then(
- json => {
- this.tickets = json.data.tickets;
- this.lines = json.data.lines;
- this.meters = json.data.m3;
- this.totalFilter = json.data.total;
- this.fakeIndex.model = json.data.tickets;
- }
- );
- }
- filterTickets(filter) {
+ searchTickets(filter) {
if (filter) {
this.filter = Object.assign({}, this.filter, filter);
}
- this.order = {field: null, dir: null};
- this.fakeIndex.filter.page = 1;
- this.fakeIndex.model = [];
- this.searchTickets();
- }
- onOrder(field, dir) {
- this.order = {field: field, dir: dir};
- this.searchTickets();
+
+ let filters = Object.assign({}, {
+ where: this.filter
+ }, {
+ page: 1,
+ limit: 700
+ });
+
+ this.$http.get('/production/api/FakeProductions/list?filter=' + JSON.stringify(filters)).then(
+ json => {
+ this.tickets = json.data.tickets;
+ this.footer.lines = json.data.lines;
+ this.footer.meters = json.data.m3;
+ this.footer.total = json.data.total;
+ }
+ );
}
+
$doCheck() {
if (this.actions.state) {
this.doAction('changeState');
@@ -175,7 +158,7 @@ export default class ProductionIndex {
hour += ':00';
this.hourItems.push({id: i, name: hour});
}
- this.filterTickets();
+ this.searchTickets();
}
}
ProductionIndex.$inject = ['$element', '$scope', '$http', 'vnPopover', 'vnApp', '$translate'];
diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss
index a47cdc4b22..eea97e50e1 100644
--- a/client/production/src/index/style.scss
+++ b/client/production/src/index/style.scss
@@ -33,8 +33,4 @@ vn-production-index {
width: 600px;
}
}
- .list-content{
- height: 531px;
- overflow-y: auto;
- }
}
\ No newline at end of file
diff --git a/client/production/src/production-table/production-table.html b/client/production/src/production-table/production-table.html
new file mode 100644
index 0000000000..29af2918ab
--- /dev/null
+++ b/client/production/src/production-table/production-table.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{::ticket.ticketFk}}
+ {{::ticket.agency}}
+ {{::ticket.salesPerson | ucwords}}
+ {{ticket.hour}}
+ {{ticket.state}}
+ {{::ticket.lines}}
+ {{::ticket.m3}}
+ {{::ticket.boxes}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/client/production/src/production-table/production-table.js b/client/production/src/production-table/production-table.js
new file mode 100644
index 0000000000..e0ef06d666
--- /dev/null
+++ b/client/production/src/production-table/production-table.js
@@ -0,0 +1,48 @@
+import ngModule from '../module';
+
+export class ProductionTable {
+ constructor($filter) {
+ this.$filter = $filter;
+ this._tickets = [];
+ this.itemsDisplayedInList = 10;
+ this.pageTable = {
+ filter: {
+ page: 1,
+ size: this.itemsDisplayedInList
+ },
+ model: []
+ };
+ }
+ set tickets(value) {
+ this._tickets = value;
+ this.totalFilter = this._tickets.length;
+ this.pageTable.model = this._tickets.slice(0, this.itemsDisplayedInList);
+ }
+ get tickets() {
+ return this._tickets;
+ }
+ onOrder(field, order) {
+ let reverse = order === 'DESC';
+ this.tickets = this.$filter('orderBy')(this.tickets, field, reverse);
+ let init = (this.pageTable.filter.page - 1) * this.itemsDisplayedInList;
+ let fin = this.pageTable.filter.page * this.itemsDisplayedInList;
+ this.pageTable.model = this.tickets.slice(init, fin);
+ }
+ pageTickets() {
+ let init = (this.pageTable.filter.page - 1) * this.itemsDisplayedInList;
+ let fin = this.pageTable.filter.page * this.itemsDisplayedInList;
+ this.pageTable.model = this.tickets.slice(init, fin);
+ }
+}
+
+ProductionTable.$inject = ['$filter'];
+
+ngModule.component('vnProductionTable', {
+ template: require('./production-table.html'),
+ bindings: {
+ tickets: '=',
+ footer: '<',
+ selected: '='
+ },
+ controller: ProductionTable
+});
diff --git a/client/production/src/production.js b/client/production/src/production.js
index f9f4eeb081..a784a76ae2 100644
--- a/client/production/src/production.js
+++ b/client/production/src/production.js
@@ -4,4 +4,5 @@ export * from './module';
// import components
import './index/index';
import './production-filters/production-filters';
-import './production-comment/production-comment';
+// import './production-comment/production-comment';
+import './production-table/production-table';
diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss
index 6c2ca8eb71..67ffda0856 100644
--- a/client/salix/src/styles/misc.scss
+++ b/client/salix/src/styles/misc.scss
@@ -51,7 +51,7 @@ html [vn-center], .vn-center{
min-width: 60px;
}
-.list-body{
+.list-element{
padding: 4px 0px;
border-bottom: 1px solid $color-medium-grey;
i {
@@ -67,7 +67,7 @@ html [vn-center], .vn-center{
font-weight: bold;
text-align: center
}
- .list-body{
+ .list-element{
white-space: nowrap;
}
}
@@ -75,7 +75,7 @@ html [vn-center], .vn-center{
font-weight: bold;
border-top: 3px solid $color-medium-grey;
}
-.list-body.warning{
+.list-element.warning{
background-color: $color-orange;
color:$color-white;
font-weight: bold;