CHANGE_LEAD_FREASH_CLIENT_BRANCH_DROPDOWN_INDTRDUCED : RV
This commit is contained in:
parent
786b639a9a
commit
22ff7b6957
@ -215,9 +215,13 @@ class LeadsController extends BaseController
|
||||
$data['entity_type_id'] = $client_data['entity_type_id'];
|
||||
$data['client_type'] = $client_data['client_type'];
|
||||
} else {
|
||||
$data['client_id'] = 0;
|
||||
$data['client_branch_id'] = 0;
|
||||
$data['source_policy_id'] = 0;
|
||||
if(!empty($data['client_id'])){
|
||||
$data['is_client_created'] = $data['client_id'];
|
||||
}else{
|
||||
$data['client_id'] = 0;
|
||||
$data['client_branch_id'] = 0;
|
||||
$data['source_policy_id'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$data['client_code'] = generate_client_code();
|
||||
@ -395,6 +399,7 @@ class LeadsController extends BaseController
|
||||
'contact_person_email' => $data['contact_person_email'],
|
||||
'client_id' => $data['client_id'] ?? 0,
|
||||
'client_branch_id' => $data['client_branch_id'] ?? 0,
|
||||
'is_client_created' => $data['is_client_created'] ?? null,
|
||||
'source_policy_id' => $data['source_policy_id'] ?? 0,
|
||||
'policy_type_id' => $value,
|
||||
'salse_person_id' => $data['salse_person_id'] ?? 0,
|
||||
|
||||
@ -146,6 +146,30 @@
|
||||
<!-- client row -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label class="switch" style="position: relative;top: 33px;left: 0px;">
|
||||
<input id="exixting_client" type="checkbox" name="exixting_client">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="exixting_client" style="position: relative;top: 39px;left: 20px;">Existing Client</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_type" name="client_type" required>
|
||||
@ -186,21 +210,6 @@
|
||||
placeholder="Enter Client Short Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
||||
class="text-danger">*</span></label>
|
||||
@ -1611,10 +1620,15 @@
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").prop("selectedIndex", 0);
|
||||
@ -1907,6 +1921,8 @@
|
||||
|
||||
}
|
||||
|
||||
$('#exixting_client').removeAttr('required');
|
||||
|
||||
} else {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
@ -2006,6 +2022,62 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('#exixting_client').change(function () {
|
||||
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
$("#gst").val("");
|
||||
$("#pan").val("");
|
||||
$("#branch_name").val("");
|
||||
$("#branch_code").val("");
|
||||
$("#contact_person_name").val("");
|
||||
$("#contact_person_mobile").val("");
|
||||
$("#contact_person_email").val("");
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").select2();
|
||||
$("#client_branch_id").select2();
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
|
||||
} else {
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@ -64,6 +64,74 @@
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
/* background-color: #f0f0f0; */
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 54px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<?php
|
||||
@ -174,7 +242,9 @@ if (isset($selected_lead_type)) {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
'data-cn': item.client_name,
|
||||
'data-csn': item.short_name,
|
||||
'data-ct': item.client_type,
|
||||
'data-cet': item.entity_type_id,
|
||||
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
|
||||
});
|
||||
|
||||
@ -244,6 +314,24 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
let client_id = $(this).val();
|
||||
|
||||
const $selected = $(this).find('option:selected');
|
||||
|
||||
const clientId = $selected.val();
|
||||
const clientName = $selected.data('cn');
|
||||
const shortName = $selected.data('csn');
|
||||
const clientType = $selected.data('ct');
|
||||
const entityTypeId = $selected.data('cet');
|
||||
|
||||
console.log('Client ID:', clientId);
|
||||
console.log('Client Name:', clientName);
|
||||
console.log('Short Name:', shortName);
|
||||
console.log('Client Type:', clientType);
|
||||
console.log('Entity Type ID:', entityTypeId);
|
||||
|
||||
$("#client_type").val(clientType);
|
||||
$("#entity_type_id").val(entityTypeId);
|
||||
$("#client_name").val(clientName);
|
||||
$("#client_short_name").val(shortName);
|
||||
|
||||
if (client_id == 'add_client') {
|
||||
// alert("Hello");
|
||||
@ -583,6 +671,57 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
if (lead_type == 1) {
|
||||
$('.claim-row').hide();
|
||||
|
||||
if(data.is_client_created == null || data.is_client_created == 0 || data.is_client_created == ""){
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#gst").prop('readonly', false);
|
||||
$("#pan").prop('readonly', false);
|
||||
$("#branch_name").prop('readonly', false);
|
||||
$("#branch_code").prop('readonly', false);
|
||||
$("#contact_person_name").prop('readonly', false);
|
||||
$("#contact_person_mobile").prop('readonly', false);
|
||||
$("#contact_person_email").prop('readonly', false);
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
|
||||
}else{
|
||||
|
||||
$('#exixting_client').prop('checked', true);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#gst").prop('readonly', true);
|
||||
$("#pan").prop('readonly', true);
|
||||
$("#branch_name").prop('readonly', true);
|
||||
$("#branch_code").prop('readonly', true);
|
||||
$("#contact_person_name").prop('readonly', true);
|
||||
$("#contact_person_mobile").prop('readonly', true);
|
||||
$("#contact_person_email").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.claim-row').show();
|
||||
if (policy_type_id == 1) {
|
||||
@ -770,6 +909,59 @@ if (isset($selected_lead_type)) {
|
||||
temp_client_id = data.client_id
|
||||
}
|
||||
|
||||
if(lead_type == 1){
|
||||
|
||||
if(data.is_client_created == null || data.is_client_created == 0 || data.is_client_created == ""){
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#gst").prop('readonly', false);
|
||||
$("#pan").prop('readonly', false);
|
||||
$("#branch_name").prop('readonly', false);
|
||||
$("#branch_code").prop('readonly', false);
|
||||
$("#contact_person_name").prop('readonly', false);
|
||||
$("#contact_person_mobile").prop('readonly', false);
|
||||
$("#contact_person_email").prop('readonly', false);
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
|
||||
}else{
|
||||
|
||||
$('#exixting_client').prop('checked', true);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#gst").prop('readonly', true);
|
||||
$("#pan").prop('readonly', true);
|
||||
$("#branch_name").prop('readonly', true);
|
||||
$("#branch_code").prop('readonly', true);
|
||||
$("#contact_person_name").prop('readonly', true);
|
||||
$("#contact_person_mobile").prop('readonly', true);
|
||||
$("#contact_person_email").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
}
|
||||
}
|
||||
|
||||
$('#page_title').text('Edit Lead');
|
||||
$('#leads_primarykey').val(data.id || '');
|
||||
|
||||
@ -100,6 +100,30 @@
|
||||
<!-- client row -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label class="switch" style="position: relative;top: 33px;left: 0px;">
|
||||
<input id="exixting_client" type="checkbox" name="exixting_client">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="exixting_client" style="position: relative;top: 39px;left: 20px;">Existing Client</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_type" name="client_type" required>
|
||||
@ -140,21 +164,6 @@
|
||||
placeholder="Enter Client Short Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
||||
class="text-danger">*</span></label>
|
||||
@ -616,6 +625,49 @@
|
||||
}
|
||||
|
||||
leadTypeBsedHideAndShow(value, true)
|
||||
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
$("#gst").val("");
|
||||
$("#branch_name").val("");
|
||||
$("#branch_code").val("");
|
||||
$("#contact_person_name").val("");
|
||||
$("#contact_person_mobile").val("");
|
||||
$("#contact_person_email").val("");
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").prop("selectedIndex", 0);
|
||||
$("#client_branch_id").prop("selectedIndex", 0);
|
||||
$("#source_policy_id").empty();
|
||||
$('#source_policy_id').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Policy"
|
||||
}));
|
||||
$("#pan").val("");
|
||||
|
||||
$('#policy_type_id_1').prop("selectedIndex", 0)
|
||||
$('#insurer_1').prop("selectedIndex", 0)
|
||||
$('#tpa_1').prop("selectedIndex", 0);
|
||||
$('#policy_start_date').val("");
|
||||
$('#policy_end_date').val("");
|
||||
$("#appendArea_1").empty();
|
||||
|
||||
})
|
||||
|
||||
function leadTypeBsedHideAndShow(value, resetValues = false) {
|
||||
@ -656,6 +708,8 @@
|
||||
|
||||
}
|
||||
|
||||
$('#exixting_client').removeAttr('required');
|
||||
|
||||
} else {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
@ -1023,4 +1077,59 @@
|
||||
|
||||
}
|
||||
|
||||
$('#exixting_client').change(function () {
|
||||
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
$("#gst").val("");
|
||||
$("#pan").val("");
|
||||
$("#branch_name").val("");
|
||||
$("#branch_code").val("");
|
||||
$("#contact_person_name").val("");
|
||||
$("#contact_person_mobile").val("");
|
||||
$("#contact_person_email").val("");
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").prop("selectedIndex", 0);
|
||||
$("#client_branch_id").prop("selectedIndex", 0);
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
|
||||
} else {
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user