Allow the reuse of colors in tags

This commit is contained in:
johnnyq 2023-08-16 14:37:35 -04:00
parent 2915d7a1b7
commit d9dbe718bd
3 changed files with 3 additions and 23 deletions

View File

@ -34,7 +34,7 @@
<?php
foreach($colors_diff as $color) {
foreach($colors_array as $color) {
?>

View File

@ -42,7 +42,7 @@
<?php
foreach($colors_diff as $color) {
foreach($colors_array as $color) {
?>
<div class="col-3 mb-3">
<div class="form-check">

View File

@ -18,28 +18,8 @@ $sql = mysqli_query(
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$colors_used_array = [];
if ($num_rows > 0) {
//Colors Used
$sql_colors_used = mysqli_query(
$mysqli,
"SELECT tag_color FROM tags
WHERE tag_archived_at IS NULL"
);
while ($color_used_row = mysqli_fetch_array($sql_colors_used)) {
$colors_used_array[] = $color_used_row['tag_color'];
}
$colors_diff = array_diff($colors_array, $colors_used_array);
} else {
$colors_diff = $colors_array;
}
?>
<div class="card card-dark">
<div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-tags mr-2"></i>Tags</h3>
@ -81,7 +61,7 @@ if ($num_rows > 0) {
while ($row = mysqli_fetch_array($sql)) {
$tag_id = intval($row['tag_id']);
$tag_name = nullable_htmlentities($row['tag_name']);
$tag_type = nullable_htmlentities($row['tag_type']);
$tag_type = intval($row['tag_type']);
$tag_color = nullable_htmlentities($row['tag_color']);
$tag_icon = nullable_htmlentities($row['tag_icon']);