Simplify code
This commit is contained in:
@@ -19,8 +19,7 @@
|
||||
</template>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="checkbox" v-for="action in crmData.actions"
|
||||
v-if="action.changeable === true">
|
||||
<div class="checkbox" v-for="action in crmData.actions" v-if="action.changeable === true">
|
||||
<label :class="{ disabled: !action.changeable}">
|
||||
<input type="checkbox" class="form-control"
|
||||
v-model="action.value" :disabled="!action.changeable"/>
|
||||
@@ -56,7 +55,19 @@
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.load()
|
||||
this.beginLoading();
|
||||
|
||||
return this.getClient().get('/api/crm-selections')
|
||||
.then(response => {
|
||||
this.crmData = response.data
|
||||
}).catch(error => {
|
||||
this.alert({
|
||||
message: 'Es ist ein Fehler aufgetreten :(',
|
||||
class: 'alert-danger'
|
||||
})
|
||||
}).finally(() => {
|
||||
this.endLoading()
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['beginLoading', 'endLoading', 'alert']),
|
||||
@@ -67,21 +78,6 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
load () {
|
||||
this.beginLoading();
|
||||
|
||||
return this.getClient().get('/api/crm-selections')
|
||||
.then(response => {
|
||||
this.crmData = response.data
|
||||
}).catch(error => {
|
||||
this.alert({
|
||||
message: 'Es ist ein Fehler aufgetreten :(',
|
||||
class: 'alert-danger'
|
||||
})
|
||||
}).finally(() => {
|
||||
this.endLoading()
|
||||
});
|
||||
},
|
||||
save () {
|
||||
this.beginLoading();
|
||||
|
||||
|
||||
@@ -61,31 +61,28 @@
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.load()
|
||||
this.beginLoading();
|
||||
|
||||
const client = axios.create({
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + this.authToken
|
||||
}
|
||||
});
|
||||
|
||||
return client.get('/api/events')
|
||||
.then(response => {
|
||||
this.events = response.data;
|
||||
}).catch(error => {
|
||||
this.alert({
|
||||
message: 'Es ist ein Fehler aufgetreten :(',
|
||||
class: 'alert-danger'
|
||||
});
|
||||
}).finally(() => {
|
||||
this.endLoading();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['beginLoading', 'endLoading', 'alert']),
|
||||
load () {
|
||||
this.beginLoading();
|
||||
|
||||
const client = axios.create({
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + this.authToken
|
||||
}
|
||||
});
|
||||
|
||||
return client.get('/api/events')
|
||||
.then(response => {
|
||||
this.events = response.data;
|
||||
}).catch(error => {
|
||||
this.alert({
|
||||
message: 'Es ist ein Fehler aufgetreten :(',
|
||||
class: 'alert-danger'
|
||||
});
|
||||
}).finally(() => {
|
||||
this.endLoading();
|
||||
});
|
||||
},
|
||||
formatBookingDate (date) {
|
||||
if (!date) {
|
||||
return '-'
|
||||
|
||||
@@ -60,9 +60,13 @@
|
||||
{{ timeFrame | period }}
|
||||
</label>
|
||||
</div>
|
||||
<form-checkbox :value.sync="userData.monthLong">
|
||||
Ich habe Zeit und würde gerne über einen Monat am Stück in eine Destination.
|
||||
</form-checkbox>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" class="form-control" v-model="userData.monthLong"/>
|
||||
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
|
||||
Ich habe Zeit und würde gerne über einen Monat am Stück in eine Destination.
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -84,12 +88,10 @@
|
||||
import dayjs from 'dayjs'
|
||||
import 'dayjs/locale/de'
|
||||
import FormGroup from './components/FormGroup';
|
||||
import FormCheckbox from './components/FormCheckbox';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FormGroup,
|
||||
FormCheckbox
|
||||
FormGroup
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
@@ -112,19 +114,6 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
load () {
|
||||
this.beginLoading();
|
||||
|
||||
return this.getClient().get('/api/teamer-data')
|
||||
.then(response => {
|
||||
this.abilities = response.data.abilities;
|
||||
this.timeFrames = response.data.timeFrames;
|
||||
this.jobProfiles = response.data.jobProfiles;
|
||||
}).catch(error => {
|
||||
}).finally(() => {
|
||||
this.endLoading();
|
||||
});
|
||||
},
|
||||
save () {
|
||||
const data = {
|
||||
abilities: this.userData.abilities,
|
||||
@@ -156,7 +145,17 @@
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.load()
|
||||
this.beginLoading();
|
||||
|
||||
return this.getClient().get('/api/teamer-data')
|
||||
.then(response => {
|
||||
this.abilities = response.data.abilities;
|
||||
this.timeFrames = response.data.timeFrames;
|
||||
this.jobProfiles = response.data.jobProfiles;
|
||||
}).catch(error => {
|
||||
}).finally(() => {
|
||||
this.endLoading();
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userData', 'loading', 'authToken'])
|
||||
|
||||
Reference in New Issue
Block a user