mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-24 06:40:01 +01:00
prepared autocomplete
This commit is contained in:
parent
1c18fe20a0
commit
7b700cb820
5 changed files with 14 additions and 13 deletions
|
@ -14,7 +14,7 @@
|
||||||
#Rezept Seite
|
#Rezept Seite
|
||||||
RewriteRule ^recipe/([0-9]+)$ ?site=recipe&number=$1
|
RewriteRule ^recipe/([0-9]+)$ ?site=recipe&number=$1
|
||||||
|
|
||||||
#Rezepteditieren
|
#Rezept editieren
|
||||||
RewriteRule ^edit-recipe/([0-9]+)$ ?site=edit-recipe&number=$1
|
RewriteRule ^edit-recipe/([0-9]+)$ ?site=edit-recipe&number=$1
|
||||||
|
|
||||||
#Loginseite
|
#Loginseite
|
||||||
|
|
1
bin/bootstrap.autocomplete.js
vendored
Normal file
1
bin/bootstrap.autocomplete.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -4,15 +4,14 @@ $(document).ready(function () {
|
||||||
$("input[type=number]").on("focus", function () { $(this).select(); });
|
$("input[type=number]").on("focus", function () { $(this).select(); });
|
||||||
$("input[type=text]").on("focus", function () { $(this).select(); });
|
$("input[type=text]").on("focus", function () { $(this).select(); });
|
||||||
|
|
||||||
// $(".ingredientName").on("focus", function () {
|
// implement autocomplete with https://bootstrap-autocomplete.readthedocs.io/en/latest/#
|
||||||
// autocomplete(this, values);
|
$(".autocomplete-ingredient").autoComplete(
|
||||||
// });
|
{
|
||||||
// $(".ingredientName").keydown(function (x) {
|
resolverSettings: {
|
||||||
// if ((x.keyCode == 9) && ($(this).parent().parent().next().prop("class") != $(this).parent().parent().prop("class"))) {
|
url: '/api/recipes/auto'
|
||||||
// $(this).parent().parent().find(".addIngredient").click();
|
}
|
||||||
// }
|
}
|
||||||
// });
|
);
|
||||||
// $(".ingredientAmount").on("focus", function () { $(this).select(); });
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
$additionalInput = "";
|
$additionalInput = "";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!-- <script src="/bin/autocomplete.js" charset="utf-8"></script> -->
|
<script src="/bin/bootstrap.autocomplete.js" charset="utf-8"></script>
|
||||||
<script src="/bin/manageRecipe.js" charset="utf-8"></script>
|
<script src="/bin/manageRecipe.js" charset="utf-8"></script>
|
||||||
<?php echo $script; ?>
|
<?php echo $script; ?>
|
||||||
<div class="container mt-5">
|
<div class="container mt-5">
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" name="ingredient[1][Name]" placeholder="Zutat" required>
|
<input type="text" class="autocomplete-ingredient form-control" name="ingredient[1][Name]" placeholder="Zutat" autocomplete="off" required>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text p-0"><button onclick="removeItem(this);" class="removeItem fas fa-trash-alt bg-transparent rounded-right border-0 p-2 pl-3 pr-3 text-danger"></button></span>
|
<span class="input-group-text p-0"><button onclick="removeItem(this);" class="removeItem fas fa-trash-alt bg-transparent rounded-right border-0 p-2 pl-3 pr-3 text-danger"></button></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -180,8 +180,9 @@
|
||||||
$values = array();
|
$values = array();
|
||||||
$result = $mysqli->query("SELECT Name FROM Zutat ORDER BY Name ASC");
|
$result = $mysqli->query("SELECT Name FROM Zutat ORDER BY Name ASC");
|
||||||
while($item = $result->fetch_assoc()){
|
while($item = $result->fetch_assoc()){
|
||||||
echo $item["Name"]."||";
|
array_push($values, $item["Name"]);
|
||||||
}
|
}
|
||||||
|
print_r(json_encode($values));
|
||||||
$mysqli->close();
|
$mysqli->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue