File size: 7,062 Bytes
1503282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Veggie Ledger | Reports</title>
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script>
      tailwind.config = {
        theme: {
          extend: {
            colors: {
              primary: '#4CAF50',
              secondary: '#8BC34A',
            }
          }
        }
      }
    </script>
</head>
<body class="bg-gray-50">
    <custom-navbar></custom-navbar>
    
    <main class="container mx-auto px-4 py-8">
        <h1 class="text-2xl font-bold text-gray-800 mb-6">Reports & Analytics</h1>
        
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
            <div class="bg-white rounded-lg shadow-md p-6">
                <h2 class="text-xl font-semibold text-gray-800 mb-4">Monthly Summary</h2>
                <div class="h-64">
                    <canvas id="monthlyChart"></canvas>
                </div>
            </div>
            <div class="bg-white rounded-lg shadow-md p-6">
                <h2 class="text-xl font-semibold text-gray-800 mb-4">Expense Categories</h2>
                <div class="h-64">
                    <canvas id="categoryChart"></canvas>
                </div>
            </div>
        </div>
        
        <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
            <div class="bg-white rounded-lg shadow-md p-6">
                <h2 class="text-xl font-semibold text-gray-800 mb-4">Family Balances</h2>
                <div class="space-y-4">
                    <div class="flex justify-between items-center">
                        <span>Mother</span>
                        <span class="text-primary">₹350.00</span>
                    </div>
                    <div class="flex justify-between items-center">
                        <span>Father</span>
                        <span class="text-primary">₹1,200.00</span>
                    </div>
                    <div class="flex justify-between items-center">
                        <span>Brother</span>
                        <span class="text-red-500">-₹2,000.00</span>
                    </div>
                    <div class="flex justify-between items-center">
                        <span>Sister</span>
                        <span class="text-gray-500">₹0.00</span>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-lg shadow-md p-6 md:col-span-2">
                <h2 class="text-xl font-semibold text-gray-800 mb-4">Recent Activity</h2>
                <div class="space-y-4">
                    <div class="flex justify-between items-center border-b pb-2">
                        <div>
                            <p class="font-medium">Vegetables</p>
                            <p class="text-sm text-gray-500">Mother • 15 Nov 2023</p>
                        </div>
                        <p class="text-red-500 font-medium">-₹350.00</p>
                    </div>
                    <div class="flex justify-between items-center border-b pb-2">
                        <div>
                            <p class="font-medium">Grocery</p>
                            <p class="text-sm text-gray-500">Father • 14 Nov 2023</p>
                        </div>
                        <p class="text-red-500 font-medium">-₹1,200.00</p>
                    </div>
                    <div class="flex justify-between items-center">
                        <div>
                            <p class="font-medium">Received Money</p>
                            <p class="text-sm text-gray-500">Brother • 12 Nov 2023</p>
                        </div>
                        <p class="text-primary font-medium">+₹2,000.00</p>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <custom-footer></custom-footer>

    <script src="components/navbar.js"></script>
    <script src="components/footer.js"></script>
    <script src="script.js"></script>
    <script>
        feather.replace();
        
        document.addEventListener('DOMContentLoaded', function() {
            // Monthly Chart
            const monthlyCtx = document.getElementById('monthlyChart').getContext('2d');
            new Chart(monthlyCtx, {
                type: 'bar',
                data: {
                    labels: ['Sep', 'Oct', 'Nov'],
                    datasets: [
                        {
                            label: 'Income',
                            data: [2500, 3000, 2000],
                            backgroundColor: '#8BC34A',
                            borderRadius: 4
                        },
                        {
                            label: 'Expenses',
                            data: [1800, 2200, 1550],
                            backgroundColor: '#F44336',
                            borderRadius: 4
                        }
                    ]
                },
                options: {
                    responsive: true,
                    scales: {
                        x: {
                            stacked: false,
                            grid: {
                                display: false
                            }
                        },
                        y: {
                            beginAtZero: true,
                            grid: {
                                drawBorder: false
                            }
                        }
                    },
                    plugins: {
                        legend: {
                            position: 'top',
                        }
                    }
                }
            });
            
            // Category Chart
            const categoryCtx = document.getElementById('categoryChart').getContext('2d');
            new Chart(categoryCtx, {
                type: 'doughnut',
                data: {
                    labels: ['Vegetables', 'Grocery', 'Transport', 'Other'],
                    datasets: [{
                        data: [35, 40, 15, 10],
                        backgroundColor: [
                            '#4CAF50',
                            '#8BC34A',
                            '#CDDC39',
                            '#FFC107'
                        ],
                        borderWidth: 0
                    }]
                },
                options: {
                    responsive: true,
                    plugins: {
                        legend: {
                            position: 'right',
                        }
                    }
                }
            });
        });
    </script>
</body>
</html>