220 lines
12 KiB
PHP
220 lines
12 KiB
PHP
<div class="tab-pane fade active show" id="general-q-tab">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card-body">
|
|
<form role="form" class="parsley-examples" method="post" id="general_form" enctype="multipart/form-data">
|
|
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
|
<input type="hidden" name="PrimaryKey" id="general_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
|
<input type="hidden" name="client_id" id="client_id" />
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="entity_type_id">Entity Type <span
|
|
class="text-danger">*</span></label>
|
|
<select class="form-control" id="entity_type" name="entity_type_id" required>
|
|
<option value="">Select Entity</option>
|
|
<?php foreach($entity as $value) { ?>
|
|
<?php if(isset($client['entity_type_id'])){ ?>
|
|
<?php if($value['id'] == $client['entity_type_id']) { ?>
|
|
<option value="<?= $value['id'] ?>" selected><?= $value['name'] ?></option>
|
|
<?php } else { ?>
|
|
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
|
<?php } ?>
|
|
<?php } else { ?>
|
|
<option value="<?= $value['id'] ?>"><?= $value['name'] ?></option>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="client_name">Client Name<span
|
|
class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="client_name"
|
|
placeholder="Enter Client Name" value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>" name="client_name" required>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="short_name">Client Short Name<span
|
|
class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="short_name"
|
|
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" required>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="pan">PAN<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="pan"
|
|
placeholder="Enter PAN Number" value="<?= isset($client['pan']) ? $client['pan'] : '' ?>" name="pan" data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$" required>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="gst">GST<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="gst"
|
|
placeholder="Enter GST Number" value="<?= isset($client['gst']) ? $client['gst'] : '' ?>" name="gst" data-parsley-trigger="change" data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
|
</div>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="address1">Address 1<span
|
|
class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="address1"
|
|
placeholder="Enter Address 1" value="<?= isset($client['address1']) ? $client['address1'] : '' ?>" name="address1" required>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="address2">Address 2<span
|
|
class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="address2"
|
|
placeholder="Enter Address 2" value="<?= isset($client['address2']) ? $client['address2'] : '' ?>" name="address2" required>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="city">City<span
|
|
class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="city"
|
|
placeholder="Enter City" value="<?= isset($client['city']) ? $client['city'] : '' ?>" name="city" required>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="state">State<span
|
|
class="text-danger">*</span></label>
|
|
<select class="form-control" id="state" name="state" required>
|
|
<option value="">Select State</option>
|
|
<?php foreach($state as $value) { ?>
|
|
<?php if(isset($client['state'])){ ?>
|
|
<?php if($value['id'] == $client['state']) { ?>
|
|
<option value="<?= $value['id'] ?>" selected><?= $value['state'] ?></option>
|
|
<?php } else { ?>
|
|
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
|
|
<?php } ?>
|
|
<?php } else { ?>
|
|
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="pincode">Pincode<span
|
|
class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="pincode"
|
|
placeholder="Enter Pincode" onkeypress = "return onlyNumbers(event)" value="<?= isset($client['pincode']) ? $client['pincode'] : '' ?>" name="pincode" maxlength="6" required>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group text-right m-b-0">
|
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
|
id="btnSubmit">Submit</button>
|
|
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
|
id="btnBack">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div> <!-- end col-->
|
|
</div>
|
|
</div>
|
|
<!-- end -->
|
|
|
|
<script>
|
|
|
|
var PrimaryKey = $('#general_PrimaryKey').val();
|
|
var form_action = '';
|
|
|
|
$(document).ready(function () {
|
|
|
|
$("#general_form").submit(function(event) {
|
|
|
|
event.preventDefault();
|
|
var isValid = $('#general_form').parsley().validate();
|
|
if (!isValid) {
|
|
console.log('Form is Empty', 'Warning');
|
|
return ;
|
|
}
|
|
|
|
if(PrimaryKey === ''){
|
|
form_action = '<?= base_url("client/general/create"); ?>';
|
|
}else{
|
|
form_action = '<?= base_url("client/general/edit"); ?>';
|
|
}
|
|
|
|
var formData = new FormData($('#general_form')[0]);
|
|
var OptionsHTML1 = ''
|
|
|
|
$.ajax({
|
|
data: formData,
|
|
url: form_action,
|
|
type: "POST",
|
|
dataType: 'json',
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(res) {
|
|
|
|
console.log(res);
|
|
$('#client_id').val(res.data.id);
|
|
$('#client_id_relation').val(res.data.id);
|
|
$('#relation_PrimaryKey').val(res.data.id);
|
|
$('#client_id_branch').val(res.data.id);
|
|
$('#branch_PrimaryKey').val(res.data.id);
|
|
$('#client_id_policy').val(res.data.id);
|
|
$('#policy_PrimaryKey').val(res.data.id);
|
|
$('#client_id_kyc').val(res.data.id);
|
|
$('#kyc_PrimaryKey').val(res.data.id);
|
|
$('#entity_type').val(res.data.entity_type_id);
|
|
$('#kyc_tab').click();
|
|
|
|
var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
|
|
toastr.success(message, 'Success');
|
|
|
|
$.ajax({
|
|
url: '<?= base_url("client/kyc/list/"); ?>' + res.data.entity_type_id,
|
|
type: "GET",
|
|
dataType: 'json',
|
|
processData: false,
|
|
contentType: false,
|
|
success: function (res) {
|
|
|
|
console.log(res);
|
|
var tbody = $('#tbody');
|
|
tbody.empty();
|
|
|
|
$.each(res.data, function (index, item) {
|
|
var row = `<tr>
|
|
<td> ${item.file_name}</td>
|
|
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
|
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
|
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
|
<button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td>
|
|
<td id="name_${item.id}" style="display:none;"></td>
|
|
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
|
</tr>`;
|
|
tbody.append(row);
|
|
});
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
}
|
|
});
|
|
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
}
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
function onlyNumbers(event){
|
|
var charcode;
|
|
charcode = event.which || event.keyCode;
|
|
if(charcode>= 48 && charcode <= 57)return true;
|
|
return false;
|
|
}
|
|
|
|
|
|
</script>
|