Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
5c80a8b4d7
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"module": "client",
|
"module": "client",
|
||||||
"name": "Clients",
|
"name": "Clients",
|
||||||
"icon": "person",
|
"icon": "/static/images/icon_client.png",
|
||||||
"validations" : true,
|
"validations" : true,
|
||||||
"routes": [
|
"routes": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,8 +7,7 @@ export default class Controller {
|
||||||
this.timeout = $timeout;
|
this.timeout = $timeout;
|
||||||
this.vnApp = vnApp;
|
this.vnApp = vnApp;
|
||||||
this.translate = $translate;
|
this.translate = $translate;
|
||||||
this.payMethodFk = null;
|
this.billData = {};
|
||||||
this.dueDay = null;
|
|
||||||
this.copyData();
|
this.copyData();
|
||||||
}
|
}
|
||||||
$onChanges(changes) {
|
$onChanges(changes) {
|
||||||
|
@ -16,8 +15,12 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
copyData() {
|
copyData() {
|
||||||
if (this.client) {
|
if (this.client) {
|
||||||
this.payMethodFk = this.client.payMethodFk || null;
|
this.billData.payMethodFk = this.client.payMethodFk;
|
||||||
this.dueDay = this.client.dueDay ? this.client.dueDay : null;
|
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() {
|
submit() {
|
||||||
|
@ -25,10 +28,16 @@ export default class Controller {
|
||||||
() => this.checkPaymentChanges());
|
() => this.checkPaymentChanges());
|
||||||
}
|
}
|
||||||
checkPaymentChanges() {
|
checkPaymentChanges() {
|
||||||
let payMethodFk = this.client.payMethodFk || null;
|
let equals = true;
|
||||||
let dueDay = this.client.dueDay || null;
|
Object.keys(this.billData).forEach(
|
||||||
|
val => {
|
||||||
if (this.payMethodFk !== payMethodFk || this.dueDay !== dueDay)
|
if (this.billData[val] !== this.client[val]) {
|
||||||
|
this.billData[val] = this.client[val];
|
||||||
|
equals = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (!equals)
|
||||||
this.$.sendMail.show();
|
this.$.sendMail.show();
|
||||||
}
|
}
|
||||||
returnDialog(response) {
|
returnDialog(response) {
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
{{::$ctrl.text}}
|
{{::$ctrl.text}}
|
||||||
</vn-none>
|
</vn-none>
|
||||||
<vn-none>
|
<vn-none>
|
||||||
<vn-icon icon="keyboard_arrow_down" ng-if="$ctrl.showArrow('DESC')"></vn-icon>
|
<vn-icon icon="arrow_drop_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_up" ng-if="$ctrl.showArrow('ASC')"></vn-icon>
|
||||||
</vn-none>
|
</vn-none>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<ng-transclude ng-if="!$ctrl.text"></ng-transclude>
|
<ng-transclude ng-if="!$ctrl.text"></ng-transclude>
|
|
@ -1,6 +1,6 @@
|
||||||
import {module} from '../module';
|
import {module} from '../module';
|
||||||
|
|
||||||
export default class ColumHeader {
|
export default class ColumnHeader {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.order = undefined;
|
this.order = undefined;
|
||||||
this.mouseIsOver = false;
|
this.mouseIsOver = false;
|
||||||
|
@ -22,10 +22,10 @@ export default class ColumHeader {
|
||||||
return showArrow;
|
return showArrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ColumHeader.$inject = [];
|
ColumnHeader.$inject = [];
|
||||||
|
|
||||||
module.component('vnColumHeader', {
|
module.component('vnColumnHeader', {
|
||||||
template: require('./colum-header.html'),
|
template: require('./column-header.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
field: '@?',
|
field: '@?',
|
||||||
text: '@?',
|
text: '@?',
|
||||||
|
@ -34,6 +34,6 @@ module.component('vnColumHeader', {
|
||||||
require: {
|
require: {
|
||||||
gridHeader: '^^vnGridHeader'
|
gridHeader: '^^vnGridHeader'
|
||||||
},
|
},
|
||||||
controller: ColumHeader,
|
controller: ColumnHeader,
|
||||||
transclude: true
|
transclude: true
|
||||||
});
|
});
|
|
@ -17,9 +17,10 @@ import './snackbar/snackbar';
|
||||||
import './tooltip/tooltip';
|
import './tooltip/tooltip';
|
||||||
import './icon-menu/icon-menu';
|
import './icon-menu/icon-menu';
|
||||||
import './drop-down/drop-down';
|
import './drop-down/drop-down';
|
||||||
import './colum-header/colum-header';
|
import './column-header/column-header';
|
||||||
import './grid-header/grid-header';
|
import './grid-header/grid-header';
|
||||||
import './multi-check/multi-check';
|
import './multi-check/multi-check';
|
||||||
|
import './datePicker/datePicker';
|
||||||
|
|
||||||
export {NAME as BUTTON, directive as ButtonDirective} from './button/button';
|
export {NAME as BUTTON, directive as ButtonDirective} from './button/button';
|
||||||
export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl';
|
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 SUBMIT_MDL, factory as submitMdl} from './submit/submit.mdl';
|
||||||
export {NAME as COMBO, directive as ComboDirective} from './combo/combo';
|
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 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, 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_MDL, factory as datePickerMdl} from './date-picker/date-picker.mdl';*/
|
||||||
export {NAME as CARD, directive as CardDirective} from './card/card';
|
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 CARD_MDL, factory as cardMdl} from './card/card.mdl';
|
||||||
export {NAME as SWITCH, directive as SwitchDirective} from './switch/switch';
|
export {NAME as SWITCH, directive as SwitchDirective} from './switch/switch';
|
||||||
|
|
|
@ -26,8 +26,8 @@ export function directive(resolve, normalizer, $translate) {
|
||||||
if (!initOptions.locale)
|
if (!initOptions.locale)
|
||||||
initOptions.locale = $translate.use();
|
initOptions.locale = $translate.use();
|
||||||
|
|
||||||
if (!initOptions.dateFormat && initOptions.locale === 'es')
|
/*if (!initOptions.dateFormat && initOptions.locale === 'es')
|
||||||
initOptions.dateFormat = 'd-m-Y';
|
initOptions.dateFormat = 'd-m-Y';*/
|
||||||
|
|
||||||
if (!input.matches('input'))
|
if (!input.matches('input'))
|
||||||
input = input.querySelector('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;
|
white-space: nowrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
vn-none{
|
vn-none{
|
||||||
min-width: 16px;
|
min-width: 17px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vn-icon{
|
vn-icon{
|
||||||
line-height: 16px;
|
line-height: 17px;
|
||||||
font-size: 16px;
|
font-size: 17px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: inline;
|
display: inline;
|
||||||
|
|
|
@ -74,6 +74,7 @@ module.component('vnMultiCheck', {
|
||||||
template: require('./multi-check.html'),
|
template: require('./multi-check.html'),
|
||||||
controller: MultiCheck,
|
controller: MultiCheck,
|
||||||
bindings: {
|
bindings: {
|
||||||
|
checkAll: '=',
|
||||||
options: '<',
|
options: '<',
|
||||||
models: '=',
|
models: '=',
|
||||||
className: '@?'
|
className: '@?'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {module} from '../module';
|
import {module} from '../module';
|
||||||
import Component from '../lib/component';
|
import Component from '../lib/component';
|
||||||
import getModifiedData from '../lib/modified';
|
import getModifiedData from '../lib/modified';
|
||||||
import copyObject from '../lib/copy';
|
// import copyObject from '../lib/copy';
|
||||||
import isEqual from '../lib/equals';
|
import isEqual from '../lib/equals';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,7 +116,7 @@ export default class Watcher extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
writeData(json, resolve) {
|
writeData(json, resolve) {
|
||||||
copyObject(json.data, this.data);
|
this.data = this.copyObject(json.data);
|
||||||
this.copyData();
|
this.copyData();
|
||||||
resolve(json);
|
resolve(json);
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,22 @@ export default class Watcher extends Component {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
copyData() {
|
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) {
|
callback(transition) {
|
||||||
if (!this.state && this.dataChanged()) {
|
if (!this.state && this.dataChanged()) {
|
||||||
this.state = transition.to().name;
|
this.state = transition.to().name;
|
||||||
|
@ -145,11 +159,12 @@ export default class Watcher extends Component {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
dataChanged() {
|
dataChanged() {
|
||||||
return !isEqual(this.data, this.orgData);
|
let newData = this.copyObject(this.data);
|
||||||
|
return !isEqual(newData, this.orgData);
|
||||||
}
|
}
|
||||||
onConfirmResponse(response) {
|
onConfirmResponse(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'ACCEPT') {
|
||||||
copyObject(this.orgData, this.data);
|
this.data = this.copyObject(this.orgData);
|
||||||
this.$state.go(this.state);
|
this.$state.go(this.state);
|
||||||
} else {
|
} else {
|
||||||
this.state = null;
|
this.state = null;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"module": "production",
|
"module": "production",
|
||||||
"name": "Production",
|
"name": "Production",
|
||||||
"icon": "group_work",
|
"icon": "/static/images/icon_production.png",
|
||||||
"validations" : false,
|
"validations" : false,
|
||||||
"routes": [
|
"routes": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
<vn-vertical pad-medium>
|
<vn-vertical pad-medium>
|
||||||
<vn-horizontal vn-one margin-large-bottom class="locator-header">
|
<vn-horizontal vn-one margin-large-bottom class="locator-header">
|
||||||
<vn-title vn-one><span translate>Finder</span></vn-title>
|
<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-icon
|
||||||
vn-none
|
vn-none
|
||||||
margin-medium-right
|
margin-medium-right
|
||||||
|
@ -14,7 +15,8 @@
|
||||||
ng-click="$ctrl.moreFilters($event)">
|
ng-click="$ctrl.moreFilters($event)">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-button vn-none pad-small-top label="Filtrar" ng-click="$ctrl.searchTickets()"></vn-button>
|
<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-horizontal>
|
||||||
<vn-one></vn-one>
|
<vn-one></vn-one>
|
||||||
<vn-autocomplete vn-two
|
<vn-autocomplete vn-two
|
||||||
|
@ -35,6 +37,6 @@
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-two></vn-two>
|
<vn-two></vn-two>
|
||||||
</vn-horizontal>
|
</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-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
|
@ -10,17 +10,37 @@ export default class ProductionIndex {
|
||||||
this.filter = {};
|
this.filter = {};
|
||||||
this.tickets = [];
|
this.tickets = [];
|
||||||
this.states = [];
|
this.states = [];
|
||||||
|
this.checkAll = 0;
|
||||||
this.footer = {
|
this.footer = {
|
||||||
total: null,
|
total: null,
|
||||||
lines: null,
|
lines: null,
|
||||||
meters: null
|
meters: null
|
||||||
};
|
};
|
||||||
|
this._search = null;
|
||||||
this.hourItems = [];
|
this.hourItems = [];
|
||||||
this.child = undefined;
|
this.child = undefined;
|
||||||
this.userProfile = aclConstant.userProfile;
|
this.userProfile = aclConstant.userProfile;
|
||||||
this.filter.warehouseFk = this.userProfile.warehouseId;
|
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
|
// Actions Callbacks
|
||||||
_changeState(ids, sateteId, stateName, index) {
|
_changeState(ids, sateteId, stateName, index) {
|
||||||
this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then(
|
this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then(
|
||||||
|
@ -72,14 +92,15 @@ export default class ProductionIndex {
|
||||||
delete this.child;
|
delete this.child;
|
||||||
}
|
}
|
||||||
searchTickets(filter) {
|
searchTickets(filter) {
|
||||||
this.filter = Object.assign({}, filter || {}, this.filter);
|
this.filter = Object.assign({}, this.filter, filter || {});
|
||||||
|
|
||||||
let filters = Object.assign({}, {
|
let filters = Object.assign({}, {
|
||||||
where: this.filter
|
where: this.filter
|
||||||
}, {
|
}, {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 700
|
limit: 1000
|
||||||
});
|
});
|
||||||
|
this.checkAll = 0;
|
||||||
this.$http.get('/production/api/FakeProductions/list?filter=' + JSON.stringify(filters)).then(
|
this.$http.get('/production/api/FakeProductions/list?filter=' + JSON.stringify(filters)).then(
|
||||||
json => {
|
json => {
|
||||||
this.tickets = json.data.tickets;
|
this.tickets = json.data.tickets;
|
||||||
|
@ -92,7 +113,7 @@ export default class ProductionIndex {
|
||||||
refreshTickets() {
|
refreshTickets() {
|
||||||
this.filter = {};
|
this.filter = {};
|
||||||
this.filter.warehouseFk = this.userProfile.warehouseId;
|
this.filter.warehouseFk = this.userProfile.warehouseId;
|
||||||
this.searchTickets();
|
this.search = null;
|
||||||
}
|
}
|
||||||
onChangeWareHouse(item) {
|
onChangeWareHouse(item) {
|
||||||
if (item && item.id && item.id != this.filter.warehouseFk) {
|
if (item && item.id && item.id != this.filter.warehouseFk) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"Finder" : "Localizador",
|
"Finder" : "Localizador",
|
||||||
|
"Production" : "Producción",
|
||||||
"Error: No tickets selected!" : "Error: ¡No hay tickets seleccionados!",
|
"Error: No tickets selected!" : "Error: ¡No hay tickets seleccionados!",
|
||||||
"Error: Action not implemented!" : "Error: ¡Acción no implementada!",
|
"Error: Action not implemented!" : "Error: ¡Acción no implementada!",
|
||||||
"State" : "Estado",
|
"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-autocomplete vn-one margin-medium-right field="$ctrl.filter.agencyFk" url="/production/api/Agencies" label="Agency"></vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal margin-large-top>
|
<vn-horizontal margin-large-top>
|
||||||
<vn-submit vn-one label="Filter"></vn-submit>
|
<vn-one></vn-one>
|
||||||
<vn-button vn-none label="Cancel" ng-click="$ctrl.onCancel()"></vn-button>
|
<vn-none>
|
||||||
|
<vn-submit label="Filter"></vn-submit>
|
||||||
|
</vn-none>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
ngModule.component('vnProductionFilterPanel', {
|
ngModule.component('vnProductionFilterPanel', {
|
||||||
template: require('./production-filters.html')
|
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-vertical>
|
||||||
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||||
<vn-none min-none></vn-none>
|
<vn-none min-none></vn-none>
|
||||||
<vn-colum-header vn-none min-none>
|
<vn-column-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-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-colum-header>
|
</vn-column-header>
|
||||||
<vn-colum-header vn-one pad-medium-h field="ticketFk" text="Ticket ID"></vn-colum-header>
|
<vn-column-header vn-one pad-medium-h field="ticketFk" text="Ticket ID"></vn-column-header>
|
||||||
<vn-colum-header vn-two pad-medium-h field="agency" text="Agency"></vn-colum-header>
|
<vn-column-header vn-two pad-medium-h field="agency" text="Agency"></vn-column-header>
|
||||||
<vn-colum-header vn-one pad-medium-h field="routeFk" text="Route ID"></vn-colum-header>
|
<vn-column-header vn-one pad-medium-h field="routeFk" text="Route ID"></vn-column-header>
|
||||||
<vn-colum-header vn-two pad-medium-h field="salesPerson" text="Commercial"></vn-colum-header>
|
<vn-column-header vn-two pad-medium-h field="salesPerson" text="Commercial"></vn-column-header>
|
||||||
<vn-colum-header vn-one pad-medium-h field="hour" text="Hour"></vn-colum-header>
|
<vn-column-header vn-one pad-medium-h field="hour" text="Hour"></vn-column-header>
|
||||||
<vn-colum-header vn-one pad-medium-h field="state" text="State"></vn-colum-header>
|
<vn-column-header vn-one pad-medium-h field="state" text="State"></vn-column-header>
|
||||||
<vn-colum-header vn-one pad-medium-h field="lines" text="Lines"></vn-colum-header>
|
<vn-column-header vn-one pad-medium-h field="lines" text="Lines"></vn-column-header>
|
||||||
<vn-colum-header vn-one pad-medium-h field="m3" text="m3"></vn-colum-header>
|
<vn-column-header vn-one pad-medium-h field="m3" text="m3"></vn-column-header>
|
||||||
<vn-colum-header vn-one pad-medium-h field="boxes" text="Boxes"></vn-colum-header>
|
<vn-column-header vn-one pad-medium-h field="boxes" text="Boxes"></vn-column-header>
|
||||||
<vn-none min-none></vn-none>
|
<vn-none min-none></vn-none>
|
||||||
</vn-grid-header>
|
</vn-grid-header>
|
||||||
<vn-one class="list list-content">
|
<vn-one class="list list-content">
|
||||||
|
|
|
@ -5,6 +5,7 @@ export class ProductionTable {
|
||||||
this.$filter = $filter;
|
this.$filter = $filter;
|
||||||
this._tickets = [];
|
this._tickets = [];
|
||||||
this.itemsDisplayedInList = 14;
|
this.itemsDisplayedInList = 14;
|
||||||
|
this._checkAll = 0;
|
||||||
this.pageTable = {
|
this.pageTable = {
|
||||||
filter: {
|
filter: {
|
||||||
page: 1,
|
page: 1,
|
||||||
|
@ -13,6 +14,12 @@ export class ProductionTable {
|
||||||
model: []
|
model: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
get checkAll() {
|
||||||
|
return this._checkAll;
|
||||||
|
}
|
||||||
|
set checkAll(value) {
|
||||||
|
this._checkAll = value;
|
||||||
|
}
|
||||||
set tickets(value) {
|
set tickets(value) {
|
||||||
this._tickets = value;
|
this._tickets = value;
|
||||||
this.totalFilter = this._tickets.length;
|
this.totalFilter = this._tickets.length;
|
||||||
|
@ -40,7 +47,8 @@ ngModule.component('vnProductionTable', {
|
||||||
template: require('./production-table.html'),
|
template: require('./production-table.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
tickets: '=',
|
tickets: '=',
|
||||||
footer: '<'
|
footer: '<',
|
||||||
|
checkAll: '='
|
||||||
},
|
},
|
||||||
controller: ProductionTable
|
controller: ProductionTable
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,15 +3,18 @@
|
||||||
<h6 vn-one translate="Modules access"></h6>
|
<h6 vn-one translate="Modules access"></h6>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-module-container>
|
<vn-module-container>
|
||||||
<a ng-repeat="mod in $ctrl.modules" ui-sref="{{::mod.route.state}}" class="{{::mod.name}} vn-module mdl-shadow--4dp">
|
<a ng-repeat="mod in $ctrl.modules" ui-sref="{{::mod.route.state}}" class="vn-module mdl-shadow--4dp">
|
||||||
<vn-vertical>
|
|
||||||
|
<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>
|
<vn-one>
|
||||||
<h4 translate="{{::mod.name}}"></h4>
|
<h4 translate="{{::mod.name}}"></h4>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-one>
|
|
||||||
<vn-icon icon="{{::mod.icon}}"></vn-icon>
|
|
||||||
</vn-one>
|
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
|
@ -19,11 +19,23 @@ vn-home {
|
||||||
.vn-module{
|
.vn-module{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: none;
|
flex: none;
|
||||||
padding: 2em;
|
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
border-radius: 4px;
|
background-color: #FF9300;
|
||||||
box-sizing: border-box;
|
color: white;
|
||||||
transition: opacity 0.7s ease;
|
|
||||||
|
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{
|
h4{
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
font-size: 16pt;
|
font-size: 16pt;
|
||||||
|
@ -40,14 +52,6 @@ vn-home {
|
||||||
opacity: 0.7;
|
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="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="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>
|
<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">
|
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-small for="apps">
|
||||||
<vn-horizontal>
|
<li class="mdl-menu__item" ng-repeat="mod in $ctrl.modules track by $index" ui-sref="{{::mod.route.state}}">
|
||||||
<div ng-repeat="mod in $ctrl.modules track by $index" margin-medium-right>
|
<img ng-if="mod.icon && mod.icon.startsWith('/')" ng-src="{{::mod.icon}}" />
|
||||||
<vn-vertical>
|
<span translate="{{::mod.name}}"></span>
|
||||||
<a ui-sref="{{::mod.route.state}}">
|
</li>
|
||||||
<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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
vn-main-menu {
|
vn-main-menu {
|
||||||
vn-icon {
|
li.mdl-menu__item{
|
||||||
padding: .1em;
|
background-color: #FF9300;
|
||||||
border-radius: .1em;
|
margin-bottom: 8px;
|
||||||
vertical-align: middle;
|
color: white;
|
||||||
font-size: 24px;
|
img{
|
||||||
|
max-width: 18px;
|
||||||
&:hover {
|
vertical-align: middle;
|
||||||
cursor: pointer;
|
margin-top: -3px;
|
||||||
opacity: .85;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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"
|
icon="keyboard_arrow_down"
|
||||||
style="cursor: pointer;">
|
style="cursor: pointer;">
|
||||||
</vn-icon>
|
</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>
|
</vn-horizontal>
|
||||||
</form>
|
</form>
|
|
@ -10,17 +10,17 @@ export default class Controller {
|
||||||
this.$window = $window;
|
this.$window = $window;
|
||||||
}
|
}
|
||||||
onClick(event) {
|
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?
|
// 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.filter = Object.assign({}, this.index.filter);
|
||||||
childCtrl.onSubmit = filter => this.onChildSubmit(filter);
|
childCtrl.onSubmit = filter => this.onChildSubmit(filter);
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
onChildSubmit(filter) {
|
onChildSubmit(filter) {
|
||||||
this.vnPopover.hide();
|
// this.vnPopover.hide();
|
||||||
Object.assign(this.index.filter, filter);
|
Object.assign(this.index.filter, filter);
|
||||||
this.onSubmit();
|
this.onSubmit();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,13 @@ export default class Controller {
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
if (this.onSearch)
|
if (this.onSearch)
|
||||||
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() {
|
$onDestroy() {
|
||||||
this.$window.sessionStorage.removeItem('filter');
|
this.$window.sessionStorage.removeItem('filter');
|
||||||
|
@ -42,7 +49,8 @@ ngModule.component('vnSearchbar', {
|
||||||
search: '=',
|
search: '=',
|
||||||
onSearch: '&',
|
onSearch: '&',
|
||||||
advanced: '=',
|
advanced: '=',
|
||||||
popover: '@'
|
popover: '@',
|
||||||
|
label: '@?'
|
||||||
},
|
},
|
||||||
controller: Controller
|
controller: Controller
|
||||||
});
|
});
|
||||||
|
|
|
@ -58,7 +58,7 @@ gulp.task('services', ['copy'], function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('clean', function() {
|
gulp.task('clean', function() {
|
||||||
return del([`${buildDir}/*`, `!${buildDir}/templates`], {force: true});
|
return del([`${buildDir}/*`, `!${buildDir}/templates`, `!${buildDir}/images`], {force: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spliting
|
// Spliting
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = function(Client){
|
||||||
}
|
}
|
||||||
|
|
||||||
function andWhere(p){
|
function andWhere(p){
|
||||||
return {
|
let where = {
|
||||||
where: {
|
where: {
|
||||||
id: p.id,
|
id: p.id,
|
||||||
name: {regexp: p.name},
|
name: {regexp: p.name},
|
||||||
|
@ -30,11 +30,17 @@ module.exports = function(Client){
|
||||||
socialName: {regexp: p.socialName},
|
socialName: {regexp: p.socialName},
|
||||||
city: {regexp: p.city},
|
city: {regexp: p.city},
|
||||||
postcode: p.postcode,
|
postcode: p.postcode,
|
||||||
email: {regexp: p.email},
|
email: {regexp: p.email}
|
||||||
phone: p.phone
|
|
||||||
},
|
},
|
||||||
skip: (p.page - 1) * p.size,
|
skip: (p.page - 1) * p.size,
|
||||||
limit: 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');
|
var path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Módulo de configuración
|
* Módulo de configuración
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +17,6 @@ module.exports = {
|
||||||
|
|
||||||
return require(path.join(__dirname, 'config', `${name}.${env}.json`));
|
return require(path.join(__dirname, 'config', `${name}.${env}.json`));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuración de la aplicación
|
* Configuración de la aplicación
|
||||||
* @return {Object} Objeto de configuración app
|
* @return {Object} Objeto de configuración app
|
||||||
|
@ -26,7 +24,6 @@ module.exports = {
|
||||||
app: function() {
|
app: function() {
|
||||||
return this.getConfig('app');
|
return this.getConfig('app');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuración de smtp
|
* Configuración de smtp
|
||||||
* @return {Object} Objeto de configuración smtp
|
* @return {Object} Objeto de configuración smtp
|
||||||
|
@ -34,7 +31,6 @@ module.exports = {
|
||||||
smtp: function() {
|
smtp: function() {
|
||||||
return this.getConfig('smtp');
|
return this.getConfig('smtp');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuración de mysql
|
* Configuración de mysql
|
||||||
* @return {Object} Objeto de configuración 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/*
|
logs/*
|
||||||
static/*
|
static/*
|
||||||
temp/*
|
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){
|
if(filter.where && filter.where.q){
|
||||||
var newFilter = {
|
var newFilter = {
|
||||||
or: [
|
and: [
|
||||||
{agency: {regexp: filter.where.q}},
|
{
|
||||||
{state: {regexp: filter.where.q}}
|
or: [
|
||||||
],
|
{agency: {regexp: filter.where.q}},
|
||||||
and: []
|
{state: {regexp: filter.where.q}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
delete filter.where.q;
|
delete filter.where.q;
|
||||||
|
|
||||||
Object.keys(filter.where).forEach(
|
if(Object.keys(filter.where).length){
|
||||||
key => {
|
Object.keys(filter.where).forEach(
|
||||||
let field = new Object();
|
key => {
|
||||||
field[key] = filter.where[key];
|
let field = new Object();
|
||||||
newFilter.and.push(field);
|
field[key] = filter.where[key];
|
||||||
}
|
newFilter.and.push(field);
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
filter.where = newFilter;
|
filter.where = newFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ module.exports = function(FakeProduction) {
|
||||||
FakeProduction.beginTransaction({isolationLevel: FakeProduction.Transaction.READ_COMMITTED}, function(err, tx) {
|
FakeProduction.beginTransaction({isolationLevel: FakeProduction.Transaction.READ_COMMITTED}, function(err, tx) {
|
||||||
Message.create(messages, {transaction: tx}, function (err, res) {
|
Message.create(messages, {transaction: tx}, function (err, res) {
|
||||||
if(err){
|
if(err){
|
||||||
transaction.rollback(function(error) {
|
tx.rollback(function(error) {
|
||||||
(error) ? cb(error, null) : cb(err, null);
|
(error) ? cb(error, null) : cb(err, null);
|
||||||
});
|
});
|
||||||
} else{
|
} else{
|
||||||
|
|
|
@ -24,7 +24,7 @@ module.exports = function(Ticket) {
|
||||||
var hour = `${time}:00`;
|
var hour = `${time}:00`;
|
||||||
|
|
||||||
var query = `update Ticket set date = CONCAT(DATE(date), ' ', ?) where id in (?)`;
|
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){
|
FakeProduction.updateAll({ticketFk: {inq: tickets}}, {hour: hour}, function(err, res){
|
||||||
if(err)
|
if(err)
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
"client":{
|
"client":{
|
||||||
"type": "String"
|
"type": "String"
|
||||||
},
|
},
|
||||||
|
"date":{
|
||||||
|
"type": "Date"
|
||||||
|
},
|
||||||
"hour":{
|
"hour":{
|
||||||
"type": "String"
|
"type": "String"
|
||||||
},
|
},
|
||||||
|
@ -74,10 +77,10 @@
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
{
|
{
|
||||||
"accessType": "*",
|
"accessType": "READ",
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "DENY"
|
"permission": "ALLOW"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"accessType": "*",
|
"accessType": "*",
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
{
|
{
|
||||||
"accessType": "*",
|
"accessType": "READ",
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "DENY"
|
"permission": "ALLOW"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"accessType": "*",
|
"accessType": "*",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
select tmp.Id_Ticket as ticketFk,
|
select tmp.Id_Ticket as ticketFk,
|
||||||
tmp.Id_Cliente as clientFk,
|
tmp.Id_Cliente as clientFk,
|
||||||
tmp.Alias as client,
|
tmp.Alias as client,
|
||||||
|
tmp.Fecha as `date`,
|
||||||
tmp.Hora as hour,
|
tmp.Hora as hour,
|
||||||
tmp.POBLACION as city,
|
tmp.POBLACION as city,
|
||||||
tmp.PROVINCIA as province,
|
tmp.PROVINCIA as province,
|
||||||
|
|
Loading…
Reference in New Issue