This commit is contained in:
bitbucket 2024-02-22 11:50:28 +05:30
parent c7ae64c6aa
commit 3842ee6979
6 changed files with 51 additions and 43 deletions

View File

@ -82,6 +82,7 @@ class Customer extends BaseController
$session_role = get_user_role();
$model = new CustomerModel();
$dob = $this->request->getPost('dob');
$pan = ($this->request->getPost('pan_no') == '') ? $this->request->getPost('o_pan_no') : $this->request->getPost('pan_no');
$dob = (isset($dob) && $dob != "") ? $dob : NULL ;
$data = [
'first_name' => $this->request->getPost('cfname'),
@ -89,7 +90,7 @@ class Customer extends BaseController
'mobile_no' => $this->request->getPost('cmobile'),
'email' => $this->request->getPost('cmail'),
'date_of_birth' => $dob,
'pan_no' => $this->request->getPost('pan_no'),
'pan_no' => $pan,
'adhar_no' => $this->request->getPost('adhar_no'),
'donor_type' => $this->request->getPost('DonorType'),
@ -405,6 +406,8 @@ class Customer extends BaseController
case 'is not null':
$conditionStrings[] = "$column IS NOT NULL";
break;
case '':
throw new \Exception("Data Not Found");
}
}

View File

@ -107,7 +107,7 @@ class Invoice extends BaseController
$upt_data = $model->updateData('donations_accepted', $data, $where);
}
}
session()->setFlashdata('success', 'Causes has been added successfully.');
session()->setFlashdata('success', 'Data has been added successfully.');
return redirect()->route('donations_accepted');
}
catch (\Throwable $e)
@ -139,7 +139,7 @@ class Invoice extends BaseController
$data['currency'] = $setting_model->select('currency')->where($where)->findAll();
$data['customers'] = $model->getData('donor', $where);
// $data['causes'] = $model->getData('causes', $where);
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id() )->get()->getResult();
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id() )->where('isactive',1)->get()->getResult();
$data['campaign'] = $model->getData('campaign', $where);
$data['invoice_number_formatting'] = $model->getData('settings', $where);
@ -197,7 +197,7 @@ class Invoice extends BaseController
$this->AuditHistoryModel->save($audit_data);
/************************************* */
if($upt_data) echo true;
if($upt_data){ session()->setFlashdata('success', 'Data has been accepted successfully.');echo true; }
else echo false;
}
@ -230,7 +230,7 @@ class Invoice extends BaseController
];
$this->AuditHistoryModel->save($audit_data);
/************************************* */
session()->setFlashdata('success', 'Data has been rejected successfully.');
return redirect()->route('receipt_list');
}

View File

