Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
68441ef
make parent, contact, phone, and note fields optional in edit form
vikrant-vikrant Sep 29, 2025
f8e9e3a
add today's date to student details
vikrant-vikrant Sep 30, 2025
55374fb
refactor: remove unused @font-face declarations and update contact li…
vikrant-vikrant Sep 30, 2025
02a9cce
fix: update MONGO_URL to use environment variable for database connec…
vikrant-vikrant Sep 30, 2025
4894a5e
feat: add dueFees field to student edit and new forms
vikrant-vikrant Sep 30, 2025
06b98c0
feat: add dueFees field to saveEditStudent and newStudent form
vikrant-vikrant Sep 30, 2025
ec274f3
fix: update dueFees condition for student fee status display
vikrant-vikrant Oct 1, 2025
706dec4
feat: enhance student management UI with search functionality and gra…
vikrant-vikrant Oct 3, 2025
262d048
feat: enhance monthly due fees logic to prevent duplicates and track …
vikrant-vikrant Oct 3, 2025
80d50a9
feat: update new student form to include grade selection and auto-fil…
vikrant-vikrant Oct 3, 2025
297948e
feat: update WhatsApp link logic to include due fees notification
vikrant-vikrant Oct 3, 2025
9a3f719
feat: update WhatsApp link to include due fees notification for phone…
vikrant-vikrant Oct 3, 2025
8ad0457
add filters,and hero text for dashboard and all students
vikrant-vikrant Oct 5, 2025
5d18215
feat: implement flash messaging system and date utilities; add middle…
vikrant-vikrant Oct 9, 2025
c025858
need to improve all sturcture
vikrant-vikrant Oct 15, 2025
e5faf88
feat: add cron job service for monthly due fees processing in separat…
vikrant-vikrant Oct 15, 2025
cc77265
refactor: reorganize imports and improve database connection handling…
vikrant-vikrant Oct 15, 2025
3c0e4a0
Merge branch 'feture'
vikrant-vikrant Oct 15, 2025
8c98412
refactor: remove unused middleware imports for improved code clarity
vikrant-vikrant Oct 15, 2025
01c6478
refactor: remove app.js file and its associated configurations
vikrant-vikrant Oct 15, 2025
03d899b
feat: enhance monthly due fees logic to log when fees are already add…
vikrant-vikrant Oct 16, 2025
9a4c557
Merge branch 'main' of https://github.com/vikrant-vikrant/Dynamic-Vision
vikrant-vikrant Oct 16, 2025
41a9ab7
feat: implement MongoDB session store with error handling and session…
vikrant-vikrant Oct 22, 2025
4606c52
fix: update cron job schedule to run daily at 00:10 instead of 00:00
vikrant-vikrant Oct 23, 2025
28868b1
fix: improve student deletion feedback and enable method override in app
vikrant-vikrant Oct 24, 2025
45cc3f0
fix: adjust fee addition logic and update toast styles for better res…
vikrant-vikrant Nov 7, 2025
09a1d06
refactor: remove cron job dependency and integrate MongoDB connection…
vikrant-vikrant Nov 11, 2025
31e5da0
feat: add monthly due update workflow with cron scheduling and Node s…
vikrant-vikrant Nov 23, 2025
eecc98a
fix: update cron job schedule to run at 18:30 and correct script path…
vikrant-vikrant Nov 24, 2025
393ecf0
fix: remove default MongoDB URL fallback in cron job service
vikrant-vikrant Nov 26, 2025
2c7e6bc
fix: update MongoDB connection string in cron job service and remove …
vikrant-vikrant Dec 2, 2025
aa8ee0a
fix: restore dotenv configuration and update MongoDB connection strin…
vikrant-vikrant Dec 4, 2025
be6e23c
fix: update MongoDB connection handling to use environment variable a…
vikrant-vikrant Dec 5, 2025
33ceb18
Update monthlydue.yml
vikrant-vikrant Dec 5, 2025
7ae362e
Merge pull request #2 from vikrant-vikrant/main
vikrant-vikrant Dec 5, 2025
d911494
Update monthlydue.yml
vikrant-vikrant Dec 8, 2025
677a616
fix: validate fee amount before adding and update WhatsApp links for …
vikrant-vikrant Dec 8, 2025
bd6fae7
fix: update reminder links to include SMS option and adjust styles
vikrant-vikrant Dec 9, 2025
8f13dc3
Merge pull request #3 from vikrant-vikrant/feture add fee validation …
vikrant-vikrant Dec 9, 2025
2ead540
feat: add filtering for due students
vikrant-vikrant Dec 14, 2025
3b2af54
feat: enhance styling and layout for navigation and student listings
vikrant-vikrant Dec 14, 2025
7cc1492
refactor: update dashboard rendering and enhance student fee display
vikrant-vikrant Dec 15, 2025
c1a176e
style: enhance student details display with improved typography and l…
vikrant-vikrant Dec 15, 2025
e05e8f4
feat: add initial README and project images for documentation
vikrant-vikrant Dec 19, 2025
036bf09
feat: implement fund management feature with earnings and dues display
vikrant-vikrant Dec 22, 2025
53580cd
feat: implement monthly report management with earnings, expenses, an…
vikrant-vikrant Jan 1, 2026
98649ce
Merge branch 'feture' into main
vikrant-vikrant Jan 1, 2026
b907a5c
Merge pull request #4 from vikrant-vikrant/main
vikrant-vikrant Jan 1, 2026
540189f
refactor: simplify student listing logic and remove filter options fr…
vikrant-vikrant Jan 1, 2026
c668064
feat: enhance responsive design for fund management page
vikrant-vikrant Jan 1, 2026
5e67fa8
feat: update expense handling and improve UI layout for fund management
vikrant-vikrant Jan 1, 2026
35cdc28
feat: update fund management styles and improve report display
vikrant-vikrant Jan 2, 2026
7983f70
Merge branch 'main' into feture
vikrant-vikrant Jan 2, 2026
31cd577
Merge pull request #5 from vikrant-vikrant/feture
vikrant-vikrant Jan 2, 2026
db5592c
feat: update expense section headers and improve total expense display
vikrant-vikrant Jan 2, 2026
9d771c1
feat: refine previous report query to filter by year and month
vikrant-vikrant Jan 2, 2026
a3a512b
Merge pull request #6 from vikrant-vikrant/feture
vikrant-vikrant Jan 2, 2026
8bf0291
feat: adjust total span font size for improved responsiveness
vikrant-vikrant Jan 4, 2026
063d5b0
feat: fix student name selector in search functionality
vikrant-vikrant Jan 4, 2026
cd0cade
feat: enhance fee entry display and update search functionality
vikrant-vikrant Jan 4, 2026
0ce90fb
feat: add new student statistics and enhance fee entry links in month…
vikrant-vikrant Jan 4, 2026
b4391cd
feat: enhance styling for new students section and update fee history…
vikrant-vikrant Jan 6, 2026
eb62a0f
feat: implement user authentication with signup and login functionality
vikrant-vikrant Jan 9, 2026
f026525
feat: remove passport dependency and update login/signup forms for im…
vikrant-vikrant Jan 12, 2026
d8bb362
feat: enhance login and signup forms with improved styling and structure
vikrant-vikrant Jan 13, 2026
2a06e95
feat: implement user ownership in models and routes, add authenticati…
vikrant-vikrant Jan 15, 2026
fbbb7f0
feat: implement user authentication middleware and JWT token handling
vikrant-vikrant Jan 18, 2026
83263e6
Merge branch 'main' into feture
vikrant-vikrant Jan 18, 2026
625d6c7
Merge pull request #7 from vikrant-vikrant/feture
vikrant-vikrant Jan 18, 2026
4645462
feat: filter students by owner in fund controller and improve navbar …
vikrant-vikrant Jan 19, 2026
b861c88
fix: correct casing of isLoggedIn import in routes
vikrant-vikrant Jan 19, 2026
e16509f
fix: correct casing of layout in login and signup views
vikrant-vikrant Jan 19, 2026
a6b146c
fix: adjust font sizes and padding in fund.css; update fee entry disp…
vikrant-vikrant Jan 20, 2026
edebc2d
feat: add profile image and dropdown menu in navbar for user account …
vikrant-vikrant Jan 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/monthlydue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Monthly Due Update

