FIX_Button Issues : ps

This commit is contained in:
VE10-Sanjeev 2024-06-24 09:43:47 +00:00
parent 2e4119d077
commit f25f5ecfbe
6 changed files with 2404 additions and 97 deletions

View File

@ -571,14 +571,14 @@ class ApiIntegration extends ResourceController
$B = $filteringRequestedBillingAddress;
$missingBillingValues = array_diff($A, $B); //Find difference element in Existing Images only
$commonBillingElements = array_intersect($A, $B);
if (!empty($missingBillingValues)) {
$this->logger->info("Api SaveCustomerDetails : Missing billing " .implode(",",$missingBillingValues)." Are inactived");
$inactive_where = ['isactive' => 1, 'customer_id' => (int)$last_insert_customer_id,'address_type'=>1];
$inactive_whereIn[0] = 'address_1';
$inactive_whereIn[1] = $missingBillingValues;
$data_to_batch_update = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
$api_model->inactiveMissingDetails('customer_addresses',$data_to_batch_update, $inactive_where, $inactive_whereIn);
}
// if (!empty($missingBillingValues)) {
// $this->logger->info("Api SaveCustomerDetails : Missing billing " .implode(",",$missingBillingValues)." Are inactived");
// $inactive_where = ['isactive' => 1, 'customer_id' => (int)$last_insert_customer_id,'address_type'=>1];
// $inactive_whereIn[0] = 'address_1';
// $inactive_whereIn[1] = $missingBillingValues;
// $data_to_batch_update = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
// $api_model->inactiveMissingDetails('customer_addresses',$data_to_batch_update, $inactive_where, $inactive_whereIn);
// }
}
}
@ -654,14 +654,14 @@ class ApiIntegration extends ResourceController
$B = $filteringRequestedShippingAddress;
$missingShippingValues = array_diff($A, $B); //Find difference element in Existing Images only
$commonShippingElements = array_intersect($A, $B);
if (!empty($missingShippingValues)) {
$inactive_where = ['isactive' => 1, 'customer_id' => (int)$last_insert_customer_id, 'address_type'=>2];
$inactive_whereIn[0] = 'address_1';
$inactive_whereIn[1] = $missingShippingValues;
$data_to_batch_update = ['isactive' => 0,'updated_by'=>$this->global_variable_user_id];
$api_model->inactiveMissingDetails('customer_addresses',$data_to_batch_update, $inactive_where, $inactive_whereIn);
$this->logger->info("Api SaveCustomerDetails : Missing Shipping " .implode(",",$missingShippingValues)." Are inactived");
}
// if (!empty($missingShippingValues)) {
// $inactive_where = ['isactive' => 1, 'customer_id' => (int)$last_insert_customer_id, 'address_type'=>2];
// $inactive_whereIn[0] = 'address_1';
// $inactive_whereIn[1] = $missingShippingValues;
// $data_to_batch_update = ['isactive' => 1,'updated_by'=>$this->global_variable_user_id];
// $api_model->inactiveMissingDetails('customer_addresses',$data_to_batch_update, $inactive_where, $inactive_whereIn);
// $this->logger->info("Api SaveCustomerDetails : Missing Shipping " .implode(",",$missingShippingValues)." Are inactived");
// }
}
}

View File

