Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
7b38d2f188
|
@ -19,6 +19,7 @@ import './icon-menu/icon-menu';
|
|||
import './drop-down/drop-down';
|
||||
import './colum-header/colum-header';
|
||||
import './grid-header/grid-header';
|
||||
import './multi-check/multi-check';
|
||||
|
||||
export {NAME as BUTTON, directive as ButtonDirective} from './button/button';
|
||||
export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl';
|
||||
|
|
|
@ -1,4 +1,19 @@
|
|||
<div class="multi-check {{$ctrl.className}}">
|
||||
<vn-check model="$ctrl.checkAll"></vn-check>
|
||||
|
||||
</div>
|
||||
<vn-vertical 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">
|
||||
<vn-icon vn-none icon="check_box_outline_blank" ng-click="$ctrl.checkAll = 1"></vn-icon>
|
||||
</vn-none>
|
||||
<vn-none class="primaryCheckbox color" ng-if="$ctrl.checkAll===1">
|
||||
<vn-icon vn-none icon="check_box" ng-click="$ctrl.checkAll = 0"></vn-icon>
|
||||
</vn-none>
|
||||
<vn-none class="primaryCheckbox color" ng-if="$ctrl.checkAll===2">
|
||||
<vn-icon vn-none icon="indeterminate_check_box" ng-click="$ctrl.checkAll = 0"></vn-icon>
|
||||
</vn-none>
|
||||
<vn-icon vn-none class="arrow_down" icon="keyboard_arrow_down" ng-click="$ctrl.showDropDown = true"></vn-icon>
|
||||
</vn-horizontal>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-drop-down vn-none items="$ctrl.options" show="$ctrl.showDropDown" selected="$ctrl.type"></vn-drop-down>
|
||||
</vn-one>
|
||||
</vn-vertical>
|
|
@ -1,33 +1,73 @@
|
|||
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
|
||||
*/
|
||||
export default class MultiCheck {
|
||||
constructor($element) {
|
||||
this.$element = $element;
|
||||
this._checkAll = false;
|
||||
this._checkType = '';
|
||||
constructor() {
|
||||
this._checkAll = 0;
|
||||
this.type = {};
|
||||
this.showDropDown = false;
|
||||
}
|
||||
get checkAll() {
|
||||
return this._checkAll;
|
||||
}
|
||||
set checkAll(value) {
|
||||
this._checkAll = value;
|
||||
this.switchChecks();
|
||||
}
|
||||
get checkType() {
|
||||
return this._checkType;
|
||||
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);
|
||||
} else {
|
||||
checked = el[this.type.id] ? true : false;
|
||||
}
|
||||
} else {
|
||||
checked = this.checkAll === 1;
|
||||
}
|
||||
el.checked = checked;
|
||||
}
|
||||
);
|
||||
}
|
||||
set checkType(value) {
|
||||
this._checkType = value;
|
||||
$onChanges() {
|
||||
this.type = {};
|
||||
this.checkAll = 0;
|
||||
}
|
||||
$doCheck() {
|
||||
if (this.type && this.type.id) {
|
||||
switch (this.type.id) {
|
||||
case 'all':
|
||||
this.checkAll = 1;
|
||||
break;
|
||||
case 'any':
|
||||
this.checkAll = 0;
|
||||
break;
|
||||
default:
|
||||
this.checkAll = 2;
|
||||
break;
|
||||
}
|
||||
this.type = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
MultiCheck.$inject = ['$element'];
|
||||
MultiCheck.$inject = [];
|
||||
|
||||
module.component('vnMultiCheck', {
|
||||
template: require('./multi-check.html'),
|
||||
controller: MultiCheck,
|
||||
bindings: {
|
||||
options: '<',
|
||||
container: '@',
|
||||
models: '=',
|
||||
className: '@?'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
vn-multi-check {
|
||||
vn-icon{
|
||||
cursor: pointer;
|
||||
}
|
||||
&:focus, &:active, &:hover{
|
||||
outline: none;
|
||||
border: none;
|
||||
}
|
||||
.primaryCheckbox {
|
||||
vn-icon{
|
||||
font-size: 22px;
|
||||
margin-left: -4px;
|
||||
i{
|
||||
color: rgba(0,0,0,.54);
|
||||
}
|
||||
}
|
||||
&.color {
|
||||
i{
|
||||
color: rgb(255,152,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
.arrow_down{
|
||||
i{
|
||||
padding-top: 8px;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,11 +49,11 @@
|
|||
</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-check model="$ctrl.checkAll"></vn-check>
|
||||
<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>
|
||||
|
@ -71,12 +71,12 @@
|
|||
<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.cheched"></vn-check>
|
||||
<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}} {{::ticket.salesPerson | ucwords}}</vn-two>
|
||||
<vn-one pad-medium-h>{{::ticket.hour}}</vn-one>
|
||||
<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>
|
||||
|
|
|
@ -18,7 +18,7 @@ export default class ProductionIndex {
|
|||
this.order = {};
|
||||
this.filter = {};
|
||||
this.order = {};
|
||||
this._checkAll = false;
|
||||
|
||||
this.tickets = [];
|
||||
this.states = [];
|
||||
this.lines = 0;
|
||||
|
@ -36,22 +36,7 @@ export default class ProductionIndex {
|
|||
name: "Silla FV"
|
||||
};
|
||||
}
|
||||
get checkAll() {
|
||||
return this._checkAll;
|
||||
}
|
||||
set checkAll(value) {
|
||||
this._checkAll = value;
|
||||
this.switchChecks();
|
||||
}
|
||||
switchChecks() {
|
||||
let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]');
|
||||
checks.forEach(
|
||||
(el, i) => {
|
||||
el.checked = this._checkAll;
|
||||
this.tickets[i].cheched = this._checkAll;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Actions Callbacks
|
||||
_changeState(ids, sateteId, stateName, index) {
|
||||
this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then(
|
||||
|
@ -72,6 +57,17 @@ export default class ProductionIndex {
|
|||
}
|
||||
);
|
||||
}
|
||||
_changeTime(ids, time, index) {
|
||||
this.$http.put(`/production/api/changeTime?time=${time}`, {tickets: ids}).then(
|
||||
() => {
|
||||
index.forEach(
|
||||
val => {
|
||||
this.tickets[val].hour = time;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// End Actions Callbacks
|
||||
doAction(action) {
|
||||
|
@ -80,11 +76,13 @@ export default class ProductionIndex {
|
|||
let ids = [];
|
||||
let index = [];
|
||||
let tickets = [];
|
||||
checks.forEach(
|
||||
(_, i) => {
|
||||
ids.push(this.tickets[i].ticketFk);
|
||||
index.push(i);
|
||||
tickets.push({ticketFk: this.tickets[i].ticketFk, salesPersonFk: this.tickets[i].salesPersonFk});
|
||||
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) {
|
||||
|
@ -97,6 +95,9 @@ export default class ProductionIndex {
|
|||
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!'));
|
||||
|
@ -160,6 +161,9 @@ export default class ProductionIndex {
|
|||
if (this.actions.state) {
|
||||
this.doAction('changeState');
|
||||
this.actions.state = null;
|
||||
} else if (this.actions.hours) {
|
||||
this.doAction('changeTime');
|
||||
this.actions.hours = null;
|
||||
}
|
||||
}
|
||||
$onInit() {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-one margin-medium-right field="$ctrl.filter.stateFk" data="$ctrl.data.states" label="State"></vn-autocomplete>
|
||||
<vn-autocomplete vn-one margin-medium-right field="$ctrl.filter.agencyFk" url="/production/api/Agencies/list" label="Agency"></vn-autocomplete>
|
||||
<vn-autocomplete vn-one margin-medium-right field="$ctrl.filter.agencyFk" url="/production/api/Agencies" label="Agency"></vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal margin-large-top>
|
||||
<vn-submit vn-one label="Filter"></vn-submit>
|
||||
|
|
|
@ -91,4 +91,7 @@ html [vn-center], .vn-center{
|
|||
&:hover{
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
.flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday {
|
||||
background-color: $color-orange;
|
||||
}
|
Loading…
Reference in New Issue