mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Merged Client Trip and Global Trips along with exports into 1 managable file
This commit is contained in:
26
trips.php
26
trips.php
@@ -4,8 +4,14 @@
|
||||
$sort = "trip_date";
|
||||
$order = "DESC";
|
||||
|
||||
require_once "includes/inc_all.php";
|
||||
|
||||
// If client_id is in URI then show client Side Bar and client header
|
||||
if (isset($_GET['client_id'])) {
|
||||
require_once "includes/inc_all_client.php";
|
||||
$client_query = "AND trip_client_id = $client_id";
|
||||
} else {
|
||||
require_once "includes/inc_all.php";
|
||||
$client_query = '';
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sort = http_build_query($get_copy);
|
||||
@@ -18,6 +24,7 @@ $sql = mysqli_query(
|
||||
WHERE (trip_purpose LIKE '%$q%' OR trip_source LIKE '%$q%' OR trip_destination LIKE '%$q%' OR trip_miles LIKE '%$q%' OR client_name LIKE '%$q%' OR user_name LIKE '%$q%')
|
||||
AND DATE(trip_date) BETWEEN '$dtf' AND '$dtt'
|
||||
AND trip_archived_at IS NULL
|
||||
$client_query
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
@@ -43,6 +50,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
<div class="card-body">
|
||||
<form class="mb-4" autocomplete="off">
|
||||
<?php if(isset($_GET['client_id'])) { ?>
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<?php } ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
@@ -101,11 +111,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
Date <?php if ($sort == 'trip_date') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<?php if (!isset($_GET['client_id'])) { ?>
|
||||
<th>
|
||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
|
||||
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<th>
|
||||
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">
|
||||
Driver <?php if ($sort == 'user_name') { echo $order_icon; } ?>
|
||||
@@ -153,7 +165,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
if (empty($client_name)) {
|
||||
$client_name_display = "-";
|
||||
} else {
|
||||
$client_name_display = "<a href='client_trips.php?client_id=$client_id'>$client_name</a>";
|
||||
$client_name_display = "<a href='trips.php?client_id=$client_id'>$client_name</a>";
|
||||
}
|
||||
if ($round_trip == 1) {
|
||||
$round_trip_display = "<i class='fa fa-fw fa-sync-alt text-secondary'></i>";
|
||||
@@ -172,13 +184,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<td>
|
||||
<a class="text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php<?php if (isset($_GET['client_id'])) { echo "?client_id=$client_id "; } ?>"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<?php echo $trip_date; ?>
|
||||
</a>
|
||||
</td>
|
||||
<?php if (!isset($_GET['client_id'])) { ?>
|
||||
<td><?php echo $client_name_display; ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo $user_name_display; ?></td>
|
||||
<td><?php echo $trip_purpose; ?></td>
|
||||
<td><?php echo $trip_source; ?></td>
|
||||
@@ -196,14 +210,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php"
|
||||
data-ajax-url="ajax/ajax_trip_edit.php<?php if (isset($_GET['client_id'])) { echo "?client_id=$client_id "; } ?>"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<i class="fa fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_trip_copy.php"
|
||||
data-ajax-url="ajax/ajax_trip_copy.php<?php if (isset($_GET['client_id'])) { echo "?client_id=$client_id "; } ?>"
|
||||
data-ajax-id="<?php echo $trip_id; ?>"
|
||||
>
|
||||
<i class="fa fa-fw fa-copy mr-2"></i>Copy
|
||||
|
||||
Reference in New Issue
Block a user