diff --git a/layout/frontend/b2c/dist/css/global.css b/layout/frontend/b2c/dist/css/global.css
index a8ad572..77d8cf1 100644
--- a/layout/frontend/b2c/dist/css/global.css
+++ b/layout/frontend/b2c/dist/css/global.css
@@ -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;
diff --git a/module/intranet/siteparts/intranet.php b/module/intranet/siteparts/intranet.php
index a3ed16b..034de09 100644
--- a/module/intranet/siteparts/intranet.php
+++ b/module/intranet/siteparts/intranet.php
@@ -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;
diff --git a/module/ticketcenter/category_listform.inc.old.php b/module/ticketcenter/category_listform.inc.old.php
deleted file mode 100644
index 3b55f49..0000000
--- a/module/ticketcenter/category_listform.inc.old.php
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/module/ticketcenter/css/repair.css b/module/ticketcenter/css/repair.css
index 32c9bc3..45a50f6 100644
--- a/module/ticketcenter/css/repair.css
+++ b/module/ticketcenter/css/repair.css
@@ -1,3 +1,1013 @@
+
+/* Ticketcenter */
+
+.ticketcenter {
+ nav {
+ margin-top: unset;
+ }
+
+ .lesezeichen_leiste {
+ display: none;
+ }
+
+ li.promoted {
+ padding-block-end: 0px;
+ }
+
+ .button_delete {
+ padding: 10px;
+ border-radius: var(--br);
+ color: white;
+ background: var(--clr-mandant);
+ display: inline-block;
+ white-space: nowrap;
+ margin-left: 10px;
+
+ }
+}
+
+.toolbar {
+ padding: 1rem 0;
+}
+
+.info_labels .label label {
+ border: 0;
+ padding: 0;
+}
+
+.ticket_weiterleiten {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+}
+
+.ticket_weiterleiten li.promoted {
+ /* width: 100%; */
+ margin-top: 10px;
+}
+
+a.button_forward_ticket {
+ display: block;
+ background: #ededed;
+ text-align: center;
+ padding: 10px;
+ border-radius: var(--br);
+ color: black;
+}
+
+.titlebar {
+ display: flex;
+ justify-content: space-between;
+ gap: 1rem;
+ padding: 1rem 0;
+ border: 1px solid var(--border);
+}
+
+.date_filter_builder {
+ display: none;
+}
+
+.titlebar>div {
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+
+}
+
+a.primary {
+ background: #e4e4e4;
+ padding: 10px;
+ border-radius: var(--br);
+ /* color: rgb(0, 0, 0); */
+ background: var(--clr-mandant);
+ display: inline-block;
+ white-space: nowrap;
+}
+
+/* a.primary:hover {
+ color: white;
+} */
+
+a.secondary {
+ background: #e4e4e4;
+ padding: 10px;
+ border-radius: var(--br);
+ color: var(--fc-primary);
+ border: 1px solid transparent;
+ background: var(--blur_elevated);
+ display: inline-block;
+ white-space: nowrap;
+ border: 1px solid var(--border);
+}
+
+a.secondary.active {
+ border: 1px solid var(--clr-mandant);
+}
+
+.toolbar .container {
+ display: flex;
+ justify-content: space-between;
+ gap: 1rem;
+ flex-wrap: wrap;
+
+ .right_toolbar {
+ flex-wrap: wrap;
+ }
+}
+
+.outline {
+ border: 1px solid var(--border);
+ color: black;
+ background: transparent;
+ padding: 10px;
+ border-radius: var(--br);
+ min-width: 48px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ cursor: pointer;
+}
+
+.tabbar {
+ display: flex;
+ margin-bottom: 1rem;
+ border-bottom: 1px solid var(--border);
+ padding-left: 2px;
+ padding-block-start: 2px;
+}
+
+.tabbar .outline {
+ background: transparent;
+ border: none;
+ font-weight: 600;
+ color: var(--pico-contrast);
+ border-radius: 0;
+}
+
+.tabbar .outline.active {
+ border-bottom: 2px solid var(--clr-mandant);
+ color: var(--clr-mandant);
+}
+
+.titlebar h1 span {
+ display: block;
+ font-size: 15px;
+ font-weight: normal;
+}
+
+.booking {
+ display: flex;
+ gap: 15px;
+}
+
+.white_section {
+ background: var(--blur_elevated);
+ padding: 1rem;
+ border: 1px solid var(--border);
+ border-radius: var(--br);
+ margin-bottom: 10px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+
+.white_section table {
+ width: 100%;
+ text-align: left;
+ border-collapse: collapse;
+}
+
+.white_section table th,
+.white_section table td {
+ padding: 5px;
+ border-bottom: 1px solid var(--border);
+}
+
+.verleihshop-erfolgsmeldung main {
+ background: var(--bg-white);
+}
+
+.white_section td li.promoted {
+ padding-bottom: 0;
+}
+
+.verleihshop-erfolgsmeldung img {
+ max-width: 200px;
+ margin: 0 auto;
+}
+
+p.rental_item_status svg {
+ width: 11px;
+ height: 11px;
+ margin-top: -1px;
+ display: flex;
+}
+
+.white_section h3 {
+ border-bottom: 1px solid var(--border);
+ padding-block-end: 8px;
+ margin: 0;
+}
+
+p.rental_item_status>span {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+}
+
+p.rental_item_status {
+ display: flex;
+ gap: 15px;
+ align-items: center;
+}
+
+a[role="button"] {
+ padding: 10px;
+ border-radius: var(--br);
+ color: white;
+ background: var(--clr-mandant);
+ display: inline-block;
+ white-space: nowrap;
+}
+
+p.rental_item_status {
+ font-size: 13px;
+ opacity: 0.8;
+}
+
+.section_group.rental_items img.rental_item_image {
+ aspect-ratio: 4 / 3;
+ margin-bottom: 1rem;
+ border: 1px solid var(--border);
+ border-radius: var(--br);
+ max-height: 630px !important;
+ object-fit: contain;
+ background: white;
+}
+
+.rental_item img {
+ aspect-ratio: 4 / 3;
+ object-fit: contain;
+}
+
+.ticketcenter a.back:before {
+ display: none;
+}
+
+.rental_item h3 {
+ border-top: 1px solid var(--border);
+ padding-top: 15px;
+}
+
+.rental_item_button {
+ text-align: right;
+ padding: 10px;
+ text-decoration: underline;
+ color: var(--clr-mandant);
+ font-size: 13px;
+}
+
+.rental_item_list {
+ display: grid;
+ gap: 15px;
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
+ /* Dynamische Spalten */
+}
+
+.buttons {
+ display: flex;
+ gap: 15px;
+ align-items: center;
+ flex-wrap: wrap;
+}
+
+.rental_item_list p.rental_item_status {
+ flex-wrap: wrap;
+ gap: 5px;
+ flex-direction: column;
+ align-items: flex-start;
+}
+
+.rental_item h3,
+.rental_item p {
+ padding-inline: 15px;
+ margin-bottom: 15px;
+}
+
+a.rental_item_container {
+ background: var(--blur_elevated);
+ border-radius: var(--br);
+ overflow: hidden;
+}
+
+h2.rental_item_title {
+ font-size: var(--fs-900);
+}
+
+h2.rental_item_title:before {
+ display: none;
+}
+
+.section_group {
+ display: grid;
+ gap: calc(1rem * 1.5);
+ grid-template-columns: repeat(auto-fit, minmax(20%, 1fr));
+ align-items: flex-start;
+}
+
+.section_group.rental_items {
+ grid-template-columns: 2fr 1fr;
+}
+
+.cardform_section {
+ background: var(--blur_elevated);
+ padding: 2rem;
+ border-radius: var(--br);
+ border: 1px solid var(--border);
+ grid-column: span 3;
+}
+
+.card_ticket {
+ width: 100%;
+ background: var(--blur_elevated);
+ border-radius: var(--br);
+ display: block;
+ overflow: hidden;
+ border: 1px solid var(--border);
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+}
+
+input[type="checkbox"].error_input {
+ outline: 1px solid red;
+ outline-offset: 2px;
+ outline-style: auto;
+}
+
+.info_labels label {
+ padding-block-end: 10px;
+ display: block;
+ border-bottom: 1px solid var(--border);
+ margin-bottom: 10px;
+}
+
+.info_labels_edit {
+ padding-block-end: 7px;
+}
+
+a.link {
+ text-decoration: underline;
+ color: #003bff;
+}
+
+tr.escalated td {
+ background: #ff000008 !important;
+ color: red !important;
+ font-weight: bold !important;
+}
+
+i.fa-solid.fa-circle-exclamation {
+ color: red;
+}
+
+.history {
+ padding: 1rem;
+ border-left: 1px solid var(--border);
+}
+
+table#service_item_create td {
+ padding: 0 !important;
+}
+
+.select2-container--default .select2-selection--single {
+ border: 1px solid var(--border) !important;
+ border-radius: var(--br) !important;
+}
+
+.select2-container--default .select2-selection--single .select2-selection__rendered {
+ line-height: 40px !important;
+}
+
+.select2-container .select2-selection--single {
+ height: 40px !important;
+}
+
+.select2-container--default .select2-selection--single .select2-selection__arrow {
+ height: 38px !important;
+}
+
+.table_titlebare {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+select#input_main_contact_all {
+ display: none;
+}
+
+a.button_delete.primary {
+ padding-inline: 17px;
+}
+
+.card_ticket input#input_description {
+ font-size: inherit;
+}
+
+.titlebar h1 {
+ margin-top: 0;
+}
+
+table#service_item_create .select2-container--default .select2-selection--single {
+ border-radius: 0 !important;
+ border: 0 !important;
+}
+
+table#service_item_create td select,
+table#service_item_create td textarea,
+table#service_item_create td input {
+ font-size: 14px !important;
+ border-radius: 0 !important;
+ border: 0 !important;
+}
+
+.create_service_items {
+ margin-bottom: 1rem;
+}
+
+.history_list_item {
+ padding-block-end: 1rem;
+ position: relative;
+ display: block;
+ color: inherit;
+}
+
+.history_list_item:before {
+ content: "";
+ width: 12px;
+ height: 12px;
+ position: absolute;
+ left: -22px;
+ top: 4px;
+ background: #dddddd;
+ border-radius: 999px;
+}
+
+.history_date {
+ font-size: 13px;
+ opacity: 0.7;
+ padding-bottom: 10px;
+}
+
+.history_link a {
+ text-decoration: underline !important;
+ color: blue;
+}
+
+.message {
+ background: var(--clr-light);
+ padding: 1rem;
+ border-radius: var(--br);
+ margin-bottom: 1rem;
+ max-width: 95%;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ border: 1px solid var(--border);
+}
+
+.messages_scroll_container {
+ overflow-y: scroll;
+ height: 500px;
+ display: flex;
+ flex-direction: column-reverse;
+}
+
+p.date {
+ font-size: 12px;
+}
+
+p.history {
+ font-size: 12px;
+ text-align: center;
+ color: gray;
+}
+
+textarea#send_message {
+ width: 100%;
+ max-width: unset;
+}
+
+input#files {
+ width: auto;
+}
+
+textarea#send_message {
+ min-height: 60px;
+}
+
+.communication_toolbar {
+ display: flex;
+ gap: 10px;
+ padding-top: 1rem;
+ flex-direction: column;
+}
+
+.send_message_inputs {
+ display: flex;
+ align-items: flex-start;
+ gap: 1rem;
+}
+
+.right_toolbar {
+ display: flex;
+}
+
+span.In.Bearbeitung {
+ display: inline-block;
+ background: orange;
+ padding: 2px 8px;
+ font-size: 11px;
+ border-radius: 99px;
+ color: white;
+ white-space: nowrap;
+ font-weight: 500 !important;
+}
+
+span.Offen {
+ display: inline-block;
+ background: #dddddd;
+ padding: 2px 8px;
+ font-size: 11px;
+ border-radius: 99px;
+ color: black;
+ font-weight: 500 !important;
+}
+
+.individual_state_span {
+ display: inline-block;
+ background: #d9f3ff;
+ padding: 2px 8px;
+ font-size: 11px;
+ border-radius: 99px;
+ color: #004084;
+ font-weight: 500 !important;
+ white-space: nowrap;
+}
+
+.order_link_text {
+ border-bottom: 1px solid var(--border);
+ padding-block-end: 1rem;
+ display: block;
+ margin-bottom: 10px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ width: 100%;
+ max-width: 260px;
+ color: blue;
+ text-decoration: underline;
+}
+
+/* form#form_ticket_card aside {
+ overflow-y: scroll;
+ height: 77vh;
+} */
+
+.order_link_text_label>div:last-child .order_link_text {
+ border-bottom: 0;
+}
+
+.select2-container {
+ width: 100% !important;
+}
+
+.status_container {
+ display: flex;
+ gap: 5px;
+ flex-wrap: wrap;
+}
+
+.send_mail_checkbox {
+ display: flex;
+ align-items: center;
+ flex-direction: row-reverse;
+ justify-content: flex-end;
+ gap: 5px;
+}
+
+.send_mail_checkbox input {
+ margin: 0;
+}
+
+.suppliers {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 3px;
+ align-items: center;
+}
+
+.input.input_send_email {
+ display: flex;
+}
+
+span.Geschlossen {
+ display: inline-block;
+ background: #53ae37;
+ padding: 2px 8px;
+ font-size: 11px;
+ border-radius: 99px;
+ color: white;
+ font-weight: 500 !important;
+}
+
+section.cardform_section.new_ticket {
+ display: grid;
+ grid-template-columns: 2fr 3fr;
+ gap: 1rem;
+}
+
+section.cardform_section.new_ticket li.promoted {
+ width: 100%;
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+}
+
+.ticket-instruction ol li,
+.ticket-instruction ul li {
+ list-style: disc;
+}
+
+a.button_create_ticket {
+ width: 100%;
+ text-align: center;
+ display: block;
+ background: var(--clr-mandant);
+ color: white;
+ padding: 10px;
+ border-radius: var(--br);
+}
+
+.titlebar h1 {
+ margin-bottom: 0;
+}
+
+a.button_send_message_button {
+ background: var(--clr-mandant);
+ color: white;
+ padding: 1rem;
+ border-radius: var(--br);
+ display: block;
+}
+
+.message.outbound {
+ width: 100%;
+ margin-left: auto;
+ background: var(--blue-accent);
+ color: white;
+}
+
+.info_labels label div {
+ font-size: 16px;
+}
+
+.info_labels_edit label div {
+ font-size: 16px;
+}
+
+.titlebar li {
+ padding-bottom: 0 !important;
+}
+
+.card_header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ border-bottom: 1px solid var(--border);
+ padding: 0.5rem;
+ padding-inline: 1rem;
+ min-height: 57px;
+}
+
+.card_title h3 {
+ margin: 0;
+}
+
+p.state {
+ display: inline-block;
+ background: #e2e2e2;
+ padding: 5px 10px;
+ border-radius: var(--br);
+}
+
+aside {
+ grid-column: span 1;
+}
+
+fieldset {
+ border: 0;
+}
+
+div.dt-container.ui.grid>div.row:first-child {
+ padding-top: 0 !important;
+ padding-bottom: 0 !important;
+}
+
+.overdue {
+ background: #ff000008 !important;
+ color: red !important;
+ font-weight: bold !important;
+}
+
+.breadcrumb a {
+ color: white;
+}
+
+body.wiki .subcategory {
+ .pct_textcontent:after {
+ content: '';
+ width: 100%;
+ height: 10px;
+ background: var(--blur) !important;
+ position: absolute;
+ bottom: 0;
+ border-radius: 999px;
+ max-width: calc(100% - 2rem);
+ left: 50%;
+ transform: translateX(-50%);
+ }
+ .pct_read{
+ margin-bottom: 10px;
+ }
+ .pct_status {
+ height: 10px;
+ background: #5a9c9d;
+ border-radius: 999px;
+ z-index: 1;
+ position: relative;
+ }
+}
+body.wiki .category {
+ .pct_textcontent:after {
+ content: '';
+ width: 100%;
+ height: 10px;
+ background: var(--blur) !important;
+ position: absolute;
+ bottom: 0;
+ border-radius: 999px;
+ max-width: calc(100% - 2rem);
+ left: 50%;
+ transform: translateX(-50%);
+ }
+ .pct_read{
+ margin-bottom: 10px;
+ }
+ .pct_status {
+ height: 10px;
+ background: #5a9c9d;
+ border-radius: 999px;
+ z-index: 1;
+ position: relative;
+ }
+}
+
+
+.unreaded {
+ border: 1px solid red !important;
+ }
+
+
+
+
+
+.ticketcenter {
+ .right_toolbar {
+ gap: 10px;
+ /* a {
+ color: var(--clr-dark);
+ border: unset;
+ } */
+ }
+
+ .left_toolbar {
+ gap: 10px;
+ /* a {
+ color: var(--clr-dark);
+ border: unset;
+ } */
+ }
+
+ .titlebar {
+ background-color: #fff;
+ border-radius: var(--br);
+ padding: 10px 20px;
+ }
+
+ #ticket_wrapper {
+ display: flex;
+ flex-direction: column;
+ background-color: #fff;
+ border-radius: var(--br);
+ padding: 10px 20px;
+ margin-top: 20px;
+ border: 1px solid var(--border);
+
+ table {
+ border-collapse: collapse;
+ }
+
+ thead {
+ tr {
+ border: 1px solid var(--border);
+
+ th {
+ padding: 1rem 4px;
+ border-left: 1px solid var(--border);
+ border-right: 1px solid var(--border);
+ }
+ }
+ }
+
+ tbody {
+ tr {
+ border: 1px solid var(--border);
+
+ td.ticket_numb {
+ white-space: nowrap;
+ word-break: keep-all;
+ hyphens: none;
+ }
+
+ td {
+ padding: 1rem 4px;
+ border-left: 1px solid var(--border);
+ border-right: 1px solid var(--border);
+ }
+ }
+ }
+
+ .row:last-of-type {
+ display: flex;
+ justify-content: space-between;
+
+ .dt-button-split.buttons {
+ gap: unset;
+ align-items: start;
+
+ button {
+ margin-bottom: unset;
+
+ &.ui.floating.button.dt-button-split-drop.dropdown.icon.dt-button {
+ height: 42px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+ }
+
+ .ui.unstackable.pagination.menu {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+
+ li {
+ list-style: none;
+ /* .page-link {
+ color: var(--clr-dark);
+ } */
+ }
+ }
+ }
+ }
+}
+
+body.new_ticket {
+ .titlebar {
+ display: none;
+ }
+}
+
+body.ticket_edit {
+ .titlebar {
+ margin-bottom: 20px;
+ }
+
+ #input_main_tickets_status {
+ margin-bottom: 10px;
+ }
+}
+
+.ticketcenter {
+ .info_labels {
+ display: flex;
+ flex-direction: column;
+
+ input {
+ margin-bottom: 10px;
+ width: 100%;
+ }
+
+ .input {
+ margin-bottom: 10px;
+ width: 100%;
+ }
+
+ .promoted {
+ width: 100%;
+ }
+
+ a {
+ width: 100%;
+ }
+ }
+}
+
+.ticketcenter.ticket_edit {
+ main {
+ position: unset;
+ }
+
+ .main-screen {
+ position: unset;
+ }
+
+ div#hero_content {
+ height: unset;
+ }
+
+ .modal.category_edit {
+ max-width: 600px;
+ width: calc(100% - 40px);
+ margin: 0px 20px;
+ position: absolute;
+ top: 50%;
+ left: calc(50% - 20px);
+ transform: translate(-50%, -50%);
+ background-color: #fff;
+ padding: 20px;
+ border-radius: 7px;
+ }
+
+ .category_edit_bg {
+ width: 100%;
+ height: 100%;
+ background-color: #0000002e;
+ top: 0px;
+ left: 0px;
+ position: absolute;
+ z-index: 999;
+ }
+
+
+
+ #category_edit {
+ display: block;
+ background: #ededed;
+ text-align: center;
+ padding: 10px;
+ border-radius: var(--br);
+ color: black;
+ cursor: pointer;
+ }
+}
+
+@media (width < 1200px) {
+ .ticketcenter.ticket_edit {
+ .section_group {
+ .cardform_section {
+ grid-column: span 2;
+ }
+
+ aside {
+ grid-column: span 2;
+ }
+ }
+ }
+}
+
+@media (width < 768px) {
+ .ticketcenter.ticket_edit {
+ .section_group {
+ .cardform_section {
+ grid-column: span 4;
+ }
+
+ aside {
+ grid-column: span 4;
+ }
+ }
+ }
+}
+
+#ticket tbody tr {
+ cursor: pointer;
+}
+
+/* Ticketcenter Ende */
+
+
body.ticketcenter, body.servicecenter {
background-image: url(/userdata/01_Basis/Intranet_bg.webp) !important;
}
diff --git a/module/ticketcenter/services/ticketcenter.api.php b/module/ticketcenter/services/ticketcenter.api.php
new file mode 100644
index 0000000..513bcc3
--- /dev/null
+++ b/module/ticketcenter/services/ticketcenter.api.php
@@ -0,0 +1,44 @@
+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]);
+}
\ No newline at end of file
diff --git a/module/ticketcenter/category.inc.php b/module/ticketcenter/views/category/category.inc.php
similarity index 99%
rename from module/ticketcenter/category.inc.php
rename to module/ticketcenter/views/category/category.inc.php
index 11a8348..1c7ba22 100644
--- a/module/ticketcenter/category.inc.php
+++ b/module/ticketcenter/views/category/category.inc.php
@@ -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 . "
)";
diff --git a/module/ticketcenter/category_cardform.inc.php b/module/ticketcenter/views/category/category_cardform.inc.php
similarity index 100%
rename from module/ticketcenter/category_cardform.inc.php
rename to module/ticketcenter/views/category/category_cardform.inc.php
diff --git a/module/ticketcenter/category_listform.inc.php b/module/ticketcenter/views/category/category_listform.inc.php
similarity index 100%
rename from module/ticketcenter/category_listform.inc.php
rename to module/ticketcenter/views/category/category_listform.inc.php
diff --git a/module/ticketcenter/process.inc.php b/module/ticketcenter/views/process/process.inc.php
similarity index 100%
rename from module/ticketcenter/process.inc.php
rename to module/ticketcenter/views/process/process.inc.php
diff --git a/module/ticketcenter/process_cardform.inc.php b/module/ticketcenter/views/process/process_cardform.inc.php
similarity index 100%
rename from module/ticketcenter/process_cardform.inc.php
rename to module/ticketcenter/views/process/process_cardform.inc.php
diff --git a/module/ticketcenter/process_listform.inc.php b/module/ticketcenter/views/process/process_listform.inc.php
similarity index 100%
rename from module/ticketcenter/process_listform.inc.php
rename to module/ticketcenter/views/process/process_listform.inc.php
diff --git a/module/ticketcenter/status.inc.php b/module/ticketcenter/views/status/status.inc.php
similarity index 100%
rename from module/ticketcenter/status.inc.php
rename to module/ticketcenter/views/status/status.inc.php
diff --git a/module/ticketcenter/status_cardform.inc.php b/module/ticketcenter/views/status/status_cardform.inc.php
similarity index 100%
rename from module/ticketcenter/status_cardform.inc.php
rename to module/ticketcenter/views/status/status_cardform.inc.php
diff --git a/module/ticketcenter/status_listform.inc.php b/module/ticketcenter/views/status/status_listform.inc.php
similarity index 100%
rename from module/ticketcenter/status_listform.inc.php
rename to module/ticketcenter/views/status/status_listform.inc.php
diff --git a/module/ticketcenter/show_ticketcenter.inc.php b/module/ticketcenter/views/ticketcenter/show_ticketcenter.inc.php
similarity index 98%
rename from module/ticketcenter/show_ticketcenter.inc.php
rename to module/ticketcenter/views/ticketcenter/show_ticketcenter.inc.php
index 9b1a2cd..56845f6 100644
--- a/module/ticketcenter/show_ticketcenter.inc.php
+++ b/module/ticketcenter/views/ticketcenter/show_ticketcenter.inc.php
@@ -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);
+// })
+
+
-
\ No newline at end of file
diff --git a/module/ticketcenter/show_ticketcenter_ajax.php b/module/ticketcenter/views/ticketcenter/show_ticketcenter_ajax.php
similarity index 100%
rename from module/ticketcenter/show_ticketcenter_ajax.php
rename to module/ticketcenter/views/ticketcenter/show_ticketcenter_ajax.php
diff --git a/module/ticketcenter/show_ticketcenter_cardform.inc.php b/module/ticketcenter/views/ticketcenter/show_ticketcenter_cardform.inc.php
similarity index 99%
rename from module/ticketcenter/show_ticketcenter_cardform.inc.php
rename to module/ticketcenter/views/ticketcenter/show_ticketcenter_cardform.inc.php
index 7cc2235..5150501 100644
--- a/module/ticketcenter/show_ticketcenter_cardform.inc.php
+++ b/module/ticketcenter/views/ticketcenter/show_ticketcenter_cardform.inc.php
@@ -5,6 +5,7 @@ if (isset($_GET['service_item_no'])) {
$ticket['service_item_no'] = $_GET['service_item_no'];
}
?>
+
diff --git a/module/ticketcenter/show_ticketcenter_category_desc_ajax.php b/module/ticketcenter/views/ticketcenter/show_ticketcenter_category_desc_ajax.php
similarity index 100%
rename from module/ticketcenter/show_ticketcenter_category_desc_ajax.php
rename to module/ticketcenter/views/ticketcenter/show_ticketcenter_category_desc_ajax.php
diff --git a/module/ticketcenter/views/ticketcenter/show_ticketcenter_listform.inc copy.php b/module/ticketcenter/views/ticketcenter/show_ticketcenter_listform.inc copy.php
new file mode 100644
index 0000000..7c09476
--- /dev/null
+++ b/module/ticketcenter/views/ticketcenter/show_ticketcenter_listform.inc copy.php
@@ -0,0 +1,941 @@
+
+";
+ // echo "User Department IDs: " . implode(', ', $department_ids) . "
";
+
+ // 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 = '';
+ }
+ $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";
+ }
+ ?>
+
+ | = $unread ?> |
+ = $row['ticket_no'] ?> |
+
+
+ = $row['state'] ?>
+
+ = $row['individual_state_description'] ?>
+
+
+ |
+ = "1. " . $row['category_description'] . " "?>
+ = !empty($row['subcategory_description']) ? "2. " . $row['subcategory_description'] . " " : '' ?>
+ = !empty($row['subsubcategory_description']) ? "3. " . $row['subsubcategory_description'] : '' ?>
+ |
+ = $row['description'] ?> |
+ = $row['sender'] ?> |
+
+ = $row['receiver'] ?> |
+ = $creation_date->format('d.m.y H:i') ?> |
+ = $last_action->format('d.m.y H:i') ?> |
+
+ $now) {
+ echo $due_date->format('d.m.y');
+ } else {
+ echo '' . $due_date->format('d.m.y') . '';
+ }
+ } else {
+ echo '--.--.--';
+ }
+ ?>
+ |
+ 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';
+ }
+ ?> |
+
+
+
+
+
+ format('d.m.y H:i');
+ }
+ ?>
+ |
+
+
+
+
+
+ ' . htmlspecialchars($supplier['description']) . ' ';
+ }
+ ?>
+
+ |
+
+
+
+ 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];
+?>
+
+
+
+
+
\ No newline at end of file
diff --git a/module/ticketcenter/show_ticketcenter_listform.inc.php b/module/ticketcenter/views/ticketcenter/show_ticketcenter_listform.inc.php
similarity index 99%
rename from module/ticketcenter/show_ticketcenter_listform.inc.php
rename to module/ticketcenter/views/ticketcenter/show_ticketcenter_listform.inc.php
index 9341555..8f55964 100644
--- a/module/ticketcenter/show_ticketcenter_listform.inc.php
+++ b/module/ticketcenter/views/ticketcenter/show_ticketcenter_listform.inc.php
@@ -1,4 +1,4 @@
-
+
-
+