| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- /**
- * @var Customer $customer
- * @var Project[] $projects
- * @var int $filter_count
- * @var int $year
- * @var int $month
- * @var string $report_month
- * @var int $finished
- */
- $report_months = array_reverse(Project::getReportMonths());
- $user = Core::$user;
- $year_options = [];
- foreach(range(2018, date("Y")) as $i) {
- $year_options[$i] = $i;
- }
- $month_options = [
- 1 => __("January"),
- 2 => __("February"),
- 3 => __("March"),
- 4 => __("April"),
- 5 => __("May"),
- 6 => __("June"),
- 7 => __("July"),
- 8 => __("August"),
- 9 => __("September"),
- 10 => __("October"),
- 11 => __("November"),
- 12 => __("December"),
- ];
- $finished_options = [
- 0 => __("Unfinished Only"),
- 1 => __("Finished Only"),
- ];
- ?>
- <div class="container mt-3 py-4">
- <div class="row">
- <div class="col-auto">
- <h2>
- <?=htmlspecialchars($customer->name)?> Projects
- <span class="badge badge-pill badge-primary"><?=number_format(count($projects))?></span>
- </h2>
- </div>
- <div class="col text-right">
- <button type="button" class="btn btn-primary" data-toggle="collapse" data-target="#project-filters">
- <i class="fa fa-fw fa-filter"></i>
- Filters
- <?php
- if($filter_count > 0) {
- ?>
- <span class="badge badge-pill badge-danger"><?=$filter_count?></span>
- <?php
- }
- ?>
- </button>
- <a class="btn btn-success" href="/account/projects/add?customer_id=<?=$customer->id?>">
- <i class="fa fa-fw fa-plus"></i>
- Add
- </a>
- </div>
- </div>
- <?php
- $filters_show = $filter_count > 0 ? "show" : "";
- ?>
- <div class="collapse <?=$filters_show?>" id="project-filters">
- <div class="card card-body bg-light text-dark mb-3">
- <h3>Filters</h3>
- <form method="get">
- <div class="row">
- <div class="col-lg">
- <input type="hidden" name="customer_id" value="<?=htmlspecialchars($customer->id)?>" />
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="id">ID</label>
- <div class="col-sm">
- <input class="form-control" type="number" name="id" id="id" placeholder="Enter ID" value="<?=htmlspecialchars(http::value("id", "int"))?>" />
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="name">Name</label>
- <div class="col-sm">
- <input class="form-control" type="text" name="name" id="name" placeholder="Enter name" value="<?=htmlspecialchars(http::value("name"))?>" />
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="year">Year</label>
- <div class="col-sm">
- <select class="form-control" type="text" name="year" id="year">
- <option value="0">Select Year</option>
- <?php
- HtmlHelper::renderOptions($year_options, $year);
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label for="month" class="col-sm-4 col-form-label">
- <?=htmlspecialchars(__("Month"))?>
- </label>
- <div class="col-sm">
- <select class="form-control" id="month" name="month">
- <option value=""><?=htmlspecialchars(__("Select Month"))?></option>
- <?php
- HtmlHelper::renderOptions($month_options, $month);
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label for="report-month" class="col-sm-4 col-form-label"><?=htmlspecialchars(__("Report Month"))?></label>
- <div class="col-sm">
- <select class="form-control" name="report_month" id="report-month">
- <option value=""><?=htmlspecialchars(__("Select Report Month"))?></option>
- <?php
- HtmlHelper::renderOptions($report_months, $report_month);
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="finished"><?=htmlspecialchars(__("Finished"))?></label>
- <div class="col-sm">
- <select class="form-control" type="text" name="finished" id="finished">
- <option value="">Show all</option>
- <?php
- HtmlHelper::renderOptions($finished_options, $finished);
- ?>
- </select>
- </div>
- </div>
- <div class="row">
- <div class="col-sm offset-sm-4">
- <button class="btn btn-primary" type="submit">Submit</button>
- <a class="btn btn-secondary" href="/account/projects?customer_id=<?=htmlspecialchars($customer->id)?>">Clear Filters</a>
- </div>
- </div>
- </div>
- </div>
- </form>
- </div>
- </div>
- <form id="projects-form" method="post">
- <input type="hidden" id="type" name="type" value="" />
- <?php
- View::include("project_list", compact("customer", "projects"));
- ?>
- <div class="row">
- <div class="col-md-6 offset-md-6">
- <div class="input-group">
- <div class="input-group-prepend">
- <label class="input-group-text" for="batch-action">
- Batch Action
- </label>
- </div>
- <select class="form-control" id="batch-action" required>
- <option value="">Select Action</option>
- <?php
- if($user->canExportProjectCsv()) {
- ?>
- <option value="export-admin-csv">Export CSV</option>
- <?php
- }
- ?>
- <option value="export-customer-csv">Export Customer CSV</option>
- <option value="export-quickbooks-customer-csv">Export Quickbooks Customer CSV</option>
- <option value="export-quickbooks-tester-csv">Export Quickbooks Tester CSV</option>
- </select>
- <div class="input-group-append">
- <button type="submit" class="btn btn-primary" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>">
- Submit
- </button>
- </div>
- </div>
- </div>
- </div>
- </form>
- </div>
|