fixed zone bugs

This commit is contained in:
Joan Sanchez 2019-02-25 10:03:50 +01:00
parent c3f20dba3c
commit ac1e619b06
6 changed files with 26 additions and 24 deletions

View File

@ -93,7 +93,7 @@ export default class Calendar extends Component {
} }
applyOffset(date) { applyOffset(date) {
date.setTime(date.getTime() - date.getTimezoneOffset() * 60000); // date.setTime(date.getTime() - date.getTimezoneOffset() * 60000);
} }
repaint() { repaint() {

View File

@ -3,6 +3,7 @@
<div class="textField"> <div class="textField">
<div class="leftIcons"> <div class="leftIcons">
<vn-icon-button <vn-icon-button
ng-if="::$ctrl.step"
icon="remove" icon="remove"
ng-click="$ctrl.remove()" ng-click="$ctrl.remove()"
tabindex="-1" tabindex="-1"
@ -13,7 +14,7 @@
<input <input
class="mdl-textfield__input" class="mdl-textfield__input"
type="number" type="number"
name="{{$ctrl.name}}" name="{{::$ctrl.name}}"
ng-model="$ctrl.value" ng-model="$ctrl.value"
ng-disabled="$ctrl.disabled" ng-disabled="$ctrl.disabled"
ng-readonly="$ctrl.readonly" ng-readonly="$ctrl.readonly"
@ -26,14 +27,15 @@
<div class="selected underline"></div> <div class="selected underline"></div>
<div class="suffix"> <div class="suffix">
<vn-icon-button <vn-icon-button
ng-if="::$ctrl.step"
icon="add" icon="add"
ng-click="$ctrl.add()" ng-click="$ctrl.add()"
tabindex="-1" tabindex="-1"
translate-attr="{title: 'Add'}"> translate-attr="{title: 'Add'}">
</vn-icon-button> </vn-icon-button>
<i class="material-icons" <i class="material-icons"
ng-if="$ctrl.hasInfo" ng-if="::$ctrl.hasInfo"
vn-tooltip="{{$ctrl.info}}"> vn-tooltip="{{::$ctrl.info}}">
info_outline info_outline
</i> </i>
</div> </div>

View File

@ -3,7 +3,6 @@ import Textfield from '../textfield/textfield';
import './style.scss'; import './style.scss';
export default class InputNumber extends Textfield { export default class InputNumber extends Textfield {
constructor($element, $scope, $attrs, vnTemplate, $transclude) { constructor($element, $scope, $attrs, vnTemplate, $transclude) {
super($element, $scope, $attrs, vnTemplate, $transclude); super($element, $scope, $attrs, vnTemplate, $transclude);
@ -56,30 +55,30 @@ export default class InputNumber extends Textfield {
if ((this.validate() !== undefined && !this.validate()) || if ((this.validate() !== undefined && !this.validate()) ||
(this.max && this.value > this.max) || (this.max && this.value > this.max) ||
(this.min && this.value < this.min) || (this.min && this.value < this.min) ||
(this.step && this.value % this.step != 0)) { (this.step && this.value % this.step != 0))
this.$element[0].querySelector('.infix').classList.add('invalid', 'validated'); this.$element[0].querySelector('.infix').classList.add('invalid', 'validated');
}
if (this.onChange) if (this.onChange)
this.onChange(); this.onChange();
} }
add() { add() {
if (this.step && this.value % this.step != 0) { if (this.step && this.value % this.step != 0)
this.value += (this.step - this.value % this.step); this.value += (this.step - this.value % this.step);
} else { else
this.value += this.step; this.value += this.step;
}
this.validateValue(); this.validateValue();
} }
remove() { remove() {
if (this.step && this.value % this.step != 0) { if (this.step && this.value % this.step != 0)
this.value -= (this.step + this.value % this.step); this.value -= (this.step + this.value % this.step);
} else { else
this.value -= this.step; this.value -= this.step;
}
this.validateValue(); this.validateValue();
} }
} }

View File

@ -17,7 +17,9 @@ class Controller {
this.ndMonth = this.$scope.ndMonth; this.ndMonth = this.$scope.ndMonth;
} }
get zone() { // Disabled until implementation
// of holidays by node
/* get zone() {
return this._zone; return this._zone;
} }
@ -41,7 +43,7 @@ class Controller {
this.events = this.events.concat(events); this.events = this.events.concat(events);
}); });
} } */
get data() { get data() {
return this._data; return this._data;

View File

@ -51,14 +51,12 @@
<vn-input-number vn-one <vn-input-number vn-one
label="Price" label="Price"
field="$ctrl.zone.price" field="$ctrl.zone.price"
min="0.00" min="0.00">
step="0.50">
</vn-input-number> </vn-input-number>
<vn-input-number vn-one <vn-input-number vn-one
label="Bonus" label="Bonus"
field="$ctrl.zone.bonus" field="$ctrl.zone.bonus"
min="0.00" min="0.00">
step="0.50">
</vn-input-number> </vn-input-number>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>

View File

@ -23,12 +23,13 @@ class Controller {
} }
onSelection(item, isIncluded) { onSelection(item, isIncluded) {
item.isIncluded = isIncluded; let node = Object.assign({}, item);
const path = '/agency/api/ZoneIncludeds/toggleIsIncluded'; node.isIncluded = isIncluded;
const params = {zoneFk: this.zone.id, item}; node.childs = []; // Data too large
this.$http.post(path, params).then(() => {
}); const path = '/agency/api/ZoneIncludeds/toggleIsIncluded';
const params = {zoneFk: this.zone.id, item: node};
this.$http.post(path, params);
} }
} }