mirror of
https://github.com/itflow-org/itflow
synced 2026-03-23 22:15:39 +00:00
Tidy up the ticket_invoice_add_modal
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
// Check if ticket_id and invoice_id are set in the URL
|
|
||||||
$addToExistingInvoice = isset($_GET['ticket_id']) && isset($_GET['invoice_id']);
|
|
||||||
$sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_status LIKE 'Draft' AND invoice_client_id = $client_id ORDER BY invoice_number ASC");
|
$sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_status LIKE 'Draft' AND invoice_client_id = $client_id ORDER BY invoice_number ASC");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -17,45 +15,27 @@ $sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_stat
|
|||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
<?php
|
<?php if (mysqli_num_rows($sql_invoices) > 0) { ?>
|
||||||
if (mysqli_num_rows($sql_invoices) > 0) {
|
|
||||||
?>
|
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<?php if (!$addToExistingInvoice): ?>
|
<a class="nav-link active" data-toggle="pill" href="#pills-create-invoice"><i class="fa fa-fw fa-check mr-2"></i>Create New Invoice</a>
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-create-invoice"><i class="fa fa-fw fa-check mr-2"></i>Create New Invoice</a>
|
|
||||||
<?php else: ?>
|
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-create-invoice"><i class="fa fa-fw fa-check mr-2"></i>Create New Invoice</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<?php if ($addToExistingInvoice): ?>
|
<a class="nav-link" data-toggle="pill" href="#pills-add-to-invoice"><i class="fa fa-fw fa-plus mr-2"></i>Add to Existing Invoice</a>
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-add-to-invoice"><i class="fa fa-fw fa-plus mr-2"></i>Add to Existing Invoice</a>
|
|
||||||
<?php else: ?>
|
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-add-to-invoice"><i class="fa fa-fw fa-plus mr-2"></i>Add to Existing Invoice</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php } else { ?>
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
<i class="fa fa-fw fa-exclamation-triangle mr-2"></i>No draft invoices found. Please create a new invoice first.
|
<i class="fa fa-fw fa-exclamation-triangle mr-2"></i>No draft invoices found. Please create a new invoice first.
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php } ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<?php if (!$addToExistingInvoice): ?>
|
|
||||||
<div class="tab-pane fade show active" id="pills-create-invoice">
|
<div class="tab-pane fade show active" id="pills-create-invoice">
|
||||||
<?php else: ?>
|
|
||||||
<div class="tab-pane fade" id="pills-create-invoice">
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Invoice Date <strong class="text-danger">*</strong></label>
|
<label>Invoice Date <strong class="text-danger">*</strong></label>
|
||||||
@@ -109,12 +89,9 @@ $sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_stat
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (mysqli_num_rows($sql_invoices) > 0) {
|
if (mysqli_num_rows($sql_invoices) > 0) { ?>
|
||||||
if ($addToExistingInvoice): ?>
|
|
||||||
<div class="tab-pane fade show active" id="pills-add-to-invoice">
|
<div class="tab-pane fade show active" id="pills-add-to-invoice">
|
||||||
<?php else: ?>
|
|
||||||
<div class="tab-pane fade" id="pills-add-to-invoice">
|
|
||||||
<?php endif;?>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Invoice</label>
|
<label>Invoice</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -134,27 +111,20 @@ $sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_stat
|
|||||||
$invoice_date = nullable_htmlentities($row['invoice_date']);
|
$invoice_date = nullable_htmlentities($row['invoice_date']);
|
||||||
$invoice_due = nullable_htmlentities($row['invoice_due']);
|
$invoice_due = nullable_htmlentities($row['invoice_due']);
|
||||||
$invoice_amount = floatval($row['invoice_amount']);
|
$invoice_amount = floatval($row['invoice_amount']);
|
||||||
|
|
||||||
|
|
||||||
if ($invoice_status == "Draft") {
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo $invoice_id; ?>" <?php if ($invoice_id == $_GET['invoice_id']) {
|
<option value="<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number | $invoice_scope"; ?></option>
|
||||||
echo "selected";
|
<?php } ?>
|
||||||
}?>><?php echo "$invoice_prefix$invoice_number $invoice_scope"; ?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
}
|
<?php } ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Item <strong class="text-danger">*</strong></label>
|
<label>Item <strong class="text-danger">*</strong></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -222,10 +192,7 @@ $sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_stat
|
|||||||
$tax_percent = floatval($row['tax_percent']);
|
$tax_percent = floatval($row['tax_percent']);
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
<option value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||||
|
<?php } ?>
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user