@ -99,6 +99,7 @@ public function existsSubscriptionDetails($where){
public function getSubscriptionInvoiceDetail($where)
{
$result = $this->getJoinedData($where);
// print_r($result);die;
if (!empty($result)) {
foreach ($result as $i => $item) {
$invoiceId = $item['invoice_id'];
@ -244,8 +245,8 @@ public function getJoinedData($where, $orderby = [])
->select('B.title as company_name,B.business_logo,B.terms as company_terms,B.address as company_address,B.city as company_city,B.state as company_state,B.postal_code as company_postal_code,B.email as company_email,B.mobile_no as company_mobile_no')
->select('COALESCE(NULLIF(states.state_name, ""), A.state) AS customer_bill_state')
->select('COALESCE(NULLIF(states.state_name, ""), S.state) AS customer_ship_state')
->select('concat(A.address_1," ", A.address_2) as customer_bill_address,A.postal_code as customer_bill_postal_code ,A.city as customer_bill_city, countries.country_name as customer_bill_country,A.country as bcountry,A.state as bstate,A.customer_address_id as baddr_id,A.email as bemail')
->select('concat(S.address_1," ", S.address_2) as customer_ship_address,S.postal_code as customer_ship_postal_code ,S.city as customer_ship_city, countries.country_name as customer_ship_country,S.country as scountry,S.state as sstate,S.customer_address_id as saddr_id,S.email as semail')
->select('CONCAT_WS(" ", A.first_name, A.last_name) as customer_biller_name,concat(A.address_1," ", A.address_2) as customer_bill_address,A.postal_code as customer_bill_postal_code ,A.city as customer_bill_city, countries.country_name as customer_bill_country,A.country as bcountry,A.state as bstate,A.customer_address_id as baddr_id,A.email as bemail,A.mobile_no as bmobile')
->select('CONCAT_WS(" ", S.first_name, S.last_name) as customer_shipper_name,concat(S.address_1," ", S.address_2) as customer_ship_address,S.postal_code as customer_ship_postal_code ,S.city as customer_ship_city, countries.country_name as customer_ship_country,S.country as scountry,S.state as sstate,S.customer_address_id as saddr_id,S.email as semail,S.mobile_no as smobile')
->get()
->getResult();

View File

@ -21,17 +21,23 @@
<link href="<?= base_url() . "public/assets/css/icons.min.css" ?>" rel="stylesheet" type="text/css" />
</head>
<style>
.bgm {
min-height: 100vh;
background: url("public/uploads/loginbgm2.jpeg") center;
}
</style>
<body class="loading">
<div class="account-pages mt-5 mb-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5">
<div class="card">
<div class="card-body p-4">
<!-- <div class="bgm"></div> -->
<div class="text-center w-75 m-auto">
<div class="auth-logo">
<a href="javascript: void(0);" class="logo logo-dark text-center">
@ -89,6 +95,7 @@
</form>
</div>
</div> <!-- end card-body -->
</div>
<!-- end card -->

View File

@ -640,14 +640,13 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div>
<input type="hidden" id="status" name="status" value="<?= isset($invoice_details['status']) ? $invoice_details['status'] : 'Draft' ?>">
<input type="hidden" id="hiddenInvoiceId" name="invoice_id" placeholder="hidden for invoice id" value="<?= isset($invoice_details['invoice_id']) ? $invoice_details['invoice_id'] : '' ?>" />
<input type="hidden" name="invoice_type" value="<?php echo ($page_name === 'Add Subscription Invoice Details' || $page_name === 'Edit Subscription Invoice Details') ? '2' : '1'; ?>">
<div class="form-group m-b-0">
<?php if (isset($invoice_details['status'])) : ?>
<button type="submit" class="btn btn-white waves-effect waves-light" name="saveas" value="Draft" id="saveDraftButton">Save as Draft</button>
<button type="button" class="btn btn-primary waves-effect" name="saveas" value="Approved" id="saveApprovedButton">Save as Approved</button>
<button type="button" class="btn btn-white waves-effect waves-light" name="void" value="Void" id="voidButton">Void</button>
<button type="button" class="btn btn-white waves-effect" name="cancel" value="Cancel" id="cancelButton">Cancel</button>
<?php endif; ?>
<input type="hidden" name="invoice_type" value="<?php echo ($page_name === 'Add Subscription Invoice Details' || $page_name === 'Edit Subscription Invoice Details') ? '2' : '1'; ?>">
</div>
</form>
</div>
@ -855,6 +854,58 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
var status = "<?php echo isset($invoice_details['status']) ? $invoice_details['status'] : ''; ?>";
var invoice_type = "<?php echo isset($invoice_type) ? $invoice_type : ''; ?>";
console.log('Invoice Type:', invoice_type);
console.log('Status:', status);
// Call the function to show buttons based on initial status
showButtonsBasedOnStatus(status, invoice_type);
// Handling button clicks
$('#cancelButton').click(function() {
console.log('Cancel button clicked');
});
$('#saveDraftButton').click(function() {
console.log('Save as Draft button clicked');
});
$('#voidButton').click(function() {
console.log('Void button clicked');
});
$('#saveApprovedButton').click(function() {
console.log('Save as Approved button clicked');
});
});
function hideAllButtons() {
$('#cancelButton, #saveDraftButton, #voidButton, #saveApprovedButton').hide();
}
// Function to show buttons based on status and invoice_type
function showButtonsBasedOnStatus(status, invoice_type) {
hideAllButtons();
if (invoice_type == '1' || invoice_type =='2') {
if (status == '') {
$('#saveDraftButton, #saveApprovedButton').show();
} else if (status === 'Draft') {
$('#voidButton, #saveDraftButton, #saveApprovedButton').show();
} else if (status === 'Approved') {
$('#cancelButton').show();
if (invoice_type === '2') {
$('#saveApprovedButton').show();
}
} else if (status === 'Cancelled' || status === 'Void') {
hideAllButtons();
}
}
}
</script>
<script>
@ -1982,59 +2033,8 @@ function saveInvoiceCustomer() {
});
});
</script>
<script>
$(document).ready(function() {
var status = "<?php echo isset($invoice_details['status']) ? $invoice_details['status'] : ''; ?>";
var invoice_type = "<?php echo isset($invoice_details['invoice_type']) ? $invoice_details['invoice_type'] : ''; ?>";
console.log("Status: " + status);
console.log("Invoice Type: " + invoice_type);
// Function to hide all buttons
function hideAllButtons() {
$('#cancelButton, #saveDraftButton, #voidButton, #saveApprovedButton').hide();
}
// Function to show buttons based on status
function showButtonsBasedOnStatus(status) {
hideAllButtons();
if (invoice_type === '1' || invoice_type === '2') {
if (status === '') {
$('#saveDraftButton, #saveApprovedButton').show();
} else if (status === 'Draft') {
$('#voidButton, #saveDraftButton, #saveApprovedButton').show();
} else if (status === 'Approved') {
$('#cancelButton').show();
if (invoice_type === '2') {
$('#saveApprovedButton').show();
}
} else if (status === 'Cancelled' || status === 'Void') {
hideAllButtons();
}
}
}
// Initial call to show buttons based on the initial status
showButtonsBasedOnStatus(status);
// Handling button clicks
$('#cancelButton').click(function() {
console.log('Cancel button clicked');
});
$('#saveDraftButton').click(function() {
console.log('Save as Draft button clicked');
});
$('#voidButton').click(function() {
console.log('Void button clicked');
});
$('#saveApprovedButton').click(function() {
console.log('Save as Approved button clicked');
});
});
</script>
<script>
$("#addressCopiedAsShipping").on("change", function() {

File diff suppressed because it is too large Load Diff

View File

@ -139,30 +139,22 @@
background-color: #FFEAEF;
}
/* Style for the table containing - summary-invoice details */
table.summary-table {
/* Define your CSS styles here */
.summary-table {
width: 100%;
border-collapse: collapse;
vertical-align: top;
}
/* Style for the table containing - summary-invoice subtotal-table details */
table.subtotal-table {
.subtotal-table {
width: 100%;
border-collapse: collapse;
}
/* Style for the notes and terms information */
.notes-container,
.terms-container {
text-align: center;
margin-top: 20px;
}
.subtotal-table td:last-child {
font-weight: bold;
}
/* Style for the table containing - footer-table details */
table.footer-table {
font-family: Nunito Sans;
@ -204,7 +196,7 @@
<td class="billing-address-container" style="vertical-align: top;">
<?php foreach ($data as $value) : ?>
<b>BILLING TO :</b><br>
<b><?= $value->customer_name ?></b><br>
<b><?= isset($value->customer_biller_name) && trim($value->customer_biller_name) !== '' ? $value->customer_biller_name : $value->customer_name ?></b><br>
<?php if ($value->customer_bill_address && ($value->baddr_id !== null || $value->baddr_id !== '')) { ?>
<?= $value->customer_bill_address ? $value->customer_bill_address . " ," : "" ?><br>
<?= $value->customer_bill_city ? $value->customer_bill_city : "" ?>&nbsp;<?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
@ -213,15 +205,15 @@
<?php } else if ($value->baddr_id === null || $value->baddr_id === '') {
echo $value->billing_address ? '<p style="white-space: pre-line">' . $value->billing_address . '</p>' : '';
} ?>
<?= $value->mobile_no ? "Phone : +91" . $value->mobile_no . " ." : "" ?><br>
<?= $value->email ? "Email : " . $value->email . " ." : "" ?>
<?= $value->bmobile ? "Phone : +91" . $value->bmobile . " ." : ($value->mobile_no ? "Phone : +91" . $value->mobile_no . " ." : "") ?><br>
<?= $value->bemail ? "Email : " . $value->bemail . " ." : ($value->email ? "Email : " . $value->email . " ." : "" ) ?>
<?php endforeach; ?>
</td>
<td class="shipping-address-container" style="vertical-align: top;">
<?php foreach ($data as $value) : ?>
<b>SHIPPING TO :</b><br>
<b><?= $value->customer_name ?></b><br>
<b><?= isset($value->customer_shipper_name) && trim($value->customer_shipper_name) !== '' ? $value->customer_shipper_name : $value->customer_name ?></b><br>
<?php if ($value->customer_ship_address && ($value->saddr_id !== null || $value->saddr_id !== '')) { ?>
<?= $value->customer_ship_address ? $value->customer_ship_address . " ," : "" ?><br>
<?= $value->customer_ship_city ? $value->customer_ship_city : "" ?>&nbsp;<?= $value->customer_ship_state ? $value->customer_bill_state : "" ?>
@ -230,8 +222,8 @@
<?php } else if ($value->saddr_id === null || $value->saddr_id === '') {
echo $value->shipping_address ? '<p style="white-space: pre-line">' . $value->shipping_address . '</p>' : '';
} ?>
<?= $value->mobile_no ? "Phone : +91" . $value->mobile_no . " ." : "" ?><br>
<?= $value->email ? "Email : " . $value->email . " ." : "" ?>
<?= $value->smobile ? "Phone : +91" . $value->smobile . " ." : "" ?><br>
<?= $value->semail ? "Email : " . $value->semail . " ." : "" ?>
<?php endforeach; ?>
</td>
@ -282,10 +274,10 @@
</table>
<!-- table containing - invoice details ends -->
<!-- table containing - summary details -->
<table class="summary-table mt-1">
<table class="summary-table mt-1" style="width: 100%;">
<?php if (!empty($data)) : ?>
<tr>
<td colspan="6" style="width: 60%; vertical-align: top;">
<td colspan="6" style="width: 60%; vertical-align: top; display:flex;">
<?php foreach ($data as $value) : ?>
<div class="notes-container">
<?php if (!empty($value->reason)) : ?>
@ -293,23 +285,27 @@
<h6>Reason</h6>
<?php echo nl2br($value->reason); ?>
</div>
<?php else : ?><div style="text-align: left !important;"><p>&nbsp;&nbsp; </p></div>
<?php endif; ?>
<?php if (!empty($value->notes)) : ?>
<div style="text-align: left !important;">
<h6>Notes</h6>
<?php echo nl2br($value->notes); ?>
</div>
<?php else : ?><div style="text-align: left !important;"><p>&nbsp;&nbsp; </p></div>
<?php endif; ?>
<?php if (!empty($value->payment_note)) : ?>
<div style="text-align: left !important;">
<h6>Payment Notes</h6>
<?php echo nl2br($value->payment_note); ?>
</div>
<?php else : ?><div style="text-align: left !important;"><p>&nbsp;&nbsp; </p></div>
<?php endif; ?>
<?php if (!empty($value->terms)) : ?>
<pre style="font-family: 'Times New Roman', Times, sans-serif; font-size: 12px; text-align: left;">
<?= $row->terms ?>
</pre>
</pre>
<?php else : ?><div style="text-align: left !important;"><p>&nbsp;&nbsp; </p></div>
<?php endif; ?>
</div>
<br>
@ -379,10 +375,12 @@
</td>
<td colspan="6" style="width: 40%; vertical-align: bottom;">
<div class="terms-container">
<!-- <img src="<?php // echo base_url('public/uploads/default_sign_sm.png'); ?>" alt="Authorized Signatory" class="Authorized-Signatory"> -->
<center>
<img src="<?php echo base_url('public/uploads/default_sign_sm.png'); ?>" alt="Authorized Signatory" class="Authorized-Signatory">
<div>
<h6 style="text-align:center;">Authorized Signatory</h6>
<h6>Authorized Signatory</h6>
</div>
</center>
</div>
</td>
</tr>