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"> <div class="mdl-chip__action">
<i <i
class="material-icons pointer" 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()"> ng-click="$ctrl.onClear()">
clear clear
</i> </i>

View File

@ -29,7 +29,7 @@ class DatePicker extends Component {
if (this.vp.selectedDates.length) { if (this.vp.selectedDates.length) {
let date = this.vp.selectedDates[0]; 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(); let now = new Date();
date.setTime(date.getTime() date.setTime(date.getTime()
+ now.getHours() * 60 * 60 * 1000 + now.getHours() * 60 * 60 * 1000
@ -38,7 +38,15 @@ class DatePicker extends Component {
+ now.getUTCMilliseconds() + 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; this._model = date;
} else } else
this.model = null; this.model = null;

View File

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

View File

@ -27,6 +27,16 @@
ng-click="$ctrl.showLastTickets($event)" ng-click="$ctrl.showLastTickets($event)"
vn-tooltip="Imports ticket lines"> vn-tooltip="Imports ticket lines">
</vn-button> </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-tool-bar>
</vn-horizontal> </vn-horizontal>
<vn-table model="model"> <vn-table model="model">

View File

@ -145,6 +145,14 @@ class Controller {
this.$.descriptor.parent = event.target; this.$.descriptor.parent = event.target;
this.$.descriptor.show(); 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']; Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];

View File

@ -52,15 +52,6 @@
field="$ctrl.claim.isChargedToMana" field="$ctrl.claim.isChargedToMana"
vn-acl="salesAssistant"> vn-acl="salesAssistant">
</vn-check> </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> </vn-horizontal>
<vn-horizontal pad-small-v> <vn-horizontal pad-small-v>

View File

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