FIX_LEAD_NOT_SAVE,FEAT_INSTALLMENT_BDS

This commit is contained in:
Srinivas-Saravanan 2025-05-16 17:50:57 +05:30
parent cc15eadd8a
commit 57766f7680
4 changed files with 56 additions and 28 deletions

View File

@ -241,8 +241,12 @@ class LeadsController extends BaseController
$form_file_name = "file_name_" . $index_plus_one;
$form_docs_name = "docs_name_" . $index_plus_one;
$leads_file_primary_key = $data['leads_file_id'] ?? [];
$files = $this->request->getFileMultiple($form_file_name);
$multi_file_data = $this->uploadMultiFiles($files, $data[$form_docs_name], $leads_file_primary_key);
$multi_file_data = [];
if(isset($data[$form_docs_name])){
$files = $this->request->getFileMultiple($form_file_name);
$multi_file_data = $this->uploadMultiFiles($files, $data[$form_docs_name], $leads_file_primary_key);
}
// Separate the insurer and insurer branch, handle missing or invalid data
if (isset($data['insurer']) && strpos($data['insurer'], '-') !== false) {

View File

@ -661,6 +661,13 @@
$('.renewalFields').show();
$('.renewalFields').find('select, input').attr('required', 'required');
if (value == 3) {
$("#source_policy_id").removeAttr("required");
$("#source_policy_start_date").removeAttr("required");
$("#source_policy_end_date").removeAttr("required");
}
$('.proposed_div').show().find('select, input').attr('required', 'required');
$('#policy_end_date').removeAttr('required');

View File

@ -446,7 +446,7 @@
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD &nbsp;&nbsp; <i class="fa fa-info-circle" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD &nbsp;&nbsp; <i class="fa fa-info-circle info-icon" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
</label>
</div>
@ -532,13 +532,13 @@
</div>
<div class="form-group col-md-3">
<label for="installment">Installment</label>
<label for="installment">Installment &nbsp; <i id="infoIcon" class="fas fa-info-circle info-icon" data-toggle="tooltip" title="Click for Installment details" style="margin-left: 5px;"></i></label>
<input id="installment" value="" type="text" class="form-control" name="installment">
</div>
<div class="form-group col-md-3">
<label for="installment_data">
Installment Data <i id="infoIcon" class="fas fa-info-circle info-icon" title="Click for Installment details" style="margin-left: 5px;"></i>
Installment Data
</label>
<input id="installment_data" class="form-control" name="installment_data">
</div>

View File

@ -1,50 +1,67 @@
<?php
$fileIndex = 1; // Initialize index
$increment = 1; // Example increment value
$fileIndex = 1;
$increment = 1;
?>
<?php if (isset($lead_edit_data) && isset($lead_edit_data["multi_file_data"]) && !empty($lead_edit_data["multi_file_data"])) {
<?php if (isset($lead_edit_data) && isset($lead_edit_data["multi_file_data"]) && !empty($lead_edit_data["multi_file_data"])) {
foreach ($lead_edit_data["multi_file_data"] as $index => $value) {
$isFirstField = ($index === 0); // First file must be Demography
$isFirstField = ($index === 0);
$placeholder = $isFirstField ? 'First file must be Demography.' : '';
$accept = $isFirstField ? '.xls,.xlsx' : '';
$index = $index + 1;
$displayIndex = $index + 1;
?>
<div class="form-row d-flex align-items-end" id="fileField_<?= $index ?>">
<div class="form-row d-flex align-items-end" id="fileField_<?= $displayIndex ?>">
<input type="hidden" name="leads_file_id[]" value="<?= htmlspecialchars($value['id']) ?>" id="file_id_<?= $displayIndex ?>">
<input type="hidden" name="leads_file_id[]"
value="<?= htmlspecialchars($value['id']) ?>" id="file_id_<?= $index ?>">
<!-- Document Name Input -->
<div class="form-group col-md-5">
<label>Document Name<span class="text-danger"></span></label>
<label>Document Name</label>
<input type="text" class="form-control" name="docs_name_<?= $increment ?>[]"
placeholder="<?= $placeholder ?>"
value="<?= htmlspecialchars($value['docs_name']) ?>" id="docs_name_<?= $index ?>">
value="<?= htmlspecialchars($value['docs_name']) ?>" id="docs_name_<?= $displayIndex ?>">
</div>
<!-- File Upload Input -->
<div class="form-group col-md-5">
<label>
File Upload
<span class="text-danger"></span><br>
<small id="file_name_display_<?= $index ?>" class="text-muted">
File Upload<br>
<small id="file_name_display_<?= $displayIndex ?>" class="text-muted">
<?= !empty($value['file_name']) ? htmlspecialchars($value['file_name']) : 'No file chosen' ?>
</small>
</label>
<input type="file" class="form-control" id="file_name_<?= $index ?>"
<input type="file" class="form-control" id="file_name_<?= $displayIndex ?>"
name="file_name_<?= $increment ?>[]" accept="<?= $accept ?>"
onchange="showFileName(this, <?= $index ?>)">
onchange="showFileName(this, <?= $displayIndex ?>)">
</div>
<!-- Add/Remove Buttons -->
<div class="col-md-2" style="position: relative; bottom: 16px;">
<button type="button" class="btn btn-danger" onclick="removeFileField(<?= $index ?>, <?= htmlspecialchars($value['id']) ?>)">x</button>
<button type="button" class="btn btn-danger" onclick="removeFileField(<?= $displayIndex ?>, <?= htmlspecialchars($value['id']) ?>)">x</button>
<button type="button" class="btn btn-primary" onclick="addFileField(<?= $increment ?>)">+</button>
</div>
</div>
<?php } } ?>
<?php } } else { ?>
<!-- Default field if no file data exists -->
<div class="form-row d-flex align-items-end" id="fileField_1">
<input type="hidden" name="leads_file_id[]" value="">
<div class="form-group col-md-5">
<label>Document Name</label>
<input type="text" class="form-control" name="docs_name_1[]"
placeholder="First file must be Demography." id="docs_name_1">
</div>
<div class="form-group col-md-5">
<label>
File Upload<br>
<small id="file_name_display_1" class="text-muted">No file chosen</small>
</label>
<input type="file" class="form-control" id="file_name_1"
name="file_name_1[]" accept=".xls,.xlsx" onchange="showFileName(this, 1)">
</div>
<div class="col-md-2" style="position: relative; bottom: 16px;">
<button type="button" class="btn btn-danger" onclick="removeFileField(1, '')">x</button>
<button type="button" class="btn btn-primary" onclick="addFileField(1)">+</button>
</div>
</div>
<?php } ?>