Subversion Repositories SmartDukaan

Rev

Rev 35977 | Rev 36843 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35977 Rev 36842
Line 4... Line 4...
4
            $('#' + 'main-content').html(response);
4
            $('#' + 'main-content').html(response);
5
        });
5
        });
6
});
6
});
7
 
7
 
8
 
8
 
-
 
9
// Format a Date as a local YYYY-MM-DD string (avoids UTC/IST day shift from toISOString)
-
 
10
function toLocalYMD(d) {
-
 
11
    const y = d.getFullYear();
-
 
12
    const m = String(d.getMonth() + 1).padStart(2, '0');
-
 
13
    const day = String(d.getDate()).padStart(2, '0');
-
 
14
    return `${y}-${m}-${day}`;
-
 
15
}
-
 
16
 
-
 
17
// Restrict the Acquired Date picker to the last 7 days (today and the 7 days before it).
-
 
18
// The form HTML is injected via AJAX, so set min/max lazily when the field is focused.
-
 
19
$(document).on('focus', 'input[name="acquiredDate"]', function () {
-
 
20
    const today = new Date();
-
 
21
    const minDate = new Date();
-
 
22
    minDate.setDate(today.getDate() - 7);
-
 
23
    $(this).attr('max', toLocalYMD(today));
-
 
24
    $(this).attr('min', toLocalYMD(minDate));
-
 
25
});
-
 
26
 
-
 
27
 
9
$(document).on('change', "#maritalStatus", function () {
28
$(document).on('change', "#maritalStatus", function () {
10
    let maritalStatus = $(this).val();
29
    let maritalStatus = $(this).val();
11
    if (maritalStatus == 1) {
30
    if (maritalStatus == 1) {
12
        $(".loiAnniversaryDate").removeClass('hide-model');
31
        $(".loiAnniversaryDate").removeClass('hide-model');
13
        $(".loiAnniversaryDate").addClass('show-model');
32
        $(".loiAnniversaryDate").addClass('show-model');
Line 146... Line 165...
146
    }
165
    }
147
    if (!email) missingFields.push('Email');
166
    if (!email) missingFields.push('Email');
148
    if (!referId) missingFields.push('Refer By');
167
    if (!referId) missingFields.push('Refer By');
149
    if (!bdm) missingFields.push('Bdm');
168
    if (!bdm) missingFields.push('Bdm');
150
    if (!stateHead) missingFields.push('State head');
169
    if (!stateHead) missingFields.push('State head');
-
 
170
    if (!acquiredDate) {
151
    if (!acquiredDate) missingFields.push('Acquired date');
171
        missingFields.push('Acquired date');
-
 
172
    } else {
-
 
173
        // Acquired date must fall within the last 7 days (not in the future, not older than 7 days back)
-
 
174
        const acq = new Date(acquiredDate);
-
 
175
        const today = new Date();
-
 
176
        today.setHours(0, 0, 0, 0);
-
 
177
        const minAllowed = new Date(today);
-
 
178
        minAllowed.setDate(today.getDate() - 7);
-
 
179
        if (acq > today || acq < minAllowed) {
-
 
180
            missingFields.push('Acquired date must be within the last 7 days');
-
 
181
        }
-
 
182
    }
152
    if (!dob) missingFields.push('dob(Date of Birth)');
183
    if (!dob) missingFields.push('dob(Date of Birth)');
153
    if (age <= 18) missingFields.push('You must be at least 18 years old to Fill LOI FORM. ');
184
    if (age <= 18) missingFields.push('You must be at least 18 years old to Fill LOI FORM. ');
154
    if (!panNo) missingFields.push('Pan Number');
185
    if (!panNo) missingFields.push('Pan Number');
155
    if (!adharNo) missingFields.push('Aadhar Number');
186
    if (!adharNo) missingFields.push('Aadhar Number');
156
    if (!gstNo) missingFields.push('GST Number');
187
    if (!gstNo) missingFields.push('GST Number');