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

Added shop_left and shop_right fields for locations. Modified location edit form layout.

Alan Lam 8 лет назад
Родитель
Сommit
f612124b15
3 измененных файлов с 48 добавлено и 22 удалено
  1. 3 0
      controllers/location_edit.php
  2. 1 1
      engine/location.php
  3. 44 21
      views/location_edit_form.php

+ 3 - 0
controllers/location_edit.php

@@ -20,6 +20,9 @@ if($submit) {
 		$location->county = http::value("county", "trim");
 		$location->postal_code = http::value("postal_code", "trim");
 
+		$location->shop_left = http::value("shop_left", "trim");
+		$location->shop_right = http::value("shop_right", "trim");
+
 		$location->latitude = http::value("latitude", "float");
 		$location->longitude = http::value("longitude", "float");
 

+ 1 - 1
engine/location.php

@@ -4,7 +4,7 @@ class Location extends Model {
 
 	protected static $table = "location";
 	protected static $id_field = "id";
-	protected static $fillable_fields = ["customer_id", "name", "address_1", "address_2", "city", "county", "postal_code", "state", "country", "latitude", "longitude", "dts_verified"];
+	protected static $fillable_fields = ["customer_id", "name", "address_1", "address_2", "city", "county", "postal_code", "state", "country", "shop_left", "shop_right", "latitude", "longitude", "dts_verified"];
 
 	protected static $field_map = [
 	];

+ 44 - 21
views/location_edit_form.php

@@ -3,36 +3,59 @@
 
 	<form method="post">
 		<div class="row">
-			<div class="col-lg">
+			<div class="col-lg mb-3">
+				<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($location->name)?>" required />
+					</div>
+				</div>
 
-				<div class="form-group">
-					<label for="name">Name</label>
-					<input class="form-control" type="text" name="name" id="name" placeholder="Enter name" value="<?=htmlspecialchars($location->name)?>" required />
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="address-1">Address Line 1</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="address_1" id="address-1" placeholder="Enter address line 1" value="<?=htmlspecialchars($location->address_1)?>" required />
+					</div>
+				</div>
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="address-2">Address Line 2</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="address_2" id="address-2" placeholder="Enter address line 2" value="<?=htmlspecialchars($location->address_2)?>" />
+					</div>
 				</div>
-				<div class="form-group">
-					<label for="address-1">Address Line 1</label>
-					<input class="form-control" type="text" name="address_1" id="address-1" placeholder="Enter address line 1" value="<?=htmlspecialchars($location->address_1)?>" required />
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="city">City</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="city" id="city" placeholder="Enter city" value="<?=htmlspecialchars($location->city)?>" required />
+					</div>
 				</div>
-				<div class="form-group">
-					<label for="address-2">Address Line 2</label>
-					<input class="form-control" type="text" name="address_2" id="address-2" placeholder="Enter address line 2" value="<?=htmlspecialchars($location->address_2)?>" />
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="county">County</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="county" id="county" placeholder="Enter county" value="<?=htmlspecialchars($location->county)?>" />
+					</div>
 				</div>
-				<div class="form-group">
-					<label for="city">City</label>
-					<input class="form-control" type="text" name="city" id="city" placeholder="Enter city" value="<?=htmlspecialchars($location->city)?>" required />
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="postal-code">Postal Code</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="postal_code" id="postal-code" placeholder="Enter postal code" value="<?=htmlspecialchars($location->postal_code)?>" required />
+					</div>
 				</div>
-				<div class="form-group">
-					<label for="county">County</label>
-					<input class="form-control" type="text" name="county" id="county" placeholder="Enter county" value="<?=htmlspecialchars($location->county)?>" />
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="shop-left">Shop Name (Left)</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="shop_left" id="shop-left" placeholder="Enter shop name (left)" value="<?=htmlspecialchars($location->shop_left)?>" />
+					</div>
 				</div>
-				<div class="form-group">
-					<label for="postal-code">Postal Code</label>
-					<input class="form-control" type="text" name="postal_code" id="postal-code" placeholder="Enter postal code" value="<?=htmlspecialchars($location->postal_code)?>" required />
+				<div class="row mb-1">
+					<label class="col-sm-4 col-form-label" for="shop-right">Shop Name (Right)</label>
+					<div class="col-sm">
+						<input class="form-control" type="text" name="shop_right" id="shop-right" placeholder="Enter shop name (right)" value="<?=htmlspecialchars($location->shop_right)?>" />
+					</div>
 				</div>
 			</div>
 			<div class="col-lg">
-				<label>Map</label>
-				<div class="mb-3" id="map" style="height: 382px;" data-maps data-lat="<?=$location->latitude?>" data-lng="<?=$location->longitude?>" data-zoom="14" data-marker="true" data-marker-draggable="true" data-marker-dragend-target="#map-data"></div>
+				<div class="mb-3" id="map" style="height: 330px;" data-maps data-lat="<?=$location->latitude?>" data-lng="<?=$location->longitude?>" data-zoom="14" data-marker="true" data-marker-draggable="true" data-marker-dragend-target="#map-data"></div>
 
 				<div id="map-data">
 					<input type="hidden" name="latitude" data-latitude value="<?=$location->latitude?>" />