Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
5c80a8b4d7
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"module": "client",
|
||||
"name": "Clients",
|
||||
"icon": "person",
|
||||
"icon": "/static/images/icon_client.png",
|
||||
"validations" : true,
|
||||
"routes": [
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@ export default class Controller {
|
|||
this.timeout = $timeout;
|
||||
this.vnApp = vnApp;
|
||||
this.translate = $translate;
|
||||
this.payMethodFk = null;
|
||||
this.dueDay = null;
|
||||
this.billData = {};
|
||||
this.copyData();
|
||||
}
|
||||
$onChanges(changes) {
|
||||
|
@ -16,8 +15,12 @@ export default class Controller {
|
|||
}
|
||||
copyData() {
|
||||
if (this.client) {
|
||||
this.payMethodFk = this.client.payMethodFk || null;
|
||||
this.dueDay = this.client.dueDay ? this.client.dueDay : null;
|
||||
this.billData.payMethodFk = this.client.payMethodFk;
|
||||
this.billData.iban = this.client.iban;
|
||||
this.billData.dueDay = this.client.dueDay;
|
||||
this.billData.discount = this.client.discount;
|
||||
this.billData.credit = this.client.credit;
|
||||
this.billData.creditInsurance = this.client.creditInsurance;
|
||||
}
|
||||
}
|
||||
submit() {
|
||||
|
@ -25,10 +28,16 @@ export default class Controller {
|
|||
() => this.checkPaymentChanges());
|
||||
}
|
||||
checkPaymentChanges() {
|
||||
let payMethodFk = this.client.payMethodFk || null;
|
||||
let dueDay = this.client.dueDay || null;
|
||||
|
||||
if (this.payMethodFk !== payMethodFk || this.dueDay !== dueDay)
|
||||
let equals = true;
|
||||
Object.keys(this.billData).forEach(
|
||||
val => {
|
||||
if (this.billData[val] !== this.client[val]) {
|
||||
this.billData[val] = this.client[val];
|
||||
equals = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (!equals)
|
||||
this.$.sendMail.show();
|
||||
}
|
||||
returnDialog(response) {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
{{::$ctrl.text}}
|
||||
</vn-none>
|
||||
<vn-none>
|
||||
<vn-icon icon="keyboard_arrow_down" ng-if="$ctrl.showArrow('DESC')"></vn-icon>
|
||||
<vn-icon icon="keyboard_arrow_up" ng-if="$ctrl.showArrow('ASC')"></vn-icon>
|
||||
<vn-icon icon="arrow_drop_down" ng-if="$ctrl.showArrow('DESC')"></vn-icon>
|
||||
<vn-icon icon="arrow_drop_up" ng-if="$ctrl.showArrow('ASC')"></vn-icon>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
||||
<ng-transclude ng-if="!$ctrl.text"></ng-transclude>
|
|
@ -1,6 +1,6 @@
|
|||
import {module} from '../module';
|
||||
|
||||
export default class ColumHeader {
|
||||
export default class ColumnHeader {
|
||||
constructor() {
|
||||
this.order = undefined;
|
||||
this.mouseIsOver = false;
|
||||
|
@ -22,10 +22,10 @@ export default class ColumHeader {
|
|||
return showArrow;
|
||||
}
|
||||
}
|
||||
ColumHeader.$inject = [];
|
||||
ColumnHeader.$inject = [];
|
||||
|
||||
module.component('vnColumHeader', {
|
||||
template: require('./colum-header.html'),
|
||||
module.component('vnColumnHeader', {
|
||||
template: require('./column-header.html'),
|
||||
bindings: {
|
||||
field: '@?',
|
||||
text: '@?',
|
||||
|
@ -34,6 +34,6 @@ module.component('vnColumHeader', {
|
|||
require: {
|
||||
gridHeader: '^^vnGridHeader'
|
||||
},
|
||||
controller: ColumHeader,
|
||||
controller: ColumnHeader,
|
||||
transclude: true
|
||||
});
|
|
@ -17,9 +17,10 @@ import './snackbar/snackbar';
|
|||
import './tooltip/tooltip';
|
||||
import './icon-menu/icon-menu';
|
||||
import './drop-down/drop-down';
|
||||
import './colum-header/colum-header';
|
||||
import './column-header/column-header';
|
||||
import './grid-header/grid-header';
|
||||
import './multi-check/multi-check';
|
||||
import './datePicker/datePicker';
|
||||
|
||||
export {NAME as BUTTON, directive as ButtonDirective} from './button/button';
|
||||
export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl';
|
||||
|
@ -37,8 +38,8 @@ export {NAME as SUBMIT, directive as SubmitDirective} from './submit/submit';
|
|||
export {NAME as SUBMIT_MDL, factory as submitMdl} from './submit/submit.mdl';
|
||||
export {NAME as COMBO, directive as ComboDirective} from './combo/combo';
|
||||
export {NAME as COMBO_MDL, factory as comboMdl} from './combo/combo.mdl';
|
||||
export {NAME as DATE_PICKER, directive as DatePickerDirective} from './date-picker/date-picker';
|
||||
export {NAME as DATE_PICKER_MDL, factory as datePickerMdl} from './date-picker/date-picker.mdl';
|
||||
/* export {NAME as DATE_PICKER, directive as DatePickerDirective} from './date-picker/date-picker';
|
||||
export {NAME as DATE_PICKER_MDL, factory as datePickerMdl} from './date-picker/date-picker.mdl';*/
|
||||
export {NAME as CARD, directive as CardDirective} from './card/card';
|
||||
export {NAME as CARD_MDL, factory as cardMdl} from './card/card.mdl';
|
||||
export {NAME as SWITCH, directive as SwitchDirective} from './switch/switch';
|
||||
|
|
|
@ -26,8 +26,8 @@ export function directive(resolve, normalizer, $translate) {
|
|||
if (!initOptions.locale)
|
||||
initOptions.locale = $translate.use();
|
||||
|
||||
if (!initOptions.dateFormat && initOptions.locale === 'es')
|
||||
initOptions.dateFormat = 'd-m-Y';
|
||||
/*if (!initOptions.dateFormat && initOptions.locale === 'es')
|
||||
initOptions.dateFormat = 'd-m-Y';*/
|
||||
|
||||
if (!input.matches('input'))
|
||||
input = input.querySelector('input');
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input type="text"
|
||||
class="mdl-textfield__input"
|
||||
name="{{::$ctrl.name}}"
|
||||
ng-model="$ctrl.modelView"
|
||||
ng-disabled="{{!$ctrl.enabled}}"
|
||||
rule="{{::$ctrl.rule}}"/>
|
||||
<button
|
||||
type="button"
|
||||
class="mdl-chip__action ng-hide"
|
||||
tabindex="-1"
|
||||
translate-attr="{title: 'Clear'}"
|
||||
ng-show="$ctrl.modelView"
|
||||
ng-click="$ctrl.onClear()"
|
||||
>
|
||||
<i class="material-icons">clear</i>
|
||||
</button>
|
||||
<label class="mdl-textfield__label">{{::$ctrl.label | translate}}</label>
|
||||
</div>
|
|
@ -0,0 +1,183 @@
|
|||
import {module} from '../module';
|
||||
import Component from '../lib/component';
|
||||
import Flatpickr from 'vendor/src/flatpickr';
|
||||
import './style.scss';
|
||||
|
||||
// equivalences to format date between flatpicker and angularjs
|
||||
export const fromatEquivalence = {
|
||||
d: 'dd', // Day of the month, 2 digits with leading zeros (01 to 31)
|
||||
j: 'd', // Day of the month without leading zeros (1 to 31)
|
||||
m: 'MM', // Month in year, padded (01-12)
|
||||
n: 'M', // Month in year (1-12)
|
||||
y: 'yy', // A two digit representation of a year (00-99)
|
||||
Y: 'yyyy', // A full numeric representation of a year, 4 digits (1999 or 2003)
|
||||
H: 'HH', // Hour in AM/PM, padded (01-12)
|
||||
h: 'H', // Hour in AM/PM, (1-12)
|
||||
i: 'mm', // Minutes (00 to 59)
|
||||
s: 'ss' // Seconds (00 to 59)
|
||||
};
|
||||
|
||||
class DatePicker extends Component {
|
||||
constructor($element, $translate, $filter, $timeout) {
|
||||
super($element);
|
||||
this.input = $element[0].querySelector('input');
|
||||
this.$translate = $translate;
|
||||
this.$filter = $filter;
|
||||
this.$timeout = $timeout;
|
||||
this.enabled = true;
|
||||
this._modelView = null;
|
||||
this._model = undefined;
|
||||
|
||||
componentHandler.upgradeElement($element[0].firstChild);
|
||||
}
|
||||
|
||||
get model() {
|
||||
return this._model;
|
||||
}
|
||||
set model(value) {
|
||||
this._model = value;
|
||||
if (value && !this.modelView) {
|
||||
let format = this._formatFlat2Angular(this.iniOptions.dateFormat || 'Y-m-d');
|
||||
this.modelView = this.$filter('date')(value, format);
|
||||
}
|
||||
}
|
||||
get modelView() {
|
||||
return this._modelView;
|
||||
}
|
||||
set modelView(value) {
|
||||
this._modelView = value;
|
||||
this.input.value = value;
|
||||
this._setModel(value);
|
||||
this.$timeout(
|
||||
() => {
|
||||
this.mdlUpdate();
|
||||
}, 500);
|
||||
}
|
||||
onClear() {
|
||||
this.modelView = null;
|
||||
}
|
||||
mdlUpdate() {
|
||||
let mdlField = this.element.firstChild.MaterialTextfield;
|
||||
if (mdlField)
|
||||
mdlField.updateClasses_();
|
||||
}
|
||||
|
||||
_formatFlat2Angular(string) { // change string Flatpickr format to angular format (d-m-Y -> dd-MM-yyyy)
|
||||
let aux = string.split(/[ZT.,/ :-]/);
|
||||
let parts = [];
|
||||
aux.forEach(
|
||||
val => {
|
||||
parts.push(fromatEquivalence[val]);
|
||||
}
|
||||
);
|
||||
if (string.indexOf(' ') !== -1 || string.indexOf('T') !== -1) { // datetime format
|
||||
let dates = parts.slice(0, 3).join('-');
|
||||
let hours = parts.slice(3, parts.length).join(':');
|
||||
return `${dates} ${hours}`.trim();
|
||||
} else if (string.indexOf(':') !== -1) { // only time format
|
||||
return parts.join(':');
|
||||
} else { // only date format
|
||||
return parts.join('-');
|
||||
}
|
||||
}
|
||||
|
||||
_setModel(value) {
|
||||
let model;
|
||||
if (!value) {
|
||||
model = undefined;
|
||||
} else if (!this.iniOptions.dateFormat || (this.iniOptions.dateFormat && this.iniOptions.dateFormat.startsWith('Y-m-d'))) {
|
||||
model = value;
|
||||
} else {
|
||||
let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/);
|
||||
let aux = value.split(/[ZT.,/ :-]/);
|
||||
let date = {};
|
||||
formats.forEach(
|
||||
(k, i) => {
|
||||
if (k.toLowerCase() === 'y') {
|
||||
date.year = aux[i];
|
||||
} else if (k === 'm' || k === 'n') {
|
||||
date.month = aux[i];
|
||||
} else if (k === 'd' || k === 'j') {
|
||||
date.day = aux[i];
|
||||
} else if (k.toLowerCase() === 'h') {
|
||||
date.hour = aux[i];
|
||||
} else if (k === 'i') {
|
||||
date.minutes = aux[i];
|
||||
} else if (k === 's') {
|
||||
date.seccons = aux[i];
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
let dateStr = '';
|
||||
let hourStr = '';
|
||||
|
||||
if (date.year && date.month && date.day) {
|
||||
dateStr = `${date.year}-${date.month}-${date.day}`;
|
||||
}
|
||||
if (date.hour) {
|
||||
hourStr = date.hour;
|
||||
if (date.minutes) {
|
||||
hourStr += ':' + date.minutes;
|
||||
} else {
|
||||
hourStr += ':00';
|
||||
}
|
||||
if (date.seccons) {
|
||||
hourStr += ':' + date.seccons;
|
||||
} else {
|
||||
hourStr += ':00';
|
||||
}
|
||||
}
|
||||
model = `${dateStr} ${hourStr}`.trim();
|
||||
}
|
||||
|
||||
if (this.model !== model) {
|
||||
this.model = model;
|
||||
}
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
if (!this.iniOptions)
|
||||
this.iniOptions = {};
|
||||
|
||||
if (!this.iniOptions.locale)
|
||||
this.iniOptions.locale = this.$translate.use();
|
||||
|
||||
if (!this.iniOptions.dateFormat && this.iniOptions.locale === 'es')
|
||||
this.iniOptions.dateFormat = 'd-m-Y';
|
||||
else if (this.iniOptions.dateFormat) {
|
||||
let format = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/);
|
||||
if (format.length <= 1) {
|
||||
throw new Error(`Error: Invalid string format ${format}`);
|
||||
}
|
||||
format.forEach(
|
||||
val => {
|
||||
if (!fromatEquivalence[val]) {
|
||||
throw new Error(`Error in dateFormat ${this.iniOptions.dateFormat}: is not like Flatpickr Formatting Token https://chmln.github.io/flatpickr/formatting/`);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (this.input)
|
||||
this.vp = new Flatpickr(this.input, this.iniOptions);
|
||||
}
|
||||
$onDestroy() {
|
||||
if (this.vp)
|
||||
this.vp.destroy();
|
||||
}
|
||||
}
|
||||
DatePicker.$inject = ['$element', '$translate', '$filter', '$timeout'];
|
||||
|
||||
module.component('vnDatePicker', {
|
||||
template: require('./datePicker.html'),
|
||||
bindings: {
|
||||
model: '=',
|
||||
label: '@?',
|
||||
name: '@?',
|
||||
enabled: '<?',
|
||||
rule: '<?',
|
||||
iniOptions: '<?'
|
||||
},
|
||||
controller: DatePicker
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
vn-date-picker {
|
||||
.mdl-chip__action {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: -6px;
|
||||
margin: 22px 0px;
|
||||
background-color: white;
|
||||
}
|
||||
.material-icons {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
|
@ -7,12 +7,12 @@ vn-grid-header {
|
|||
white-space: nowrap;
|
||||
justify-content: center;
|
||||
vn-none{
|
||||
min-width: 16px;
|
||||
min-width: 17px;
|
||||
}
|
||||
}
|
||||
vn-icon{
|
||||
line-height: 16px;
|
||||
font-size: 16px;
|
||||
line-height: 17px;
|
||||
font-size: 17px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline;
|
||||
|
|
|
@ -74,6 +74,7 @@ module.component('vnMultiCheck', {
|
|||
template: require('./multi-check.html'),
|
||||
controller: MultiCheck,
|
||||
bindings: {
|
||||
checkAll: '=',
|
||||
options: '<',
|
||||
models: '=',
|
||||
className: '@?'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {module} from '../module';
|
||||
import Component from '../lib/component';
|
||||
import getModifiedData from '../lib/modified';
|
||||
import copyObject from '../lib/copy';
|
||||
// import copyObject from '../lib/copy';
|
||||
import isEqual from '../lib/equals';
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ export default class Watcher extends Component {
|
|||
});
|
||||
}
|
||||
writeData(json, resolve) {
|
||||
copyObject(json.data, this.data);
|
||||
this.data = this.copyObject(json.data);
|
||||
this.copyData();
|
||||
resolve(json);
|
||||
}
|
||||
|
@ -133,8 +133,22 @@ export default class Watcher extends Component {
|
|||
resolve();
|
||||
}
|
||||
copyData() {
|
||||
this.orgData = copyObject(this.data);
|
||||
this.orgData = this.copyObject(this.data);
|
||||
}
|
||||
|
||||
copyObject(data) {
|
||||
let copy = {};
|
||||
if (data) {
|
||||
Object.keys(data).forEach(
|
||||
val => {
|
||||
if (data[val] !== "" && data[val] !== undefined && data[val] !== null)
|
||||
copy[val] = data[val];
|
||||
}
|
||||
);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
callback(transition) {
|
||||
if (!this.state && this.dataChanged()) {
|
||||
this.state = transition.to().name;
|
||||
|
@ -145,11 +159,12 @@ export default class Watcher extends Component {
|
|||
return true;
|
||||
}
|
||||
dataChanged() {
|
||||
return !isEqual(this.data, this.orgData);
|
||||
let newData = this.copyObject(this.data);
|
||||
return !isEqual(newData, this.orgData);
|
||||
}
|
||||
onConfirmResponse(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
copyObject(this.orgData, this.data);
|
||||
this.data = this.copyObject(this.orgData);
|
||||
this.$state.go(this.state);
|
||||
} else {
|
||||
this.state = null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"module": "production",
|
||||
"name": "Production",
|
||||
"icon": "group_work",
|
||||
"icon": "/static/images/icon_production.png",
|
||||
"validations" : false,
|
||||
"routes": [
|
||||
{
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
<vn-vertical pad-medium>
|
||||
<vn-horizontal vn-one margin-large-bottom class="locator-header">
|
||||
<vn-title vn-one><span translate>Finder</span></vn-title>
|
||||
<vn-two vn-horizontal class="filterPanel">
|
||||
<vn-textfield vn-one label="Filtro" model="$ctrl.filter.q"></vn-textfield>
|
||||
|
||||
<form vn-two vn-horizontal class="filterPanel" ng-submit="$ctrl.searchTickets()">
|
||||
<vn-textfield vn-one label="Filtro" model="$ctrl.search"></vn-textfield>
|
||||
<vn-icon
|
||||
vn-none
|
||||
margin-medium-right
|
||||
|
@ -14,7 +15,8 @@
|
|||
ng-click="$ctrl.moreFilters($event)">
|
||||
</vn-icon>
|
||||
<vn-button vn-none pad-small-top label="Filtrar" ng-click="$ctrl.searchTickets()"></vn-button>
|
||||
</vn-two>
|
||||
</form>
|
||||
|
||||
<vn-one vn-horizontal>
|
||||
<vn-one></vn-one>
|
||||
<vn-autocomplete vn-two
|
||||
|
@ -35,6 +37,6 @@
|
|||
</vn-one>
|
||||
<vn-two></vn-two>
|
||||
</vn-horizontal>
|
||||
<vn-production-table tickets="$ctrl.tickets" footer="$ctrl.footer"></vn-production-table>
|
||||
<vn-production-table check-all="$ctrl.checkAll" tickets="$ctrl.tickets" footer="$ctrl.footer"></vn-production-table>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
|
@ -10,17 +10,37 @@ export default class ProductionIndex {
|
|||
this.filter = {};
|
||||
this.tickets = [];
|
||||
this.states = [];
|
||||
this.checkAll = 0;
|
||||
this.footer = {
|
||||
total: null,
|
||||
lines: null,
|
||||
meters: null
|
||||
};
|
||||
this._search = null;
|
||||
this.hourItems = [];
|
||||
this.child = undefined;
|
||||
this.userProfile = aclConstant.userProfile;
|
||||
this.filter.warehouseFk = this.userProfile.warehouseId;
|
||||
}
|
||||
|
||||
get search() {
|
||||
return this._search;
|
||||
}
|
||||
set search(value) {
|
||||
this._search = value;
|
||||
this.filter.q = value;
|
||||
if (!value) {
|
||||
this.searchTickets();
|
||||
}
|
||||
}
|
||||
|
||||
get checkAll() {
|
||||
return this._checkAll;
|
||||
}
|
||||
set checkAll(value) {
|
||||
this._checkAll = value;
|
||||
}
|
||||
|
||||
// Actions Callbacks
|
||||
_changeState(ids, sateteId, stateName, index) {
|
||||
this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then(
|
||||
|
@ -72,14 +92,15 @@ export default class ProductionIndex {
|
|||
delete this.child;
|
||||
}
|
||||
searchTickets(filter) {
|
||||
this.filter = Object.assign({}, filter || {}, this.filter);
|
||||
this.filter = Object.assign({}, this.filter, filter || {});
|
||||
|
||||
let filters = Object.assign({}, {
|
||||
where: this.filter
|
||||
}, {
|
||||
page: 1,
|
||||
limit: 700
|
||||
limit: 1000
|
||||
});
|
||||
this.checkAll = 0;
|
||||
this.$http.get('/production/api/FakeProductions/list?filter=' + JSON.stringify(filters)).then(
|
||||
json => {
|
||||
this.tickets = json.data.tickets;
|
||||
|
@ -92,7 +113,7 @@ export default class ProductionIndex {
|
|||
refreshTickets() {
|
||||
this.filter = {};
|
||||
this.filter.warehouseFk = this.userProfile.warehouseId;
|
||||
this.searchTickets();
|
||||
this.search = null;
|
||||
}
|
||||
onChangeWareHouse(item) {
|
||||
if (item && item.id && item.id != this.filter.warehouseFk) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"Finder" : "Localizador",
|
||||
"Production" : "Producción",
|
||||
"Error: No tickets selected!" : "Error: ¡No hay tickets seleccionados!",
|
||||
"Error: Action not implemented!" : "Error: ¡Acción no implementada!",
|
||||
"State" : "Estado",
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
<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>
|
||||
<vn-button vn-none label="Cancel" ng-click="$ctrl.onCancel()"></vn-button>
|
||||
<vn-one></vn-one>
|
||||
<vn-none>
|
||||
<vn-submit label="Filter"></vn-submit>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ngModule from '../module';
|
||||
import './style.scss';
|
||||
|
||||
ngModule.component('vnProductionFilterPanel', {
|
||||
template: require('./production-filters.html')
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
vn-production-filter-panel{
|
||||
.mdl-button--colored{
|
||||
color: #ffa410 !important;
|
||||
background-color: white !important;
|
||||
}
|
||||
.mdl-button--colored:hover{
|
||||
color: white !important;
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
<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="Ticket ID"></vn-colum-header>
|
||||
<vn-colum-header vn-two pad-medium-h field="agency" text="Agency"></vn-colum-header>
|
||||
<vn-colum-header vn-one pad-medium-h field="routeFk" text="Route ID"></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-column-header vn-none min-none>
|
||||
<vn-multi-check check-all="$ctrl.checkAll" 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-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="ticketFk" text="Ticket ID"></vn-column-header>
|
||||
<vn-column-header vn-two pad-medium-h field="agency" text="Agency"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="routeFk" text="Route ID"></vn-column-header>
|
||||
<vn-column-header vn-two pad-medium-h field="salesPerson" text="Commercial"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="hour" text="Hour"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="state" text="State"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="lines" text="Lines"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="m3" text="m3"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="boxes" text="Boxes"></vn-column-header>
|
||||
<vn-none min-none></vn-none>
|
||||
</vn-grid-header>
|
||||
<vn-one class="list list-content">
|
||||
|
|
|
@ -5,6 +5,7 @@ export class ProductionTable {
|
|||
this.$filter = $filter;
|
||||
this._tickets = [];
|
||||
this.itemsDisplayedInList = 14;
|
||||
this._checkAll = 0;
|
||||
this.pageTable = {
|
||||
filter: {
|
||||
page: 1,
|
||||
|
@ -13,6 +14,12 @@ export class ProductionTable {
|
|||
model: []
|
||||
};
|
||||
}
|
||||
get checkAll() {
|
||||
return this._checkAll;
|
||||
}
|
||||
set checkAll(value) {
|
||||
this._checkAll = value;
|
||||
}
|
||||
set tickets(value) {
|
||||
this._tickets = value;
|
||||
this.totalFilter = this._tickets.length;
|
||||
|
@ -40,7 +47,8 @@ ngModule.component('vnProductionTable', {
|
|||
template: require('./production-table.html'),
|
||||
bindings: {
|
||||
tickets: '=',
|
||||
footer: '<'
|
||||
footer: '<',
|
||||
checkAll: '='
|
||||
},
|
||||
controller: ProductionTable
|
||||
});
|
||||
|
|
|
@ -3,15 +3,18 @@
|
|||
<h6 vn-one translate="Modules access"></h6>
|
||||
</vn-horizontal>
|
||||
<vn-module-container>
|
||||
<a ng-repeat="mod in $ctrl.modules" ui-sref="{{::mod.route.state}}" class="{{::mod.name}} vn-module mdl-shadow--4dp">
|
||||
<vn-vertical>
|
||||
<a ng-repeat="mod in $ctrl.modules" ui-sref="{{::mod.route.state}}" class="vn-module mdl-shadow--4dp">
|
||||
|
||||
<vn-vertical class="home__icon">
|
||||
<vn-one>
|
||||
<vn-icon ng-if="mod.icon && !mod.icon.startsWith('/')" icon="{{::mod.icon}}"></vn-icon>
|
||||
<img ng-if="mod.icon && mod.icon.startsWith('/')" ng-src="{{::mod.icon}}" />
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<h4 translate="{{::mod.name}}"></h4>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-icon icon="{{::mod.icon}}"></vn-icon>
|
||||
</vn-one>
|
||||
</vn-vertical>
|
||||
|
||||
</a>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
|
@ -19,11 +19,23 @@ vn-home {
|
|||
.vn-module{
|
||||
display: flex;
|
||||
flex: none;
|
||||
padding: 2em;
|
||||
margin: 10px;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
transition: opacity 0.7s ease;
|
||||
background-color: #FF9300;
|
||||
color: white;
|
||||
|
||||
overflow:hidden;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
|
||||
.home__icon{
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
img {
|
||||
max-width: 50%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
h4{
|
||||
text-transform: capitalize;
|
||||
font-size: 16pt;
|
||||
|
@ -40,14 +52,6 @@ vn-home {
|
|||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&.Clients{
|
||||
background-color: #ffa410;
|
||||
color: #ffffff;
|
||||
}
|
||||
&.Production{
|
||||
background-color: #95d600;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,18 +4,10 @@
|
|||
<vn-icon icon="language" translate-attr="{title: 'Change language'}" ng-click="$ctrl.onChangeLanguage()"></vn-icon>
|
||||
<vn-icon icon="exit_to_app" translate-attr="{title: 'Logout'}" ng-click="$ctrl.onLogoutClick()"></vn-icon>
|
||||
<vn-icon icon="account_circle" translate-attr="{title: 'Profile'}" style="font-size: 35px;"></vn-icon>
|
||||
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-medium for="apps">
|
||||
<vn-horizontal>
|
||||
<div ng-repeat="mod in $ctrl.modules track by $index" margin-medium-right>
|
||||
<vn-vertical>
|
||||
<a ui-sref="{{::mod.route.state}}">
|
||||
<button vn-one class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored popover-button">
|
||||
<vn-icon vn-one icon="{{::mod.icon}}" style="font-size:40px"></vn-icon>
|
||||
</button>
|
||||
</a>
|
||||
<vn-label class="popover-label" text="{{::mod.name}}"></vn-label>
|
||||
</vn-vertical>
|
||||
</div>
|
||||
</vn-horizontal>
|
||||
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-small for="apps">
|
||||
<li class="mdl-menu__item" ng-repeat="mod in $ctrl.modules track by $index" ui-sref="{{::mod.route.state}}">
|
||||
<img ng-if="mod.icon && mod.icon.startsWith('/')" ng-src="{{::mod.icon}}" />
|
||||
<span translate="{{::mod.name}}"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
vn-main-menu {
|
||||
vn-icon {
|
||||
padding: .1em;
|
||||
border-radius: .1em;
|
||||
vertical-align: middle;
|
||||
font-size: 24px;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
opacity: .85;
|
||||
li.mdl-menu__item{
|
||||
background-color: #FF9300;
|
||||
margin-bottom: 8px;
|
||||
color: white;
|
||||
img{
|
||||
max-width: 18px;
|
||||
vertical-align: middle;
|
||||
margin-top: -3px;
|
||||
}
|
||||
}
|
||||
li.mdl-menu__item:hover{
|
||||
background-color: #FF9300;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
li.mdl-menu__item:last-child{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
icon="keyboard_arrow_down"
|
||||
style="cursor: pointer;">
|
||||
</vn-icon>
|
||||
<vn-icon-button icon="search"></vn-icon-button>
|
||||
<vn-button ng-if="$ctrl.label" vn-none label="{{$ctrl.label}}"></vn-button>
|
||||
<vn-icon-button ng-if="!$ctrl.label" icon="search"></vn-icon-button>
|
||||
</vn-horizontal>
|
||||
</form>
|
|
@ -10,17 +10,17 @@ export default class Controller {
|
|||
this.$window = $window;
|
||||
}
|
||||
onClick(event) {
|
||||
var child = this.vnPopover.showComponent(this.popover, this.$scope, this.element);
|
||||
this.child = this.vnPopover.showComponent(this.popover, this.$scope, this.element);
|
||||
|
||||
// XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente?
|
||||
var childCtrl = angular.element(child).isolateScope().$ctrl;
|
||||
var childCtrl = angular.element(this.child).isolateScope().$ctrl;
|
||||
childCtrl.filter = Object.assign({}, this.index.filter);
|
||||
childCtrl.onSubmit = filter => this.onChildSubmit(filter);
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
onChildSubmit(filter) {
|
||||
this.vnPopover.hide();
|
||||
// this.vnPopover.hide();
|
||||
Object.assign(this.index.filter, filter);
|
||||
this.onSubmit();
|
||||
}
|
||||
|
@ -28,6 +28,13 @@ export default class Controller {
|
|||
onSubmit() {
|
||||
if (this.onSearch)
|
||||
this.onSearch();
|
||||
|
||||
if (angular.element(this.child)) {
|
||||
if (angular.element(this.child).scope())
|
||||
angular.element(this.child).scope().$destroy();
|
||||
angular.element(this.child).remove();
|
||||
}
|
||||
delete this.child;
|
||||
}
|
||||
$onDestroy() {
|
||||
this.$window.sessionStorage.removeItem('filter');
|
||||
|
@ -42,7 +49,8 @@ ngModule.component('vnSearchbar', {
|
|||
search: '=',
|
||||
onSearch: '&',
|
||||
advanced: '=',
|
||||
popover: '@'
|
||||
popover: '@',
|
||||
label: '@?'
|
||||
},
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -58,7 +58,7 @@ gulp.task('services', ['copy'], function() {
|
|||
});
|
||||
|
||||
gulp.task('clean', function() {
|
||||
return del([`${buildDir}/*`, `!${buildDir}/templates`], {force: true});
|
||||
return del([`${buildDir}/*`, `!${buildDir}/templates`, `!${buildDir}/images`], {force: true});
|
||||
});
|
||||
|
||||
// Spliting
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = function(Client){
|
|||
}
|
||||
|
||||
function andWhere(p){
|
||||
return {
|
||||
let where = {
|
||||
where: {
|
||||
id: p.id,
|
||||
name: {regexp: p.name},
|
||||
|
@ -30,11 +30,17 @@ module.exports = function(Client){
|
|||
socialName: {regexp: p.socialName},
|
||||
city: {regexp: p.city},
|
||||
postcode: p.postcode,
|
||||
email: {regexp: p.email},
|
||||
phone: p.phone
|
||||
email: {regexp: p.email}
|
||||
},
|
||||
skip: (p.page - 1) * p.size,
|
||||
limit: p.size
|
||||
};
|
||||
if(p.phone){
|
||||
where.or = [
|
||||
{phone: p.phone},
|
||||
{mobile: p.phone}
|
||||
]
|
||||
}
|
||||
return where;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
var path = require('path');
|
||||
|
||||
/**
|
||||
* Módulo de configuración
|
||||
*/
|
||||
|
@ -18,7 +17,6 @@ module.exports = {
|
|||
|
||||
return require(path.join(__dirname, 'config', `${name}.${env}.json`));
|
||||
},
|
||||
|
||||
/**
|
||||
* Configuración de la aplicación
|
||||
* @return {Object} Objeto de configuración app
|
||||
|
@ -26,7 +24,6 @@ module.exports = {
|
|||
app: function() {
|
||||
return this.getConfig('app');
|
||||
},
|
||||
|
||||
/**
|
||||
* Configuración de smtp
|
||||
* @return {Object} Objeto de configuración smtp
|
||||
|
@ -34,7 +31,6 @@ module.exports = {
|
|||
smtp: function() {
|
||||
return this.getConfig('smtp');
|
||||
},
|
||||
|
||||
/**
|
||||
* Configuración de mysql
|
||||
* @return {Object} Objeto de configuración MySQL
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
var path = require('path');
|
||||
|
||||
/**
|
||||
* Módulo de configuración
|
||||
*/
|
||||
module.exports = {
|
||||
/**
|
||||
* Obtiene la configuración en función del entorno en el que se está
|
||||
* ejecutando la aplicación.
|
||||
* @param {String} name Nombre del fichero
|
||||
* @return {Object} Objeto de configuración
|
||||
*/
|
||||
getConfig: function(name) {
|
||||
let env = process.env.NODE_ENV;
|
||||
|
||||
if (!env)
|
||||
env = 'development';
|
||||
|
||||
return require(path.join(__dirname, 'config', `${name}.${env}.json`));
|
||||
},
|
||||
|
||||
/**
|
||||
* Configuración de la aplicación
|
||||
* @return {Object} Objeto de configuración app
|
||||
*/
|
||||
app: function() {
|
||||
return this.getConfig('app');
|
||||
},
|
||||
|
||||
/**
|
||||
* Configuración de smtp
|
||||
* @return {Object} Objeto de configuración smtp
|
||||
*/
|
||||
smtp: function() {
|
||||
return this.getConfig('smtp');
|
||||
},
|
||||
|
||||
/**
|
||||
* Configuración de mysql
|
||||
* @return {Object} Objeto de configuración MySQL
|
||||
*/
|
||||
mysql: function() {
|
||||
return this.getConfig('mysql');
|
||||
}
|
||||
};
|
|
@ -1,4 +1,5 @@
|
|||
logs/*
|
||||
static/*
|
||||
temp/*
|
||||
!static/templates
|
||||
!static/templates
|
||||
!static/images
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
|
@ -13,22 +13,27 @@ module.exports = function(FakeProduction) {
|
|||
|
||||
if(filter.where && filter.where.q){
|
||||
var newFilter = {
|
||||
or: [
|
||||
{agency: {regexp: filter.where.q}},
|
||||
{state: {regexp: filter.where.q}}
|
||||
],
|
||||
and: []
|
||||
and: [
|
||||
{
|
||||
or: [
|
||||
{agency: {regexp: filter.where.q}},
|
||||
{state: {regexp: filter.where.q}}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
delete filter.where.q;
|
||||
|
||||
Object.keys(filter.where).forEach(
|
||||
key => {
|
||||
let field = new Object();
|
||||
field[key] = filter.where[key];
|
||||
newFilter.and.push(field);
|
||||
}
|
||||
);
|
||||
|
||||
if(Object.keys(filter.where).length){
|
||||
Object.keys(filter.where).forEach(
|
||||
key => {
|
||||
let field = new Object();
|
||||
field[key] = filter.where[key];
|
||||
newFilter.and.push(field);
|
||||
}
|
||||
);
|
||||
}
|
||||
filter.where = newFilter;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ module.exports = function(FakeProduction) {
|
|||
FakeProduction.beginTransaction({isolationLevel: FakeProduction.Transaction.READ_COMMITTED}, function(err, tx) {
|
||||
Message.create(messages, {transaction: tx}, function (err, res) {
|
||||
if(err){
|
||||
transaction.rollback(function(error) {
|
||||
tx.rollback(function(error) {
|
||||
(error) ? cb(error, null) : cb(err, null);
|
||||
});
|
||||
} else{
|
||||
|
|
|
@ -24,7 +24,7 @@ module.exports = function(Ticket) {
|
|||
var hour = `${time}:00`;
|
||||
|
||||
var query = `update Ticket set date = CONCAT(DATE(date), ' ', ?) where id in (?)`;
|
||||
var params = [time, tickets];
|
||||
var params = [hour, tickets];
|
||||
|
||||
FakeProduction.updateAll({ticketFk: {inq: tickets}}, {hour: hour}, function(err, res){
|
||||
if(err)
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
"client":{
|
||||
"type": "String"
|
||||
},
|
||||
"date":{
|
||||
"type": "Date"
|
||||
},
|
||||
"hour":{
|
||||
"type": "String"
|
||||
},
|
||||
|
@ -74,10 +77,10 @@
|
|||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "*",
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "DENY"
|
||||
"permission": "ALLOW"
|
||||
},
|
||||
{
|
||||
"accessType": "*",
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "*",
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "DENY"
|
||||
"permission": "ALLOW"
|
||||
},
|
||||
{
|
||||
"accessType": "*",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
select tmp.Id_Ticket as ticketFk,
|
||||
tmp.Id_Cliente as clientFk,
|
||||
tmp.Alias as client,
|
||||
tmp.Fecha as `date`,
|
||||
tmp.Hora as hour,
|
||||
tmp.POBLACION as city,
|
||||
tmp.PROVINCIA as province,
|
||||
|
|
Loading…
Reference in New Issue