-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
132 lines (123 loc) · 3.15 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
const { createApp } = Vue;
createApp({
data() {
return {
showResults: false,
showEchography: false,
showAppointments: false,
showMore: false,
showVacancies: false,
showCalendar: false,
showButtons: false,
results: null,
lastPeriodDate: '',
conceptionDate: '',
durationInDays: '',
durationInWeeks: '',
durationInMonths: '',
durationInMonthsFormated: '',
dueDate: ''
}
},
computed: {
getDueDate() {
return new Date(
this.lastPeriodDate
? new Date(this.lastPeriodDate).getTime() + 288 * 24 * 60 * 60 * 1000
: new Date(this.conceptionDate).getTime() + 266 * 24 * 60 * 60 * 1000
);
},
dueDateFormat() {
return this.dueDate.toLocaleDateString();
}
},
methods: {
proceed() {
if (this.lastPeriodDate === '' && this.conceptionDate === '') {
alert('Veuillez renseigner soit la date des dernières règles soit celle de la conception');
} else {
const today = new Date();
const startDate = this.lastPeriodDate ? new Date(this.lastPeriodDate) : new Date(this.conceptionDate);
const durationInMs = today - startDate;
this.durationInDays = Math.floor(durationInMs / 1000 / 60 / 60 / 24);
this.durationInWeeks = Math.floor(this.durationInDays / 7);
this.durationInMonths = Math.floor(this.durationInDays / 30);
this.durationInMonthsFormated = this.durationInMonths + 1;
this.dueDate = this.getDueDate;
this.showResults = true;
this.showButtons = true;
this.showEchography = false;
this.showAppointments = false;
this.showMore = false;
this.showVacancies = false;
this.showCalendar = false;
}
},
convertir(jours) {
const joursParMois = 30.44;
const joursParSemaine = 7;
const mois = Math.floor(jours / joursParMois);
const resteMois = jours % joursParMois;
const semaines = Math.floor(resteMois / joursParSemaine);
const resteSemaines = resteMois % joursParSemaine;
const joursRestants = Math.floor(resteSemaines);
return `${mois} mois, ${semaines} semaine(s) et ${joursRestants} jour(s)`;
},
format(num) {
let res = new Intl.NumberFormat('fr-FR', { maximumSignificantDigits: 2 }).format(num);
return res;
},
displayEchography() {
this.showResults = false;
this.showButtons = true;
this.showEchography = true;
this.showAppointments = false;
this.showMore = false;
this.showVacancies = false;
this.showCalendar = false;
},
displayVacancies() {
this.showResults = false;
this.showButtons = true;
this.showEchography = false;
this.showAppointments = false;
this.showMore = false;
this.showVacancies = true;
this.showCalendar = false;
},
displayAppointments(){
this.showResults = false;
this.showButtons = true;
this.showEchography = false;
this.showAppointments= true
this.showMore= false,
this.showVacancies= false,
this.showCalendar= false
},
displayMore(){
this.showResults = false;
this.showButtons = true;
this.showEchography = false;
this.showAppointments= false;
this.showMore= true;
this.showVacancies= false;
this.showCalendar= false
},
displayCalendar(){
this.showResults = false;
this.showButtons = true;
this.showEchography = false;
this.showAppointments= false;
this.showMore= false
this.showVacancies= false;
this.showCalendar= true
},
format(num){
let res = new Intl.NumberFormat('fr-FR', { maximumSignificantDigits: 3 }).format(num);
return res;
},
getImgUrl(pic) {
return "public/img/" + pic;
}
},
}).mount('#app')