Merge branch 'dev' of https://git.verdnatura.es/salix into dev
# Conflicts: # client/production/src/index/index.js
This commit is contained in:
commit
e9c0fa5cc9
|
@ -8,6 +8,7 @@
|
|||
<vn-one>
|
||||
<ul class="dropdown">
|
||||
<li ng-repeat="item in $ctrl.items | filter:search" ng-click="$ctrl.selected = item">{{::item.name}}</li>
|
||||
<li ng-if="$ctrl.showLoadMore" class="dropdown__loadMore" ng-click="$ctrl.loadMore()" translate="Load More"></li>
|
||||
</ul>
|
||||
</vn-one>
|
||||
</vn-vertical>
|
|
@ -5,11 +5,22 @@ export default class DropDown {
|
|||
constructor($element, $scope) {
|
||||
this.$element = $element;
|
||||
this.$ = $scope;
|
||||
this._showLoadMore = false;
|
||||
}
|
||||
get showLoadMore() {
|
||||
return this._showLoadMore;
|
||||
}
|
||||
set showLoadMore(value) {
|
||||
this._showLoadMore = value;
|
||||
}
|
||||
|
||||
$onChanges(changesObj) {
|
||||
if (changesObj.show && changesObj.top && changesObj.top.currentValue) {
|
||||
this.$element.css('top', changesObj.top.currentValue + 'px');
|
||||
}
|
||||
if (this.loadMore) {
|
||||
this.showLoadMore = true;
|
||||
}
|
||||
}
|
||||
clearSearch() {
|
||||
this.$.search = '';
|
||||
|
@ -28,6 +39,7 @@ module.component('vnDropDown', {
|
|||
show: '<',
|
||||
filter: '@?',
|
||||
selected: '=',
|
||||
loadMore: '&?',
|
||||
top: '<?'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
vn-grid-header {
|
||||
border-bottom: 3px solid #9D9D9D;
|
||||
font-weight: bold;
|
||||
padding-right: 13px;
|
||||
.orderly{
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="icon-menu" ng-click="$ctrl.show()">
|
||||
<div class="icon-menu">
|
||||
<vn-icon-button icon="{{::$ctrl.icon}}"></vn-icon-button>
|
||||
<vn-drop-down items="$ctrl.items" show="$ctrl.showDropDown" selected="$ctrl.selected" filter="true"></vn-drop-down>
|
||||
</div>
|
|
@ -14,10 +14,6 @@ export default class IconMenu {
|
|||
set showDropDown(value) {
|
||||
this._showDropDown = value;
|
||||
}
|
||||
show() {
|
||||
// this._showDropDown = true;
|
||||
}
|
||||
|
||||
getItems() {
|
||||
this.$http.get(this.url).then(
|
||||
json => {
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
"Accept": "Aceptar",
|
||||
"Cancel": "Cancelar",
|
||||
"Close": "Cerrar",
|
||||
"Clear": "Borrar"
|
||||
"Clear": "Borrar",
|
||||
"Load More": "Cargar más"
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<vn-vertical vn-none class="multi-check {{$ctrl.className}}" tabindex="-1" ng-blur="$ctrl.showDropDown = false">
|
||||
<vn-vertical class="multi-check" vn-none class="multi-check {{$ctrl.className}}" tabindex="-1" ng-blur="$ctrl.showDropDown = false">
|
||||
<vn-one>
|
||||
<vn-horizontal>
|
||||
<vn-none class="primaryCheckbox" ng-if="$ctrl.checkAll===0">
|
||||
|
|
|
@ -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 = {};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vn-multi-check {
|
||||
.multi-check {
|
||||
vn-icon{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -13,12 +13,11 @@
|
|||
icon="keyboard_arrow_down"
|
||||
ng-click="$ctrl.moreFilters($event)">
|
||||
</vn-icon>
|
||||
<vn-button vn-none pad-small-top label="Filtrar" ng-click="$ctrl.filterTickets()"></vn-button>
|
||||
<vn-button vn-none pad-small-top label="Filtrar" ng-click="$ctrl.searchTickets()"></vn-button>
|
||||
</vn-two>
|
||||
<vn-one vn-horizontal>
|
||||
<vn-one></vn-one>
|
||||
<vn-autocomplete vn-two
|
||||
initial-value="$ctrl.warehouse"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
field="$ctrl.warehouseFk"
|
||||
|
@ -30,77 +29,10 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal vn-one margin-large-bottom>
|
||||
<vn-one>
|
||||
<vn-horizontal class="actionPanel">
|
||||
<vn-button vn-none margin-medium-right label="Printed" ng-click="$ctrl.doAction('markPrinted')"></vn-button>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="assignment" items="$ctrl.states" selected="$ctrl.actions.state"></vn-icon-menu>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-button icon="textsms" ng-click="$ctrl.doAction('addComment')"></vn-icon-button>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="person" items="[{id:1,name:'trabajador 01'},{id:2,name:'trabajador 02'},{id:3,name:'trabajador 03'}]"
|
||||
selected="$ctrl.actions.worker"></vn-icon-menu>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="query_builder" items="$ctrl.hourItems" selected="$ctrl.actions.hours"></vn-icon-menu>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
||||
<vn-production-actions tickets="$ctrl.tickets" states="$ctrl.states" hour-items="$ctrl.hourItems"></vn-production-actions>
|
||||
</vn-one>
|
||||
<vn-two></vn-two>
|
||||
</vn-horizontal>
|
||||
|
||||
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||
<vn-none min-none></vn-none>
|
||||
<vn-colum-header vn-none min-none>
|
||||
<vn-multi-check models="$ctrl.tickets" options="[{id:'all',name:'Todos'},{id:'any',name:'Ninguno'},{id:'problem',name:'Con incidencia'},{id:'no-problem',name:'Sin incidencia'}]"></vn-multi-check>
|
||||
</vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="ticketFk" text="ID Ticket"></vn-colum-header>
|
||||
<vn-colum-header vn-two pad-medium-h field="agency" text="Agency"></vn-colum-header>
|
||||
<vn-colum-header vn-two pad-medium-h field="salesPerson" text="Commercial"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="hour" text="Hour"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="state" text="State"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="lines" text="Lines"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="m3" text="m3"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="boxes" text="Boxes"></vn-colum-header>
|
||||
<vn-none min-none></vn-none>
|
||||
</vn-grid-header>
|
||||
<vn-one class="list list-content">
|
||||
<vn-horizontal vn-one class="list list-body text-center" ng-repeat="ticket in $ctrl.tickets track by ticket.id" ng-class="{warning: ticket.problem==='RIESGO'}">
|
||||
<vn-none>
|
||||
<vn-icon margin-small-left icon="report_problem" ng-if="ticket.problem" vn-tooltip="{{ticket.problem}}" tooltip-position="right"></vn-icon>
|
||||
</vn-none>
|
||||
<vn-none>
|
||||
<vn-check model="ticket.checked"></vn-check>
|
||||
</vn-none>
|
||||
<vn-one pad-medium-h>{{::ticket.ticketFk}}</vn-one>
|
||||
<vn-two pad-medium-h>{{::ticket.agency}}</vn-two>
|
||||
<vn-two pad-medium-h>{{::ticket.salesPerson | ucwords}}</vn-two>
|
||||
<vn-one pad-medium-h>{{ticket.hour}}</vn-one>
|
||||
<vn-one pad-medium-h>{{ticket.state}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.lines}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.m3}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.boxes}}</vn-one>
|
||||
<vn-none>
|
||||
<vn-icon icon="more" vn-tooltip tooltip-template="/static/templates/tooltip.locator.tpl.html" tooltip-position="left"></vn-icon>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
||||
</vn-one>
|
||||
<vn-horizontal vn-one class="list list-footer">
|
||||
<vn-none></vn-none>
|
||||
<vn-none></vn-none>
|
||||
<vn-one pad-medium-h>
|
||||
<span translate="Resultados"></span>:
|
||||
<span>{{$ctrl.totalFilter}}</span>
|
||||
</vn-one>
|
||||
<vn-six></vn-six>
|
||||
<vn-one pad-medium-h text-right>{{$ctrl.lines}}</vn-one>
|
||||
<vn-one pad-medium-h text-right>{{$ctrl.meters}}</vn-one>
|
||||
<vn-one></vn-one>
|
||||
<vn-none></vn-none>
|
||||
</vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-paging page-change="$ctrl.searchTickets()" index="$ctrl.fakeIndex" total="$ctrl.totalFilter"></vn-paging>
|
||||
</vn-one>
|
||||
<vn-production-table tickets="$ctrl.tickets" footer="$ctrl.footer"></vn-production-table>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
|
@ -2,32 +2,18 @@ import ngModule from '../module';
|
|||
import './style.scss';
|
||||
|
||||
export default class ProductionIndex {
|
||||
constructor($element, $scope, $http, vnPopover, vnApp, $translate) {
|
||||
constructor($element, $scope, $http, vnPopover) {
|
||||
this.$element = $element;
|
||||
this.$ = $scope;
|
||||
this.$http = $http;
|
||||
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.actions = {
|
||||
state: null,
|
||||
worker: null,
|
||||
hour: null
|
||||
this.footer = {
|
||||
total: null,
|
||||
lines: null,
|
||||
meters: null
|
||||
};
|
||||
this.hourItems = [];
|
||||
this.child = undefined;
|
||||
|
@ -69,42 +55,6 @@ 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});
|
||||
}
|
||||
}
|
||||
);
|
||||
switch (action) {
|
||||
case 'changeState' :
|
||||
this._changeState(ids, this.actions.state.id, this.actions.state.name, index);
|
||||
break;
|
||||
case 'addComment':
|
||||
this._sendMessage(tickets);
|
||||
break;
|
||||
case 'markPrinted':
|
||||
this._changeState(ids, 4, 'Impreso', index);
|
||||
break;
|
||||
case 'changeTime':
|
||||
this._changeTime(ids, this.actions.hours.name, index);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.vnApp.showMessage(this.$translate.instant('Error: No tickets selected!'));
|
||||
}
|
||||
}
|
||||
|
||||
// Start modals and actions modals
|
||||
moreFilters(event) {
|
||||
this.child = this.vnPopover.showComponent('vn-production-filter-panel', this.$, this.$element[0].querySelector('.filterPanel'));
|
||||
var childCtrl = angular.element(this.child).isolateScope().$ctrl;
|
||||
|
@ -115,7 +65,7 @@ export default class ProductionIndex {
|
|||
event.preventDefault();
|
||||
}
|
||||
onChildSubmit(filter) {
|
||||
this.filterTickets(filter);
|
||||
this.searchTickets(filter);
|
||||
this.onChildCancel();
|
||||
}
|
||||
onChildCancel() {
|
||||
|
@ -123,51 +73,24 @@ export default class ProductionIndex {
|
|||
angular.element(this.child).remove();
|
||||
delete this.child;
|
||||
}
|
||||
// END modals and actions modals
|
||||
searchTickets() {
|
||||
searchTickets(filter) {
|
||||
let filters = Object.assign({}, {
|
||||
where: this.filter
|
||||
where: Object.assign({}, filter, this.filter)
|
||||
}, {
|
||||
page: this.fakeIndex.filter.page,
|
||||
limit: this.fakeIndex.filter.size
|
||||
page: 1,
|
||||
limit: 700
|
||||
});
|
||||
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;
|
||||
this.footer.lines = json.data.lines;
|
||||
this.footer.meters = json.data.m3;
|
||||
this.footer.total = json.data.total;
|
||||
}
|
||||
);
|
||||
}
|
||||
filterTickets(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();
|
||||
}
|
||||
$doCheck() {
|
||||
if (this.actions.state) {
|
||||
this.doAction('changeState');
|
||||
this.actions.state = null;
|
||||
} else if (this.actions.hours) {
|
||||
this.doAction('changeTime');
|
||||
this.actions.hours = null;
|
||||
}
|
||||
}
|
||||
$onInit() {
|
||||
for (let i = 6; i < 21; i++) {
|
||||
for (let i = 1; i <= 24; i++) {
|
||||
let hour = [i].join('');
|
||||
if (hour.length === 1) {
|
||||
hour = [0, i].join('');
|
||||
|
@ -175,10 +98,10 @@ 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'];
|
||||
ProductionIndex.$inject = ['$element', '$scope', '$http', 'vnPopover'];
|
||||
|
||||
ngModule.component('vnProductionIndex', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -33,8 +33,4 @@ vn-production-index {
|
|||
width: 600px;
|
||||
}
|
||||
}
|
||||
.list-content{
|
||||
height: 531px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<vn-horizontal class="actionPanel">
|
||||
<vn-button vn-none margin-medium-right label="Printed" ng-click="$ctrl.doAction('markPrinted')"></vn-button>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="assignment" items="$ctrl.states" selected="$ctrl.actionState"></vn-icon-menu>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-button icon="textsms" ng-click="$ctrl.doAction('addComment')"></vn-icon-button>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="person" items="[{id:1,name:'trabajador 01'},{id:2,name:'trabajador 02'},{id:3,name:'trabajador 03'}]"
|
||||
selected="$ctrl.actionWorker"></vn-icon-menu>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="query_builder" items="$ctrl.hourItems" selected="$ctrl.actionHours"></vn-icon-menu>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
|
@ -0,0 +1,115 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
export default class ProductionActions {
|
||||
constructor($http, $translate, vnApp) {
|
||||
this.$http = $http;
|
||||
this.$translate = $translate;
|
||||
this.vnApp = vnApp;
|
||||
|
||||
this._actionState = null;
|
||||
this._actionWorker = null;
|
||||
this._actionHours = null;
|
||||
}
|
||||
|
||||
set actionState(value) {
|
||||
this._actionState = value;
|
||||
this.doAction('changeState');
|
||||
}
|
||||
get actionState() {
|
||||
return this._actionState;
|
||||
}
|
||||
|
||||
set actionHours(value) {
|
||||
this._actionHours = value;
|
||||
this.doAction('changeTime');
|
||||
}
|
||||
get actionHours() {
|
||||
return this._actionHours;
|
||||
}
|
||||
|
||||
set actionWorker(value) {
|
||||
this._actionWorker = value;
|
||||
this.doAction('changeWorker');
|
||||
}
|
||||
get actionWorker() {
|
||||
return this._actionWorker;
|
||||
}
|
||||
|
||||
_changeState(ids, sateteId, stateName, index) {
|
||||
this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then(
|
||||
() => {
|
||||
index.forEach(
|
||||
i => {
|
||||
this.tickets[i].state = stateName;
|
||||
this.tickets[i].stateFk = sateteId;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
_sendMessage(tickets) {
|
||||
this.$http.post(`/production/api/TicketStates/messageSend`, {tickets: tickets}).then(
|
||||
() => {
|
||||
this.vnApp.showMessage(this.$translate.instant('Success: message send!'));
|
||||
}
|
||||
);
|
||||
}
|
||||
_changeTime(ids, time, index) {
|
||||
this.$http.put(`/production/api/changeTime?time=${time}`, {tickets: ids}).then(
|
||||
() => {
|
||||
index.forEach(
|
||||
i => {
|
||||
this.tickets[i].hour = time;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
doAction(actionName) {
|
||||
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 (actionName) {
|
||||
case 'changeState' :
|
||||
this._changeState(ids, this.actionState.id, this.actionState.name, index);
|
||||
break;
|
||||
case 'addComment':
|
||||
this._sendMessage(tickets);
|
||||
break;
|
||||
case 'markPrinted':
|
||||
this._changeState(ids, 4, 'Impreso', index);
|
||||
break;
|
||||
case 'changeTime':
|
||||
this._changeTime(ids, this.actionHours.name, index);
|
||||
break;
|
||||
default:
|
||||
this.vnApp.showMessage(this.$translate.instant('Error: No jet implemented!'));
|
||||
}
|
||||
} else {
|
||||
this.vnApp.showMessage(this.$translate.instant('Error: No tickets selected!'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProductionActions.$inject = ['$http', '$translate', 'vnApp'];
|
||||
|
||||
ngModule.component('vnProductionActions', {
|
||||
template: require('./production-actions.html'),
|
||||
bindings: {
|
||||
tickets: '<',
|
||||
states: '<',
|
||||
hourItems: '<'
|
||||
},
|
||||
controller: ProductionActions
|
||||
});
|
|
@ -0,0 +1,55 @@
|
|||
<vn-vertical>
|
||||
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||
<vn-none min-none></vn-none>
|
||||
<vn-colum-header vn-none min-none>
|
||||
<vn-multi-check models="$ctrl.tickets" options="[{id:'all',name:'Todos'},{id:'any',name:'Ninguno'},{id:'problem',name:'Con incidencia'},{id:'no-problem',name:'Sin incidencia'}]"></vn-multi-check>
|
||||
</vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="ticketFk" text="ID Ticket"></vn-colum-header>
|
||||
<vn-colum-header vn-two pad-medium-h field="agency" text="Agency"></vn-colum-header>
|
||||
<vn-colum-header vn-two pad-medium-h field="salesPerson" text="Commercial"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="hour" text="Hour"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="state" text="State"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="lines" text="Lines"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="m3" text="m3"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="boxes" text="Boxes"></vn-colum-header>
|
||||
<vn-none min-none></vn-none>
|
||||
</vn-grid-header>
|
||||
<vn-one class="list list-content">
|
||||
<vn-horizontal vn-one class="list list-element text-center" ng-repeat="ticket in $ctrl.pageTable.model track by ticket.id" ng-class="{warning: ticket.problem==='RIESGO'}">
|
||||
<vn-none>
|
||||
<vn-icon margin-small-left icon="report_problem" ng-if="ticket.problem" vn-tooltip="{{ticket.problem}}" tooltip-position="right"></vn-icon>
|
||||
</vn-none>
|
||||
<vn-none>
|
||||
<vn-check model="ticket.checked"></vn-check>
|
||||
</vn-none>
|
||||
<vn-one pad-medium-h>{{::ticket.ticketFk}}</vn-one>
|
||||
<vn-two pad-medium-h>{{::ticket.agency}}</vn-two>
|
||||
<vn-two pad-medium-h>{{::ticket.salesPerson | ucwords}}</vn-two>
|
||||
<vn-one pad-medium-h>{{ticket.hour}}</vn-one>
|
||||
<vn-one pad-medium-h>{{ticket.state}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.lines}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.m3}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.boxes}}</vn-one>
|
||||
<vn-none>
|
||||
<vn-icon icon="more" vn-tooltip tooltip-template="/static/templates/tooltip.locator.tpl.html" tooltip-position="left"></vn-icon>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
||||
</vn-one>
|
||||
<vn-horizontal vn-one class="list list-footer">
|
||||
<vn-none></vn-none>
|
||||
<vn-none></vn-none>
|
||||
<vn-one pad-medium-h>
|
||||
<span translate="Resultados"></span>:
|
||||
<span>{{$ctrl.footer.total}}</span>
|
||||
</vn-one>
|
||||
<vn-six></vn-six>
|
||||
<vn-one pad-medium-h text-right>{{$ctrl.footer.lines}}</vn-one>
|
||||
<vn-one pad-medium-h text-right>{{$ctrl.footer.meters}}</vn-one>
|
||||
<vn-one></vn-one>
|
||||
<vn-none></vn-none>
|
||||
</vn-horizontal>
|
||||
|
||||
<vn-one>
|
||||
<vn-paging page-change="$ctrl.pageTickets()" index="$ctrl.pageTable" total="$ctrl.totalFilter"></vn-paging>
|
||||
</vn-one>
|
||||
</vn-vertical>
|
|
@ -0,0 +1,46 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
export class ProductionTable {
|
||||
constructor($filter) {
|
||||
this.$filter = $filter;
|
||||
this._tickets = [];
|
||||
this.itemsDisplayedInList = 14;
|
||||
this.pageTable = {
|
||||
filter: {
|
||||
page: 1,
|
||||
size: this.itemsDisplayedInList
|
||||
},
|
||||
model: []
|
||||
};
|
||||
}
|
||||
set tickets(value) {
|
||||
this._tickets = value;
|
||||
this.totalFilter = this._tickets.length;
|
||||
this.pageTable.filter.page = 1;
|
||||
this.pageTickets();
|
||||
}
|
||||
get tickets() {
|
||||
return this._tickets;
|
||||
}
|
||||
onOrder(field, order) {
|
||||
let reverse = order === 'DESC';
|
||||
this.tickets = this.$filter('orderBy')(this.tickets, field, reverse);
|
||||
this.pageTickets();
|
||||
}
|
||||
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: '<'
|
||||
},
|
||||
controller: ProductionTable
|
||||
});
|
|
@ -4,4 +4,5 @@ export * from './module';
|
|||
// import components
|
||||
import './index/index';
|
||||
import './production-filters/production-filters';
|
||||
import './production-comment/production-comment';
|
||||
import './production-actions/production-actions';
|
||||
import './production-table/production-table';
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue