ticketcenter update
This commit is contained in:
2
layout/frontend/b2c/dist/css/global.css
vendored
2
layout/frontend/b2c/dist/css/global.css
vendored
@@ -10,7 +10,7 @@
|
||||
--fs-300: 0.6125em;
|
||||
--fs-400: 0.75em;
|
||||
--fs-500: 0.875em;
|
||||
--fs-600: 1.2em;
|
||||
--fs-600: 1em;
|
||||
--fs-700: 1.1em;
|
||||
--fs-800: 1.4em;
|
||||
--fs-900: 1.7em;
|
||||
|
||||
@@ -86,7 +86,7 @@ function intranet_show($sitepart_id) {
|
||||
$include = MODULE_PATH.'/intranet/qr_code.php';
|
||||
break;
|
||||
case 27:
|
||||
$include = MODULE_PATH.'/ticketcenter/show_ticketcenter.inc.php';
|
||||
$include = MODULE_PATH.'/ticketcenter/views/ticketcenter/show_ticketcenter.inc.php';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
<?php
|
||||
$translation = \DynCom\mysyde\common\classes\Registry::get("translation");
|
||||
$formname = "form_category_list";
|
||||
$inputname = "input_id";
|
||||
?>
|
||||
|
||||
<ul class="toolbar_menu">
|
||||
<?= button("new", $translation->get("new"), $formname, "loadCard('new_category', true)"); ?>
|
||||
|
||||
|
||||
</ul>
|
||||
<div id="mainContent">
|
||||
|
||||
<h1><?php echo get_translation('Zuständige Abteilung'); ?></h1>
|
||||
|
||||
<form id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<input name="input_id" type="hidden" value="<?= $input_id ?>">
|
||||
<input type="hidden" class="selected_linklist_row" name="input_category_id" value="" />
|
||||
<input type="hidden" name="fieldtype" value="" />
|
||||
<input type="hidden" name="type_id" value="" />
|
||||
<div id="page_linklist" class="category_list_view">
|
||||
<?
|
||||
show_category();
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var reorderCall = null;
|
||||
var dragEnabled = false;
|
||||
|
||||
function toggleDragDrop( _aTag ) {
|
||||
if (dragEnabled === false) {
|
||||
dragEnabled = true;
|
||||
$('ol.sortable').addClass("enabled");
|
||||
$('ol.sortable').nestedSortable("option", "disabled", false);
|
||||
$(_aTag).html("<?php echo $translation->get('disable_drag_drop'); ?>");
|
||||
} else {
|
||||
dragEnabled = false;
|
||||
$('ol.sortable').removeClass("enabled");
|
||||
$('ol.sortable').nestedSortable("option", "disabled", true);
|
||||
$(_aTag).html("<?php echo $translation->get('enable_drag_drop'); ?>");
|
||||
}
|
||||
}
|
||||
|
||||
$('ol.sortable').nestedSortable({
|
||||
forcePlaceholderSize: true,
|
||||
handle : '.dd-icon',
|
||||
helper : 'clone',
|
||||
items : 'li',
|
||||
opacity : .6,
|
||||
placeholder : 'placeholder',
|
||||
revert : 250,
|
||||
tabSize : 25,
|
||||
tolerance : 'pointer',
|
||||
toleranceElement : '> div',
|
||||
maxLevels : 5,
|
||||
isTree : true,
|
||||
expandOnHover : 1000,
|
||||
cookieIndex : 'nestedSortable_expanded2',
|
||||
startCollapsed : true,
|
||||
stop : function ( event, ui ) {
|
||||
reorder_category();
|
||||
store_expanded();
|
||||
},
|
||||
disabled : false
|
||||
});
|
||||
|
||||
$('.disclose').click(function () {
|
||||
$(this).closest('li').toggleClass('mjs-nestedSortable-collapsed').toggleClass('mjs-nestedSortable-expanded');
|
||||
store_expanded();
|
||||
});
|
||||
|
||||
function store_expanded() {
|
||||
var list = [];
|
||||
$('ol.sortable').find('li.mjs-nestedSortable-expanded').each(function () {
|
||||
list.push($(this).attr("id"));
|
||||
});
|
||||
$.cookie('nestedSortable_expanded2', list.join(','));
|
||||
}
|
||||
|
||||
function reorder_category() {
|
||||
if (reorderCall !== null) {
|
||||
reorderCall.abort();
|
||||
}
|
||||
|
||||
serialized = $('ol.sortable').nestedSortable('serialize');
|
||||
arraied = $('ol.sortable').nestedSortable('toHierarchy', {startDepthCount: 0});
|
||||
var parameter = {
|
||||
list: arraied
|
||||
};
|
||||
reorderCall = jQuery.post("?action=reorder_category", parameter, function ( output, status, xhr ) {
|
||||
if (xhr.getResponseHeader('REQUIRES_AUTH') == 1) {
|
||||
window.location.replace("/mysyde/");
|
||||
} else {
|
||||
console.log(output);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
44
module/ticketcenter/services/ticketcenter.api.php
Normal file
44
module/ticketcenter/services/ticketcenter.api.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
|
||||
session_start();
|
||||
$currDir = __DIR__;
|
||||
$rootDir = dirname(dirname(dirname($currDir)));
|
||||
$mysydeDir = $rootDir . '/mysyde';
|
||||
|
||||
require_once($rootDir . '/vendor/autoload.php');
|
||||
require_once($rootDir . "/mysyde/frontend/frontend_functions.inc.php");
|
||||
|
||||
$envDir = $rootDir . '/config';
|
||||
$envFilePath = $envDir . '/.env';
|
||||
if (is_dir($envDir) && file_exists($envFilePath) && is_file($envFilePath) && is_readable($envFilePath)) {
|
||||
$dotenv = new \Dotenv\Dotenv($envDir);
|
||||
$dotenv->load();
|
||||
}
|
||||
$common = $mysydeDir ."/common/common_functions.inc.php";
|
||||
require_once($common);
|
||||
|
||||
$connEnv = (local_environment()) ? $mysydeDir."/dc.config.php" : $mysydeDir."/dc-server.config.php";
|
||||
|
||||
require_once($connEnv);
|
||||
|
||||
db_connect();
|
||||
|
||||
|
||||
switch ($_POST['action']) {
|
||||
case 'get_tickets':
|
||||
get_tickets();
|
||||
break;
|
||||
default:
|
||||
echo json_encode(['error' => 'Invalid action']);
|
||||
break;
|
||||
}
|
||||
|
||||
function get_tickets() {
|
||||
$contact = $_SESSION['main_contact'];
|
||||
$contact_json = json_encode($contact);
|
||||
|
||||
return json_encode(['contact' => $contact_json]);
|
||||
}
|
||||
@@ -109,8 +109,7 @@ function save_category()
|
||||
$query = "UPDATE main_tickets_category SET
|
||||
description = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||||
text = '" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_text"]) . "',
|
||||
escalation_state = '" . $_REQUEST["input_escalation_state"] . "',
|
||||
service_center = '" . ($_REQUEST["input_service_center"] == "on" ? 1 : 0) . "'
|
||||
escalation_state = '" . $_REQUEST["input_escalation_state"] . "'
|
||||
WHERE id = '" . $_REQUEST["input_category_id"] . "' LIMIT 1";
|
||||
|
||||
@mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
@@ -128,13 +127,12 @@ function save_category()
|
||||
|
||||
$query = "
|
||||
INSERT INTO main_tickets_category
|
||||
(description, text, code, escalation_state, service_center, sorting)
|
||||
(description, text, code, escalation_state, sorting)
|
||||
VALUES (
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_description"]) . "',
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_text"]) . "',
|
||||
'" . mysqli_real_escape_string($GLOBALS['mysql_con'], $_REQUEST["input_code"]) . "',
|
||||
" . (int) $_REQUEST["input_escalation_state"] . ",
|
||||
" . (($_REQUEST["input_service_center"] == "on") ? 1 : 0) . ",
|
||||
" . (int) $sorting . "
|
||||
)";
|
||||
|
||||
@@ -223,7 +223,7 @@ function save_ticket($close = FALSE)
|
||||
isset($_POST["input_subcategory"]) ? $_POST["input_subcategory"] : null,
|
||||
isset($_POST["input_subsubcategory"]) ? $_POST["input_subsubcategory"] : null);
|
||||
|
||||
insert_main_service_items_history($_POST['input_ticket_no'], $_POST['input_description'], $input_id, $_POST["input_service_item"]);
|
||||
// insert_main_service_items_history($_POST['input_ticket_no'], $_POST['input_description'], $input_id, $_POST["input_service_item"]);
|
||||
|
||||
|
||||
if ($close == TRUE) {
|
||||
@@ -1319,6 +1319,21 @@ function getContactsByCategory($category_id) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// make fetch to server to get subsubcategory data based on subcategory id and insert it after subcategory select
|
||||
// fetch('/module/ticketcenter/services/show_ticketcenter_ajax.php', {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/x-www-form-urlencoded'
|
||||
// },
|
||||
// body: new URLSearchParams({ action: "get_tickets" })
|
||||
// })
|
||||
// .then(response => response.text())
|
||||
// .then(data => {
|
||||
// console.log(data);
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.error('Error:', error);
|
||||
// })
|
||||
|
||||
</script>
|
||||
|
||||
</script>
|
||||
@@ -5,6 +5,7 @@ if (isset($_GET['service_item_no'])) {
|
||||
$ticket['service_item_no'] = $_GET['service_item_no'];
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" href="/module/ticketcenter/css/repair.css">
|
||||
<script type="text/javascript"
|
||||
src="/mysyde/admin/admin.js?t=<?= filemtime($_SERVER['DOCUMENT_ROOT'] . '/mysyde/admin/admin.js') ?>"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
@@ -0,0 +1,941 @@
|
||||
<script type="text/javascript" src="/mysyde/admin/admin.js"></script>
|
||||
<?php
|
||||
$formname = "form_ticket_list";
|
||||
|
||||
// Enable error reporting
|
||||
// ini_set('display_errors', 1);
|
||||
// ini_set('display_startup_errors', 1);
|
||||
// error_reporting(E_ALL);
|
||||
|
||||
|
||||
function load_ticket_list($cue)
|
||||
{
|
||||
|
||||
// Query to get user's department and mandant information
|
||||
$contact_info_query = "SELECT
|
||||
mcd.main_mandant_id,
|
||||
mcd.main_department_id
|
||||
FROM
|
||||
main_contact_department mcd
|
||||
WHERE
|
||||
mcd.main_contact_id = " . $GLOBALS['main_contact']['id'];
|
||||
|
||||
$contact_info_result = mysqli_query($GLOBALS['mysql_con'], $contact_info_query);
|
||||
|
||||
$mandant_ids = [];
|
||||
$department_ids = [];
|
||||
|
||||
while ($contact_info = mysqli_fetch_assoc($contact_info_result)) {
|
||||
if (!empty($contact_info['main_mandant_id']) && !in_array($contact_info['main_mandant_id'], $mandant_ids)) {
|
||||
$mandant_ids[] = $contact_info['main_mandant_id'];
|
||||
}
|
||||
|
||||
if (!empty($contact_info['main_department_id']) && !in_array($contact_info['main_department_id'], $department_ids)) {
|
||||
$department_ids[] = $contact_info['main_department_id'];
|
||||
}
|
||||
}
|
||||
|
||||
// For debugging
|
||||
// echo "User Mandant IDs: " . implode(', ', $mandant_ids) . "<br>";
|
||||
// echo "User Department IDs: " . implode(', ', $department_ids) . "<br>";
|
||||
|
||||
// Store the result in contact_info for compatibility with existing code
|
||||
$contact_info = [
|
||||
'mandant_ids' => implode(', ', $mandant_ids),
|
||||
'department_ids' => implode(', ', $department_ids)
|
||||
];
|
||||
|
||||
$join = "";
|
||||
$additional_joins = "";
|
||||
$additional_where = "";
|
||||
if (isset($cue)) {
|
||||
switch ($cue) {
|
||||
case '1000': // Meine offenen und in bearbeitung Tickets
|
||||
$where = " WHERE sender_id = " . $GLOBALS['main_contact']['id'] . " AND current_state != 4";
|
||||
break;
|
||||
case '1500': // Meine offenen und in bearbeitung Tickets
|
||||
$where = " WHERE receiver_id = " . $GLOBALS['main_contact']['id'] . " AND current_state != 4";
|
||||
break;
|
||||
|
||||
case '2000': // Offene Tickets der Abteilung
|
||||
// $join = " LEFT JOIN main_contact_department ON main_contact_department.main_contact_id = main_tickets.receiver_id";
|
||||
// $where = " WHERE current_state != 4 AND (main_contact_department.main_mandant_id =" . $GLOBALS['main_contact']['master_mandant_id'] . " OR main_tickets_category.main_mandant_id = " . $GLOBALS['main_contact']['master_mandant_id'] . ")";
|
||||
$where = " WHERE 1=1 and current_state != 4 and receiver_id = 0";
|
||||
// Only add these joins for case 2000
|
||||
// $additional_joins = "
|
||||
// -- Category contact, department, mandant joins
|
||||
// LEFT JOIN main_tickets_category_contact cat_contact
|
||||
// ON main_tickets.main_ticket_category_id = cat_contact.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id = 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_department cat_dept
|
||||
// ON main_tickets.main_ticket_category_id = cat_dept.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id = 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_mandant cat_mandant
|
||||
// ON main_tickets.main_ticket_category_id = cat_mandant.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id = 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
|
||||
// -- Subcategory contact, department, mandant joins
|
||||
// LEFT JOIN main_tickets_category_contact subcat_contact
|
||||
// ON main_tickets.main_ticket_subcategory_id = subcat_contact.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id != 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_department subcat_dept
|
||||
// ON main_tickets.main_ticket_subcategory_id = subcat_dept.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id != 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_mandant subcat_mandant
|
||||
// ON main_tickets.main_ticket_subcategory_id = subcat_mandant.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id != 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
|
||||
// -- Subsubcategory contact, department, mandant joins
|
||||
// LEFT JOIN main_tickets_category_contact subsubcat_contact
|
||||
// ON main_tickets.main_ticket_subsubcategory_id = subsubcat_contact.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subsubcategory_id != 0
|
||||
// LEFT JOIN main_tickets_category_department subsubcat_dept
|
||||
// ON main_tickets.main_ticket_subsubcategory_id = subsubcat_dept.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subsubcategory_id != 0
|
||||
// LEFT JOIN main_tickets_category_mandant subsubcat_mandant
|
||||
// ON main_tickets.main_ticket_subsubcategory_id = subsubcat_mandant.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subsubcategory_id != 0
|
||||
// ";
|
||||
|
||||
// Only add these conditions for case 2000
|
||||
// $additional_where = "
|
||||
// OR current_state != 4 AND (
|
||||
// -- For tickets with a category but no subcategory and no subsubcategory
|
||||
// main_tickets.main_ticket_subcategory_id = 0 AND
|
||||
// main_tickets.main_ticket_subsubcategory_id = 0 AND (
|
||||
// cat_contact.main_contact_id = " . $GLOBALS['main_contact']['id'] . " OR
|
||||
// cat_dept.main_department_id IN (" . ($contact_info['department_ids'] ?: "0") . ") OR
|
||||
// cat_mandant.main_mandant_id IN (" . ($contact_info['mandant_ids'] ?: "0") . ")
|
||||
// )
|
||||
// ) OR current_state != 4 AND (
|
||||
// -- For tickets with a subcategory but no subsubcategory
|
||||
// main_tickets.main_ticket_subcategory_id != 0 AND
|
||||
// main_tickets.main_ticket_subsubcategory_id = 0 AND (
|
||||
// subcat_contact.main_contact_id = " . $GLOBALS['main_contact']['id'] . " OR
|
||||
// subcat_dept.main_department_id IN (" . ($contact_info['department_ids'] ?: "0") . ") OR
|
||||
// subcat_mandant.main_mandant_id IN (" . ($contact_info['mandant_ids'] ?: "0") . ")
|
||||
// )
|
||||
// ) OR current_state != 4 AND (
|
||||
// -- For tickets with a subsubcategory (ignore category and subcategory)
|
||||
// main_tickets.main_ticket_subsubcategory_id != 0 AND (
|
||||
// subsubcat_contact.main_contact_id = " . $GLOBALS['main_contact']['id'] . " OR
|
||||
// subsubcat_dept.main_department_id IN (" . ($contact_info['department_ids'] ?: "0") . ") OR
|
||||
// subsubcat_mandant.main_mandant_id IN (" . ($contact_info['mandant_ids'] ?: "0") . ")
|
||||
// )
|
||||
// )
|
||||
// ";
|
||||
break;
|
||||
|
||||
case '2500': // Offene Tickets der Abteilung
|
||||
// $join = " LEFT JOIN main_contact_department ON main_contact_department.main_contact_id = main_tickets.receiver_id";
|
||||
// $where = " WHERE current_state != 4 AND (main_contact_department.main_mandant_id =" . $GLOBALS['main_contact']['master_mandant_id'] . " OR main_tickets_category.main_mandant_id = " . $GLOBALS['main_contact']['master_mandant_id'] . ")";
|
||||
$where = " WHERE 1=1 and current_state != 4";
|
||||
// Only add these joins for case 2000
|
||||
// $additional_joins = "
|
||||
// -- Category contact, department, mandant joins
|
||||
// LEFT JOIN main_tickets_category_contact cat_contact
|
||||
// ON main_tickets.main_ticket_category_id = cat_contact.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id = 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_department cat_dept
|
||||
// ON main_tickets.main_ticket_category_id = cat_dept.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id = 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_mandant cat_mandant
|
||||
// ON main_tickets.main_ticket_category_id = cat_mandant.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id = 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
|
||||
// -- Subcategory contact, department, mandant joins
|
||||
// LEFT JOIN main_tickets_category_contact subcat_contact
|
||||
// ON main_tickets.main_ticket_subcategory_id = subcat_contact.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id != 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_department subcat_dept
|
||||
// ON main_tickets.main_ticket_subcategory_id = subcat_dept.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id != 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
// LEFT JOIN main_tickets_category_mandant subcat_mandant
|
||||
// ON main_tickets.main_ticket_subcategory_id = subcat_mandant.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subcategory_id != 0
|
||||
// AND main_tickets.main_ticket_subsubcategory_id = 0
|
||||
|
||||
// -- Subsubcategory contact, department, mandant joins
|
||||
// LEFT JOIN main_tickets_category_contact subsubcat_contact
|
||||
// ON main_tickets.main_ticket_subsubcategory_id = subsubcat_contact.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subsubcategory_id != 0
|
||||
// LEFT JOIN main_tickets_category_department subsubcat_dept
|
||||
// ON main_tickets.main_ticket_subsubcategory_id = subsubcat_dept.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subsubcategory_id != 0
|
||||
// LEFT JOIN main_tickets_category_mandant subsubcat_mandant
|
||||
// ON main_tickets.main_ticket_subsubcategory_id = subsubcat_mandant.main_tickets_category_id
|
||||
// AND main_tickets.main_ticket_subsubcategory_id != 0
|
||||
// ";
|
||||
|
||||
// Only add these conditions for case 2000
|
||||
// $additional_where = "
|
||||
// OR current_state != 4 AND (
|
||||
// -- For tickets with a category but no subcategory and no subsubcategory
|
||||
// main_tickets.main_ticket_subcategory_id = 0 AND
|
||||
// main_tickets.main_ticket_subsubcategory_id = 0 AND (
|
||||
// cat_contact.main_contact_id = " . $GLOBALS['main_contact']['id'] . " OR
|
||||
// cat_dept.main_department_id IN (" . ($contact_info['department_ids'] ?: "0") . ") OR
|
||||
// cat_mandant.main_mandant_id IN (" . ($contact_info['mandant_ids'] ?: "0") . ")
|
||||
// )
|
||||
// ) OR current_state != 4 AND (
|
||||
// -- For tickets with a subcategory but no subsubcategory
|
||||
// main_tickets.main_ticket_subcategory_id != 0 AND
|
||||
// main_tickets.main_ticket_subsubcategory_id = 0 AND (
|
||||
// subcat_contact.main_contact_id = " . $GLOBALS['main_contact']['id'] . " OR
|
||||
// subcat_dept.main_department_id IN (" . ($contact_info['department_ids'] ?: "0") . ") OR
|
||||
// subcat_mandant.main_mandant_id IN (" . ($contact_info['mandant_ids'] ?: "0") . ")
|
||||
// )
|
||||
// ) OR current_state != 4 AND (
|
||||
// -- For tickets with a subsubcategory (ignore category and subcategory)
|
||||
// main_tickets.main_ticket_subsubcategory_id != 0 AND (
|
||||
// subsubcat_contact.main_contact_id = " . $GLOBALS['main_contact']['id'] . " OR
|
||||
// subsubcat_dept.main_department_id IN (" . ($contact_info['department_ids'] ?: "0") . ") OR
|
||||
// subsubcat_mandant.main_mandant_id IN (" . ($contact_info['mandant_ids'] ?: "0") . ")
|
||||
// )
|
||||
// )
|
||||
// ";
|
||||
break;
|
||||
|
||||
case '3000': // Alle geschlossenen Tickets
|
||||
$join = " LEFT JOIN main_contact_department ON main_contact_department.main_contact_id = main_tickets.receiver_id";
|
||||
$where = " WHERE main_tickets.current_state = 4 AND ((main_contact_department.main_mandant_id =" . $GLOBALS['main_contact']['master_mandant_id'] . " OR main_contact_department.main_mandant_id IS NULL) OR main_tickets.sender_id = " . $GLOBALS['main_contact']['id'] . " )";
|
||||
break;
|
||||
case '4000': // Alle Tickets ungefiltert
|
||||
// Fix for case 4000 - set a valid WHERE clause that's always true
|
||||
$where = " WHERE 1=1";
|
||||
break;
|
||||
case '5000': // Alle Tickets die Eskalieren (die zu lange offen/in Bearbeitung sind)
|
||||
$where = " WHERE due_date <> '0000-00-00' AND due_date < CURDATE() AND current_state IN (2, 3)";
|
||||
break;
|
||||
case '6000': // Alle Tickets die Eskalieren (die zu lange offen/in Bearbeitung sind)
|
||||
$join = " LEFT JOIN main_contact_department ON main_contact_department.main_contact_id = main_tickets.receiver_id";
|
||||
$where = " WHERE receiver_id = 0 ";
|
||||
// $where = " WHERE receiver_id = 0 AND main_contact_department.main_mandant_id =".$GLOBALS['main_contact']['master_mandant_id'];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$where = " WHERE (receiver_id = " . $GLOBALS['main_contact']['id'] . " OR sender_id = " . $GLOBALS['main_contact']['id'] . " ) AND current_state != 4";
|
||||
}
|
||||
|
||||
$query = "SELECT DISTINCT
|
||||
main_tickets.*,
|
||||
main_tickets_category.description AS 'category_description',
|
||||
COALESCE(main_tickets_subsubcategory.escalation_state, main_tickets_subcategory.escalation_state, main_tickets_category.escalation_state) AS 'escalation_state',
|
||||
individual_state.description AS 'individual_state_description',
|
||||
main_tickets_subcategory.description AS 'subcategory_description',
|
||||
main_tickets_subsubcategory.description AS 'subsubcategory_description',
|
||||
receiver.name AS 'receiver',
|
||||
sender.name AS 'sender',
|
||||
|
||||
main_tickets_state.description AS 'state',
|
||||
DATE_ADD(main_tickets.creation_date, INTERVAL COALESCE(main_tickets_subsubcategory.escalation_state, main_tickets_subcategory.escalation_state, main_tickets_category.escalation_state) DAY) AS 'escalation'
|
||||
FROM
|
||||
main_tickets
|
||||
" . $join . "
|
||||
LEFT JOIN main_contact AS receiver ON receiver.id = main_tickets.receiver_id
|
||||
LEFT JOIN main_contact AS sender ON sender.id = main_tickets.sender_id
|
||||
LEFT JOIN main_tickets_status AS individual_state ON individual_state.id = main_tickets.individual_state
|
||||
LEFT JOIN main_tickets_category ON main_tickets.main_ticket_category_id = main_tickets_category.id
|
||||
LEFT JOIN main_tickets_category AS main_tickets_subcategory ON main_tickets.main_ticket_subcategory_id = main_tickets_subcategory.id
|
||||
LEFT JOIN main_tickets_category AS main_tickets_subsubcategory ON main_tickets.main_ticket_subsubcategory_id = main_tickets_subsubcategory.id
|
||||
LEFT JOIN main_tickets_state ON main_tickets.current_state = main_tickets_state.id
|
||||
" . $additional_joins . "
|
||||
WHERE
|
||||
(" . substr($where, 7) . ")
|
||||
" . $additional_where . "
|
||||
ORDER BY
|
||||
ticket_no DESC;";
|
||||
// var_dump($query);
|
||||
|
||||
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
while ($row = @mysqli_fetch_array($result)) {
|
||||
// var_dump($row);
|
||||
if ($cue == 2000) {
|
||||
if (checkUserPermission($row, $contact_info) == false) {
|
||||
continue; // Skip this row if the user doesn't have permission
|
||||
}
|
||||
}
|
||||
// var_dump("-----");
|
||||
// print_r($row);
|
||||
$unread = "";
|
||||
$query2 = "SELECT * FROM main_tickets_notification
|
||||
WHERE main_ticket_id = " . $row['id'] . " AND main_contact_id = " . $GLOBALS['main_contact']['id'] . " AND viewed = 0";
|
||||
// var_dump($query2);
|
||||
$result2 = @mysqli_query($GLOBALS['mysql_con'], $query2);
|
||||
$viewed = @mysqli_num_rows($result2);
|
||||
if ($viewed != 0) {
|
||||
$unread = '<i class="fa-solid fa-circle-exclamation"></i>';
|
||||
}
|
||||
$creation_date = new DateTime($row['creation_date']);
|
||||
$last_action = new DateTime($row['last_action_date']);
|
||||
$escalation = new DateTime($row['escalation']);
|
||||
$now = new DateTime(); // Aktuelles Datum und Uhrzeit
|
||||
$escalated = "";
|
||||
if ($escalation < $now && (isset($row['escalation_state']) && $row['escalation_state'] != "0")) {
|
||||
$escalated = "escalated";
|
||||
}
|
||||
?>
|
||||
<tr id="item_<?= $row['id'] ?>" class='list_item <?= $escalated ?>' data-checked="false" data-inputname="input_id"
|
||||
data-action="edit" data-inputid="<?= encryptId($row['id']) ?>">
|
||||
<td><?= $unread ?></td>
|
||||
<td class=ticket_numb><?= $row['ticket_no'] ?></td>
|
||||
<td>
|
||||
<div class="status_container">
|
||||
<span class="<?= $row['state'] ?>"><?= $row['state'] ?></span>
|
||||
<?php if (!empty($row['individual_state_description'])): ?>
|
||||
<span class="individual_state_span"><?= $row['individual_state_description'] ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td><?= "1. " . $row['category_description'] . "<br>"?>
|
||||
<?= !empty($row['subcategory_description']) ? "2. " . $row['subcategory_description'] . "<br>" : '' ?>
|
||||
<?= !empty($row['subsubcategory_description']) ? "3. " . $row['subsubcategory_description'] : '' ?>
|
||||
</td>
|
||||
<td><?= $row['description'] ?></td>
|
||||
<td><?= $row['sender'] ?></td>
|
||||
|
||||
<td><?= $row['receiver'] ?></td>
|
||||
<td><?= $creation_date->format('d.m.y H:i') ?></td>
|
||||
<td><?= $last_action->format('d.m.y H:i') ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($row['due_date'] != "0000-00-00") {
|
||||
// var_dump($due_date);
|
||||
$due_date = new DateTime($row['due_date']);
|
||||
if ($due_date > $now) {
|
||||
echo $due_date->format('d.m.y');
|
||||
} else {
|
||||
echo '<span class="overdue">' . $due_date->format('d.m.y') . '</span>';
|
||||
}
|
||||
} else {
|
||||
echo '--.--.--';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php
|
||||
$now = new DateTime(); // Current date and time
|
||||
$creation = clone $creation_date; // Clone to avoid modifying the original
|
||||
$interval = $now->diff($creation);
|
||||
|
||||
if ($interval->y > 0) {
|
||||
echo $interval->y . ' Jahre, ' . $interval->m . ' Monate';
|
||||
} elseif ($interval->m > 0) {
|
||||
echo $interval->m . ' Monate, ' . $interval->d . ' Tage';
|
||||
} elseif ($interval->d > 0) {
|
||||
echo $interval->d . ' Tage, ' . $interval->h . ' Std';
|
||||
} elseif ($interval->h > 0) {
|
||||
echo $interval->h . ' Std, ' . $interval->i . ' Min';
|
||||
} else {
|
||||
echo $interval->i . ' Minuten';
|
||||
}
|
||||
?></td>
|
||||
|
||||
|
||||
|
||||
<?php if ($cue == 5000) { ?>
|
||||
<td>
|
||||
<?php if (isset($row['escalation_state']) && $row['escalation_state'] != "0") {
|
||||
echo $escalation->format('d.m.y H:i');
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<?php if ($cue == 7000 || $cue == 8000) { ?>
|
||||
<td>
|
||||
<?php
|
||||
$supplierQuery = "SELECT s.description
|
||||
FROM main_ticket_suplier l
|
||||
LEFT JOIN main_tickets_supliers s ON l.main_ticket_suplier_id = s.id
|
||||
WHERE l.main_ticket_id = " . (int) $row['id'];
|
||||
$supplierResult = mysqli_query($GLOBALS['mysql_con'], $supplierQuery);
|
||||
?>
|
||||
<div class="suppliers">
|
||||
<?php
|
||||
while ($supplier = mysqli_fetch_assoc($supplierResult)) {
|
||||
echo '<span class="ticket_supplier">' . htmlspecialchars($supplier['description']) . '</span> ';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
function checkUserPermission($row, $contact_info) {
|
||||
$category_keys = [
|
||||
'main_ticket_subsubcategory_id',
|
||||
'main_ticket_subcategory_id',
|
||||
'main_ticket_category_id'
|
||||
];
|
||||
|
||||
foreach ($category_keys as $key) {
|
||||
if (isset($row[$key]) && $row[$key] != 0) {
|
||||
$category_id = $row[$key];
|
||||
|
||||
// 1. Direct contact match
|
||||
$contacts = getContactsByCategory($category_id);
|
||||
if (in_array($GLOBALS['main_contact']['id'], $contacts)) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 2. Department and mandant matching
|
||||
$departments = getDepartmentsByCategory($category_id);
|
||||
$mandants = getMandantsByCategory($category_id);
|
||||
// var_dump($mandants);
|
||||
// var_dump($departments);
|
||||
// var_dump($mandants);
|
||||
// $userDepartments = array_map('trim', explode(',', $contact_info['department_ids']));
|
||||
// $userMandants = array_map('trim', explode(',', $contact_info['mandant_ids']));
|
||||
|
||||
// $hasDepartments = !empty($departments) && $departments != [0];
|
||||
// $hasMandants = !empty($mandants) && $mandants != [0];
|
||||
|
||||
// $departmentMatch = !$hasDepartments || count(array_intersect($userDepartments, $departments)) > 0;
|
||||
// $mandantMatch = !$hasMandants || count(array_intersect($userMandants, $mandants)) > 0;
|
||||
// // Check if the user has access to the department and mandant
|
||||
// if ($departmentMatch && $mandantMatch) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// 3. Check if the user has access to the department and mandant
|
||||
// $array_dep_mand = [];
|
||||
// foreach ($departments as $department) {
|
||||
// foreach ($mandants as $mandant) {
|
||||
// $dep_mand_bind = [
|
||||
// 'department' => $department,
|
||||
// 'mandant' => $mandant
|
||||
// ];
|
||||
// $array_dep_mand[] = $dep_mand_bind;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (empty($departments) and empty($mandants)){
|
||||
return false;
|
||||
} else if (empty($mandants)) {
|
||||
$query = "SELECT * FROM main_contact_department WHERE main_contact_id = " . $GLOBALS['main_contact']['id'] . "
|
||||
AND main_department_id IN (" . implode(',', $departments) . ")";
|
||||
} else if (empty($departments)) {
|
||||
$query = "SELECT * FROM main_contact_department WHERE main_contact_id = " . $GLOBALS['main_contact']['id'] . "
|
||||
AND main_department_id IN (" . implode(',', $departments) . ")";
|
||||
} else {
|
||||
$query = "SELECT * FROM main_contact_department WHERE main_contact_id = " . $GLOBALS['main_contact']['id'] . " AND main_mandant_id IN (" . implode(',', $mandants) . ") AND main_department_id IN (" . implode(',', $departments) . ")";
|
||||
}
|
||||
|
||||
// var_dump($query);
|
||||
|
||||
// var_dump($query);
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
|
||||
|
||||
|
||||
if (mysqli_num_rows($result) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
// If we checked one level and didn't find a match - don't exit, continue to the next one
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 1000: Meine offenen und in Bearbeitung Tickets
|
||||
$query_count_1000 = "SELECT COUNT(*) FROM main_tickets WHERE (receiver_id = " . $GLOBALS['main_contact']['id'] . " OR sender_id = " . $GLOBALS['main_contact']['id'] . " ) AND current_state != 4";
|
||||
$result_1000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_1000))[0];
|
||||
|
||||
// 2000: Offene Tickets der Abteilung
|
||||
$query_count_2000 = "SELECT COUNT(DISTINCT main_tickets.id)
|
||||
FROM main_tickets
|
||||
LEFT JOIN main_contact_department ON main_contact_department.main_contact_id = main_tickets.receiver_id
|
||||
LEFT JOIN main_tickets_category ON main_tickets.main_ticket_category_id = main_tickets_category.id
|
||||
WHERE current_state != 4
|
||||
AND (
|
||||
main_contact_department.main_mandant_id = " . $GLOBALS['main_contact']['master_mandant_id'] . "
|
||||
OR main_tickets_category.main_mandant_id = " . $GLOBALS['main_contact']['master_mandant_id'] . "
|
||||
)";
|
||||
$result_2000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_2000))[0];
|
||||
|
||||
// 3000: Alle geschlossenen Tickets
|
||||
$query_count_3000 = "SELECT COUNT(*) FROM main_tickets WHERE current_state = 4";
|
||||
$result_3000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_3000))[0];
|
||||
|
||||
// 4000: Alle Tickets ungefiltert
|
||||
$query_count_4000 = "SELECT COUNT(*) FROM main_tickets";
|
||||
$result_4000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_4000))[0];
|
||||
|
||||
// 5000: Alle eskalierenden Tickets (zu lange offen/in Bearbeitung)
|
||||
$query_count_5000 = "SELECT COUNT(*)
|
||||
FROM main_tickets
|
||||
LEFT JOIN main_tickets_category ON main_tickets.main_ticket_category_id = main_tickets_category.id
|
||||
LEFT JOIN main_tickets_category AS main_tickets_subcategory ON main_tickets.main_ticket_subcategory_id = main_tickets_subcategory.id
|
||||
WHERE DATE_ADD(main_tickets.creation_date, INTERVAL COALESCE(main_tickets_subcategory.escalation_state, main_tickets_category.escalation_state) DAY) < NOW()
|
||||
AND main_tickets.current_state IN (2, 3)";
|
||||
$result_5000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_5000))[0];
|
||||
|
||||
// 6000: Alle nicht zugewiesenen Tickets
|
||||
$query_count_6000 = "SELECT COUNT(*) FROM main_tickets WHERE receiver_id = 0";
|
||||
$result_6000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_6000))[0];
|
||||
|
||||
// 7000: // Alle Tickets die im Bereich Einkauf sind (holen wir über main_mandant_id aus main_tickets_category = 15)
|
||||
$query_count_7000 = "SELECT COUNT(*)
|
||||
FROM main_tickets
|
||||
LEFT JOIN main_tickets_category ON main_tickets.main_ticket_category_id = main_tickets_category.id
|
||||
LEFT JOIN main_tickets_category AS main_tickets_subcategory ON main_tickets.main_ticket_subcategory_id = main_tickets_subcategory.id
|
||||
WHERE main_tickets_category.main_mandant_id = 15
|
||||
OR main_tickets_subcategory.main_mandant_id = 15 AND main_tickets.current_state != 4";
|
||||
$result_7000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_7000))[0];
|
||||
|
||||
// 8000: // Alle Tickets die im Bereich Einkauf sind (holen wir über main_mandant_id aus main_tickets_category = 15)
|
||||
$query_count_8000 = "SELECT COUNT(*)
|
||||
FROM main_tickets
|
||||
LEFT JOIN main_tickets_category ON main_tickets.main_ticket_category_id = main_tickets_category.id
|
||||
LEFT JOIN main_tickets_category AS main_tickets_subcategory ON main_tickets.main_ticket_subcategory_id = main_tickets_subcategory.id
|
||||
WHERE main_tickets_category.main_mandant_id = 15
|
||||
OR main_tickets_subcategory.main_mandant_id = 15 AND main_tickets.current_state = 4";
|
||||
$result_8000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_8000))[0];
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="/module/ticketcenter/css/repair.css">
|
||||
<form action="" id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<!-- DataTables -->
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.css" /> -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/searchbuilder/1.8.0/css/searchBuilder.dataTables.css" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/2.0.2/css/dataTables.semanticui.css" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/3.0.0/css/responsive.semanticui.css" />
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
|
||||
|
||||
<link
|
||||
href="https://cdn.datatables.net/v/se/jszip-3.10.1/dt-2.0.2/af-2.7.0/b-3.0.1/b-colvis-3.0.1/b-html5-3.0.1/b-print-3.0.1/cr-2.0.0/date-1.5.2/fc-5.0.0/fh-4.0.1/kt-2.12.0/r-3.0.0/rg-1.5.0/rr-1.5.0/sc-2.4.1/sb-1.7.0/sp-2.3.0/sl-2.0.0/sr-1.4.0/datatables.min.css"
|
||||
rel="stylesheet">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.2/moment.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/datetime/1.5.2/js/dataTables.dateTime.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/searchbuilder/1.8.0/js/searchBuilder.dataTables.js"></script>
|
||||
<script src="https://cdn.datatables.net/searchbuilder/1.8.0/js/dataTables.searchBuilder.js"></script>
|
||||
<script
|
||||
src="https://cdn.datatables.net/v/se/jszip-3.10.1/dt-2.0.2/af-2.7.0/b-3.0.1/b-colvis-3.0.1/b-html5-3.0.1/b-print-3.0.1/cr-2.0.0/date-1.5.2/fc-5.0.0/fh-4.0.1/kt-2.12.0/r-3.0.0/rg-1.5.0/rr-1.5.0/sc-2.4.1/sb-1.7.0/sp-2.3.0/sl-2.0.0/sr-1.4.0/datatables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/2.0.2/js/dataTables.semanticui.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/3.0.0/js/dataTables.responsive.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/3.0.0/js/responsive.semanticui.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/3.0.2/js/dataTables.buttons.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.semanticui.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
|
||||
<script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.html5.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
|
||||
|
||||
|
||||
<div class="loading" aria-busy="true"></div>
|
||||
<input type='hidden' class='selected_linklist_row' name='input_id' value=''>
|
||||
<div class="toolbar">
|
||||
<div class="container">
|
||||
<!-- <div class="right_toolbar">
|
||||
<a role="button" class="secondary" href="?cue=1000">
|
||||
Meine Tickets <span class="badge">(<?= $result_1000 ?>)</span>
|
||||
</a>
|
||||
<a role="button" class="secondary" href="?cue=2000">
|
||||
Abteilungstickets <span class="badge">(<?= $result_2000 ?>)</span>
|
||||
</a>
|
||||
<a role="button" class="secondary" href="?cue=3000">
|
||||
Archiv <span class="badge">(<?= $result_3000 ?>)</span>
|
||||
</a>
|
||||
|
||||
<?php if (get_permission_state('all_tickets', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
<a role="button" class="secondary" href="?cue=4000">
|
||||
Alle Tickets <span class="badge">(<?= $result_4000 ?>)</span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (get_permission_state('escalated_tickets', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
<a role="button" class="secondary" href="?cue=5000">
|
||||
Eskalierte Tickets <span class="badge">(<?= $result_5000 ?>)</span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (get_permission_state('all_tickets', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
<a role="button" class="secondary" href="?cue=6000">
|
||||
Nicht zugewiesene Tickets <span class="badge">(<?= $result_6000 ?>)</span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div> -->
|
||||
<div class="right_toolbar">
|
||||
<a role="button" class="secondary" href="?cue=1000">
|
||||
Von mir erstellt <span class="badge"></span>
|
||||
</a>
|
||||
<a role="button" class="secondary" href="?cue=1500">
|
||||
Zu bearbeitende Tickets <span class="badge"></span>
|
||||
</a>
|
||||
<a role="button" class="secondary" href="?cue=2000">
|
||||
Ticket Pool <span class="badge"></span>
|
||||
</a>
|
||||
<a role="button" class="secondary" href="?cue=2500">
|
||||
Ticket Übersicht <span class="badge"></span>
|
||||
</a>
|
||||
<a role="button" class="secondary" href="?cue=3000">
|
||||
Archiv <span class="badge"></span>
|
||||
</a>
|
||||
<?php if (get_permission_state('all_tickets', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
<a role="button" class="secondary" href="?cue=4000">
|
||||
Alle Tickets <span class="badge"></span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if (get_permission_state('escalated_tickets', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
<a role="button" class="secondary" href="?cue=5000">
|
||||
Eskalierte Tickets <span class="badge"></span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (get_permission_state('all_tickets', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
<a role="button" class="secondary" href="?cue=6000">
|
||||
Nicht zugewiesene Tickets <span class="badge"></span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="left_toolbar">
|
||||
<?php if (get_permission_state('all_tickets', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) {
|
||||
echo button("delete", "Löschen", $formname, "sendRequest('delete', true)");
|
||||
} ?>
|
||||
<a role="button" class="primary" href="?action=new">Ticket erstellen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section class="listform_content">
|
||||
<div class="container">
|
||||
<div class="titlebar">
|
||||
<?php
|
||||
if (isset($_GET["cue"])) {
|
||||
switch ($_GET["cue"]) {
|
||||
case 1000:
|
||||
$title = "Von mir erstellt";
|
||||
$description = "Meine eigenen Tickets";
|
||||
break;
|
||||
case 1500:
|
||||
$title = "Zu bearbeitende Tickets";
|
||||
$description = "Meine in Bearbeitung befindlichen Tickets";
|
||||
break;
|
||||
case 2000:
|
||||
$title = "Abteilungstickets";
|
||||
$description = "Alle laufenden Abteilungstickets";
|
||||
break;
|
||||
case 2500:
|
||||
$title = "Ticket Übersicht";
|
||||
$description = "Alle laufenden Tickets";
|
||||
break;
|
||||
case 3000:
|
||||
$title = "Archiv";
|
||||
$description = "Alle geschlossenen Abteilungstickets";
|
||||
break;
|
||||
case 4000:
|
||||
$title = "Alle Tickets";
|
||||
$description = "Alle laufenden und geschlossenen Tickets";
|
||||
break;
|
||||
case 5000:
|
||||
$title = "Eskalierte Tickets";
|
||||
$description = "Alle eskalierenden Tickets";
|
||||
break;
|
||||
case 6000:
|
||||
$title = "Nicht zugewiesene Tickets";
|
||||
$description = "Alle Tickets ohne aktuellen Bearbeiter";
|
||||
break;
|
||||
case 7000:
|
||||
$title = "Einkauf Tickets";
|
||||
$description = "Alle Tickets des Bereichs Einkauf";
|
||||
break;
|
||||
case 8000:
|
||||
$title = "Einkauf Tickets (Archiv)";
|
||||
$description = "Alle Tickets des Bereichs Einkauf";
|
||||
break;
|
||||
default:
|
||||
$title = "Tickets";
|
||||
$description = "Übersicht über Tickets";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<hgroup>
|
||||
<h1><?php echo htmlspecialchars($title); ?></h1>
|
||||
<p><?php echo htmlspecialchars($description); ?></p>
|
||||
</hgroup>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<hgroup>
|
||||
<h1>Ticketcenter</h1>
|
||||
</hgroup>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<div>
|
||||
<!-- <div title="Datumsfilter"role="button" id="openDateFilter" class="outline"><i class="fa-solid fa-calendar-days"></i></div>
|
||||
<div title="Filter"role="button" id="openSearchBuilder" class="outline"><i class="fa-solid fa-filter"></i></div> -->
|
||||
<select name="select_categoty" id="">
|
||||
<option value="all">Alle Kategorien</option>
|
||||
<?php
|
||||
$query = "SELECT * FROM main_tickets_category ORDER BY description ASC";
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
echo '<option value="' . $row['description'] . '">' . htmlspecialchars($row['description']) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<input type="text" title="Suche..." placeholder="Suche..." id="listform_search">
|
||||
</div>
|
||||
</div>
|
||||
<div class="date_filter_builder">
|
||||
<div class="date_filter_builder_title_row">
|
||||
<div class="dtsb-title">Datumsfilter</div>
|
||||
</div>
|
||||
<div class="date_filter_builder_group">
|
||||
<label for="min">
|
||||
Datum von...
|
||||
<input placeholder="Datum von..." type="text" id="min" name="min">
|
||||
</label>
|
||||
<label for="max">
|
||||
Datum bis...
|
||||
<input placeholder="Datum bis..." type="text" id="max" name="max">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="ticket" class="ui celled table selectable linklist" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Nr.</th>
|
||||
<th>Status</th>
|
||||
<th>Abteilung</th>
|
||||
<th>Beschreibung</th>
|
||||
<th>Ersteller</th>
|
||||
<th>Akt. Bearbeiter</th>
|
||||
<th>Erstellt</th>
|
||||
<th>Letzte Aktion</th>
|
||||
<th>Zu erledigen bis</th>
|
||||
<th>Geöffnet seit</th>
|
||||
|
||||
<?php if ($_GET['cue'] == 5000) { ?>
|
||||
<th>Eskaliert am</th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? load_ticket_list($_GET['cue']); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#ticket').DataTable({
|
||||
info: false,
|
||||
responsive: true,
|
||||
pageLength: 20,
|
||||
colReorder: false,
|
||||
pagingType: 'simple_numbers',
|
||||
lengthChange: false,
|
||||
// lengthMenu: [10, 20, 50, 100],
|
||||
paging: true,
|
||||
sorting: 0,
|
||||
language: {
|
||||
url: '//cdn.datatables.net/plug-ins/2.0.2/i18n/de-DE.json',
|
||||
searchPlaceholder: '',
|
||||
search: '',
|
||||
lengthMenu: 'Zeige _MENU_ Einträge',
|
||||
paginate: {
|
||||
next: '>',
|
||||
previous: '<'
|
||||
},
|
||||
datetime: {
|
||||
previous: 'Zurück',
|
||||
next: 'Weiter',
|
||||
months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
|
||||
weekdays: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
|
||||
amPm: ['am', 'pm'],
|
||||
hours: 'Stunde',
|
||||
minutes: 'Minute',
|
||||
seconds: 'Sekunde',
|
||||
unknown: '-'
|
||||
},
|
||||
// searchBuilder: {
|
||||
// title: {
|
||||
// 0: 'Filter',
|
||||
// _: 'Filters (%d)'
|
||||
// },
|
||||
// }
|
||||
|
||||
},
|
||||
layout: {
|
||||
// top1: {
|
||||
// searchBuilder: {
|
||||
// greyscale: true
|
||||
// }
|
||||
// },
|
||||
topStart: 'pageLength',
|
||||
topEnd: '',
|
||||
bottomStart: {
|
||||
buttons: [
|
||||
{
|
||||
extend: 'collection',
|
||||
// split: ['copyHtml5', 'excelHtml5', 'csvHtml5', 'print']
|
||||
split: ['copyHtml5', 'excelHtml5', 'csvHtml5', 'print']
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
bottomEnd: 'paging',
|
||||
},
|
||||
// drawCallback: function(settings) {
|
||||
// initLinklist();
|
||||
// }
|
||||
});
|
||||
|
||||
var table = $('#ticket').DataTable();
|
||||
|
||||
// Ermöglicht das durchsuchen von Tabellen
|
||||
$('#listform_search').keyup(function () {
|
||||
table.search($(this).val()).draw();
|
||||
})
|
||||
|
||||
var minDate, maxDate;
|
||||
|
||||
// Custom filtering function which will search data in column four between two values
|
||||
DataTable.ext.search.push(function (settings, data, dataIndex) {
|
||||
var min = minDate.val();
|
||||
var max = maxDate.val();
|
||||
var date = new Date(moment(data[1], 'DD.MM.YYYY'));
|
||||
|
||||
if (
|
||||
(min === null && max === null) ||
|
||||
(min === null && date <= max) ||
|
||||
(min <= date && max === null) ||
|
||||
(min <= date && date <= max)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Create date inputs
|
||||
minDate = new DateTime('#min', {
|
||||
format: 'DD.MM.YYYY'
|
||||
});
|
||||
maxDate = new DateTime('#max', {
|
||||
format: 'DD.MM.YYYY'
|
||||
});
|
||||
|
||||
// Refilter the table
|
||||
$('#min, #max').on('change', function () {
|
||||
table.draw();
|
||||
});
|
||||
$(".list_item").click(function () {
|
||||
// Hole die Datenattribute aus der geklickten Zeile
|
||||
var inputId = $(this).data('inputid');
|
||||
|
||||
// Setze den Wert des versteckten Input-Feldes auf die inputid der geklickten Zeile
|
||||
$('input[name="input_id"]').val(inputId);
|
||||
});
|
||||
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('.loading').hide();
|
||||
$('.listform_content').show();
|
||||
});
|
||||
|
||||
$(".list_item").dblclick(function () {
|
||||
// Hole die Datenattribute aus der geklickten Zeile
|
||||
var action = $(this).data('action');
|
||||
var inputId = $(this).data('inputid');
|
||||
|
||||
// Erweitere die URL mit den Parametern
|
||||
var newUrl = window.location.href.split('?')[0] + '?action=' + action + '&id=' + inputId;
|
||||
|
||||
// Aktualisiere die URL
|
||||
window.location.href = newUrl;
|
||||
});
|
||||
|
||||
|
||||
// Funktion zum Öffnen/Schließen der Filter Search Groups vom DataTable
|
||||
$('#openSearchBuilder').click(function () {
|
||||
$(".dtsb-searchBuilder").toggle();
|
||||
$(this).toggleClass("active")
|
||||
});
|
||||
|
||||
// Funktion zum Öffnen/Schließen der Date Filter vom DataTable
|
||||
$('#openDateFilter').click(function () {
|
||||
$(".date_filter_builder").toggle();
|
||||
$(this).toggleClass("active")
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
// Hole den Wert des cue-Parameters aus der URL
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const cue = urlParams.get('cue');
|
||||
|
||||
// Wenn ein cue-Wert vorhanden ist, füge die Klasse active zum passenden Button hinzu
|
||||
if (cue) {
|
||||
$(`a[href="?cue=${cue}"]`).addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const cue = urlParams.get('cue');
|
||||
if (cue) {
|
||||
sessionStorage.setItem('lastCue', cue);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
function filterByCategory() {
|
||||
const selectedCategory = $('select[name="select_categoty"]').val();
|
||||
|
||||
console.log("Selected category:", selectedCategory);
|
||||
const table = $('#ticket').DataTable();
|
||||
|
||||
if (selectedCategory === 'all') {
|
||||
// Zeige alle Zeilen
|
||||
table.column(3).search('').draw();
|
||||
} else {
|
||||
// Filtere nach der ausgewählten Kategorie (Spalte 3 ist "Abteilung")
|
||||
table.column(3).search(selectedCategory, true, false).draw();
|
||||
}
|
||||
}
|
||||
|
||||
// Event Listener für die Kategorie-Auswahl
|
||||
$('select[name="select_categoty"]').on('change', filterByCategory);
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
@@ -1,4 +1,4 @@
|
||||
<script type="text/javascript" src="/mysyde/admin/admin.js"></script>
|
||||
<!-- <script type="text/javascript" src="/mysyde/admin/admin.js"></script> -->
|
||||
<?php
|
||||
$formname = "form_ticket_list";
|
||||
|
||||
@@ -519,7 +519,7 @@ WHERE main_tickets_category.main_mandant_id = 15
|
||||
$result_8000 = mysqli_fetch_array(mysqli_query($GLOBALS['mysql_con'], $query_count_8000))[0];
|
||||
?>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/module/ticketcenter/css/repair.css">
|
||||
<form action="" id="<?= $formname ?>" name="<?= $formname ?>" method="post">
|
||||
<!-- DataTables -->
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.9.2/semantic.min.css" /> -->
|
||||
@@ -761,8 +761,8 @@ $('#ticket').DataTable({
|
||||
pageLength: 20,
|
||||
colReorder: false,
|
||||
pagingType: 'simple_numbers',
|
||||
lengthChange: true,
|
||||
lengthMenu: [10, 20, 50, 100],
|
||||
lengthChange: false,
|
||||
// lengthMenu: [10, 20, 50, 100],
|
||||
paging: true,
|
||||
sorting: 0,
|
||||
language: {
|
||||
@@ -246,19 +246,19 @@ class Adminmenu {
|
||||
'subsites' => array(
|
||||
'category' => array(
|
||||
'name' => $translation->get('category'),
|
||||
'include' => MODULE_PATH . "ticketcenter/category.inc.php",
|
||||
'include' => MODULE_PATH . "ticketcenter/views/category/category.inc.php",
|
||||
'admin_start_parameter' => "",
|
||||
'linklistmenu' => TRUE
|
||||
),
|
||||
'process' => array(
|
||||
'name' => $translation->get('Process'),
|
||||
'include' => MODULE_PATH . "ticketcenter/process.inc.php",
|
||||
'include' => MODULE_PATH . "ticketcenter/views/process/process.inc.php",
|
||||
'admin_start_parameter' => "",
|
||||
'linklistmenu' => TRUE
|
||||
),
|
||||
'status' => array(
|
||||
'name' => $translation->get('Status'),
|
||||
'include' => MODULE_PATH . "ticketcenter/status.inc.php",
|
||||
'include' => MODULE_PATH . "ticketcenter/views/status/status.inc.php",
|
||||
'admin_start_parameter' => "",
|
||||
'linklistmenu' => TRUE
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?
|
||||
require '../../vendor/autoload.php';
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php');
|
||||
use Smalot\PdfParser\Parser;
|
||||
// use React\EventLoop\Factory;
|
||||
// use React\Promise\Promise;
|
||||
|
||||
@@ -494,12 +494,12 @@ function load_mandant_list_new($contact){
|
||||
<td><?= input_select_from_sql("", "input_role_".$i, $query_role, $role, FALSE, FALSE, "", TRUE); ?></td>
|
||||
<td style="display: none;"><?= input("", "input_phone_no_".$i, "text", $phone, 100); ?></td>
|
||||
<td style="display: none;"><?= input("", "input_email_".$i, "text", $email, 100); ?></td>
|
||||
<!-- <?php if ($GLOBALS['admin_user']['control_permissions'] == 1){?>
|
||||
<td><button class="pop_up_button svg_button" title="Berechtigung ändern" data-popup-id="popup-mandant-<?= $mandant_id?>" ><svg xmlns="http://www.w3.org/2000/svg" width="28.8" height="35.25" viewBox="0 0 28.8 35.25">
|
||||
<?php if ($GLOBALS['admin_user']['control_permissions'] == 1){?>
|
||||
<td><button class="pop_up_button svg_button" title="Berechtigung ändern" data-popup-id="popup-mandant-<?= $mandant?>" ><svg xmlns="http://www.w3.org/2000/svg" width="28.8" height="35.25" viewBox="0 0 28.8 35.25">
|
||||
<path id="shield-security" d="M14.4.375l14.4,6.45v9.6a19.876,19.876,0,0,1-4.125,12.188A17.908,17.908,0,0,1,14.4,35.625,17.912,17.912,0,0,1,4.125,28.612,19.875,19.875,0,0,1,0,16.425v-9.6ZM14.4,18V3.9L3.225,8.85V18H14.4V32.325a15.292,15.292,0,0,0,7.5-5.4A17.845,17.845,0,0,0,25.575,18Z" transform="translate(0 -0.375)"/></svg>
|
||||
</button>
|
||||
</td>
|
||||
<?php } ?> -->
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user