This commit is contained in:
heama 2024-04-06 18:25:27 +05:30
commit 032bac923d

View File

@ -26,9 +26,11 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4" class="col-form-label">Client Name<span class="text-danger">*</span></label>
<i type="button" class="fe-plus-circle" id="addClientModalButton" style="font-size: 18px;" data-toggle="modal" data-target="#addClientModal" title="Add Client"></i>
<select class="form-control cleint-select SelExample" name="client_id" id="SelExample" <?= isset($sales['client_id']) ? '' : 'required' ?>>
<select class="form-control cleint-select SelExample" name="client_id" <?= isset($sales['client_id']) ? '' : 'required' ?>>
<?= isset($sales['client_id']) ? '' : '<option value="">Select a Client</option>' ?>
<?php foreach ($client as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?>
@ -41,7 +43,7 @@
</div>
<div class="form-group col-md-6">
<label for="inputPassword4" class="col-form-label">Status<span class="text-danger">*</span></label>
<select class="form-control status-select" name="status" required data-toggle="select2">
<select class="form-control status-select" name="status" required data-toggle="select2" >
<!-- <option value="">Select a Status</option> -->
<option value="Created" <?= isset($sales['status']) && $sales['status'] === 'Created' ? 'selected' : '' ?>>Created</option>
<option value="Paid" <?= isset($sales['status']) && $sales['status'] === 'Paid' ? 'selected' : '' ?>>Paid</option>
@ -105,7 +107,7 @@
if ($salechild['isactive'] == 1) : ?>
<tr>
<td>
<select class="form-control book-select " name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
<select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" id="" style="width: 249px !important;">
<option value="">Select a Product</option>
<?php foreach ($product as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?>
@ -380,7 +382,7 @@ $(document).ready(function() {
// Event listener for "Add More Item" button
$('#addItem').click(function() {
var newRow = '<tr>' +
'<td><select class="form-control book-select" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option><?php foreach ($product as $value) : if ((int)$value["isactive"] === 1) : ?><option value="<?= $value["product_id"] ?>"><?= $value["product_name"]; ?></option><?php endif; endforeach; ?></select></td>' +
'<td><select class="form-control book-select SelExample" name="item_details[]" required data-toggle="select2" style="width: 249px !important;"><option value="">Select a Product</option><?php foreach ($product as $value) : if ((int)$value["isactive"] === 1) : ?><option value="<?= $value["product_id"] ?>"><?= $value["product_name"]; ?></option><?php endif; endforeach; ?></select></td>' +
'<td style="width:10%;"><input type="number" class="form-control item-quantity"min="0" name="quantity[]"/></td>' +
'<td style="width:10%;"><input type="text" class="form-control item-rate" name="unit-price[]"readonly /></td>' +
'<td style="width:8%;"><input type="text" class="form-control item-tax"name="item-tax[]" readonly /></td>' +
@ -393,6 +395,7 @@ $(document).ready(function() {
'</tr>';
$('#itemTable tbody').append(newRow);
initializeSelect2();
});
// Event listener for removing item
@ -475,8 +478,12 @@ $(document).ready(function() {
$(document).ready(function(){
// Initialize select2
$(".SelExample").select2();
$(".SelExample").select2("val", "4");
});
function initializeSelect2() {
$('.SelExample').select2({
width: '249px' // Adjust width as needed
});
}
</script>
<script>
$(document).ready(function() {
@ -527,9 +534,14 @@ $(document).ready(function() {
<style>
.select2-container--default .select2-results__option--highlighted[aria-selected]{
color:#ffffff;
background: #526dee!important;
}
.select2-container .select2-selection--single{
height: 36px;