mirror of https://github.com/itflow-org/itflow
Added Array Tagging to Add Client also added Tag Icon Field
This commit is contained in:
parent
ee1230e18a
commit
c9065e8348
|
|
@ -23,6 +23,9 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-additional">Additional</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-tag">Tag</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
|
@ -261,6 +264,35 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-tag">
|
||||
|
||||
<ul class="list-group">
|
||||
|
||||
<?php
|
||||
$sql_tags_select = mysqli_query($mysqli,"SELECT * FROM tags WHERE tag_archived_at IS NULL AND company_id = $session_company_id ORDER BY tag_name ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_tags_select)){
|
||||
$tag_id_select = $row['tag_id'];
|
||||
$tag_name_select = $row['tag_name'];
|
||||
$tag_color_select = $row['tag_color'];
|
||||
$tag_icon_select = $row['tag_icon'];
|
||||
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" name="tags[]" value="<?php echo $tag_id_select; ?>">
|
||||
<label class="form-check-label ml-2" style="color:<?php echo $tag_color_select ?>;"><?php echo "<i class='fa fw fa-$tag_icon_select'></i>"; ?> <?php echo $tag_name_select; ?></label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
<input type="text" class="form-control" name="name" placeholder="Tag name" required autofocus>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<label>Color</label>
|
||||
<div class="form-row">
|
||||
|
||||
<?php
|
||||
|
||||
foreach($colors_diff as $color) {
|
||||
foreach($colors_diff as $color) {
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -36,6 +36,11 @@
|
|||
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Icon</label>
|
||||
<input type="text" class="form-control" name="icon" placeholder="Icon ex handshake">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<input type="text" class="form-control" name="name" value="<?php echo $tag_name; ?>" required>
|
||||
</div>
|
||||
|
||||
<label>Color <strong class="text-danger">*</strong></label>
|
||||
<label>Color</label>
|
||||
<div class="mb-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="color" value="<?php echo $tag_color; ?>" checked>
|
||||
|
|
@ -42,6 +42,11 @@
|
|||
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Icon</label>
|
||||
<input type="text" class="form-control" name="icon" placeholder="Icon ex handshake" value="<?php echo $tag_icon; ?>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
|
|
|
|||
12
post.php
12
post.php
|
|
@ -921,6 +921,12 @@ if(isset($_POST['add_client'])){
|
|||
|
||||
}
|
||||
|
||||
//Add Tags
|
||||
|
||||
foreach($_POST['tags'] as $tag_id){
|
||||
mysqli_query($mysqli,"INSERT INTO client_tags SET client_id = $client_id, tag_id = $tag_id, client_tag_created_at = NOW()");
|
||||
}
|
||||
|
||||
$_SESSION['alert_message'] = "Client added";
|
||||
|
||||
header("Location: clients.php");
|
||||
|
|
@ -1751,8 +1757,9 @@ if(isset($_POST['add_tag'])){
|
|||
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$color = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['color'])));
|
||||
$icon = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['icon'])));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO tags SET tag_name = '$name', tag_color = '$color', tag_created_at = NOW(), company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO tags SET tag_name = '$name', tag_color = '$color', tag_icon = '$icon', tag_created_at = NOW(), company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Tag', log_action = 'Created', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
|
@ -1768,8 +1775,9 @@ if(isset($_POST['edit_tag'])){
|
|||
$tag_id = intval($_POST['tag_id']);
|
||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$color = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['color'])));
|
||||
$icon = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['icon'])));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE tags SET tag_name = '$name', tag_color = '$color', tag_updated_at = NOW() WHERE tag_id = $tag_id AND company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"UPDATE tags SET tag_name = '$name', tag_color = '$color', tag_icon = '$icon', tag_updated_at = NOW() WHERE tag_id = $tag_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Tag', log_action = 'Modified', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
|
|
|||
2
tags.php
2
tags.php
|
|
@ -112,7 +112,7 @@ $colors_diff = array_diff($colors_array,$colors_used_array);
|
|||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editTagModal<?php echo $tag_id; ?>"><?php echo "$tag_name"; ?></a></td>
|
||||
<td><?php echo "<i class='fa fa-fw fa-$tag_icon'></i>"; ?> <a class="text-dark" href="#" data-toggle="modal" data-target="#editTagModal<?php echo $tag_id; ?>"><?php echo "$tag_name"; ?></a></td>
|
||||
<td><i class="fa fa-3x fa-circle" style="color:<?php echo $tag_color; ?>;"></i></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
|
|
|
|||
Loading…
Reference in New Issue