diff --git a/admin/calendar.php b/admin/calendar.php index 4bec0989..732d68a2 100644 --- a/admin/calendar.php +++ b/admin/calendar.php @@ -53,6 +53,7 @@ define('MFH_CALENDAR', 1); $rs = hesk_dbQuery("SELECT `id`, `name`, `color` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `cat_order`"); $categories = []; while ($row = hesk_dbFetchAssoc($rs)) { + $row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000' : 'background: ' . $row['color']; $categories[] = $row; } @@ -64,7 +65,28 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?>
-
+
+
+
+

Categories

+
+
+
    + +
  • +
    + +
    + + + +
  • + +
+
+
+
+

Calendar

diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 2e2e48e0..8fc0ddc1 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -262,11 +262,11 @@ while ($mycat = hesk_dbFetchAssoc($res)) { } $tmp = $i ? 'White' : 'Blue'; - $style = 'font-weight:normal;font-size:1em'; + $style = ''; if ($mycat['color'] == null) { - $style .= ';color: black'; + $style .= 'color: black; border: solid 1px #000'; } else { - $style .= ';background: ' . $mycat['color']; + $style .= 'background: ' . $mycat['color']; } $i = $i ? 0 : 1; @@ -307,7 +307,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) { data-color="'. htmlspecialchars($mycat['color']) . '" data-priority="' . $mycat['priority'] . '" data-manager="' . $mycat['manager'] . '"> ' . $mycat['id'] . ' - ' . $mycat['name'] . ' + ' . $mycat['name'] . ' ' . $priorities[$mycat['priority']]['formatted'] . ' ' . $all . ' diff --git a/css/mods-for-hesk.css b/css/mods-for-hesk.css index 1ec09169..b6bdb683 100644 --- a/css/mods-for-hesk.css +++ b/css/mods-for-hesk.css @@ -315,4 +315,9 @@ div.setupButtons { .no-bottom-border { border-bottom: none; +} + +.category-label { + font-weight: normal; + font-size: 1em; } \ No newline at end of file diff --git a/js/calendar/mods-for-hesk-calendar.js b/js/calendar/mods-for-hesk-calendar.js index ee643529..52e127ce 100644 --- a/js/calendar/mods-for-hesk-calendar.js +++ b/js/calendar/mods-for-hesk-calendar.js @@ -214,6 +214,7 @@ $(document).ready(function() { success: function(id) { addToCalendar(id, data, "Event successfully created"); $('#create-event-modal').modal('hide'); + updateCategoryVisibility(); }, error: function(data) { $.jGrowl('An error occurred when trying to create the event', { theme: 'alert-danger', closeTemplate: '' }); @@ -262,6 +263,8 @@ $(document).ready(function() { } }); }); + + $('input[name="category-toggle"]').change(updateCategoryVisibility); }); function addToCalendar(id, event, successMessage) { @@ -290,7 +293,8 @@ function buildEvent(id, dbObject) { color: endOfDay.isBefore() ? '#dd0000' : 'green', allDay: true, type: dbObject.type, - categoryId: dbObject.categoryId + categoryId: dbObject.categoryId, + className: 'category-' + dbObject.categoryId }; } @@ -305,6 +309,7 @@ function buildEvent(id, dbObject) { type: dbObject.type, categoryId: dbObject.categoryId, categoryName: dbObject.categoryName, + className: 'category-' + dbObject.categoryId, color: dbObject.categoryColor, textColor: calculateTextColor(dbObject.categoryColor) }; @@ -395,4 +400,16 @@ function displayEditModal(date) { $form.find('select[name="category"] option[value="' + date.categoryId + '"]').prop('selected', true); $('#edit-event-modal').modal('show'); +} + +function updateCategoryVisibility() { + $('input[name="category-toggle"]').each(function() { + $this = $(this); + + if ($this.is(':checked')) { + $('.category-' + $this.val()).show(); + } else { + $('.category-' + $this.val()).hide(); + } + }); } \ No newline at end of file