-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
107 lines (95 loc) · 4.06 KB
/
preload.js
File metadata and controls
107 lines (95 loc) · 4.06 KB
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
const { contextBridge, ipcRenderer } = require("electron");
// ===================================================
// EXPOSITION D'INFORMATIONS DE BASE
// ===================================================
contextBridge.exposeInMainWorld("versions", {
node: () => process.versions.node,
chrome: () => process.versions.chrome,
electron: () => process.versions.electron,
ping: () => ipcRenderer.invoke("ping"),
});
// ===================================================
// API PRINCIPALE POUR L'APPLICATION DE TONTINE
// ===================================================
contextBridge.exposeInMainWorld("api", {
// ================= MANAGER =================
getManager: () => ipcRenderer.invoke("manager:get"),
createManager: (nom, email, mot_de_passe) =>
ipcRenderer.invoke("manager:create", nom, email, mot_de_passe),
updateManagerInfo: (nom, email, mot_de_passe) =>
ipcRenderer.invoke("manager:update", nom, mot_de_passe),
// ================= MEMBRES =================
ajouterMembre: (nom, prenom, contact, date_entree) =>
ipcRenderer.invoke("membre:add", nom, prenom, contact, date_entree),
modifierMembre: (id, nom, prenom, contact, actif) =>
ipcRenderer.invoke("membre:update", id, nom, prenom, contact, actif),
supprimerMembre: (id) => ipcRenderer.invoke("membre:delete", id),
getMembres: () => ipcRenderer.invoke("membre:getAll"),
getMembre: (id) => ipcRenderer.invoke("membre:get", id),
getMembresNumber: () => ipcRenderer.invoke("membre:getNumber"),
// ================= TONTINES =================
creerTontine: (nom, montant, date_debut, date_fin, jour) =>
ipcRenderer.invoke("tontine:add", nom, montant, date_debut, date_fin, jour),
modifierTontine: (id, nom, montant, date_debut, date_fin, jour, active) =>
ipcRenderer.invoke(
"tontine:update",
id,
nom,
montant,
date_debut,
date_fin,
jour,
active
),
supprimerTontine: (id) => ipcRenderer.invoke("tontine:delete", id),
getTontines: () => ipcRenderer.invoke("tontine:getAll"),
getTontine: (id) => ipcRenderer.invoke("tontine:get", id),
getTontineNumber: (i) => ipcRenderer.invoke("tontine:getNumber"),
// ========== ASSOCIATIONS TONTINE - MEMBRE ==========
associerMembreTontine: (tontine_id, membre_id) =>
ipcRenderer.invoke("association:add", tontine_id, membre_id),
retirerMembreTontine: (tontine_id, membre_id) =>
ipcRenderer.invoke("association:remove", tontine_id, membre_id),
getMembresDeTontine: (tontine_id) =>
ipcRenderer.invoke("association:getMembres", tontine_id),
// ================= COTISATIONS =================
enregistrerCotisation: (
membre_id,
tontine_id,
date,
montant,
statut,
commentaire
) =>
ipcRenderer.invoke(
"cotisation:add",
membre_id,
tontine_id,
date,
montant,
statut,
commentaire
),
modifierCotisation: (id, montant, statut, commentaire) =>
ipcRenderer.invoke("cotisation:update", id, montant, statut, commentaire),
supprimerCotisation: (id) => ipcRenderer.invoke("cotisation:delete", id),
getCotisationsParTontine: (tontine_id) =>
ipcRenderer.invoke("cotisation:getByTontine", tontine_id),
// ================= PENALITES =================
ajouterPenalite: (cotisation_id, montant, raison) =>
ipcRenderer.invoke("penalite:add", cotisation_id, montant, raison),
getPenalitesParCotisation: (cotisation_id) =>
ipcRenderer.invoke("penalite:getByCotisation", cotisation_id),
getSommeCotisation: () =>
ipcRenderer.invoke("cotisation:getAllCotisations"),
// ================= STATISTIQUES =================
getStatistiquesGlobales: () => ipcRenderer.invoke("stats:getGlobales"),
getTotalCotiseParMembre: (membre_id) =>
ipcRenderer.invoke("stats:getTotalByMembre", membre_id),
// ================= SAUVEGARDE =================
sauvegarder: (destinationPath) =>
ipcRenderer.invoke("sauvegarde:save", destinationPath),
restaurer: (sourcePath) =>
ipcRenderer.invoke("sauvegarde:restore", sourcePath),
getDashboardStats: () => ipcRenderer.invoke("stats:getDashboard"),
});