Tracker issue

This commit is contained in:
heama 2024-03-22 14:18:10 +05:30
parent 6a57d1a640
commit cc68fff67f
2 changed files with 58 additions and 24 deletions

View File

@ -119,7 +119,7 @@
<th>Amount </th>
<th style="text-align: center !important" colspan="2">Discount</th>
<th hidden></th>
<?php if ($invoice_type === '1') : ?> <th>Actions</th> <?php endif; ?>
<?php if ($invoice_type === '1') : ?> <th></th> <?php endif; ?>
</tr>
</thead>
<tbody>
@ -129,8 +129,11 @@
<tr>
<td><select class="form-control book-select" id="<?= "book" . $inx; ?>bookSelect" name="item_details[]" onchange="displayBookTag(this,<?= $inx; ?>)" required data-toggle="select2" style="width: 249px !important;">
<option value="">Select a <?= $flag_name; ?></option>
<?php if($invoice_type === '1'){?>
<option value="add_new_book">+ Add New Book</option>
<?php foreach ($books as $book) : ?>
<?php }foreach ($books as $book) : ?>
<?php $disabled = ((int)$book->isactive == 0) ? 'disabled' : ''; ?>
<option value="<?= $book->book_id ?>" <?php if (isset($ii_details['product']) && ($ii_details['product'] === $book->book_id)) echo "selected"; ?> <?= $disabled; ?>>
<?php if((int)$book->isactive == 0){ echo $book->title." (Disabled) ";}else{ echo $book->title; } ?></option>
@ -169,8 +172,9 @@
<td style="width:30% !important;">
<select class="form-control book-select" id="book0" name="item_details[]" onchange="displayBookTag(this,0)" required data-toggle="select2" style="width: 249px !important;">
<option value="">Select a <?= $flag_name ?></option>
<?php if($invoice_type === '1'){?>
<option value="add_new_book">+ Add New Book</option>
<?php
<?php }
foreach ($books as $book) :
if ((int)$book->isactive === 1) : ?>
<option value="<?= $book->book_id ?>"><?= $book->title; ?></option>
@ -194,7 +198,7 @@
<td hidden><input type="hidden" class="form-control" id="hiddenInvoiceChildId0" name="invoice_child_id[]" value="" placeholder="hidden for invoice child/item id" /></td>
<?php if ($invoice_type === '1') : ?>
<td>
<center><i class="fa fa-trash remove-item "></i></center>
<!-- <center><i class="fa fa-trash remove-item "></i></center> -->
</td>
<?php endif; ?>
@ -313,13 +317,13 @@
</div>
</div>
</div>
<div class="modal fade" id="customerModal" tabindex="-1" role="dialog" aria-labelledby="paymentModalLabel" aria-hidden="true">
<div class="modal fade" id="customerModal" tabindex="-1" role="dialog" aria-labelledby="paymentModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="customerModalLabel">Add New Customer</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
<!-- <span aria-hidden="true">&times;</span> -->
</button>
</div>
<div class="modal-body">
@ -359,7 +363,7 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal"id="closeCustomerModal">Close</button>
<button type="button" class="btn btn-primary save-invoice-customer" onclick="saveInvoiceCustomer()">Save Customer</button>
</div>
</div>
@ -399,8 +403,7 @@
</button>
</div>
<div class="modal-body">
<textarea class="form-control" id="voidReason" rows="3" placeholder="Enter reason for voiding..."></textarea>
<!-- <input type="hidden" id="invoiceId" name="invoiceId"> -->
<textarea class="form-control" id="voidReason" rows="3" placeholder="Enter reason for voiding..." required></textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
@ -410,6 +413,10 @@
</div>
</div>
<!-- </div>
</div> -->
<!-- Reason for Cancel Modal -->
<div class="modal fade" id="cancelReasonModal" tabindex="-1" role="dialog" aria-labelledby="voidReasonModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
@ -446,13 +453,14 @@
<div class="modal-body">
<div class="form-row">
<div class="form-group col-md-6">
<label for="bookName">Book Name</label>
<label for="bookName">Book Name<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="bookName" name="bookName" required>
</div>
<div class="form-group col-md-6">
<label for="bookPrice">Price</label>
<input type="number" class="form-control" id="bookPrice" name="bookPrice" required>
</div>
<label for="bookPrice">Price<span class="text-danger"> *</span></label>
<input type="number" class="form-control" id="bookPrice" name="bookPrice" required min="0">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
@ -461,20 +469,20 @@
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="isbn_code" class="col-form-label">ISBN Code<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="isbn_code" name="isbn_code" placeholder="ISBN Code" required />
<label for="isbn_code" class="col-form-label">ISBN Code</label>
<input type="text" class="form-control" id="isbn_code" name="isbn_code" placeholder="ISBN Code" />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="publisher" class="col-form-label">Publisher Name<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="publisher" name="publisher" placeholder="Publisher Name" value="<?= isset($details['publisher']) ? $details['publisher'] : '' ?>" required />
<label for="publisher" class="col-form-label">Publisher Name</label>
<input type="text" class="form-control" id="publisher" name="publisher" placeholder="Publisher Name" value="<?= isset($details['publisher']) ? $details['publisher'] : '' ?>" />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="publishers_code" class="col-form-label">Publisher Code</label>
<input type="text" class="form-control" id="publishers_code" name="publishers_code" placeholder="Publisher Code" />
<label for="publishers_code" class="col-form-label">Publisher Code<span class="text-danger"> *</span></label>
<input type="text" class="form-control" id="publishers_code" name="publishers_code" placeholder="Publisher Code"required />
</div>
</div>
@ -492,7 +500,7 @@
<script>
var bookData=<?php echo json_encode($books); ?>;
localStorage.setItem('add_book_index', 0);
document.getElementById("addItem").addEventListener("click", function() {
var bookArray = bookData;
var table = document.getElementById("itemTable").getElementsByTagName("tbody")[0];
@ -1216,6 +1224,7 @@
}
$('.save-invoice-customer').prop('disabled', false);
},
error: function() {
alert("Error occur.");
$('#editAddressesCheckbox').prop('checked', false);
@ -1226,6 +1235,15 @@
});
}
}
$('#closeCustomerModal').click(function() {
// Reset customer dropdown value
$('#customerName').val("").trigger('change');
// Optionally, reset input fields
$('#cus_first_name').val("");
$('#cus_last_name').val("");
$('#cus_email').val("");
$('#cus_mobile_no').val("");
});
</script>
<script>
// JavaScript code to handle form submission and AJAX request
@ -1291,18 +1309,25 @@ $(document).ready(function() {
</script>
<script>
// JavaScript code to handle voiding invoice and submitting reason
$(document).ready(function() {
// Handle clicking on the "Void" button
$('#voidButton').click(function() {
var invoiceId = <?= isset($invoice_details['invoice_id']) ? $invoice_details['invoice_id'] : '' ?>; // Get the invoice_id
var invoiceId = <?= isset($invoice_details['invoice_id']) ? $invoice_details['invoice_id'] : '' ?>;
$('#voidReasonModal').modal('show');
$('#voidReasonModal').find('#voidReason').data('invoiceId', invoiceId); // Set the invoice_id in the modal
$('#submitVoidReason').data('invoiceId', invoiceId); // Set the invoice_id in the modal
});
// Handle submitting void reason
$('#submitVoidReason').click(function() {
var voidReason = $('#voidReason').val();
var invoiceId = $('#voidReason').data('invoiceId'); // Get the invoice_id from the modal
var voidReason = $('#voidReason').val().trim(); // Trim the value to remove whitespace
var invoiceId = $(this).data('invoiceId'); // Get the invoice_id from the button data
// Check if voidReason is empty
if (voidReason === '') {
alert('Please enter a reason for voiding.');
return;
}
// Perform AJAX request to update status and reason
$.ajax({
@ -1330,6 +1355,8 @@ $(document).ready(function() {
});
</script>
<script>
// JavaScript code to handle voiding invoice and submitting reason
$(document).ready(function() {
@ -1344,6 +1371,10 @@ $(document).ready(function() {
$('#submitCancelReason').click(function() {
var cancelReason = $('#cancelReason').val();
var invoiceIds = $('#cancelReason').data('invoiceIds'); // Get the invoice_id(s) from the modal
if (cancelReason === '') {
alert('Please enter a reason for Cancelling.');
return;
}
// Perform AJAX request to update status and reason
$.ajax({

View File

@ -280,6 +280,9 @@ p {
<?php if(!empty($value->notes)){ ?>
<br><p style="text-align: left !important;"><b>Notes:</b> <?= $value->notes; ?></p>
<?php } ?>
<?php if(!empty($value->reason)){ ?>
<br><p style="text-align: left !important;"><b>Reason:</b> <?= $value->reason; ?></p>
<?php } ?>
<?php foreach ($invoiceTerms as $row) :
if (!empty($row->terms)) { ?>
<br><pre style="font-family: 'Times New Roman', Times, sans-serif; font-size: 12px; text-align: left;">