From 01e461b5baad48bf3bdda4d798a2ca3ea8d1954b Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Tue, 19 Nov 2024 13:52:27 +0100 Subject: [PATCH 01/41] Fixed Error when no additional class was set --- public/plugins/vue/tt-components/tt-button.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/plugins/vue/tt-components/tt-button.js b/public/plugins/vue/tt-components/tt-button.js index f5e28f50c..65e7f0f2a 100644 --- a/public/plugins/vue/tt-components/tt-button.js +++ b/public/plugins/vue/tt-components/tt-button.js @@ -30,6 +30,8 @@ Vue.component('tt-button', { 'btn-sm': this.sm, } + if (!this.additionalClass) return classes + for (const className of this.additionalClass.split(' ')) { classes[className] = true } From 465509a0c66fac2d37d97cd25ffc90e3a677e33a Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Wed, 27 Nov 2024 13:17:49 +0000 Subject: [PATCH 02/41] Changed notify duration --- .../WarehouseShippingNoteController.php | 9 ++++++++- .../WarehouseShippingNote/WarehouseShippingNote.css | 11 ++++++++++- .../WarehouseShippingNoteModal.js | 5 ++++- public/plugins/notification/notify.js | 2 +- public/plugins/vue/tt-components/tt-modal.js | 8 ++++++-- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/application/WarehouseShippingNote/WarehouseShippingNoteController.php b/application/WarehouseShippingNote/WarehouseShippingNoteController.php index d5a0d9eaf..592826bf8 100644 --- a/application/WarehouseShippingNote/WarehouseShippingNoteController.php +++ b/application/WarehouseShippingNote/WarehouseShippingNoteController.php @@ -240,8 +240,15 @@ class WarehouseShippingNoteController extends TTCrud { $hoursEntries = json_decode($shippingNote->hoursEntries, true); foreach ($hoursEntries as $hoursEntry) { // die(json_encode($hoursEntry)); + $articleTitle = "Arbeitsstunden"; + if (isset($hoursEntry['priceType']) && $hoursEntry['priceType'] == 50) { + $articleTitle = "Arbeitsstunden (50% Zuschlag)"; + } elseif (isset($hoursEntry['priceType']) && $hoursEntry['priceType'] == 100) { + $articleTitle = "Arbeitsstunden (100% Zuschlag)"; + } + $positions[] = [ - 'articleTitle' => "Arbeitsstunden", + 'articleTitle' => $articleTitle, 'articleDescription' => "Datum: ". date("d.m.Y", strtotime($hoursEntry['date'])) . " | Mitarbeiter: " . UserModel::getOne($hoursEntry['userId'])->name, 'articleUnit' => 'Std.', 'amount' => $hoursEntry['hourCount'], diff --git a/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css b/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css index c4baf9c04..5efd6858e 100644 --- a/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css +++ b/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css @@ -36,10 +36,19 @@ grid-gap: 10px; } - .warehouse-shipping-note-modal-positions-entry-actions, .warehouse-shipping-note-modal-hours-entry-actions { + .warehouse-shipping-note-modal-positions-entry-actions { grid-column: 2; } + .warehouse-shipping-note-modal-hours-entry-actions { + grid-column: 1 / span 2; + margin-bottom: 8px; + } + + .modal .table.table-striped.table-sm button{ + margin-bottom: 4px; + } + .signModal > div { margin: 0; width: 100vw; diff --git a/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js b/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js index ebc20857c..81cd0a585 100644 --- a/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js +++ b/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js @@ -47,6 +47,7 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', { hourCount: '', kilometerCount: '', hourlyPrice: '', + priceType: 'normal', } }, //language=Vue @@ -55,6 +56,7 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', { + @@ -74,6 +76,7 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', { userId: this.userId, date: this.date, hourCount: this.hourCount, + priceType: this.priceType, hourlyPrice: this.hourlyPrice || null, carId: this.carId ? this.carId : null, kilometerCount: this.carId ? this.kilometerCount : null @@ -103,7 +106,7 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', { if (!this.userId || this.carId) return; const response = await axios.get(window.TT_CONFIG["BASE_PATH"] + '/WarehouseShippingNote/timerecordingCarForUser?userId=' + this.userId); if (response.data.status === 'USER_NO_CAR') { - this.window.notify('info', 'Kein zugewiesenes Fahrzeug gefunden'); + // this.window.notify('info', 'Kein zugewiesenes Fahrzeug gefunden'); this.carId = ''; return; } diff --git a/public/plugins/notification/notify.js b/public/plugins/notification/notify.js index 7fee5da5f..b20771cc6 100644 --- a/public/plugins/notification/notify.js +++ b/public/plugins/notification/notify.js @@ -6,7 +6,7 @@ document.addEventListener('DOMContentLoaded', () => { // @formatter:on const notyf = new Notyf({ - duration: 10000, position: { + duration: 6000, position: { x: 'right', y: 'bottom', }, ripple: true, dismissible: true, fontSize: '32px', types: [{ diff --git a/public/plugins/vue/tt-components/tt-modal.js b/public/plugins/vue/tt-components/tt-modal.js index 35ca21eac..1b64e2814 100644 --- a/public/plugins/vue/tt-components/tt-modal.js +++ b/public/plugins/vue/tt-components/tt-modal.js @@ -44,14 +44,18 @@ Vue.component('tt-modal', { this.$emit('submit') } } - }, //language=Vue + }, + data() { + return {window: window, isMobile: navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) !== null} + }, + //language=Vue template: ` diff --git a/public/css/pages/Calendar/View.css b/public/css/pages/Calendar/View.css index f5c8e190b..036ac2ba4 100644 --- a/public/css/pages/Calendar/View.css +++ b/public/css/pages/Calendar/View.css @@ -185,6 +185,16 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion { .fc-day-today .fc-daygrid-day-number { color: #fff; } +.fc-scroller-harness-liquid { + overflow: visible; +} +.fc .fc-scroller-harness-liquid { + height: 700px; +} + +.card { + overflow: auto; +} .card-fullscreen { display: block; diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index 0c3079f49..9070d35ba 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -285,6 +285,7 @@ document.addEventListener('DOMContentLoaded', function () { schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', timeZone: 'UTC', locale: 'de', + height: 'auto', resourceAreaWidth: '220px', themeSystem: 'bootstrap4', snapDuration: '00:15:00', From 08f7a15bf1b32dc2a38a464eec064802ab6195ef Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Sun, 8 Dec 2024 19:00:06 +0100 Subject: [PATCH 08/41] Kalender Update: * Suche wurde angepasst --- application/Calendar/CalendarModel.php | 61 ++++++++++++++++++-------- public/js/pages/Calendar/View.js | 11 +++-- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/application/Calendar/CalendarModel.php b/application/Calendar/CalendarModel.php index 2303b08d6..8b92c2e14 100644 --- a/application/Calendar/CalendarModel.php +++ b/application/Calendar/CalendarModel.php @@ -43,6 +43,23 @@ class CalendarModel public static $specialCalendarColors = array(997 => '#bd0000', 998 => '#8000A3', 999 => '#08769b'); + public static function convertToSummertime($timestamp) + { + // Create a DateTime object from the Unix timestamp + $date = new DateTime(); + $date->setTimestamp($timestamp); + + // Set the timezone to Europe/Berlin + $date->setTimezone(new DateTimeZone('Europe/Berlin')); + if ($date->format('I') == 1) { + $cest = 7200; + } else { + $cest = 3600; + } + $unixtimestamp = $date->getTimestamp() + $cest; + // Format the date and time + return date('Y-m-d H:i:s', $unixtimestamp); + } public static function replace_unicode_sequences($string) { @@ -96,16 +113,18 @@ class CalendarModel $rows = array(); while ($data = $dbcal->fetch_array($res)) { - if ($data['location']) { - $searchName = $data['name'] . " @" . $data['location']; - } else { - $searchName = $data['name']; + if ($data['private'] != 1 || $data['calendar_id'] == $r->cal_id) { + if ($data['location']) { + $searchName = $data['name'] . " @" . $data['location']; + } else { + $searchName = $data['name']; + } + $id = $data['id'] . ";" . date("Y-m-d", $data['start_time']); + $rows[] = array( + 'id' => $id, + 'text' => $searchName . " (" . date("Y-m-d", $data['start_time']) . ")" + ); } - $id = $data['id'] . ";" . date("Y-m-d", $data['start_time']); - $rows[] = array( - 'id' => $id, - 'text' => $searchName . " (" . date("Y-m-d", $data['start_time']) . ")" - ); } $json['incomplete_results'] = false; $json['total_count'] = count($rows); @@ -195,7 +214,11 @@ class CalendarModel if ($data['recurrence']) { $recurrence = json_decode($data['recurrence'], true); - $rrule_events= json_decode($data['rrule_events'], true); + $rrule_events = json_decode($data['rrule_events'], true); + foreach ($rrule_events as $key => $value) { + $rrule_events[$key]['start'] = self::convertToSummertime(strtotime($value['start'])); + $rrule_events[$key]['end'] = self::convertToSummertime(strtotime($value['end'])); + } if ($rrulefreq[$recurrence['pattern']['type']]) { unset ($byweekday); $freq = $rrulefreq[$recurrence['pattern']['type']]; @@ -237,19 +260,19 @@ class CalendarModel $txtcolor = "#000"; $colorCounter++; } - $location=$data['location']; - $eventtype=$data['event_type']; - $description=$data['description']; + $location = $data['location']; + $eventtype = $data['event_type']; + $description = $data['description']; if ($calenderRights[$data['calendar_id']]) { $rights = $calenderRights[$data['calendar_id']]; $CalendarUsers[$data['calendar_id']] = $data['calendar_name']; - if ($data['private']==1 && $calendar[0]->go_calendar_id != $data['calendar_id']) { + if ($data['private'] == 1 && $calendar[0]->go_calendar_id != $data['calendar_id']) { $name = "Privat"; $attachment = 0; $attachmentLinks = ""; - $location=""; - $eventtype="1"; - $description=""; + $location = ""; + $eventtype = "1"; + $description = ""; } $rows[] = array( 'id' => array('id' => $data['id']), @@ -552,7 +575,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda $busy = ($r->busy); $users = ($r->users); $attendees = ($r->attendees); - $privateflag=($r->privateflag); + $privateflag = ($r->privateflag); foreach ($users as $key => $value) { $user_id = $value; } @@ -750,7 +773,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda $users = ($r->users); $customer_info_reminder_check = 0; $attendees = ($r->attendees); - $privateflag=($r->privateflag); + $privateflag = ($r->privateflag); date_default_timezone_set('Europe/Berlin'); header('Content-Type: application/json'); foreach ($users as $key => $value) { diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index 9070d35ba..00a82f4f9 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -117,7 +117,7 @@ document.addEventListener('DOMContentLoaded', function () { } else { rights = false; } - if (value.privateflag.privateflag == '1' && mycalendar_id!=value.calendar_id.calendar_id) { + if (value.privateflag.privateflag == '1' && mycalendar_id != value.calendar_id.calendar_id) { rights = false; } @@ -843,7 +843,9 @@ if (typeof (EventSource) !== 'undefined') { } else { movable = false; } - if (event.privateflag == '1' && mycalendar_id!=event.calendar_id_check) { + console.log(mycalendar_id); + console.log(event.calendar_id_check.calendar_id); + if (event.privateflag == '1' && mycalendar_id != event.calendar_id_check.calendar_id) { rights = false; movable = false; @@ -1536,7 +1538,8 @@ $(document).ready(function () { return { q: params.term, // Der Suchbegriff term: params.term, // Der Suchbegriff - calendars: visibleCalendars // Die dynamische Variable, die du hinzufügen möchtest + calendars: visibleCalendars, // Die dynamische Variable, die du hinzufügen möchtest + cal_id: $('#calendar-id').data('calendarid') }; }, dataType: 'json', @@ -1918,7 +1921,7 @@ Xinon GMbH`; } else { movable = false; } - if (value.privateflag.privateflag == '1' && mycalendar_id!=value.calendar_id.calendar_id) { + if (value.privateflag.privateflag == '1' && mycalendar_id != value.calendar_id.calendar_id) { rights = false; movable = false; From 08a6cd924e290262457890d8d5dec1c85967596d Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Sun, 8 Dec 2024 19:53:24 +0100 Subject: [PATCH 09/41] =?UTF-8?q?Kalender=20Update:=20*=20=C3=84nderungen?= =?UTF-8?q?=20bei=20Serienterminen=20wurden=20derweilen=20deaktiviert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/pages/Calendar/View.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index 00a82f4f9..57045d4b5 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -489,6 +489,7 @@ document.addEventListener('DOMContentLoaded', function () { $('.show-attendee').show(); $('.show-attendee').data('id', info.event.id); } + if (data.data.attendees.attendees) { let attendees = JSON.parse(data.data.attendees.attendees); $.each(attendees, function (index, value) { @@ -504,6 +505,13 @@ document.addEventListener('DOMContentLoaded', function () { $('#calendar-attendees').val(attendees).trigger('change'); } + if (info.event.extendedProps.rruleflag==true) + { + $('#delete-event').hide(); + $('#update-event').hide(); + $('.show-attendee').hide(); + + } }); if (info.event.extendedProps.clickable) { From b8e8729eff5879d9b1290edf9aa4473f71daf9cf Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Sun, 8 Dec 2024 20:14:40 +0100 Subject: [PATCH 10/41] =?UTF-8?q?Kalender=20Update:=20*=20=C3=84nderungen?= =?UTF-8?q?=20bei=20Serienterminen=20wurden=20derweilen=20deaktiviert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/pages/Calendar/View.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index 57045d4b5..bb2f3f9e0 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -505,8 +505,7 @@ document.addEventListener('DOMContentLoaded', function () { $('#calendar-attendees').val(attendees).trigger('change'); } - if (info.event.extendedProps.rruleflag==true) - { + if (info.event.extendedProps.rruleflag == true) { $('#delete-event').hide(); $('#update-event').hide(); $('.show-attendee').hide(); @@ -1335,17 +1334,6 @@ $(document).ready(function () { var txtcolors = []; var calendar_id = []; var thisis = $(this); - if (init === 0) { - var resourceA = calendar.getResourceById(thisis.data('calendar_id')); - if (resourceA) { - var events = resourceA.getEvents(); - events.forEach(function (event) { - event.setProp('backgroundColor', thisis.closest('div').find('.color-input').val()); - event.setProp('textColor', thisis.closest('div').find('.color-text-input').val()); - }); - } - calendar.render(); - } $.each($('.color-input'), function (index, value) { if ($(this).data('calendar_id')) { bgcolors.push($(this).closest('div').find('.color-input').val()); @@ -1367,6 +1355,10 @@ $(document).ready(function () { groups: groups }, function (data) { + }).done(function (data) { + if (init === 0) { + refreshCalendarEvents(); + } }) }); $('body').on('change', '.calendar-check', function (event, init = 0) { From 0ea1949c5cc2270b7e39f0dc054e442e5d2e2841 Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Mon, 9 Dec 2024 10:24:00 +0100 Subject: [PATCH 11/41] Kalender Update: * Bugfix Kunden-Info --- public/js/pages/Calendar/View.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index bb2f3f9e0..1aa278280 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -427,7 +427,7 @@ document.addEventListener('DOMContentLoaded', function () { } if (data.data.customer_info_send.customer_info_send) { const obj = JSON.parse(data.data.customer_info_send.customer_info_send); - $('#customer-info-check-info').html(''); + $('#customer-info-check-info').html(''); const unixTime = obj.sendtime; const date = new Date(unixTime * 1000); const germanDateTime = date.toLocaleString('de-DE', { @@ -451,7 +451,8 @@ document.addEventListener('DOMContentLoaded', function () {
gesendet am: ` + germanDateTime + `
`; - var tooltip = new Tooltip($('.fa-circle-info'), { + console.log(title); + var tooltip = new Tooltip($('.customer-info-point'), { title: title, placement: 'right', trigger: 'hover', @@ -850,8 +851,6 @@ if (typeof (EventSource) !== 'undefined') { } else { movable = false; } - console.log(mycalendar_id); - console.log(event.calendar_id_check.calendar_id); if (event.privateflag == '1' && mycalendar_id != event.calendar_id_check.calendar_id) { rights = false; movable = false; From 535ff886c67c78c7183a3a38c05d16b08c23e5b4 Mon Sep 17 00:00:00 2001 From: Daniel Spitzer Date: Mon, 9 Dec 2024 10:47:42 +0100 Subject: [PATCH 12/41] Kalender Update: * Bugfix Accept Title reset --- public/js/pages/Calendar/View.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index 1aa278280..3a0e93836 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -478,7 +478,10 @@ document.addEventListener('DOMContentLoaded', function () { const datetime = new Date(accept.time * 1000); const germanDateTime = datetime.toLocaleString('de-DE'); $('.accepted-status').prop('title', accept.user + ' (' + germanDateTime + ')'); + } else { + $('.accepted-status').prop('title', ''); } + $('.accepted-status').addClass('fa-circle-check'); $('.event-accepted').text('Akzeptiert'); } else { From 5e5feb3ce6dbfd895f282bd1fb53f9ccb4c39aa7 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Mon, 9 Dec 2024 13:14:44 +0100 Subject: [PATCH 13/41] changed shipping note --- .../WarehouseShippingNote/PDF_MAIN.php | 6 +- .../WarehouseShippingNoteController.php | 59 +++++++++++++++---- .../20241209130000_warehouse_modify_5.php | 33 +++++++++++ .../WarehouseShippingNote.css | 4 ++ .../WarehouseShippingNoteModal.js | 22 +++++-- 5 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 db/migrations/20241209130000_warehouse_modify_5.php diff --git a/Layout/default/WarehouseShippingNote/PDF_MAIN.php b/Layout/default/WarehouseShippingNote/PDF_MAIN.php index 4615b4861..6db5cd503 100644 --- a/Layout/default/WarehouseShippingNote/PDF_MAIN.php +++ b/Layout/default/WarehouseShippingNote/PDF_MAIN.php @@ -101,7 +101,7 @@ TODO: enable option for showing prices Position Menge Einheit - Artikel + Artikel Preis @@ -112,7 +112,7 @@ TODO: enable option for showing prices - + € @@ -123,7 +123,7 @@ TODO: enable option for showing prices - + diff --git a/application/WarehouseShippingNote/WarehouseShippingNoteController.php b/application/WarehouseShippingNote/WarehouseShippingNoteController.php index 592826bf8..abe8beadb 100644 --- a/application/WarehouseShippingNote/WarehouseShippingNoteController.php +++ b/application/WarehouseShippingNote/WarehouseShippingNoteController.php @@ -13,7 +13,7 @@ class WarehouseShippingNoteController extends TTCrud { ['key' => 'deliveryAddressPLZ', 'text' => 'L.-Adr. PLZ', 'required' => true], ['key' => 'deliveryAddressEMail', 'text' => 'L.-Adr. EMail', 'required' => false, 'table' => false], ['key' => 'note', 'text' => 'Art der Arbeit', 'required' => true, 'table' => false], - ['key' => 'status', 'text' => 'Status', 'required' => true, 'table' => ['filter' => 'select'], 'modal' => ['type' => 'select', 'items' => [['value' => 'new', 'text' => 'Neu'], ['value' => 'inProgress', 'text' => 'In Bearbeitung'], ['value' => 'accepted', 'text' => 'Akzeptiert'], ['value' => 'invoiced', 'text' => 'In Rechnung gestellt'],]]], + ['key' => 'status', 'text' => 'Status', 'required' => true, 'table' => ['filter' => 'select'], 'modal' => ['type' => 'select', 'items' => [['value' => 'new', 'text' => 'Neu'], ['value' => 'in_progress', 'text' => 'In Bearbeitung'], ['value' => 'accepted', 'text' => 'Akzeptiert'], ['value' => 'invoiced', 'text' => 'In Rechnung gestellt'],]]], ['key' => 'positions', 'text' => 'Positionen', 'required' => true, 'table' => false, 'modal' => false], ['key' => 'create', 'text' => 'Erstellt', 'required' => false, 'modal' => false, 'table' => ['filter' => 'date']], ['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'type' => 'autocomplete', 'table' => ['class' => 'text-nowrap', 'filter' => 'select'], 'modal' => ['items' => [], 'type' => 'select',]], @@ -247,18 +247,20 @@ class WarehouseShippingNoteController extends TTCrud { $articleTitle = "Arbeitsstunden (100% Zuschlag)"; } - $positions[] = [ - 'articleTitle' => $articleTitle, - 'articleDescription' => "Datum: ". date("d.m.Y", strtotime($hoursEntry['date'])) . " | Mitarbeiter: " . UserModel::getOne($hoursEntry['userId'])->name, - 'articleUnit' => 'Std.', - 'amount' => $hoursEntry['hourCount'], - 'price' => $hoursEntry['hourlyPrice'] * $hoursEntry['hourCount'] ?? 0, - ]; + if (intval($hoursEntry['hourCount']) > 0) { + $positions[] = [ + 'articleTitle' => $articleTitle, + 'articleDescription' => "Datum: ". date("d.m.Y", strtotime($hoursEntry['date'])) . " | Mitarbeiter: " . UserModel::getOne($hoursEntry['userId'])->name, + 'articleUnit' => 'Std.', + 'amount' => $hoursEntry['hourCount'], + 'price' => $hoursEntry['hourlyPrice'] * $hoursEntry['hourCount'] ?? 0, + ]; + } if ($hoursEntry['carId']) { $positions[] = [ - 'articleTitle' => "Fahrkostenpauschale", - 'articleDescription' => "Fahrzeug: " . TimerecordingCarModel::getOne($hoursEntry['carId'])->number_plate, + 'articleTitle' => "Fahrkostenpauschale (hin und retour)", + 'articleDescription' => "Datum: ". date("d.m.Y", strtotime($hoursEntry['date'])) . " | Fahrzeug: " . TimerecordingCarModel::getOne($hoursEntry['carId'])->number_plate, 'articleUnit' => 'Km', 'amount' => $hoursEntry['kilometerCount'], 'price' => 1 * $hoursEntry['kilometerCount'] ?? 0, @@ -268,6 +270,21 @@ class WarehouseShippingNoteController extends TTCrud { } + usort($positions, function ($a, $b) { + $aHasMitarbeiter = str_contains($a['articleDescription'], 'Mitarbeiter'); + $bHasMitarbeiter = str_contains($b['articleDescription'], 'Mitarbeiter'); + $aHasFahrzeug = str_contains($a['articleDescription'], 'Fahrzeug'); + $bHasFahrzeug = str_contains($b['articleDescription'], 'Fahrzeug'); + + if ($aHasMitarbeiter && !$bHasMitarbeiter) return -1; + if (!$aHasMitarbeiter && $bHasMitarbeiter) return 1; + if ($aHasFahrzeug && !$bHasFahrzeug) return -1; + if (!$aHasFahrzeug && $bHasFahrzeug) return 1; + return 0; + }); + + + $textElements = []; // parse shippingNote.textElements ({"1":true,"2":true}) to array, fetch each text element and put content into array $shippingNoteTextElements = json_decode($shippingNote->textElements, true); @@ -356,6 +373,28 @@ class WarehouseShippingNoteController extends TTCrud { self::returnJson(array_values($out)); } + protected function changeStatusAction() { + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + $json = json_decode(file_get_contents('php://input'), true); + $id = $json['id']; + $status = $json['status']; + if (strlen($id) < 1) { + http_response_code(500); + self::returnJson(['success' => false, 'message' => 'Lieferschein wurde nicht gefunden']); + } + + $shippingNote = (array) WarehouseShippingNoteModel::get($id); + if ($shippingNote['status'] === 'accepted' || $shippingNote['status'] === 'invoiced') { + http_response_code(500); + self::returnJson(['success' => false, 'message' => 'Status kann nicht geändert werden']); + } + + $shippingNote['status'] = $status; + WarehouseShippingNoteModel::update($shippingNote); + self::returnJson(['success' => true, 'message' => 'Status wurde geändert']); + } + //TODO: either move this to TimerecordingCarController or make it better protected function timerecordingCarAutoCompleteAction() { $timerecordingCars = array_map(function ($timerecordingCar) { diff --git a/db/migrations/20241209130000_warehouse_modify_5.php b/db/migrations/20241209130000_warehouse_modify_5.php new file mode 100644 index 000000000..cc5f9a9ba --- /dev/null +++ b/db/migrations/20241209130000_warehouse_modify_5.php @@ -0,0 +1,33 @@ +getEnvironment() == "thetool") { + $WarehouseHistory = $this->table("WarehouseHistory", ["signed" => true]); + $WarehouseHistory->changeColumn("old_value", "text", ["null" => true]); + $WarehouseHistory->changeColumn("new_value", "text", ["null" => true]); + $WarehouseHistory->save(); + + } + + if ($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void { + if ($this->getEnvironment() == "thetool") { + $WarehouseHistory = $this->table("WarehouseHistory", ["signed" => true]); + $WarehouseHistory->changeColumn("old_value", "string", ["null" => true, "limit" => 255]); + $WarehouseHistory->changeColumn("new_value", "string", ["null" => true, "limit" => 255]); + $WarehouseHistory->save(); + } + + if ($this->getEnvironment() == "addressdb") { + + } + } +} diff --git a/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css b/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css index ff8a58f38..4be936e76 100644 --- a/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css +++ b/public/js/pages/WarehouseShippingNote/WarehouseShippingNote.css @@ -21,6 +21,10 @@ grid-template-columns: 2fr 1fr 1fr 1fr 2fr 1fr 1fr; } +.warehouse-shipping-note-modal-hours-entry-container.hideHourlyPrice.hideKilometer { + grid-template-columns: 2fr 1fr 1fr 1fr 2fr 1fr; +} + @media (min-width: 992px) { .modal-lg, .modal-xl { /*max width either 90% or 1120px*/ diff --git a/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js b/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js index 81cd0a585..9e8f164b1 100644 --- a/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js +++ b/public/js/pages/WarehouseShippingNote/WarehouseShippingNoteModal.js @@ -52,14 +52,14 @@ Vue.component('warehouse-shipping-note-modal-hours-entry', { }, //language=Vue template: ` -
+
- +
@@ -168,7 +168,7 @@ Vue.component('warehouse-shipping-note-modal-hours-view', { {{ userNames[entry.userId] }} {{ window.moment(entry.date).format('DD.MM.YYYY') }} {{ entry.hourCount }} - {{ entry.kilometerCount }} + {{ entry.kilometerCount }} {{ entry.hourlyPrice }} @@ -500,13 +500,13 @@ Vue.component('warehouse-shipping-note-modal', {