mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add date for movement editor
This commit is contained in:
parent
d9a3e117b2
commit
502a629dc8
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<household></household>
|
<household></household>
|
||||||
<concerned></concerned>
|
<concerned></concerned>
|
||||||
|
<dates></dates>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -8,12 +9,14 @@
|
|||||||
import { mapState } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
import Concerned from './components/Concerned.vue';
|
import Concerned from './components/Concerned.vue';
|
||||||
import Household from './components/Household.vue';
|
import Household from './components/Household.vue';
|
||||||
|
import Dates from './components/Dates.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
Concerned,
|
Concerned,
|
||||||
Household,
|
Household,
|
||||||
|
Dates,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// for debugging purpose
|
// for debugging purpose
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<h2>{{ $t('household_member_editor.dates_title') }}</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="start_date">
|
||||||
|
{{ $t('household_member_editor.dates.start_date') }}
|
||||||
|
</label>
|
||||||
|
<input type="date" v-model="startDate" />
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Dates',
|
||||||
|
computed: {
|
||||||
|
startDate: {
|
||||||
|
get() {
|
||||||
|
return [
|
||||||
|
this.$store.state.startDate.getFullYear(),
|
||||||
|
(this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'),
|
||||||
|
this.$store.state.startDate.getDate().toString().padStart(2, '0')
|
||||||
|
].join('-');
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
let
|
||||||
|
[year, month, day] = value.split('-'),
|
||||||
|
dValue = new Date(year, month-1, day);
|
||||||
|
|
||||||
|
this.$store.dispatch('setStartDate', dValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -6,7 +6,6 @@ const concerned = window.household_members_editor_data.persons.map(p => {
|
|||||||
return {
|
return {
|
||||||
person: p,
|
person: p,
|
||||||
position: null,
|
position: null,
|
||||||
start_date: null,
|
|
||||||
allowRemove: false,
|
allowRemove: false,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -17,10 +16,12 @@ const store = createStore({
|
|||||||
concerned,
|
concerned,
|
||||||
household: window.household_members_editor_data.household,
|
household: window.household_members_editor_data.household,
|
||||||
positions: window.household_members_editor_data.positions,
|
positions: window.household_members_editor_data.positions,
|
||||||
|
startDate: new Date(),
|
||||||
allowHouseholdCreate: window.household_members_editor_data.allowHouseholdCreate,
|
allowHouseholdCreate: window.household_members_editor_data.allowHouseholdCreate,
|
||||||
allowHouseholdSearch: window.household_members_editor_data.allowHouseholdSearch,
|
allowHouseholdSearch: window.household_members_editor_data.allowHouseholdSearch,
|
||||||
allowLeaveWithoutHousehold: window.household_members_editor_data.allowLeaveWithoutHousehold,
|
allowLeaveWithoutHousehold: window.household_members_editor_data.allowLeaveWithoutHousehold,
|
||||||
forceLeaveWithoutHousehold: false
|
forceLeaveWithoutHousehold: false,
|
||||||
|
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
isHouseholdNew(state) {
|
isHouseholdNew(state) {
|
||||||
@ -68,7 +69,7 @@ const store = createStore({
|
|||||||
let persons = state.concerned.map(conc => conc.person.id);
|
let persons = state.concerned.map(conc => conc.person.id);
|
||||||
if (!persons.includes(person.id)) {
|
if (!persons.includes(person.id)) {
|
||||||
state.concerned.push({ person, position: null,
|
state.concerned.push({ person, position: null,
|
||||||
start_date: null, allowRemove: true });
|
allowRemove: true });
|
||||||
} else {
|
} else {
|
||||||
console.err("person already included");
|
console.err("person already included");
|
||||||
}
|
}
|
||||||
@ -105,6 +106,9 @@ const store = createStore({
|
|||||||
state.household = null;
|
state.household = null;
|
||||||
state.forceLeaveWithoutHousehold = true;
|
state.forceLeaveWithoutHousehold = true;
|
||||||
},
|
},
|
||||||
|
setStartDate(state, dateI) {
|
||||||
|
state.startDate = dateI
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addConcerned({ commit }, person) {
|
addConcerned({ commit }, person) {
|
||||||
@ -132,6 +136,9 @@ const store = createStore({
|
|||||||
forceLeaveWithoutHousehold({ commit }) {
|
forceLeaveWithoutHousehold({ commit }) {
|
||||||
commit('forceLeaveWithoutHousehold');
|
commit('forceLeaveWithoutHousehold');
|
||||||
},
|
},
|
||||||
|
setStartDate({ commit }, date) {
|
||||||
|
commit('setStartDate', date);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user