on:
schedule:
- cron: "30 00 * * *"
workflow_dispatch: # Allows manual run

jobs:
run-monthly-job:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install Dependencies
run: npm install

- name: Run Monthly Due Script
env:
MONGO_URL: ${{ secrets.MONGO_URL }}
run: node services/cronJobs.js
131 changes: 131 additions & 0 deletions controllers/fund.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
const Student = require("../models/students");
const catchAsync = require("../utils/catchAsync");
const MonthlyReport = require("../models/monthlyReport");
let thisMonthYear = new Date().toLocaleString("en-US", {
month: "short",
year: "numeric",
});
module.exports.fund = catchAsync(async (req, res) => {
const now = new Date();
const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 1);
const [dueResult, feesThisMonth, stuThisMonth] = await Promise.all([
// 🔹 Total due (all students)
Student.aggregate([
{ $match: { owner: req.user._id } },
{
$group: {
_id: null,
totalDue: { $sum: "$dueFees" },
},
},
]),
Student.aggregate([
{ $match: { owner: req.user._id } },
{ $unwind: "$feesHistory" },

{
$match: {
"feesHistory.paidDate": { $gte: startOfMonth, $lt: endOfMonth },
},
},

{
$sort: {
"feesHistory.paidDate": -1, // ascending
},
},

{
$project: {
name: 1,
grade: 1,
"feesHistory.amount": 1,
"feesHistory.paidDate": 1,
"feesHistory.note": 1,
},
},
]),
Student.find({
owner: req.user._id,
joiningDate: {
$gte: startOfMonth,
$lt: endOfMonth,
},
}).select("name grade"),
]);
const todayDate = new Date().toISOString().split("T")[0];
const totalDue = dueResult[0]?.totalDue || 0;
const month = new Date().getMonth() + 1;
const year = new Date().getFullYear();
let thisMonthData = await MonthlyReport.findOne({
owner: req.user._id,
month,
year,
});
if (!thisMonthData) {
thisMonthData = await MonthlyReport.create({
owner: req.user._id,
month,
year,
totalEarning: 0,
expenses: [],
totalExpenses: 0,
newStudents: 0,
studentsLeft: 0,
createdAt: new Date(),
});
}
const previousReport = await MonthlyReport.find({
owner: req.user._id,
$or: [
{ year: { $lt: year } }, // any past year
{ year: year, month: { $lt: month } }, // same year but earlier months
],
}).sort({ year: -1, month: -1 });
res.render("listings/fund", {
totalDue,
todayDate,
feesThisMonth,
previousReport,
thisMonthYear,
thisMonthData,
stuThisMonth,
});
});
module.exports.addExpense = catchAsync(async (req, res) => {
const { note, amount, paidDate } = req.body;
if (!amount || amount <= 0) {
req.flash("error", "Amount must be greater than 0");
return res.redirect(`/fund`);
}
const month = new Date().getMonth() + 1;
const year = new Date().getFullYear();
const report = await MonthlyReport.findOneAndUpdate(
{ owner: req.user._id, month, year },
{
$setOnInsert: {
owner: req.user._id,
month,
year,
totalEarning: 0,
expenses: [],
totalExpenses: 0,
newStudents: 0,
studentsLeft: 0,
createdAt: new Date(),
},
},
{ new: true, upsert: true },
);
console.log("report of the month");
console.log(month, year, report);
report.expenses.push({
note,
amount: Number(amount),
paidDate: paidDate ? new Date(paidDate) : new Date(),
});
await report.save();
req.flash("success", "Expense added successfully");
res.redirect("/fund");
});
Loading