Просмотр исходного кода

Added ID, changed buttons to use icons, moved internal ID down a line.

Alan Lam 8 лет назад
Родитель
Сommit
a4d8d32219
2 измененных файлов с 32 добавлено и 18 удалено
  1. 6 6
      public/js/app-project-form.js
  2. 26 12
      views/project_form.php

+ 6 - 6
public/js/app-project-form.js

@@ -49,9 +49,9 @@ function handleSelectButton() {
 
 	lgi.slideUp("fast", function() {
 
-		$(button).text("Deselect");
-		$(button).removeClass("btn-outline-success");
-		$(button).addClass("btn-outline-danger");
+		$(button).find("span").text("Deselect");
+		$(button).removeClass("btn-outline-success").addClass("btn-outline-danger");
+		$(button).find("[data-icon]").attr("data-icon", "times");
 		lgi.detach();
 		$("#selected-locations-list-group").append(lgi);
 		let lgis = $("#selected-locations-list-group .list-group-item");
@@ -75,9 +75,9 @@ function handleDeselectButton() {
 	let button = this;
 
 	lgi.slideUp("fast", function() {
-		$(button).text("Select");
-		$(button).removeClass("btn-outline-danger");
-		$(button).addClass("btn-outline-success");
+		$(button).find("span").text("Select");
+		$(button).removeClass("btn-outline-danger").addClass("btn-outline-success");
+		$(button).find("[data-icon]").attr("data-icon", "check");
 		lgi.detach();
 		$("#not-selected-locations-list-group").append(lgi);
 		let lgis = $("#not-selected-locations-list-group .list-group-item");

+ 26 - 12
views/project_form.php

@@ -126,7 +126,7 @@ $date_deadline = explode(" ", $project->dts_deadline)[0];
 						</div>
 					</div>
 
-					<div class="list-group list-group-flush" id="selected-locations-list-group">
+					<div class="list-group list-group-flush limit-height-2" id="selected-locations-list-group">
 					<?php
 					foreach($locations as $index => $location) {
 						if(!in_array($location->id, $location_ids)) continue;
@@ -139,20 +139,27 @@ $date_deadline = explode(" ", $project->dts_deadline)[0];
 						$filter = strtolower(implode("", $filter_parts));
 						?>
 						<div class="list-group-item" data-location-id="<?=$location->id?>" data-internal-id="<?=htmlspecialchars($location->internal_id)?>" data-name="<?=htmlspecialchars($location->name)?>" data-filter-value="<?=htmlspecialchars($filter)?>">
-							<div class="row">
-								<div class="col-auto">
+							<div class="row no-gutters">
+								<div class="col-2 text-right pr-3">
+									<?=$location->id?>
+								</div>
+								<div class="col">
 									<?=htmlspecialchars($location->name)?>
 									<?php
 									if($location->internal_id) {
 										?>
-										<small>(Internal ID: <?=htmlspecialchars($location->internal_id)?>)</small>
+										<br />
+										<small class="text-primary">Customer Internal ID: <?=htmlspecialchars($location->internal_id)?></small>
 										<?php
 									}
 									?><br />
 									<small><?=htmlspecialchars($address)?></small>
 								</div>
-								<div class="col align-self-center text-right">
-									<button class="btn btn-outline-danger" type="button">Deselect</button>
+								<div class="col-auto align-self-center text-right">
+									<button class="btn btn-outline-danger" type="button">
+										<i class="fas fa-times"></i>
+										<span class="sr-only">Deselect</span>
+									</button>
 								</div>
 							</div>
 						</div>
@@ -181,7 +188,7 @@ $date_deadline = explode(" ", $project->dts_deadline)[0];
 						</div>
 					</div>
 
-					<div class="list-group list-group-flush" id="not-selected-locations-list-group">
+					<div class="list-group list-group-flush limit-height-2" id="not-selected-locations-list-group">
 					<?php
 					foreach($locations as $index => $location) {
 						if(in_array($location->id, $location_ids)) continue;
@@ -194,21 +201,28 @@ $date_deadline = explode(" ", $project->dts_deadline)[0];
 						$filter = strtolower(implode("", $filter_parts));
 						?>
 						<div class="list-group-item" data-location-id="<?=$location->id?>" data-internal-id="<?=htmlspecialchars($location->internal_id)?>" data-name="<?=htmlspecialchars($location->name)?>" data-filter-value="<?=htmlspecialchars($filter)?>">
-							<div class="row">
-								<div class="col-auto">
+							<div class="row no-gutters">
+								<div class="col-2 text-right pr-3">
+									<?=$location->id?>
+								</div>
+								<div class="col">
 									<?=htmlspecialchars($location->name)?>
 									<?php
 									if($location->internal_id) {
 										?>
-										<small>(Internal ID: <?=htmlspecialchars($location->internal_id)?>)</small>
+										<br />
+										<small class="text-primary">Customer Internal ID: <?=htmlspecialchars($location->internal_id)?></small>
 										<?php
 									}
 									?>
 									<br />
 									<small><?=htmlspecialchars($address)?></small>
 								</div>
-								<div class="col align-self-center text-right">
-									<button class="btn btn-outline-success" type="button">Select</button>
+								<div class="col-auto align-self-center text-right">
+									<button class="btn btn-outline-success" type="button">
+										<i class="fas fa-check"></i>
+										<span class="sr-only">Select</span>
+									</button>
 								</div>
 							</div>
 						</div>