mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
fix html5 birthdate field on modal form OnTheFly
This commit is contained in:
parent
4d0cfbb396
commit
937be1af3a
@ -137,8 +137,10 @@ export default {
|
|||||||
} else if (this.type === 'thirdparty') {
|
} else if (this.type === 'thirdparty') {
|
||||||
this.$refs.castThirdparty.postData();
|
this.$refs.castThirdparty.postData();
|
||||||
} else {
|
} else {
|
||||||
|
// saveAction() ==cast=to==> child.castByType() ==cast=to==> grand-child.postData()
|
||||||
this.$refs.castNew.castByType();
|
this.$refs.castNew.castByType();
|
||||||
}
|
}
|
||||||
|
this.modal.showModal = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,20 +11,7 @@ const getPerson = (id) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GET a thirdparty by id
|
* POST a new person
|
||||||
* TODO move in ChillThirdpartyAssets !!
|
|
||||||
*/
|
|
||||||
const getThirdparty = (id) => {
|
|
||||||
const url = `/api/1.0/thirdparty/thirdparty/${id}.json`;
|
|
||||||
return fetch(url)
|
|
||||||
.then(response => {
|
|
||||||
if (response.ok) { return response.json(); }
|
|
||||||
throw Error('Error with request resource response');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* POST a person
|
|
||||||
*/
|
*/
|
||||||
const postPerson = (body) => {
|
const postPerson = (body) => {
|
||||||
const url = `/api/1.0/person/person.json`;
|
const url = `/api/1.0/person/person.json`;
|
||||||
@ -43,6 +30,5 @@ const postPerson = (body) => {
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
getPerson,
|
getPerson,
|
||||||
getThirdparty,
|
|
||||||
postPerson
|
postPerson
|
||||||
};
|
};
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="action === 'edit' || action === 'create'">
|
<div v-else-if="action === 'edit' || action === 'create'">
|
||||||
{{ action }}
|
|
||||||
|
|
||||||
<input v-model="firstName" :placeholder="$t('person.firstname')" />
|
<input v-model="firstName" :placeholder="$t('person.firstname')" />
|
||||||
<input v-model="lastName" :placeholder="$t('person.lastname')" />
|
<input v-model="lastName" :placeholder="$t('person.lastname')" />
|
||||||
@ -68,18 +67,12 @@
|
|||||||
<option value="neuter">{{ $t('person.gender.neuter') }}</option>
|
<option value="neuter">{{ $t('person.gender.neuter') }}</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--
|
<i class="fa fa-birthday-cake"></i>
|
||||||
<input
|
<input type="date"
|
||||||
type="text"
|
|
||||||
id="chill_personbundle_person_birthdate"
|
id="chill_personbundle_person_birthdate"
|
||||||
name="chill_personbundle_person[birthdate]"
|
name="chill_personbundle_person[birthdate]"
|
||||||
required="required"
|
|
||||||
class="input datepicker"
|
|
||||||
v-model="birthDate"
|
v-model="birthDate"
|
||||||
aria-label="Use the arrow keys to pick a date"
|
/>
|
||||||
/>
|
|
||||||
<datepicker v-model="birthDate" />
|
|
||||||
-->
|
|
||||||
|
|
||||||
<i class="fa fa-phone">
|
<i class="fa fa-phone">
|
||||||
</i><input v-model="phonenumber" :placeholder="$t('person.phonenumber')" />
|
</i><input v-model="phonenumber" :placeholder="$t('person.phonenumber')" />
|
||||||
@ -91,9 +84,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getPerson, postPerson } from '../../_api/OnTheFly';
|
import { getPerson, postPerson } from '../../_api/OnTheFly';
|
||||||
//import Datepicker from 'vue3-datepicker';
|
|
||||||
//import { ref } from 'vue';
|
|
||||||
//const picked = ref(new Date())
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OnTheFlyPerson",
|
name: "OnTheFlyPerson",
|
||||||
@ -118,17 +108,18 @@ export default {
|
|||||||
set(value) { this.person.gender = value; },
|
set(value) { this.person.gender = value; },
|
||||||
get() { return this.person.gender; }
|
get() { return this.person.gender; }
|
||||||
},
|
},
|
||||||
// birthDate: {
|
birthDate: {
|
||||||
// set(value) { this.person.birthdate.datetime = value; },
|
set(value) {
|
||||||
// get() {
|
if (this.person.birthdate) {
|
||||||
// if (this.person.birthdate) {
|
this.person.birthdate.datetime = value + "T00:00:00+0100";
|
||||||
// let datetime = this.person.birthdate.datetime;
|
} else {
|
||||||
// return datetime.getDate() + '-' + (datetime.getMonth() + 1) + '-' + datetime.getFullYear();
|
this.person.birthdate = { datetime: value + "T00:00:00+0100"};
|
||||||
// } else {
|
}
|
||||||
// return ref(new Date());
|
},
|
||||||
// }
|
get() {
|
||||||
// }
|
return (this.person.birthdate) ? this.person.birthdate.datetime.split('T')[0] : '';
|
||||||
// },
|
}
|
||||||
|
},
|
||||||
phonenumber: {
|
phonenumber: {
|
||||||
set(value) { this.person.phonenumber = value; },
|
set(value) { this.person.phonenumber = value; },
|
||||||
get() { return this.person.phonenumber; }
|
get() { return this.person.phonenumber; }
|
||||||
@ -168,11 +159,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadData() {
|
loadData() {
|
||||||
//console.log('loading data', this.id);
|
|
||||||
getPerson(this.id)
|
getPerson(this.id)
|
||||||
.then(person => new Promise((resolve, reject) => {
|
.then(person => new Promise((resolve, reject) => {
|
||||||
this.person = person;
|
this.person = person;
|
||||||
//console.log('person', this.person);
|
console.log('get person', this.person);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
@ -180,7 +170,7 @@ export default {
|
|||||||
postPerson(this.person)
|
postPerson(this.person)
|
||||||
.then(person => new Promise((resolve, reject) => {
|
.then(person => new Promise((resolve, reject) => {
|
||||||
this.person = person;
|
this.person = person;
|
||||||
console.log('person', person);
|
console.log('post person', person);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user