mirror of https://github.com/itflow-org/itflow
Update Tags filter to only show tags available
This commit is contained in:
parent
573953704c
commit
34e92d2223
20
clients.php
20
clients.php
|
|
@ -190,8 +190,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||
<?php
|
||||
$sql_tags = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1");
|
||||
while ($row = mysqli_fetch_array($sql_tags)) {
|
||||
$sql_tags_filter = mysqli_query($mysqli, "
|
||||
SELECT tags.tag_id, tags.tag_name, tag_type
|
||||
FROM tags
|
||||
LEFT JOIN client_tags ON client_tags.tag_id = tags.tag_id
|
||||
WHERE tag_type = 1
|
||||
GROUP BY tags.tag_id
|
||||
HAVING COUNT(client_tags.client_id) > 0
|
||||
");
|
||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
||||
$tag_id = intval($row['tag_id']);
|
||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||
|
||||
|
|
@ -199,15 +206,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button"
|
||||
data-toggle="ajax-modal"
|
||||
data-modal-size="sm"
|
||||
data-ajax-url="ajax/ajax_tag_add.php"
|
||||
data-ajax-id="1">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
|
|
|
|||
23
contacts.php
23
contacts.php
|
|
@ -117,8 +117,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<div class="input-group">
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||
|
||||
<?php $sql_tags = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 3");
|
||||
while ($row = mysqli_fetch_array($sql_tags)) {
|
||||
<?php
|
||||
$sql_tags_filter = mysqli_query($mysqli, "
|
||||
SELECT tags.tag_id, tags.tag_name, tag_type
|
||||
FROM tags
|
||||
LEFT JOIN contact_tags ON contact_tags.tag_id = tags.tag_id
|
||||
LEFT JOIN contacts ON contact_tags.contact_id = contacts.contact_id
|
||||
WHERE tag_type = 3
|
||||
$client_query -- This ensures we only get tags relevant to the selected client
|
||||
GROUP BY tags.tag_id
|
||||
HAVING COUNT(contact_tags.contact_id) > 0
|
||||
");
|
||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
||||
$tag_id = intval($row['tag_id']);
|
||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||
|
||||
|
|
@ -126,15 +136,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button"
|
||||
data-toggle="ajax-modal"
|
||||
data-modal-size="sm"
|
||||
data-ajax-url="ajax/ajax_tag_add.php"
|
||||
data-ajax-id="2">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -131,8 +131,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<div class="input-group">
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||
|
||||
<?php $sql_tags = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 4");
|
||||
while ($row = mysqli_fetch_array($sql_tags)) {
|
||||
<?php
|
||||
$sql_tags_filter = mysqli_query($mysqli, "
|
||||
SELECT tags.tag_id, tags.tag_name, tag_type
|
||||
FROM tags
|
||||
LEFT JOIN credential_tags ON credential_tags.tag_id = tags.tag_id
|
||||
LEFT JOIN credentials ON credential_tags.credential_id = credentials.credential_id
|
||||
WHERE tag_type = 4
|
||||
$client_query -- This ensures we only get tags relevant to the selected client
|
||||
GROUP BY tags.tag_id
|
||||
HAVING COUNT(credential_tags.credential_id) > 0
|
||||
");
|
||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
||||
$tag_id = intval($row['tag_id']);
|
||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||
|
||||
|
|
@ -140,15 +150,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button"
|
||||
data-toggle="ajax-modal"
|
||||
data-modal-size="sm"
|
||||
data-ajax-url="ajax/ajax_tag_add.php"
|
||||
data-ajax-id="4">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -105,8 +105,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<div class="col-md-3">
|
||||
<div class="input-group">
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||
<?php $sql_tags = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2");
|
||||
while ($row = mysqli_fetch_array($sql_tags)) {
|
||||
<?php
|
||||
$sql_tags_filter = mysqli_query($mysqli, "
|
||||
SELECT tags.tag_id, tags.tag_name, tag_type
|
||||
FROM tags
|
||||
LEFT JOIN location_tags ON location_tags.tag_id = tags.tag_id
|
||||
LEFT JOIN locations ON location_tags.location_id = locations.location_id
|
||||
WHERE tag_type = 2
|
||||
$client_query -- This ensures we only get tags relevant to the selected client
|
||||
GROUP BY tags.tag_id
|
||||
HAVING COUNT(location_tags.location_id) > 0
|
||||
");
|
||||
while ($row = mysqli_fetch_array($sql_tags_filter)) {
|
||||
$tag_id = intval($row['tag_id']);
|
||||
$tag_name = nullable_htmlentities($row['tag_name']); ?>
|
||||
|
||||
|
|
@ -114,15 +124,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button"
|
||||
data-toggle="ajax-modal"
|
||||
data-modal-size="sm"
|
||||
data-ajax-url="ajax/ajax_tag_add.php"
|
||||
data-ajax-id="3">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($client_url) { ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue