mirror of
https://github.com/itflow-org/itflow
synced 2026-03-09 15:24:51 +00:00
Update Categories Create and Edit Modals to take advantage of custom colors
This commit is contained in:
@@ -31,21 +31,6 @@ if (isset($_GET['archived'])) {
|
||||
$category = "Archived";
|
||||
}
|
||||
|
||||
$colors_used_array = [];
|
||||
|
||||
//Colors Used
|
||||
$sql_colors_used = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT category_color FROM categories
|
||||
WHERE category_type = '$category'
|
||||
AND category_$archive_query"
|
||||
);
|
||||
|
||||
while ($color_used_row = mysqli_fetch_array($sql_colors_used)) {
|
||||
$colors_used_array[] = $color_used_row['category_color'];
|
||||
}
|
||||
$colors_diff = array_diff($colors_array, $colors_used_array);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -59,7 +44,7 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
||||
?>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCategoryModal"><i
|
||||
class="fas fa-plus mr-2"></i>Create</button>
|
||||
class="fas fa-plus mr-2"></i>New <?php echo nullable_htmlentities($category); ?> Category</button>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -75,7 +60,7 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
||||
value="<?php if (isset($q)) {
|
||||
echo stripslashes(nullable_htmlentities($q));
|
||||
} ?>"
|
||||
placeholder="Search Categories">
|
||||
placeholder="Search <?php echo nullable_htmlentities($category); ?> Categories ">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
@@ -140,7 +125,6 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = nullable_htmlentities($row['category_name']);
|
||||
$category_color = nullable_htmlentities($row['category_color']);
|
||||
//$colors_used_array[] = $row['category_color'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
@@ -186,12 +170,9 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
//$colors_diff = array_diff($colors_array,$colors_used_array);
|
||||
|
||||
include "category_edit_modal.php";
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -14,26 +14,22 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list-ul"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Category name" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="form-row">
|
||||
|
||||
<?php
|
||||
|
||||
foreach ($colors_diff as $color) { ?>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $color; ?>">
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-3x fa-circle" style="color:<?php echo $color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-paint-brush"></i></span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<input type="color" class="form-control col-3" name="color" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -14,33 +14,22 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $category_name; ?>" required>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $category_color; ?>" checked>
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-4x fa-circle" style="color:<?php echo $category_color; ?>"></i>
|
||||
</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list-ul"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $category_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<?php
|
||||
|
||||
foreach($colors_diff as $color) { ?>
|
||||
<div class="col-3 mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $color; ?>">
|
||||
<label class="form-check-label">
|
||||
<i class="fa fa-fw fa-3x fa-circle" style="color:<?php echo $color; ?>"></i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-paint-brush"></i></span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<input type="color" class="form-control col-3" name="color" value="<?php echo $category_color; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
$name = sanitizeInput($_POST['name']);
|
||||
$type = sanitizeInput($_POST['type']);
|
||||
$color = preg_replace("/[^0-9a-zA-Z-]/", "", sanitizeInput($_POST['color']));
|
||||
$color = sanitizeInput($_POST['color']);
|
||||
|
||||
Reference in New Issue
Block a user