Fix critical member management issues: dues tracking, member IDs, and profile display
All checks were successful
Build And Push Image / docker (push) Successful in 2m20s
All checks were successful
Build And Push Image / docker (push) Successful in 2m20s
- Fix dues payment logic to automatically calculate payment_due_date as 1 year from payment date - Remove redundant dues_paid_until field and replace with payment_due_date throughout - Implement member ID generation system with format MUSA-YYYY-XXXX - Create migration endpoints for generating member IDs and fixing payment dates - Update admin members page to display actual member_id from database - Ensure ProfileAvatar components use correct member_id field - Add support for profile images in list and grid views with initials fallback - Fix countries export alias for backward compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -28,14 +28,16 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
// Determine payment date - use custom date if provided, otherwise today
|
||||
let paymentDate: string;
|
||||
let paymentDateObj: Date;
|
||||
|
||||
if (customPaymentDate) {
|
||||
try {
|
||||
// Validate the custom date
|
||||
const parsedDate = new Date(customPaymentDate);
|
||||
if (isNaN(parsedDate.getTime())) {
|
||||
paymentDateObj = new Date(customPaymentDate);
|
||||
if (isNaN(paymentDateObj.getTime())) {
|
||||
throw new Error('Invalid date format');
|
||||
}
|
||||
paymentDate = parsedDate.toISOString().split('T')[0]; // YYYY-MM-DD format
|
||||
paymentDate = paymentDateObj.toISOString().split('T')[0]; // YYYY-MM-DD format
|
||||
} catch (error) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
@@ -44,15 +46,21 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
} else {
|
||||
// Default to today if no custom date provided
|
||||
paymentDate = new Date().toISOString().split('T')[0];
|
||||
paymentDateObj = new Date();
|
||||
paymentDate = paymentDateObj.toISOString().split('T')[0];
|
||||
}
|
||||
|
||||
// Calculate next payment due date (1 year from payment date)
|
||||
const nextDueDate = new Date(paymentDateObj);
|
||||
nextDueDate.setFullYear(nextDueDate.getFullYear() + 1);
|
||||
const nextDueDateStr = nextDueDate.toISOString().split('T')[0];
|
||||
|
||||
// Prepare update data
|
||||
const updateData = {
|
||||
current_year_dues_paid: 'true',
|
||||
membership_date_paid: paymentDate,
|
||||
membership_status: 'Active', // Ensure member is marked as active when dues are paid
|
||||
payment_due_date: undefined // Clear the due date since it's now paid
|
||||
payment_due_date: nextDueDateStr, // Set to 1 year from payment date
|
||||
membership_status: 'Active' // Ensure member is marked as active when dues are paid
|
||||
};
|
||||
|
||||
// Update the member
|
||||
|
||||
Reference in New Issue
Block a user