290 lines
17 KiB
PHP
290 lines
17 KiB
PHP
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="header-title"><?= $page_name; ?></h4>
|
|
<?php if ($page_name === 'Edit Customer Details') : ?>
|
|
<ul class="nav nav-tabs" id="customerTabs" role="tablist">
|
|
<li class="nav-item">
|
|
<a class="nav-link active" id="customerDetails-tab" data-toggle="tab" href="#customerDetails" role="tab" aria-controls="customerDetails" aria-selected="true">Customer Details</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" id="subscriptionDetails-tab" data-toggle="tab" href="#subscriptionDetails" role="tab" aria-controls="subscriptionDetails" aria-selected="false">Subscription Details</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" id="invoiceDetails-tab" data-toggle="tab" href="#invoiceDetails" role="tab" aria-controls="invoiceDetails" aria-selected="false">Invoice Details</a>
|
|
</li>
|
|
</ul>
|
|
<?php endif; ?>
|
|
<div class="tab-content">
|
|
|
|
<!-- Customer Details Tab -->
|
|
<div class="tab-pane fade show active" id="customerDetails" role="tabpanel" aria-labelledby="customerDetails-tab">
|
|
<!-- Customer details form fields -->
|
|
<form class="parsley-examples" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_donor"; ?>" id="myForm" name="myForm">
|
|
<!-- <img src="<?= base_url() . "public/assets/images/plugins/loading.gif" ?>" alt="loader1" style="display:none; height:30px; width:auto;" id="loaderImg"> -->
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="DonorType" class="col-form-label">Donor Type<span class="text-danger"> *</span></label>
|
|
<select class="form-control" id="DonorType" name="DonorType" required>
|
|
<option value="" disabled>Select Donor Type</option>
|
|
<option value="option1" <?= isset($customer['donor_type']) && $customer['donor_type'] === 'option1' ? 'selected' : '' ?>>Individual</option>
|
|
<option value="option2" <?= isset($customer['donor_type']) && $customer['donor_type'] === 'option2' ? 'selected' : '' ?>>Organization</option>
|
|
|
|
</select>
|
|
<div class="invalid-feedback">Please provide.</div>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4" id="org_reg">
|
|
<label for="csname" class="col-form-label">Organization Name<span class="text-danger"> *</span></label>
|
|
<input type="text" class="form-control" id="org_name_field" name="org_name" value="<?= isset($customer['org_name']) ? $customer['org_name'] : '' ?>" placeholder="Organization Name"/>
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-4" id="org_name">
|
|
<label for="csname" class="col-form-label">Organization Reg Details<span class="text-danger"> *</span></label>
|
|
<input type="text" class="form-control" id="org_reg_details" name="org_reg_Details" value="<?= isset($customer['org_reg_Details']) ? $customer['org_reg_Details'] : '' ?>" placeholder="Organization Reg details"/>
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="cfname" class="col-form-label"><span class="contactPerson">Contact Person </span>First Name<span class="text-danger"> *</span></label>
|
|
<input type="text" class="form-control" id="cfname" name="cfname" value="<?= isset($customer['first_name']) ? $customer['first_name'] : '' ?>" placeholder="First Name" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="csname" class="col-form-label"><span class="contactPerson">Contact Person </span>Last Name<span class="text-danger"> *</span></label>
|
|
<input type="text" class="form-control" name="csname" value="<?= isset($customer['last_name']) ? $customer['last_name'] : '' ?>" placeholder="Last Name" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
|
|
<div class="form-group col-md-4">
|
|
<label for="cmobile" class="col-form-label"><span class="contactPerson">Contact Person </span>Mobile<span class="text-danger"> *</span></label>
|
|
<div class="input-group mb-2">
|
|
<!-- <div class="input-group-prepend"> -->
|
|
<div class="input-group-text">+91</div>
|
|
<!-- </div> -->
|
|
<input name="mobile"class="form-control" pattern="[0-9]{10}" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" type="tel" data-parsley-type="number" data-parsley-length="[10,10]" class="form-control" placeholder="Enter Contact Mobile" id="mobile" maxlength="10" onkeypress = "return onlyNumbers(event)" style="width: 80% !important;" required>
|
|
|
|
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="cmail" class="col-form-label"><span class="contactPerson">Contact Person </span>Email</label>
|
|
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" />
|
|
<span id="emailValidationMessage"></span>
|
|
</div>
|
|
|
|
<!-- <div class="form-group col-md-4">
|
|
<label for="dob" class="col-form-label">Date Of Birth</label>
|
|
<input type="date" class="form-control" name="dob" value="" placeholder="Date Of Birth" />
|
|
</div> -->
|
|
|
|
<div class="form-group col-md-4">
|
|
<label for="csname" class="col-form-label"><span class="contactPerson">Organization </span> PAN Number <i class="text-danger contactPerson"> *</i> </label>
|
|
<input type="text" class="form-control" id="pan_no"name="pan_no" required value="<?= isset($customer['pan_no']) ? $customer['pan_no'] : '' ?>" placeholder="PAN Number" />
|
|
</div>
|
|
<div class="form-group col-md-4" id="adhar_no_individual">
|
|
<label for="csname" class="col-form-label"><span class="contactPerson"> </span>Adhar Number</label>
|
|
<input type="text" class="form-control" id="adhar_no" name="adhar_no" value="<?= isset($customer['adhar_no']) ? $customer['adhar_no'] : '' ?>" placeholder="Adhar Number" />
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<input type="hidden" id="donor_id" name="donor_id" placeholder="hidden for Donor id" value="<?= isset($customer['donor_id']) ? $customer['donor_id'] : '' ?>" />
|
|
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
|
<br />
|
|
|
|
|
|
<div class="after-add-more">
|
|
<hr />
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="baddress1" class="col-form-label">Address</label>
|
|
<textarea type="text" class="form-control" id="baddress1" name="address" placeholder="Address (eg : 1234 Main St)" style="width:202%" ><?= isset($customer['address']) ? $customer['address'] : '' ?></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label for="bcountry" class="col-form-label">Country</label>
|
|
<select class="form-control" id="bcountry" name="country">
|
|
<option value="<?= isset($customer['country']) ? $customer['country'] : '';?>"><?= isset($customer['country']) ? $customer['country'] : 'Choose your Country';?></option>
|
|
<?php foreach ($country_details as $value) { ?>
|
|
<option value="<?php echo $value['country_name']; ?>">
|
|
<?php
|
|
echo $value['country_name'];
|
|
?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<div id="billinput" style="display: block">
|
|
<label for="bistate" class="col-form-label">State</label>
|
|
<input type="text" class="form-control" id="bistate" name="state_text" placeholder="State" value="<?= isset($customer['state']) ? $customer['state'] : ''?>"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="bcity" class="col-form-label">City</label>
|
|
<input type="text" class="form-control" id="bcity" name="city" value="<?= isset($customer['city']) ? $customer['city'] : '' ?>" placeholder="City" />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="bzip" class="col-form-label">Postal Code</label>
|
|
<input type="text" class="form-control" id="bzip" name="zip" value="<?= isset($customer['postal_code']) ? $customer['postal_code'] : '' ?>" placeholder="Postal Code" pattern="\d*" maxlength="10" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
|
|
<?php if (!empty($customer)) { ?>
|
|
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
|
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($customer) && $customer['isactive'] == 1 ? 'checked' : '' ?>>
|
|
<label for="isactive"> Is Active</label>
|
|
</div>
|
|
<br>
|
|
<?php } ?>
|
|
|
|
|
|
<div class="form-group text-right m-b-0">
|
|
|
|
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" type="submit"><?= isset($customer['donor_id']) ? 'Update' : 'Submit' ?></button>
|
|
<button type="reset" class="btn btn-primary waves-effect mr-1">Reset</button>
|
|
<a href="<?= base_url() . "Donor_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
|
</div>
|
|
</form>
|
|
|
|
</div><!-- end customer Details Tab -->
|
|
</div><!-- end tab-content-->
|
|
</div><!-- end card-body-->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
document.getElementById('myForm').addEventListener('submit', function(event) {
|
|
var form = event.target;
|
|
|
|
if (form.checkValidity() === false) {
|
|
|
|
form.reportValidity(); // Display validation error messages
|
|
event.preventDefault(); // Prevent form submission if it's not valid
|
|
$('#submitBtn').prop('disabled', false);
|
|
} else {
|
|
|
|
$('#submitBtn').prop('disabled', true);
|
|
}
|
|
});
|
|
</script>
|
|
<script>
|
|
function onlyNumbers(event){
|
|
var charcode;
|
|
charcode = event.which || event.keyCode;
|
|
if(charcode>= 48 && charcode <= 57)return true;
|
|
return false;
|
|
}
|
|
function validateEmail(email) {
|
|
// Regular expression for a Gmail, Yahoo, or Hotmail email address validation
|
|
var emailPattern = /^[a-zA-Z0-9._%+-]+@(gmail\.com|yahoo\.com|hotmail\.com|email\.com)$/;
|
|
|
|
var emailInput = document.getElementById("cmail");
|
|
var validationMessage = document.getElementById("emailValidationMessage");
|
|
|
|
if (emailPattern.test(email)) {
|
|
validationMessage.textContent = "";
|
|
} else if (email == "") {
|
|
validationMessage.textContent = "";
|
|
} else {
|
|
validationMessage.textContent = "Invalid email address.";
|
|
validationMessage.style.color = "red";
|
|
}
|
|
}
|
|
|
|
</script>
|
|
<script>
|
|
function restriction(event) {
|
|
var charCode = event.which || event.keyCode;
|
|
if ((charCode >= 48 && charCode <= 57)) {
|
|
return true;
|
|
} else {
|
|
event.preventDefault(); // Prevent the character from being entered
|
|
return false;
|
|
}
|
|
}
|
|
$(document).ready(function() {
|
|
// Initial setup based on donor type
|
|
updateDonorTypeFields();
|
|
|
|
// Handle changes in donor type
|
|
$('#DonorType').on('change', function(){
|
|
updateDonorTypeFields();
|
|
});
|
|
|
|
// Validate Aadhar number on input
|
|
$('#adhar_no').on('input', function(){
|
|
validateAdharNumber($(this).val());
|
|
});
|
|
|
|
// Validate PAN number on input
|
|
$('#pan_no').on('input', function(){
|
|
validatePANNumber($(this).val());
|
|
});
|
|
|
|
function updateDonorTypeFields() {
|
|
let DonorType = $('#DonorType').val();
|
|
|
|
// Organization type selected
|
|
if (DonorType === 'option2') {
|
|
$('#org_name').show();
|
|
$('#org_reg').show();
|
|
$('.contactPerson').show();
|
|
$('#adhar_no_individual').hide();
|
|
$('#org_name_field').prop('required', true);
|
|
$('#org_reg_details').prop('required', true);
|
|
$('#pan_no').prop('required', true);
|
|
}
|
|
// Individual type selected
|
|
else {
|
|
$('#adhar_no_individual').show();
|
|
$('#org_name').hide();
|
|
$('#org_reg').hide();
|
|
$('.contactPerson').hide();
|
|
$('#pan_no').prop('required', false);
|
|
}
|
|
}
|
|
|
|
function validateAdharNumber(adharNumber) {
|
|
let adharPattern = /^\d{12}$/;
|
|
|
|
if (!adharPattern.test(adharNumber)) {
|
|
$('#adhar_no').addClass('is-invalid');
|
|
} else {
|
|
$('#adhar_no').removeClass('is-invalid');
|
|
}
|
|
}
|
|
|
|
function validatePANNumber(panNumber) {
|
|
let panPattern = /^[A-Z]{5}[0-9]{4}[A-Z]$/;
|
|
|
|
if (!panPattern.test(panNumber)) {
|
|
$('#pan_no').addClass('is-invalid');
|
|
} else {
|
|
$('#pan_no').removeClass('is-invalid');
|
|
}
|
|
}
|
|
});
|
|
</script>
|