@ -97,7 +97,7 @@ public function getCampaignDetails(){
$group_names = [];
$group_query = [];
foreach ($group_id as $j) {
$cg_data = $this->db->table('customer_groups as CG')
$cg_data = $this->db->table('donor_groups as CG')
->select('CG.group_id, CG.group_name,CG.group_query, CG.isactive')
->where(['CG.isactive' => 1, 'CG.group_id' => $j])
->get()
@ -135,7 +135,8 @@ public function customerGroupQueryExecution($queries){
foreach ($results as $innerArray) {
foreach ($innerArray as $customer) {
$customerId = $customer->customer_id;
// echo json_encode($customer);die;
$customerId = $customer->donor_id;
// Check if the customer_id already exists in $uniqueCustomers
if (!isset($uniqueCustomers[$customerId])) {
@ -160,7 +161,7 @@ public function customerGroupQueryExecution($queries){
{
$db = \Config\Database::connect();
$query = "SELECT * FROM customer_groups WHERE group_name = 'EXPIRYDATE'";
$query = "SELECT * FROM donor_groups WHERE group_name = 'EXPIRYDATE'";
$result = $db->query($query)->getResultArray();

View File

@ -47,7 +47,7 @@
<div class="form-group col-md-4" id="org_pan_no">
<label for="csname" class="col-form-label"><span class="contactPerson">Organization PAN Number</label>
<input type="text" class="form-control" id="pan_no_org"name="pan_no" value="<?= isset($customer['pan_no']) ? $customer['pan_no'] : '' ?>" placeholder="PAN Number" />
<input type="text" class="form-control" id="pan_no_org"name="o_pan_no" value="<?= isset($customer['pan_no']) ? $customer['pan_no'] : '' ?>" placeholder="PAN Number" />
<div class="invalid-feedback"> Please provide. </div>
</div>
@ -78,8 +78,8 @@
</div>
<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)" />
<label for="cmail" class="col-form-label"><span class="contactPerson">Contact Person </span>Email<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" required />
<span id="emailValidationMessage"></span>
</div>
@ -115,13 +115,13 @@
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<label for="baddress1" class="col-form-label">Address</label>
<label for="baddress1" class="col-form-label">Address<span class="text-danger"> *</span></label>
<textarea type="text" class="form-control" id="baddress1" name="address" placeholder="Address (eg : 1234 Main St)" style="width:202%" required><?= 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>
<label for="bcountry" class="col-form-label">Country<span class="text-danger"> *</span></label>
<select class="form-control" id="bcountry" name="country"required>
<option value="<?= isset($customer['country']) ? $customer['country'] : '';?>"><?= isset($customer['country']) ? $customer['country'] : 'Choose your Country';?></option>
<?php foreach ($country_details as $value) { ?>
@ -135,17 +135,17 @@
</div>
<div class="form-group col-md-3">
<div id="billinput" style="display: block">
<label for="bistate" class="col-form-label">State</label>
<label for="bistate" class="col-form-label">State<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bistate" name="state_text"required 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>
<label for="bcity" class="col-form-label">City<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bcity" name="city" required 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>
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bzip" name="zip" required value="<?= isset($customer['postal_code']) ? $customer['postal_code'] : '' ?>" placeholder="Postal Code" pattern="\d*" maxlength="10" />
</div>
</div>

View File

@ -43,6 +43,7 @@
<option value="<?= $val->id ?>" <?php if ($val->is_active == 1) echo "selected"; ?> > <?= $val->name ?> </option>
<?php endforeach; ?>
</select>
<div class="invalid-feedback"> Please provide. </div>
</div>

View File

@ -15,7 +15,7 @@
</div>
<br>
<form method="POST" enctype="multipart/form-data" action="<?= base_url() . "save_invoice"; ?>" id="myForm">
<form method="POST" enctype="multipart/form-data" action="<?= base_url() . "save_invoice"; ?>" class="main-form" id="myForm">
<div class="form-group">
<div class="form-row">
@ -47,7 +47,7 @@
<select class="form-control" id="event" name="causes_id" data-toggle="select2">
<option value="">Select the Causes</option>
<?php foreach ($causes as $causesData) : if(date("Y-m-d") >= $causesData->from_date && date("Y-m-d") <= $causesData->to_date || $causesData->from_date == '' && $causesData->to_date == ''){?>
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected"; ?>><?= $causesData->name ?> ( <?= date("d-m-Y", strtotime($causesData->from_date)) ?> - <?= date("d-m-Y", strtotime($causesData->to_date)) ?> )</option>
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected"; ?> ><?= $causesData->name ?> <?= ($causesData->from_date != '') ? '('. date("d-m-Y", strtotime($causesData->from_date)) .' - '. date("d-m-Y", strtotime($causesData->to_date)).' )' : ''; ?> </option>
<?php } else {
if(isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) { ?>
<option value="<?= $causesData->causes_id ?>" <?php if (isset($receipt_details['causes_id']) && ($receipt_details['causes_id'] === $causesData->causes_id)) echo "selected disabled"; ?>><?= $causesData->name ?> ( <?= date("d-m-Y", strtotime($causesData->from_date)) ?> - <?= date("d-m-Y", strtotime($causesData->to_date)) ?> )</option>
@ -100,12 +100,12 @@
<div class="form-group col-md-3">
<label for="invoiceDate" class="col-form-label">Payment Mode<span class="text-danger"> *</span></label>
<select class="form-control" id="paymentMode" name="payment_mode" required>
<option value="<?= isset($receipt_details['payment_mode']) ? $receipt_details['payment_mode'] : null ;?>"><?= isset($receipt_details['payment_mode']) ? $receipt_details['payment_mode'] : 'Select Payment Mode' ; ?></option>
<option value="credit">Credit Card</option>
<option value="debit">Debit Card</option>
<option value="cash">Cash</option>
<option value="upi">UPI</option>
<option value="banktransfer">Bank Transfer</option>
<option value="" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == '' ) { echo 'selected'; } ?> >Select Payment Mode</option>
<option value="credit" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'credit' ) { echo 'selected'; } ?>>Credit Card</option>
<option value="debit" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'debit' ) { echo 'selected'; } ?>>Debit Card</option>
<option value="cash" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'cash' ) { echo 'selected'; } ?>>Cash</option>
<option value="upi" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'upi' ) { echo 'selected'; } ?>>UPI</option>
<option value="banktransfer" <?php if( isset($receipt_details['payment_mode']) && $receipt_details['payment_mode'] == 'banktransfer' ) { echo 'selected'; } ?>>Bank Transfer</option>
</select>
</div>
<div class="form-group col-md-3">
@ -192,11 +192,30 @@ $(function() {
$(function() {
$('#form-submit').on('click', function(){
console.log('edakfibsefui');
$('#submitBtn').click();
// Disable the button to prevent multiple clicks
if ($('.myForm')[0].checkValidity()) {
this.disabled = true;
}
$('#submitBtn').click();
// Perform any other actions (e.g., form submission)
// For example, you can use AJAX to submit the form data
});
});
$(function() {
$('#saveDraftButton').on('click', function(){
// Check if the form is valid
if ($('.main-form')[0].checkValidity()) {
// Disable the button to prevent multiple clicks
$(this).prop('disabled', true);
// Submit the form
$('.main-form').submit();
}
});
});
// hide all fields for account login
$(function() {
@ -231,23 +250,6 @@ $(function() {
// });
}
});
// $(document).ready(function(){
// var invoiceNo = $("#invoiceNumber").val()
// if (invoiceNo != '') {
// $("#invoiceNumber").val(invoiceNo).prop("readonly", true);
// }else{
// var final_sno = "<?php
// $lastYear = date('Y') - 1;
// $currentYear = date('y');
// echo $lastYear.'-'.$currentYear.'/'.$count_receipt_no;
// ?>";
// // console.log(final_sno);
// $("#invoiceNumber").val(final_sno).prop("readonly", true);
// }
// });
function restriction(event) {
var charCode = event.which || event.keyCode;
if ((charCode >= 48 && charCode <= 57)) {
@ -298,7 +300,7 @@ $(document).ready(function(){
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_donor"; ?>" id="myForm" name="myForm">
<form class="needs-validation myForm" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_donor"; ?>" id="myForm" name="myForm">
<input type="hidden" name="new_receipt" value="new_receipt"/>
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?php echo get_business_id() ?>" />
@ -391,3 +393,4 @@ $(document).ready(function(){