This commit is contained in:
Juan Ferrer 2018-12-27 12:55:54 +01:00
commit 2ead6f145d
7 changed files with 36 additions and 16 deletions

View File

@ -12,7 +12,7 @@
<div class="mdl-chip__action">
<i
class="material-icons pointer"
ng-show="$ctrl.enabled && $ctrl.model && ($ctrl.hasFocus || $ctrl.hasMouseIn)"
ng-show="!$ctrl.disabled && $ctrl.model && ($ctrl.hasFocus || $ctrl.hasMouseIn)"
ng-click="$ctrl.onClear()">
clear
</i>

View File

@ -29,7 +29,7 @@ class DatePicker extends Component {
if (this.vp.selectedDates.length) {
let date = this.vp.selectedDates[0];
if (!this.isLocale && !this._iniOptions.enableTime) {
if (!this.isLocale && !this._iniOptions.enableTime && !this.iniOptions.onlyDate) {
let now = new Date();
date.setTime(date.getTime()
+ now.getHours() * 60 * 60 * 1000
@ -38,7 +38,15 @@ class DatePicker extends Component {
+ now.getUTCMilliseconds()
);
}
console.log(this.iniOptions);
if (this.iniOptions.onlyDate) {
let now = new Date();
let offset = now.getTimezoneOffset() * 60000;
date.setHours(0, 0, 0, 0);
date.setTime(date.getTime() - offset);
}
console.log(date);
this._model = date;
} else
this.model = null;

View File

@ -10,6 +10,8 @@ export default class inputRange extends Input {
this.mdlElement.addEventListener('change', () => {
this._value = this.input.value;
this.$.$applyAsync();
if (this._value && this.onChange)
this.onChange();
});
}
@ -71,6 +73,7 @@ ngModule.component('vnInputRange', {
max: '<?',
step: '<?',
value: '=',
model: '='
model: '=',
onChange: '&'
}
});

View File

@ -27,6 +27,16 @@
ng-click="$ctrl.showLastTickets($event)"
vn-tooltip="Imports ticket lines">
</vn-button>
<vn-input-range
vn-one
label="Responsability"
value="$ctrl.claim.responsibility"
max="5"
min="1"
step="1"
vn-acl="salesAssistant"
on-change="$ctrl.saveResponsibility()">
</vn-input-range>
</vn-tool-bar>
</vn-horizontal>
<vn-table model="model">

View File

@ -145,6 +145,14 @@ class Controller {
this.$.descriptor.parent = event.target;
this.$.descriptor.show();
}
saveResponsibility() {
let query = `/claim/api/Claims/updateClaim`;
this.$http.post(query, {responsibility: this.claim.responsibility}).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
}
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];

View File

@ -52,15 +52,6 @@
field="$ctrl.claim.isChargedToMana"
vn-acl="salesAssistant">
</vn-check>
<vn-input-range
vn-one
label="Responsability"
value="$ctrl.claim.responsibility"
max="5"
min="1"
step="1"
vn-acl="salesAssistant">
</vn-input-range>
</vn-horizontal>
</vn-horizontal>
<vn-horizontal pad-small-v>

View File

@ -30,12 +30,12 @@
<vn-one>
<vn-input-range
vn-one
disabled="true"
label="Responsability"
value="$ctrl.summary.claim.responsibility"
max="4"
min="0"
step="1">
max="5"
min="1"
step="1"
vn-acl="salesAssistant">
</vn-input-range>
</vn-one>
</vn-horizontal>