mirror of
https://github.com/itflow-org/itflow
synced 2026-03-28 16:25:40 +00:00
Add UI and logic for location Description, Tweak Location Listing UI to use the media class
This commit is contained in:
@@ -13,21 +13,25 @@
|
|||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-address">Address</a>
|
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-address">Address</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-contact">Contact</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-contact">Contact</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-photo">Photo</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="pills-address">
|
<div class="tab-pane fade show active" id="pills-details">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
||||||
@@ -44,6 +48,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short Description">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Photo</label>
|
||||||
|
<input type="file" class="form-control-file" name="file">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-address">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Address</label>
|
<label>Address</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -151,10 +174,10 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-photo">
|
<div class="tab-pane fade" id="pills-notes">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="file" class="form-control-file" name="file">
|
<textarea class="form-control" rows="8" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,13 +15,16 @@
|
|||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-address<?php echo $location_id; ?>">Address</a>
|
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $location_id; ?>">Details</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="pill" href="#pills-address<?php echo $location_id; ?>">Address</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-contact<?php echo $location_id; ?>">Contact</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-contact<?php echo $location_id; ?>">Contact</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-photo<?php echo $location_id; ?>">Photo</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $location_id; ?>">Notes</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -29,7 +32,47 @@
|
|||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="pills-address<?php echo $location_id; ?>">
|
<div class="tab-pane fade show active" id="pills-details<?php echo $location_id; ?>">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Name of location" value="<?php echo $location_name; ?>" required>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<div class="input-group-text">
|
||||||
|
<input type="checkbox" name="location_primary" value="1" <?php if ($location_primary == 1) { echo "checked"; } ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Short Description" value="<?php echo $location_description; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3" style="text-align: center;">
|
||||||
|
<?php if (!empty($location_photo)) { ?>
|
||||||
|
<img class="img-fluid" src="<?php echo "uploads/clients/$client_id/$location_photo"; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Photo</label>
|
||||||
|
<input type="file" class="form-control-file" name="file">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="pills-address<?php echo $location_id; ?>">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
|
||||||
@@ -160,16 +203,10 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-photo<?php echo $location_id; ?>">
|
<div class="tab-pane fade" id="pills-notes<?php echo $location_id; ?>">
|
||||||
|
|
||||||
<div class="mb-3" style="text-align: center;">
|
|
||||||
<?php if (!empty($location_photo)) { ?>
|
|
||||||
<img class="img-fluid" src="<?php echo "uploads/clients/$client_id/$location_photo"; ?>">
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="file" class="form-control-file" name="file">
|
<textarea class="form-control" rows="8" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"><?php echo $location_notes; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
<p><strong>Format csv file with headings & data:</strong><br>Name, Address, City, State, Postal Code, Phone, Hours</p>
|
<p><strong>Format csv file with headings & data:</strong><br>Name, Description, Address, City, State, Postal Code, Phone, Hours</p>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="form-group my-4">
|
<div class="form-group my-4">
|
||||||
<input type="file" class="form-control-file" name="file" accept=".csv">
|
<input type="file" class="form-control-file" name="file" accept=".csv">
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ $sql = mysqli_query(
|
|||||||
"SELECT SQL_CALC_FOUND_ROWS * FROM locations
|
"SELECT SQL_CALC_FOUND_ROWS * FROM locations
|
||||||
WHERE location_client_id = $client_id
|
WHERE location_client_id = $client_id
|
||||||
AND location_$archive_query
|
AND location_$archive_query
|
||||||
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%')
|
AND (location_name LIKE '%$q%' OR location_description LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%')
|
||||||
ORDER BY location_primary DESC, $sort $order LIMIT $record_from, $record_to"
|
ORDER BY location_primary DESC, $sort $order LIMIT $record_from, $record_to"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -89,6 +89,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$location_id = intval($row['location_id']);
|
$location_id = intval($row['location_id']);
|
||||||
$location_name = nullable_htmlentities($row['location_name']);
|
$location_name = nullable_htmlentities($row['location_name']);
|
||||||
|
$location_description = nullable_htmlentities($row['location_description']);
|
||||||
$location_country = nullable_htmlentities($row['location_country']);
|
$location_country = nullable_htmlentities($row['location_country']);
|
||||||
$location_address = nullable_htmlentities($row['location_address']);
|
$location_address = nullable_htmlentities($row['location_address']);
|
||||||
$location_city = nullable_htmlentities($row['location_city']);
|
$location_city = nullable_htmlentities($row['location_city']);
|
||||||
@@ -112,18 +113,28 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$location_contact_id = intval($row['location_contact_id']);
|
$location_contact_id = intval($row['location_contact_id']);
|
||||||
$location_primary = intval($row['location_primary']);
|
$location_primary = intval($row['location_primary']);
|
||||||
if ( $location_primary == 1 ) {
|
if ( $location_primary == 1 ) {
|
||||||
$location_primary_display = "<p class='text-success'>Primary Location</p>";
|
$location_primary_display = "<small class='text-success ml-1'><i class='fa fa-fw fa-check'></i> Primary</small>";
|
||||||
} else {
|
} else {
|
||||||
$location_primary_display = "";
|
$location_primary_display = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<td>
|
||||||
<i class="fa fa-fw fa-map-marker-alt text-secondary"></i>
|
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>">
|
||||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>"><?php echo $location_name; ?></a>
|
<div class="media">
|
||||||
<?php echo $location_primary_display; ?>
|
<i class="fa fa-fw fa-2x fa-map-marker-alt text-secondary mr-3 mt-1"></i>
|
||||||
</th>
|
<div class="media-body">
|
||||||
|
<p>
|
||||||
|
<strong><?php echo $location_name; ?></strong><?php echo $location_primary_display; ?>
|
||||||
|
<br>
|
||||||
|
<small class="text-secondary"><?php echo $location_description; ?></small>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo $location_address; ?><br><?php echo "$location_city $location_state $location_zip"; ?></a></td>
|
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo $location_address; ?><br><?php echo "$location_city $location_state $location_zip"; ?></a></td>
|
||||||
<td><?php echo $location_phone_display; ?></td>
|
<td><?php echo $location_phone_display; ?></td>
|
||||||
<td><?php echo $location_hours_display; ?></td>
|
<td><?php echo $location_hours_display; ?></td>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$client_id = intval($_POST['client_id']);
|
$client_id = intval($_POST['client_id']);
|
||||||
$name = sanitizeInput($_POST['name']);
|
$name = sanitizeInput($_POST['name']);
|
||||||
|
$description = sanitizeInput($_POST['description']);
|
||||||
$country = sanitizeInput($_POST['country']);
|
$country = sanitizeInput($_POST['country']);
|
||||||
$address = sanitizeInput($_POST['address']);
|
$address = sanitizeInput($_POST['address']);
|
||||||
$city = sanitizeInput($_POST['city']);
|
$city = sanitizeInput($_POST['city']);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ if(isset($_POST['add_location'])){
|
|||||||
mkdir("uploads/clients/$client_id");
|
mkdir("uploads/clients/$client_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO locations SET location_name = '$name', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact, location_client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO locations SET location_name = '$name', location_description = '$description', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact, location_client_id = $client_id");
|
||||||
|
|
||||||
$location_id = mysqli_insert_id($mysqli);
|
$location_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ if(isset($_POST['edit_location'])){
|
|||||||
mkdir("uploads/clients/$client_id");
|
mkdir("uploads/clients/$client_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE locations SET location_name = '$name', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact WHERE location_id = $location_id");
|
mysqli_query($mysqli,"UPDATE locations SET location_name = '$name', location_description = '$description', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact WHERE location_id = $location_id");
|
||||||
|
|
||||||
// Update Primay location in clients if primary location is checked
|
// Update Primay location in clients if primary location is checked
|
||||||
if ($location_primary == 1) {
|
if ($location_primary == 1) {
|
||||||
@@ -206,12 +206,12 @@ if(isset($_POST['export_client_locations_csv'])){
|
|||||||
$f = fopen('php://memory', 'w');
|
$f = fopen('php://memory', 'w');
|
||||||
|
|
||||||
//set column headers
|
//set column headers
|
||||||
$fields = array('Name', 'Address', 'City', 'State', 'Postal Code', 'Phone', 'Hours');
|
$fields = array('Name', 'Description', 'Address', 'City', 'State', 'Postal Code', 'Phone', 'Hours');
|
||||||
fputcsv($f, $fields, $delimiter);
|
fputcsv($f, $fields, $delimiter);
|
||||||
|
|
||||||
//output each row of the data, format line as csv and write to file pointer
|
//output each row of the data, format line as csv and write to file pointer
|
||||||
while($row = $sql->fetch_assoc()){
|
while($row = $sql->fetch_assoc()){
|
||||||
$lineData = array($row['location_name'], $row['location_address'], $row['location_city'], $row['location_state'], $row['location_zip'], $row['location_phone'], $row['location_hours']);
|
$lineData = array($row['location_name'], $row['location_description'], $row['location_address'], $row['location_city'], $row['location_state'], $row['location_zip'], $row['location_phone'], $row['location_hours']);
|
||||||
fputcsv($f, $lineData, $delimiter);
|
fputcsv($f, $lineData, $delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ if(isset($_POST["import_client_locations_csv"])){
|
|||||||
//(Else)Check column count
|
//(Else)Check column count
|
||||||
$f = fopen($file_name, "r");
|
$f = fopen($file_name, "r");
|
||||||
$f_columns = fgetcsv($f, 1000, ",");
|
$f_columns = fgetcsv($f, 1000, ",");
|
||||||
if(!$error & count($f_columns) != 7) {
|
if(!$error & count($f_columns) != 8) {
|
||||||
$error = true;
|
$error = true;
|
||||||
$_SESSION['alert_message'] = "Bad column count.";
|
$_SESSION['alert_message'] = "Bad column count.";
|
||||||
}
|
}
|
||||||
@@ -278,28 +278,31 @@ if(isset($_POST["import_client_locations_csv"])){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isset($column[1])){
|
if(isset($column[1])){
|
||||||
$address = sanitizeInput($column[1]);
|
$description = sanitizeInput($column[1]);
|
||||||
}
|
}
|
||||||
if(isset($column[2])){
|
if(isset($column[2])){
|
||||||
$city = sanitizeInput($column[2]);
|
$address = sanitizeInput($column[2]);
|
||||||
}
|
}
|
||||||
if(isset($column[3])){
|
if(isset($column[3])){
|
||||||
$state = sanitizeInput($column[3]);
|
$city = sanitizeInput($column[3]);
|
||||||
}
|
}
|
||||||
if(isset($column[4])){
|
if(isset($column[4])){
|
||||||
$zip = sanitizeInput($column[4]);
|
$state = sanitizeInput($column[4]);
|
||||||
}
|
}
|
||||||
if(isset($column[5])){
|
if(isset($column[5])){
|
||||||
$phone = preg_replace("/[^0-9]/", '',$column[5]);
|
$zip = sanitizeInput($column[5]);
|
||||||
}
|
}
|
||||||
if(isset($column[6])){
|
if(isset($column[6])){
|
||||||
$hours = sanitizeInput($column[6]);
|
$phone = preg_replace("/[^0-9]/", '',$column[6]);
|
||||||
|
}
|
||||||
|
if(isset($column[7])){
|
||||||
|
$hours = sanitizeInput($column[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if duplicate was detected
|
// Check if duplicate was detected
|
||||||
if($duplicate_detect == 0){
|
if($duplicate_detect == 0){
|
||||||
//Add
|
//Add
|
||||||
mysqli_query($mysqli,"INSERT INTO locations SET location_name = '$name', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_hours = '$hours', location_client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO locations SET location_name = '$name', location_description = '$description', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_hours = '$hours', location_client_id = $client_id");
|
||||||
$row_count = $row_count + 1;
|
$row_count = $row_count + 1;
|
||||||
}else{
|
}else{
|
||||||
$duplicate_count = $duplicate_count + 1;
|
$duplicate_count = $duplicate_count + 1;
|
||||||
@@ -336,7 +339,7 @@ if(isset($_GET['download_client_locations_csv_template'])){
|
|||||||
$f = fopen('php://memory', 'w');
|
$f = fopen('php://memory', 'w');
|
||||||
|
|
||||||
//set column headers
|
//set column headers
|
||||||
$fields = array('Name', 'Address', 'City', 'State', 'Postal Code', 'Phone', 'Hours');
|
$fields = array('Name', 'Description', 'Address', 'City', 'State', 'Postal Code', 'Phone', 'Hours');
|
||||||
fputcsv($f, $fields, $delimiter);
|
fputcsv($f, $fields, $delimiter);
|
||||||
|
|
||||||
//move back to beginning of file
|
//move back to beginning of file
|
||||||
|
|||||||
Reference in New Issue
Block a user