MERGE_CODE_MERGE : RV

This commit is contained in:
VENKATESHWARAN 2025-02-27 18:03:03 +05:30
commit a2479cb28d
7 changed files with 2068 additions and 63 deletions

View File

@ -404,6 +404,7 @@ $routes->group("rfq", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "LeadsController::createRFQ"); $routes->post("create", "LeadsController::createRFQ");
$routes->post("createQCR", "LeadsController::createQCR"); $routes->post("createQCR", "LeadsController::createQCR");
$routes->get("list/(:any)", "LeadsController::viewRFQ/$1"); $routes->get("list/(:any)", "LeadsController::viewRFQ/$1");
$routes->get("nonEB","LeadsController::rfqNonEB");
}); });

View File

@ -2534,26 +2534,34 @@ class EmployeeRestController extends AdminController
$terms = json_decode($ClientPolicyValue['policy_terms']);
if($ClientPolicyValue['policy_type_id'] == 1) if($ClientPolicyValue['policy_type_id'] == 1)
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); $policyGroup = 'gpa';
$data['ticket_type_id'] = 2; $data['ticket_type_id'] = 2;
}else if($ClientPolicyValue['policy_type_id'] == 6) }else if($ClientPolicyValue['policy_type_id'] == 6)
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); $policyGroup = 'gpa';
$data['ticket_type_id'] = 3; $data['ticket_type_id'] = 3;
}else if($ClientPolicyValue['policy_type_id'] == 7) }else if($ClientPolicyValue['policy_type_id'] == 7)
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); $policyGroup = 'gpa';
$data['ticket_type_id'] = 4; $data['ticket_type_id'] = 4;
}else }else
{ {
$data['policy_terms'] = $this->policyTermsFiter($terms,'gmc'); $policyGroup = 'gmc';
$data['ticket_type_id'] = 1; $data['ticket_type_id'] = 1;
} }
$terms = json_decode($ClientPolicyValue['policy_terms'] , true);
$data['policy_terms'] = isset($terms['enrollment_display_key'])
&& !empty($terms['enrollment_display_key'])
? $terms['enrollment_display_key']
: $this->policyTermsFiter($terms, $policyGroup);
$terms = json_decode($ClientPolicyValue['policy_terms']);
$data['client_id'] = $ClientPolicyValue['client_id']; $data['client_id'] = $ClientPolicyValue['client_id'];
$data['client_policy_id'] = $ClientPolicyValue['id']; $data['client_policy_id'] = $ClientPolicyValue['id'];
$data['policy_name'] = $ClientPolicyValue['policy_type']; $data['policy_name'] = $ClientPolicyValue['policy_type'];

View File

@ -2385,6 +2385,11 @@ class LeadsController extends BaseController
return $financialYears; return $financialYears;
} }
public function rfqNonEB(){
$this->loadLayout('view_rfq_non_eb');
}
} }

View File

@ -71,13 +71,20 @@ class RestAuthenticationController extends AdminController
$mobile_number = $this->request->getJSON()->mobile_number; $mobile_number = $this->request->getJSON()->mobile_number;
$employeeData = $this->employeeModel->where('mobile', $mobile_number) $employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
->where('relationship', 'self') ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
->where('emp_status !=', 'truncated') ->where('employees.is_active', 1)
->where('is_active', 1) ->where('employees.relationship', 'self')
->first(); ->where('employees.emp_status !=', 'truncated')
->where('employees.mobile', $mobile_number)
->where('EP.is_active', 1)
->whereIn('EP.status', ['active'])
->first();
if ($employeeData) {
if (isset($employeeData['employee_id']))
{
$result = ['user_verification' => true ,'message' => "Verified Successfully"]; $result = ['user_verification' => true ,'message' => "Verified Successfully"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
@ -97,11 +104,18 @@ class RestAuthenticationController extends AdminController
$email = $this->request->getJSON()->email; $email = $this->request->getJSON()->email;
$employeeData = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self') $employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
->where('emp_status !=', 'truncated')->where('is_active', 1) ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
->where('employees.is_active', 1)
->where('employees.relationship', 'self')
->where('employees.emp_status !=', 'truncated')
->where('employees.email_corporate', $email)
->where('EP.is_active', 1)
->whereIn('EP.status', ['active'])
->first(); ->first();
if ($employeeData) { if (isset($employeeData['employee_id']))
{
$otp = random_int(100000, 999999); $otp = random_int(100000, 999999);

View File

@ -231,7 +231,7 @@
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label id="pod_no_label_1" for="pod_no">POD No <span id="pod_no_label_1_span" class="text-danger"></span></label> <label id="pod_no_label_1" for="pod_no">POD No with Courier Name <span id="pod_no_label_1_span" class="text-danger"></span></label>
<input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO" <input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO"
value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>" value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>"
name="pod_no"> name="pod_no">
@ -337,7 +337,7 @@
</div> </div>
<div class="form-group col-md-6 returned" style="display: none;"> <div class="form-group col-md-6 returned" style="display: none;">
<label for="awb_no_courier_name">AWB No with Courier Name</label> <label for="awb_no_courier_name">Return AWB No with Courier Name</label>
<input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier" <input type="text" class="form-control" id="awb_no_courier_name" placeholder="eg : 0001/ST Courier"
value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name"> value="<?= isset($ticket_data['awb_no_courier_name']) ? $ticket_data['awb_no_courier_name'] : '' ?>" name="awb_no_courier_name">
</div> </div>
@ -565,7 +565,46 @@
} }
}); });
$('.' + thirdClass).find('input, textarea').attr('required', true); // $('.' + thirdClass).find('input, textarea').attr('required', true);
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
try {
extrafieldsArray = JSON.parse(extrafieldsArray); // Convert string to object
} catch (error) {
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
return;
}
var selectedClaimStatus = $('#claim_status_id').val();
var $thirdClass = $(`.${thirdClass}`);
var hasValue = $thirdClass.find('input, textarea, select').filter(function () {
return $(this).val().trim() !== ''; // Check if at least one field is not empty
}).length > 0;
$thirdClass.each(function () {
var id = $(this).find('[id]').first().attr('id');
var $label = $(this).find('label');
var $thisDiv = $(this);
var $inputs = $thisDiv.find('input, textarea, select');
// ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
// ✅ Condition 2: If any field in the class has a value, make all required
if (shouldAddRequired || hasValue) {
if ($label.length && !$label.find('.text-danger').length) {
$label.append(' <span class="text-danger">*</span>');
}
console.log("input from if ",$inputs);
// $inputs.attr('required', true);
$('.' + thirdClass).find('input, textarea,select').attr('required', true);
} else {
$label.find('.text-danger').remove();
console.log("input ",$inputs);
// $inputs.prop('required', false);
$('.' + thirdClass).find('input, textarea,select').attr('required', false);
}
});
} }
@ -587,7 +626,7 @@
if ($parentDiv.length) { if ($parentDiv.length) {
let thirdClass = $parentDiv.attr("class").split(" ")[2] || ""; let thirdClass = $parentDiv.attr("class").split(" ")[2] || "";
console.log('thirdClass', thirdClass); console.log('thirdClass', thirdClass);
addRequiredFieldSymbolByClass(thirdClass); // addRequiredFieldSymbolByClass(thirdClass);
// addRequiredFieldSymbol(targetId); // addRequiredFieldSymbol(targetId);
if (thirdClass) { if (thirdClass) {
// console.log("fields",fields); // console.log("fields",fields);
@ -608,64 +647,97 @@
} }
}); });
function addRequiredFieldSymbol(field_name) { // function addRequiredFieldSymbol(field_name) {
// Find the field with the given name // // Find the field with the given name
var $field = $(`[name="${field_name}"]`); // var $field = $(`[name="${field_name}"]`);
if ($field.length) { // if ($field.length) {
// Find the parent div of this field // // Find the parent div of this field
var $parentDiv = $field.closest('div'); // var $parentDiv = $field.closest('div');
if ($parentDiv.length) { // if ($parentDiv.length) {
// Get the classes as an array // // Get the classes as an array
var classes = $parentDiv.attr('class') ? $parentDiv.attr('class').split(/\s+/) : []; // var classes = $parentDiv.attr('class') ? $parentDiv.attr('class').split(/\s+/) : [];
if (classes.length > 0) { // if (classes.length > 0) {
// Get the last class in the array // // Get the last class in the array
var lastClass = classes[classes.length - 1]; // var lastClass = classes[classes.length - 1];
// Find all divs with this last class // // Find all divs with this last class
var $allDivsWithClass = $(`.${lastClass}`); // var $allDivsWithClass = $(`.${lastClass}`);
// Add asterisk to all labels within these divs // // Add asterisk to all labels within these divs
$allDivsWithClass.each(function() { // $allDivsWithClass.each(function() {
var $label = $(this).find('label'); // var $label = $(this).find('label');
if ($label.length && !$label.find('.text-danger').length) { // if ($label.length && !$label.find('.text-danger').length) {
$label.append(' <span class="text-danger">*</span>'); // $label.append(' <span class="text-danger">*</span>');
} // }
}); // });
console.log(`Added required symbol to ${$allDivsWithClass.length} labels with class "${lastClass}"`); // console.log(`Added required symbol to ${$allDivsWithClass.length} labels with class "${lastClass}"`);
} else { // } else {
console.warn(`Parent div for field "${field_name}" has no classes`); // console.warn(`Parent div for field "${field_name}" has no classes`);
} // }
} else { // } else {
console.warn(`No parent div found for field name="${field_name}"`); // console.warn(`No parent div found for field name="${field_name}"`);
} // }
} else { // } else {
console.warn(`No field found with name="${field_name}"`); // console.warn(`No field found with name="${field_name}"`);
} // }
} // }
function addRequiredFieldSymbolByClass(className) { function addRequiredFieldSymbolByClass(className) {
// Find all divs with the specified class
var $divsWithClass = $(`.${className}`); var $divsWithClass = $(`.${className}`);
if ($divsWithClass.length) { if ($divsWithClass.length) {
// Add asterisk to all labels within these divs let extrafieldsArray = $('#extra_fields_array_for_validate').val();
$divsWithClass.each(function() { try {
var $label = $(this).find('label'); extrafieldsArray = JSON.parse(extrafieldsArray); // Convert string to object
if ($label.length && !$label.find('.text-danger').length) { } catch (error) {
$label.append(' <span class="text-danger">*</span>'); console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
} return;
}); }
console.log(`Added required symbol to ${$divsWithClass.length} labels with class "${className}"`); var selectedClaimStatus = $('#claim_status_id').val();
console.log("Selected claim status ID:", selectedClaimStatus);
console.log("Extra Field Array:", extrafieldsArray[selectedClaimStatus]);
// ✅ Check if at least one field inside the class has a value
// var hasValue = $divsWithClass.find('input, textarea, select').filter(function () {
// return $(this).val().trim() !== ''; // Check if at least one field is not empty
// }).length > 0;
// $divsWithClass.each(function () {
// var id = $(this).find('[id]').first().attr('id');
// var $label = $(this).find('label');
// var $thisDiv = $(this);
// var $inputs = $thisDiv.find('input, textarea, select');
// // ✅ Condition 1: Check if this ID is in extraFieldsArray (required by status)
// var shouldAddRequired = extrafieldsArray[selectedClaimStatus] && extrafieldsArray[selectedClaimStatus].includes(id);
// // ✅ Condition 2: If any field in the class has a value, make all required
// if (shouldAddRequired || hasValue) {
// if ($label.length && !$label.find('.text-danger').length) {
// $label.append(' <span class="text-danger">*</span>');
// }
// console.log("input from if ",$inputs);
// $inputs.attr('required', true);
// } else {
// $label.find('.text-danger').remove();
// console.log("input ",$inputs);
// $inputs.prop('required', false);
// }
// });
console.log(`Processed ${$divsWithClass.length} labels with class "${className}"`);
} else { } else {
console.warn(`No divs found with class="${className}"`); console.warn(`No divs found with class="${className}"`);
} }
} }
$('#mode_of_intimation').change(function(){ $('#mode_of_intimation').change(function(){
console.log("function called"); console.log("function called");
var mode_of_intimation = $('#mode_of_intimation').val(); var mode_of_intimation = $('#mode_of_intimation').val();

File diff suppressed because it is too large Load Diff