Compare commits
91 Commits
a41e9edbc7
...
e7b1fa5cc0
| Author | SHA1 | Date |
|---|---|---|
|
|
e7b1fa5cc0 | |
|
|
a86de55713 | |
|
|
c7d1272e7a | |
|
|
602a848bb7 | |
|
|
796e55172e | |
|
|
831eb41b02 | |
|
|
dac10efa93 | |
|
|
93ba9012f6 | |
|
|
0fdec50b70 | |
|
|
97b9ffa384 | |
|
|
f0e99a0ed6 | |
|
|
73dc5e7384 | |
|
|
6f09f07ba9 | |
|
|
09c1505747 | |
|
|
03315767a9 | |
|
|
862e59d630 | |
|
|
7630d72b50 | |
|
|
831d50f79d | |
|
|
da928de6e9 | |
|
|
d34a5fb5a6 | |
|
|
7ac1dbcf0e | |
|
|
e7d30d8b69 | |
|
|
c6af49faa0 | |
|
|
8426e56519 | |
|
|
a4e22ecaf7 | |
|
|
62e1437163 | |
|
|
3f53a5c4a1 | |
|
|
ee3b0452ad | |
|
|
9575b00924 | |
|
|
d3ebaf8a16 | |
|
|
fb32ede54f | |
|
|
9dfa06814d | |
|
|
80414d3ea6 | |
|
|
792502f5c4 | |
|
|
f6af013c3d | |
|
|
b555fd25d6 | |
|
|
6b9b3ce96d | |
|
|
4258f70e61 | |
|
|
4992ab9bc0 | |
|
|
e48add34ef | |
|
|
d9d2718b8f | |
|
|
3ae004cc5e | |
|
|
10c767fd3d | |
|
|
514c06d67b | |
|
|
ee523cf5bf | |
|
|
f8f3e5d0d6 | |
|
|
52dc4684da | |
|
|
7dca51f0f9 | |
|
|
1769a7635d | |
|
|
2065a266f8 | |
|
|
bcf37a1940 | |
|
|
7b6b0fbbd0 | |
|
|
fa48213e7c | |
|
|
d84611a186 | |
|
|
8c89f5c00f | |
|
|
78be7ba4f0 | |
|
|
cf3b749952 | |
|
|
e6455bb6a2 | |
|
|
b4c7bac855 | |
|
|
041f29491b | |
|
|
f4e091bb6d | |
|
|
46d89e7f1f | |
|
|
b649e82b8c | |
|
|
d1b689b227 | |
|
|
c3744b48a3 | |
|
|
b5d336f9c0 | |
|
|
0e3f3aa6a7 | |
|
|
cfac2dd3cf | |
|
|
4f530ad7ba | |
|
|
91dc004188 | |
|
|
6898509f40 | |
|
|
876e8420c8 | |
|
|
ad23829f9d | |
|
|
e0db8b7091 | |
|
|
012c9731fc | |
|
|
39f6b0a607 | |
|
|
a180bfd29c | |
|
|
55120ff73f | |
|
|
580e6e49ea | |
|
|
8875521881 | |
|
|
e5b2a4cecd | |
|
|
ae93b2357e | |
|
|
1c462e6f19 | |
|
|
245c5a6fcc | |
|
|
1dddc94391 | |
|
|
e9e96f0966 | |
|
|
15e90527c7 | |
|
|
8d8cd313e7 | |
|
|
8879d5a10e | |
|
|
a889c0a213 | |
|
|
533577f1a8 |
|
|
@ -18,8 +18,12 @@
|
|||
'version': '0.1',
|
||||
|
||||
# any module necessary for this one to work correctly
|
||||
|
||||
'depends': ['base','hr','account','mail','hr_skills', 'hr_contract'],
|
||||
|
||||
|
||||
|
||||
|
||||
# always loaded
|
||||
'data': [
|
||||
'security/security.xml',
|
||||
|
|
|
|||
|
|
@ -256,6 +256,8 @@ class HRJobRecruitment(models.Model):
|
|||
rec.submission_status = 'zero'
|
||||
|
||||
|
||||
experience = fields.Many2one('candidate.experience', string="Experience")
|
||||
|
||||
@api.depends('application_ids.submitted_to_client')
|
||||
def _compute_no_of_submissions(self):
|
||||
counts = dict(self.env['hr.applicant']._read_group(
|
||||
|
|
|
|||
|
|
@ -1836,6 +1836,13 @@
|
|||
// Next button logic
|
||||
nextButtons.forEach(button => {
|
||||
button.addEventListener("click", function () {
|
||||
if (currentStep === 0) {
|
||||
// Validate employer history fields before proceeding
|
||||
if (!validateEmployerHistory()) {
|
||||
return false; // Stop navigation
|
||||
}
|
||||
}
|
||||
|
||||
if (validateStep(currentStep)) {
|
||||
if (currentStep < steps.length - 1) {
|
||||
currentStep++;
|
||||
|
|
@ -1844,6 +1851,181 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
function validateEmployerHistory() {
|
||||
const employerTable = document.getElementById('previous_employer_table_body');
|
||||
const rows = employerTable.querySelectorAll('tr');
|
||||
let hasErrors = false;
|
||||
|
||||
rows.forEach(row => {
|
||||
// Get the cells for this row
|
||||
const companyNameInput = row.querySelector('input[name="company_name"]');
|
||||
const designationInput = row.querySelector('input[name="designation"]');
|
||||
const dojInput = row.querySelector('input[name="doj"]');
|
||||
|
||||
// Check if ANY field in this row has a value
|
||||
const hasValues = Array.from(row.querySelectorAll('input')).some(input =>
|
||||
input.value && input.value.trim() !== ''
|
||||
);
|
||||
|
||||
if (hasValues) {
|
||||
// If any field has value, check required fields
|
||||
if (!companyNameInput || !companyNameInput.value.trim()) {
|
||||
companyNameInput.classList.add("is-invalid");
|
||||
companyNameInput.required = true;
|
||||
hasErrors = true;
|
||||
} else {
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (!designationInput || !designationInput.value.trim()) {
|
||||
if (designationInput) {
|
||||
designationInput.classList.add("is-invalid");
|
||||
designationInput.required = true;
|
||||
hasErrors = true;
|
||||
}
|
||||
} else {
|
||||
if (designationInput) designationInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (!dojInput || !dojInput.value.trim()) {
|
||||
if (dojInput) {
|
||||
dojInput.classList.add("is-invalid");
|
||||
dojInput.required = true;
|
||||
hasErrors = true;
|
||||
}
|
||||
} else {
|
||||
if (dojInput) dojInput.classList.remove("is-invalid");
|
||||
}
|
||||
} else {
|
||||
// No values in this row, remove validation
|
||||
if (companyNameInput) {
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
companyNameInput.required = false;
|
||||
}
|
||||
if (designationInput) {
|
||||
designationInput.classList.remove("is-invalid");
|
||||
designationInput.required = false;
|
||||
}
|
||||
if (dojInput) {
|
||||
dojInput.classList.remove("is-invalid");
|
||||
dojInput.required = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Also check the "experience" radio buttons
|
||||
const experienceRadios = document.querySelectorAll('input[name="experience"]');
|
||||
const isExperienced = Array.from(experienceRadios).some(radio =>
|
||||
radio.value === 'experienced' && radio.checked
|
||||
);
|
||||
|
||||
if (isExperienced) {
|
||||
// If user selected "Experienced", check if at least one employer is filled
|
||||
const anyEmployerFilled = Array.from(rows).some(row => {
|
||||
return Array.from(row.querySelectorAll('input')).some(input =>
|
||||
input.value && input.value.trim() !== ''
|
||||
);
|
||||
});
|
||||
|
||||
if (!anyEmployerFilled) {
|
||||
alert("Please fill at least one employer detail since you selected 'Experienced'");
|
||||
hasErrors = true;
|
||||
}
|
||||
}
|
||||
|
||||
return !hasErrors;
|
||||
}
|
||||
|
||||
// Add real-time validation as user types
|
||||
const employerInputs = document.querySelectorAll('#previous_employer_table_body input');
|
||||
employerInputs.forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
// When user types in any employer field, validate that row
|
||||
const row = this.closest('tr');
|
||||
if (row) {
|
||||
validateRow(row);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Add change event to experience radio buttons
|
||||
const experienceRadios = document.querySelectorAll('input[name="experience"]');
|
||||
experienceRadios.forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
if (this.value === 'experienced' && this.checked) {
|
||||
// Make first employer row required
|
||||
const firstRow = document.querySelector('#previous_employer_table_body tr');
|
||||
if (firstRow) {
|
||||
const companyNameInput = firstRow.querySelector('input[name="company_name"]');
|
||||
const designationInput = firstRow.querySelector('input[name="designation"]');
|
||||
const dojInput = firstRow.querySelector('input[name="doj"]');
|
||||
|
||||
if (companyNameInput) companyNameInput.required = true;
|
||||
if (designationInput) designationInput.required = true;
|
||||
if (dojInput) dojInput.required = true;
|
||||
}
|
||||
} else if (this.value === 'fresher' && this.checked) {
|
||||
// Remove required from all employer fields
|
||||
const allInputs = document.querySelectorAll('#previous_employer_table_body input');
|
||||
allInputs.forEach(input => {
|
||||
input.required = false;
|
||||
input.classList.remove("is-invalid");
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Helper function to validate a single row
|
||||
function validateRow(row) {
|
||||
const companyNameInput = row.querySelector('input[name="company_name"]');
|
||||
const designationInput = row.querySelector('input[name="designation"]');
|
||||
const dojInput = row.querySelector('input[name="doj"]');
|
||||
|
||||
// Check if ANY field in this row has a value
|
||||
const hasValues = Array.from(row.querySelectorAll('input')).some(input =>
|
||||
input.value && input.value.trim() !== ''
|
||||
);
|
||||
|
||||
if (hasValues) {
|
||||
// Set required attributes
|
||||
if (companyNameInput) companyNameInput.required = true;
|
||||
if (designationInput) designationInput.required = true;
|
||||
if (dojInput) dojInput.required = true;
|
||||
|
||||
// Validate
|
||||
if (companyNameInput && !companyNameInput.value.trim()) {
|
||||
companyNameInput.classList.add("is-invalid");
|
||||
} else if (companyNameInput) {
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (designationInput && !designationInput.value.trim()) {
|
||||
designationInput.classList.add("is-invalid");
|
||||
} else if (designationInput) {
|
||||
designationInput.classList.remove("is-invalid");
|
||||
}
|
||||
|
||||
if (dojInput && !dojInput.value.trim()) {
|
||||
dojInput.classList.add("is-invalid");
|
||||
} else if (dojInput) {
|
||||
dojInput.classList.remove("is-invalid");
|
||||
}
|
||||
} else {
|
||||
// No values, remove requirements
|
||||
if (companyNameInput) {
|
||||
companyNameInput.required = false;
|
||||
companyNameInput.classList.remove("is-invalid");
|
||||
}
|
||||
if (designationInput) {
|
||||
designationInput.required = false;
|
||||
designationInput.classList.remove("is-invalid");
|
||||
}
|
||||
if (dojInput) {
|
||||
dojInput.required = false;
|
||||
dojInput.classList.remove("is-invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Previous button logic
|
||||
prevButtons.forEach(button => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue