CHANGE_BDS
This commit is contained in:
parent
999c7c8ade
commit
e758e4fdaa
@ -329,6 +329,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("getCDAccNoByClientAndInsurer/(:any)", "ClientController::getCDAccNoByClientAndInsurer/$1");
|
$routes->get("getCDAccNoByClientAndInsurer/(:any)", "ClientController::getCDAccNoByClientAndInsurer/$1");
|
||||||
$routes->post("createClientWithMinimalData", "ClientController::createClientWithMinimalData");
|
$routes->post("createClientWithMinimalData", "ClientController::createClientWithMinimalData");
|
||||||
$routes->post("createVehicleWithMinimalData", "ClientController::createVehicleWithMinimalData");
|
$routes->post("createVehicleWithMinimalData", "ClientController::createVehicleWithMinimalData");
|
||||||
|
$routes->post("createVehicleWithMinimalDataForBDS", "ClientController::createVehicleWithMinimalDataForBDS");
|
||||||
$routes->post("createClientBranchWithMinamalData", "ClientController::createClientBranchWithMinamalData");
|
$routes->post("createClientBranchWithMinamalData", "ClientController::createClientBranchWithMinamalData");
|
||||||
$routes->post("createClientPolicyWithMinimalData", "ClientController::createClientPolicyWithMinimalData");
|
$routes->post("createClientPolicyWithMinimalData", "ClientController::createClientPolicyWithMinimalData");
|
||||||
$routes->post("createCDAccountNumberUsingAjax", "MasterController::createCDAccountNumberUsingAjax");
|
$routes->post("createCDAccountNumberUsingAjax", "MasterController::createCDAccountNumberUsingAjax");
|
||||||
|
|||||||
@ -4619,17 +4619,70 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createVehicleWithMinimalData2()
|
public function createVehicleWithMinimalDataForBDS()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
// print_r($data); die;
|
||||||
if (isset($data['client_name']) && !empty($data['client_name'])) {
|
if (isset($data['client_name']) && !empty($data['client_name'])) {
|
||||||
|
|
||||||
$this->clientModel->insert();
|
$client_type = $postData['client_type'] ?? null;
|
||||||
|
|
||||||
} else {
|
if ($client_type == 2) {
|
||||||
|
|
||||||
$vehicle_insert = $this->vehicleModel->insert($data);
|
$client_data = [
|
||||||
|
'client_type' => $data['client_type'],
|
||||||
|
'client_name' => $data['client_name'],
|
||||||
|
'email' => $data['short_name'] ?? $data['client_name'],
|
||||||
|
'phone' => $data['mobile'],
|
||||||
|
'client_code' => generate_client_code()
|
||||||
|
];
|
||||||
|
|
||||||
|
$client_insert = $this->clientModel->insert($client_data);
|
||||||
|
} else if ($client_type == 1) {
|
||||||
|
|
||||||
|
$client_data = [
|
||||||
|
'client_type' => $data['client_type'],
|
||||||
|
'client_name' => $data['client_name'],
|
||||||
|
'short_name' => $data['short_name'] ?? $data['client_name'],
|
||||||
|
'client_code' => generate_client_code(),
|
||||||
|
'entity_type_id' => 2
|
||||||
|
];
|
||||||
|
|
||||||
|
$client_insert = $this->clientModel->insert($client_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional logic for non-individual clients (client_type != 2)
|
||||||
|
if ($client_type != 2) {
|
||||||
|
$unit[] = $data['short_name'] . '-' . 001;
|
||||||
|
$branch_data = [
|
||||||
|
'client_id' => $client_insert,
|
||||||
|
'branch_name' => $data['branch_name'],
|
||||||
|
'branch_code' => 001,
|
||||||
|
'gst' => $data['gst'],
|
||||||
|
'units' => json_encode($unit) ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$branch_insert = $this->clientBranchModel->insert($branch_data);
|
||||||
|
if ($branch_insert) {
|
||||||
|
$contact_data = [
|
||||||
|
'ref_id' => $branch_insert,
|
||||||
|
'contact_type' => 'client',
|
||||||
|
'name' => $data['name'],
|
||||||
|
'email' => $data['email'],
|
||||||
|
];
|
||||||
|
$this->levelContactModel->insert($contact_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$vehicle_data = [
|
||||||
|
'vehicle_no' => $data['vehicle_no'],
|
||||||
|
'type' => $data['type'],
|
||||||
|
'rc' => $data['rc'],
|
||||||
|
'branch_id' => $data['branch_id'] ?? null,
|
||||||
|
'owner' => $client_insert,
|
||||||
|
];
|
||||||
|
|
||||||
|
$vehicle_insert = $this->vehicleModel->insert($vehicle_data);
|
||||||
|
|
||||||
if ($vehicle_insert) {
|
if ($vehicle_insert) {
|
||||||
|
|
||||||
@ -4646,12 +4699,38 @@ class ClientController extends AdminController
|
|||||||
'owner_branch_id' => $data['branch_id'] ?? null,
|
'owner_branch_id' => $data['branch_id'] ?? null,
|
||||||
'owner_type' => $data['Owner_type'],
|
'owner_type' => $data['Owner_type'],
|
||||||
'vehicles' => $vehicles,
|
'vehicles' => $vehicles,
|
||||||
'message' => 'Vehicle created successfully
|
'message' => 'Vehicle created successfully'
|
||||||
'
|
|
||||||
], 200);
|
], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||||
}
|
}
|
||||||
|
} else if (isset($data['owner']) && !empty($data['owner'])) {
|
||||||
|
|
||||||
|
$vehicle_data = [
|
||||||
|
'vehicle_no' => $data['vehicle_no'],
|
||||||
|
'type' => $data['type'],
|
||||||
|
'rc' => $data['rc'],
|
||||||
|
'branch_id' => $data['branch_id'] ?? null,
|
||||||
|
'owner' => $data['owner'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$vehicle_insert = $this->vehicleModel->insert($vehicle_data);
|
||||||
|
|
||||||
|
if ($vehicle_insert) {
|
||||||
|
|
||||||
|
return $this->respond([
|
||||||
|
'status' => true,
|
||||||
|
'vehicle_id' => $vehicle_insert,
|
||||||
|
'data' => $data,
|
||||||
|
'message' => 'Vehicle created successfully'
|
||||||
|
], 200);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1390,8 +1390,12 @@ $(document).ready(function(){
|
|||||||
// var myModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
// var myModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
||||||
// myModal.show();
|
// myModal.show();
|
||||||
|
|
||||||
// $(this).val('').select2();
|
$(this).val('').select2();
|
||||||
|
$('#client_type').removeClass('readonly-select ');;
|
||||||
appendVehicleForm();
|
appendVehicleForm();
|
||||||
|
}else{
|
||||||
|
$('#client_type').prop('disabled', true);
|
||||||
|
$('#client_type').addClass('readonly-select ');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1483,6 +1487,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
$('#policy_type_id').change(function() {
|
$('#policy_type_id').change(function() {
|
||||||
|
|
||||||
|
$('#vehicle_no').val("").select2();
|
||||||
$('#client_type').val('');
|
$('#client_type').val('');
|
||||||
$('#client_id').val('').select2();
|
$('#client_id').val('').select2();
|
||||||
$('#client_branch_id').val('').select2();
|
$('#client_branch_id').val('').select2();
|
||||||
@ -2951,12 +2956,12 @@ function appendOwner(data) {
|
|||||||
text: 'Select Owner'
|
text: 'Select Owner'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$('#owner').append(
|
// $('#owner').append(
|
||||||
$('<option>', {
|
// $('<option>', {
|
||||||
value: 'add_client',
|
// value: 'add_client',
|
||||||
text: ' + Add Owner',
|
// text: ' + Add Owner',
|
||||||
})
|
// })
|
||||||
);
|
// );
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
@ -3450,7 +3455,7 @@ $("#vehicle_form").submit(function(event) {
|
|||||||
|
|
||||||
isVehicleFormSubmitting = true;
|
isVehicleFormSubmitting = true;
|
||||||
|
|
||||||
form_action = '<?= base_url("util/createVehicleWithMinimalData"); ?>';
|
form_action = '<?= base_url("util/createVehicleWithMinimalDataForBDS"); ?>';
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
@ -3818,12 +3823,12 @@ $('#Owner_type').on('change', function() {
|
|||||||
text: 'Select Owner'
|
text: 'Select Owner'
|
||||||
}))
|
}))
|
||||||
|
|
||||||
$('#owner').append(
|
// $('#owner').append(
|
||||||
$('<option>', {
|
// $('<option>', {
|
||||||
value: 'add_client',
|
// value: 'add_client',
|
||||||
text: ' + Add Owner',
|
// text: ' + Add Owner',
|
||||||
})
|
// })
|
||||||
);
|
// );
|
||||||
|
|
||||||
// Populate client options based on selected client type
|
// Populate client options based on selected client type
|
||||||
if (selectedClientType) {
|
if (selectedClientType) {
|
||||||
@ -4936,6 +4941,7 @@ $('#new_vehicle_switch').change(function () {
|
|||||||
|
|
||||||
function toggleClient(input) {
|
function toggleClient(input) {
|
||||||
let btn = $("#vehicle_client_btn");
|
let btn = $("#vehicle_client_btn");
|
||||||
|
let client_type = $('#client_type').val();
|
||||||
|
|
||||||
// if (btn.text().trim() === "New Client") {
|
// if (btn.text().trim() === "New Client") {
|
||||||
// btn.text("Existing Client");
|
// btn.text("Existing Client");
|
||||||
@ -4960,17 +4966,41 @@ function toggleClient(input) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if($(input).is(":checked")){
|
if($(input).is(":checked")){
|
||||||
|
|
||||||
|
if(client_type == 1){
|
||||||
$('.new_client').show();
|
$('.new_client').show();
|
||||||
$('.old_client').hide();
|
$('.old_client').hide();
|
||||||
$(".old_client").find("select, input, textarea").val("").prop("required", false);
|
$(".old_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
$(".new_client").find("select, input, textarea").val("").prop("required", true);
|
$(".new_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
}else{
|
||||||
|
$('.new_client').show();
|
||||||
|
$('.old_client').hide();
|
||||||
|
$(".old_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
$(".new_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
$('.v_group_client').hide();
|
||||||
|
$('.v_individual_client').show();
|
||||||
|
$(".v_group_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
$(".v_individual_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
}
|
||||||
|
|
||||||
$('#owner').select2();
|
$('#owner').select2();
|
||||||
$('#owner_branch').select2();
|
$('#owner_branch').select2();
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
|
if(client_type == 1){
|
||||||
|
$('.new_client').hide();
|
||||||
|
$('.old_client').show();
|
||||||
|
$(".old_client").find("select, input, textarea").prop("required", true);
|
||||||
|
$(".new_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
}else{
|
}else{
|
||||||
$('.new_client').hide();
|
$('.new_client').hide();
|
||||||
$('.old_client').show();
|
$('.old_client').show();
|
||||||
$(".old_client").find("select, input, textarea").prop("required", true);
|
$(".old_client").find("select, input, textarea").prop("required", true);
|
||||||
$(".new_client").find("select, input, textarea").val("").prop("required", false);
|
$(".new_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
$('.old_group_client').hide();
|
||||||
|
$(".old_group_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
}
|
||||||
$('#owner').select2();
|
$('#owner').select2();
|
||||||
$('#owner_branch').select2();
|
$('#owner_branch').select2();
|
||||||
}
|
}
|
||||||
@ -4978,6 +5008,7 @@ function toggleClient(input) {
|
|||||||
|
|
||||||
function removeVehicleForm(){
|
function removeVehicleForm(){
|
||||||
$('#vehicle_row_div').empty();
|
$('#vehicle_row_div').empty();
|
||||||
|
$('#client_type').addClass('readonly-select ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeClientForm(){
|
function removeClientForm(){
|
||||||
@ -4989,6 +5020,8 @@ function getVehicleFormData() {
|
|||||||
console.log("🔹 Collecting Vehicle Form Data...");
|
console.log("🔹 Collecting Vehicle Form Data...");
|
||||||
let vhno = $('#modal_vehicle_no').val();
|
let vhno = $('#modal_vehicle_no').val();
|
||||||
let rc = $('#rc').val();
|
let rc = $('#rc').val();
|
||||||
|
let client_type = $('#client_type').val();
|
||||||
|
|
||||||
|
|
||||||
if (vhno === "" && rc === "") {
|
if (vhno === "" && rc === "") {
|
||||||
toastr.warning("Please enter any one of these: Vehicle No or Chassis No", "WARNING");
|
toastr.warning("Please enter any one of these: Vehicle No or Chassis No", "WARNING");
|
||||||
@ -5012,10 +5045,11 @@ function getVehicleFormData() {
|
|||||||
console.log("✅ Added field:", name, "=", value);
|
console.log("✅ Added field:", name, "=", value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
data["client_type"] = client_type;
|
||||||
|
|
||||||
console.log("📌 Final Data Object:", data);
|
console.log("📌 Final Data Object:", data);
|
||||||
|
|
||||||
let url = '<?= base_url("util/createVehicleWithMinimalData"); ?>';
|
let url = '<?= base_url("util/createVehicleWithMinimalDataForBDS"); ?>';
|
||||||
|
|
||||||
// Send AJAX request
|
// Send AJAX request
|
||||||
sendAjaxRequestForGlobal(url, 'POST', data, function(response) {
|
sendAjaxRequestForGlobal(url, 'POST', data, function(response) {
|
||||||
@ -5023,20 +5057,20 @@ function getVehicleFormData() {
|
|||||||
|
|
||||||
if (response.status == true) {
|
if (response.status == true) {
|
||||||
toastr.success(response.message, 'SUCCESS');
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
getClientAndBranchAndPolicy();
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message, 'WARNING');
|
toastr.warning(response.message, 'WARNING');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#client_row_div').empty();
|
$('#client_row_div').empty();
|
||||||
$('#vehicle_row_div').empty();
|
$('#vehicle_row_div').empty();
|
||||||
|
$('#client_type').addClass('readonly-select ');
|
||||||
|
|
||||||
}, function(xhr, status, error) {
|
}, function(xhr, status, error) {
|
||||||
console.error('Error fetching data:', error);
|
console.error('Error fetching data:', error);
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
|
toastr.error('An error occurred while checking the CD amount.', 'ERROR');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getClientFormData() {
|
function getClientFormData() {
|
||||||
@ -5073,6 +5107,7 @@ function getClientFormData() {
|
|||||||
|
|
||||||
if (response.status == true) {
|
if (response.status == true) {
|
||||||
toastr.success(response.message, 'SUCCESS');
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
getClientAndBranchAndPolicy()
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(response.message, 'WARNING');
|
toastr.warning(response.message, 'WARNING');
|
||||||
}
|
}
|
||||||
@ -5105,9 +5140,13 @@ function appendVehicleForm(){
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="form-group col-md-3 mt-3">
|
<div class="form-group col-md-3">
|
||||||
<!-- <label for="vehicle_client_btn">Client</label> -->
|
<label class="switch" style="position: relative;top: 32px;left: 20px;">
|
||||||
<input id="vehicle_client_btn" type="checkbox" name="new_vehicle" value="1" data-toggle="toggle" data-off="Existing Client" data-on="Add Client" data-onstyle="info" data-offstyle="primary" data-style="border" data-width="218" onchange="toggleClient(this)">
|
<input id="vehicle_client_btn" type="checkbox" name="vehicle_client_btn" onchange="toggleClient(this)">
|
||||||
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label for="vehicle_client_btn" style="position: relative;top: 33px;left: 25px;"> New Client </label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
@ -5145,47 +5184,47 @@ function appendVehicleForm(){
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 old_client">
|
<div class="form-group col-md-3 old_client old_group_client">
|
||||||
<label for="owner_branch">Branch <span class="text-danger">*</span></label>
|
<label for="owner_branch">Branch <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="owner_branch" name="branch_id">
|
<select class="form-control" id="owner_branch" name="branch_id">
|
||||||
<option value="">Select Branch</option>
|
<option value="">Select Branch</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 new_client" style="display: none;">
|
<div class="form-group col-md-3 v_common new_client" style="display: none;">
|
||||||
<label for="client_name">Client Name <span class="text-danger">*</span></label>
|
<label for="client_name">Client Name <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="client_name" name="client_name">
|
<input type="text" class="form-control" id="client_name" name="client_name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 group_client new_client" style="display: none;">
|
<div class="form-group col-md-3 v_group_client new_client" style="display: none;">
|
||||||
<label for="short_name">Client Short Name <span class="text-danger">*</span></label>
|
<label for="short_name">Client Short Name <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="short_name" name="short_name"
|
<input type="text" class="form-control" id="short_name" name="short_name"
|
||||||
onkeyup="validateInputForClient(this, 'clients', 'short_name')">
|
onkeyup="validateInputForClient(this, 'clients', 'short_name')">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 group_client new_client" style="display: none;">
|
<div class="form-group col-md-3 v_group_client new_client" style="display: none;">
|
||||||
<label for="branch_name">Branch Name <span class="text-danger">*</span></label>
|
<label for="branch_name">Branch Name <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="branch_name" name="branch_name">
|
<input type="text" class="form-control" id="branch_name" name="branch_name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 group_client new_client" style="display: none;">
|
<div class="form-group col-md-3 v_group_client new_client" style="display: none;">
|
||||||
<label for="contact_name">Contact Name <span class="text-danger">*</span></label>
|
<label for="contact_name">Contact Name <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="contact_name" name="name">
|
<input type="text" class="form-control" id="contact_name" name="name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 new_client" style="display: none;">
|
<div class="form-group col-md-3 v_common new_client" style="display: none;">
|
||||||
<label for="email">Email <span class="text-danger">*</span></label>
|
<label for="email">Email <span class="text-danger">*</span></label>
|
||||||
<input type="email" class="form-control" id="email" name="email"
|
<input type="email" class="form-control" id="email" name="email"
|
||||||
placeholder="Enter Email">
|
placeholder="Enter Email">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 new_client" style="display: none;">
|
<div class="form-group col-md-3 new_client v_individual_client" style="display: none;">
|
||||||
<label for="mobile">Mobile <span class="text-danger">*</span></label>
|
<label for="mobile">Mobile <span class="text-danger">*</span></label>
|
||||||
<input type="number" class="form-control" id="mobile" name="mobile"
|
<input type="number" class="form-control" id="mobile" name="mobile"
|
||||||
placeholder="Enter Mobile">
|
placeholder="Enter Mobile">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 group_client new_client" style="display: none;">
|
<div class="form-group col-md-3 v_group_client new_client" style="display: none;">
|
||||||
<label for="gst">GST <span class="text-danger">*</span></label>
|
<label for="gst">GST <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="gst" name="gst"
|
<input type="text" class="form-control" id="gst" name="gst"
|
||||||
placeholder="Enter GST Number"
|
placeholder="Enter GST Number"
|
||||||
@ -5205,6 +5244,36 @@ function appendVehicleForm(){
|
|||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
$('#vehicle_row_div').append(html);
|
$('#vehicle_row_div').append(html);
|
||||||
|
appendOwner(client_list);
|
||||||
|
$('#owner').select2();
|
||||||
|
$('#owner_branch').select2();
|
||||||
|
|
||||||
|
$("#vehicle_form_row_div").on("input change", "input, select, textarea", function () {
|
||||||
|
if ($("#client_type").val() === "") {
|
||||||
|
alert("Please select the client type first");
|
||||||
|
if ($(this).is(":checkbox")) {
|
||||||
|
// uncheck checkbox
|
||||||
|
$(this).prop("checked", false);
|
||||||
|
} else {
|
||||||
|
// clear text/select/textarea
|
||||||
|
$(this).val("");
|
||||||
|
}
|
||||||
|
$("#client_type").focus(); // focus back to client_type
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#owner').change(function(){
|
||||||
|
|
||||||
|
let owner_id = $(this).val();
|
||||||
|
console.log('owner_id', owner_id);
|
||||||
|
if(branch_list != '') {
|
||||||
|
// console.log(branch_list[client_id]);
|
||||||
|
let data = branch_list[owner_id];
|
||||||
|
appendOwnerBranch(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendClientForm(){
|
function appendClientForm(){
|
||||||
@ -5294,24 +5363,6 @@ function appendClientForm(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#client_type').on('change', function() {
|
|
||||||
|
|
||||||
let client_type = $(this).val();
|
|
||||||
|
|
||||||
if(client_type == 1){
|
|
||||||
$('.group_client').show();
|
|
||||||
$('.individual_client').hide();
|
|
||||||
$(".group_client").find("select, input, textarea").val("").prop("required", true);
|
|
||||||
$(".individual_client").find("select, input, textarea").val("").prop("required", false);
|
|
||||||
}else{
|
|
||||||
$('.group_client').hide();
|
|
||||||
$('.individual_client').show();
|
|
||||||
$(".group_client").find("select, input, textarea").val("").prop("required", false);
|
|
||||||
$(".individual_client").find("select, input, textarea").val("").prop("required", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function validateInputForClient(input, table, field) {
|
function validateInputForClient(input, table, field) {
|
||||||
|
|
||||||
let owner_type = $('#Owner_type').val();
|
let owner_type = $('#Owner_type').val();
|
||||||
@ -5351,4 +5402,85 @@ function validateInputForClient(input, table, field) {
|
|||||||
$('#hide_smbt_btn button').prop('disabled', false);
|
$('#hide_smbt_btn button').prop('disabled', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#client_type').on('change', function() {
|
||||||
|
|
||||||
|
let client_type = $(this).val();
|
||||||
|
|
||||||
|
if(client_type == 1){
|
||||||
|
$('.group_client').show();
|
||||||
|
$('.individual_client').hide();
|
||||||
|
$(".group_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
$(".individual_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
}else{
|
||||||
|
$('.group_client').hide();
|
||||||
|
$('.individual_client').show();
|
||||||
|
$(".group_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
$(".individual_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#client_type').on('change', function() {
|
||||||
|
|
||||||
|
let btn = $("#vehicle_client_btn");
|
||||||
|
let client_type = $(this).val();
|
||||||
|
|
||||||
|
if(client_type == 1){
|
||||||
|
|
||||||
|
if(btn.is(':checked')){
|
||||||
|
$('.v_group_client').show();
|
||||||
|
$('.v_individual_client').hide();
|
||||||
|
$(".v_group_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
$(".v_individual_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
}else{
|
||||||
|
$('.v_group_client').hide();
|
||||||
|
$('.v_individual_client').hide();
|
||||||
|
$(".v_group_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
$(".v_individual_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
|
||||||
|
$('.old_group_client').show();
|
||||||
|
$(".old_group_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
$(".v_common").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
if(btn.is(':checked')){
|
||||||
|
$('.v_group_client').hide();
|
||||||
|
$('.v_individual_client').show();
|
||||||
|
$(".v_group_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
$(".v_individual_client").find("select, input, textarea").val("").prop("required", true);
|
||||||
|
}else{
|
||||||
|
$('.v_group_client').hide();
|
||||||
|
$('.v_individual_client').hide();
|
||||||
|
$(".v_group_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
$(".v_individual_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
|
||||||
|
$('.old_group_client').hide();
|
||||||
|
$(".old_group_client").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
$(".v_common").find("select, input, textarea").val("").prop("required", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(client_list, function(index, item) {
|
||||||
|
if (item.client_type == client_type) {
|
||||||
|
|
||||||
|
let client_show_name = item.client_name;
|
||||||
|
if (item.client_type == 2) {
|
||||||
|
// client_show_name = item.client_name + ' - ' + (item.dob ?? '') + (item.pan ?? '');
|
||||||
|
client_show_name = item.client_name + (item.dob ? ('- (' + item.dob + ' )' ) : '') + (item.pan ? ('- ' + item.pan ) : '');
|
||||||
|
}
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: client_show_name,
|
||||||
|
'data-cn': item.client_name,
|
||||||
|
'data-ct': item.client_type
|
||||||
|
});
|
||||||
|
$('#owner').append(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -718,7 +718,7 @@ function getClientAndBranchAndPolicy()
|
|||||||
unit_list = res.unit_data;
|
unit_list = res.unit_data;
|
||||||
appendClients(res.client_data);
|
appendClients(res.client_data);
|
||||||
appendVehicles(res.vehicle_data);
|
appendVehicles(res.vehicle_data);
|
||||||
appendOwner(client_list)
|
// appendOwner(client_list)
|
||||||
}else{
|
}else{
|
||||||
console.log('No data found');
|
console.log('No data found');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user