Feat: structure for month and form

This commit is contained in:
Bertrand Benjamin 2021-07-07 15:07:46 +02:00
parent caaefc0972
commit 6d669e5ae4
7 changed files with 151 additions and 34 deletions

View File

@ -0,0 +1,31 @@
<template>
<form id="new-month">
<h3> Nouveau mois </h3>
<input type="month">
<month-form></month-form>
</form>
</template>
<script>
import MonthForm from "./MonthForm"
export default {
name: 'NewMonth',
components: {
MonthForm: MonthForm,
},
data () {
return {
monthDate: "2021/07",
}
},
props: {
},
computed: {
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

View File

@ -0,0 +1,42 @@
<template>
<form>
<label for="ca-theo">CA théorique</label>
<input type="number" id="ca-theo">
<label for="ca-retro">CA au moment de la rétrocession</label>
<input type="number" id="ca-retro">
<label for="ca-react">CA réactualisé</label>
<input type="number" id="ca-react">
<label for="nbr-seance">Nombre de séances</label>
<input type="number" id="nbr-seance">
<label for="retro">Montant de la rétrocession</label>
<input type="number" id="retro">
<label for="remumeration">Rémunération effectuée</label>
<input type="number" id="remumeration">
</form>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'MonthForm',
props: {
},
computed: {
...mapGetters({
empty: "travail/empty_month",
})
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

View File

@ -0,0 +1,38 @@
<template>
<div class="month-presentation">
<div class="date">
{{ month.date }}
</div>
<div class="infos">
<ul>
<li> CA théorique {{ month.ca_theo ?? "∅"}}</li>
<li> CA à la rétrocession {{ month.ca_retro ?? "∅"}}</li>
<li> CA réactualisé {{ month.ca_react ?? "∅"}}</li>
<li> Nombre de séances {{ month.nbr_seances ?? "∅"}}</li>
<li> Montant de la rétrocession {{ month.retro ?? "∅"}}</li>
<li> Rémunération effectuée {{ month.remumeration ?? "∅"}}</li>
</ul>
</div>
<div class="actions">
<button> Éditer </button>
</div>
</div>
</template>
<script>
export default {
name: 'MonthPresentation',
props: {
month: {
type: Object,
}
},
computed: {
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

View File

@ -0,0 +1,31 @@
<template>
<ul id="months">
<li v-for="month in months" :key="month.date">
<month-presentation :month=month></month-presentation>
</li>
</ul>
</template>
<script>
import { mapGetters } from 'vuex'
import MonthPresentation from "./MonthPresentation"
export default {
name: 'Months',
components: {
MonthPresentation: MonthPresentation
},
props: {
},
computed: {
...mapGetters({
months: "travail/Months",
})
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

View File

@ -1,29 +0,0 @@
<template>
<div id="months">
<ul>
<li v-for="month in months" :key="month.date">
{{ month }}
</li>
</ul>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'months',
props: {
},
computed: {
...mapGetters({
months: "travail/months",
})
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

View File

@ -70,8 +70,9 @@ const travail = {
}
},
getters: {
count (state) {return state.months.length},
months (state) {
cCount (state) {return state.months.length},
TheEmptyMonth (state) {return state.empty},
Months (state) {
return state.months.sort((a, b) => new Date(b.date) - new Date(a.date))
},
},

View File

@ -2,17 +2,20 @@
<h1>Home</h1>
<section>
<h2> Mois </h2>
<months></months>
<create-month></create-month>
<months-list></months-list>
</section>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import months from '../components/months'
import MonthsList from '../components/MonthsUl.vue'
import CreateMonth from '../components/CreateMonth.vue'
export default {
name: 'home',
components: {
months: months
MonthsList: MonthsList,
CreateMonth: CreateMonth,
},
data () {
return {}