Commit cd05ff7d authored by Korko's avatar Korko
Browse files

Fix indentation + add some filter for phone number to split on blur and merge on edit

parent 19eff987
This diff is collapsed.
This diff is collapsed.
......@@ -19,41 +19,50 @@ window.app = new VueAjax({
components: {
participant: {
template: '#participant-template',
props: ['idx', 'participants'],
data: function() {
return {
name: '',
email: '',
phone: '',
exclusions: []
};
template: '#participant-template',
props: ['idx', 'participants'],
data: function() {
return {
name: '',
email: '',
phone: '',
exclusions: []
};
},
components: {
select2: require('../vuejs/select2.vue')
},
computed: {
participantNames: function() {
var names = [];
this.participants.forEach(function(participant, idx) {
if(participant.name && idx !== this.idx) {
names.push({id: participant.id, value: idx, text: participant.name});
}
}.bind(this));
return names;
},
components: {
select2: require('../vuejs/select2.vue')
phoneNumber: function() {
if(this.phone.length) {
return this.phone[0] === '0' ?
this.phone.match(/[0-9]{1,2}/g).join(' ') :
[this.phone[0]].concat(this.phone.slice(1).match(/[0-9]{1,2}/g)).join(' ');
} else {
return this.phone;
}
}
},
watch: {
name: function() {
this.$emit('changename', this.name);
},
computed: {
participantNames: function() {
var names = [];
this.participants.forEach(function(participant, idx) {
if(participant.name && idx !== this.idx) {
names.push({id: participant.id, value: idx, text: participant.name});
}
}.bind(this));
return names;
}
email: function() {
this.$emit('changeemail', this.email);
},
watch: {
name: function() {
this.$emit('changename', this.name);
},
email: function() {
this.$emit('changeemail', this.email);
},
phone: function() {
this.$emit('changephone', this.phone);
}
phone: function() {
this.$emit('changephone', this.phone);
}
}
}
},
......
......@@ -17,7 +17,7 @@
<td class="row border-right">
<div class="input-group">
<span class="input-group-addon lang" lang="fr">(+33)</span>
<input type='tel' pattern='0?[67]\d{8}' :maxlength="(phone[0] === undefined || phone[0] === '0') ? 10 : 9" name="phone[]" placeholder="@lang('form.phone.placeholder')" v-model="phone" class="form-control participant-phone" :required="!email" />
<input type='tel' pattern='0?[67]\d{8}' :maxlength="(phone[0] === undefined || phone[0] === '0') ? 10 : 9" name="phone[]" placeholder="@lang('form.phone.placeholder')" v-model="phone" @focus="$event.target.value = phone" @blur="$event.target.value = phoneNumber" class="form-control participant-phone" :required="!email" />
</div>
</td>
<td class="row border-right text-left participant-exclusions-wrapper">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment