19 Commits

Author SHA1 Message Date
da5f53c267 Feat: add current year to nav 2022-02-13 18:14:54 +01:00
8b92697870 Feat: css to hightlight selected_year 2022-02-13 18:03:44 +01:00
4ddfa1654f Feat: selecting a year is working 2022-02-13 17:57:40 +01:00
acab0a9d68 Feat: list years 2022-02-13 17:50:55 +01:00
e22445646a Fix: current year default range 2021-10-08 05:40:10 +02:00
e191a47be5 Feat: prepare editing page 2021-08-16 14:46:11 +02:00
08c14e1887 Feat: remove applicationMenu 2021-08-16 14:30:45 +02:00
9e123a9542 Feat: create hightlightSum component 2021-08-13 10:54:47 +02:00
2d0c2c4df9 Feat: ca -> CA 2021-08-13 10:43:29 +02:00
da86f4b9f1 Feat: change type base to editable and add getters for hightlights and
editable
2021-08-13 10:42:01 +02:00
5eb9837e1c Feat: computed attributes for months 2021-08-13 10:19:26 +02:00
9cf4cf934b Feat: use output function for month description 2021-08-13 09:43:47 +02:00
710015a37b Feat: hightlight for month presentation 2021-08-12 15:17:22 +02:00
35666dce00 Feat: locale for date and button for adding next month 2021-08-12 15:12:57 +02:00
37d1967343 Feat: simplify createMonth 2021-08-12 14:28:00 +02:00
cdbc5f9d51 Feat: add unit and percent to real percent 2021-08-12 14:21:25 +02:00
d690bcac56 Feat: add individual percentage and individualize functions on months 2021-08-12 14:12:24 +02:00
db21bc1275 Feat: use store/config to display attributs of months 2021-08-12 12:22:03 +02:00
4e8189da38 Feat: rename months attributs 2021-08-12 12:09:18 +02:00
20 changed files with 645 additions and 417 deletions

View File

@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-cog" class="svg-inline--fa fa-user-cog fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M610.5 373.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 400.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm201.2 226.5c-2.3-1.2-4.6-2.6-6.8-3.9l-7.9 4.6c-6 3.4-12.8 5.3-19.6 5.3-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-5.5-17.7 1.9-36.4 17.9-45.7l7.9-4.6c-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-16-9.2-23.4-28-17.9-45.7.9-2.9 2.2-5.8 3.2-8.7-3.8-.3-7.5-1.2-11.4-1.2h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c10.1 0 19.5-3.2 27.2-8.5-1.2-3.8-2-7.7-2-11.8v-9.2z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,6 +1,8 @@
<template>
<Nav></Nav>
<router-view></router-view>
<div class="content">
<router-view></router-view>
</div>
</template>
<script>
@@ -14,4 +16,5 @@ export default {
}
</script>
<style></style>
<style>
</style>

View File

@@ -7,77 +7,78 @@ const isDevelopment = process.env.NODE_ENV !== 'production'
// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { secure: true, standard: true } }
{ scheme: 'app', privileges: { secure: true, standard: true } }
])
async function createWindow() {
// Create the browser window.
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
}
})
// Create the browser window.
const win = new BrowserWindow({
width: 800,
height: 600,
autoHideMenuBar: true,
webPreferences: {
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
// Load the index.html when not in development
win.loadURL('app://./index.html')
}
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
}
})
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
// Load the index.html when not in development
win.loadURL('app://./index.html')
}
}
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', async () => {
if (isDevelopment && !process.env.IS_TEST) {
// Install Vue Devtools
try {
//await installExtension(VUEJS_DEVTOOLS)
// vuedev tools for vue3
await installExtension('ljjemllljcmogpfapbkkighbhhppjdbg')
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
if (isDevelopment && !process.env.IS_TEST) {
// Install Vue Devtools
try {
//await installExtension(VUEJS_DEVTOOLS)
// vuedev tools for vue3
await installExtension('ljjemllljcmogpfapbkkighbhhppjdbg')
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}
}
}
createWindow()
createWindow()
})
// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
if (process.platform === 'win32') {
process.on('message', (data) => {
if (data === 'graceful-exit') {
app.quit()
}
})
} else {
process.on('SIGTERM', () => {
app.quit()
})
}
if (process.platform === 'win32') {
process.on('message', (data) => {
if (data === 'graceful-exit') {
app.quit()
}
})
} else {
process.on('SIGTERM', () => {
app.quit()
})
}
}

View File

@@ -1,53 +1,36 @@
<template>
<div class="boxed-green month-presentation" id="new-month">
<div class="toolbar">
<button v-show='!addingMonth' @click='toggleAdding'>
Ajouter {{ formatedDate }}
</button>
</div>
<div class="boxed-green month-presentation" id="new-month" v-show='addingMonth'>
<div class="date">
<input type="month" v-model="monthDate">
<div class="month">
{{ theMonth }}
</div>
<div class="year">
{{ theYear }}
</div>
<div class="actions">
<button class="validate" @click="save"> Valider </button>
<button class="cancel" @click="cancel"> Annuler </button>
</div>
<div class="actions">
<button class="validate" @click="save"> Valider </button>
<button class="cancel" @click="cancel"> Annuler </button>
</div>
</div>
<div class="datas">
<ul>
<li>
<label for="ca-theo">CA théorique</label>
<input type="number" v-model.number="monthCopy.ca_theo" id="ca-theo" class="value" >
</li>
<li>
<label for="ca-retro">CA rétrocession</label>
<input type="number" v-model.number="monthCopy.ca_retro" id="ca-retro" class="value" >
</li>
<li>
<label for="ca-react">CA réactualisé</label>
<input type="number" v-model.number="monthCopy.ca_react" id="ca-react" class="value" >
</li>
<li>
<label for="nbr-seances">Nombre de séances effectuées</label>
<input type="number" v-model.number="monthCopy.nbr_seances" id="nbr-seances" class="value" >
</li>
<li>
<label for="retro">Montant de la rétrocession</label>
<input type="number" v-model.number="monthCopy.retro" id="retro" class="value" >
</li>
<li>
<label for="remuneration">Rémunération effectuée</label>
<input type="number" v-model.number="monthCopy.remuneration" id="remuneration" class="value">
</li>
</ul>
<li v-for="cara in description" :key='cara.name'>
<label :for='cara.name'>{{ cara.label }}</label>
<input type="number" v-model.number="monthCopy[cara.name]" id="cara.name" class="value">
</li>
</div>
</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
const today = new Date();
function formatDate(date) {
var y = ''+date.getFullYear()
var m = ''+(date.getMonth()+1)
if (m.length < 2) { m = '0'+m}
return [y, m].join('-')
}
import { parseISO, addMonths, format } from 'date-fns'
import frLocal from 'date-fns/locale/fr'
export default {
name: 'NewMonth',
@@ -57,17 +40,41 @@ export default {
},
data () {
return {
monthDate: formatDate(today),
monthDate: new Date(),
monthCopy: Object,
addingMonth: false,
}
},
mounted () {
this.monthCopy = this.theEmptyMonth
},
watch: {
lastMonthDate: function () {
if (this.lastMonthDate) {
this.monthDate = addMonths(parseISO(this.lastMonthDate, "yyyy-MM", new Date()), 1)
} else {
this.monthDate = new Date()
}
},
},
computed: {
...mapGetters('travail', {
'theEmptyMonth': 'TheEmptyMonth',
'lastMonthDate': 'lastMonthDate',
}),
...mapGetters('config', {
'description': 'descEditable',
}),
formatedDate: function () {
return format(this.monthDate, "MMMM YYY", {locale: frLocal} )
},
theMonth: function () {
return format(this.monthDate, "MMM", {locale: frLocal})
},
theYear: function () {
return format(this.monthDate, "YYY", {locale: frLocal})
},
},
methods: {
...mapActions('travail', {
@@ -76,14 +83,19 @@ export default {
...mapActions('config', {
'writeData': 'writeData',
}),
toggleAdding: function () {
this.addingMonth = !this.addingMonth
},
save: function () {
console.log("save")
console.log(this.monthCopy)
this.createMonth({date: this.monthDate, month: this.monthCopy})
this.createMonth({date: format(this.monthDate, "yyyy-MM"), month: this.monthCopy})
this.toggleAdding()
this.writeData()
},
cancel: function () {
this.monthCopy = this.theEmptyMonth
this.toggleAdding()
this.monthCopy = this.theEmptyMonth
},
},
}
@@ -117,12 +129,17 @@ export default {
}
li {
margin: 3px;
width: 30%;
display: flex;
flex-direction: column-reverse;
}
label{
text-align: right;
font-size: 0.8em;
}
.value {
font-size: 1.5em;
font-weight: bold;
}
.toolbar {
text-align: center;
}
</style>

View File

@@ -1,58 +1,37 @@
<template>
<div class="month-presentation">
<div class="date">
<div class="month">
{{ theMonth }}
</div>
<div class="year">
{{ theYear }}
</div>
<div>
<button class="edit" @click="toggleEdit" v-show="!editing"> Mettre à jour </button>
<button class="validate" @click="save" v-show="editing"> Valider </button>
<button class="cancel" @click="cancel" v-show="editing"> Annuler </button>
</div>
</div>
<div id="display">
<ul>
<li>
<label for="ca-theo">CA "Séances effectuées"</label>
<span class="value" v-show="!editing">{{ TheMonth.ca_theo ?? ""}}</span>
<input type="number" v-model.number="monthCopy.ca_theo" id="ca-theo" class="value" v-show="editing">
</li>
<li>
<label for="ca-retro">CA "Séances facturées"</label>
<span class="value" v-show="!editing">{{ TheMonth.ca_retro ?? ""}}</span>
<input type="number" v-model.number="monthCopy.ca_retro" id="ca-retro" class="value" v-show="editing">
</li>
<li>
<label for="ca-react">CA "Séances facturées" réactualisé</label>
<span class="value" v-show="!editing">{{ TheMonth.ca_react ?? ""}}</span>
<input type="number" v-model.number="monthCopy.ca_react" id="ca-react" class="value" v-show="editing">
</li>
<li>
<label for="nbr-seances">Nombre de séances effectuées</label>
<span class="value" v-show="!editing">{{ TheMonth.nbr_seances ?? ""}}</span>
<input type="number" v-model.number="monthCopy.nbr_seances" id="nbr-seances" class="value" v-show="editing">
</li>
<li>
<label for="retro">Montant de la rétrocession</label>
<span class="value" v-show="!editing">{{ TheMonth.retro ?? ""}}</span>
<input type="number" v-model.number="monthCopy.retro" id="retro" class="value" v-show="editing">
</li>
<li>
<label for="remuneration">Rémunération </label>
<span class="value" v-show="!editing">{{ TheMonth.remuneration ?? ""}}</span>
<input type="number" v-model.number="monthCopy.remuneration" id="remuneration" class="value" v-show="editing">
</li>
</ul>
</div>
<div id="date">
<div class="month">
{{ theMonth }}
</div>
<div class="year">
{{ theYear }}
</div>
<div>
<button class="edit" @click="toggleEdit" v-show="!editing"> Mettre à jour </button>
<button class="validate" @click="save" v-show="editing"> Valider </button>
<button class="cancel" @click="cancel" v-show="editing"> Annuler </button>
</div>
</div>
<div id="display" v-show="!editing">
<div class="hightlight" v-for="cara in descHightlights" :key='cara.name'>
<label :for='cara.name'>{{ cara.label }}</label>
<span class="value" >{{ cara.output(TheMonth) ?? "∅"}} {{cara.unit}}</span>
</div>
</div>
<div id="edit" v-show="editing">
<div v-for="cara in descEditable" :key='cara.name' class="cara">
<label :for='cara.name'>{{ cara.label }}</label>
<input type="number" v-model.number="monthCopy[cara.name]" id="cara.name">
</div>
</div>
</div>
</template>
<script>
import { mapActions } from 'vuex'
import { mapActions, mapGetters } from 'vuex'
import { parseISO, format } from 'date-fns'
import frLocal from 'date-fns/locale/fr'
export default {
name: 'MonthPresentation',
props: {
@@ -71,11 +50,15 @@ export default {
this.monthCopy = {...this.TheMonth}
},
computed: {
...mapGetters('config', {
'descHightlights': 'monthHightlightDesc',
'descEditable': 'descEditable',
}),
rawDate: function () {
return parseISO(this.TheDate, "yyyy-MM", new Date())
},
theMonth: function () {
return format(this.rawDate, "MMM", )
return format(this.rawDate, "MMM", {locale: frLocal})
},
theYear: function () {
return format(this.rawDate, "YYY", )
@@ -114,7 +97,7 @@ export default {
margin: 20px;
}
.date {
#date {
font-size: 1em;
font-weight: bold;
border-right: 1px solid black;
@@ -123,20 +106,27 @@ export default {
font-size: 2em;
}
ul {
#display {
list-style-type: none;
padding: 0;
display: flex;
flex-flow: row wrap;
align-items: center;
justify-content: space-around;
}
li {
#display > * {
margin: 3px;
width: 30%;
width: 80px;
display: flex;
flex-direction: column-reverse;
}
label{
text-align: right;
font-size: 0.8em;
}
.value {
font-size: 1.5em;
text-align: right;
font-weight: bold;
}
@@ -148,6 +138,9 @@ export default {
padding: 4px;
font-size: 0.8em;
width: auto;
}
.cara {
display: flex;
flex-direction: column-reverse;
}
</style>

View File

@@ -1,56 +1,30 @@
<template>
<div class="hightlights">
<div class="hightlight boxed">
<ul>
<li>{{ ca }} </li>
<li>CA</li>
</ul>
</div>
<div class="hightlight boxed">
<ul>
<li>{{ remuneration }} </li>
<li>Rémunération</li>
</ul>
</div>
<div class="hightlight boxed">
<ul>
<li>{{ caPersoUntouch }} </li>
<li>13e mois</li>
</ul>
</div>
<hightlight-sum :months="months" attribute="ca"/>
<hightlight-sum :months="months" attribute="remuneration"/>
<hightlight-sum :months="months" attribute="caPersoUntouch"/>
</div>
<revenus-chart/>
</template>
<script>
import { mapGetters } from 'vuex'
import { caTotal,
caMean,
remuneration,
caPersoUntouch
} from '../lib/months'
import RevenusChart from '../components/graphs/RevenusChart.vue'
import hightlightSum from './hightlightSum.vue'
export default {
name: 'caOnPeriod',
components: {
RevenusChart: RevenusChart,
hightlightSum: hightlightSum,
},
data () {
return {}
},
computed: {
...mapGetters('config', {
caProPercentage: 'caProPercentage',
}),
...mapGetters('travail', {
months: "months",
}),
ca: function () {return caTotal(this.months).toLocaleString()},
caMean: function () {return caMean(this.months).toLocaleString()},
remuneration: function () {return remuneration(this.months).toLocaleString()},
caPersoUntouch: function () {return caPersoUntouch(this.months, this.caProPercentage).toLocaleString()},
},
mounted () {
},

View File

@@ -1,55 +1,30 @@
<template>
<div class="hightlights">
<div class="hightlight boxed">
<ul>
<li>{{ caTheo }} </li>
<li>CA "séances effectuées"</li>
</ul>
</div>
<div class="hightlight boxed">
<ul>
<li>{{ retrocession }} </li>
<li>Rétrocession</li>
</ul>
</div>
<div class="hightlight boxed">
<ul>
<li>{{ notInvoiced }} </li>
<li>Non facturé</li>
</ul>
</div>
<hightlight-sum :months="months" attribute="caTheo"/>
<hightlight-sum :months="months" attribute="retro"/>
<hightlight-sum :months="months" attribute="notInvoiced"/>
</div>
<repartition-chart/>
</template>
<script>
import { mapGetters } from 'vuex'
import {
caTheo,
notInvoiced,
retrocession,
} from '../lib/months'
import RepartitionChart from './graphs/RepartitionChart.vue'
import hightlightSum from './hightlightSum.vue'
export default {
name: 'caRepartition',
components: {
RepartitionChart: RepartitionChart,
hightlightSum: hightlightSum,
},
data () {
return {}
},
computed: {
...mapGetters('config', {
caProPercentage: 'caProPercentage',
}),
...mapGetters('travail', {
months: "months",
}),
caTheo: function () {return caTheo(this.months).toLocaleString()},
notInvoiced: function () {return notInvoiced(this.months).toLocaleString()},
retrocession: function () {return retrocession(this.months).toLocaleString()},
},
mounted () {
},

View File

@@ -10,9 +10,8 @@ import { mapGetters } from 'vuex'
import {
notInvoiced,
caPro,
remuneration,
retrocession,
caPersoUntouch,
sum,
} from '../../lib/months'
export default {
@@ -43,11 +42,11 @@ export default {
{
label: "Difference CA perso et remuneration",
data: [
caPro(this.months, this.caProPercentage),
notInvoiced(this.months),
retrocession(this.months),
remuneration(this.months),
caPersoUntouch(this.months, this.caProPercentage),
sum(Object.values(this.months).map(a => caPro(a))),
sum(Object.values(this.months).map(a => notInvoiced(a))),
sum(Object.values(this.months).map(a => a.retro)),
sum(Object.values(this.months).map(a => a.remuneration)),
sum(Object.values(this.months).map(a => caPersoUntouch(a))),
],
},
],

View File

@@ -7,7 +7,7 @@
<script>
import Chart from 'chart.js'
import { mapGetters } from 'vuex'
import { monthCA, caPersoUntouch, caPerso, remuneration } from '../../lib/months'
import { ca, caPersoUntouch, sum } from '../../lib/months'
export default {
name: 'RevenusChart',
@@ -37,7 +37,7 @@ export default {
{
type: "bar",
label: "Difference CA perso et remuneration",
data: Object.values(this.months).map(a => caPerso({bar: a}, this.caProPercentage) - remuneration({bar:a})),
data: Object.values(this.months).map(a => caPersoUntouch(a)),
backgroundColor: "red",
borderColor: "light-red",
borderWidth: 3
@@ -45,7 +45,7 @@ export default {
{
type: "bar",
label: "CA",
data: Object.values(this.months).map(a => monthCA(a)),
data: Object.values(this.months).map(a => ca(a)),
backgroundColor: "rgba(54,73,93,.5)",
borderColor: "#36495d",
borderWidth: 3
@@ -79,7 +79,9 @@ export default {
},
untouchEvo: function () {
const cumulativeArray = (arr => value => {arr.push(value); return [...arr];})([]);
return Object.values(this.months).map(cumulativeArray).map(a => caPersoUntouch(a, this.caProPercentage))
return Object.values(this.months)
.map(cumulativeArray)
.map(a => sum(a.map(m => caPersoUntouch(m))))
},
},
methods: {

View File

@@ -0,0 +1,52 @@
<template>
<div class="hightlight boxed">
<ul>
<li>{{ sumValue }} {{ unit }}</li>
<li>{{ label }} </li>
</ul>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import {
sum,
} from '../lib/months'
export default {
name: 'hightlightSum',
components: {
},
props: {
months: Object,
attribute: String,
},
data () {
return {}
},
computed: {
...mapGetters('config', {
descOf: "descOf",
}),
theDesc: function () {
return this.descOf(this.attribute)
},
sumValue: function () {
return sum(Object.values(this.months).map(m => this.theDesc.output(m))).toLocaleString()
},
label: function () {
return this.theDesc.label
},
unit: function () {
return this.theDesc.unit
},
},
mounted () {
},
methods: {
},
}
</script>
<style scoped>
</style>

View File

@@ -1,21 +1,87 @@
<template>
<h1>Sous Margot</h1>
<!--
<nav>
<router-link to="/"> Home </router-link>
<router-link to="/config"> Config </router-link>
<h1><router-link to="/"> Sous Margot </router-link></h1>
<h2>
<ul id="years">
<li v-for="year in years" :key="year">
<span @click="selectYear(year)" :class="{selected_year:year==selected_year}">{{ year }}</span>
</li>
</ul>
</h2>
<div class="nav-link">
<router-link to="/edit">
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-edit" class="svg-inline--fa fa-user-edit fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" width='25px' height="25px">
<path fill="currentColor" d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h274.9c-2.4-6.8-3.4-14-2.6-21.3l6.8-60.9 1.2-11.1 7.9-7.9 77.3-77.3c-24.5-27.7-60-45.5-99.9-45.5zm45.3 145.3l-6.8 61c-1.1 10.2 7.5 18.8 17.6 17.6l60.9-6.8 137.9-137.9-71.7-71.7-137.9 137.8zM633 268.9L595.1 231c-9.3-9.3-24.5-9.3-33.8 0l-37.8 37.8-4.1 4.1 71.8 71.7 41.8-41.8c9.3-9.4 9.3-24.5 0-33.9z"></path>
</svg>
</router-link>
<router-link to="/config">
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="user-cog" class="svg-inline--fa fa-user-cog fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" width='25px' height="25px">
<path fill="black" d="M610.5 373.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 400.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm201.2 226.5c-2.3-1.2-4.6-2.6-6.8-3.9l-7.9 4.6c-6 3.4-12.8 5.3-19.6 5.3-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-5.5-17.7 1.9-36.4 17.9-45.7l7.9-4.6c-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-16-9.2-23.4-28-17.9-45.7.9-2.9 2.2-5.8 3.2-8.7-3.8-.3-7.5-1.2-11.4-1.2h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c10.1 0 19.5-3.2 27.2-8.5-1.2-3.8-2-7.7-2-11.8v-9.2z"></path>
</svg>
</router-link>
</div>
</nav>
-->
</template>
<script>
import { mapGetters } from 'vuex'
import { mapActions } from 'vuex'
import { getYear } from 'date-fns'
const today = new Date()
export default {
name: 'Nav',
props: {
data () {
return {
current_year: getYear(today),
selected_year: getYear(today),
}
},
computed: {
...mapGetters({
available_years: "travail/years",
}),
years: function () {
return [...this.available_years, this.current_year].filter((v, i, a) => a.indexOf(v) === i)
}
},
methods: {
...mapActions('travail', {
'setRange': 'setRange',
}),
selectYear: function (year) {
this.selected_year=year
this.setRange({
start: `${this.current_year}-01`,
end: `${this.current_year}-12`
})
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
#years {
list-style-type: none;
padding: 0;
display: flex;
flex-flow: row wrap;
align-items: center;
justify-content: space-around;
}
#years > * {
margin: 3px;
width: 80px;
display: flex;
flex-direction: column-reverse;
}
.selected_year {
font-size: 1.5em;
font-weight: bold;
}
</style>

View File

@@ -1,83 +1,44 @@
export function monthCA(month) {
// Function on a month
export function ca(month) {
// Extract the CA of the month
if (month.ca_react) {
return month.ca_react
if (month.caReact) {
return month.caReact
} else {
return month.ca_retro
return month.caRetro
}
}
export function count (months) {
// Count how many months there are
return Object.keys(months).length
export function notInvoiced (month) {
// Compute how much has not been invoiced
return month.caTheo - ca(month)
}
export function caTotal (months) {
// Total CA (ca_react if sets, ca_retro otherwise)
return Object.values(months).map(a => monthCA(a)).reduce(
(acc, v) => acc + v
,0
)
export function caPro (month) {
// Compute the part of the CA to go pro usage
return ca(month) * month.proPercentage / 100
}
export function caMean (months) {
// Mean of CA
return Math.floor(caTotal(months) / count(months))
export function caPerso (month) {
// Compute the part of the CA to go personnal usage
return ca(month) * (1 - month.proPercentage / 100)
}
export function caTheo (months) {
// Total theorical CA
return Object.values(months).map(a => a.ca_theo).reduce(
(acc, v) => acc + v,
0
)
export function caPersoUntouch (month) {
// Compute the part of the CA to go personnal usage
return caPerso(month) - month.remuneration
}
export function notInvoiced (months) {
// Total of not invoiced sessions
return caTheo(months) - caTotal(months)
// Function on an array of month
export function sum (array) {
// sum the array
return array.reduce((acc, v)=> acc + v, 0)
}
export function remuneration (months) {
// Total remuneration
return Object.values(months).map(a => a.remuneration).reduce(
(acc, v) => acc + v,
0
)
export function mean(array) {
console.log(array)
return Math.floor(array.reduce((acc, v)=> acc + v, 0) / array.length)
}
export function remunerationMean (months) {
// Mean of remuneration
return Math.floor(remuneration(months) / count(months))
}
export function retrocession (months) {
// Total retrocession
return Object.values(months)
.map(a => a.retro)
.reduce(
(acc, v) => acc + v,
0
)
}
export function retrocessionMean (months) {
// Mean of retrocession
return Math.floor(retrocession(months) / count(months))
}
export function caPro (months, keepPercent) {
// Part of the CA to keep for professional use
return caTotal(months) * keepPercent
}
export function caPerso (months, keepPercent) {
// Part of the CA to keep for personal use
return caTotal(months) - caPro(months, keepPercent)
}
export function caPersoUntouch (months, keepPercent) {
// Part of the personnal use CA that haven't been use
return caPerso(months, keepPercent) - remuneration(months)
}

View File

@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'
import Home from "@/views/home.vue"
import Config from "@/views/config.vue"
import Edit from "@/views/edit.vue"
const routes = [
{
@@ -9,6 +10,11 @@ const routes = [
name: 'home',
component: Home
},
{
path: '/edit',
name: 'edit',
component: Edit
},
{
path: '/config',
name: 'config',

View File

@@ -1,6 +1,13 @@
import path from 'path'
import Papa from 'papaparse'
import { writeFile } from 'fs'
import {
ca,
notInvoiced,
caPro,
caPerso,
caPersoUntouch,
} from '../../lib/months.js'
const config = {
namespaced: true,
@@ -10,11 +17,136 @@ const config = {
userDir: './userDir/',
dataFile: 'datas.csv',
caProPercentage: 0.5,
descAll : [
{
name: 'caTheo',
color: '',
label: 'CA "scéances effectuées"',
type: 'editable',
unit: '€',
hightlight: false,
output: month => month.caTheo,
},
{
name: 'caRetro',
color: '',
label: 'CA "Séances facturées"',
type: 'editable',
unit: '€',
hightlight: false,
output: month => month.caRetro,
},
{
name: 'caReact',
color: '',
label: 'CA "Séances facturées" réactualisé',
type: 'editable',
unit: '€',
hightlight: false,
output: month => month.caReact,
},
{
name: 'sessionQty',
color: '',
label: 'Nombre de séances effectuées',
unit: '',
hightlight: false,
output: month => month.sessionQty,
},
{
name: 'retro',
color: '',
label: 'Montant de la rétrocession',
type: 'editable',
unit: '€',
hightlight: false,
output: month => month.retro,
},
{
name: 'remuneration',
color: '',
label: 'Rémuneration',
type: 'editable',
unit: '€',
hightlight: true,
output: month => month.remuneration,
},
{
name: 'proPercentage',
color: '',
label: 'Pourcentage du CA pour la partie pro',
type: 'editable',
unit: '%',
hightlight: false,
output: month => month.proPercentage,
},
{
name: 'ca',
color: '',
label: 'CA',
type: 'compute',
unit: '€',
hightlight: true,
output: month => ca(month),
},
{
name: 'notInvoiced',
color: '',
label: 'Non facturé',
type: 'compute',
unit: '€',
hightlight: true,
output: month => notInvoiced(month),
},
{
name: 'caPro',
color: '',
label: 'CA pour le partie pro',
type: 'compute',
unit: '€',
hightlight: false,
output: month => caPro(month),
},
{
name: 'caPerso',
color: '',
label: 'CA destiné à la rémuneration',
type: 'compute',
unit: '€',
hightlight: false,
output: month => caPerso(month),
},
{
name: 'caPersoUntouch',
color: '',
label: 'Banque 13e mois',
type: 'compute',
unit: '€',
hightlight: false,
output: month => caPersoUntouch(month),
},
],
}
},
getters: {
userDir (state) { return state.userDir },
dataFilePath (state) { return path.join(state.userDir, state.dataFile) },
descAll (state) {
// All description of attributes for months
return state.descAll
},
descEditable (state) {
// All description of attributes for months that are editable
return state.descAll.filter(d => d.type == 'editable')
},
descComputed (state) {
// All description of attributes for months that are computed
return state.descAll.filter(d => d.type != 'editable')
},
descOf: (state) => (desc) => {
return state.descAll.filter(d => d.name == desc)[0]
},
monthHightlightDesc (state) { return state.descAll.filter(a => a.hightlight) },
caProPercentage (state) { return state.caProPercentage },
},
mutations: {

View File

@@ -1,72 +1,27 @@
import { readFile } from 'fs'
import Papa from 'papaparse'
import { getYear } from 'date-fns'
const today = new Date()
const travail = {
namespaced: true,
state() {
return {
empty: {
ca_theo: null, // ca théorique basé sur les séances effectuées
nbr_seances: null, // Nombre de séances effectuées sur le mois
ca_retro: null, // ca au moment de la rétrocession
ca_react: null, // ca réactualisé
caTheo: null, // ca théorique basé sur les séances effectuées
sessionQty: null, // Nombre de séances effectuées sur le mois
caRetro: null, // ca au moment de la rétrocession
caReact: null, // ca réactualisé
retro: 0, // montant de la rétrocession
remuneration: 0, // rémunération décidée
proPercentage: 50, // Pourcentage du CA pour la partie pro
},
months: {
// "2021-01": {
// ca_theo: null, // ca théorique basé sur les séances effectuées
// nbr_seances: null, // Nombre de séances effectuées sur le mois
// ca_retro: 6747, // ca au moment de la rétrocession
// ca_react: null, // ca réactualisé
// retro: 893, // montant de la rétrocession
// remuneration: 2000, // rémunération décidée
// },
// "2021-02": {
// ca_theo: null, // ca théorique basé sur les séances effectuées
// nbr_seances: null, // Nombre de séances effectuées sur le mois
// ca_retro: 5183, // ca au moment de la rétrocession
// ca_react: null, // ca réactualisé
// retro: 665, // montant de la rétrocession
// remuneration: 1500, // rémunération décidée
// },
// "2021-03": {
// ca_theo: null, // ca théorique basé sur les séances effectuées
// nbr_seances: null, // Nombre de séances effectuées sur le mois
// ca_retro: 7088, // ca au moment de la rétrocession
// ca_react: null, // ca réactualisé
// retro: 855, // montant de la rétrocession
// remuneration: 2000, // rémunération décidée
// },
// "2021-04": {
// ca_theo: null, // ca théorique basé sur les séances effectuées
// nbr_seances: null, // Nombre de séances effectuées sur le mois
// ca_retro: 4194, // ca au moment de la rétrocession
// ca_react: 5630, // ca réactualisé
// retro: 627, // montant de la rétrocession
// remuneration: 2000, // rémunération décidée
// },
// "2021-05": {
// ca_theo: null, // ca théorique basé sur les séances effectuées
// nbr_seances: null, // Nombre de séances effectuées sur le mois
// ca_retro: 5564, // ca au moment de la rétrocession
// ca_react: 6335, // ca réactualisé
// retro: 699, // montant de la rétrocession
// remuneration: 2800, // rémunération décidée
// },
// "2021-06": {
// ca_theo: null, // ca théorique basé sur les séances effectuées
// nbr_seances: null, // Nombre de séances effectuées sur le mois
// ca_retro: 5442, // ca au moment de la rétrocession
// ca_react: 6335, // ca réactualisé
// retro: 638, // montant de la rétrocession
// remuneration: 2800, // rémunération décidée
// },
},
range: {
start: "2021-01",
end: "2021-08",
start: `${getYear(today)}-01`,
end: `${getYear(today)}-12`,
},
}
},
@@ -81,6 +36,10 @@ const travail = {
// Get all the months
return Object.keys(state.months).sort().reverse()
},
lastMonthDate(state) {
// Return the date of the last registered month
return Object.keys(state.months).sort().reverse()[0]
},
months: (state, getters) => {
// Get in range months
const a = Object.keys(state.months)
@@ -96,12 +55,17 @@ const travail = {
return state.months
},
getMonth: (state) => (date) => {
// Get a month by its date
return state.months[date]
},
count: (state, getters) => {
// Amount of mounts
return Object.keys(getters.months).length
},
years: (state) => {
// list of years with data
return Object.keys(state.months).map(k => k.slice(0,4)).filter((v, i, a) => a.indexOf(v) === i)
}
},
mutations: {
cleanMonths (state) {

View File

@@ -1,44 +1,68 @@
body {
background-color: whitesmoke;
background-color: whitesmoke;
margin: 0;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding: 0 20px;
color: black;
}
nav h1 {
font-size: 2em;
border-bottom: 1px solid #000;
}
nav a {
color: black;
text-decoration: none;
}
.content {
margin: 10px;
}
button {
color: white;
padding: 4px;
box-shadow: 1px 1px 2px gray;
text-align: center;
display: inline-block;
border-radius: 5px;
background-color: white;
margin-top: 5px;
font-size: 0.8em;
width: auto;
transition: all 0.2s ease-out;
color: black;
padding: 4px;
box-shadow: 1px 1px 2px gray;
text-align: center;
display: inline-block;
border-radius: 5px;
background-color: white;
margin-top: 5px;
font-size: 0.8em;
width: auto;
transition: all 0.2s ease-out;
}
button:hover {
transition: all 0.2s ease-out;
background-color: black;
color: white;
transition: all 0.2s ease-out;
}
.validate {
border: 2px solid green;
color: green;
border: 2px solid green;
color: green;
}
.validate:hover {
background-color: green;
color: white;
background-color: green;
color: white;
}
.cancel {
border: 2px solid red;
color: red;
border: 2px solid red;
color: red;
}
.cancel:hover {
background-color: red;
color: white;
}
.edit {
border: 2px solid orange;
color: orange;
border: 2px solid orange;
color: orange;
}
.edit:hover {
background-color: orange;
@@ -46,41 +70,41 @@ button:hover {
}
.boxed {
box-shadow: 2px 2px 5px gray;
border-left: 1rem solid black;
border-radius: 10px;
background-color: white;
box-shadow: 2px 2px 5px gray;
border-left: 1rem solid black;
border-radius: 10px;
background-color: white;
}
.boxed-green {
box-shadow: 2px 2px 5px gray;
border-left: 1rem solid green;
border-radius: 10px;
background-color: white;
box-shadow: 2px 2px 5px gray;
border-left: 1rem solid green;
border-radius: 10px;
background-color: white;
}
.hightlights {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 20px;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 20px;
}
.hightlight > ul{
list-style-type: none;
display: flex;
flex-flow: column wrap;
padding-inline-start: 0;
margin-block-start: 0;
margin-block-end: 0;
.hightlight > ul {
list-style-type: none;
display: flex;
flex-flow: column wrap;
padding-inline-start: 0;
margin-block-start: 0;
margin-block-end: 0;
}
.hightlight > ul > li {
margin: 5px;
flex-direction: column-reverse;
margin: 5px;
flex-direction: column-reverse;
}
.hightlight > ul :first-child{
font-size: 2rem;
font-weight: bold;
text-align: center;
.hightlight > ul :first-child {
font-size: 2rem;
font-weight: bold;
text-align: center;
}
.hightlight > ul :last-child{
text-align: end;
.hightlight > ul :last-child {
text-align: end;
}

View File

@@ -1,3 +1,40 @@
<template>
<h1>Config</h1>
<h2> Données </h2>
<h3>Données éditables</h3>
<ul>
<li v-for="param in descEditable" :key='param.name'>
{{ param }}
</li>
</ul>
<h3>Données calculées</h3>
<ul>
<li v-for="param in descComputed" :key='param.name'>
{{ param }}
</li>
</ul>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'config',
data () {
return {}
},
computed: {
...mapGetters('config', {
'descEditable': 'descEditable',
'descComputed': 'descComputed',
}),
},
methods: {
},
mounted () {
},
}
</script>

22
src/views/edit.vue Normal file
View File

@@ -0,0 +1,22 @@
<template>
<h1>Edition</h1>
</template>
<script>
export default {
name: 'edit',
data () {
return {}
},
computed: {
},
methods: {
},
mounted () {
},
}
</script>

View File

@@ -1,14 +1,14 @@
<template>
<div id="content">
<div id="content">
<section id="months">
<create-month/>
<months-list/>
<create-month />
<months-list />
</section>
<section id="stats">
<ca-on-period/>
<ca-repartition/>
<ca-on-period />
<ca-repartition />
</section>
</div>
</div>
</template>
<script>
@@ -43,16 +43,15 @@ export default {
<style scoped>
#content {
display: grid;
grid-template-columns: minmax(580px, 2fr) minmax(450px, 1fr);
grid-template-areas:
"stats months";
gap: 1em;
display: grid;
grid-template-columns: minmax(580px, 2fr) minmax(450px, 1fr);
grid-template-areas: "stats months";
gap: 1em;
}
#stats {
grid-area: stats;
grid-area: stats;
}
#months {
grid-area: months;
grid-area: months;
}
</style>

View File

@@ -1,8 +1,8 @@
ca_theo,nbr_seances,ca_retro,ca_react,retro,remuneration,date
7000,,6747,,893,2000,2021-01
5200,,5183,,665,1500,2021-02
7100,,7088,,855,2000,2021-03
5700,,4194,5630,627,2000,2021-04
6500,,5564,6335,699,2800,2021-05
6725,235,5442,6376,638,2800,2021-06
2176,81,1274,,172,2000,2021-07
caTheo,sessionQty,caRetro,caReact,retro,remuneration,date,proPercentage
7000,,6747,,893,2000,2021-01,50
5200,,5183,,665,1500,2021-02,50
7100,,7088,,855,2000,2021-03,50
5700,,4194,5630,627,2000,2021-04,50
6500,,5564,6335,699,2800,2021-05,50
6725,235,5442,6376,638,2800,2021-06,50
2176,81,1274,,172,2000,2021-07,50
1 ca_theo caTheo nbr_seances sessionQty ca_retro caRetro ca_react caReact retro remuneration date proPercentage
2 7000 7000 6747 6747 893 2000 2021-01 50
3 5200 5200 5183 5183 665 1500 2021-02 50
4 7100 7100 7088 7088 855 2000 2021-03 50
5 5700 5700 4194 4194 5630 5630 627 2000 2021-04 50
6 6500 6500 5564 5564 6335 6335 699 2800 2021-05 50
7 6725 6725 235 235 5442 5442 6376 6376 638 2800 2021-06 50
8 2176 2176 81 81 1274 1274 172 2000 2021-07 50