mirror of https://github.com/itflow-org/itflow
170 lines
9.0 KiB
PHP
170 lines
9.0 KiB
PHP
<?php
|
|
|
|
// Default Column Sortby/Order Filter
|
|
$sort = "project_name";
|
|
$order = "ASC";
|
|
|
|
require_once "inc_all.php";
|
|
|
|
|
|
//Rebuild URL
|
|
$url_query_strings_sort = http_build_query($get_copy);
|
|
|
|
$sql = mysqli_query(
|
|
$mysqli,
|
|
"SELECT SQL_CALC_FOUND_ROWS * FROM projects
|
|
LEFT JOIN clients ON client_id = project_client_id
|
|
WHERE project_template = 0
|
|
AND DATE(project_created_at) BETWEEN '$dtf' AND '$dtt'
|
|
AND (project_name LIKE '%$q%' OR project_description LIKE '%$q%')
|
|
AND project_archived_at IS NULL
|
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
|
);
|
|
|
|
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|
|
|
?>
|
|
|
|
<div class="card card-dark">
|
|
<div class="card-header py-2">
|
|
<h3 class="card-title mt-2"><i class="fas fa-fw fa-project-diagram mr-2"></i>Projects</h3>
|
|
<div class="card-tools">
|
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addProjectModal"><i class="fas fa-plus mr-2"></i>New Project</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
<form class="mb-4" autocomplete="off">
|
|
<div class="row">
|
|
<div class="col-sm-4">
|
|
<div class="input-group">
|
|
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(nullable_htmlentities($q));} ?>" placeholder="Search Projects">
|
|
<div class="input-group-append">
|
|
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
|
|
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="collapse mt-3 <?php if (!empty($_GET['dtf']) || $_GET['canned_date'] !== "custom" ) { echo "show"; } ?>" id="advancedFilter">
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
<div class="form-group">
|
|
<label>Canned Date</label>
|
|
<select onchange="this.form.submit()" class="form-control select2" name="canned_date">
|
|
<option <?php if ($_GET['canned_date'] == "custom") { echo "selected"; } ?> value="custom">Custom</option>
|
|
<option <?php if ($_GET['canned_date'] == "today") { echo "selected"; } ?> value="today">Today</option>
|
|
<option <?php if ($_GET['canned_date'] == "yesterday") { echo "selected"; } ?> value="yesterday">Yesterday</option>
|
|
<option <?php if ($_GET['canned_date'] == "thisweek") { echo "selected"; } ?> value="thisweek">This Week</option>
|
|
<option <?php if ($_GET['canned_date'] == "lastweek") { echo "selected"; } ?> value="lastweek">Last Week</option>
|
|
<option <?php if ($_GET['canned_date'] == "thismonth") { echo "selected"; } ?> value="thismonth">This Month</option>
|
|
<option <?php if ($_GET['canned_date'] == "lastmonth") { echo "selected"; } ?> value="lastmonth">Last Month</option>
|
|
<option <?php if ($_GET['canned_date'] == "thisyear") { echo "selected"; } ?> value="thisyear">This Year</option>
|
|
<option <?php if ($_GET['canned_date'] == "lastyear") { echo "selected"; } ?> value="lastyear">Last Year</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-group">
|
|
<label>Date From</label>
|
|
<input onchange="this.form.submit()" type="date" class="form-control" name="dtf" max="2999-12-31" value="<?php echo nullable_htmlentities($dtf); ?>">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-group">
|
|
<label>Date To</label>
|
|
<input onchange="this.form.submit()" type="date" class="form-control" name="dtt" max="2999-12-31" value="<?php echo nullable_htmlentities($dtt); ?>">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<hr>
|
|
<div class="table-responsive-sm">
|
|
<table class="table table-striped table-hover table-borderless">
|
|
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
|
<tr>
|
|
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_name&order=<?php echo $disp; ?>">Project</a></th>
|
|
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_description&order=<?php echo $disp; ?>">Description</a></th>
|
|
<th>Tickets</th>
|
|
<th>Tasks</th>
|
|
<th>Due</th>
|
|
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_created_at&order=<?php echo $disp; ?>">Created</a></th>
|
|
<th class="text-center">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
|
|
while ($row = mysqli_fetch_array($sql)) {
|
|
$project_id = intval($row['project_id']);
|
|
$project_name = nullable_htmlentities($row['project_name']);
|
|
$project_description = nullable_htmlentities($row['project_description']);
|
|
if ($project_description) {
|
|
$project_description_display = $project_description;
|
|
} else {
|
|
|
|
$project_description_display = "-";
|
|
}
|
|
$project_created_at = date("Y-m-d", strtotime($row['project_created_at']));
|
|
$project_updated_at = nullable_htmlentities($row['project_updated_at']);
|
|
|
|
?>
|
|
|
|
<tr>
|
|
<th>
|
|
<a class="text-dark" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>"><?php echo $project_name; ?></a>
|
|
</th>
|
|
<td><?php echo $project_description_display; ?></td>
|
|
<td>
|
|
<div class="progress" style="height: 20px;">
|
|
<div class="progress-bar bg-success" style="width: 50%;">1 / 2</div>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<div class="progress" style="height: 20px;">
|
|
<div class="progress-bar" style="width: 70%;">7 / 10</div>
|
|
</div>
|
|
</td>
|
|
<td>Next Week</td>
|
|
<td><?php echo $project_created_at; ?></td>
|
|
<td>
|
|
<div class="dropdown dropleft text-center">
|
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
|
<i class="fas fa-ellipsis-h"></i>
|
|
</button>
|
|
<div class="dropdown-menu">
|
|
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
|
|
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
|
</a>
|
|
<div class="dropdown-divider"></div>
|
|
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?php echo $project_id; ?>">
|
|
<i class="fas fa-fw fa-archive mr-2"></i>Delete
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
require "project_edit_modal.php";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php require_once "pagination.php";
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
require_once "project_add_modal.php";
|
|
|
|
require_once "footer.php";
|
|
|