Streamline form handling

This commit is contained in:
Björn Fromme
2018-11-01 16:54:33 +01:00
parent c105c12f7d
commit ce0e98fb92
2 changed files with 35 additions and 25 deletions
@@ -1,35 +1,45 @@
<template> <template>
<div id="myep-main" v-show="!loading"> <div id="myep-main" v-show="!loading">
<h1>Mein Profil</h1> <h1>Mein Profil</h1>
<div class="row"> <form @submit.prevent="saveSelections()">
<div class="col-xs-12 col-md-6"> <div class="row">
<template v-for="selectionGroup in this.crmData.selectionGroups" <div class="col-xs-12 col-md-6">
v-if="hasVisibleSelections(selectionGroup)"> <template v-for="selectionGroup in this.crmData.selectionGroups"
<h3>{{ selectionGroup.name}}</h3> v-if="hasVisibleSelections(selectionGroup)">
<div class="checkbox" v-for="selection in selectionGroup.selections" <h3>{{ selectionGroup.name}}</h3>
v-if="selection.changeable === true"> <div class="checkbox" v-for="selection in selectionGroup.selections"
<label :class="{ disabled: !selection.changeable}"> v-if="selection.changeable === true">
<input type="checkbox" class="form-control" v-model="selection.value" <label :class="{ disabled: !selection.changeable}">
:disabled="!selection.changeable" @change="saveSelections()"/> <input type="checkbox" class="form-control" v-model="selection.value"
:disabled="!selection.changeable"/>
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
{{ selection.name }}
</label>
</div>
</template>
</div>
<div class="col-xs-12 col-md-6">
<div class="checkbox" v-for="action in this.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"/>
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span> <span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
{{ selection.name }} {{ action.name }}
</label> </label>
</div> </div>
</template>
</div>
<div class="col-xs-12 col-md-6">
<div class="checkbox" v-for="action in this.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"
@change="saveSelections()"/>
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
{{ action.name }}
</label>
</div> </div>
</div> </div>
</div> <div class="row">
<div class="col-xs-12">
<div class="form-group">
<button type="submit" class="button" :disabled="loading">
Speichern
</button>
</div>
</div>
</div>
</form>
</div> </div>
</template> </template>
@@ -1,7 +1,7 @@
<template> <template>
<div class="form-wrapper form--border" id="myep-main" v-show="!loading"> <div class="form-wrapper form--border" id="myep-main" v-show="!loading">
<h1>Teamer</h1> <h1>Teamer</h1>
<form @submit="saveTeamerData()"> <form @submit.prevent="saveTeamerData()">
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6"> <div class="col-xs-12 col-md-6">
<h4>Fährst du Ski oder Board?</h4> <h4>Fährst du Ski oder Board?</h4>