Alan Lam 8 лет назад
Родитель
Сommit
7fa4de3fd3
2 измененных файлов с 52 добавлено и 24 удалено
  1. 5 3
      controllers/users.php
  2. 47 21
      views/users.php

+ 5 - 3
controllers/users.php

@@ -11,6 +11,7 @@ else {
 Core::addBreadcrumb("/account", "Account");
 Core::addBreadcrumb("/account", "Account");
 Core::addBreadcrumb("/account/users", $page_title);
 Core::addBreadcrumb("/account/users", $page_title);
 
 
+$id = http::value("id", "int");
 $first_name = http::value("first_name", "trim");
 $first_name = http::value("first_name", "trim");
 $last_name = http::value("last_name", "trim");
 $last_name = http::value("last_name", "trim");
 $email = http::value("email", "trim");
 $email = http::value("email", "trim");
@@ -20,8 +21,9 @@ $customer_id = http::value("customer_id", "int");
 $location_id = http::value("location_id", "int");
 $location_id = http::value("location_id", "int");
 
 
 $nvp = [];
 $nvp = [];
-if($first_name !== false) $nvp["first_name"] = ((new Constraint("CONTAINS"))->setValues($first_name));
-if($last_name !== false) $nvp["last_name"] = ((new Constraint("CONTAINS"))->setValues($last_name));
+if($id !== false) $nvp["id"] = $id;
+if(strlen($first_name) > 0) $nvp["first_name"] = ((new Constraint("CONTAINS"))->setValues($first_name));
+if(strlen($last_name) > 0) $nvp["last_name"] = ((new Constraint("CONTAINS"))->setValues($last_name));
 if(strlen($email) > 0) $nvp["email"] = $email;
 if(strlen($email) > 0) $nvp["email"] = $email;
 if($level !== false) $nvp["level"] = $level;
 if($level !== false) $nvp["level"] = $level;
 
 
@@ -43,7 +45,7 @@ $users = array_slice($users, $pagination_object->offset, $pagination_object->pag
 
 
 
 
 View::includeOnce("header", compact("page_title"));
 View::includeOnce("header", compact("page_title"));
-View::include("users", compact("users", "pagination_object", "filter_count", "first_name", "last_name", "email", "level", "customer_id", "location_id"));
+View::include("users", compact("users", "pagination_object", "filter_count", "id", "first_name", "last_name", "email", "level", "customer_id", "location_id"));
 View::includeOnce("modal_page_jump");
 View::includeOnce("modal_page_jump");
 View::includeOnce("footer");
 View::includeOnce("footer");
 
 

+ 47 - 21
views/users.php

@@ -30,32 +30,58 @@
 			<h3>Filters</h3>
 			<h3>Filters</h3>
 			<form method="get">
 			<form method="get">
 
 
-				<div class="row mb-1">
-					<label class="col-sm-4 col-form-label" for="level">Level</label>
-					<div class="col-sm">
-						<select class="form-control" name="level" id="level">
-							<option value="">Any except Registered</option>
-							<?php
-							foreach(User::LEVELS as $value => $display) {
-								$selected = ($value === $level) ? "selected" : "";
-								?>
-								<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
-								<?php
-							}
-							?>
-						</select>
+				<div class="row mb-3">
+					<div class="col-lg">
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="first-name">First Name</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="first_name" id="first-name" placeholder="Enter first name" value="<?=htmlspecialchars($first_name)?>" />
+							</div>
+						</div>
+
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="last-name">Last Name</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="last_name" id="last-name" placeholder="Enter last name" value="<?=htmlspecialchars($last_name)?>" />
+							</div>
+						</div>
 					</div>
 					</div>
-				</div>
+					<div class="col-lg">
 
 
-				<div class="row mb-3">
-					<label class="col-sm-4 col-form-label" for="email">Email</label>
-					<div class="col-sm">
-						<input class="form-control" type="text" name="email" id="email" placeholder="Enter email" value="<?=htmlspecialchars($email)?>" />
+						<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="text" name="id" id="id" placeholder="Enter ID" value="<?=htmlspecialchars($id)?>" />
+							</div>
+						</div>
+
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="level">Level</label>
+							<div class="col-sm">
+								<select class="form-control" name="level" id="level">
+									<option value="">Any except Registered</option>
+									<?php
+									foreach(User::LEVELS as $value => $display) {
+										$selected = ($value === $level) ? "selected" : "";
+										?>
+										<option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
+										<?php
+									}
+									?>
+								</select>
+							</div>
+						</div>
+
+						<div class="row mb-1">
+							<label class="col-sm-4 col-form-label" for="email">Email</label>
+							<div class="col-sm">
+								<input class="form-control" type="text" name="email" id="email" placeholder="Enter email" value="<?=htmlspecialchars($email)?>" />
+							</div>
+						</div>
 					</div>
 					</div>
 				</div>
 				</div>
-
 				<div class="row">
 				<div class="row">
-					<div class="col-sm offset-sm-4">
+					<div class="col-sm text-center">
 						<button class="btn btn-primary" type="submit">Filter</button>
 						<button class="btn btn-primary" type="submit">Filter</button>
 					</div>
 					</div>
 				</div>
 				</div>