Compare commits

...

701 Commits

Author SHA1 Message Date
f68e9ee218 Notification endpoint now filters for participant_id and fixed parsing of event type enumeration array 2025-12-09 12:21:11 +01:00
18f6d53998 Added logging to PutUser failures 2025-12-08 15:40:44 +01:00
4b8e878735 Added ChatGPT-created Mermaid database diagram to the Readme file 2025-12-08 15:40:32 +01:00
3f7da82ea6 Updated create schema script and added script to clear times doublettes for same participant type 2025-12-08 15:40:18 +01:00
c1e3e8939a Externalize all configuration parameters Pt.I 2025-12-05 18:08:15 +01:00
dc98b1d500 Merge branch 'release/1.7.0' into develop 2025-12-05 16:05:42 +01:00
a50cd9cc9a Merge branch 'bugfix/deactivating_users_roleeditor' into develop 2025-12-05 16:00:45 +01:00
d06669e943 Merge branch 'release/1.7.0' into develop 2025-12-05 15:58:38 +01:00
60baf02299 Applied automatic field check also for PUT on times to avoid accidental overwrite 2025-11-16 19:52:09 +01:00
ae2ce859ad Do not accidentally overwrite shipcall fields when fields are not passed on PUT request 2025-11-16 19:26:15 +01:00
44dd6010d7 Put some extra info in the docs 2025-11-14 15:54:18 +01:00
9116841292 Added a documentation file for the API spec 2025-11-14 11:19:04 +01:00
b5dd7422f4 Initializing pool connection variable with None.
Release pool connection handle und all circumstances especially also when a query fails
before the call is finished. This should avoid connection starvation.

fix prod. link

production fix

Fixed application path
2025-11-12 15:06:54 +01:00
63a3ce2f6f Improved connection pool init 2025-11-12 13:54:26 +01:00
8cc3444626 Added default port to python run flask settings 2025-11-12 13:53:34 +01:00
6362f47d43 Updated project settings, removed participant 'active' and fixed user delete 2025-10-13 17:37:59 +02:00
c6954fb222 Fixed some validation issues that have cropped up over the last months 2025-10-07 12:01:57 +02:00
6d8b86280c changed e-mail formatting to direct url at actual notified shipcall 2025-09-30 14:46:34 +02:00
2a1570d9f5 bugfix enum format
fixed required case

fixed more default occurrances

changed validates signature
2025-09-08 15:02:06 +02:00
14cfb41591 bugfix enum format
fixed required case

fixed more default occurrances

changed validates signature
2025-09-08 14:59:09 +02:00
62bd6304c4 Allow special characters &,-,_ for ship name and callsign 2025-07-25 13:33:18 +02:00
7fea4d27b7 Updated clear data script for the database (for purging all data via SQL) 2025-07-25 13:05:13 +02:00
03b434b801 Zwei Nachkommastellen für den Tiefgang in der Übersicht 2025-05-26 17:14:41 +02:00
dbd7347ac9 Moved draft up and put unit behind the value 2025-05-26 17:14:21 +02:00
ac15a6c2cf Added german satellite assemblies to setup project 2025-05-26 17:14:09 +02:00
c27685df6e Draft instead of callsign in BSMD cell 2025-05-26 17:12:31 +02:00
6610532c90 Some stuff for the website 2025-04-29 10:58:06 +02:00
d180dac600 improved next 24hr schedule check query that takes precedence for times eta value 2025-03-14 15:03:38 +01:00
8b4131332b release pooled SQL connection when sending an email 2025-03-07 10:05:14 +01:00
27b9f46f30 Avoid adding the same notification twice to a sender 2025-03-06 09:51:12 +01:00
c8550431e0 Bugfix for last update 2025-03-05 17:39:39 +01:00
a1b807824e fix for checking notification types when e-mail notifications are evaluated 2025-03-04 17:55:18 +01:00
189626d61c Reduced log-verbosity on the server 2025-02-27 13:48:13 +01:00
7b08eafd84 Version bump to 1.8.0.0 2025-02-10 08:28:43 +01:00
9e1c654826 Fixed error where rows where not collapsed when user is not of type pilot 2025-02-10 08:19:32 +01:00
ec925c1eb6 Fixed flag evaluation for notification selection type 2025-02-10 08:19:20 +01:00
d879d8cc5c Fixed typo 2025-02-10 08:19:08 +01:00
4885c6a0ff Fix bug when checking for assigned pilot in case tidal times are changed 2025-02-10 08:18:58 +01:00
7baa7b0220 Added event type evaluation and storage of selection bitflag. Fixed some details in the UI 2025-02-10 08:18:44 +01:00
a3a8ef3b39 Extended API and added event type selection to about dialog 2025-02-10 08:18:32 +01:00
fd5dbc8b37 Changed Win Target to .NET8, updated YAML for user notification event selection 2025-02-10 08:18:17 +01:00
6cbc8df5f5 Allow pilots to enter tidal times 2025-02-10 08:17:59 +01:00
bc3d5678ed Allow shipcall PUT also by PILOT 2025-02-10 08:17:46 +01:00
545910c9b8 Fix filtering of notifications depending on participant assignment to shipcall in case the notification has no participant id 2025-02-10 08:17:20 +01:00
9dc4673b3b Fix E-Mail validation error reporting 2025-02-10 08:16:57 +01:00
3d76acb2f0 Version bump to 1.7.0.7 2025-02-10 08:14:57 +01:00
98c05aed3b Fixed error where rows where not collapsed when user is not of type pilot 2025-02-09 13:57:03 +01:00
98696aee93 Fixed flag evaluation for notification selection type 2025-02-08 13:41:44 +01:00
7f706dfc51 Fixed typo 2025-02-08 11:16:21 +01:00
ab12e28d3d Fix bug when checking for assigned pilot in case tidal times are changed 2025-02-06 06:54:19 +01:00
e9a7e03ebf Version bump to 1.7.0.6 2025-02-05 20:06:07 +01:00
f1c5bd3cd8 Added event type evaluation and storage of selection bitflag. Fixed some details in the UI 2025-02-05 19:24:07 +01:00
bb13d74849 Extended API and added event type selection to about dialog 2025-02-05 09:27:59 +01:00
55cf17d169 Changed Win Target to .NET8, updated YAML for user notification event selection 2025-02-04 10:12:29 +01:00
ea634a3af2 Allow pilots to enter tidal times 2025-02-03 12:02:24 +01:00
21471d4d41 Allow shipcall PUT also by PILOT 2025-02-03 11:56:44 +01:00
fce897fae4 Fix filtering of notifications depending on participant assignment to shipcall in case the notification has no participant id 2025-02-03 11:14:51 +01:00
64c6607076 Fix E-Mail validation error reporting 2025-02-03 10:35:46 +01:00
6dedc04957 changed bg color for missing data 2025-01-21 15:19:18 +01:00
213f7cf58c fixed path 2025-01-21 14:52:50 +01:00
49a8498bbe Changed settings for test version 2025-01-21 13:47:52 +01:00
e84a73465d Version bump to 1.7.0.5 2025-01-20 08:14:18 +01:00
2d61565c29 fixed stupid serialization error 2025-01-20 08:13:37 +01:00
753d8a4465 fixed stupid init bug 2025-01-13 17:35:35 +01:00
654518e642 Version bump to 1.7.0.4 2025-01-13 17:09:52 +01:00
7840406688 split up red / yellow evaluation errors on separate notification types (time_conflict(red), missing_data(yellow)) 2025-01-13 16:31:32 +01:00
1f860baa2b do not show notifications again on the client 2025-01-13 11:59:12 +01:00
5eb1074a79 Fixed notification event display on client side 2025-01-13 11:45:13 +01:00
ba8778cc3f fixed interval settings 2025-01-13 10:44:37 +01:00
6b173495af Clear notifications from the database that are more than 3 days in the past 2025-01-13 09:45:56 +01:00
cda3f231a7 creating notifications if a shipcall is cancelled 2025-01-10 13:49:00 +01:00
91caf74dca filter out cancelled shipcalls before timer error validation 2025-01-10 13:28:12 +01:00
b36e2c9e05 Added new notifications to basic types 2025-01-10 11:48:11 +01:00
0c6c3a048d Merge branch 'feature/toast_notifications' into develop 2025-01-10 11:17:11 +01:00
1e6e34df77 Version bump to 1.7.0.3 2025-01-08 09:24:11 +01:00
f7a43ca971 Added some separators in about dialog to make it easier to understand 2025-01-08 09:23:53 +01:00
e103743d5e removed erroneous break from add user loop 2025-01-07 07:47:57 +01:00
710e21e567 fixed small de-ref bug 2025-01-07 07:24:42 +01:00
afe31e504a Version bump 1.7.0.2 2024-12-23 18:48:55 +01:00
1fd87edd6e Custom toast control, colored by type 2024-12-23 18:39:24 +01:00
a648cc2e71 Overview window of past notifications 2024-12-23 11:23:37 +01:00
880a8a2a8d Got simple toast notifications going 2024-12-19 12:59:54 +01:00
f7684902aa fixed missing info in notification API 2024-12-19 10:48:36 +01:00
f218e5f96a fixed missing info in notification API 2024-12-18 17:59:40 +01:00
4d5d63dbdd Updated Nuget 2024-12-18 08:53:06 +01:00
622ab6b4a3 fixed some smaller issues 2024-12-17 14:51:04 +01:00
47da3ff475 removed wrong curly braces 2024-12-17 10:48:39 +01:00
7813203790 Reset everything to online devel version 2024-12-17 10:40:40 +01:00
331ffcd10c Notification Mail püpscher 2024-12-16 17:48:32 +01:00
14244e2f48 EMail notifications work in progress 2024-12-16 16:25:52 +01:00
3e2b9f649c moved and updated e-mail msg templates 2024-12-16 08:31:38 +01:00
02947ce6e5 E-Mail template first steps 2024-12-14 18:56:06 +01:00
fc6c6179b8 Added E-Mail send logic (untested yet) 2024-12-13 11:36:21 +01:00
7548de7609 Prepare to send E-mail notifications 2024-12-12 16:06:32 +01:00
e5d9d051ea Added notification generation for next 24hrs shipcalls 2024-12-12 11:10:05 +01:00
50cecc6a9d fixed bug in participant API GET with user_id parameter 2024-12-11 12:10:37 +01:00
ebb2182c4c Create assignment and un-assignment notifications 2024-12-10 10:30:26 +01:00
023f3357f3 Do not allow editing on cancelled shipcalls 2024-12-07 15:17:52 +01:00
dd3f000f84 fixed missing shipcall id in backend result 2024-12-07 15:17:25 +01:00
573ab2d808 Scheduler setup for notification level evaluation 2024-12-06 10:08:24 +01:00
9b69e4f50c Added data delete script 2024-12-06 08:08:28 +01:00
be46e79a67 Cosmetics and bumped version to 1.7.0.0 2024-12-05 18:46:04 +01:00
7d4f202692 Fixed error in validation when not all fields are transmitted. Added UI for Notification flags. 2024-12-05 18:39:28 +01:00
44f5d07ed7 Adjusted yaml spec and fixed user interface for storing notification flags 2024-12-05 17:25:01 +01:00
941b5e70fb Fixed ship add in backend 2024-12-05 14:47:20 +01:00
97a9e0bcf7 Fixed small bug regarding read only of port combobox 2024-12-04 10:29:20 +01:00
4acf8d7c29 fixed init when Port has been preselected but no berth 2024-12-04 10:29:07 +01:00
74b15e4b64 Do not run change port event handler during iinit 2024-12-04 10:28:57 +01:00
e60a623753 Do port dependencies for comboboxes also when loading existing shipcall 2024-12-04 10:28:47 +01:00
ddae95b784 Make pier filter combobox dependent on selected harbour 2024-12-04 10:28:34 +01:00
184d15554b Port may only be changed if the shipcall is created 2024-12-04 10:28:24 +01:00
0d9e4ac026 fixed some missing client warnings 2024-11-19 12:26:33 +01:00
6bfb0d3e23 fixed database upgrade script (1.5 -> 1.6) 2024-11-19 12:11:57 +01:00
25013b4edc fixed comparison typo 2024-11-14 11:48:12 +01:00
3775d6775c adding missing defaults when shipcall is not yet created 2024-11-14 11:47:57 +01:00
9bb847242c Fixed situation where end time was reset after from time left 24h window 2024-11-14 11:47:34 +01:00
2576127b79 serverside fixes for detecting unchanged time values 2024-11-14 11:45:24 +01:00
08792c5fa7 Apply 1 day past rule to both from and to times on eta / etd to avoid loophole 2024-11-14 11:44:27 +01:00
effbf42303 If the agency provided a time, display it in the BSMD column. Also corrected ETD/ETA Label right there 2024-11-08 09:59:37 +01:00
b070979723 Allow new shipcalls up to 1 day in the past for serverside validation 2024-11-08 09:41:04 +01:00
d6e3ae20c1 Allow new shipcalls up to 1 day in the past for serverside validation 2024-11-08 09:37:46 +01:00
b5a8a3d31c added -1 day time logic to client 2024-11-08 09:35:07 +01:00
be5859424d allow ATA changes in the past, allow OK click if time values have not been changed 2024-11-08 09:33:34 +01:00
72d3ad05bf Added validation rules regarding port_id (for berth and participant assignment) 2024-10-23 09:55:56 +02:00
0d7861ec36 If a PUT or DELETE operation is attempted on a non-existant object, 404 is returned 2024-10-21 10:37:35 +02:00
4531eda8f1 more validation input fixes 2024-10-19 19:59:38 +02:00
b5b78a9c7e Fixed tidal window validation and description output 2024-10-19 19:59:17 +02:00
f0720b9b1d Fixed some more small bugs in validation when only a partial times dataset is put 2024-10-19 19:58:46 +02:00
bac3421a64 Fix text filter if there is whitespace in the text, simplified some events 2024-10-19 19:57:07 +02:00
11098da25b bugfix for shipcall PUT validation 2024-10-19 19:56:29 +02:00
scopesorting
fb8b732b1d regardless of the BSMD flag, BSMD users are now able to perform shipc… (#51)
* regardless of the BSMD flag, BSMD users are now able to perform shipcall PUT-requests

* regardless of the BSMD flag, BSMD users are now able to perform shipcall PUT-requests

* docstrings and BSMD-flag handling
2024-10-19 19:56:08 +02:00
4a0943c64f Version bump to 1.6.0.4 2024-10-19 19:51:32 +02:00
2a47dd6534 Avoid harbour selection changed event when initializing dialog 2024-10-19 19:39:03 +02:00
dd5d334e96 Version bump to 1.6.0.3 2024-10-01 08:37:34 +02:00
34c91497f3 Only allow harbours to be selected where the current user is assigned to 2024-10-01 08:36:30 +02:00
e18188cd85 don't allow a changed port when creating departure after a new arrival 2024-10-01 08:19:11 +02:00
4b1f773c6f changed last change highlight colors 2024-09-30 08:36:45 +02:00
1d64a83d32 Fixed error in validation when times data was updated for operations 2024-09-30 08:32:18 +02:00
0eaea46409 Limit shifting number to 127 to avoid int -> uint overflow on insert 2024-09-30 08:31:50 +02:00
f3c5111265 Upgrade to python 3.12 on the server, exported current requirements 2024-09-23 08:09:59 +02:00
d7919922fc Version bump to 1.6.0.2 and making 1.6.0.2 the minimum win client version 2024-09-20 14:10:14 +02:00
90d32a26f1 Show last change date permanently in the header. Latest value is highlighted 2024-09-20 12:24:59 +02:00
ed6f5ab648 essential bugfixes 2024-09-20 09:46:48 +02:00
12c1fc59b1 Merge branch 'feature/client_with_ports' into develop 2024-09-19 09:45:38 +02:00
a06ec0eabb Bump version to 1.6.0.1 2024-09-19 09:26:46 +02:00
de94d63a41 Make nomination comboboxes dependant on selected harbour 2024-09-19 09:25:24 +02:00
3b3601baeb Added agency port dependency when editing shipcalls 2024-09-19 09:10:15 +02:00
Max Metz
7abf0e26e2 when a ship is deleted, the IMO is no longer considered to exist 2024-09-18 08:34:21 +02:00
Max Metz
cc29320c87 BSMD-flag check was executed on the wrong ID. Now, it correctly uses the assigned agency's ID to determine the presence of a BSMD flag 2024-09-18 08:33:59 +02:00
402c9807c9 Merge branch 'bugfix/extend_clientside_validation' into develop 2024-09-17 09:45:54 +02:00
8c23df8cda Added extra too far in the future validation on the client-side 2024-09-17 09:40:36 +02:00
470110ef5b Ensure both or none of the tidal window times are set when leaving the agency dialogs 2024-09-17 08:47:43 +02:00
081995990f Only allow editing (OK-Button enabled) for the assigned owner of the times record 2024-09-17 08:26:39 +02:00
d2bab6e2c2 only allow saving if ETA time is greater than ETD time when shifting 2024-09-17 08:04:26 +02:00
6215449bc8 Filter berths in combobox by selected port. Might still need some work.. 2024-09-16 16:38:55 +02:00
80ad3e8e5a Show port in shipcall control overview at the bottom left 2024-09-16 16:02:57 +02:00
948684455d Add port selection to shipcall create / edit dialog 2024-09-16 15:31:12 +02:00
0e7493366c Added port filter to main screen and allowed port filtering 2024-09-16 14:18:57 +02:00
775fa3a7e2 Simple purge script for data pertaining to a specific participant 2024-09-16 14:18:57 +02:00
5ce866936d unified return structure to use error_field instead of message key to correspond to API specification 2024-09-16 14:17:30 +02:00
a68a768277 fixed bug in ports GET 2024-09-15 16:13:47 +02:00
489dfc2ed6 added port_id and ports endpoint to flask app (no validation yet!), reading works 2024-09-13 17:45:31 +02:00
c796be2892 Upgraded client library references due to security warnings 2024-09-12 16:44:15 +02:00
6a6ffa38f9 extended OpenAPI with port endpoint and refs, adjusted some code to compile 2024-09-12 16:43:39 +02:00
a2c56e9696 Changes for linter to return no messages at all for warning level 2024-09-12 15:52:24 +02:00
cc17e6c33a Merge branch 'feature/1.6_database_changes' into develop 2024-09-12 11:48:56 +02:00
5625cbac49 reverted settings for test version 2024-09-12 11:31:16 +02:00
79ed86937c Merge branch 'release/1.5.0' into develop 2024-09-12 11:23:08 +02:00
a90eca923d
Merge pull request #49 from puls200/hotfix/20240912
Hotfix/20240912
2024-09-12 10:48:06 +02:00
Max Metz
aaea8441f6 shifting the ship-id check into the validation object 2024-09-12 10:22:27 +02:00
Max Metz
82ad56812e correcting an issue in the DELETE methods for SHIPS and TIMES, where the ID may have been provided as a null value or was incorrectly converted (string instead of integer) 2024-09-12 10:19:26 +02:00
82969c8726 Merge branch 'bugfix/validation_feedback' into release/1.5.0 2024-09-12 09:43:45 +02:00
4e39510be6 Version bump to 1.5.0.4 2024-09-11 09:11:46 +02:00
e7a6aa6584 fixed some cut and paste error and a crash when changing the assignment fails by API 2024-09-11 08:41:49 +02:00
282a860c42 Version bump to 1.5.0.2 2024-09-11 07:08:14 +02:00
a0d27289ae removed unnecessary float conversion 2024-09-10 21:46:30 +02:00
a497f7f2a0 fixed typo in error message 2024-09-10 21:15:52 +02:00
a305ee3bed Version bump to 1.5.0.2 2024-09-10 21:14:21 +02:00
38563d5b38 Simplified error display dialog 2024-09-10 18:06:28 +02:00
39c5990199
Merge pull request #48 from puls200/hotfix/20240910
Hotfix/20240910
2024-09-10 17:53:12 +02:00
Max Metz
7c5bc626d0 improving documentation 2024-09-10 17:47:44 +02:00
Max Metz
6505ad758f bsmd authorization for times PUT 2024-09-10 17:45:32 +02:00
96d0de9e56
Update validation rules document (#47)
* Update validation rules document

* clarified error message array in 400 return value

* simplified the return structure
2024-09-10 17:41:21 +02:00
Max Metz
5b68ef95cb adapting exception handling and error responses for 400 responses. Using a simplified format, which only uses the keys 'error_field' and 'error_description' 2024-09-10 17:37:08 +02:00
Max Metz
590df30fef A ship's IMO-validation was used in POST and PUT requests. This caused an issue for POST requests. 2024-09-10 14:48:20 +02:00
Max Metz
c90b002806 Times POST no longer raises a ValidationError when the provided time is in the past. 2024-09-10 14:17:03 +02:00
Max Metz
7a97cd7d95 format of exceptions now always follows baseline format. 'errors'-key is always a list of dictionaries. 2024-09-10 13:50:13 +02:00
c375b9f553 Adding proper result structure to error return message 2024-09-10 12:59:39 +02:00
4f88e493d9
Merge pull request #46 from puls200/hotfix/20240909
Hotfix/20240909
2024-09-09 19:54:34 +02:00
67c852482e Added some warnings if time intervals or particular values lie in the past for shipcall and agency 2024-09-09 18:27:03 +02:00
Max Metz
9127cdeac8 BSMD users are now allowed to POST times entry, if they are assigned to the ShipcallParticipantMap or the special BSMD-flag-clause takes place 2024-09-09 17:06:03 +02:00
93362d3695 Don't crash on ship delete API error 2024-09-09 13:11:56 +02:00
Max Metz
d2cd233f13 creating default handlers for every kind of Exception in the /api/ routes. Those default functions also create automatic logging with the .warning level. Relocated the .impl-calls into the Try-Exception-blocks, so they are properly logged and avoid system failures. 2024-09-09 12:46:55 +02:00
Max Metz
85973ad848 creating a default error response format for each API route 2024-09-09 12:21:32 +02:00
Max Metz
61b00b8b22 auto-converting non-lists to list values. 2024-09-09 11:55:58 +02:00
8028382e79
Merge pull request #45 from puls200/hotfix/20240905_validation_error_type
Hotfix/20240905 validation error type
2024-09-05 18:40:30 +02:00
Max Metz
ab7b1ed34f every ValidationError is defined to return a dictionary. In case of validation errors without such a call, a function enforces a default with an undefined key to ensure the correct format. 2024-09-05 12:46:04 +02:00
Max Metz
7ad8011c52 Merge branch 'release/1.5.0' of github.com:puls200/brecal into release/1.5.0 2024-09-05 11:55:34 +02:00
1243ebf9e7 Adjusted error formatting and bumped test version to 1.5.0.1 2024-09-05 06:49:25 +02:00
3bce9e85b9
Merge pull request #44 from puls200/hotfix/20240903_maintenance_1.5.0
Hotfix/20240903 maintenance 1.5.0
2024-09-05 05:59:44 +02:00
Max Metz
facafd09ba adapting the .md documentation for the traffic state rules. 2024-09-04 12:29:06 +02:00
Max Metz
c7371a945a adapting traffic light validation 0002-C. This no longer requires ETA verification. Adapted the description when the error occurs and renamed the function. 2024-09-04 12:21:22 +02:00
Max Metz
e4d0ea2301 fixed serialization of marshmallow.ValidationErrors. This was caused by the 'valid_data' containing datetime objects, which were not serializable natively. 2024-09-04 12:11:32 +02:00
Max Metz
bc73bb3c08 fixed serialization of marshmallow.ValidationErrors. This was caused by the 'valid_data' containing datetime objects, which were not serializable natively. 2024-09-04 12:11:05 +02:00
Max Metz
2f678267c8 time estimations are no longer dependency on times POST requests. This refers to eta_berth, etd_berth, operations_start, operations_end. 2024-09-04 11:41:03 +02:00
Max Metz
a8d0356eb7 added the shipcall PUT rule to the docs/ApiValidatioNRules.md document 2024-09-04 11:19:47 +02:00
Max Metz
2c0a73113b shipcall PUTs may no longer change the shipcall type 2024-09-04 11:17:32 +02:00
126faff281 Removed ETA as required field from shipcall PUT/POST 2024-09-04 11:13:38 +02:00
Max Metz
3d2405e8fb maintenance of API Input Validation (ship & times) 2024-09-04 10:27:46 +02:00
Max Metz
1ff972883f adding input validation for time intervals 2024-09-04 10:27:38 +02:00
76995a84e4 Added the port reference to management of berths incl. excel import 2024-09-04 09:50:53 +02:00
Max Metz
4b5ff90b34 properly serializing ValidationError exceptions. 2024-09-04 08:30:46 +02:00
759532733c
Merge pull request #42 from puls200/hotfix/20240903_json_responses
properly serializing ValidationError exceptions.
2024-09-04 08:30:12 +02:00
6cfd311bbb Version bump to 1.6 2024-09-04 08:09:13 +02:00
8b4c9e2590 Extending the role editor pt.2 2024-09-04 08:09:00 +02:00
Max Metz
ff060edcfa properly serializing ValidationError exceptions. 2024-09-03 11:23:28 +02:00
de7a9a05f2 Extending the role editor pt. 1 2024-09-03 10:03:36 +02:00
bbc705cf63 Database changes complete 2024-09-03 08:54:34 +02:00
983c21ba67 don't crash on badly formatted error messages 2024-09-02 08:48:40 +02:00
9b038b3571 Database extension, first step 2024-09-01 11:33:01 +02:00
ed7c4fbfbb Created test version including version bump to 1.5.0 2024-08-30 11:27:10 +02:00
1f854b6cde Merge branch 'feature/improve_error_display' into develop 2024-08-29 09:21:52 +02:00
78ab83628b Version bump to 1.4.1 (due to API change) 2024-08-29 09:01:21 +02:00
38ed66a638 Updated YAML File to match API rule for readOnly properties 2024-08-29 08:58:28 +02:00
e890985e2d
Merge pull request #41 from puls200/hotfix/20240827
potentially resolving the 'Unknown column ... in 'field list' issue
2024-08-29 07:34:24 +02:00
Max Metz
2ac2bc196c potentially resolving the 'Unknown column ... in 'field list' issue 2024-08-28 18:44:45 +02:00
99052efd07 Fixed shipcall POST documentation for canceled field 2024-08-28 17:39:19 +02:00
b154f73ce9 Convenience: If creating a new ship fails, the ship is shown again when the dialog is re-opened 2024-08-28 17:35:58 +02:00
65779731fd Show the content of the message info from the failure exception 2024-08-28 17:04:04 +02:00
fc96f5d856
Merge pull request #40 from puls200/hotfix/20240827
removed the 'canceled may not be set on post'-issue.
2024-08-28 14:55:32 +02:00
Max Metz
a51b830cf6 removed the 'canceled may not be set on post'-issue. 2024-08-28 13:06:36 +02:00
231c9f86c4
Merge pull request #39 from puls200/hotfix/20240827
Hotfix/20240827
2024-08-28 10:24:21 +02:00
Max Metz
1be7d68f5c participant flag also resolved 2024-08-27 21:16:49 +02:00
Max Metz
cc2a54c1c6 added extensive logging for an open, unresolved issue. The issue-log may make clear, where the issue originates 2024-08-27 21:14:30 +02:00
Max Metz
e1d9570268 solving the concatenation issue of a list and a None-type. 2024-08-27 20:52:10 +02:00
Max Metz
8082100b7e using the @classmethod _missing_ function in an IntFlag creates an incorrect resolution of intflags. 127 was resolved as 0 due to the _missing_ function. Without that method, 127 becomes a proper multi-flag 2024-08-27 20:33:33 +02:00
Max Metz
6eab98d2a1 correcting the issue with participant_id authorization (BSMD or AGENCY check). 2024-08-27 19:23:37 +02:00
f58665f761
Merge pull request #38 from puls200/hotfix/api_input_validation_20240812
marshmallow.fields incorrectly resolved the 'required' field. Adapted…
2024-08-15 08:47:06 +02:00
Max Metz
fcc03b2ade adaptation of traffic validation (resolving open issue) 2024-08-14 19:09:35 +02:00
Max Metz
c4e5764601 /ships GET no longer blocks deleted ships from being returned. 2024-08-14 15:53:37 +02:00
Max Metz
b60874cbb0 shipcall, ship, times and user verify the validity of JSON data when receiving POST/PUT requests. 2024-08-14 15:49:28 +02:00
Max Metz
e488501837 debugging the missing column '.PORT_ADMINISTRATION' issue 2024-08-14 14:58:03 +02:00
Max Metz
4f3686e00f marshmallow.fields incorrectly resolved the 'required' field. Adapted each field to ensure that missing data properly raises an error. 2024-08-14 13:59:26 +02:00
cb0717fc82
Merge pull request #37 from puls200/hotfix/api_input_validation_20240812
added a reference check to PUT-requests (shipcall), so each provided …
2024-08-13 08:28:19 +02:00
cdf6e7d99b Reverted change to only return not deleted ships 2024-08-13 08:27:05 +02:00
Max Metz
0e8faf499d GET ships no longer returns deleted ships 2024-08-12 20:35:37 +02:00
Max Metz
22009eb469 resolving an issue where missing values for 'flags' in the Shipcall would cause rule-violations 2024-08-12 19:56:26 +02:00
Max Metz
e526337c6a added a reference check to PUT-requests (shipcall), so each provided ID must exist. Corrected some input validation functions to solve known bugs 2024-08-12 19:43:19 +02:00
7e6252880d
Merge pull request #36 from puls200/hotfix/20240806_api_validation
corrected open issues of the API validation functions. Made some vali…
2024-08-06 21:54:42 +02:00
Max Metz
d54fed9160 corrected open issues of the API validation functions. Made some validation errors more verbose, improved robustness, refactored some of the methods and adapted many unit tests to the novel format. 2024-08-06 20:46:40 +02:00
18719f15c1
Merge pull request #35 from puls200/hotfix/api_input_validation_20240801
correcting a validation issue for 'voyage'
2024-08-01 21:25:28 +02:00
Max Metz
3ce2fc829d correcting a validation issue for 'voyage' 2024-08-01 18:34:56 +02:00
be6c898415
Merge pull request #30 from puls200/feature/api_input_validation
API Input-Validierung
2024-08-01 14:27:42 +02:00
Max Metz
5769889fea resolving the validation issue in shipcalls, which was caused by a faulty fields type in the ShipcallSchema. 2024-07-31 14:59:59 +02:00
cc724bdb30 Updated validation rule documentation 2024-07-25 11:13:51 +02:00
Max Metz
cd8c246d72 adapting times POST, PUT, DELETE to properly include the special case, where a BSMD user should also be allowed to handle times entries of an AGENCY, if the agency has the flag set. 2024-07-25 10:42:44 +02:00
83520a2bc7 Fixed small issues for ships endpoint validation 2024-07-25 10:42:44 +02:00
Max Metz
3d2e1f5158 Added input validation for API requests. Refactored some methods, added docstrings. Solved marshmallow-warnings in BreCal.schemas.model. Added unit tests, now totaling 215. Added proposals to refactor all SQL queries into an object at BreCal.database.sql_queries.SQLQuery for better standardization. Created a helper-object to handle Emails, which prepares the notification-feature. 2024-07-25 10:42:44 +02:00
e33833235d Bugfix for comparer when times value is null and DateTime.Now is inconsistent 2024-07-25 10:41:22 +02:00
d4903b80d4 Updated postman collection 2024-07-25 08:14:36 +02:00
d7de35236c Version bump to 1.4 2024-07-22 10:40:08 +02:00
14569ad7bc Reset values button on times and times terminal dialog boxes to completely undo entries.
Also fixed bug where clear context menu was disabled and wouldn't disappear
2024-07-22 08:51:20 +02:00
9bf84f8baa remove required fields for Times and Times Terminal 2024-07-22 08:22:09 +02:00
31c54f9d8f ETD is always enabled if user is bsmd group (was typo? can't recall) 2024-07-22 07:06:41 +02:00
ad16ae4945 Bugfix: ATA/ATD values do not get changed when already displayed 2024-07-18 07:22:25 +02:00
1a5591cc39 even more small fixes 2024-07-14 15:12:49 +02:00
e30309bca2 fixed more small things and version bump to 1.3.0.3 2024-07-13 19:18:41 +02:00
64977d5819 Small-time fixes to things previously changed and version bump to 1.3.0.2 2024-07-12 16:29:32 +02:00
9d017524ef Added shifting sequence number, storage hidden in flags. This is a prototype. 2024-07-12 09:32:09 +02:00
24138fc1e9 Fixed an error regarding berth display in AGENT/TERMINAL and set to+from berth info for shifting shipcalls 2024-07-11 11:39:12 +02:00
ec0eb3cbfa Switched visibility and position of ETA/ETD in shipcall dialog depending on type 2024-07-11 08:08:33 +02:00
e03c8dc7df User-Filter Settings now on a per-user basis, saved as a dictionary in user space.
This is for the case of people using the same windows account but with several different BC users.
2024-07-10 10:35:40 +02:00
ac8b6ba491 Hide some controls depending on arrival/departure 2024-07-10 09:28:36 +02:00
e3000e1f16 Removed ETA from times dialog if shifting shipcall 2024-07-10 09:05:45 +02:00
208d74f9e3 When creating a new shipcall 'Geeste' is the default time ref point 2024-07-09 11:54:15 +02:00
39020fc5d3 Bugfix: Changed lock times not showing immediately 2024-07-09 10:01:36 +02:00
8f40b82c5d Ship list WIP 2024-07-09 08:10:01 +02:00
b26fff7e17 added product code info for vsproj file 2024-07-02 10:05:45 +02:00
c8c60c0f9b Only user Interval end if interval start is also unset (as suggestion in terminal control) 2024-07-01 13:25:54 +02:00
6f1346c430 Fixed 4 digit time entry 2024-07-01 13:25:16 +02:00
ac21a2fa45 Changed interval date formatting so intervals spanning multiple days show ok 2024-07-01 13:24:05 +02:00
fe46b9b94e Filter shipcalls that have ata set and ata is more than 2 hours in the past 2024-07-01 13:22:29 +02:00
b275320d54 For the interval, the end date is also set in the control 2024-07-01 13:22:17 +02:00
570a227b78 Simplified input text filtering:
If user enters 10 digits, then these are split up for the date
2024-07-01 13:22:04 +02:00
bb956d4792 include last minute for day filter 2024-07-01 13:21:49 +02:00
71a8b44532 fixed bug in search filter where time component wasnt cut of (as expected) 2024-07-01 13:21:28 +02:00
36e853fcda Enter Agency Time as highlighted suggestion for other participants (not terminal) 2024-07-01 13:21:09 +02:00
bc6a9e95ea Removed compiler message 2024-06-24 15:27:09 +02:00
a5753727a7 Added button for automatically selecting the next 24 hours, meaning filling the ETA from/to fields
automatically and triggering the search
2024-06-24 15:21:37 +02:00
69b9e8bcfe Added derived DateTimePicker to use custom keyboard parsing (numbers only) 2024-06-24 14:37:10 +02:00
090fa6cfda Removed some hardcoded text and renamed Lotsen to Flusslotsen 2024-06-24 07:23:34 +02:00
eb62097278 Improved Text input for datetime picker Control 2024-06-23 15:31:55 +02:00
fc63931d6b Added simple windows (MSI) installer für project output 2024-06-22 16:27:59 +02:00
f45fe9178d Added disclaimer and data security file (taken from Word doc) 2024-06-21 15:26:13 +02:00
50e9261267 avoid thread termination by catching exception thrown on failed times GET 2024-05-15 09:48:45 +02:00
97d4fa9faf Bugfix for update deadlock and increased version to 1.2.1.1 2024-05-15 09:48:22 +02:00
c5df95625d reduced retry to single request and reset the error text line 2024-05-13 19:31:59 +02:00
6973ec64fe Fixed wrong Uri reference for devel version 2024-05-13 19:29:47 +02:00
d4fe104984 Added log4net settings to App.config 2024-05-13 19:25:54 +02:00
1bb4cc5225 Increased version to 1.3 2024-05-06 13:45:05 +02:00
ecddc43633 Bugfix mixup enabled/readonly 2024-05-05 11:18:50 +02:00
8698d3a1f5 increased 1 hour comparison by 60 seconds to avoid seconds deviation 2024-05-05 11:18:35 +02:00
f07cadef80 fixed another SQL typo 2024-05-05 11:18:13 +02:00
f7604b055e fixed schedule sql 2024-05-05 11:17:58 +02:00
76bf4f01bd Maximum threshold should still be allowed (e.g. 1 hour) 2024-05-05 11:17:36 +02:00
3b01dbb7aa set schedule logging to INFO and using correct query for schedule test calls 2024-05-02 09:44:00 +02:00
707ffd0d59 Fix for traffic light status 2024-05-02 09:43:35 +02:00
45db6daffe
Merge pull request #29 from puls200/bugfix/fix_20240429
fixing: generator didn't stop after throw()
2024-04-30 06:58:49 +02:00
Max Metz
105718e2a6 fixing: generator didn't stop after throw() 2024-04-29 16:51:41 +02:00
01753540fe
Merge pull request #28 from puls200/bugfix/fix_20240429
adapting validation rules for version 1.2. Rules 0002: the time-diffe…
2024-04-29 13:43:46 +02:00
Max Metz
7f50624d23 adapting validation rules for version 1.2. Rules 0002: the time-difference threshold for 'disagreement' is expanded to 1 hour. There is now element-wise comparison of elements to circumvent instabilities from rounding pd.Timestamp objects. Rules 0001 L&M and 0003: created a feature flag, which skips the evaluation of Terminal times altogether. For version 1.2, this feature flag is enabled. 2024-04-29 12:59:14 +02:00
0fb425d970 Updated with comment from Basti to (temporarily) deaktivate rules for the terminal 2024-04-29 09:59:28 +02:00
7723a595ee Calling dialog for outgoing shipcall async to show incoming call asap 2024-04-25 10:36:43 +02:00
3569360600 Optics adjustment: Scrollbar width, text cutoff with ... and set textareas to readonly but enabled for better viewing 2024-04-25 10:36:29 +02:00
4766584512 Fixed bug where app was accidentally switched to en-us locale by old ENI code 2024-04-25 10:36:13 +02:00
dba5cb3523 added latest rules from current excel document 2024-04-25 09:38:06 +02:00
140f335704 Neue Release Notes 2024-04-25 09:08:27 +02:00
3ec97ccb2c Update Ampelfunktion.md
Neue Beschreibung ergänzt
2024-04-25 09:08:27 +02:00
130f9ff5d4 Update Ampelfunktion.md
Überschriften ergänzt
2024-04-25 09:08:26 +02:00
776efd0399 First draft of traffic light rules converted from Excel to markdown 2024-04-25 09:08:26 +02:00
ef017eee61 Make lock time editable only for port authority and show it in the overview grid 2024-04-23 17:40:21 +02:00
2e3a957947 Added history filter for own shipcalls only, added wait cursor for longer reloading ops 2024-04-23 17:40:05 +02:00
916cbde312 Removed seconds from ATA/ATD display 2024-04-23 17:39:53 +02:00
d54140e397 Fixed a bug where complete shiplist was selectable instead of only non-deleted ships after closing the shiplist editor 2024-04-23 17:39:40 +02:00
82c9b14f73 localized the shipcall type combobox selection 2024-04-23 17:39:25 +02:00
8c7169d291 Fixed bug where ship was not initially shown in overview 2024-04-23 17:39:05 +02:00
378e568124 pimped up the optics of a shipcall cell (a bit) 2024-04-23 17:38:49 +02:00
bac4354ea0 Resized agent controls to not cut off a label 2024-04-23 17:38:35 +02:00
bedf68c4d5 Avoid crash if delete is tried on deleted object 2024-04-23 17:38:13 +02:00
75585153d4 Added a manual refresh button because.. well.. they asked for it 2024-04-13 16:00:56 +02:00
15eb7615a6 Bugfix for creating new shipcalls 2024-04-13 16:00:42 +02:00
f1e392591e Remove old shipcalls if time filter ETA FROM is cleared again 2024-04-13 16:00:27 +02:00
e38a12ee50 Only allow non deleted ships to be selected and safeguard the create ship dialog 2024-04-13 16:00:10 +02:00
921062e38b fix for ship logical delete server-side 2024-04-13 15:59:51 +02:00
8e8f9d6d3e
Merge pull request #26 from puls200/feature/api_validation_rules
Feature/api validation rules
2024-04-10 15:22:27 +02:00
060d131cea Clarified date/time format strings 2024-04-10 15:18:53 +02:00
4e34a536c7 added required fields 2024-04-10 15:18:53 +02:00
6bc57cf31d added missing change 2024-04-10 15:18:53 +02:00
01eb7999f8 Created first draft 2024-04-10 15:18:53 +02:00
2a7cf2119b created an empty document 2024-04-10 15:18:53 +02:00
81416bcc56 setup devel version 1.2.0.3 2024-04-10 15:13:32 +02:00
757bc258fe Set a default value for time range filter minimum 2024-04-10 15:01:01 +02:00
d429c0b01a Improved on history display, showing type and eta/etd.
Also using a link label style to allow to move overview grid by clicking on the element
2024-04-10 15:00:35 +02:00
a9f80b8f86 Make sorting take agency times as more important into account if they are set 2024-04-10 15:00:17 +02:00
cdcba3909e Allow other time ref points only when shipcall is an arrival 2024-04-10 15:00:01 +02:00
7fec9905fd Fixed small issues when creating a new ship 2024-04-10 14:59:41 +02:00
89d9243181 Made all edit dialogs resizable and added scrollviewers to text inputs 2024-04-10 14:59:24 +02:00
08dd104284 fixed POST when a null evaluation enum is sent 2024-04-08 14:00:49 +02:00
40fd77bf6c fixed serialization in case of null values read 2024-04-08 14:00:31 +02:00
553b9131d4 do not show undefined entry in shipcall type combobox 2024-04-08 13:59:47 +02:00
a905f0921d Prevent adding of empty records by checking if required fields have been set 2024-04-08 13:59:30 +02:00
5c5ff21a10 Added Tooltip for fixed order button in edit dialog 2024-04-08 13:59:11 +02:00
f819024706 Added Ampelfunktionen definition document (without version in name) 2024-04-08 10:30:12 +02:00
315cf330b8 Increased dialog width to allow start/end times to be fully seen. Also include end time(!) only in overview (if available) 2024-04-03 19:34:07 +02:00
ced68b504d Expanded all dialogs to include end times for eta, etd and operations 2024-04-03 11:29:07 +02:00
4106b9a0ef For intervals there are now 2 fields in the times object: eta_interval_end and etd_interval_end 2024-04-03 10:39:32 +02:00
3e4ab3660f Fixed window layout positions 2024-04-03 10:12:54 +02:00
cbcbf8937f Testversion erstellt 2024-04-03 07:37:33 +02:00
441bb9a6b7 Fixed ATA / ATD setting for mooring company 2024-04-02 15:31:12 +02:00
d2081e549f update API file 2024-04-02 13:46:04 +02:00
5f7a4ab874 ATA / ATD in Times. In between version with single field 2024-04-02 11:49:03 +02:00
1dfa4e7b5e fixed merge 2024-04-02 11:31:38 +02:00
d42b3753e7 split up ata_atd in two separate fields ata and atd 2024-03-31 21:58:56 +02:00
7894ba0323 Set fixed order in shipcall control by using a tooltip enabled icon with a closed lock 2024-03-31 11:52:36 +02:00
11f72b370d fixed a bug where shipcall id was not set on times delete 2024-03-30 21:41:03 +01:00
d1c3115a8f Idea what to do with lock icon on shipcall control 2024-03-30 21:40:16 +01:00
ac2ad3bc18 fixed bug for POST new shipcalls 2024-03-30 19:48:53 +01:00
b8c0d665af Fixed orders part 1 2024-03-29 19:28:41 +01:00
0ca8e1f916 Added Filter flag (checkbox) to select only shipcalls the users participant is assigned to 2024-03-29 11:05:48 +01:00
32296f7d15 Change history Part 3
Finished layout of history control, reversed sort order (newest on top)
May need to move labels to HistoryDialog
2024-03-29 10:13:23 +01:00
e845c919fd Setup history window, fixed a small bug in the yaml and loaded history entries 2024-03-28 18:09:57 +01:00
54a5b4bb50 Change history Part 1
Here a button was added in the status bar that should eventually open a separate
window with all history information. I also added some tooltips.
2024-03-28 16:36:45 +01:00
7dc37b6fe6 Updated external NuGet packages 2024-03-28 16:35:27 +01:00
5e4ada4389 Added last update label and made progress bar alive 2024-03-28 12:08:23 +01:00
87eaf124d9 Draft is now a required field.
There is now logic in each agent window that checks the required fields if they
change and enable the OK button accordingly
2024-03-28 11:14:32 +01:00
a845135650 Bugfix for saving shipcall values 2024-03-28 09:46:23 +01:00
63baa0c2c2 Display ETA/ETDs with correct timeref labels now 2024-03-28 09:46:02 +01:00
fb3413cac0 Version bump to 1.2.0.0 2024-03-28 08:06:49 +01:00
166d886698 re-created API and fixed some small errors 2024-03-28 08:04:33 +01:00
a5b16154c6 Fixed saving of shipcall by correctly interpreting enums now
The trick was to use a helper-field and a (decorated) @post_load method in the model that allows to fill the helper
fields with the values (ints) instead of strings for enums.
Trouble is: We are parsing strings from API/JSON and want to serialize as int (value in IntEnum). The helper
fields also must be skipped when setting up the query. Pretty convoluted, but gets the jon done (finally).

Also extended the database by new field 'interval_end' which is a preparation to allow not only timestamps but also
intervals when specifying times for participants.
2024-03-27 19:20:54 +01:00
049cdaaf73 Fixed filtering by date interval.
The lamba used to filter out arrivals/Departures was all wrong.
2024-03-27 17:15:49 +01:00
f311d75c73 added ata_atd and time_point_ref fields to database, yaml and python access layer 2024-03-27 10:52:12 +01:00
862ef9fe88 Merge branch 'feature/api_enhancements' into develop 2024-03-27 10:08:48 +01:00
dab7e2c56c ran code generator 2024-03-27 10:06:41 +01:00
63b815c274 fixed enum serialization by using custom optional to_json() method 2024-02-27 07:31:04 +01:00
e88f3fa1de synched enum fields to lower case like yaml 2024-02-26 07:23:09 +01:00
06e9c9b8ae log incoming message 2024-02-24 10:05:43 +01:00
b47c261487 added existence check to dictionary key usage 2024-02-14 16:55:21 +01:00
e8f6a17e7f change parameter order 2024-02-14 16:42:55 +01:00
c6bbbf94e3 do not use execute_scalar 2024-02-14 16:24:06 +01:00
77722703ac added trace output 2024-02-14 16:12:07 +01:00
fc1b55c7b9 added remaining fields to user query 2024-02-14 15:51:12 +01:00
8a6ded2813 fixes for errors reported in server log 2024-02-14 15:41:21 +01:00
898cfdf07d Merged current state of develop 2024-02-14 10:56:35 +01:00
6e114d15e7 Set default shipcall lookup to max 1 day in the past 2024-02-09 12:42:18 +01:00
e5ed4f83b9 Rename fields 2024-02-05 16:55:59 +01:00
b7ac38ca99 startup window size sanity check 2024-02-05 16:35:08 +01:00
59c6efcd7f Merge branch 'bugfix/retry_token' into develop 2024-02-05 16:09:55 +01:00
e3017349b0 added finally statement to close pooledConnection under all circumstances 2024-02-05 09:48:34 +01:00
53fcefd6c9 token refresh - new take 2024-02-05 07:36:14 +01:00
50b7dd8cc5 fix shipcall query to include times eta/etd 2024-02-04 11:20:32 +01:00
92d7bccdd4 fix small binding error 2024-02-04 11:19:34 +01:00
833a71169e fixed deleted ship display in grid 2024-01-15 17:29:19 +01:00
801c4a1383 fixed deleted in ship (was int, is now: bool) 2024-01-15 17:16:22 +01:00
708fa5ce37 fixed naming in query 2024-01-15 17:10:21 +01:00
801800df92 added missing fields in query 2024-01-15 17:04:49 +01:00
a4e51f2483 changed local path 2024-01-15 17:00:19 +01:00
c51264a55d added new fields to evaluation object 2024-01-15 16:25:08 +01:00
722ea94ae0 fixed some bugs in the dialog, but still cannot save a ship 2024-01-15 16:02:27 +01:00
86b2380cb2 fixed some bugs compiles now but not finished 2024-01-14 20:39:27 +01:00
fbd636943e Ship editing pt. 1 (doesn't compile) 2024-01-14 15:40:00 +01:00
f50497b7db added edit button for ships in EditShipcallControl 2024-01-14 13:57:44 +01:00
106247527e Added ship post/put/delete to API 2024-01-14 13:35:35 +01:00
88d6a6a994 added simple comment 2024-01-13 19:09:50 +01:00
c1d8b2e855 fixed notification endpoint to return real data for a shipcall 2024-01-13 19:09:50 +01:00
1ef74b51ba added ship delete and fixed schema loading error for shipclass 2024-01-13 19:09:50 +01:00
dd4ae7def8 fixed error, but enum values are still serialized as int 2024-01-13 19:09:50 +01:00
01dda53425 Tried to create history endpoint but failed. Not working. 2024-01-13 19:09:50 +01:00
a52cc27d69 Fixed SQL and added endpoint for history data 2024-01-13 19:09:50 +01:00
783f9f5089 Added history table 2024-01-13 19:09:50 +01:00
ae9053bcaf Added POST and PUT endpoint for /ship 2024-01-13 19:09:50 +01:00
3ae282102c All database changes in an update script. Devel database is already updated. 2024-01-13 19:09:49 +01:00
23a903997a now the code is compiling. Yaml file documented via description tags. 2024-01-13 19:09:49 +01:00
bd81f01d76 fixed a lot of small problems in yaml file, returned to OpenApi 3.0 format 2024-01-13 19:09:49 +01:00
5459d99098 Improved OpenAPI doc in Stoplight, but still issues with ParticipantType and nullable Types. The client code does not compile. 2024-01-13 19:09:49 +01:00
c6b16c4fa7 Enums, work in progress 2024-01-13 19:09:49 +01:00
c50f82354f Removed spinner from IMO integerUpDown 2024-01-13 19:03:08 +01:00
aba1d9d00b Changed validation rule 002 A-C so that the agency time is set as reference time allowing 15 minute deviation 2024-01-13 19:02:43 +01:00
d8fabe0f97 Fixed time comparison validation func. Now compares min/max value of array. 2024-01-13 19:01:56 +01:00
c24bc981b0 :fixed filtering by berth id, also including outgoing and shifting moves 2024-01-13 18:59:21 +01:00
94fcf75d4c fixes for some idiotic mistakes 2023-12-28 20:08:47 +01:00
c264390ac1 Set max lengh for times and terminal text info fields 2023-12-28 11:29:58 +01:00
29cd8f57bb fixed typo 2023-12-28 11:26:59 +01:00
d488193923 removed bold text 2023-12-28 11:22:56 +01:00
4b17647ca5 Open all dialogs at the same stored position 2023-12-28 11:20:09 +01:00
d601120c5e Add context menu to delete pierside assignments 2023-12-28 11:09:38 +01:00
9463bde64d fixed label 2023-12-28 10:55:52 +01:00
e3834b6ffb adjusted draft input 2023-12-28 10:43:15 +01:00
db2ba28d61 Merge branch 'bugfix/ui_fixes_1.1' into develop 2023-12-26 17:15:13 +01:00
e7e9d79c5d Version bump to 1.1.1 2023-12-26 17:13:10 +01:00
898452a55b Storing window location and size for main window and all six dialogs 2023-12-26 17:05:16 +01:00
dc630e66b6 Mark required fields bold and prevent empty entries 2023-12-26 09:17:52 +01:00
d116c06b9e Enabled combobox ship search by adding helper container class ShipModel 2023-12-26 08:41:54 +01:00
01ab755638 renamed gedreht to port 2023-12-24 16:16:53 +01:00
f9f1fc011d static startup notification text 2023-12-24 12:42:34 +01:00
2651aa6886 fixed typo textBlockAgencyBerthRemarks 2023-12-24 11:33:48 +01:00
b4764e29b6 disable port authority validation logic 2023-12-24 11:20:43 +01:00
cbc77ae157 probably fixed the bug but cannot test because server side is not compatible 2023-12-24 11:08:10 +01:00
ae349b3781 made cancelled row look cancelled 2023-12-23 20:43:46 +01:00
86e6c8caa7 Corrections Pt.1 2023-12-23 18:20:20 +01:00
84a5cc862a Merge branch 'feature/RoleEditor_logical_delete' into develop 2023-12-20 08:09:40 +01:00
scopesorting
187f018e26 gitignore (solved conflict) 2023-12-19 09:51:29 +01:00
scopesorting
191aff720b Implemented the feature to ignore port administration. However, the flag is currently disabled. 2023-12-19 09:51:29 +01:00
scopesorting
e7b7d7e18f correcting 0004A & 0004B 2023-12-19 09:51:29 +01:00
scopesorting
ca8a7ab291 updating rule 0004A&0004B by using a rounding method for time differences. 2023-12-19 09:51:29 +01:00
scopesorting
a29b3ead0e bugfix of 0004A and B, where the tide window may have deviated by few seconds, so the wrong state would be concluded. 2023-12-19 09:51:29 +01:00
3c7268f9f2 new development version 2023-12-18 09:37:20 +01:00
e49b788b3d Added Canceled Checkbox to BSMD dialog box 2023-12-17 17:29:39 +01:00
73e729010d Automatically open a dialog for an outgoing call after an incoming call was created.
The dialog is filled with the defaults of the incoming call, adding two days to ETA to set the ETD.
2023-12-17 17:05:26 +01:00
24757c1702 Version bump 1.0.0 -> 1.1.0 2023-12-17 11:12:52 +01:00
305cc0d3e1 only undeleted berths and ships to select, but display all 2023-12-15 16:58:50 +01:00
scopesorting
99c798bfe0 changing 'exit' with sys.exit to avoid 'NameError' for the exit call 2023-12-15 16:40:51 +01:00
scopesorting
31a5034e17 Solving: RemovedInMarshmallow4Warning: Passing field metadata as keyword arguments is deprecated. Use the explicit argument instead. Additional metadata: {'Required': False} 2023-12-15 16:40:51 +01:00
scopesorting
dfdd4da1d8 correcting minor typos in the documentation and verbosity 2023-12-15 16:40:51 +01:00
scopesorting
2f67e58ace created a feature flag, which disables the PORT_ADMINISTRATION validation rules. Currently, the flag is 'hardcoded' once in the library. Adapting the test to properly facilitate the feature flag
cherry picking all open adjustments to the develop branch.
2023-12-15 16:40:51 +01:00
scopesorting
ad7637368b removing unused if-statements 2023-12-15 16:40:51 +01:00
scopesorting
08ab984096 updating the sql handler's method of filtering for the filled-in header 2023-12-15 16:40:51 +01:00
scopesorting
836c1aa802 fixing the 'KeyError' when using an empty times dataframe. Returning 'green' 2023-12-15 16:40:51 +01:00
scopesorting
6ce6e882e9 more concise evaluation messages for 0001. Adding newlines (works on Windows) when multiple evaluation messages are shown. Properly adding the ShipcallType filters for each rule (whether incoming, outgoing or shifting). Added a regular expression to abbreviate an evaluation message when 512 characters are exceeded.
fixing a version conflict for validation rule functions.
2023-12-15 16:40:51 +01:00
scopesorting
d004e77650 created a feature flag, which disables the PORT_ADMINISTRATION validation rules. Currently, the flag is 'hardcoded' once in the library. Adapting the test to properly facilitate the feature flag
cherry picking the feature flag of 'port administration' rules
2023-12-15 16:40:51 +01:00
378274a176 Logical delete of berths and ships in RoleEditor.
The deleted rows will still be shown however a little grayed out
2023-12-15 16:31:28 +01:00
ba424b18b0 clear controls properly when assignment gets reset in shipcall control 2023-12-14 16:58:53 +01:00
9945cc139b Reset tooltip if evaluation message is empty 2023-12-14 16:09:46 +01:00
f323ae44ff Tab always moves to the next control 2023-12-14 15:46:10 +01:00
dfc09fe833 set maximum for draft to 50 2023-12-14 15:27:27 +01:00
ee071d6b9d Pflichtfelder bei Neuanlage gefixt 2023-12-07 10:49:32 +01:00
08edd7d1d8 add localized message if username/password is wrong 2023-12-07 10:08:08 +01:00
fcbe554248 renamed Gedreht to Anlegeseite 2023-12-07 09:57:31 +01:00
30693700b2 small cleanup yaml 2023-12-07 09:49:01 +01:00
bea2a147d8 Changed search box watermark for better understanding 2023-12-05 09:06:48 +01:00
fe6d1424e5 limit text remark input to 512 characters 2023-12-05 09:06:01 +01:00
faae0cb6f0
Merge pull request #20 from puls200/bugfix/pierside
Merging all Go-Live fixes back into develop
2023-12-01 09:48:27 +02:00
scopesorting
ad593ff2a2 more concise evaluation messages for 0001. Adding newlines (works on Windows) when multiple evaluation messages are shown. Properly adding the ShipcallType filters for each rule (whether incoming, outgoing or shifting). Added a regular expression to abbreviate an evaluation message when 512 characters are exceeded. 2023-12-01 09:44:22 +02:00
scopesorting
fce8ce0c68 changing the ParticipantType to an IntFlag, so multiple roles are possible. Adapting every validation rule (0001, 0003, 0004, 0005), which may be affected by this change. Changing the filter for a participant type to properly include the change. Changing the pier_side rule (0006B), which uses the shipcall and times_terminal. New shipcalls should now be evaluated properly, unless no participant is assigned at all. If the ladder case can occur, the validation rules 0001N+0001O will be added (held back for now). 2023-12-01 09:44:09 +02:00
scopesorting
6f9b4a6b5a removing verbosity in validation rule functions, and returning 'None', when a selected times dataframe is empty. In case of empty results, the function now properly computes the delta towards a query time and returns YELLOW, when a violation is observed. This should finally fix the bugs for 0001 A-M 2023-12-01 09:43:49 +02:00
scopesorting
9a12d74e77 updating validation rules 0001 A-M. Instead of filtering by times_df (which may not exist), the rules make use of the shipcall_participant_map. When one of the participants in a rule is not assigned, no violation is observed. When there are multiple entries of a participant (due to an input bug), the function still verifies properly. When critical time is observed, and there is not yet an entry for the respective key time, there will be a 'yellow' state. 2023-12-01 09:43:31 +02:00
scopesorting
9f61e2af38 updating check_time_delta_violation_query_time_to_now: no longer ignoring events of the past (delta<=0) 2023-12-01 09:43:17 +02:00
scopesorting
4859ff6803 ensuring that len(df_times) always works. Preventing 'None' from occuring 2023-12-01 09:42:48 +02:00
scopesorting
834da84786 minot adjustments & refactoring 2023-11-28 16:49:16 +02:00
scopesorting
8027620f22 fixing the 'KeyError' when using an empty times dataframe. Returning 'green' 2023-11-28 16:48:53 +02:00
c36e913472 added trace output and fixed a bug when saving shipcalls without times 2023-11-28 16:48:16 +02:00
81a45f57cf Catch exception if one occurrs during saving 2023-11-27 17:26:37 +01:00
2b43dc49d9 extended gitignore for local flask 2023-11-27 14:37:23 +01:00
8d63fece15 Version bump to 1.0.0.0 2023-11-25 16:01:03 +01:00
56ade40aef fixed creating new shipcalls and cleaned up logon error message display 2023-11-25 12:15:38 +01:00
5c6d41470c created 0.9.7 version with some minor fixes 2023-11-25 11:39:45 +01:00
721baa3a06 moved schedule import after venv sitepackage path set 2023-11-22 10:48:27 +01:00
66bfd326cc
Merge pull request #18 from puls200/feature/update_shipcalls_routine
Feature/update shipcalls routine
2023-11-22 10:36:34 +01:00
9b5206572a
Merge pull request #16 from puls200/feature/hotfix_20231114
Feature/hotfix 20231114
2023-11-22 10:30:04 +01:00
scopesorting
fd0efe0046 adding schedule routine jobs, which will be executed in a background thread within WSGI while running the Flask application. 2023-11-21 12:47:04 +01:00
scopesorting
9346920a97 potentially solving the 'shipcall_id' error log 2023-11-21 11:51:49 +01:00
scopesorting
3cc1591aba potentially correcting 0006A/0006B 2023-11-21 11:41:56 +01:00
scopesorting
a5220fd6f2 refactoring: simplification of error messages. These now stem from a string, which is the function name. Previously, the inspect module was used with a rather complex function call to obtain the method's name. The simplification makes code more readable for future work. 2023-11-20 16:43:27 +01:00
scopesorting
49bbb77624 refactoring a few methods 2023-11-20 16:35:31 +01:00
scopesorting
40dc022b25 fixing np to_list error, which may have caused the evaluation function to stop altogether. 2023-11-20 16:22:58 +01:00
scopesorting
21e9c75781 typo. 2023-11-14 12:07:59 +01:00
scopesorting
c6d1bf30a6 adapting rules 0001-L & 0001-M (times terminal) and 0006-B. However, for 0006-B the provided solution is not verified, as the errors could not be reproduced locally. 2023-11-14 12:06:39 +01:00
fd5bd76db2
Merge pull request #15 from puls200/feature/hotfix_20231110
Feature/hotfix 20231110
2023-11-10 18:07:12 +01:00
scopesorting
e9aace6268 creating stub objects for every single validation function. Unit tests are created for each function to check whether they return 'GREEN' whenever no violation is expected, or 'YELLOW'/'RED' when a rule violation is artificially forced. The test framework now successfully runs 116 unit tests. Adapted some validation functions, applied refactoring and solved potential obstacles along the way. At least from the perspective of unit tests, every function now works as expected. 2023-11-10 17:59:08 +01:00
scopesorting
b2cde8b6f5 correcting the open issues from 09.11.2023 (0001 A-M was previously commited, 0006A+B are corrected herein) 2023-11-10 17:50:01 +01:00
9d61b95378 Version bump to 0.9.6 2023-11-10 14:36:25 +01:00
09623f1442 bugfixes and small improvements for 0.9.5 test results 2023-11-10 14:13:06 +01:00
scopesorting
d99188dc98 Merge branch 'develop' of github.com:puls200/brecal into dev_recent 2023-11-10 13:39:08 +01:00
f0fa9285af fixed ETA/ETD sorting by taking agency values into account 2023-11-10 11:46:43 +01:00
d439b7ed12 fixed removing of assignments (delete times record), removed green bg color 2023-11-10 11:36:17 +01:00
b7a8b3aa1b Bugfix: switch arrival/departure berth combobox for incoming / outgoing calls (just for display, not logical) 2023-11-08 07:55:21 +01:00
1a0fb6f9ef fixed gitignore file and copy scripts 2023-11-07 09:00:14 +01:00
scopesorting
2374cf4ff0
Feature/removing pandas warning (#14)
* removing the Pandas 'sqlalchemy' warning by refactoring

* removing the Pandas 'sqlalchemy' warning by refactoring.

* reformatting
2023-11-07 07:08:52 +01:00
scopesorting
8606e1fdb6 removing the Pandas 'sqlalchemy' warning by refactoring
removing the Pandas 'sqlalchemy' warning by refactoring.

reformatting
2023-11-04 10:26:43 +01:00
b75ea6891c fixed path in app.config 2023-11-01 17:03:15 +01:00
ead190d219
Merge pull request #11 from puls200/feature/hotfix_20231031_traffic_lights
Validation rule bug fixes as noted in test version 0.9.4
2023-11-01 16:07:38 +01:00
c72f1676aa
Merge pull request #12 from puls200/bugfix/fixes_0.9.4
Bugfix/fixes 0.9.4
2023-11-01 16:01:36 +01:00
44de849430 fixed little bugs, bumped version and set API endpoint to (correct for develop branch) brecaldevel endpoint 2023-11-01 15:53:29 +01:00
a82080b970 Fixed berth display changing between add and update 2023-11-01 11:10:28 +01:00
scopesorting
8e2e676cb0 hotfixing open errors, as defined by Daniel Schick and Christin Hollman (26.10. and 27.10.). Adding descriptions for the error codes instead of using 'cryptic' function names. This should make the application much more readable. 2023-10-31 18:15:59 +01:00
4aa7d65790 updated devel publishing profile 2023-10-31 16:42:51 +01:00
1695ca101e Set development / feature branch to 'devel' settings, added scripts to move to test and to production. Added script to increase version, store version and to update the respective files 2023-10-29 17:56:06 +01:00
f2ecc7ca2e make ETA/ETD the default sort order 2023-10-28 13:02:18 +02:00
b254759562 fixed mixup in enum ids outgoing/shifting for shipcall queries 2023-10-28 12:43:36 +02:00
d24cc67554 Allow saving of user data also if password change info has not been given 2023-10-28 12:07:07 +02:00
6c87142cac added deployment info and fixed production publishing profile 2023-10-27 08:46:29 +02:00
41cae96922 Make user email and phone editable through the role editor 2023-10-26 16:29:24 +02:00
c8e634156b Allow changes of users phone and email contact info by the user 2023-10-26 16:29:17 +02:00
3e63b9ce46 added missing paranthesis 2023-10-26 16:21:26 +02:00
cc284b2612 fixed search query 2023-10-26 16:11:34 +02:00
13c5866884 Fixed eta / etd search error and evaluate searchFromEta as filter used against the back-end to retrieve shipcalls from the past 2023-10-26 15:00:15 +02:00
a763589587 9+10, undo 7 : Berth display when shifting 2023-10-26 14:58:24 +02:00
84ede9a465 8. Changed order of arr/dep. combobox in bsmd control dep -> arr 2023-10-26 09:45:37 +02:00
5f23523a9d 7. Changed layout of agency shifting dialog 2023-10-26 09:41:05 +02:00
213b3e51d9 5.+6.:ETD and correct terminal display for outgoing / shifting calls 2023-10-26 09:35:13 +02:00
e973b6804e 2+4.: Tab order fixed 2023-10-26 09:23:16 +02:00
b30892ada1 1. Controls only editable if current user is the owner of the times data record 2023-10-26 08:19:27 +02:00
4bb73fe80f
Merge pull request #10 from puls200/feature/hotfix_20231025_traffic_lights
Feature/hotfix 20231025 traffic lights
2023-10-25 20:43:04 +02:00
scopesorting
d1f4703102 updating rules 0002 A-C (check_participants_agree_on_estimated_time) and 0004 B (typo in function) 2023-10-25 14:20:24 +02:00
scopesorting
65d31fa2ab Merge branch 'develop' of github.com:puls200/brecal into feature/hotfix_20231025_traffic_lights 2023-10-25 13:22:28 +02:00
a91cf7bdba Version bump to 0.9.3.0 2023-10-22 13:13:42 +02:00
9c690a91b0 Fixes for tests regarding the evaluation functions 2023-10-22 13:08:15 +02:00
scopesorting
1f29aca6d0 correcting an import error for 'evaluate_shipcall_state', updating misc/Deployment to describe the creation of a virtual environment, Python installation and running tests (pytest and pytest-coverage). 2023-10-19 18:32:49 +02:00
scopesorting
cdb7877461 Adding validation rules (traffic light status) to the system. Post & Put calls of shipcalls and times now execute the traffic light evaluation and store the result in the connected MySQL database instance. The 'brecal_utils' library is merged with 'BreCal', including the stub objects and test functions. Requirements were adapted, and installation of a virtual environment works from scratch (on a linux system). 2023-10-19 18:32:49 +02:00
scopesorting
e4cb2eb639 correcting an import error for 'evaluate_shipcall_state', updating misc/Deployment to describe the creation of a virtual environment, Python installation and running tests (pytest and pytest-coverage). 2023-10-19 13:26:19 +02:00
9f7dd4f55c corrected header centering 2023-10-18 19:02:55 +02:00
8ba1d351b7 Version bump to 0.9.2.0 2023-10-18 18:49:45 +02:00
5f0712c799 Added some styles for evaluation result and tried to solve sync problems 2023-10-18 18:48:47 +02:00
961a2a7666 Version bump to 0.9.1.0 2023-10-18 08:54:48 +02:00
9087d68025 Fixed participant type evaluation for Times edit control 2023-10-18 08:15:38 +02:00
scopesorting
25db0cf44f Adding validation rules (traffic light status) to the system. Post & Put calls of shipcalls and times now execute the traffic light evaluation and store the result in the connected MySQL database instance. The 'brecal_utils' library is merged with 'BreCal', including the stub objects and test functions. Requirements were adapted, and installation of a virtual environment works from scratch (on a linux system). 2023-10-17 09:09:35 +02:00
scopesorting
e2a5f2e0d6
Merge pull request #8 from puls200/feature/fixes_0.9
Feature/fixes 0.9
2023-10-17 07:27:47 +02:00
3044ca2621 add missing include 2023-10-16 18:47:22 +02:00
26b71052ae add missing key 2023-10-16 18:43:48 +02:00
2857c8693a fixes 2023-10-16 17:46:30 +02:00
da0287ae6e fixes 2023-10-16 17:42:45 +02:00
e5e262fd4f improve connection handling on startup 2023-10-16 17:31:57 +02:00
6597c46a9d removed connection data file 2023-10-16 15:36:38 +02:00
fe53c85447 made simple path change and added documentation pt 1 2023-10-16 15:34:18 +02:00
0b5063a9bc Version bump to 0.9.0.0 2023-10-16 11:07:18 +02:00
1e9636c47c Bugfix: avoid clearing of all assigned participants (they are *not* set in this dialog!(any more)) 2023-10-16 11:07:18 +02:00
35f0f8b204 fixed wrong label 2023-10-16 11:07:18 +02:00
2440424312 set enabled flags in times and terminal edit controls 2023-10-16 11:07:18 +02:00
6079d1dc51 bugfix create new: eta is not required any more 2023-10-16 11:07:18 +02:00
2d8a895e9f bugfix enable controls correctly on dialog load 2023-10-16 11:07:18 +02:00
5ed0a08ca2
Merge pull request #5 from puls200/feature/fixes_0.7
Feature/fixes 0.7
2023-10-12 07:02:20 +02:00
02705f2677 allow read-only views of not-assigned participants of any data 2023-10-10 11:50:43 +02:00
ebfa7c1fc7 fixed participant combobox display 2023-10-10 10:19:24 +02:00
d36517f63b merged participant type for assignment side quest 2023-10-09 18:02:02 +02:00
c1a2f78a14 saving is possible (again), fixed the nested parameter 2023-10-09 17:37:44 +02:00
dc30fe9c53 added type flag to participant assignment for ship call pt. 1 2023-10-07 14:18:00 +02:00
b926f413dc more fixes to grid view 2023-10-07 14:16:38 +02:00
8ceeaf82a5 Darstellung im Grid verbessert 2023-10-07 14:16:38 +02:00
36b1711189 kein 3-state Checkboxen mehr in den Agentur-Dialgoen 2023-10-07 14:16:38 +02:00
eb51074328 Fixed issues when editing the shipcall as BSMD 2023-10-07 14:16:38 +02:00
da8ef2f113 bugfix 2023-10-07 14:16:38 +02:00
f51e3fe13a version bump to 0.8 2023-10-07 14:16:38 +02:00
c282f5d5e0
Merge pull request #4 from puls200/feature/authority_id_for_berths
Feature/authority id for berths
2023-10-07 14:07:48 +02:00
d807b95020 Extension of role editor to allow authority entry for berths 2023-10-06 16:13:09 +02:00
bf54b0e9d8 database extension 2023-10-06 16:13:05 +02:00
scopesorting
f54ecadeb1
Merge pull request #3 from puls200/feature/update_sql_schemas
sample_data.sql
2023-10-06 15:24:20 +02:00
max_metz
22091fa7db updating 'sample_data': adding some null values for shipcalls & times, so the 'insert into' call matches the updated schema 2023-10-06 08:44:56 +02:00
a8296d3bbc
Merge pull request #2 from puls200/feature/fixes_0.6
Feature/fixes 0.6
2023-10-04 11:34:12 +02:00
a267ddc682 version bump 0.7 2023-10-04 11:17:58 +02:00
97adf65c0c Fixed all sorts of small bugs, should be working now 2023-10-04 10:38:08 +02:00
7d5887b29d Korrektur fürs Passwort ändern 2023-10-04 07:34:18 +02:00
0936e30d00 WIP 2023-10-04 07:34:17 +02:00
8b3abec280 Edit dialogs agent WIP Pt. 2 2023-10-04 07:34:17 +02:00
92a504b668 Edit dialogs agent WIP 2023-10-04 07:34:16 +02:00
e7680afcd4 Layout agency times controls 2023-10-04 07:34:16 +02:00
5a8dae602e Agentur Times Dialog ausgehend Screendesign 2023-10-04 07:34:16 +02:00
aca7908d4c Überarbeitung Dialog Anlaufbearbeitung Pt.1 2023-10-04 07:34:15 +02:00
31ddcbb336 When applying the search filter use also the ships name in the free text input 2023-10-04 07:34:15 +02:00
2f0ca85c19 fixed saving of new shipcalls, reversed logic of cancelled ship filter 2023-10-04 07:34:15 +02:00
6872df4278 Increased token timeout to 2 hours, introduced a background task to refresh token at about 70 min interval 2023-10-04 07:34:14 +02:00
215d419180 added Id return object to POST of times and shipcall 2023-09-29 14:44:53 +02:00
916beedbb8 added evaluation and evaluation_message to shipcall (für die Ampel) 2023-09-29 14:22:04 +02:00
197048aa8b
Merge pull request #1 from puls200/feature/win_client_changes_sprint_1
Feature/win client changes sprint 1
2023-09-21 09:45:40 +02:00
ba29a8217e Add comment if BSMD is allowed to edit agents data fields (at the bottom of the edit window) 2023-09-21 09:36:35 +02:00
110ff5ccce EXTENDED TIMES TO DIFFERENTIATE BETWEEN PARTICIPANT TYPES
Participants can be of multiple types (e.g. agent and terminal), therefore the participant
type must be stored in the times data record in order to assign times correctly during
display and to differentiate in calculation.
2023-09-21 08:23:19 +02:00
df641f096c added terminal times control 2023-09-18 20:36:44 +02:00
370270eaf3 added ad readme for the role editor 2023-09-18 14:57:29 +02:00
e7614a085c Merge branch 'feature/win_client_changes_sprint_1' of ssh://lager/mnt/ext/git/git_brcal into feature/win_client_changes_sprint_1 2023-09-18 14:56:49 +02:00
cb742fb17c working on times edit control for terminal 2023-09-18 14:55:56 +02:00
13722f039c Save and restore of filter criteria (user-context) 2023-09-15 17:05:07 +02:00
47884fde7d changed key path to a relative path that works on both installations 2023-09-15 08:12:44 +02:00
d74f943994 Fixed test client setup as a separate setup.
Please see ReadMe.md in the BreCalClient folder for details.
2023-09-13 07:09:52 +02:00
7660ee72f2 Added filtering and sorting to shipcalls in the list.
While doing so, I have also refactored the shipcall processing logic in the main window.
All changes now go through the filter and sorting stage before all controls are removed
and only the controls matching to the sorted list are added to the stack panel.
2023-09-12 16:48:28 +02:00
90338f9e95 test profile is now installing but overwriting the productive profile 2023-09-11 06:48:18 +02:00
f200673023 If an agency allows BSMD entries, then the flag is set and the dialog controls are enabled 2023-09-06 09:04:30 +02:00
4093c2eb21 Moved connection string to config file 2023-09-06 08:39:46 +02:00
89ecb33ffe added signing to test publish profile 2023-09-06 07:06:45 +02:00
29a214c5f4 change settings to test version 2023-09-05 17:15:59 +02:00
89a6a4f726 extended times and use flags on participant, added code to have a test version of the client 2023-09-05 16:38:40 +02:00
05462e6332 changed arrow colors, enabled controls on edit control if participant is agency or bsmd 2023-09-04 13:07:19 +02:00
4abd5025f5 add confirmation dialog if password was changed successfully 2023-09-04 12:28:58 +02:00
c3f16f4b20 Fixed adding and removing assignments of participants and berths 2023-09-04 12:12:07 +02:00
cab09c594f Added ability to remove participant assignments in edit dialog 2023-09-04 08:39:12 +02:00
87e23b8150 updated Datenmodell xlsx 2023-08-31 14:34:14 +02:00
6acc47d158 Merge branch 'feature/import_ships' into develop 2023-08-31 13:52:44 +02:00
e9731add80 Updated user stories (Vers. 3, after user meeting at the end of August '23) 2023-08-31 13:49:39 +02:00
5539fc0fb4 added presentation ppt for user meeting on aug 28, 23 in Bremen 2023-08-29 18:41:32 +02:00
6a37bba97a fixed output 2023-08-24 14:11:11 +02:00
9ead1274bb added functionality to import ships by excel sheet 2023-08-24 10:48:44 +02:00
7feeed76da adding simple ppt for presentation 2023-08-24 09:05:04 +02:00
ef07764915 upped the UI some 2023-08-24 07:50:12 +02:00
f5b79d5d63 work in progress.. 2023-08-23 17:12:41 +02:00
f255b16ff4 Work in progress, edit dialog completed, saving new elements works 2023-08-23 09:38:44 +02:00
8fbb199aaa added times controlling but no functions 2023-08-21 19:11:23 +02:00
ee5420ff5b Save and display a new shipcall 2023-08-21 16:20:12 +02:00
95fab27229 Edit and save a shipcall 2023-08-21 15:34:09 +02:00
beb9d75a90 Excel Import berth in RoleEditor Tool 2023-08-21 08:26:32 +02:00
8939339d09 created publish version 2023-08-18 16:17:32 +02:00
ba170c9320 first steps excel import berths 2023-08-18 16:09:13 +02:00
411ea8135e Changing Password is functional through API and Client 2023-08-18 15:29:20 +02:00
083ea69961 Many little details in the client, added password change dialog 2023-08-18 09:48:37 +02:00
37827767ef Layout Shipcall editing dialog 2023-08-17 13:24:25 +02:00
65ffea1b8c Show arrows for shipcall types 2023-08-17 11:06:34 +02:00
3d7906a9f2 Synchronizing data structures including the latest changes in Excel spec
Database
API (yaml)
Flask
2023-08-17 10:05:48 +02:00
542b495d95 fixed yaml and added additional input fields 2023-08-16 16:06:15 +02:00
3af6e77d30 Select participants on edit shipcall control 2023-08-16 12:16:08 +02:00
cf5498d049 Shipcalls now showing participant relevant info in correct columns 2023-08-15 09:04:57 +02:00
84462aead4 work on shipcall control 2023-08-14 16:00:34 +02:00
7655ebe724 put and post for participants of shipcall 2023-08-14 09:15:36 +02:00
dbf2ec3c5d saving participant entries, wip 2023-08-13 12:18:49 +02:00
794cd8efaf added shipcall participant list to API GET call 2023-08-11 15:07:42 +02:00
c08ba046c9 fixed Windows tool passwort hash creation 2023-08-11 11:17:08 +02:00
6e764aa043 Added flag-type editing to participant type, allowing participant to include several types 2023-08-10 08:49:17 +02:00
383f6a38c7 Client very WIP und Fehlerkorrektur API 2023-08-08 07:43:47 +02:00
6b93f0ac3f Type für Participant, Content-Type in responses korrigiert 2023-08-07 12:19:20 +02:00
d44dbcc437 Mockup der Suche, Lokalisierung hinzugefügt (statisch via Resources) 2023-08-04 11:13:55 +02:00
9a735898ba Herunterklappbares Shipcall Control, angefangen 2023-08-04 08:33:01 +02:00
7d862ae756 added info from Christin regarding customer meeting 2023-08-03 18:59:15 +02:00
8528527aa7 misc 2023-07-31 14:48:28 +02:00
9fb3e9e751 added some useful icons and event actions for shipcall control 2023-07-28 08:21:32 +02:00
3148ed32b1 Shipcall list now working with traffic light on bound property, data from server 2023-07-27 12:55:39 +02:00
8a9e3884fe Closing pooled connections 2023-07-27 09:58:06 +02:00
12f36c5113 Fixed Token transmission to server, loading of berth and ship lists ok! 2023-07-14 16:03:45 +02:00
6d4c36d07b Client work in Progress.. 2023-07-13 21:32:28 +02:00
6d4392c1bc fixed error result values in python api 2023-07-13 10:07:23 +02:00
504131c239 Added ENI style login screen 2023-07-13 09:43:08 +02:00
5ca3c7a050 fixed client so it can login now to the public api 2023-07-11 18:11:19 +02:00
b7f6996489 Renamed API yaml file
linked (instead of copied it) to client project and
recreated the cs class
2023-07-11 17:39:24 +02:00
c02e51c427 added sample client with sample autogenerated client code
as per Visual Studio Extension
2023-07-11 17:17:27 +02:00
161553a84f updated yaml file 2023-07-11 17:15:49 +02:00
5544d0126d fixed complete participant download and removed all TODOs regarding
token verifikation. Also removed the /verify call since it is now covered by /login.
2023-07-11 15:46:17 +02:00
0eb6fd7a20 adjusted launch script 2023-06-29 08:08:40 +02:00
6fa5010dae Updated postman collection 2023-06-27 11:34:43 +02:00
d2c84f8d68 A lot of small errors fixed on deployment, some things work different with mysql and MariaDB 2023-06-27 11:32:50 +02:00
3f211919af added JWT Authentication (expiring bearer token) 2023-06-26 08:38:45 +02:00
b9d35b9244 added a user login 2023-06-23 15:20:26 +02:00
15cc4bf8da API up and running.
There are still open issues but in principle, it is working
2023-06-22 10:56:13 +02:00
20f38fff91 POST zum Laufen gebracht.. RTFM! :-) 2023-06-20 07:44:27 +02:00
d0a77b3f0f die meisten GET calls sind drin, 2 funktionieren noch nicht 2023-06-19 16:04:02 +02:00
a40df31f9d Updated models for current API 2023-06-19 11:14:44 +02:00
a0b0462302 fixed participant loading 2023-06-19 10:23:40 +02:00
f6f2f73d01 some work on returning berths (ok) and participants (so far not ok) 2023-06-16 14:11:02 +02:00
fdeacdca6e Datenmodell neu, Verbindungsdaten Flask aus einer Datei laden 2023-06-16 12:25:53 +02:00
31b52038b2 editing berths and ships Pt.2 (done) 2023-04-28 15:17:58 +02:00
4e9151f8c8 editing berths and ships Pt. 1 2023-04-27 14:24:03 +02:00
0ca62d7e80 synchronized database create and dump script, including instructions 2023-04-27 09:39:29 +02:00
9a8c16ad79 Merge branch 'feature/role_editor' into develop 2023-04-23 12:51:23 +02:00
7ea16692cc role/securable editor more or less functional 2023-04-22 19:32:54 +02:00
fd0497fee4 role / securable mappings 2023-04-21 11:57:04 +02:00
a4737b8b1f started on user role assignments 2023-04-17 08:25:48 +02:00
c9aa439712 saving securables, more logic 2023-04-17 07:49:27 +02:00
66b2691c41 some more UI logic 2023-04-16 16:58:32 +02:00
a86b02d541 Implemented user create and update 2023-04-16 16:32:25 +02:00
a01b88e0c9 Loading of participant and user functional 2023-04-16 12:59:13 +02:00
bbb986260c Speicher-Logik erweitern 2023-04-15 18:58:24 +02:00
6a37f1ef4f Datenmodell aktualisiert 2023-04-13 07:44:56 +02:00
11f6e47a91 added docs by Christin 2023-04-13 07:43:48 +02:00
aa0c1d81d9 added models and a database controller 2023-04-12 12:08:40 +02:00
d68e92a464 added icons and menu items 2023-04-12 07:47:33 +02:00
ae232ae686 UI Role and Securables 2023-04-10 14:43:31 +02:00
485c75f06c Role-Editor: UI for Participant and User 2023-04-10 10:42:20 +02:00
316 changed files with 45664 additions and 1269 deletions

483
.gitignore vendored
View File

@ -1,44 +1,3 @@
Skip to content
Pull requests
Issues
Codespaces
Marketplace
Explore
@danielschick
github /
gitignore
Public
Fork your own copy of github/gitignore
Code
Pull requests 371
Actions
Security
Insights
Beta Try the new code view
gitignore/VisualStudio.gitignore
@n0099
n0099 [VisualStudio.gitignore] remove a trailing space
Latest commit 491040e Jan 26, 2022
History
165 contributors
@shiftkey
@arcresu
@aroben
@bbodenmiller
@HassanHashemi
@haacked
@niik
@AArnott
@sayedihashimi
@saschanaz
@bdougie
@OsirisTerje
398 lines (319 sloc) 6.7 KB
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
@ -75,40 +34,11 @@ bld/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
@ -139,20 +69,6 @@ StyleCopReport.xml
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
@ -162,108 +78,9 @@ ipch/
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
@ -279,158 +96,196 @@ ClientBin/
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
.vscode/
#!.vscode/settings.json
#!.vscode/tasks.json
#!.vscode/launch.json
#!.vscode/extensions.json
#*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
src/notebooks_metz/
src/server/editable_requirements.txt

12
.vscode/launch.json vendored
View File

@ -5,18 +5,20 @@
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "src/server/BreCal",
"FLASK_DEBUG": "1"
"FLASK_DEBUG": "1",
"SECRET_KEY" : "zdiTz8P3jXOc7jztIQAoelK4zztyuCpJ", // https://randomkeygen.com/
"FLASK_RUN_PORT": "5000"
},
"args": [
"run" //,
// "--no-debugger",
//"--no-reload"
"run",
// "--no-debugger",
"--no-reload"
],
"jinja": true,
"justMyCode": true

View File

@ -19,7 +19,5 @@ Ein erster Gedanke des Datenbank-Layouts sieht folgendermaßen aus:
### Postman
Zum Debuggen der Flask App verwende ich dieses Tutorial:
https://code.visualstudio.com/docs/python/tutorial-flask#_create-a-project-environment-for-the-flask-tutorial
https://code.visualstudio.com/docs/python/tutorial-flask#_create-a-project-environment-for-the-flask-tutorial

237
docs/ApiValidationRules.md Normal file
View File

@ -0,0 +1,237 @@
# Rest-API validation rules for the backend
___
* Rules defined here only apply to calls that change data (POST / PUT /DELETE requests)
* Violation of these rules should result in 400 bad request
* These are not high-level rules that change color of a data entry in the app
## Change history
|Date|Edit|Author|
|--|--|--|
| 2.2.24 | Document created, first draft | Daniel Schick |
| 25.7.24 | Update for BC 1.4 and other changes | Daniel Schick |
## Global constants and definitions
### Participant type
The participant type is a bit flag that encodes which user groups a participant belongs to. Note: A participant may belong to **multiple** groups so this flag has to be bitwise evaluated.
|Value|Group|
|-----|-----|
| 1 | BSMD |
| 2 | Terminal |
| 4 | Pilot |
| 8 | Agency |
| 16 | Mooring |
| 32 | Port authority |
| 64 | Tug |
### Participant flag
The participant data record contains a field called "flag" which is also bitwise encoded. The purpose of this flag is to allow user authorization on a finer level. Currently the following flag(s) are defined:
| Value | Significance |
| ------|--------------|
| 1 | If this flag is set on a shipcall record with participant type Agency (8), all participants of type BSMD (1) may edit the record.
### Shipcall type
The shipcall type which is set in the shipcall record may have the following values
| Value | Meaning |
|-------|---------|
| 1 | Incoming |
| 2 | Outgoing |
| 3 | Shifting (changing berths) |
## All queries
### Token evaluation
The identity of the caller can be retrieved from the token. This contains an id (="user id") and more importantly, the "participant_id". Every call is only allow if the user is properly authorized to perform the call or modify the dataset.
At this time, authorization is performed on a participant level. This means that all users that belong to a particular participant have the same rights.
### Modifying unknown entities
PUT / DELETE calls referencing entities that are not found in the database will receive an 404 reply. This is already implemented in the underlying code and therefore not mentioned in this document. This evaluation should precede the API validation so in this document we assume the entities are existing.
### Return value
If a validation rule fails the call should return 400 (Bad request) including an error message in the following format:
```json
{
"error_field" : "A reference to the respective field(s) which have caused the error",
"error_description" : "Reason why this call failed"
}
```
### Time values
Date and date+time values are specified as text formatted in [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339#section-5.6), e.g.
```json
{
"created" : "2024-01-27T18:00:21Z"
}
```
Usually the "Z" is missing at the end indicating local time.
Generally, times may not be updated to a value in the past. There are exception (see SHIPCALL PUT below).
Times should also not be set to a value more than 1 year in the future. The reasoning is to prevent shipcalls to stick to the top of the list by implausible (or for the workings of Bremen calling irrelevant) values too far in the future.
## /shipcall POST
1. The call may only be performed by a user belonging to participant group type BSMD.
2. Reference checking: The dataset includes multiple fields referring other tables. The validation must make sure the referenced entities exist. This includes the following fields:
| Field | Referenced table | Notes |
|-------|------------------| ----- |
| ship_id | ship | |
| arrival_berth_id | berth | required if type is "arrival" (1) |
| departure_berth_id | berth | required if type is "departure" or "shifting" (2 or 3) |
| participants | participant | This is a list containing participant_id and type pairs with the following rules: 1. participant_id values may appear more once 2. types may only appear once, therefore there are a maximum of 7 elements in this list. |
3. Check for reasonable values for the following fields:
| Field | Validation |
|-------|------------|
| eta | value must be in the future |
| type | value must be one of the values defined above |
| voyage | if set must be <= 16 chars and no special characters |
| etd | must be in the future |
| flags | must be a combination of the flags defined above |
| draft | 0 <= value <= 20 |
| tidal_window_from | value must be in the future |
| tidal_window_to | value must be in the future, value must be > tidal_window_from |
| recommended_tugs | 0 < value < 10 |
| canceled | optional on POST |
| evaluation | may not be set |
| evaluation_message | may not be set |
| created / modified | may not be set |
#### Required fields
* eta / etd (depending on value of type: 1: eta, 2: etd, 3: etd)
* type
* ship_id
* arrival_berth_id / departure_berth_id (depending on type, see above)
* assigned participant for agency
## /shipcall PUT
1. The call may only be performed by a user belonging to participant group type BSMD.
2. If a agency is selected via the shipcall_participant_map entry, users of this agency may also edit the shipcall. Care has to be taken: The agency must have been set _before_ a member of the group may edit the record.
In other words: no setting the agency and editing the record by a member of the agency within the same call.
3. See value rules in /shipcall POST.
Exceptions:
a) Canceled may be set but only if not already set.
b) ETA/ETD may be in the past. This can happen if an agency has entered an ETA/ETD (times) in the future but
wants to edit fields of the shipcall record (e.g. the draft) but the shipcall was originally created with an ETA/ETD in the past
4. A cancelled shipcall may not be changed (is logical delete)
#### Required fields
The id field is required, missing fields will not be updated.
## /times POST
1. A new dataset may only be created by a user _not_ belonging to participant group BSMD.
2. A new dataset may only be created if a dataset of this type is not already present for the participant type.
3. A new dataset may only be created if the user belongs to the participant group assigned to the shipcall with the appropriate type (see shipcall_participant_map). This actually trumps rule #1 but may return a different error message.
4. Reference checking: The dataset includes multiple fields referring other tables. The validation must make sure the referenced entities exist. This includes the following fields:
| Field | Referenced table |
|-------|------------------|
| shipcall_id | shipcall |
| participant_id | participant |
| berth_id | berth |
5. Check for reasonable values for the following fields:
| Field | Validation |
|-------|------------|
| eta_berth, etd_berth, lock_time, zone_entry, operations_start, operations_end | if set these values must be in the future|
| eta_interval_end, etd_interval_end | if set these values must be in the future. They must be larger than their ETA/ETD counterparts. |
| remarks, berth_info | must be <= 512 chars |
| participant_type | must not be BSMD |
#### Required fields
This depends on the shipcall and participant type:
##### Incoming
AGENCY, PILOT, PORT_AUTHORITY, MOORING, TUG:
shipcall_id, participant_id, participant_type
TERMINAL:
shipcall_id, participant_id, participant_type
##### Outgoing
AGENCY, PILOT, PORT_AUTHORITY, MOORING, TUG:
shipcall_id, participant_id, participant_type
TERMINAL:
shipcall_id, participant_id, participant_type
##### Shifting
AGENCY, PILOT, PORT_AUTHORITY, MOORING, TUG:
shipcall_id, participant_id, participant_type
TERMINAL:
shipcall_id, participant_id, participant_type
## /times PUT
1. A dataset may only be changed by a user belonging to the same participant as the times dataset is referring to.
2. See reference and value checking as specified in /times POST.
3. The shipcall type may not be changed.
#### Required fields
The id field is required, missing fields will not be updated
## /times DELETE
1. A dataset may only be changed by a user belonging to the same participant as the times dataset is referring to.
2. The dataset may not be deleted already.
## /ship POST
1. The call may only be performed by a user belonging to participant group type BSMD.
2. A ship may only be added if there is no other ship with the same IMO number already present in the database.
3. Check for reasonable values for the following fields:
| Field | Validation |
|-------|------------|
| name | Length < 64, no special characters |
| IMO | 7-digit number. See [here](https://de.wikipedia.org/wiki/IMO-Nummer) for clarification. |
| callsign | Length <= 8, no special characters |
| Length | 0 < value < 1000 |
| Width | 0 < value < 100 |
| bollard_pull | 0 < value < 500, only allowed if is_tug = 1 |
## /ship PUT
1. The call may only be performed by a user belonging to participant group type BSMD.
2. The IMO number field may not be changed since it serves the purpose of a primary (matching) key.
3. See value rules in /ship POST
4. The id field is required, missing fields will not be updated
## /ship DELETE
1. The call may only be performed by a user belonging to participant group type BSMD.
2. The dataset may not be deleted already.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/UserStories.xlsx Normal file

Binary file not shown.

BIN
docs/Usertreffen.pptx Normal file

Binary file not shown.

46
misc/Ampelfunktion.md Normal file
View File

@ -0,0 +1,46 @@
<img style="float: right;" src="logo_bremen_calling.png" />
# Ampelfunktion Bremen Calling
## Einleitung
## Regeln
[Zurück](../README.md)
___
| Ampelfunktionen | Beschreibung | Definition | Bemerkungen |
|-----------------|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| | | | |
| 0001 | Nicht alle Zeiten sind zugeordnet | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur, Festmacher usw.)<br/> - Zugeordnete Zeit ist leer | |
| 0001 - A | Agentur / einkommend | times_agency:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>___zum Zeitpunkt 20 Std vor___<br/> shipcall:<br/> - eta | gelb |
| 0001 - B | Agentur / ausgehend + Verholung | times_agency:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 20 Std vor___<br/> shipcall:<br/> - etd | gelb |
| 0001 - C | Festmacher / einkommend | times_mooring:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETA Berth | gelb |
| 0001 - D | Festmacher / ausgehend + Verholung | times_mooring:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb |
| 0001 - F | Hafenamt / einkommend | times_portauthority:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETA Berth | gelb |
| 0001 - G | Hafenamt / ausgehend + Verholung | times_portauthority:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb |
| 0001 - H | Lotsen / einkommend | times_pilot:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>______<br/> times_agency:<br/> - ETA Berth < 16 Stunden entfernt | gelb |
| 0001 - I | Lotsen / ausgehend + Verholung | times_pilot:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>______<br/> times_agency:<br/> - ETD Berth < 16 Stunden entfernt | gelb |
| 0001 - J | Schlepper / einkommend | times_tug:<br/> - participant_id = ausgefüllt<br/> - ETA Berth = leer<br/>______<br/> times_agency:<br/> - ETA Berth < 16 Stunden entfernt | gelb |
| 0001 - K | Schlepper / ausgehend + Verholung | times_tug:<br/> - participant_id = ausgefüllt<br/> - ETD Berth = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb |
| 0001 - L | Terminal / einkommend | times_terminal:<br/> - participant_id = ausgefüllt<br/> - Operation Start = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETA Berth | gelb, aktuell __deaktiviert__! |
| 0001 - M | Terminal / ausgehend + Verholung | times_terminal:<br/> - participant_id = ausgefüllt<br/> - Operation Ende = leer<br/>___zum Zeitpunkt 16 Std vor___<br/> times_agency:<br/> - ETD Berth | gelb, aktuell __deaktiviert__! |
| 0002 | Zeiten für einen Eintrag weichen voneinander ab | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur, Festmacher usw. - außer BSMD-Spalte)<br/> - Zeiten ungleich (leere Einträge nicht berücksichtigen => 0001) | |
| 0002 - A | Agentur + Festmacher + Hafenamt + Lotsen + Schlepper / einkommend | Schnittmenge aus:<br/>times_agency:<br/> - ETA Berth <br/>____und____<br/>times_mooring:<br/> - ETA Berth <br/>____und____<br/>times_portauthority:<br/>- ETA Berth <br/>____und____<br/>times_pilot:<br/> - ETA Berth <br/>____und____<br/>times_tug:<br/> - ETA Berth | rot |
| 0002 - B | Agentur + Festmacher + Hafenamt + Lotsen + Schlepper / ausgehend | Schnittmenge aus:<br/>times_agency:<br/> - ETD Berth <br/>____und____<br/>times_mooring:<br/> - ETD Berth <br/>____und____<br/>times_portauthority:<br/>- ETD Berth <br/>____und____<br/>times_pilot:<br/> - ETD Berth <br/>____und____<br/>times_tug:<br/> - ETD Berth | rot |
| 0002 - C | Agentur + Festmacher + Hafenamt + Lotsen + Schlepper / Verholung | Schnittmenge aus:<br/>times_agency:<br/> - ETD Berth <br/>____und____<br/>times_mooring:<br/> - ETD Berth <br/>____und____<br/>times_portauthority:<br/>- ETD Berth <br/>____und____<br/>times_pilot:<br/> - ETD Berth <br/>____und____<br/>times_tug:<br/> - ETD Berth | rot |
| 0003 | Arbeitszeit überschneidet sich mit Fahrtzeit | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Terminal)<br/> - Zeiten passt nicht zu Ankunft / Abfahrt (leere Einträge nicht berücksichtigen => 0001) | |
| 0003 - A | Terminal / einkommend | times_terminal:<br/> - Operation Start<br/>___vor (kleiner als)____<br/> times_agency:<br/> - ETA Berth | rot, aktuell __deaktiviert__! |
| 0003 - B | Terminal / ausgehend + Verholung | times_terminal:<br/> - Operation Ende<br/>___nach (größer als)____<br/> times_agency:<br/> - ETD Berth | rot, aktuell __deaktiviert__! |
| 0004 | Tidezeiten passen nicht zu Fahrzeiten | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur)<br/> - Tidezeit ausgefüllt | |
| 0004 - A | Agentur / einkommend | times_agency:<br/> - ETA Berth <br/>___vor (kleiner als)____<br/> times_agency:<br/> - Tidefenster von <br/>___und/oder___nach (größer als)____<br/> times_agency:<br/> - Tidefenster bis | rot |
| 0004 - B | Agentur / ausgehend + Verholung | times_agency:<br/> - ETD Berth <br/>___vor (kleiner als)____<br/> times_agency:<br/> - Tidefenster von <br/>___und/oder___nach (größer als)____<br/> times_agency:<br/> - Tidefenster bis | rot |
| 0005 | Zu viele Schiffe mit gleicher Fahrtzeit | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur)<br/>- Übergreifend über die Einträge | |
| 0005 - A | Agentur / einkommend + ausgehend + Verholung | ____Zählen wenn gleich:____<br/> times_agency:<br/> - ETA Berth <br/>___und____<br/> times_agency:<br/> - ETD Berth<br/>___mehr als 3____<br/> | gelb |
| 0006 | Agentur und Terminal planen mit unterschiedlichen Liegeplätzen | Bedingungen:<br/> - Header der Zeile ist zugeordnet (Agentur / Terminal)<br/>- LP jeweils ausgefüllt | |
| 0006 - A | Agentur + Terminal (Liegeplatz) / einkommend + ausgehend + Verholung | times_agency:<br/> - Liegeplatz<br/>____ungleich____<br/>times_terminal:<br/> - Liegeplatz | gelb |
| 0006 - B | Agentur + Terminal (Anlegeseite) / einkommend + ausgehend + Verholung | times_agency:<br/> - Anlegeseite<br/>____ungleich____<br/>times_terminal:<br/> - Anlegeseite | gelb |

View File

@ -0,0 +1,585 @@
{
"info": {
"_postman_id": "9242b2d1-196b-4b2e-af57-c0e9eb141dba",
"name": "BreCal",
"description": "Bremen Calling relevant API calls",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "10427908"
},
"item": [
{
"name": "Login user",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let responseData = pm.response.json();\r",
"pm.environment.set(\"LOGON_TOKEN\", responseData.token)\r",
"console.log(\"Id: \" + responseData.id)"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\" : \"Londo\",\r\n \"password\" : \"Hallowach\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/login",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"login"
]
}
},
"response": []
},
{
"name": "Participant GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/participants",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"participants"
]
}
},
"response": []
},
{
"name": "History GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/history?shipcall_id=79",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"history"
],
"query": [
{
"key": "shipcall_id",
"value": "79"
}
]
}
},
"response": []
},
{
"name": "Shipcalls GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/shipcalls",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"shipcalls"
]
}
},
"response": []
},
{
"name": "Shipcalls POST",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"anchored\": null,\r\n \"arrival_berth_id\": 144,\r\n \"bunkering\": null,\r\n \"canceled\": false,\r\n \"created\": \"0001-01-01T00:00:00\",\r\n \"departure_berth_id\": null,\r\n \"draft\": null,\r\n \"eta\": \"2024-04-10T12:29:09.174\",\r\n \"etd\": null,\r\n \"evaluation\": null,\r\n \"evaluation_message\": null,\r\n \"flags\": null,\r\n \"id\": 0,\r\n \"modified\": null,\r\n \"moored_lock\": null,\r\n \"participants\": [\r\n {\r\n \"participant_id\": 136,\r\n \"type\": 8\r\n },\r\n {\r\n \"participant_id\": 11,\r\n \"type\": 32\r\n },\r\n {\r\n \"participant_id\": 1,\r\n \"type\": 1\r\n }\r\n ],\r\n \"pier_side\": null,\r\n \"pilot_required\": null,\r\n \"rain_sensitive_cargo\": null,\r\n \"recommended_tugs\": null,\r\n \"replenishing_lock\": null,\r\n \"replenishing_terminal\": null,\r\n \"ship_id\": 14,\r\n \"tidal_window_from\": null,\r\n \"tidal_window_to\": null,\r\n \"time_ref_point\": 0,\r\n \"tug_required\": null,\r\n \"type\": \"arrival\",\r\n \"voyage\": null\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/shipcalls",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"shipcalls"
]
}
},
"response": []
},
{
"name": "Shipcalls PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"type\": \"shifting\", \"evaluation\": \"green\", \"id\": 33, \"ship_id\": 2, \"eta\": \"2024-01-27T18:00:21\", \"etd\": \"2024-01-25T17:00:45\", \"arrival_berth_id\": 168, \"departure_berth_id\": 184, \"rain_sensitive_cargo\": \"False\", \"time_ref_point\": 1, \"participants\": [{\"participant_id\": 6, \"type\": 8}, {\"participant_id\": 11, \"type\": 32}, {\"participant_id\": 9, \"type\": 64}, {\"participant_id\": 1, \"type\": 1}], \"created\": \"2023-10-24T11:41:16\", \"modified\": \"2024-02-23T14:50:07\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/shipcalls",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"shipcalls"
]
}
},
"response": []
},
{
"name": "Berths GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/berths",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"berths"
]
}
},
"response": []
},
{
"name": "Notifications GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/notifications?shipcall_id=4",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"notifications"
],
"query": [
{
"key": "shipcall_id",
"value": "4"
}
]
}
},
"response": []
},
{
"name": "Ships GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Ships PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 17,\r\n \"name\": \"Testschiff 1\",\r\n \"imo\": 1231231,\r\n \"callsign\": \"TEST1\",\r\n \"participant_id\": null,\r\n \"length\": 202.0,\r\n \"width\": 25.0,\r\n \"is_tug\": 0,\r\n \"bollard_pull\": null,\r\n \"eni\": null,\r\n \"created\": \"2024-04-03T07:49:29\",\r\n \"modified\": null,\r\n \"deleted\": 0\r\n}"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Ships POST",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\": \"Testschiff 02\",\r\n \"imo\": 9999992,\r\n \"length\": 100.2,\r\n \"width\": 16.5,\r\n \"is_tug\": 0,\r\n \"bollard_pull\": 42,\r\n \"callsign\": \"9992\",\r\n \"participant_id\": null,\r\n \"eni\": 1\r\n }"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Ships DELETE",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 15,\r\n \"name\": \"Testschiff 01\",\r\n \"imo\": 9999991\r\n }"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/ships",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"ships"
]
}
},
"response": []
},
{
"name": "Times GET",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times?shipcall_id=112",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
],
"query": [
{
"key": "shipcall_id",
"value": "112"
}
]
}
},
"response": []
},
{
"name": "Times POST",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"start_planned\" : \"2023-04-18T07:18:19\",\r\n \"end_planned\" : \"2023-04-18T09:18:19\", \r\n \"shipcall_id\" : 1,\r\n \"participant_id\" : 1\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
]
}
},
"response": []
},
{
"name": "Times PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"etd_berth\" : \"2023-01-09T05:00:39\", \r\n \"id\" : 11,\r\n \"participant_id\": 2,\r\n \"remarks\": \"test 23\",\r\n \"shipcall_id\" : 4,\r\n \"pier_side\" : 0\r\n \r\n}\r\n\r\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
]
}
},
"response": []
},
{
"name": "Times DELETE",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": {
"raw": "{{SCHEMA}}{{PATH}}/times?id=118",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"times"
],
"query": [
{
"key": "id",
"value": "118"
}
]
}
},
"response": []
},
{
"name": "User PUT",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{LOGON_TOKEN}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 2, \r\n \"old_password\" : \"Gurkensalat\",\r\n \"new_password\" : \"Hallowach\"\r\n}"
},
"url": {
"raw": "{{SCHEMA}}{{PATH}}/user",
"host": [
"{{SCHEMA}}{{PATH}}"
],
"path": [
"user"
]
}
},
"response": []
}
],
"auth": {
"type": "bearer"
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
}

9028
misc/BreCalApi.cs Normal file

File diff suppressed because it is too large Load Diff

537
misc/BreCalApi.md Normal file
View File

@ -0,0 +1,537 @@
# Bremen calling API
Version: _1.7.0_
Last change: _Nov 14, 2025_
## Introduction
This API allows users to interact with "Bremen calling" without an UI. Apart vom querying data via _GET_ endpoints users may create and update shipcalls, assign participants and update participant times for shipcalls.
Creating and updating times and shipcalls depend on the participant roles a user is assigned to. For example, if a participant has the role "AGENCY" they may change assignments _and_ create and update agency times. A participant with the role "PILOT" on the other hand may not change the assigments and only create/update times for the pilot.
### Authentication
- **ApiKey**: API key in `header` header named `Authorization`. This is a JWT Token that the caller receives upon login.
### Notes on this version
This version refers to _1.7_ whereas the public client currently has version _1.6_. This means that there is some functionality available in the API that cannot be accessed through the UI yet, specifically notifications.
There is no documentation for the structures returned by _GET_ requests but these can easily be determined via a single query.
## Ship Endpoints
### `DELETE /ships`
**Summary:** Delete a ship (logically).
A ship can only be logically deleted, since it is possible to have been used in previous shipcalls. On logical delete, the ship can no longer be selected in a new ship call.
#### Parameters
| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| id | query | integer | Yes | **Id of ship**. *Example: 42*. Id of ship to be deleted. |
#### Responses
- **200**
- **400**
- **401**
- **500**
- **503**
---
### `GET /ships`
**Summary:** gets a list of ships
Gets a list of ships including logically deleted ships to be used with shipcalls
#### Responses
- **200**: list of ships
- **400**
- **401**
- **500**
- **503**
---
### `POST /ships`
**Summary:** create a new ship entry
adds a new non-existing ship to the database. The ships IMO number is the unique identifier.
#### Request Body
Ship details. **Do not** provide id parameter.
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| name | string | No | |
| imo | integer | No | |
| callsign | string | No | |
| participant_id | integer | No | Optional reference to participant (tug role) |
| length | number | No | |
| width | number | No | |
| is_tug | boolean | No | |
| bollard_pull | integer | No | |
| eni | integer | No | BSMD internal use |
| created | string | No | Readonly field set by the database when ship was created |
| modified | string | No | Readonly field set by the database when ship was last modified |
| deleted | boolean | No | marks the ship as logically deleted |
#### Responses
- **201**
- **400**
- **401**
- **500**
- **503**
---
### `PUT /ships`
**Summary:** Update a ship entry
Updating a ship entry. Please do not modify the IMO number. In that case please add a new entry.
#### Request Body
Updated ship entry. The id parameter is **required**.
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| name | string | No | |
| imo | integer | No | |
| callsign | string | No | |
| participant_id | integer | No | Optional reference to participant (tug role) |
| length | number | No | |
| width | number | No | |
| is_tug | boolean | No | |
| bollard_pull | integer | No | |
| eni | integer | No | BSMD internal use |
| created | string | No | Readonly field set by the database when ship was created |
| modified | string | No | Readonly field set by the database when ship was last modified |
| deleted | boolean | No | marks the ship as logically deleted |
#### Responses
- **200**
- **400**
- **401**
- **500**
- **503**
---
## Shipcall Endpoints
### `GET /shipcalls`
**Summary:** Gets a list of ship calls
Get current ship calls
#### Parameters
| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| past_days | query | integer | No | number of days in the past to include in the result. *Example: 7*. |
#### Responses
- **200**: ship call list
- **400**
- **401**
- **500**
- **503**
---
### `POST /shipcalls`
**Summary:** Create a new ship call
A new shipcall is created without times at this point. This is ususally done by the BSMD or a participant with that particular role.
#### Request Body
Creates a new ship call. **Do not** provide id parameter.
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| ship_id | integer | Yes | |
| port_id | integer | No | |
| type | string | Yes | Type of ship call |
| eta | string | No | |
| voyage | string | No | |
| etd | string | No | |
| arrival_berth_id | integer | No | |
| departure_berth_id | integer | No | |
| tug_required | boolean | No | |
| pilot_required | boolean | No | |
| flags | integer | No | |
| pier_side | boolean | No | |
| bunkering | boolean | No | |
| replenishing_terminal | boolean | No | |
| replenishing_lock | boolean | No | |
| draft | number | No | |
| tidal_window_from | string | No | |
| tidal_window_to | string | No | |
| rain_sensitive_cargo | boolean | No | |
| recommended_tugs | integer | No | |
| anchored | boolean | No | |
| moored_lock | boolean | No | |
| canceled | boolean | No | |
| evaluation | string | No | Evaluation of the ship call |
| evaluation_message | string | No | |
| time_ref_point | integer | No | Physical reference point for all times given in shipcall and depending times entries |
| participants | array<object> | No | |
| created | string | No | Readonly field set by the database when shipcall was created |
| modified | string | No | Readonly field set by the database when shipcall was last modified |
#### Responses
- **201**
- **400**
- **401**
- **500**
- **503**
---
### `PUT /shipcalls`
**Summary:** Updates a ship call
Updates a shipcall. Usually done if the participant assignments change.
#### Request Body
Creates a new ship call. The id parameter is **required**.
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| ship_id | integer | Yes | |
| port_id | integer | No | |
| type | string | Yes | Type of ship call |
| eta | string | No | |
| voyage | string | No | |
| etd | string | No | |
| arrival_berth_id | integer | No | |
| departure_berth_id | integer | No | |
| tug_required | boolean | No | |
| pilot_required | boolean | No | |
| flags | integer | No | |
| pier_side | boolean | No | |
| bunkering | boolean | No | |
| replenishing_terminal | boolean | No | |
| replenishing_lock | boolean | No | |
| draft | number | No | |
| tidal_window_from | string | No | |
| tidal_window_to | string | No | |
| rain_sensitive_cargo | boolean | No | |
| recommended_tugs | integer | No | |
| anchored | boolean | No | |
| moored_lock | boolean | No | |
| canceled | boolean | No | |
| evaluation | string | No | Evaluation of the ship call |
| evaluation_message | string | No | |
| time_ref_point | integer | No | Physical reference point for all times given in shipcall and depending times entries |
| participants | array<object> | No | |
| created | string | No | Readonly field set by the database when shipcall was created |
| modified | string | No | Readonly field set by the database when shipcall was last modified |
#### Responses
- **200**
- **400**
- **401**
- **500**
- **503**
---
## Static Endpoints
### `GET /berths`
**Summary:** Gets a list of all berths registered
Returns a list of berths, including berths that are (logically) deleted
#### Responses
- **200**: list of berths
- **400**
- **401**
- **500**
- **503**
---
### `GET /history`
**Summary:** History data
This endpoint returns a list of changes made to the specific shipcall
#### Parameters
| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| shipcall_id | query | integer | Yes | **Id of ship call**. *Example: 3*. Id given in ship call list |
#### Responses
- **200**: list of history entries
- **400**
- **401**
- **500**
- **503**
---
### `GET /notifications`
**Summary:** Gets a list of notifications pursuant to a specified participant and ship call
List of notifications (tbd)
#### Parameters
| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| shipcall_id | query | integer | No | **Id of ship call**. *Example: 52*. Id given in ship call list |
#### Responses
- **200**: notification list
- **400**
- **401**
- **500**
- **503**
---
### `GET /participants`
**Summary:** gets one or all participants
If no parameter is given, all participants are returned. The list can be used to display participant information in the context of ship calls.
#### Parameters
| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| user_id | query | integer | No | **Id of user**. *Example: 2*. User id returned by verify call. |
#### Responses
- **200**: one or all participants as list
- **400**
- **401**
- **404**
- **500**
- **503**
---
### `GET /ports`
**Summary:** Your GET endpoint
Returns a list of ports
#### Responses
- **200**: list of ports
- **401**
- **403**
- **500**
- **503**
---
## Times Endpoints
### `DELETE /times`
**Summary:** Delete a times entry for a ship call.
A times entry is typically deleted if the agent for example changes or removes the participant assignment for a particular role.
#### Parameters
| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| id | query | integer | Yes | **Id of times**. *Example: 42*. Id of times entry to be deleted. |
#### Responses
- **200**
- **400**
- **401**
- **500**
- **503**
---
### `GET /times`
**Summary:** Gets list of times
Get all times assigned to a shipcall. These might not be complete.
#### Parameters
| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| shipcall_id | query | integer | No | **Id**. *Example: 42*. Id of referenced ship call. |
#### Responses
- **200**: list of recorded times
- **400**
- **401**
- **500**
- **503**
---
### `POST /times`
**Summary:** Create a new times entry for a ship call
The times entry for a shipcall is created with reference to a participant. For each participant type there should be only one times data record.
#### Request Body
Times entry that will be added to the ship call. **Do not** provide id parameter.
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| eta_berth | string | No | Arrival time at berth |
| eta_berth_fixed | boolean | No | If true, the eta is fixed and cannot be changed |
| etd_berth | string | No | departure time from berth |
| etd_berth_fixed | boolean | No | If true, the etd is fixed and cannot be changed |
| lock_time | string | No | arrival time at lock |
| lock_time_fixed | boolean | No | If true, the lock time is fixed and cannot be changed |
| zone_entry | string | No | Expected time of entry into the zone |
| zone_entry_fixed | boolean | No | If true, the zone entry time is fixed and cannot be changed |
| operations_start | string | No | Start time for terminal operations |
| operations_end | string | No | End time for terminal operations |
| remarks | string | No | Additional remarks |
| shipcall_id | integer | Yes | Reference to a shipcall id |
| participant_id | integer | Yes | Reference to a participant id |
| berth_id | integer | No | Reference to a berth id |
| berth_info | string | No | Additional info text for berth |
| pier_side | boolean | No | true if ship is rotated, false otherwise |
| participant_type | integer | No | |
| ata | string | No | ata can be set by mooring if actual times are different from planned |
| atd | string | No | atd can be set by mooring if actual times are different from planned |
| eta_interval_end | string | No | Optional end of the interval for the times eta entry |
| etd_interval_end | string | No | Optional end of the interval for the times etd entry |
| created | string | No | Readonly field set by the database when times record was created |
| modified | string | No | Readonly field set by the database when times record was last modified |
#### Responses
- **201**
- **400**
- **401**
- **500**
- **503**
---
### `PUT /times`
**Summary:** Update a times entry for a ship call
Updating a times entry for a ship for a particular participant. The times entries are required for a shipcall to pass the validation rules.
#### Request Body
Times entry that will be added to the ship call. The id parameter is **required**.
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| eta_berth | string | No | Arrival time at berth |
| eta_berth_fixed | boolean | No | If true, the eta is fixed and cannot be changed |
| etd_berth | string | No | departure time from berth |
| etd_berth_fixed | boolean | No | If true, the etd is fixed and cannot be changed |
| lock_time | string | No | arrival time at lock |
| lock_time_fixed | boolean | No | If true, the lock time is fixed and cannot be changed |
| zone_entry | string | No | Expected time of entry into the zone |
| zone_entry_fixed | boolean | No | If true, the zone entry time is fixed and cannot be changed |
| operations_start | string | No | Start time for terminal operations |
| operations_end | string | No | End time for terminal operations |
| remarks | string | No | Additional remarks |
| shipcall_id | integer | Yes | Reference to a shipcall id |
| participant_id | integer | Yes | Reference to a participant id |
| berth_id | integer | No | Reference to a berth id |
| berth_info | string | No | Additional info text for berth |
| pier_side | boolean | No | true if ship is rotated, false otherwise |
| participant_type | integer | No | |
| ata | string | No | ata can be set by mooring if actual times are different from planned |
| atd | string | No | atd can be set by mooring if actual times are different from planned |
| eta_interval_end | string | No | Optional end of the interval for the times eta entry |
| etd_interval_end | string | No | Optional end of the interval for the times etd entry |
| created | string | No | Readonly field set by the database when times record was created |
| modified | string | No | Readonly field set by the database when times record was last modified |
#### Responses
- **200**
- **400**
- **401**
- **500**
- **503**
---
## User Endpoints
### `POST /login`
**Summary:** Returns a JWT session token and user data if successful
Perform login
#### Request Body
Login credentials
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| username | string | Yes | |
| password | string | Yes | |
#### Responses
- **200**: Successful response
- **400**
- **403**
- **500**
- **503**
**Response 200 JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| participant_id | integer | No | |
| first_name | string | No | |
| last_name | string | No | |
| user_name | string | No | |
| user_phone | string | No | |
| user_email | string | No | |
| notify_email | boolean | No | |
| notify_whatsapp | boolean | No | |
| notify_signal | boolean | No | |
| notify_popup | boolean | No | |
| exp | number | No | |
| token | string | No | |
| notify_on | array<string> | No | |
---
### `PUT /user`
**Summary:** Update user details (first/last name, phone, password)
Update user information
#### Request Body
User details
**JSON Schema**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | integer | No | |
| old_password | string | No | |
| new_password | string | No | |
| first_name | string | No | |
| last_name | string | No | |
| user_phone | string | No | |
| user_email | string | No | |
| notify_email | boolean | No | |
| notify_popup | boolean | No | |
| notify_whatsapp | boolean | No | |
| notify_signal | boolean | No | |
| notify_on | array<string> | No | |
#### Responses
- **200**
- **400**
- **401**
- **500**
- **503**
---

2045
misc/BreCalApi.yaml Normal file

File diff suppressed because it is too large Load Diff

126
misc/Deployment.md Normal file
View File

@ -0,0 +1,126 @@
# System deployment
___
## Prerequisites
## Client
Deployment of the productive client:
- create a branch release/pub_<version> from test release branch
- remove all text references to 'test' (changing target url in the process)
- rename application in settings
- change BG_COLOR in settings to #203864
- user deployment publish xml
## Database
## Backend / Flask app
In order to not have complicated and error-prone copying manoevers a direct deployment from the repo is used using git.
### File structure
### Installation steps
1) Created a ssh-key for the user that does the installation on the server following the Github [instructions](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
2) Deploy generated key to the Github user account.
3) In the shell, activate ssh-agent and add the key. For example:
```bash
eval ($ssh-agent)
ssh-add ~/.ssh/od_ed25519
```
4) Change to deployment folder
e.g.
```bash
cd /var/www/brecal_test
```
5) Perform sparse checkout on the Flask server subtree
```bash
git clone -n git@github.com:puls200/brecal.git <target_folder>
cd <target_folder>
git sparse-checkout set --no-cone src/server
git checkout
```
6) Database credentials are stored outside the web root, we are using /var/www/secure. Here the file ```connection_data.json``` is placed, a different named copy for each instance.
### Changing Devel / Test / Prod Environment
Please note that in the "develop" branch the environment and paths are set to the "devel" setting. If a deployment is made (to testing or to the production) the scripts ```copytest.sh``` and ```copyprod.sh``` have to be run. These scripts will change the environment and paths to the respective settings.
There is also a script called ```bump-version.sh``` which can be used to upgrade all version entries in the repository.
### Installing Requirements
Python 3.11 & Pip3.11 installation (linux), virtualenv package
Optional, Step 0: Python source installation
Windows (untested):
Python 3.11: https://www.geeksforgeeks.org/download-and-install-python-3-latest-version/
PIP package manager (in command window): py -m ensurepip --upgrade
Virtual Environment 'virtualenv': https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html
Linux:
Python 3.11 & the PIP package manager: https://tecadmin.net/how-to-install-python-3-11-on-ubuntu-22-04/
Virtual Environment 'virtualenv'
### Building the Virtual Environment
Create a virtualenv called '.venv' with a specified python version, such as python3.11
All python packages will be installed in the virtual environment. Upon running the application,
make sure to activate the virtual environment before starting it.
Windows: # on windows, provide the full path, as obtained by "where python"
1.) Relocate to the 'brecal' directory
cd brecal
2.) create a virtual environment with the name '.venv'
where python
virtualenv --python {python_path} .venv
3.) activate the virtual environment and install
.venv\Scripts\activate
cd ./src/server
pip install -r requirements.txt
Linux:
1.) Relocate to the 'brecal' directory
cd brecal
2.) create a virtual environment with the name '.venv'
virtualenv --python python311 .venv
3.) activate the virtual environment and install
source .venv/bin/activate
cd ./src/server
pip install -r requirements.txt
### Testing (using 'pytest')
All tests in the directory brecal/src/server/tests can be run automatically with the 'pytest' module It recognizes any function within these
scripts, as these use 'test_'-prefixes. The module can be used to run the tests or even to create coverage reports, which show, what portions
of the directory are still untested. When the pytest module is installed, one can use a single line of code to run all tests.
1.) Relocate to the application's directory
cd brecal/src/server
2.) activate the virtual environment
Windows:
source .venv\Scripts\activate
Linux:
source .venv\bin\activate
3.) run the tests
option1: run pytest as a standalone
pytest tests/
option2: run pytest & coverage report (inspects coverage for the folder 'BreCal' by running each test in 'tests/'
this creates a folder with the name 'coverage_reports', where .html files are created and can be observed by a developer.
the coverage files are typically ignored by .gitignore
pytest --cov BreCal tests/

203
misc/Readme.md Normal file
View File

@ -0,0 +1,203 @@
# Database Bremen Calling
## Server
mariadb v 10
## Getting started
- Execute 'create_schema.sql' and import 'sample_data.sql'
If the database is updated or changed, please update these files.
To avoid errors, it is best to drop the entire database, edit the create script and re-import the sample data.
## Creating the dump file
```bash
mysqldump -u [username] -p --no-create-info --complete-insert bremen_calling > sample_data.sql
```
## Removing existing tables
We want only to remove the tables in order to preserve user privileges
```sql
SELECT concat('DROP TABLE IF EXISTS `', table_name, '`;')
FROM information_schema.tables
WHERE table_schema = 'bremen_calling';
```
outputs complete drop statements
```sql
SET FOREIGN_KEY_CHECKS = 0;
-- Your semicolon separated list of DROP statements here
DROP TABLE IF EXISTS `notification`;
DROP TABLE IF EXISTS `role`;
DROP TABLE IF EXISTS `ship`;
DROP TABLE IF EXISTS `participant`;
DROP TABLE IF EXISTS `times`;
DROP TABLE IF EXISTS `role_securable_map`;
DROP TABLE IF EXISTS `user_role_map`;
DROP TABLE IF EXISTS `user`;
DROP TABLE IF EXISTS `securable`;
DROP TABLE IF EXISTS `shipcall_participant_map`;
DROP TABLE IF EXISTS `berth`;
DROP TABLE IF EXISTS `shipcall`;
SET FOREIGN_KEY_CHECKS = 1;
```
## Schema
```mermaid
erDiagram
participant {
INT id PK
VARCHAR name
VARCHAR street
VARCHAR postal_code
VARCHAR city
INT type
INT flags
}
port {
INT id PK
VARCHAR name
CHAR locode
}
berth {
INT id PK
VARCHAR name
BIT lock
INT owner_id FK
INT authority_id FK
INT port_id FK
BIT deleted
}
ship {
INT id PK
VARCHAR name
INT imo
VARCHAR callsign
INT participant_id FK
FLOAT length
FLOAT width
BIT is_tug
INT bollard_pull
INT eni
BIT deleted
}
shipcall {
INT id PK
INT ship_id FK
TINYINT type
DATETIME eta
DATETIME etd
INT arrival_berth_id FK
INT departure_berth_id FK
INT port_id FK
INT flags
BIT tug_required
BIT pilot_required
}
times {
INT id PK
INT shipcall_id FK
INT participant_id FK
INT berth_id FK
INT participant_type
DATETIME eta_berth
DATETIME etd_berth
DATETIME lock_time
DATETIME zone_entry
}
notification {
INT id PK
INT shipcall_id FK
INT participant_id FK
TINYINT level
TINYINT type
}
history {
INT id PK
INT participant_id FK
INT user_id FK
INT shipcall_id FK
DATETIME timestamp
DATETIME eta
INT type
INT operation
}
shipcall_participant_map {
INT id PK
INT shipcall_id FK
INT participant_id FK
INT type
}
shipcall_tug_map {
INT id PK
INT shipcall_id FK
INT ship_id FK
}
participant_port_map {
INT id PK
INT participant_id FK
INT port_id FK
}
user {
INT id PK
INT participant_id FK
VARCHAR first_name
VARCHAR last_name
VARCHAR user_name
VARCHAR user_email
}
role {
INT id PK
VARCHAR name
VARCHAR description
}
securable {
INT id PK
VARCHAR name
}
role_securable_map {
INT id PK
INT role_id FK
INT securable_id FK
}
user_role_map {
INT id PK
INT user_id FK
INT role_id FK
}
participant ||--o{ berth : owner_id
participant ||--o{ berth : authority_id
port ||--o{ berth : port_id
participant ||--o{ ship : participant_id
ship ||--o{ shipcall : ship_id
berth ||--o{ shipcall : arrival_berth_id
berth ||--o{ shipcall : departure_berth_id
port ||--o{ shipcall : port_id
shipcall ||--|| times : shipcall_id
participant ||--|| times : participant_id
berth ||--o{ times : berth_id
shipcall ||--o{ notification : shipcall_id
participant ||--o{ notification : participant_id
participant ||--o{ history : participant_id
user ||--o{ history : user_id
shipcall ||--o{ history : shipcall_id
shipcall ||--o{ shipcall_participant_map : shipcall_id
participant ||--o{ shipcall_participant_map : participant_id
shipcall ||--o{ shipcall_tug_map : shipcall_id
ship ||--o{ shipcall_tug_map : ship_id
participant ||--o{ participant_port_map : participant_id
port ||--o{ participant_port_map : port_id
participant ||--o{ user : participant_id
user ||--o{ user_role_map : user_id
role ||--o{ user_role_map : role_id
role ||--o{ role_securable_map : role_id
securable ||--o{ role_securable_map : securable_id
```

27
misc/Readme_yaml.md Normal file
View File

@ -0,0 +1,27 @@
# Bremen Calling Open API spec
## Infos zur Generierung der CS Wrapper / Mapping Datei aus YAML
Verwendung von "OpenAPIGenerator" aus dem [Rest API Client Code Generator 2022](https://marketplace.visualstudio.com/items?itemName=ChristianResmaHelle.ApiClientCodeGenerator2022).
Die automatisch generierte Datei muss leider noch nachgearbeitet werden:
1) #pragma warning disable CS8073 (direkt nach der NS declaration).
2) #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' (am Schluss vor der schließenden Klammer des NS)
3) Für readOnly Properties wird bei einem Enum kein korrekter Code emittiert. Daher muss aktuell folgende Funktion ergänzt werden, damit beim Speichern das "evaluation" Flag nicht mitgesendet wird:
```C++
public bool ShouldSerializeEvaluation()
{
return false;
}
```
Witziger(!)weise funktioniert es für das Property EvaluationMessage korrekt.
### Vacuum Yaml Linter
Example Usage:
```bash
vacuum lint -d .\misc\BreCalApi.yaml --fail-severity warn
```

16
misc/ReleaseNotes.md Normal file
View File

@ -0,0 +1,16 @@
# Versionshistorie
## 1.7
### YAML / API
1. Notifications GET: Der Parameter "shipcall_id" ist jetzt optional für den Abruf von Benachrichtigungen.
2. Notification: Enthält jetzt ein neues Feld "participant_id". Ist dieses gesetzt, richtet sich die Benachrichtigung an diesen Teilnehmer. Ist das Feld nicht vorhanden, richtet sich die Benachrichtigung an alle Beteiligten des shipcall
3. Die Benutzerdaten (login_result) enthalten jetzt die Felder (Flags) der Zuordnung für die verschiedenen Benachrichtigungs-Wege, aktuell implementiert ist notify_email und notify_popup. Diese können auch über user_details analog zu Telefonnummer, Name etc. gesetzt werden.
4. Die Enumeration NotificationType enthält jetzt nicht mehr den Benachrichtigungsweg, sondern den Typ des Ereignisses, das die Benachrichtigung ausgelöst hat. Aktuell werden 7 Ereignisse unterschieden.
5. Die Benutzerdaten enthalten eine Liste NotifyOn vom Typ NotificationType. In dieser Aufzählung sind die Ereignisse enthalten, über die der Benutzer benachrichtigt werden will. Wenn diese Liste leer oder nicht vorhanden ist erhält der Benutzer keine Nachrichten, auch wenn er einen Benachrichtigungsweg ausgewählt hat.

View File

@ -0,0 +1,27 @@
{
"id": "a3b2b291-6ec7-4af8-9ba6-57448547f71b",
"name": "Remote BreCal EMSWE",
"values": [
{
"key": "PATH",
"value": "brecal.bsmd-emswe.eu/",
"type": "default",
"enabled": true
},
{
"key": "LOGON_TOKEN",
"value": "",
"type": "any",
"enabled": true
},
{
"key": "SCHEMA",
"value": "https://",
"type": "default",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2023-06-27T09:33:59.460Z",
"_postman_exported_using": "Postman/10.15.4"
}

32
misc/add_user.py Normal file
View File

@ -0,0 +1,32 @@
import mysql.connector
import os
import json
import bcrypt
config_path = '../src/server/BreCal/connection_data.json'
print (os.getcwd())
if not os.path.exists(config_path):
print ('cannot find ' + config_path)
exit(1)
f = open(config_path);
connection_data = json.load(f)
mydb = mysql.connector.connect(host=connection_data["host"], user=connection_data["user"],
password = connection_data["password"], database=connection_data["database"])
print(mydb)
# insert a new user
participant_id = 1
first_name = "Londo"
last_name = "Mollari"
user_name = "Londo"
user_email = "l.mollari@centauri.gov"
user_phone = "+01 555 324 2313"
password = "Hallowach"
password_hash = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt( 12 )).decode('utf8')
query = "INSERT INTO user (participant_id, first_name, last_name, user_name, user_email, user_phone, password_hash) VALUES (" + str(participant_id) + ",\"" + first_name + "\",\"" + last_name + "\",\"" + user_name + "\",\"" + user_email + "\",\"" + user_phone + "\",\"" + password_hash + "\")"
with mydb.cursor() as cursor:
cursor.execute(query)
mydb.commit()

BIN
misc/brecal.snk Normal file

Binary file not shown.

25
misc/bump-version.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
CURRENT_VERSION=$(cat version.txt)
NEW_VERSION="${1}"
if [ -z "${NEW_VERSION}" ]; then
echo "No new version given"
exit 1
fi
echo "Bumping version ${CURRENT_VERSION} to ${NEW_VERSION}"
CURRENT_VERSION=$(printf '%s\n' "$CURRENT_VERSION" | sed -e 's/[\/&]/\\&/g')
NEW_VERSION=$(printf '%s\n' "$NEW_VERSION" | sed -e 's/[\/&]/\\&/g')
echo "Found the following matching version strings:"
git grep -I "${CURRENT_VERSION}"
echo "Proceed? [N/y]"
read proceed
if [ "${proceed}" = "y" ]; then
git grep -Il "${CURRENT_VERSION}" | xargs sed --in-place -e "s/${CURRENT_VERSION}/${NEW_VERSION}/g"
git add $(git grep -Il "${NEW_VERSION}")
fi

View File

@ -0,0 +1,46 @@
-- Inspect duplicates first
WITH duplicate_participants AS (
SELECT
shipcall_id,
participant_type,
COUNT(*) AS cnt
FROM times
GROUP BY shipcall_id, participant_type
HAVING COUNT(*) > 1
)
SELECT
t.*
FROM times AS t
JOIN duplicate_participants AS d
ON d.shipcall_id = t.shipcall_id
AND (d.participant_type <=> t.participant_type)
ORDER BY t.shipcall_id, t.participant_type, t.id;
-- Delete all but the highest-id entry per (shipcall_id, participant_type)
WITH ordered_times AS (
SELECT
id,
ROW_NUMBER() OVER (
PARTITION BY shipcall_id, participant_type
ORDER BY id DESC
) AS rn
FROM times
)
DELETE FROM times
WHERE id IN (
SELECT id
FROM ordered_times
WHERE rn > 1
);
-- Optional: re-check that no duplicates remain
WITH duplicate_participants AS (
SELECT
shipcall_id,
participant_type,
COUNT(*) AS cnt
FROM times
GROUP BY shipcall_id, participant_type
HAVING COUNT(*) > 1
)
SELECT COUNT(*) AS remaining_duplicates FROM duplicate_participants;

37
misc/clear_data.sql Normal file
View File

@ -0,0 +1,37 @@
-- This script clears all data from the database tables related to the port management system.
DELETE FROM notification WHERE id > 0;
DELETE FROM history WHERE id > 0;
DELETE FROM notification WHERE id > 0;
DELETE FROM shipcall_participant_map WHERE id > 0;
DELETE FROM participant_port_map WHERE id > 0;
DELETE FROM shipcall_tug_map WHERE id > 0;
DELETE FROM times WHERE id > 0;
DELETE FROM shipcall WHERE id > 0;
DELETE FROM user_role_map WHERE id > 0;
DELETE FROM role_securable_map WHERE id > 0;
DELETE FROM user_role_map WHERE id > 0;
DELETE FROM securable WHERE id > 0;
DELETE FROM role WHERE id > 0;
DELETE FROM user WHERE id > 0;
delete FROM ship WHERE id > 0;
DELETE FROM berth WHERE id > 0;
DELETE FROM participant WHERE id > 0;
DELETE FROM port WHERE id > 0;

View File

@ -0,0 +1,23 @@
DELETE FROM times WHERE
times.shipcall_id IN
(
SELECT s.id FROM shipcall s
JOIN shipcall_participant_map spm ON s.id = spm.shipcall_id
JOIN participant p ON spm.participant_id = p.id
WHERE p.id = 10
);
DELETE `history` FROM `history`
JOIN shipcall s on `history`.shipcall_id = s.id
JOIN shipcall_participant_map spm ON s.id = spm.shipcall_id
WHERE spm.participant_id = 10;
-- damit das hier funktioniert muss der FK in shipcall_participant_map von "RESTRICT" auf "SET NULL"
-- geändert werden
DELETE shipcall FROM shipcall
INNER JOIN shipcall_participant_map spm ON shipcall.id = spm.shipcall_id
JOIN participant p ON spm.participant_id = p.id
WHERE p.id = 10;
DELETE FROM shipcall_participant_map WHERE participant_id = 10;

42
misc/copyprod.sh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# This script replaces all references to the development version with the test version
# 1) Database references and paths
git grep -I "connection_data_test.json" -- '..' ':(exclude)*.sh'
git grep -I "/var/www/brecal_test/" -- '..' ':(exclude)*.sh'
# 2) Color references
# Bar colors in client: (BG_COLOR)
# Devel: #1D751F
# Test: #751D1F
# Prod: #203864
git grep -I "#751D1F" -- '..' ':(exclude)*.sh'
# 3) Assembly name references
git grep -I "BreCalTestClient" -- '..' ':(exclude)*.sh'
echo "Proceed? [N/y]"
read proceed
# for color
if [ "${proceed}" = "y" ]; then
# 1. for database references and paths
git grep -I "connection_data_test.json" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/connection_data_test.json/connection_data_prod.json/g"
git add $(git grep -Il "connection_data_prod.json" -- '..' ':(exclude)*.sh')
git grep -I "/var/www/brecal_test/" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/\/var\/www\/brecal_test\//\/var\/www\/brecal\//g"
git add $(git grep -Il "/var/www/brecal/" -- '..' ':(exclude)*.sh')
# 2. for color
git grep -Il "#751D1F" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/#751D1F/#203864/g"
git add $(git grep -Il "#203864" -- '..' ':(exclude)*.sh')
# 3. for assembly name
git grep -I "BreCalTestClient" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/BreCalTestClient/BreCalClient/g"
git add $(git grep -Il "BreCalClient" -- '..' ':(exclude)*.sh')
fi

42
misc/copytest.sh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# This script replaces all references to the development version with the test version
# 1) Database references and paths
git grep -I "connection_data_devel.json" -- '..' ':(exclude)*.sh'
git grep -I "/var/www/brecal_devel/" -- '..' ':(exclude)*.sh'
# 2) Color references
# Bar colors in client: (BG_COLOR)
# Devel: #1D751F
# Test: #751D1F
# Prod: #203864
git grep -I "#1D751F" -- '..' ':(exclude)*.sh'
# 3) Assembly name references
git grep -I "BreCalDevelClient" -- '..' ':(exclude)*.sh'
echo "Proceed? [N/y]"
read proceed
# for color
if [ "${proceed}" = "y" ]; then
# 1. for database references and paths
git grep -Il "connection_data_devel.json" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/connection_data_devel.json/connection_data_test.json/g"
git add $(git grep -Il "connection_data_test.json" -- '..' ':(exclude)*.sh')
git grep -Il "/var/www/brecal_devel/" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/\/var\/www\/brecal_devel\//\/var\/www\/brecal_test\//g"
git add $(git grep -Il "/var/www/brecal_test/" -- '..' ':(exclude)*.sh')
# 2. for color
git grep -Il "#1D751F" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/#1D751F/#751D1F/g"
git add $(git grep -Il "#751D1F" -- '..' ':(exclude)*.sh')
# 3. for assembly name
git grep -Il "BreCalDevelClient" -- '..' ':(exclude)*.sh' | xargs sed --in-place -e "s/BreCalDevelClient/BreCalTestClient/g"
git add $(git grep -Il "BreCalTestClient" -- '..' ':(exclude)*.sh')
fi

View File

@ -1,226 +1,510 @@
CREATE DATABASE `bremen_calling` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
-- MySQL dump 10.13 Distrib 8.0.43, for Win64 (x86_64)
--
-- Host: localhost Database: bremen_calling_test
-- ------------------------------------------------------
-- Server version 8.0.42-0ubuntu0.24.10.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `berth`
--
DROP TABLE IF EXISTS `berth`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `berth` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) DEFAULT NULL COMMENT 'Descriptive name',
`lock` bit(1) DEFAULT NULL COMMENT 'The lock must be used',
`owner_id` int unsigned DEFAULT NULL,
`authority_id` int unsigned DEFAULT NULL,
`port_id` int unsigned DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`),
KEY `FK_OWNER_PART_idx` (`owner_id`),
KEY `FK_AUTHORITY_PART_idx` (`authority_id`) /*!80000 INVISIBLE */,
KEY `FK_PORT_PART_idx` (`port_id`),
CONSTRAINT `FK_AUTHORITY_PART` FOREIGN KEY (`authority_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_OWNER_PART` FOREIGN KEY (`owner_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_PORT` FOREIGN KEY (`port_id`) REFERENCES `port` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=205 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Berth of ship for a ship call';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `history`
--
DROP TABLE IF EXISTS `history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `history` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`participant_id` int unsigned NOT NULL,
`user_id` int unsigned DEFAULT NULL,
`shipcall_id` int unsigned NOT NULL,
`timestamp` datetime NOT NULL COMMENT 'Time of saving',
`eta` datetime DEFAULT NULL COMMENT 'Current ETA / ETD value (depends if shipcall or times were saved)',
`type` int NOT NULL COMMENT 'shipcall or times',
`operation` int NOT NULL COMMENT 'insert, update or delete',
PRIMARY KEY (`id`),
KEY `FK_HISTORY_PARTICIPANT_idx` (`participant_id`),
KEY `FK_HISTORY_SHIPCALL_idx` (`shipcall_id`),
KEY `FK_HISTORY_USER` (`user_id`),
CONSTRAINT `FK_HISTORY_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_HISTORY_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`),
CONSTRAINT `FK_HISTORY_USER` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23537 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='This table stores a history of changes made to shipcalls so that everyone can see who changed what and when';
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE TABLE `history` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`participant_id` int unsigned NOT NULL,
`user_id` int unsigned DEFAULT NULL,
`shipcall_id` int unsigned NOT NULL,
`timestamp` datetime NOT NULL COMMENT 'Time of saving',
`eta` datetime DEFAULT NULL COMMENT 'Current ETA / ETD value (depends if shipcall or times were saved)',
`type` int NOT NULL COMMENT 'shipcall or times',
`operation` int NOT NULL COMMENT 'insert, update or delete',
PRIMARY KEY (`id`),
KEY `FK_HISTORY_PARTICIPANT_idx` (`participant_id`),
KEY `FK_HISTORY_SHIPCALL_idx` (`shipcall_id`),
KEY `FK_HISTORY_USER` (`user_id`),
CONSTRAINT `FK_HISTORY_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_HISTORY_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`),
CONSTRAINT `FK_HISTORY_USER` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29292 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='This table stores a history of changes made to shipcalls so that everyone can see who changed what and when';
--
-- Table structure for table `notification`
--
DROP TABLE IF EXISTS `notification`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `notification` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`shipcall_id` int unsigned DEFAULT NULL,
`participant_id` int unsigned DEFAULT NULL,
`level` tinyint DEFAULT NULL COMMENT 'severity of the notification',
`type` tinyint DEFAULT NULL COMMENT 'Email/UI/Other',
`message` varchar(512) DEFAULT NULL COMMENT 'individual message',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_NOTIFICATION_SHIPCALL_idx` (`shipcall_id`),
KEY `FK_NOTIFICATION_PARTICIPANT_idx` (`participant_id`),
CONSTRAINT `FK_NOTIFICATION_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `FK_NOTIFICATION_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10398 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='An entry corresponds to an alarm given by a violated rule during times update';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `participant`
--
DROP TABLE IF EXISTS `participant`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `participant` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) DEFAULT NULL,
`street` varchar(128) DEFAULT NULL,
`postal_code` varchar(5) DEFAULT NULL,
`city` varchar(64) DEFAULT NULL,
`flags` int(10) unsigned DEFAULT NULL,
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
`type` int DEFAULT NULL,
`flags` int unsigned DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='An organization taking part';
) ENGINE=InnoDB AUTO_INCREMENT=160 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='An organization taking part';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `participant_port_map`
--
CREATE TABLE `ship` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(45) DEFAULT NULL,
`imo` int(11) DEFAULT NULL,
`callsign` varchar(8) DEFAULT NULL,
`length` FLOAT NULL DEFAULT NULL,
`width` FLOAT NULL DEFAULT NULL,
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `shipcall` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`ship_id` INT(11) UNSIGNED NULL DEFAULT NULL,
`type` TINYINT(4) NULL DEFAULT NULL,
`eta` DATETIME NULL DEFAULT NULL,
`voyage` VARCHAR(16) NULL DEFAULT NULL,
`etd` DATETIME NULL DEFAULT NULL,
`arrival_berth_id` INT(10) UNSIGNED NULL DEFAULT NULL,
`departure_berth_id` INT(10) UNSIGNED NULL DEFAULT NULL,
`tug_required` BIT(1) NULL DEFAULT NULL,
`pilot_required` BIT(1) NULL DEFAULT NULL,
`flags` INT(10) UNSIGNED NULL DEFAULT 0,
`pier_side` BIT(1) NULL DEFAULT NULL,
`bunkering` BIT(1) NULL DEFAULT NULL,
`replenishing` BIT(1) NULL DEFAULT NULL,
`draft` FLOAT NULL DEFAULT NULL,
`tidal_window_from` DATETIME NULL DEFAULT NULL,
`tidal_window_tp` DATETIME NULL DEFAULT NULL,
`rain_sensitive_cargo` BIT(1) NULL DEFAULT b'0',
`recommended_tugs` INT(11) NULL DEFAULT 0,
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
INDEX `FK_SHIPCALL_SHIP` (`ship_id`),
INDEX `FK_SHIPCALL_BERTH_ARRIVAL` (`arrival_berth_id`),
INDEX `FK_SHIPCALL_BERTH_DEPARTURE` (`departure_berth_id`),
CONSTRAINT `FK_SHIPCALL_BERTH_ARRIVAL` FOREIGN KEY (`arrival_berth_id`) REFERENCES `berth` (`id`),
CONSTRAINT `FK_SHIPCALL_BERTH_DEPARTURE` FOREIGN KEY (`departure_berth_id`) REFERENCES `berth` (`id`),
CONSTRAINT `FK_SHIPCALL_SHIP` FOREIGN KEY (`ship_id`) REFERENCES `ship` (`id`)
)
COMMENT='Incoming, outgoing or moving to another berth'
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `times` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`start_planned` datetime DEFAULT NULL,
`end_planned` datetime DEFAULT NULL,
`duration_planned` int(11) DEFAULT NULL,
`start_actual` datetime DEFAULT NULL,
`end_actual` datetime DEFAULT NULL,
`duration_actual` int(11) DEFAULT NULL,
`shipcall_id` int(11) UNSIGNED DEFAULT NULL,
`participant_id` int(11) UNSIGNED DEFAULT NULL,
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
DROP TABLE IF EXISTS `participant_port_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `participant_port_map` (
`id` int NOT NULL AUTO_INCREMENT,
`participant_id` int unsigned NOT NULL COMMENT 'Ref to participant',
`port_id` int unsigned NOT NULL COMMENT 'Ref to port',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `FK_TIME_SHIPCALL` (`shipcall_id`),
INDEX `FK_TIME_PART` (`participant_id`),
CONSTRAINT `FK_TIME_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_TIME_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='the planned time for the participants work';
KEY `FK_PP_PARTICIPANT` (`participant_id`),
KEY `FK_PP_PORT` (`port_id`),
CONSTRAINT `FK_PP_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_PP_PORT` FOREIGN KEY (`port_id`) REFERENCES `port` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Mapping table that assigns participants to a port';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `port`
--
DROP TABLE IF EXISTS `port`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `port` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL COMMENT 'Name of port',
`locode` char(5) DEFAULT NULL COMMENT 'UNECE locode',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Port as reference for shipcalls and berths';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role`
--
DROP TABLE IF EXISTS `role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '0' COMMENT 'unique role name',
`description` varchar(255) DEFAULT '0' COMMENT 'role description',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='logical group of securables for one or more user';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `role_securable_map`
--
DROP TABLE IF EXISTS `role_securable_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `role_securable_map` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`role_id` int unsigned NOT NULL,
`securable_id` int unsigned NOT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_ROLE_SECURABLE` (`role_id`),
KEY `FK_SECURABLE_ROLE` (`securable_id`),
CONSTRAINT `FK_ROLE_SECURABLE` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `FK_SECURABLE_ROLE` FOREIGN KEY (`securable_id`) REFERENCES `securable` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Assigns securables to roles';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `securable`
--
DROP TABLE IF EXISTS `securable`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `securable` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Actual permission on a single(!) feature or operation';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ship`
--
DROP TABLE IF EXISTS `ship`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ship` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL,
`imo` int DEFAULT NULL,
`callsign` varchar(8) DEFAULT NULL,
`participant_id` int unsigned DEFAULT NULL,
`length` float DEFAULT NULL,
`width` float DEFAULT NULL,
`is_tug` bit(1) DEFAULT b'0',
`bollard_pull` int DEFAULT NULL,
`eni` int DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`),
KEY `FK_SHIP_PARTICIPANT` (`participant_id`),
CONSTRAINT `FK_SHIP_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=485 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shipcall`
--
DROP TABLE IF EXISTS `shipcall`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `shipcall` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`ship_id` int unsigned DEFAULT NULL,
`type` tinyint DEFAULT NULL,
`eta` datetime DEFAULT NULL,
`voyage` varchar(16) DEFAULT NULL,
`etd` datetime DEFAULT NULL,
`arrival_berth_id` int unsigned DEFAULT NULL,
`departure_berth_id` int unsigned DEFAULT NULL,
`tug_required` bit(1) DEFAULT NULL,
`pilot_required` bit(1) DEFAULT NULL,
`flags` int unsigned DEFAULT '0',
`pier_side` bit(1) DEFAULT NULL,
`bunkering` bit(1) DEFAULT NULL,
`replenishing_terminal` bit(1) DEFAULT NULL,
`replenishing_lock` bit(1) DEFAULT NULL,
`draft` float DEFAULT NULL,
`tidal_window_from` datetime DEFAULT NULL,
`tidal_window_to` datetime DEFAULT NULL,
`rain_sensitive_cargo` bit(1) DEFAULT b'0',
`recommended_tugs` int DEFAULT '0',
`anchored` bit(1) DEFAULT NULL,
`moored_lock` bit(1) DEFAULT NULL,
`canceled` bit(1) DEFAULT NULL,
`evaluation` int unsigned DEFAULT NULL,
`evaluation_message` varchar(512) DEFAULT NULL,
`evaluation_time` datetime DEFAULT NULL,
`evaluation_notifications_sent` bit(1) DEFAULT NULL,
`port_id` int unsigned NOT NULL DEFAULT '1' COMMENT 'Selected port for this shipcall',
`time_ref_point` int DEFAULT '0' COMMENT 'Index of a location which is the reference point for all time value entries, e.g. berth or Geeste',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_SHIPCALL_SHIP` (`ship_id`),
KEY `FK_SHIPCALL_BERTH_ARRIVAL` (`arrival_berth_id`),
KEY `FK_SHIPCALL_BERTH_DEPARTURE` (`departure_berth_id`),
KEY `idx_shipcall_type` (`type`),
KEY `idx_shipcall_eta` (`eta`),
KEY `idx_shipcall_etd` (`etd`),
KEY `FK_SHIPCALL_PORT_idx` (`port_id`),
CONSTRAINT `FK_SHIPCALL_BERTH_ARRIVAL` FOREIGN KEY (`arrival_berth_id`) REFERENCES `berth` (`id`),
CONSTRAINT `FK_SHIPCALL_BERTH_DEPARTURE` FOREIGN KEY (`departure_berth_id`) REFERENCES `berth` (`id`),
CONSTRAINT `FK_SHIPCALL_PORT` FOREIGN KEY (`port_id`) REFERENCES `port` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `FK_SHIPCALL_SHIP` FOREIGN KEY (`ship_id`) REFERENCES `ship` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2789 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Incoming, outgoing or moving to another berth';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shipcall_participant_map`
--
DROP TABLE IF EXISTS `shipcall_participant_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `shipcall_participant_map` (
`id` int NOT NULL AUTO_INCREMENT,
`shipcall_id` int unsigned DEFAULT NULL,
`participant_id` int unsigned DEFAULT NULL,
`type` int unsigned DEFAULT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_MAP_PARTICIPANT_SHIPCALL` (`shipcall_id`),
KEY `FK_MAP_SHIPCALL_PARTICIPANT` (`participant_id`),
CONSTRAINT `FK_MAP_PARTICIPANT_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`) ON DELETE SET NULL,
CONSTRAINT `FK_MAP_SHIPCALL_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8933 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Associates a participant with a shipcall';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shipcall_tug_map`
--
DROP TABLE IF EXISTS `shipcall_tug_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `shipcall_tug_map` (
`id` int NOT NULL AUTO_INCREMENT,
`shipcall_id` int unsigned NOT NULL COMMENT 'Ref to ship call',
`ship_id` int unsigned NOT NULL COMMENT 'Ref to ship (that is a tug)',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_SCT_SHIP` (`ship_id`),
KEY `FK_SCT_SHIPCALL` (`shipcall_id`),
CONSTRAINT `FK_SCT_SHIP` FOREIGN KEY (`ship_id`) REFERENCES `ship` (`id`),
CONSTRAINT `FK_SCT_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Mapping table that assigns tugs to a ship call';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `times`
--
DROP TABLE IF EXISTS `times`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `times` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`eta_berth` datetime DEFAULT NULL,
`eta_berth_fixed` bit(1) DEFAULT NULL,
`etd_berth` datetime DEFAULT NULL,
`etd_berth_fixed` bit(1) DEFAULT NULL,
`lock_time` datetime DEFAULT NULL,
`lock_time_fixed` bit(1) DEFAULT NULL,
`zone_entry` datetime DEFAULT NULL,
`zone_entry_fixed` bit(1) DEFAULT NULL,
`operations_start` datetime DEFAULT NULL,
`operations_end` datetime DEFAULT NULL,
`remarks` varchar(512) DEFAULT NULL,
`shipcall_id` int unsigned NOT NULL,
`participant_id` int unsigned NOT NULL,
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`berth_id` int unsigned DEFAULT NULL,
`berth_info` varchar(512) DEFAULT NULL,
`pier_side` bit(1) DEFAULT NULL,
`participant_type` int unsigned DEFAULT NULL,
`ata` datetime DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATA',
`atd` datetime DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATD',
`eta_interval_end` datetime DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.',
`etd_interval_end` datetime DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.',
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_shipcall_participant` (`shipcall_id`,`participant_type`),
KEY `FK_TIME_SHIPCALL` (`shipcall_id`),
KEY `FK_TIME_PART` (`participant_id`) /*!80000 INVISIBLE */,
KEY `FK_TIME_BERTH` (`berth_id`) /*!80000 INVISIBLE */,
KEY `idx_times_eta_berth` (`eta_berth`),
KEY `idx_times_etd_berth` (`etd_berth`),
CONSTRAINT `FK_TIME_BERTH` FOREIGN KEY (`berth_id`) REFERENCES `berth` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `FK_TIME_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7863 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='the planned time for the participants work';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`participant_id` int(11) UNSIGNED DEFAULT NULL,
`id` int unsigned NOT NULL AUTO_INCREMENT,
`participant_id` int unsigned NOT NULL,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`user_name` varchar(45) DEFAULT NULL,
`user_email` varchar(128) DEFAULT NULL,
`user_phone` varchar(128) DEFAULT NULL,
`password_hash` varchar(128) DEFAULT NULL,
`api_key` varchar(256) DEFAULT NULL,
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
`notify_email` bit(1) DEFAULT NULL,
`notify_whatsapp` bit(1) DEFAULT NULL,
`notify_signal` bit(1) DEFAULT NULL,
`notify_popup` bit(1) DEFAULT NULL,
`notify_event` int DEFAULT NULL COMMENT 'Bitflag of selected notification event types that the user wants to be notified of',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `FK_USER_PART` (`participant_id`),
KEY `FK_USER_PART` (`participant_id`),
CONSTRAINT `FK_USER_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='member of a participant';
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='member of a participant';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_role_map`
--
CREATE TABLE `participant` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(128) NULL DEFAULT NULL,
`street` VARCHAR(128) NULL DEFAULT NULL,
`postal_code` VARCHAR(5) NULL DEFAULT NULL,
`city` VARCHAR(64) NULL DEFAULT NULL,
`roles` INT(10) UNSIGNED NULL DEFAULT 0 COMMENT 'Bitarray of assigned roles',
`flags` INT(10) UNSIGNED NULL DEFAULT NULL,
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='An organization taking part';
CREATE TABLE `berth` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(128) NULL DEFAULT NULL COMMENT 'Descriptive name',
`participant_id` INT(10) UNSIGNED NULL DEFAULT NULL COMMENT 'If berth belongs to a participant, reference it here',
`lock` BIT(1) NULL DEFAULT NULL COMMENT 'The lock must be used',
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
INDEX `FK_BERTH_PART` (`participant_id`),
CONSTRAINT `FK_BERTH_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`)
)
COMMENT='Berth of ship for a ship call'
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
;
CREATE TABLE `shipcall_participant_map` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`shipcall_id` int(10) unsigned DEFAULT NULL,
`participant_id` int(10) unsigned DEFAULT NULL,
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Associates a participant with a shipcall';
CREATE TABLE `shipcall_tug_map` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`shipcall_id` INT(11) UNSIGNED NOT NULL COMMENT 'Ref to ship call',
`ship_id` INT(11) UNSIGNED NOT NULL COMMENT 'Ref to ship (that is a tug)',
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
INDEX `FK_SCT_SHIP` (`ship_id`),
INDEX `FK_SCT_SHIPCALL` (`shipcall_id`),
CONSTRAINT `FK_SCT_SHIP` FOREIGN KEY (`ship_id`) REFERENCES `ship` (`id`),
CONSTRAINT `FK_SCT_SHIPCALL` FOREIGN KEY (`shipcall_id`) REFERENCES `shipcall` (`id`)
)
COMMENT='Mapping table that assigns tugs to a ship call'
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
;
CREATE TABLE `notification` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`times_id` INT(11) UNSIGNED NOT NULL COMMENT 'times record that caused the notification',
`participant_id` INT(11) UNSIGNED NOT NULL COMMENT 'participant ref',
`acknowledged` BIT(1) NULL DEFAULT b'0' COMMENT 'true if UI acknowledged',
`level` TINYINT(4) NULL DEFAULT NULL COMMENT 'severity of the notification',
`type` TINYINT(4) NULL DEFAULT NULL COMMENT 'Email/UI/Other',
`message` VARCHAR(256) NULL DEFAULT NULL COMMENT 'individual message',
`created` DATETIME NULL DEFAULT current_timestamp(),
`modified` DATETIME NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
INDEX `FK_NOT_TIMES` (`times_id`),
INDEX `FK_NOT_PART` (`participant_id`),
CONSTRAINT `FK_NOT_PART` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_NOT_TIMES` FOREIGN KEY (`times_id`) REFERENCES `times` (`id`)
)
COMMENT='An entry corresponds to an alarm given by a violated rule during times update'
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `role` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT 'unique role name',
`description` VARCHAR(255) NULL DEFAULT '0' COMMENT 'role description',
PRIMARY KEY (`id`),
UNIQUE INDEX `name` (`name`)
)
COMMENT='logical group of securables for one or more user'
DEFAULT CHARSET=utf8mb4
ENGINE=InnoDB
;
CREATE TABLE `securable` (
`id` INT(10) UNSIGNED NOT NULL,
`name` VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE INDEX `name` (`name`)
)
COMMENT='Actual permission on a single(!) feature or operation'
DEFAULT CHARSET=utf8mb4
ENGINE=InnoDB
;
DROP TABLE IF EXISTS `user_role_map`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_role_map` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` INT(10) UNSIGNED NOT NULL DEFAULT 0,
`role_id` INT(10) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
INDEX `FK_USER_ROLE` (`user_id`),
INDEX `FK_ROLE_USER` (`role_id`),
CONSTRAINT `FK_ROLE_USER` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `FK_USER_ROLE` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
)
COMMENT='Assigns a user to a role'
DEFAULT CHARSET=utf8mb4
ENGINE=InnoDB
;
`id` int unsigned NOT NULL AUTO_INCREMENT,
`user_id` int unsigned NOT NULL DEFAULT '0',
`role_id` int unsigned NOT NULL DEFAULT '0',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_USER_ROLE` (`user_id`),
KEY `FK_ROLE_USER` (`role_id`),
CONSTRAINT `FK_ROLE_USER` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `FK_USER_ROLE` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Assigns a user to a role';
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE TABLE `role_securable_map` (
`id` INT(10) UNSIGNED NOT NULL,
`role_id` INT(10) UNSIGNED NOT NULL,
`securable_id` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
INDEX `FK_ROLE_SECURABLE` (`role_id`),
INDEX `FK_SECURABLE_ROLE` (`securable_id`),
CONSTRAINT `FK_ROLE_SECURABLE` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `FK_SECURABLE_ROLE` FOREIGN KEY (`securable_id`) REFERENCES `securable` (`id`)
)
COMMENT='Assigns securables to roles'
DEFAULT CHARSET=utf8mb4
ENGINE=InnoDB
;
--
-- Dumping routines for database 'bremen_calling_test'
--
/*!50003 DROP PROCEDURE IF EXISTS `delete_data` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`ds`@`localhost` PROCEDURE `delete_data`()
BEGIN
DECLARE shipcall_id_var int;
DECLARE done INT DEFAULT FALSE;
DECLARE shipcall_iter CURSOR FOR
SELECT shipcall.id FROM shipcall
LEFT JOIN times ON
times.shipcall_id = shipcall.id AND times.participant_type = 8
WHERE
-- ARRIVAL
(type = 1 AND GREATEST(shipcall.eta, COALESCE(times.eta_berth, 0)) <= CURRENT_DATE() - INTERVAL 1 MONTH) OR
-- DEPARTURE / SHIFTING
(type != 1 AND GREATEST(shipcall.etd, COALESCE(times.etd_berth, 0)) <= CURRENT_DATE() - INTERVAL 1 MONTH);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN shipcall_iter;
delete_loop: LOOP
FETCH shipcall_iter INTO shipcall_id_var;
IF done THEN
LEAVE delete_loop;
END IF;
DELETE FROM shipcall_participant_map WHERE shipcall_id = shipcall_id_var;
DELETE FROM shipcall_tug_map WHERE shipcall_id = shipcall_id_var;
DELETE FROM times WHERE shipcall_id = shipcall_id_var;
DELETE FROM history WHERE shipcall_id = shipcall_id_var;
DELETE FROM shipcall WHERE id = shipcall_id_var;
END LOOP;
CLOSE shipcall_iter;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-11-17 8:26:36

67
misc/disclaimer.html Normal file
View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="de">
<head>
<title>Information gemäß Art. 13 und Art. 14 DSGVO für Auftraggeber Software BremenCalling</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Information gemäß Art. 13 und Art. 14 DSGVO für Auftraggeber
Software BremenCalling</h1>
<hr />
Hier erhalten Sie Informationen gem. Art. 13 DSGVO über unseren Umgang mit Ihren Daten, wenn Sie die von uns betriebene Software „Bremen Calling“ nutzen.
<p>
<span style="text-decoration:underline;">Verantwortlicher:</span>
</p>
<p>
BREMER SCHIFFSMELDEDIENST Kapt. P. Langbein e.K.<br />
Vertreten durch die Geschäftsführer Bastian Güttner und Benjamin Wiese<br />
Hafenkopf II / Überseetor 20, 28217 Bremen / Germany<br />
Tel. +49 (0) 421 38 48 27<br />
E-Mail : report@bsmd.de<br />
</p>
<h2>Zweck der Datenverarbeitung:</h2>
<ul>
<li>Bereitstellung der Software „Bremen Calling“ zur Nutzung für Kunden und Auftraggeber</li>
</ul>
<h2>Rechtsgrundlage für die Datenverarbeitung:</h2>
Art. 6 Abs. 1 lit. b DSGVO (Vertrag, vorvertragliche Maßnahmen auf Anfrage der betroffenen Person)
<h2>Berechtigte Interesse des Verantwortlichen:</h2>
Hier nicht einschlägig.
<h3>Wozu benötigen wir Ihre Daten? („Hintergründe für die Bereitstellung der Daten“):</h3>
Wenn Sie unsere Software nutzen möchten, müssen wir Sie als Benutzer einrichten. Dies geschieht auf der Grundlage Ihrer (firmenbezogenen) E-Mail-Adresse und Ihres Namens.
<h3>Holen wir bei anderen Stellen außer bei Ihnen selber Informationen über Sie ein?</h3>
Nein.
<h3>Empfänger der Daten:</h3>
Wir verarbeiten Ihre Daten nur innerhalb des BSMD.
<h3>Übermittlung in Drittländer:</h3>
Eine Übermittlung Ihrer Daten in Staaten außerhalb der EU findet nicht statt.
<h3>Dauer der Speicherung:</h3>
Wir speichern Ihre Daten, solange wie Ihr Vertrag zur Nutzung unserer Software mit Ihnen besteht. Nach dem Ende unserer Geschäftsbeziehung stellen wir Ihre Benutzerdaten inaktiv und löschen sie nach sechs Monaten. Wir erarbeiten derzeit ein Löschkonzept, das ein systematisches Löschen von personenbezogenen Daten ermöglicht.
<h3>Ihre Rechte in Bezug auf Ihre Daten:</h3>
<p>
Sie können von uns Auskunft verlangen ob wir persönliche Daten von Ihnen speichern, und wenn ja, welche das sind und was wir damit tun (Art. 15 DSGVO).
</p>
<p>
Sollten wir unrichtige oder unvollständige Daten von Ihnen haben, können Sie die Berichtigung dieser Daten verlangen (Art. 16 DSGVO).
</p>
<p>
Sie können auch die Löschung Ihrer Daten verlangen (Art. 17 DSGVO). Es kann jedoch Gründe geben, aus denen wir Ihre Daten trotz Ihres Wunsches nicht löschen dürfen oder löschen müssen. Diese Gründe bestimmt das Gesetz. Wenn Sie von uns die Löschung Ihrer Daten verlangen, werden wir prüfen, ob möglicherweise solche Gründe vorliegen. Wenn nicht, löschen wir Ihre Daten. Die Alternative zur Löschung Ihrer Daten ist in bestimmten Fällen die Einschränkung der Verarbeitung Ihrer personenbezogenen Daten (Art. 18 DSGVO). Auch dabei gilt: lassen Sie uns wissen, wie Sie verfahren wollen, dann prüfen wir die gesetzlichen Vorgaben und finden einen Weg, der Ihre und unsere Interessen ausgleicht.
</p>
<p>
Art. 20 DSGVO sieht vor, dass wir Ihnen in bestimmten Fällen Ihre persönlichen Daten in einem strukturierten, gängigen und maschinenlesbaren Format zur Verfügung stellen müssen, wenn Sie es wünschen.
</p>
<p>
Möchten Sie von Ihren hier beschriebenen Rechten Gebrauch machen, genügt eine E-Mail an bremencalling@bsmd.de.
</p>
<p>
Wenn Sie der Meinung sind, dass wir die Datenschutzvorgaben für die Verarbeitung Ihrer Daten auf diesen Webseiten nicht einhalten, können Sie sich bei einer Datenschutz-Aufsichtsbehörde beschweren. Eine Liste der in Deutschland zuständigen Datenschutz-Aufsichtsbehörden finden Sie hier:
<a href="https://www.bfdi.bund.de/DE/Infothek/Anschriften_Links/anschriften_links-node.html">https://www.bfdi.bund.de/DE/Infothek/Anschriften_Links/anschriften_links-node.html</a>.
</p>
<hr />
<h4>
Stand dieser Datenschutzinformationen: April 2024
</h4>
</body>

BIN
misc/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

11
misc/index.html Normal file
View File

@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Bremen Calling</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
</body>
</html>

View File

@ -1,478 +0,0 @@
openapi: '3.0.0'
info:
version: '1.0.0'
title: 'Bremen calling API'
description: Administer DEBRE ship calls, times and notifications
termsOfService: "https://www.bsmd.de/" # url to terms page
contact:
name: "Bremen calling API"
url: "https://www.textbausteine.net"
email: "info@textbausteine.net"
license:
name: "Use at your own risk"
url: "https://www.bsmd.de/license"
servers:
# tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step3_servers_object.html
- url : "https://puls200.dyn-dns.org:8088/brecal/api"
description: "Test server self-hosted by yours truly"
paths:
# tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step4_paths_object.html
/verify:
get:
summary: Returns a session key if successful
responses:
200:
description: Successful response
content:
application/json:
schema:
title: Session key
type: string
400:
$ref: '#/components/responses/400'
403:
$ref: '#/components/responses/403'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
/shipcalls:
get:
summary: Gets a list of ship calls
parameters:
- name: participant_id
in: query
required: true
description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls"
schema:
type: integer
responses:
200:
description: ship call list
content:
application/json:
schema:
$ref: '#/components/schemas/shipcalls'
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
post:
summary: Create a new ship call
requestBody:
description: Creates a new ship call. **Do not** provide id parameter.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/shipcall'
responses:
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
put:
summary: Updates a ship call
requestBody:
description: Creates a new ship call. The id parameter is **required**.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/shipcall'
responses:
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
/ships:
get:
summary: gets a list of registered shipcalls
responses:
200:
description: list of ships
content:
application/json:
schema:
$ref: '#/components/schemas/ship_list'
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
/participant:
get:
summary: gets a particular participant entry corresponding to user id
parameters:
- name: user_id
in: query
required: true
description: "**Id of user**. *Example: 2*. User id returned by verify call."
schema:
type: integer
responses:
200:
description: ship call list
content:
application/json:
schema:
$ref: '#/components/schemas/participant'
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
/times:
get:
summary: Get all recorded times for a a ship call
parameters:
- name: shipcall_id
in: query
description: "**Id**. *Example: 42*. Id of referenced ship call."
schema:
type: integer
responses:
200:
description: list of recorded times
content:
application/json:
schema:
$ref: '#/components/schemas/times_list'
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
post:
summary: Create a new times entry for a ship call
requestBody:
description: Times entry that will be added to the ship call. **Do not** provide id parameter.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/times'
responses:
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
put:
summary: Update a times entry for a ship call
requestBody:
description: Times entry that will be added to the ship call. The id parameter is **required**.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/times'
responses:
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
delete:
summary: Delete a times entry for a ship call.
parameters:
- name: id
in: query
required: true
schema:
$ref: '#/components/schemas/timesId'
responses:
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
/notifications:
get:
summary: Gets a list of notifications pursuant to a specified participant and ship call
parameters:
- name: participant_id
in: query
required: true
description: "**Id of participant**. *Example: 2*. Id returned through loading of participant"
schema:
type: integer
- name: shipcall_id
in: query
required: true
description: "**Id of ship call**. *Example: 52*. Id given in ship call list"
schema:
$ref: '#/components/schemas/shipcallId'
responses:
200:
description: notification list
content:
application/json:
schema:
$ref: '#/components/schemas/notification'
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
/berths:
get:
summary: Gets a list of all berths registered
responses:
200:
description: list of berths
content:
application/json:
schema:
$ref: '#/components/schemas/berth_list'
400:
$ref: '#/components/responses/400'
401:
$ref: '#/components/responses/401'
500:
$ref: '#/components/responses/500'
503:
$ref: '#/components/responses/503'
components:
schemas:
timesId:
description: The unique identifier for a times entry
type: integer
shipcallId:
description: The unique identifier of a ship call
type: integer
shipcall:
type: object
required:
- id
- ship_id
- type
- eta
- voyage
- etd
properties:
id:
$ref: '#/components/schemas/shipcallId'
type:
type: string
enum:
- incoming
- outgoing
- shifting
description:
type: string
shipcalls:
type: array
items:
$ref: '#/components/schemas/shipcall'
times:
type: object
description: the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated
required:
- shipcall_id
- participant_id
properties:
id:
type: integer
start_planned:
type: string
format: date-time
end_planned:
type: string
format: date-time
duration_planned:
type: integer
start_actual:
type: string
format: date-time
end_actual:
type: string
format: date-time
shipcall_id:
type: integer
participant_id:
type: integer
times_list:
type: array
items:
$ref: '#/components/schemas/times'
berth:
type: object
description: Ship berth used for a ship call
properties:
id:
type: integer
name1:
type: string
name2:
type: string
berth_list:
type: array
items:
$ref: '#/components/schemas/berth'
ship:
type: object
description: a ship
properties:
id:
type: integer
name:
type: string
imo:
type: integer
callsign:
type: string
length:
type: number
format: float
width:
type: number
format: float
created:
type: string
format: date-time
modified:
type: string
format: date-time
ship_list:
type: array
items:
$ref: '#/components/schemas/ship'
notification:
type: object
description: a notification created by the engine if a times entry violates a rule
properties:
id:
type: integer
times_id:
type: integer
participant_id:
type: integer
notification_type:
type: string
enum: [undefined, email, push]
timestamp:
type: string
format: date-time
acknowledged:
type: boolean
notification_list:
type: array
items:
$ref: '#/components/schemas/notification'
participant:
type: object
description: A organisational entity that participates in Bremen Calling
properties:
id:
type: integer
name:
type: string
street:
type: string
postal code:
type: string
city:
type: string
Error:
type: object
required:
- message
properties:
message:
description: A human readable error message
type: string
securitySchemes:
ApiKey:
type: apiKey
in: header
name: X-Api-Key
responses:
400:
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
401:
description: Not authorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
500:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
503:
description: Not available
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- ApiKey: []
externalDocs:
url: http://textbausteine.net/
description: Extra documentation and conditions for Bremen Calling

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

113
misc/notifications.md Normal file
View File

@ -0,0 +1,113 @@
# Benachrichtigungen
___
## Benachrichtigungs-Typen (Auslöser)
### 1. Teilnehmer wird zugeordnet
Ein Teilnehmer wird über die Anwendung einem Anlauf zugeordnet. Dies ist entweder die Agentur (durch BSMD zugeordnet) oder ein weiterer Teilnehmer außer dem Hafenamt, der durch die Agentur zugeordnet wird. Die Zuordnung des Hafenamts erfolgt automatisch bei Anlage des Anlaufs.
### 2. Morgenrunde ist relevant
Ein Teilnehmer ist einem Anlauf zugeordnet. Dieser Anlauf findet in den nächsten 24 Stunden statt und ist daher für die "Morgenrunde" relevant. Der Teilnehmer erhält dazu eine Benachrichtigung.
### 3. Zeitlicher Konflikt ("Ampel")
Durch unterschiedliche Zeitangaben der Teilnehmer wird die Ampel ausgelöst und stellt eine entsprechende Fehlermeldung dar. Die Benachrichtigung wird ausgelöst bei folgenden Ampel-Wechseln:
* grün -> gelb
* grün -> rot
* gelb -> rot
### 4. Auflösung zeitl. Konflikt
* rot -> gelb
* rot -> grün
* gelb -> grün
### 5. Abwählen eines Teilnehmer
Der Teilnehmer ist nicht mehr länger dem Anlauf zugeordnet.
### 6. Fehlende Daten
Dienstleister, die 16 Stunden vor ETA/ETD und Agenturen, die 20 Stunden vor ETA/ETD keine Angaben gemacht haben.
### 7. Storno
Wird ein Anlauf storniert erhalten alle bis dahin zugeordneten Teilnehmer eine Benachrichtigung.
## API
```yaml
NotificationType:
type: string
description: Type of notification
enum:
- assignment
- next24h
- time_conflict
- time_conflict_resolved
- unassigned
- missing_data
- cancelled
```
## Entfernen von Benachrichtigungen
Unter den folgenden Voraussetzungen werden Benachrichtigungen wieder aus dem System entfernt:
* Die Benachrichtigung ist älter als 3 Tage (n.B.: Zeitraum definieren)
* Ein Teilnehmer wird wieder abgewählt
* Ein zeitlicher Konflikt wird aufgelöst
## Ablauf der Benachrichtigungen
Eine Benachrichtung enthält folgende Informationen:
* Verweis auf den Anlauf (shipcall)
* ein Erstell- und Änderungsdatum
* einen Benachrichtigungs-Typ
* einen Zustand ("level")
Der Zustand steuert den Ablauf, wenn die Prüfungsfunktion die Anläufe durchsucht oder ein Anlauf gespeichert wird.
Wird einer der Zustände 1-3 erkannt wird geprüft, ob bereits eine Benachrichtigung vorhanden ist. Ist dies nicht der Fall, wird eine Benachrichtigung neu erstellt im Zustand "0".
Die Prüfungsfunktion durchläuft alle Benachrichtigungen. Abhängig vom Zustand (0-2) werden folgende Aktionen ausgeführt:
* Ist die Benachrichtigung um Zustand "0" und sind mind. 10 Minuten vergangen, wird die Benachrichtigung in den Zustand "1" versetzt.
* Ist die Benachrichtigung im Zustand "1" wird versucht, allen dafür eingetragenenen Benutzern eine E-Mail zu senden. Ist dies erfolgreich, wechselt die Benachrichtigung in den Zustand "2".
* Ist die Benachrichtigung im Zustand "2" und sind mind. 3 Tage vergangen wird die Benachrichtigung gelöscht.
```mermaid
---
title: Ablauf
---
stateDiagram-v2
state "Level 0" as lvl0
state "Level 1" as lvl1
state "Level 2" as lvl2
[*] --> lvl0: Zustand 1-3 erkannt
lvl0 --> lvl1: +10 min.
lvl1 --> lvl2: E-Mail Versand erfolgt
lvl2 --> [*]: +3 Tage ODER Zustand 1-3 nicht mehr relevant
lvl0 --> [*]: Zustand 1-3 nicht mehr relevant
```
## Bemerkungen
Für die Zukunft sind ggf. auch Benachrichtigungen via Whatsapp/Signal geplant. Diese verhalten sich analog zu den E-Mail Benachrichtigungen und werden nur einmal versendet. Die Anzahl der Zustände wird dabei erhöht bzw. der Wechsel in den Endzustand ensprechend angepasst.
## Benachrichtigungstext
... TBD

14
misc/product_codes.txt Normal file
View File

@ -0,0 +1,14 @@
Bremen calling Installer Upgrade Codes:
======================================
Test: 1C7FA3E4-BAB9-4911-9348-73094357FC7C
Prod: 81A329F1-C663-48DA-9E15-DAF19F99B5AE
Product codes v1.2.2.3:
Test: 6F89CBAA-2189-456F-A347-0C0158325B61
Prod: 0ED342DD-DC00-4CE4-8348-96BB3AB726B1
Note:
If you want the MSI to "upgrade" from one version to the other, the
upgrade code must stay the same and the product code must change.

37
misc/requirements.txt Normal file
View File

@ -0,0 +1,37 @@
bcrypt==4.2.0
blinker==1.8.2
cached-property==1.5.2
click==8.1.7
coro-context-manager==0.2.0
coverage==7.6.1
dsnparse==0.1.15
Flask==3.0.3
Flask-JWT-Extended==4.6.0
iniconfig==2.0.0
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
marshmallow==3.22.0
marshmallow-enum==1.5.1
marshmallow_dataclass==8.7.1
mypy-extensions==1.0.0
mysql-connector-python==9.0.0
numpy==2.1.1
packaging==24.1
pandas==2.2.3
pluggy==1.5.0
pydapper==0.10.0
PyJWT==2.9.0
pytest==8.3.3
pytest-cov==5.0.0
python-dateutil==2.9.0.post0
pytz==2024.2
schedule==1.2.2
six==1.16.0
tqdm==4.66.5
typeguard==4.3.0
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.1
webargs==8.6.0
Werkzeug==3.0.4

153
misc/sample_data.sql Normal file

File diff suppressed because one or more lines are too long

192
misc/sample_static_data.sql Normal file
View File

@ -0,0 +1,192 @@
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server Version: 8.0.34-0ubuntu0.22.04.1 - (Ubuntu)
-- Server Betriebssystem: Linux
-- HeidiSQL Version: 10.2.0.5599
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Exportiere Daten aus Tabelle bremen_calling_test.berth: ~59 rows (ungefähr)
/*!40000 ALTER TABLE `berth` DISABLE KEYS */;
INSERT INTO `berth` (`id`, `name`, `lock`, `owner_id`, `authority_id`, `created`, `modified`, `deleted`) VALUES
(1, 'Roland Mühle', NULL, NULL, 11, '2023-06-26 14:01:40', '2023-10-06 15:04:08', b'1'),
(2, 'Stahlwerk', NULL, NULL, 11, '2023-06-26 14:01:40', '2023-10-06 15:04:08', b'1'),
(3, 'Kellogs', NULL, NULL, 11, '2023-06-26 14:01:40', '2023-10-06 15:04:08', b'1'),
(139, 'Avangard Dalben', NULL, 110, 136, '2023-08-21 08:23:35', '2023-10-06 16:06:01', b'0'),
(140, 'Avangard Kaje', NULL, 110, 11, '2023-08-21 08:23:35', '2023-10-06 15:04:08', b'0'),
(141, 'Baustelle 2', NULL, 111, 11, '2023-08-21 08:23:35', '2023-10-06 15:04:08', b'0'),
(142, 'BHW', NULL, 112, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(143, 'Dalben 2', NULL, 111, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(144, 'Dalben 3', NULL, 111, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(145, 'Egerland Kaje', NULL, 113, 11, '2023-08-21 08:23:36', '2023-10-06 15:04:08', b'0'),
(146, 'Getreideanlage Pier A', NULL, 114, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(147, 'Getreideanlage Pier D', NULL, 114, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(148, 'Griepe, Bnp Paribas', NULL, 115, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(149, 'Hafen F', NULL, 116, 11, '2023-08-21 08:23:37', '2023-10-06 15:04:08', b'0'),
(150, 'Hansa Landhandel', NULL, 117, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(151, 'Hansa Melasse', NULL, 118, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(152, 'Hansa-Mühle', NULL, 119, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(153, 'Heidelberger Sand', NULL, 120, 11, '2023-08-21 08:23:38', '2023-10-06 15:04:08', b'0'),
(154, 'HGM Bunkerstation', NULL, 121, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(155, 'HGM Tanklager', NULL, 121, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(156, 'Kap Horn Innen', NULL, 122, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(157, 'Kap Horn Weser', NULL, 122, 11, '2023-08-21 08:23:39', '2023-10-06 15:04:08', b'0'),
(158, 'Kap Horn Weser Bremer Recycling', NULL, 123, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(159, 'Kap Horn Weser -GHK-', NULL, 124, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(160, 'Kohlenhafen 2', NULL, 111, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(161, 'Kraftwerk Farge', NULL, 125, 11, '2023-08-21 08:23:40', '2023-10-06 15:04:08', b'0'),
(162, 'Kraftwerk Industriehafen', NULL, 126, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(163, 'Lankenau B', NULL, 111, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(164, 'Mibau, Bnp Paribas', NULL, 127, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(165, 'Müller Weser', NULL, 114, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(166, 'Osterort 5 Aussen', NULL, 111, 11, '2023-08-21 08:23:41', '2023-10-06 15:04:08', b'0'),
(167, 'Pier 2 Anleger', NULL, 128, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(168, 'Pier III', NULL, 129, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(169, 'Plump', NULL, 130, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(170, 'Rolandmühle', NULL, 131, 11, '2023-08-21 08:23:42', '2023-10-06 15:04:08', b'0'),
(171, 'Schleusenvorhafen Nord', NULL, 111, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(172, 'Schrägpier', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(173, 'Schuppen 19', NULL, 132, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(174, 'Schuppen 20', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(175, 'Schuppen 21', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(176, 'Schuppen 22', NULL, 4, 11, '2023-08-21 08:23:43', '2023-10-06 15:04:08', b'0'),
(177, 'Schuppen 23', NULL, 4, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(178, 'Schuppen 24', NULL, 4, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(179, 'Seedalben Dlg-Seite', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(180, 'Seedalben Kw-Seite', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(181, 'Seehausen Spüler', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(182, 'Tankschiffliegeplatz 1', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(183, 'Tankschiffliegeplatz 2', NULL, 111, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(184, 'Terminal 1', NULL, 10, 11, '2023-08-21 08:23:44', '2023-10-06 15:04:08', b'0'),
(185, 'Terminal 2', NULL, 10, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(186, 'Terminal 3', NULL, 10, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(187, 'Terminal 4', NULL, 10, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(188, 'TSR Recycling', NULL, 133, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(189, 'Viehbrücke', NULL, 111, 11, '2023-08-21 08:23:45', '2023-10-06 15:04:08', b'0'),
(190, 'Vulkan Industriegebiet', NULL, 120, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(191, 'Weserbahnhof', NULL, 132, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(192, 'Weser-Petrol Holzhafen', NULL, 134, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(193, 'Weser-Petrol Kalihafen', NULL, 134, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0'),
(194, 'Wesertanking', NULL, 135, 11, '2023-08-21 08:23:46', '2023-10-06 15:04:08', b'0');
/*!40000 ALTER TABLE `berth` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.participant: ~40 rows (ungefähr)
/*!40000 ALTER TABLE `participant` DISABLE KEYS */;
INSERT INTO `participant` (`id`, `name`, `street`, `postal_code`, `city`, `type`, `flags`, `created`, `modified`, `deleted`) VALUES
(1, 'Schick Informatik', 'Gottlieb-Daimler-Str. 8', '73614', 'Schorndorf', 1, 42, '2023-04-17 07:18:19', '2023-08-24 07:07:02', b'0'),
(2, 'Lotsenbrüderschaft Weser 1', '', '', '', 4, 0, '2023-08-10 07:07:41', NULL, b'0'),
(3, 'Bremer Schiffsmeldedienst', 'Hafenkopf II / Überseetor 20', '28217', 'Bremen', 1, 0, '2023-08-10 07:11:10', NULL, b'0'),
(4, 'BLG Cargo Logistics GmbH', '', '', '', 2, 0, '2023-08-10 07:14:40', NULL, b'0'),
(5, 'Schiffsmakler-Verband für Küsten und Seeschiffsbefrachter e.V.', '', '', '', 8, 0, '2023-08-10 07:15:56', NULL, b'0'),
(6, 'RMS Rhenus Maritime Services GmbH', '', '', '', 8, 1, '2023-08-10 07:19:29', '2023-09-06 09:02:53', b'0'),
(7, 'J.MÜLLER Weser GmbH & Co. KG', '', '', '', 10, 0, '2023-08-10 07:21:43', '2023-08-10 08:47:59', b'0'),
(8, 'Schiffahrtskontor Detra GmbH & Co.KG', '', '', '', 8, 0, '2023-08-10 07:23:04', NULL, b'0'),
(9, 'Boluda Deutschland GmbH', '', '', '', 64, 0, '2023-08-10 07:24:18', NULL, b'0'),
(10, 'Weserport GmbH', '', '', '', 10, 0, '2023-08-10 07:26:42', '2023-08-10 08:48:19', b'0'),
(11, 'Port Authority Bremen', '', '', '', 32, 0, '2023-08-10 07:28:11', NULL, b'0'),
(12, 'Nordenia Frachtkontor GmbH', '', '', '', 8, 0, '2023-08-21 06:52:04', NULL, b'0'),
(15, 'Extern', '', '', '', 0, 0, '2023-08-21 06:55:18', NULL, b'0'),
(16, 'FESTMA Vertäugesellschaft mbH', '', '', '', 16, 0, '2023-08-21 06:57:23', NULL, b'0'),
(110, 'Avangard', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:35', '2023-08-21 10:04:21', b'0'),
(111, 'Bremenports', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:35', '2023-08-21 10:04:21', b'0'),
(112, 'Bremer Holzwerke', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:36', '2023-08-21 10:04:21', b'0'),
(113, 'Egerland', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:36', '2023-08-21 10:04:21', b'0'),
(114, 'Müller J. Bremen', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:37', '2023-08-21 10:04:21', b'0'),
(115, 'Griepe', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:37', '2023-08-21 10:04:21', b'0'),
(116, 'Mseven Real Estate', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:37', '2023-08-21 10:04:21', b'0'),
(117, 'Hansa Landhandel', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(118, 'Hansa Melasse', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(119, 'Hansa-Mühle', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(120, 'Heidelberger Sand Und Kies Gmbh', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:38', '2023-08-21 10:04:21', b'0'),
(121, 'HGM', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:39', '2023-08-21 10:04:21', b'0'),
(122, 'Kap-Horn Logistics Gmbh', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:39', '2023-08-21 10:04:21', b'0'),
(123, 'Bremer Recycling Kontor', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:39', '2023-08-21 10:04:21', b'0'),
(124, 'GHK', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:40', '2023-08-21 10:04:21', b'0'),
(125, 'Kraftwerk Farge Engie Gmbh & Co. KG', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:40', '2023-08-21 10:04:21', b'0'),
(126, 'Swb Erzeugung', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:40', '2023-08-21 10:04:21', b'0'),
(127, 'Mibau', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:41', '2023-08-21 10:04:21', b'0'),
(128, 'SWG', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:41', '2023-08-21 10:04:21', b'0'),
(129, 'Umweltschutz Nord Ganderkesee', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:42', '2023-08-21 10:04:21', b'0'),
(130, 'Nehlsen Industrieservice Gmbh & Co. KG', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:42', '2023-08-21 10:04:21', b'0'),
(131, 'Rolandmühle', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:42', '2023-08-21 10:04:21', b'0'),
(132, 'Wfb', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:43', '2023-08-21 10:04:21', b'0'),
(133, 'TSR', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:45', '2023-08-21 10:04:21', b'0'),
(134, 'Weser-Petrol', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:46', '2023-08-21 10:04:21', b'0'),
(135, 'Wesertanking', NULL, NULL, NULL, 2, 0, '2023-08-21 08:23:46', '2023-08-21 10:04:21', b'0'),
(136, 'TEST_BSMD', 'Überseetor 20', '28217', 'Bremen', 127, 1, '2023-10-04 11:54:36', '2023-10-13 11:37:51', b'0');
/*!40000 ALTER TABLE `participant` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.role: ~2 rows (ungefähr)
/*!40000 ALTER TABLE `role` DISABLE KEYS */;
INSERT INTO `role` (`id`, `name`, `description`, `created`, `modified`) VALUES
(1, 'My first role', 'A very good description', '2023-04-17 07:31:57', NULL),
(2, 'Another role', 'This role is very nice as well', '2023-04-17 07:32:12', NULL);
/*!40000 ALTER TABLE `role` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.securable: ~2 rows (ungefähr)
/*!40000 ALTER TABLE `securable` DISABLE KEYS */;
INSERT INTO `securable` (`id`, `name`, `created`, `modified`) VALUES
(1, 'First secure thing', '2023-04-17 07:38:12', NULL),
(2, 'Another secure thing', '2023-04-17 07:38:22', NULL);
/*!40000 ALTER TABLE `securable` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.ship: ~12 rows (ungefähr)
/*!40000 ALTER TABLE `ship` DISABLE KEYS */;
INSERT INTO `ship` (`id`, `name`, `imo`, `callsign`, `participant_id`, `length`, `width`, `is_tug`, `bollard_pull`, `eni`, `created`, `modified`, `deleted`) VALUES
(1, 'Dicke Berta', 1234567, 'DEBE', 1, 100, 20, b'0', NULL, NULL, '2023-06-27 10:43:02', NULL, b'0'),
(2, 'Maersk Neston', 9632167, '9V3532', 1, 210.07, 30.2, b'0', NULL, NULL, '2023-07-27 12:34:13', NULL, b'0'),
(3, 'AFRICAN HALCYON', 9343613, NULL, NULL, 177.13, 28.4, b'0', NULL, NULL, '2023-08-24 10:41:56', NULL, b'0'),
(4, 'AMIKO', 9125669, NULL, NULL, 99.98, 16.5, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(5, 'ARKLOW BEACON', 9638795, NULL, NULL, 119.49, 14.99, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(6, 'FWN ATLANTIDE', 9535620, NULL, NULL, 145.65, 18.25, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(7, 'IONIAN SPIRIT', 9747235, NULL, NULL, 179.9, 30, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(8, 'IRMA', 9180396, NULL, NULL, 199.9, 23.6, b'0', NULL, NULL, '2023-08-24 10:42:17', NULL, b'0'),
(9, 'JANA', 9330185, NULL, NULL, 69.34, 12, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(10, 'MEDI PERTH', 9804552, NULL, NULL, 199.99, 32.24, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(11, 'S NEPTUNE', 9634892, NULL, NULL, 169.99, 27, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(12, 'WESER STAHL', 9186687, NULL, NULL, 192, 32.26, b'0', NULL, NULL, '2023-08-24 10:42:18', NULL, b'0'),
(13, 'BOTHNIABORG', 9267728, 'PBIO', NULL, 153.05, 21.8, b'0', NULL, NULL, '2023-10-04 11:52:32', NULL, b'0');
/*!40000 ALTER TABLE `ship` ENABLE KEYS */;
-- Exportiere Daten aus Tabelle bremen_calling_test.user: ~27 rows (ungefähr)
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`id`, `participant_id`, `first_name`, `last_name`, `user_name`, `user_email`, `user_phone`, `password_hash`, `api_key`, `created`, `modified`) VALUES
(1, 1, 'Daniel', 'Schick', 'dani', NULL, NULL, '$2b$12$qfjw4b3XvGuu0t6HR8OYGOzF5b8gmC6PyIIBNbIXMXEayJunEEKmi', '0815', '2023-04-17 07:15:41', '2023-08-11 11:11:34'),
(2, 1, 'Londo', 'Mollari', 'Londo', 'l.mollari@centauri.gov', '+01 555 324 2314', '$2b$12$8r1oGQiWdiuQNoGbzm.z.OoCOc8.4YACN93k7ge7YDWKjQ8tPuTrm', NULL, '2023-06-27 08:34:55', '2023-10-28 12:04:54'),
(3, 2, 'Maik', 'Baudeck', 'maikb', NULL, NULL, '$2b$12$4SxGRlinOrpEVvqDZcE.wOusMZYsepdc6vj1vDpNhbPtApxU8VGPi', '', '2023-08-10 07:09:35', '2023-08-11 11:11:55'),
(4, 3, 'Christin', 'Hollmann', 'christinh', NULL, NULL, '$2b$12$evGJop3j19bNTkdg2GHrIeRedC7LG5SIHm8.hKhdUSrlXsp6sXBDG', '', '2023-08-10 07:12:05', '2023-10-04 11:48:13'),
(5, 3, 'Bastian', 'Güttner', 'bastiang', NULL, NULL, '$2b$12$0oCX3c2WyMykmxMoLqmpNubke713xhYlEEQgnxBV6Fj/TaUn.3/U6', '', '2023-08-10 07:12:26', '2023-08-11 11:11:13'),
(6, 3, 'Benjamin', 'Wiese', 'benjaminw', NULL, NULL, '$2b$12$RRj32KdLIf3D7z7cVWFqa.yZM5.ODOS0HqU3rdCuFrJS8HJ/rtqwy', '', '2023-08-10 07:13:01', '2023-08-11 11:11:16'),
(7, 1, 'Sladjan', 'Veselinovic', 'sladjanv', NULL, NULL, '$2b$12$4DctoCbZwxTvE39lXNRzneQ2kb/lXlJ5wEZ1CGbbw.rGM3nuAYjpa', '', '2023-08-10 07:13:39', '2023-08-11 11:11:45'),
(8, 1, 'Kersten', 'Gevers', 'kersteng', NULL, NULL, '$2b$12$zKX8iLPnXRmp5wD1Yp8P7e..U9R0A4ytbiMjd.l.IGkMzahcHPNWq', '', '2023-08-10 07:13:59', '2023-08-11 11:11:49'),
(9, 4, 'Dirk', 'Brunnert', 'dirkb', NULL, NULL, '$2b$12$HTeq/Fdfse6oElk7DLsQae5dtvWJloee.VtBH.THsj2kdcxxBkCDW', '', '2023-08-10 07:15:01', '2023-08-11 11:12:01'),
(10, 5, 'Thorsten', 'Fischer', 'thorstenf', NULL, NULL, '$2b$12$NHEpTNHuKU4ruPRIfd9yc.yv5faHGemFfRI3TISniqM7QNqHiyZpK', '', '2023-08-10 07:16:20', '2023-08-11 11:12:07'),
(11, 6, 'Lisa', 'Friedhoff', 'lisaf', NULL, NULL, '$2b$12$DJKJHGrQwfY9pwzgFfPds.DHGsygHyV3KDs38Hq4AUHPPs3jBPH3y', '', '2023-08-10 07:19:52', '2023-08-11 11:12:12'),
(12, 6, 'Dario', 'Fritschi', 'dariof', NULL, NULL, '$2b$12$MwCVTMQkN6zCAzCsE572Ye.M0nRDQNld4AgorLVyWq.DcQEmAy5lu', '', '2023-08-10 07:20:11', '2023-08-11 11:12:15'),
(13, 7, 'Hergen', 'Hanke', 'hergenh', NULL, NULL, '$2b$12$MKb6BDRrTbNd0qg5BdAS.upzlqxcWOgU/VEafJKSuzE9JLIWCimq6', '', '2023-08-10 07:22:09', '2023-08-11 11:12:24'),
(14, 8, 'Hardy', 'Paasch', 'hardyp', NULL, NULL, '$2b$12$l1lE/UqnYnOvci.N4j3zBOz6HC0z87ovnO0n6BIZYO7VN8gj.qGey', '', '2023-08-10 07:23:25', '2023-08-11 11:12:28'),
(15, 8, 'Marc', 'Pagel', 'marcp', NULL, NULL, '$2b$12$UCVJKzqX92Z8xZJ4kK0BRuFXMRdqcaXaGmBrqnYWARdKlPvZvLUZq', '', '2023-08-10 07:23:41', '2023-08-11 11:12:30'),
(16, 9, 'Andreas', 'Peukert', 'andreasp', NULL, NULL, '$2b$12$jNmciJAVR6p0IflvAthmk.j0SoOBvFHwDiEDKUHfwJq7baRsKg/LG', '', '2023-08-10 07:24:37', '2023-08-11 11:12:45'),
(17, 8, 'Christina', 'Rachiele', 'christinar', NULL, NULL, '$2b$12$BCsVgPRuIWPuuor07lprF.klQxvF901O3AXUhRrBJoEvYIjNQ.HKS', '', '2023-08-10 07:25:05', '2023-08-11 11:12:33'),
(18, 9, 'Sonia', 'Rekawek', 'soniar', NULL, NULL, '$2b$12$uHCkH6gu13yqllXBibLFIOWOpvctMC7NmojtXqDd6xsLq7bmvNOMu', '', '2023-08-10 07:25:27', '2023-08-11 11:12:48'),
(19, 6, 'Frank', 'Roelfs', 'frankr', NULL, NULL, '$2b$12$cEQAhUe9VJV6uTkfOY6/R.oAVfmFZQ4vS5G6BqoNEyaVHtFRDtB56', '', '2023-08-10 07:26:04', '2023-08-11 11:12:19'),
(20, 10, 'Vera', 'Schliedermann', 'veras', NULL, NULL, '$2b$12$FKcitW6W1HPwd.cdkZLGLeTFuzjsEIrbiKInysAKN.RibZ4gVLZHi', '', '2023-08-10 07:27:01', '2023-08-11 11:12:54'),
(21, 8, 'Michael', 'Strudthoff', 'michaels', NULL, NULL, '$2b$12$doTiywWpkso1UWB5eiAW1eoACP6rN4UDVt7qFFdRFvhhWUXikCmS2', '', '2023-08-10 07:27:27', '2023-08-11 11:12:37'),
(22, 4, 'Volker', 'Viohl', 'volkerv', NULL, NULL, '$2b$12$.YavQbWNE4eJDQA.ZNSKROYvMPWifBXyMX0IL0H2z50M720fpfTJW', '', '2023-08-10 07:27:50', '2023-08-11 11:12:04'),
(23, 11, 'Frauke', 'Zabel', 'fraukez', NULL, NULL, '$2b$12$rawQg6Cjl1yECGm9DOG8degdWdD.nZjEgGp8eXO98nh11QV1sEEEO', '', '2023-08-10 07:28:33', '2023-08-11 11:12:58'),
(24, 8, 'Jan', 'Zierow', 'janz', NULL, NULL, '$2b$12$CbnjUT42cf0mkIAqAURg3OksP9G3brmsE2GQTECTZ4.cVuhPn5D2G', '', '2023-08-10 07:28:55', '2023-08-11 11:12:39'),
(25, 12, 'Berit', 'Güstrau', 'beritg', NULL, NULL, '$2b$12$g8WJTEWwsrtMyqpVW/GFVuzyRjB2/n0YJJyvBx.3l51YiVEUjEQYy', '', '2023-08-21 06:52:35', NULL),
(26, 15, 'Ilknur', 'Colmorn', 'ilknurc', NULL, NULL, '$2b$12$tpEb0JQ8Li4YkPH28FeYk.1Jt2vK.TFn9SyhBKJ08gn7S5d8WYRlO', '', '2023-08-21 06:56:42', NULL),
(27, 16, 'Horst', 'Imgram', 'horsti', NULL, NULL, '$2b$12$05NFPSaP78puAa8pL39KrOKTafs/TzWwr4YfV4/Vrdu90assvNFZa', '', '2023-08-21 06:57:58', NULL),
(28, 136, 'Christin', 'Hollmann', 'chollmann', NULL, NULL, '$2b$12$pb1bWJ7hxOplFoqT/nIhyuRD39dxOpQ9t0LwZUI8CNOkTkE.eXiSO', '', '2023-10-04 11:55:05', NULL),
(29, 1, 'Max', 'Metz', 'maxm', NULL, NULL, '$2b$12$gm4EwjCF44Ls20vDHnlG/ew/cZ.DK4gcYed.OHER5J4OzZrA.9Jt.', '', '2023-10-06 13:02:56', '2023-10-13 11:53:35');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View File

@ -0,0 +1,95 @@
-- add notification handling columns to shipcall
-- evaluation_time: Time when the "traffic light" was last changed
-- evaluation_notifications_sent: Flag to indicate if notifications were sent for the current evaluation
ALTER TABLE `bremen_calling_devel`.`shipcall`
ADD COLUMN `evaluation_time` DATETIME NULL DEFAULT NULL AFTER `evaluation_message`,
ADD COLUMN `evaluation_notifications_sent` BIT NULL AFTER `evaluation_time`,
ADD COLUMN `time_ref_point` INT NULL DEFAULT 0 COMMENT 'Index of a location which is the reference point for all time value entries, e.g. berth or Geeste' AFTER `modified`;
-- prepare notification table for historic notification data
-- removed reference to participant and times and dropped unnecessary columns
-- added reference to shipcall
ALTER TABLE `bremen_calling_devel`.`notification`
DROP FOREIGN KEY `FK_NOT_TIMES`,
DROP FOREIGN KEY `FK_NOT_PART`;
ALTER TABLE `bremen_calling_devel`.`notification`
DROP COLUMN `deleted`,
DROP COLUMN `acknowledged`,
DROP COLUMN `participant_id`,
DROP COLUMN `times_id`,
ADD COLUMN `shipcall_id` INT UNSIGNED NULL AFTER `id`,
ADD INDEX `FK_NOTIFICATION_SHIPCALL_idx` (`shipcall_id` ASC) VISIBLE,
DROP INDEX `FK_NOT_PART` ,
DROP INDEX `FK_NOT_TIMES` ;
;
ALTER TABLE `bremen_calling_devel`.`notification`
ADD CONSTRAINT `FK_NOTIFICATION_SHIPCALL`
FOREIGN KEY (`shipcall_id`)
REFERENCES `bremen_calling_devel`.`shipcall` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
-- added notification flags
-- participant reference is now mandatory
ALTER TABLE `bremen_calling_devel`.`user`
DROP FOREIGN KEY `FK_USER_PART`;
ALTER TABLE `bremen_calling_devel`.`user`
ADD COLUMN `notify_email` BIT NULL DEFAULT NULL AFTER `api_key`,
ADD COLUMN `notify_whatsapp` BIT NULL DEFAULT NULL AFTER `notify_email`,
ADD COLUMN `notify_signal` BIT NULL DEFAULT NULL AFTER `notify_whatsapp`,
ADD COLUMN `notify_popup` BIT NULL DEFAULT NULL AFTER `notify_signal`,
CHANGE COLUMN `participant_id` `participant_id` INT UNSIGNED NOT NULL ;
ALTER TABLE `bremen_calling_devel`.`user`
ADD CONSTRAINT `FK_USER_PART`
FOREIGN KEY (`participant_id`)
REFERENCES `bremen_calling_devel`.`participant` (`id`);
-- History table for change tracking
CREATE TABLE `bremen_calling_devel`.`history` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`participant_id` INT UNSIGNED NOT NULL,
`user_id` INT UNSIGNED NOT NULL,
`shipcall_id` INT UNSIGNED NOT NULL,
`timestamp` DATETIME NOT NULL COMMENT 'Time of saving',
`eta` DATETIME NULL COMMENT 'Current ETA / ETD value (depends if shipcall or times were saved)',
`type` INT NOT NULL COMMENT 'shipcall or times',
`operation` INT NOT NULL COMMENT 'insert, update or delete',
PRIMARY KEY (`id`))
COMMENT = 'This table stores a history of changes made to shipcalls so that everyone can see who changed what and when';
-- and foreign keys
ALTER TABLE `bremen_calling_devel`.`history`
ADD INDEX `FK_HISTORY_PARTICIPANT_idx` (`participant_id` ASC) VISIBLE,
ADD INDEX `FK_HISTORY_SHIPCALL_idx` (`shipcall_id` ASC) VISIBLE;
;
ALTER TABLE `bremen_calling_devel`.`history`
ADD CONSTRAINT `FK_HISTORY_PARTICIPANT`
FOREIGN KEY (`participant_id`)
REFERENCES `bremen_calling_devel`.`participant` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD CONSTRAINT `FK_HISTORY_SHIPCALL`
FOREIGN KEY (`shipcall_id`)
REFERENCES `bremen_calling_devel`.`shipcall` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ADD CONSTRAINT `FK_HISTORY_USER`
FOREIGN KEY (`user_id`)
REFERENCES `bremen_calling_devel`.`user` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
-- add additional fields to times
ALTER TABLE `bremen_calling_devel`.`times`
ADD COLUMN `ata` DATETIME NULL DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATA' AFTER `participant_type`,
ADD COLUMN `atd` DATETIME NULL DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATD' AFTER `ata`,
ADD COLUMN `eta_interval_end` DATETIME NULL DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.' AFTER `atd`;
ADD COLUMN `etd_interval_end` DATETIME NULL DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.' AFTER `eta_interval_end`;

View File

@ -0,0 +1,57 @@
CREATE TABLE `port` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL COMMENT 'Name of port',
`locode` char(5) DEFAULT NULL COMMENT 'UNECE locode',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Port as reference for shipcalls and berths';
-- Add default port to table
INSERT INTO port (id, name, locode) VALUES (1, 'Bremen', 'DEBRE');
-- Adding new ref column to berth
ALTER TABLE `berth`
ADD COLUMN `port_id` INT UNSIGNED DEFAULT NULL AFTER `authority_id`;
ALTER TABLE `berth` ALTER INDEX `FK_AUTHORITY_PART_idx` INVISIBLE;
-- adding a foreign key berth.port_id -> port.id
ALTER TABLE `berth`
ADD INDEX `FK_PORT_PART_idx` (`port_id` ASC) VISIBLE;
ALTER TABLE `berth`
ADD CONSTRAINT `FK_PORT`
FOREIGN KEY (`port_id`)
REFERENCES `port` (`id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
-- adding new ref column to shipcall incl. foreign key
ALTER TABLE `shipcall`
ADD COLUMN `port_id` INT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Selected port for this shipcall' AFTER `evaluation_notifications_sent`,
CHANGE COLUMN `time_ref_point` `time_ref_point` INT NULL DEFAULT '0' COMMENT 'Index of a location which is the reference point for all time value entries, e.g. berth or Geeste' AFTER `port_id`,
ADD INDEX `FK_SHIPCALL_PORT_idx` (`port_id` ASC) VISIBLE;
;
ALTER TABLE `shipcall`
ADD CONSTRAINT `FK_SHIPCALL_PORT`
FOREIGN KEY (`port_id`)
REFERENCES `port` (`id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
CREATE TABLE `participant_port_map` (
`id` int NOT NULL AUTO_INCREMENT,
`participant_id` int unsigned NOT NULL COMMENT 'Ref to participant',
`port_id` int unsigned NOT NULL COMMENT 'Ref to port',
`created` datetime DEFAULT CURRENT_TIMESTAMP,
`modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `FK_PP_PARTICIPANT` (`participant_id`),
KEY `FK_PP_PORT` (`port_id`),
CONSTRAINT `FK_PP_PARTICIPANT` FOREIGN KEY (`participant_id`) REFERENCES `participant` (`id`),
CONSTRAINT `FK_PP_PORT` FOREIGN KEY (`port_id`) REFERENCES `port` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Mapping table that assigns participants to a port';
-- all existing berths shall default to "bremen"
UPDATE berth SET port_id = 1 where port_id is null;

View File

@ -0,0 +1,13 @@
ALTER TABLE `notification`
ADD COLUMN `participant_id` INT UNSIGNED NULL DEFAULT NULL AFTER `shipcall_id`,
ADD INDEX `FK_NOTIFICATION_PARTICIPANT_idx` (`participant_id` ASC) VISIBLE;
;
ALTER TABLE `notification`
ADD CONSTRAINT `FK_NOTIFICATION_PARTICIPANT`
FOREIGN KEY (`participant_id`)
REFERENCES `participant` (`id`)
ON DELETE RESTRICT
ON UPDATE RESTRICT;
ALTER TABLE `user`
ADD COLUMN `notify_event` INT NULL COMMENT 'Bitflag of selected notification event types that the user wants to be notified of' AFTER `notify_popup`;

1
misc/version.txt Normal file
View File

@ -0,0 +1 @@
1.8.0.0

10
misc/weserport.md Normal file
View File

@ -0,0 +1,10 @@
# Schnittstelle Weserport Anforderungen
##
Automatische Zuordnung:
* Hafenamt
* Festmacher
* Lotsen (>120m l 13m br)

View File

@ -0,0 +1,135 @@
[*.cs]
# CS8073: The result of the expression is always the same since a value of this type is never equal to 'null'
dotnet_diagnostic.CS8073.severity = none
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_indent_labels = one_less_than_current
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_space_around_binary_operators = before_and_after
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
csharp_style_var_elsewhere = false:silent
# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = none
[*.{cs,vb}]
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_readonly_field = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
dotnet_code_quality_unused_parameters = all:suggestion
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent

View File

@ -0,0 +1,82 @@
<Window x:Class="BreCalClient.AboutDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="Help" Height="512" Width="800" Loaded="Window_Loaded">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180" />
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Projektleitung" HorizontalContentAlignment="Right"/>
<Label Grid.Column="0" Grid.Row="1" Content="Softwareentwicklung" HorizontalContentAlignment="Right"/>
<TextBlock Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
<Hyperlink NavigateUri="https://www.bsmd.de" RequestNavigate="Hyperlink_RequestNavigate">
Bremer Schiffsmeldedienst
</Hyperlink>
</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" VerticalAlignment="Center">
<Hyperlink NavigateUri="http://www.textbausteine.net/" RequestNavigate="Hyperlink_RequestNavigate">
Informatikbüro Daniel Schick
</Hyperlink>
</TextBlock>
<Border BorderThickness="0 0 0 2" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" BorderBrush="Gray" />
<Label FontWeight="DemiBold" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textChangeContactInfo}" HorizontalContentAlignment="Right"/>
<Label Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textEmail}" HorizontalContentAlignment="Right" />
<Label Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textPhone}" HorizontalContentAlignment="Right" />
<TextBox Name="textBoxUserEmail" Grid.Column="1" Grid.Row="4" Margin="2" VerticalContentAlignment="Center" />
<TextBox Name="textBoxUserPhone" Grid.Column="1" Grid.Row="5" Margin="2" VerticalContentAlignment="Center" />
<Label FontWeight="DemiBold" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textNotifications}" HorizontalContentAlignment="Right"/>
<CheckBox HorizontalAlignment="Right" Margin="2" Grid.Column="0" Grid.Row="8" VerticalAlignment="Center" x:Name="checkboxEMailNotify" />
<Label Grid.Row="8" Grid.Column="1" Content="{x:Static p:Resources.textNotifyEmail}" />
<CheckBox HorizontalAlignment="Right" Margin="2" Grid.Column="0" Grid.Row="9" VerticalAlignment="Center" x:Name="checkboxPushNotify" />
<Label Grid.Row="9" Grid.Column="1" Content="{x:Static p:Resources.textNotifyPush}" />
<Label Grid.Row="7" Grid.Column="2" Content="{x:Static p:Resources.textNotifyOn}" />
<xctk:CheckListBox Grid.Column="2" Grid.Row="8" Grid.RowSpan="3" x:Name="checkListBoxEventSelection" Margin="2" />
<Button x:Name="buttonChangeUserFields" Click="buttonChangeUserFields_Click" Grid.Column="2" Grid.Row="11" Margin="2" Content="{x:Static p:Resources.textChange}" Width="80" HorizontalAlignment="Right" IsEnabled="True" />
<Border BorderThickness="0 0 0 2" Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="3" BorderBrush="Gray" />
<Label FontWeight="DemiBold" Grid.Row="13" Grid.Column="0" Content="{x:Static p:Resources.textChangePassword}" HorizontalContentAlignment="Right"/>
<xctk:WatermarkPasswordBox Watermark="{x:Static p:Resources.textOldPassword}" Grid.Column="1" Grid.Row="13" Margin="2" x:Name="wpBoxOldPassword" TextChanged="wpBoxOldPassword_TextChanged"/>
<xctk:WatermarkPasswordBox Watermark="{x:Static p:Resources.textNewPassword}" Grid.Column="1" Grid.Row="14" Margin="2" x:Name="wpBoxNewPassword" TextChanged="wpBoxOldPassword_TextChanged"/>
<xctk:WatermarkPasswordBox Watermark="{x:Static p:Resources.textRepeatNewPassword}" Grid.Column="1" Grid.Row="15" Margin="2" x:Name="wpBoxNewPasswordRepeat" TextChanged="wpBoxOldPassword_TextChanged"/>
<Button x:Name="buttonChangePassword" Click="buttonChangePassword_Click" Grid.Column="1" Grid.Row="16" Margin="2" Content="{x:Static p:Resources.textChangePassword}" Width="120" HorizontalAlignment="Right" IsEnabled="False" />
<Border BorderThickness="0 0 0 2" Grid.Row="17" Grid.Column="0" Grid.ColumnSpan="3" BorderBrush="Gray" />
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Column="2" Grid.Row="19" HorizontalAlignment="Right" />
</Grid>
</Window>

View File

@ -0,0 +1,107 @@
// Copyright (c) 2023 schick Informatik
// Description: Show about info and allow user detail editing
//
using BreCalClient.misc.Model;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for AboutDialog.xaml
/// </summary>
public partial class AboutDialog : Window
{
#region Construction
public AboutDialog()
{
InitializeComponent();
}
#endregion
#region Properties
public LoginResult? LoginResult { get; set; }
#endregion
#region events
public event Action<string, string>? ChangePasswordRequested;
public event Action? ChangeUserSettingsRequested;
#endregion
#region event handler
private void buttonClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void buttonChangePassword_Click(object sender, RoutedEventArgs e)
{
this.ChangePasswordRequested?.Invoke(this.wpBoxOldPassword.Password, this.wpBoxNewPassword.Password);
}
private void buttonChangeUserFields_Click(object sender, RoutedEventArgs e)
{
if (this.LoginResult != null)
{
this.LoginResult.UserPhone = this.textBoxUserPhone.Text.Trim();
this.LoginResult.UserEmail = this.textBoxUserEmail.Text.Trim();
this.LoginResult.NotifyEmail = this.checkboxEMailNotify.IsChecked ?? false;
this.LoginResult.NotifyPopup = this.checkboxPushNotify.IsChecked ?? false;
if ((this.checkListBoxEventSelection.SelectedItems.Count > 0) && (this.LoginResult.NotifyOn == null))
this.LoginResult.NotifyOn = new();
this.LoginResult.NotifyOn.Clear();
foreach (NotificationType nt in this.checkListBoxEventSelection.SelectedItems)
this.LoginResult.NotifyOn.Add(nt);
this.ChangeUserSettingsRequested?.Invoke();
}
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri) { UseShellExecute = true });
e.Handled = true;
}
private void wpBoxOldPassword_TextChanged(object sender, TextChangedEventArgs e)
{
this.buttonChangePassword.IsEnabled =
(this.wpBoxOldPassword.Password.Length > 0) &&
(this.wpBoxNewPassword.Password.Length > 0) &&
(this.wpBoxNewPasswordRepeat.Password.Length > 0) &&
this.wpBoxNewPassword.Password.Equals(this.wpBoxNewPasswordRepeat.Password) &&
(!this.wpBoxNewPassword.Password.Equals(this.wpBoxOldPassword.Password));
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.checkListBoxEventSelection.ItemsSource = Enum.GetValues(typeof(BreCalClient.misc.Model.NotificationType));
if(LoginResult != null)
{
this.textBoxUserEmail.Text = LoginResult.UserEmail;
this.textBoxUserPhone.Text = LoginResult.UserPhone;
this.checkboxEMailNotify.IsChecked = LoginResult.NotifyEmail;
this.checkboxPushNotify.IsChecked = LoginResult.NotifyPopup;
if (LoginResult.NotifyOn != null)
{
foreach (NotificationType nt in LoginResult.NotifyOn)
this.checkListBoxEventSelection.SelectedItems.Add(nt);
}
}
}
#endregion
}
}

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="BreCalClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="BreCalClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<log4net>
<root>
<level value="DEBUG"/>
<appender-ref ref="LogFileAppender"/>
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="log-BreCalClient.txt"/>
<param name="AppendToFile" value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date [%thread] %-5level [%logger] - %message%newline"/>
</layout>
</appender>
</log4net>
<applicationSettings>
<BreCalClient.Properties.Settings>
<setting name="BG_COLOR" serializeAs="String">
<value>#751D1F</value>
</setting>
<setting name="APP_TITLE" serializeAs="String">
<value>!!Bremen calling Entwicklungsversion!!</value>
</setting>
<setting name="LOGO_IMAGE_URL" serializeAs="String">
<value>https://www.textbausteine.net/</value>
</setting>
<setting name="API_URL" serializeAs="String">
<value>https://brecaltest.bsmd-emswe.eu</value>
</setting>
</BreCalClient.Properties.Settings>
</applicationSettings>
<userSettings>
<BreCalClient.Properties.Settings>
<setting name="FilterCriteria" serializeAs="String">
<value />
</setting>
<setting name="Width" serializeAs="String">
<value>800</value>
</setting>
<setting name="Height" serializeAs="String">
<value>450</value>
</setting>
<setting name="Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="W1Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W1Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="W2Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W2Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="W3Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W3Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="W4Left" serializeAs="String">
<value>0</value>
</setting>
<setting name="W4Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="FilterCriteriaMap" serializeAs="String">
<value />
</setting>
<setting name="W5Top" serializeAs="String">
<value>0</value>
</setting>
<setting name="W5Left" serializeAs="String">
<value>0</value>
</setting>
</BreCalClient.Properties.Settings>
</userSettings>
</configuration>

110
src/BreCalClient/App.xaml Normal file
View File

@ -0,0 +1,110 @@
<Application x:Class="BreCalClient.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BreCalClient"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
StartupUri="MainWindow.xaml" Exit="Application_Exit" Startup="Application_Startup" >
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources\StringResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
<sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">10</sys:Double>
<sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarHeightKey}">10</sys:Double>
<Color x:Key="InformationColor">#147ec9</Color>
<SolidColorBrush x:Key="InformationColorBrush" Color="{StaticResource InformationColor}" options:Freeze="True" />
<Color x:Key="SuccessColor">#11ad45</Color>
<SolidColorBrush x:Key="SuccessColorBrush" Color="{StaticResource SuccessColor}" options:Freeze="True" />
<Color x:Key="ErrorColor">#e60914</Color>
<SolidColorBrush x:Key="ErrorColorBrush" Color="{StaticResource ErrorColor}" options:Freeze="True" />
<Color x:Key="WarningColor">#f5a300</Color>
<SolidColorBrush x:Key="WarningColorBrush" Color="{StaticResource WarningColor}" options:Freeze="True" />
<Canvas x:Key="InformationIcon" Width="24" Height="24">
<Path Data="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" Fill="White" />
</Canvas>
<Canvas x:Key="SuccessIcon" Width="24" Height="24">
<Path Data="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" Fill="White" />
</Canvas>
<Canvas x:Key="ErrorIcon" Width="24" Height="24">
<Path Data="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" Fill="White" />
</Canvas>
<Canvas x:Key="WarningIcon" Width="24" Height="24">
<Path Data="M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16" Fill="White" />
</Canvas>
<Canvas x:Key="CloseIcon" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="31.6666" Height="31.6667" Canvas.Left="22.1666" Canvas.Top="22.1667" Stretch="Fill" Fill="#FF000000" Data="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z "/>
</Canvas>
<Style TargetType="Border" x:Key="NotificationBorder">
<Setter Property="Padding" Value="5" />
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Opacity="0.5" ShadowDepth="1" BlurRadius="2" />
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Rectangle" x:Key="NotificationIcon">
<Setter Property="Width" Value="24"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Margin" Value="0,5,5,5" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Fill" Value="White"/>
</Style>
<Style TargetType="TextBlock" x:Key="NotificationText">
<Setter Property="Foreground" Value="White" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Margin" Value="5,0,0,0" />
</Style>
<Style TargetType="{x:Type Button}" x:Key="NotificationCloseButton">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#FFF" />
<Setter Property="FontSize" Value="15" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#33000000" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#77000000" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Rectangle" x:Key="CloseButtonIcon">
<Setter Property="Width" Value="10"/>
<Setter Property="Height" Value="10"/>
<Setter Property="Fill" Value="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -0,0 +1,34 @@
using BreCalClient.misc.Model;
using BreCalClient.Properties;
using System.Windows;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public static Participant Participant { get; set; } = new Participant();
private void Application_Exit(object sender, ExitEventArgs e)
{
BreCalClient.Properties.Settings.Default.Save();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
// Window size sanity check
if(Settings.Default.Width == 0)
{
Settings.Default.Width = 800;
Settings.Default.Save();
}
if(Settings.Default.Height == 0)
{
Settings.Default.Height = 450;
Settings.Default.Save();
}
}
}
}

View File

@ -0,0 +1,207 @@
// Copyright (c) 2024- schick Informatik
// Description: Helper (static) class to handle polled API notifications
//
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ToastNotifications.Core;
using BreCalClient.misc.Model;
namespace BreCalClient
{
internal class AppNotification(int id)
{
private static readonly Dictionary<int, AppNotification> _notifications = [];
private static readonly ObservableCollection<AppNotification> _notificationsCollection = [];
#region Properties
public int Id { get { return id; } }
public string? NotificationType
{
get; private set;
}
public string? NotificationDisplay
{
get; private set;
}
public string? NotificationDate
{
get; private set;
}
public string? Ship
{
get; private set;
}
public string? ShipcallType
{
get; private set;
}
public string? Berth
{
get; private set;
}
public string? ETA
{
get; private set;
}
public string? Message
{
get; private set;
}
public static ObservableCollection<AppNotification> AppNotifications { get { return _notificationsCollection; } }
#endregion
#region internal statics
internal static void LoadFromSettings()
{
_notifications.Clear();
if (Properties.Settings.Default.Notifications != null)
{
// load notification ids that have been processed
foreach (string? notification_id in Properties.Settings.Default.Notifications)
{
if (Int32.TryParse(notification_id, out int result))
_notifications.Add(result, new AppNotification(result));
}
}
}
internal static void Clear()
{
_notifications.Clear();
SaveNotifications();
}
internal static bool UpdateNotifications(List<Notification> notifications, System.Collections.Concurrent.ConcurrentDictionary<int, ShipcallControlModel> currentShipcalls, ToastViewModel vm, LoginResult loginResult)
{
bool result = false;
foreach (Notification notification in notifications)
{
if (notification.ParticipantId.HasValue && notification.ParticipantId.Value != App.Participant.Id) // not meant for us
continue;
if (!currentShipcalls.ContainsKey(notification.ShipcallId)) // not one of our shipcalls (maybe for another port or filtered)
continue;
// filter out notifications for shipcalls where we are not nomiated/assigned
if (!notification.ParticipantId.HasValue)
{
bool iAmAssigned = false;
foreach (ParticipantAssignment p in currentShipcalls[notification.ShipcallId].AssignedParticipants.Values)
{
if (p.ParticipantId.Equals(App.Participant.Id))
{
iAmAssigned = true; break;
}
}
if (!iAmAssigned) continue;
}
// filter out notifications the user is not interested in
if((notification.Type != null) && !loginResult.NotifyOn.Contains(notification.Type.Value))
continue;
if (!_notificationsCollection.Where(x => x.Id == notification.Id).Any())
{
List<AppNotification> newList = new(_notificationsCollection);
AppNotification ap = new(notification.Id)
{
NotificationType = notification.Type.ToString(),
NotificationDate = notification.Created.ToString(),
Ship = currentShipcalls[notification.ShipcallId]?.Ship?.Name,
ShipcallType = currentShipcalls[notification.ShipcallId]?.Shipcall?.Type.ToString(),
ETA = currentShipcalls[notification.ShipcallId]?.GetETAETD(true)
};
Times? agencyTimes = currentShipcalls[notification.ShipcallId]?.GetTimesForParticipantType(Extensions.ParticipantType.AGENCY);
ap.Berth = currentShipcalls[notification.ShipcallId]?.GetBerthText(agencyTimes);
ap.Message = notification.Message;
System.Diagnostics.Trace.WriteLine($"Notification {notification.Id} Type {notification.Type}");
MessageOptions options = new()
{
FontSize = 14,
ShowCloseButton = true,
Tag = ap
};
newList.Add(ap);
newList.Sort((a, b) => (a.NotificationDate ?? "").CompareTo(b.NotificationDate));
_notificationsCollection.Clear();
foreach(AppNotification newAp in newList)
_notificationsCollection.Add(newAp);
ap.NotificationDisplay = string.Empty;
switch(notification.Type)
{
case misc.Model.NotificationType.Assignment:
ap.NotificationDisplay = Resources.Resources.textAssignment; break;
case misc.Model.NotificationType.Next24h:
ap.NotificationDisplay = Resources.Resources.textNext24h; break;
case misc.Model.NotificationType.TimeConflict:
ap.NotificationDisplay = Resources.Resources.textTimeConflict; break;
case misc.Model.NotificationType.TimeConflictResolved:
ap.NotificationDisplay = Resources.Resources.textTimeConflictResolved; break;
case misc.Model.NotificationType.MissingData:
ap.NotificationDisplay = Resources.Resources.textMissingData; break;
case misc.Model.NotificationType.Cancelled:
ap.NotificationDisplay = Resources.Resources.textCancelled; break;
case misc.Model.NotificationType.Unassigned:
ap.NotificationDisplay = Resources.Resources.textUnassigned; break;
}
string toastText = ap.NotificationDisplay + "\n";
toastText += $"{ap.Ship} ({ap.ShipcallType}) - {ap.ETA} - {ap.Berth}";
if (!string.IsNullOrEmpty(ap.Message))
toastText += $" \n{ap.Message}";
if (_notifications.TryAdd(notification.Id, ap))
{
App.Current.Dispatcher.Invoke(() =>
{
vm.ShowAppNotification(toastText, options);
});
result = true;
}
}
}
if (result)
SaveNotifications(); // store notification ids in config array on change
return result;
}
internal static void SaveNotifications()
{
if (Properties.Settings.Default.Notifications == null)
Properties.Settings.Default.Notifications = [];
else
Properties.Settings.Default.Notifications.Clear();
foreach (int notification_id in _notifications.Keys)
{
Properties.Settings.Default.Notifications.Add(notification_id.ToString());
}
}
#endregion
}
}

View File

@ -0,0 +1,23 @@
// Copyright (c) 2024- schick Informatik
// Description:
//
using ToastNotifications;
using ToastNotifications.Core;
namespace BreCalClient
{
public static class AppNotificationExtension
{
public static void ShowAppNotification(this Notifier notifier, string message)
{
notifier.Notify(() => new AppNotificationMessage(message));
}
public static void ShowAppNotification(this Notifier notifier, string message, MessageOptions displayOptions)
{
notifier.Notify(() => new AppNotificationMessage(message, displayOptions));
}
}
}

View File

@ -0,0 +1,30 @@
using System.Windows;
using ToastNotifications.Core;
using ToastNotifications.Messages.Core;
namespace BreCalClient
{
public class AppNotificationMessage : MessageBase<AppNotificationPart>
{
public AppNotificationMessage(string message) : this(message, new MessageOptions())
{
}
public AppNotificationMessage(string message, MessageOptions options) : base(message, options)
{
}
protected override AppNotificationPart CreateDisplayPart()
{
return new AppNotificationPart(this);
}
protected override void UpdateDisplayOptions(AppNotificationPart displayPart, MessageOptions options)
{
// if (options.FontSize != null)
// displayPart.Text.FontSize = options.FontSize.Value;
// displayPart.CloseButton.Visibility = options.ShowCloseButton ? Visibility.Visible : Visibility.Collapsed;
}
}
}

View File

@ -0,0 +1,31 @@
<core:NotificationDisplayPart x:Class="BreCalClient.AppNotificationPart"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:core="clr-namespace:ToastNotifications.Core;assembly=ToastNotifications"
mc:Ignorable="d" d:DesignWidth="250" >
<Border x:Name="ContentWrapper" Style="{DynamicResource NotificationBorder}" Background="{DynamicResource ErrorColorBrush}">
<Grid x:Name="ContentContainer">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Rectangle x:Name="Icon" Width="24" Height="24">
<Rectangle.Fill>
<VisualBrush Visual="{StaticResource ErrorIcon}" />
</Rectangle.Fill>
</Rectangle>
<TextBlock x:Name="Text" Text="{Binding Message, Mode=OneTime}" Style="{StaticResource NotificationText}" Grid.Column="1" />
<Button x:Name="CloseButton" Style="{StaticResource NotificationCloseButton}" Padding="1" Grid.Column="2" Click="OnClose" Visibility="Hidden">
<Rectangle Style="{StaticResource CloseButtonIcon}" Margin="2">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Fill" Visual="{StaticResource CloseIcon}" />
</Rectangle.OpacityMask>
</Rectangle>
</Button>
</Grid>
</Border>
</core:NotificationDisplayPart>

View File

@ -0,0 +1,57 @@
using BreCalClient.misc.Model;
using System.Windows;
using System.Windows.Media;
using ToastNotifications.Core;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for NotificationPart.xaml
/// </summary>
public partial class AppNotificationPart : NotificationDisplayPart
{
public AppNotificationPart(AppNotificationMessage appNotification)
{
InitializeComponent();
Bind(appNotification);
if (appNotification.Options.Tag is AppNotification ap)
{
switch (ap.NotificationType)
{
case "TimeConflict":
this.ContentWrapper.Background = Brushes.Red;
break;
case "TimeConflictResolved":
this.ContentWrapper.Background = Brushes.Green;
break;
case "Assignment":
this.ContentWrapper.Background = Brushes.Blue;
break;
case "Next24h":
this.ContentWrapper.Background = Brushes.DarkOrange;
break;
case "Unassigned":
this.ContentWrapper.Background = Brushes.Gray;
break;
case "MissingData":
this.ContentWrapper.Background = Brushes.DarkKhaki;
break;
case "Cancelled":
this.ContentWrapper.Background = Brushes.DarkGray;
break;
default:
break;
}
}
}
private void OnClose(object sender, RoutedEventArgs e)
{
Notification.Close();
}
}
}

View File

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@ -0,0 +1,23 @@
// Copyright (c) 2023 schick Informatik
// Description: Helper for combobox binding of bool to combobox
//
using System;
using System.Globalization;
using System.Windows.Data;
namespace BreCalClient
{
public class BoolToIndexConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((bool) value == true) ? 0 : 1;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((int)value == 0);
}
}
}

View File

@ -0,0 +1,158 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<SignAssembly>True</SignAssembly>
<StartupObject>BreCalClient.App</StartupObject>
<AssemblyOriginatorKeyFile>..\..\misc\brecal.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>1.8.0.0</AssemblyVersion>
<FileVersion>1.8.0.0</FileVersion>
<Title>Bremen calling client</Title>
<Description>A Windows WPF client for the Bremen calling API.</Description>
<ApplicationIcon>containership.ico</ApplicationIcon>
<AssemblyName>BreCalTestClient</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\24hours.png" />
<None Remove="Resources\add.png" />
<None Remove="Resources\arrow_down_green.png" />
<None Remove="Resources\arrow_down_red.png" />
<None Remove="Resources\arrow_right_blue.png" />
<None Remove="Resources\arrow_right_green.png" />
<None Remove="Resources\arrow_up_blue.png" />
<None Remove="Resources\arrow_up_green.png" />
<None Remove="Resources\arrow_up_red.png" />
<None Remove="Resources\bell3.png" />
<None Remove="Resources\check.png" />
<None Remove="Resources\clipboard.png" />
<None Remove="Resources\clock.png" />
<None Remove="Resources\containership.ico" />
<None Remove="Resources\containership.png" />
<None Remove="Resources\delete.png" />
<None Remove="Resources\delete2.png" />
<None Remove="Resources\edit.png" />
<None Remove="Resources\emergency_stop_button.png" />
<None Remove="Resources\lock.png" />
<None Remove="Resources\lock_open.png" />
<None Remove="Resources\logo_bremen_calling.png" />
<None Remove="Resources\nav_refresh_green.png" />
<None Remove="Resources\nav_undo_red.png" />
<None Remove="Resources\ship2.png" />
<None Remove="Resources\sign_warning.png" />
<None Remove="Resources\trafficlight_green.png" />
<None Remove="Resources\trafficlight_off.png" />
<None Remove="Resources\trafficlight_on.png" />
<None Remove="Resources\trafficlight_red.png" />
<None Remove="Resources\trafficlight_red_yellow.png" />
<None Remove="Resources\trafficlight_yellow.png" />
<None Remove="Resources\umbrella_closed.png" />
<None Remove="Resources\umbrella_open.png" />
<None Remove="Resources\worker2.png" />
</ItemGroup>
<ItemGroup>
<Page Remove="Resources\StringResources.xaml" />
<Page Remove="StringResources.de.xaml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\misc\BreCalApi.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>BreCalApi.yaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="containership.ico" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\misc\BreCalApi.yaml" Link="BreCalApi.yaml">
<Generator>OpenApiCodeGenerator</Generator>
<LastGenOutput>BreCalApi.cs</LastGenOutput>
</None>
<Resource Include="Resources\24hours.png" />
<Resource Include="Resources\add.png" />
<Resource Include="Resources\arrow_down_green.png" />
<Resource Include="Resources\arrow_down_red.png" />
<Resource Include="Resources\arrow_right_blue.png" />
<Resource Include="Resources\arrow_right_green.png" />
<Resource Include="Resources\arrow_up_blue.png" />
<Resource Include="Resources\arrow_up_green.png" />
<Resource Include="Resources\arrow_up_red.png" />
<Resource Include="Resources\bell3.png" />
<Resource Include="Resources\check.png" />
<Resource Include="Resources\clipboard.png" />
<Resource Include="Resources\clock.png" />
<Resource Include="Resources\containership.ico" />
<Resource Include="Resources\containership.png" />
<Resource Include="Resources\delete.png" />
<Resource Include="Resources\delete2.png" />
<Resource Include="Resources\edit.png" />
<Resource Include="Resources\emergency_stop_button.png" />
<Resource Include="Resources\lock.png" />
<Resource Include="Resources\lock_open.png" />
<Resource Include="Resources\logo_bremen_calling.png" />
<Resource Include="Resources\nav_refresh_green.png" />
<Resource Include="Resources\nav_undo_red.png" />
<Resource Include="Resources\ship2.png" />
<Resource Include="Resources\sign_warning.png" />
<Resource Include="Resources\StringResources.de.xaml">
<Generator>MSBuild:Compile</Generator>
</Resource>
<Resource Include="Resources\StringResources.xaml" />
<Resource Include="Resources\trafficlight_green.png" />
<Resource Include="Resources\trafficlight_off.png" />
<Resource Include="Resources\trafficlight_on.png" />
<Resource Include="Resources\trafficlight_red.png" />
<Resource Include="Resources\trafficlight_red_yellow.png" />
<Resource Include="Resources\trafficlight_yellow.png" />
<Resource Include="Resources\umbrella_closed.png" />
<Resource Include="Resources\umbrella_open.png" />
<Resource Include="Resources\worker2.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.1" />
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
<PackageReference Include="log4net" Version="3.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.5.1" />
<PackageReference Include="RestSharp" Version="112.0.0" />
<PackageReference Include="ToastNotifications" Version="2.5.1" />
<PackageReference Include="ToastNotifications.Messages" Version="2.5.1" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Update="Resources\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,16 @@
extensions: designer.cs generated.cs
extensions: .cs .cpp .h
// Copyright (c) 2024- schick Informatik
// Description:
//
extensions: .aspx .ascx
<%--
Copyright (c) 2024- schick Informatik
--%>
extensions: .vb
'Sample license text.
extensions: .xml .config .xsd
<!--
Sample license text.
-->

View File

@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33627.172
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BreCalClient", "BreCalClient.csproj", "{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EE0DC107-4A84-442F-89B2-2FF2557F761A}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Setup", "..\Setup\Setup.vdproj", "{CDC1EC53-8D75-4F8B-B627-A76B126380D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA9E0A87-FBFB-4F2B-B5FA-46DE2E5E4BCB}.Release|Any CPU.Build.0 = Release|Any CPU
{CDC1EC53-8D75-4F8B-B627-A76B126380D4}.Debug|Any CPU.ActiveCfg = Debug
{CDC1EC53-8D75-4F8B-B627-A76B126380D4}.Release|Any CPU.ActiveCfg = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CBF797A4-0CAF-4F01-B0D5-708702165337}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,227 @@
// Copyright (c) 2023 schick Informatik
// Description: Static lists used everywhere
//
using BreCalClient.misc.Model;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace BreCalClient
{
public static class BreCalLists
{
#region Fields
private static readonly List<Participant> aList = new();
private static readonly List<Participant> mList = new();
private static readonly List<Participant> pList = new();
private static readonly List<Participant> tList = new();
private static readonly List<Participant> terList = new();
private static readonly List<Berth> _berths = new();
private static List<Berth> _allBerths = new();
private static List<Participant> _participants = new();
private static readonly List<ShipModel> _ships = new();
private static readonly List<ShipModel> _allShips = new();
private static readonly List<Port> _ports = new();
private static readonly List<Port> _allPorts = new();
private readonly static ConcurrentDictionary<int, ShipModel> _shipLookupDict = new();
private readonly static ConcurrentDictionary<int, Berth> _berthLookupDict = new();
private readonly static Dictionary<int, Participant> _participantLookupDict = new();
private readonly static ConcurrentDictionary<int, Port> _portLookupDict = new();
/// <summary>
/// List of TimeRef points
/// </summary>
// TODO: To make this portable the list of texts should come from a configuration file
private readonly static List<string> _timeRefs = new()
{
"ETB",
"Geeste",
"TN-Weser"
};
#endregion
#region Properties
/// <summary>
/// fast ship lookup
/// </summary>
public static ConcurrentDictionary<int, ShipModel> ShipLookupDict { get { return _shipLookupDict; } }
/// <summary>
/// fast port lookup
/// </summary>
public static ConcurrentDictionary<int, Berth> BerthLookupDict { get { return _berthLookupDict; } }
/// <summary>
/// fast participant lookup
/// </summary>
public static Dictionary<int, Participant> ParticipantLookupDict { get { return _participantLookupDict; } }
/// <summary>
/// fast port lookup
/// </summary>
public static ConcurrentDictionary<int, Port> PortLookupDict { get { return _portLookupDict; } }
/// <summary>
/// Participants that are agents
/// </summary>
public static List<Participant> Participants_Agent { get { return aList; } }
/// <summary>
/// Participants that are mooring companies
/// </summary>
public static List<Participant> Participants_Mooring { get { return mList; } }
/// <summary>
/// Participants that are pilots
/// </summary>
public static List<Participant> Participants_Pilot { get { return pList; } }
/// <summary>
/// Participants that are tug shipping companies
/// </summary>
public static List<Participant> Participants_Tug { get { return tList; } }
/// <summary>
/// Participants that are terminals
/// </summary>
public static List<Participant> Participants_Terminal { get { return terList; } }
/// <summary>
/// All participants
/// </summary>
public static List<Participant> Participants { get { return _participants; } }
/// <summary>
/// All active berths
/// </summary>
public static List<Berth> Berths { get { return _berths; } }
/// <summary>
/// All berths including deleted berths
/// </summary>
public static List<Berth> AllBerths { get { return _allBerths; } }
/// <summary>
/// All active ports
/// </summary>
public static List<Port> Ports { get { return _ports; } }
/// <summary>
/// All ports including deleted ports
/// </summary>
public static List<Port> AllPorts { get { return _allPorts; } }
/// <summary>
/// All active ships
/// </summary>
public static List<ShipModel> Ships { get { return _ships; } }
/// <summary>
/// All ships including deleted ships
/// </summary>
public static List<ShipModel> AllShips { get { return _allShips; } }
/// <summary>
/// List of display values for TimeRef points
/// </summary>
public static List<string> TimeRefs { get { return _timeRefs; } }
#endregion
#region public static methods
public static List<Berth> GetBerthsByPort(int port)
{
List<Berth> berths = new();
foreach(Berth berth in _berths)
{
if(berth.PortId == port)
berths.Add(berth);
}
return berths;
}
public static List<Participant> GetParticipants(int port, Extensions.ParticipantType type)
{
List<Participant> participants = new();
foreach(Participant participant in _participants)
{
if(participant.IsTypeFlagSet(type) && participant.Ports.Contains(port))
participants.Add(participant);
}
return participants;
}
#endregion
#region Internal initializer methods
internal static void InitializeParticipants(List<Participant> participants)
{
_participants = participants;
aList.Clear();
mList.Clear();
pList.Clear();
tList.Clear();
terList.Clear();
foreach (Participant p in participants)
{
_participantLookupDict[p.Id] = p;
if (p.IsTypeFlagSet(Extensions.ParticipantType.AGENCY)) aList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.MOORING)) mList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.PILOT)) pList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.TUG)) tList.Add(p);
if (p.IsTypeFlagSet(Extensions.ParticipantType.TERMINAL)) terList.Add(p);
}
}
internal static void InitializeBerths(List<Berth> berths)
{
foreach (var berth in berths)
{
_berthLookupDict[berth.Id] = berth;
if(!berth.Deleted)
_berths.Add(berth);
}
_allBerths = berths;
}
internal static void InitializeShips(List<Ship> ships)
{
_ships.Clear();
_allShips.Clear();
foreach (var ship in ships)
{
ShipModel sm = new(ship);
_shipLookupDict[ship.Id] = sm;
if (!ship.Deleted)
_ships.Add(sm);
_allShips.Add(sm);
}
}
internal static void InitializePorts(List<Port> ports)
{
foreach(var port in ports)
{
_portLookupDict[port.Id] = port;
if(!port.Deleted)
_ports.Add(port);
_allPorts.Add(port);
}
}
#endregion
}
}

View File

@ -0,0 +1,41 @@
using System.Text.RegularExpressions;
using System.Windows.Input;
using Xceed.Wpf.Toolkit;
namespace BreCalClient
{
public class DateTimePickerExt : DateTimePicker
{
protected override void OnPreviewTextInput(TextCompositionEventArgs e)
{
base.OnPreviewTextInput(e);
if (this.Template.FindName("PART_TextBox", this) is not WatermarkTextBox tb) return;
// strip input after caret
string subText = (tb.CaretIndex > 0) ? this.Text[..tb.CaretIndex] : tb.Text; // Range operator instead of Substring(0, tb.CaretIndex)
string text = subText + e.Text;
// System.Diagnostics.Debug.WriteLine("C:" + this.Text + " E: " + e.Text + " Caret: " + tb.CaretIndex + " Subt: " + subText);
// 10 char eingabe "am Stück"
if (Regex.IsMatch(text, @"^\d{10}"))
{
e.Handled = true;
tb.Text = Regex.Replace(text, @"(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", "$1.$2.20$3 $4:$5");
tb.CaretIndex = tb.Text.Length;
tb.SelectedText = "";
}
// nur die Zeit wird markiert und mit 4 Zahlen befüllt, diese Regel setzt den Doppelpunkt
else if (Regex.IsMatch(text, @"^(\d{2}\.\d{2}\. \d{4} \d{3})"))
{
e.Handled = true;
tb.Text = Regex.Replace(text, @"(\d{2}\.\d{2}\. \d{4} \d{2})(\d)(.*)", "$1:$2");
// System.Diagnostics.Trace.WriteLine("Replaced: " + tb.Text);
tb.CaretIndex = tb.Text.Length;
tb.Select(tb.Text.Length, 0);
}
}
}
}

View File

@ -0,0 +1,257 @@
// Copyright (c) 2017 schick Informatik
// Description: DataGrid mit etwas "verbesserten" Funktionen
//
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Controls.Primitives;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
namespace BreCalClient
{
/// <summary>
/// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
///
/// Step 1a) Using this custom control in a XAML file that exists in the current project.
/// Add this XmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:enictrl="clr-namespace:ENI2.Controls"
///
///
/// Step 1b) Using this custom control in a XAML file that exists in a different project.
/// Add this XmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:enictrl="clr-namespace:ENI2.Controls;assembly=ENI2.Controls"
///
/// You will also need to add a project reference from the project where the XAML file lives
/// to this project and Rebuild to avoid compilation errors:
///
/// Right click on the target project in the Solution Explorer and
/// "Add Reference"->"Projects"->[Browse to and select this project]
///
///
/// Step 2)
/// Go ahead and use your control in the XAML file.
///
/// <MyNamespace:ENIDataGrid/>
///
/// </summary>
public class ENIDataGrid : DataGrid
{
public event Action<object>? EditRequested;
public event Action<object>? DeleteRequested;
public event Action? CreateRequested;
public event Action? RefreshGrid;
public event Action<object>? PrintRequested;
public event Action<object>? ExportRequested;
public event Action<object>? ShowTextRequested;
public void Initialize()
{
this.MouseDoubleClick += dataGrid_MouseDoubleClick;
this.PreviewKeyDown += ENIDataGrid_PreviewKeyDown;
this.ContextMenu = new ContextMenu();
this.CanUserAddRows = false;
this.IsReadOnly = false;
MenuItem addItem = new MenuItem();
addItem.Header = BreCalClient.Resources.Resources.textAdd;
addItem.Icon = new Image { Source = Util.LoadImage(BreCalClient.Resources.Resources.add) };
addItem.Click += new RoutedEventHandler(this.addItem);
this.ContextMenu.Items.Add(addItem);
MenuItem deleteItem = new MenuItem();
deleteItem.Header = BreCalClient.Resources.Resources.textDelete;
deleteItem.Icon = new Image { Source = Util.LoadImage(BreCalClient.Resources.Resources.delete) };
deleteItem.Click += this.deleteItem;
this.ContextMenu.Items.Add(deleteItem);
MenuItem editItem = new MenuItem();
editItem.Header = BreCalClient.Resources.Resources.textEdit;
editItem.Icon = new Image { Source = Util.LoadImage(BreCalClient.Resources.Resources.edit) };
editItem.Click += this.editItem;
this.ContextMenu.Items.Add(editItem);
}
private void ENIDataGrid_PreviewKeyDown(object sender, KeyEventArgs e)
{
if(sender is ENIDataGrid)
{
var grid = sender as ENIDataGrid;
if (Key.Delete == e.Key)
this.deleteItem(null, null);
}
}
#region public
public DataGridRow GetRow(int index)
{
DataGridRow row = (DataGridRow)this.ItemContainerGenerator.ContainerFromIndex(index);
if(row == null)
{
this.UpdateLayout();
this.ScrollIntoView(this.Items[index]);
row = (DataGridRow)this.ItemContainerGenerator.ContainerFromIndex(index);
}
return row;
}
public DataGridCell? GetCell(DataGridRow row, int column)
{
if (row != null)
{
DataGridCellsPresenter? presenter = GetVisualChild<DataGridCellsPresenter>(row);
if (presenter == null)
{
this.ScrollIntoView(row, this.Columns[column]);
presenter = GetVisualChild<DataGridCellsPresenter>(row);
}
DataGridCell? cell = (DataGridCell?)presenter?.ItemContainerGenerator.ContainerFromIndex(column);
return cell;
}
return null;
}
public DataGridCell? GetCell(int rowIndex, int columnIndex)
{
DataGridRow row = this.GetRow(rowIndex);
return this.GetCell(row, columnIndex);
}
#endregion
#region protected
protected void addItem(object sender, RoutedEventArgs e)
{
if (!this.IsReadOnly)
{
this.CreateRequested?.Invoke();
}
e.Handled = true;
}
protected void deleteItem(object? sender, RoutedEventArgs? e)
{
if((this.SelectedItems != null) && (this.SelectedItems.Count > 0) && !this.IsReadOnly)
{
MessageBoxResult result = MessageBox.Show("Are your sure?", "Please confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
List<object> deleteList = new List<object>();
foreach (object deleteItem in this.SelectedItems)
deleteList.Add(deleteItem);
foreach (object deleteItem in deleteList)
{
if (deleteItem != null)
{
this.DeleteRequested?.Invoke(deleteItem);
}
}
this.RefreshGrid?.Invoke();
}
}
}
protected void editItem(object sender, RoutedEventArgs e)
{
if((this.SelectedItems != null) && (this.SelectedItems.Count == 1) && !this.IsReadOnly)
{
if (this.SelectedItems[0] is object selectedEntity)
this.EditRequested?.Invoke(selectedEntity);
}
}
protected void printItem(object sender, RoutedEventArgs e)
{
if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1) )
{
if (this.SelectedItems[0] is object selectedEntity)
this.PrintRequested?.Invoke(selectedEntity);
}
}
protected void exportItem(object sender, RoutedEventArgs e)
{
if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1))
{
if (this.SelectedItems[0] is object selectedEntity)
this.ExportRequested?.Invoke(selectedEntity);
}
}
protected void showTextItem(object sender, RoutedEventArgs e)
{
if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1))
{
if (this.SelectedItems[0] is object selectedEntity)
this.ShowTextRequested?.Invoke(selectedEntity);
}
}
#endregion
#region private
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (sender != null)
{
if ((sender is DataGrid grid) && (grid.SelectedItems != null) && (grid.SelectedItems.Count == 1) && !this.IsReadOnly)
{
DataGridRow? dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
if (grid.SelectedItem is object selectedEntity)
this.EditRequested?.Invoke(selectedEntity);
}
}
}
#endregion
#region private static
private static T? GetVisualChild<T>(Visual parent) where T : Visual
{
T? child = default;
int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < numVisuals; i++)
{
Visual? v = (Visual)VisualTreeHelper.GetChild(parent, i);
child = v as T;
if (child == null)
{
child = GetVisualChild<T>(v);
}
if (child != null)
{
break;
}
}
return child;
}
#endregion
}
}

View File

@ -0,0 +1,54 @@
<Window x:Class="BreCalClient.EditShipDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Left="{local:SettingBinding W3Left}" Top="{local:SettingBinding W3Top}"
Title="{x:Static p:Resources.textEditShip}" Height="250" Width="500" Loaded="Window_Loaded" ResizeMode="NoResize">
<Grid x:Name="shipGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".3*" />
<ColumnDefinition Width=".6*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Content="Name" HorizontalAlignment="Right" />
<TextBox x:Name="textBoxName" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" Text="{Binding Name, Mode=OneWay}" TextChanged="textBoxName_TextChanged" MaxLength="64"/>
<Label Content="{x:Static p:Resources.textTugCompany}" HorizontalAlignment="Right" Grid.Row="1" />
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="28" />
</Grid.ColumnDefinitions>
<ComboBox x:Name="comboBoxParticipants" Margin="2" DisplayMemberPath="Name" />
<Button x:Name="buttonResetParticipant" Grid.Column="1" Margin="2" Click="buttonResetParticipant_Click">
<Image Source="./Resources/delete2.png"/>
</Button>
</Grid>
<Label Content="IMO" HorizontalAlignment="Right" Grid.Row="2" />
<xctk:IntegerUpDown Name="integerUpDownIMO" Grid.Column="1" Grid.Row="2" Value="{Binding Imo, Mode=OneWay}" Margin="2" Minimum="1000000" Maximum="9999999" ShowButtonSpinner="False" ValueChanged="integerUpDownIMO_ValueChanged"/>
<Label Content="{x:Static p:Resources.textCallsign}" HorizontalAlignment="Right" Grid.Row="3" />
<TextBox x:Name="textBoxCallsign" Grid.Column="1" Grid.Row="3" Margin="2" VerticalContentAlignment="Center" Text="{Binding Callsign, Mode=OneWay}" MaxLength="8"/>
<Label Content="{x:Static p:Resources.textLength}" HorizontalAlignment="Right" Grid.Row="4" />
<xctk:DoubleUpDown Name="doubleUpDownLength" Grid.Row="4" Grid.Column="1" Value="{Binding Length, Mode=OneWay}" Margin="2" Minimum="0" />
<Label Content="{x:Static p:Resources.textWidth}" HorizontalAlignment="Right" Grid.Row="5" />
<xctk:DoubleUpDown Name="doubleUpDownWidth" Grid.Row="5" Grid.Column="1" Value="{Binding Width, Mode=OneWay}" Margin="2" Minimum="0"/>
<StackPanel Grid.Column="1" Grid.Row="7" Orientation="Horizontal" FlowDirection="RightToLeft">
<Button x:Name="buttonCancel" Width="80" Content="{x:Static p:Resources.textCancel}" Margin="2" Click="buttonCancel_Click" />
<Button x:Name="buttonOK" Width="80" Content="OK" Margin="2" Click="buttonOK_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,87 @@
using BreCalClient.misc.Model;
using System.Collections.Generic;
using System.Windows;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditShipDialog.xaml
/// </summary>
public partial class EditShipDialog : Window
{
public EditShipDialog()
{
InitializeComponent();
}
public Ship Ship { get; set; } = new();
public List<Participant> Participants { get; } = new List<Participant>();
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
this.Ship.Name = this.textBoxName.Text.ToUpper().Trim();
if (this.comboBoxParticipants.SelectedItem != null)
{
this.Ship.ParticipantId = ((Participant)this.comboBoxParticipants.SelectedItem).Id;
this.Ship.IsTug = true;
}
else
{
this.Ship.IsTug = false;
}
this.Ship.Imo = this.integerUpDownIMO.Value;
this.Ship.Callsign = this.textBoxCallsign.Text.ToUpper().Trim();
this.Ship.Length = this.doubleUpDownLength.Value;
this.Ship.Width = this.doubleUpDownWidth.Value;
this.DialogResult = true;
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = this.Ship;
this.comboBoxParticipants.ItemsSource = this.Participants;
if(this.Ship.ParticipantId != null)
{
foreach(Participant p in this.Participants)
{
if(this.Ship.ParticipantId == p.Id)
this.comboBoxParticipants.SelectedItem = p;
}
}
this.EnableOK();
}
private void buttonResetParticipant_Click(object sender, RoutedEventArgs e)
{
this.comboBoxParticipants.SelectedItem = null;
}
private void textBoxName_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
this.EnableOK();
}
private void integerUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.EnableOK();
}
private void EnableOK()
{
this.buttonOK.IsEnabled = (this.textBoxName.Text.Length > 2) && (this.integerUpDownIMO.Value.HasValue);
}
}
}

View File

@ -0,0 +1,97 @@
<Window x:Class="BreCalClient.EditShipcallControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:api="clr-namespace:BreCalClient.misc.Model"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="298" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
<Window.Resources>
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
<local:EnumToStringConverter x:Key="enumToStringConverter" />
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".35*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".35*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Content="{x:Static p:Resources.textShip}" Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Right"/>
<ComboBox x:Name="comboBoxShip" Margin="2" Grid.Column="1" Grid.Row="0" SelectionChanged="comboBoxShip_SelectionChanged" SelectedValuePath="Ship.Id" IsEditable="True" IsTextSearchEnabled="True" IsTextSearchCaseSensitive="False" />
<Label Content="IMO" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownIMO" IsReadOnly="True" Margin="2" Grid.Column="1" Grid.Row="1" ShowButtonSpinner="False" IsEnabled="False"/>
<Label Content="{x:Static p:Resources.textCallsign}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right"/>
<TextBox x:Name="textBoxCallsign" IsReadOnly="True" Grid.Column="1" Grid.Row="2" Margin="2" IsEnabled="False"/>
<Label Content="{x:Static p:Resources.textLength}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right"/>
<xctk:DoubleUpDown x:Name="doubleUpDownLength" Margin="2" Grid.Column="1" Grid.Row="3" FormatString="N2" IsReadOnly="True" IsEnabled="False" ShowButtonSpinner="False"/>
<Label Content="{x:Static p:Resources.textWidth}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right"/>
<xctk:DoubleUpDown x:Name="doubleUpDownWidth" Margin="2" Grid.Column="1" Grid.Row="4" FormatString="N2" IsReadOnly="True" IsEnabled="False" ShowButtonSpinner="False"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxCancelled" Grid.Column="1" Grid.Row="5" Margin="2" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textHarbour}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxHarbour" Grid.Column="1" Margin="2" Grid.Row="6" DisplayMemberPath="Name" SelectedValuePath="Id" />
<Button x:Name="buttonEditShips" Grid.Column="1" Grid.Row="7" Margin="2" Content="{x:Static p:Resources.textEditShips}" Click="buttonEditShips_Click" Visibility="Hidden" />
<Label Content="{x:Static p:Resources.textType}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right" />
<ComboBox ItemsSource="{local:Enumerate {x:Type api:ShipcallType}}" Grid.Column="3" Margin="2" Grid.Row="0" SelectionChanged="comboBoxCategories_SelectionChanged" x:Name="comboBoxCategories" />
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<Grid Grid.Row="1" Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="0" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged"/>
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged"/>
</Grid>
<Label Content="Zeit Ref." Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right" />
<Label Content="ETA" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right" Margin="0,2,0,26" Grid.RowSpan="2" x:Name="labelETA"/>
<Label Content="ETD" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" x:Name="labelETD"/>
<ComboBox x:Name="comboBoxTimeRef" Grid.Column="3" Margin="2" Grid.Row="2" />
<local:DateTimePickerExt x:Name="datePickerETD" Grid.Column="3" Grid.Row="3" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerETD_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETA" Grid.Column="3" Grid.Row="4" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" ValueChanged="datePickerETA_ValueChanged"/>
<Label Content="{x:Static p:Resources.textAgency}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxAgency" Grid.Column="3" Grid.Row="5" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxAgency_SelectionChanged">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearAgency" Click="contextMenuItemClearAgency_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label x:Name="labelBSMDGranted" Grid.Row="7" Grid.Column="3" Grid.ColumnSpan="1" Content="{x:Static p:Resources.textBSMDGranted}" Visibility="Hidden" FontWeight="DemiBold" />
<Label x:Name="labelShiftingCount" Grid.Row="6" Grid.Column="2" HorizontalAlignment="Right" Content="{x:Static p:Resources.textShiftingSequence}" />
<xctk:IntegerUpDown x:Name="integerUpDownShiftingCount" Grid.Row="6" Grid.Column="3" Margin="2" Minimum="0" Maximum="127" />
<StackPanel Grid.Row="8" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,472 @@
// Copyright (c) 2023 schick Informatik
// Description: Windows dialog to create / edit ship calls
//
using BreCalClient.misc.Api;
using BreCalClient.misc.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditShipcallControl.xaml
/// </summary>
public partial class EditShipcallControl : Window
{
public EditShipcallControl()
{
InitializeComponent();
}
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new ();
public Ship? SelectedShip {
get
{
return this.comboBoxShip.SelectedItem as Ship;
}
}
public bool ShipEditingEnabled
{
get { return this.buttonEditShips.Visibility == Visibility.Visible; }
set { this.buttonEditShips.Visibility = value ? Visibility.Visible : Visibility.Hidden; }
}
public ShipApi? ShipApi { get; set; }
public bool IsCreate { get; set; } = false;
#endregion
#region Event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
Array types = Enum.GetValues(typeof(ShipcallType));
List<ShipcallType> shipcallTypes = new();
bool first = true;
foreach(ShipcallType shipcallType in types)
{
if (!first) shipcallTypes.Add(shipcallType);
else first = false;
}
this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs;
this.comboBoxHarbour.ItemsSource = BreCalLists.Ports.Where(x => App.Participant.Ports.Contains(x.Id));
this.integerUpDownShiftingCount.Value = this.ShipcallModel.ShiftSequence;
if (this.ShipcallModel.Shipcall == null) this.ShipcallModel.Shipcall = new();
this.CopyToControls();
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult= false;
this.Close();
}
private void comboBoxShip_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (this.comboBoxShip.SelectedItem != null)
{
ShipModel? ship = this.comboBoxShip.SelectedItem as ShipModel;
this.integerUpDownIMO.Value = ship?.Ship.Imo;
this.textBoxCallsign.Text = ship?.Ship.Callsign;
this.doubleUpDownLength.Value = ship?.Ship.Length;
this.doubleUpDownWidth.Value = ship?.Ship.Width;
}
else
{
this.integerUpDownIMO.Value = null;
this.textBoxCallsign.Text = string.Empty;
this.doubleUpDownLength.Value = null;
this.doubleUpDownWidth.Value = null;
}
this.CheckForCompletion();
}
private void comboBoxAgency_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.EnableControls();
this.CheckForCompletion();
}
private void comboBoxCategories_SelectionChanged(object? sender, SelectionChangedEventArgs? e)
{
ShipcallType? type = GetShipcallTypeFromCombobox();
if (type != null)
{
switch (type)
{
case ShipcallType.Arrival:
this.datePickerETD.Visibility = Visibility.Hidden;
this.labelETD.Visibility = Visibility.Hidden;
this.datePickerETA.Visibility = Visibility.Visible;
this.labelETA.Visibility = Visibility.Visible;
Grid.SetRow(datePickerETA, 3);
Grid.SetRow(labelETA, 3);
this.datePickerETD.Value = null;
this.comboBoxDepartureBerth.SelectedIndex = -1;
this.comboBoxDepartureBerth.IsEnabled = false;
this.comboBoxArrivalBerth.IsEnabled = true;
this.comboBoxTimeRef.IsEnabled = true;
this.labelShiftingCount.Visibility = Visibility.Hidden;
this.integerUpDownShiftingCount.Visibility = Visibility.Hidden;
break;
case ShipcallType.Departure:
this.datePickerETD.Visibility = Visibility.Visible;
this.labelETD.Visibility = Visibility.Visible;
this.datePickerETA.Visibility = Visibility.Hidden;
this.labelETA.Visibility = Visibility.Hidden;
this.datePickerETA.Value = null;
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.comboBoxArrivalBerth.IsEnabled = false;
this.comboBoxDepartureBerth.IsEnabled = true;
this.comboBoxTimeRef.IsEnabled = false;
this.comboBoxTimeRef.SelectedIndex = 0;
this.labelShiftingCount.Visibility = Visibility.Hidden;
this.integerUpDownShiftingCount.Visibility = Visibility.Hidden;
break;
case ShipcallType.Shifting:
Grid.SetRow(datePickerETA, 4);
Grid.SetRow(labelETA, 4);
this.datePickerETA.Visibility = Visibility.Visible;
this.labelETA.Visibility = Visibility.Visible;
this.datePickerETD.Visibility = Visibility.Visible;
this.labelETD.Visibility = Visibility.Visible;
this.comboBoxArrivalBerth.IsEnabled = true;
this.comboBoxDepartureBerth.IsEnabled = true;
this.comboBoxTimeRef.IsEnabled = false;
this.comboBoxTimeRef.SelectedIndex = 0;
this.labelShiftingCount.Visibility = Visibility.Visible;
this.integerUpDownShiftingCount.Visibility = Visibility.Visible;
break;
}
}
this.CheckForCompletion();
}
#endregion
#region Context menu handlers
private void contextMenuItemClearAgency_Click(object sender, RoutedEventArgs e)
{
this.comboBoxAgency.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.AGENCY);
}
#endregion
#region private methods
ShipcallType? GetShipcallTypeFromCombobox()
{
EnumToStringConverter enumToStringConverter = new();
return (ShipcallType?)enumToStringConverter.ConvertBack(this.comboBoxCategories.SelectedItem, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
}
void CheckForCompletion()
{
if (this.ShipcallModel.Shipcall?.Canceled ?? false) return; // Cancelled shipcall never clicks ok
bool isEnabled = true;
isEnabled &= this.comboBoxShip.SelectedItem != null;
isEnabled &= this.comboBoxCategories.SelectedItem != null;
isEnabled &= this.comboBoxHarbour.SelectedItem != null;
if (comboBoxCategories.SelectedItem == null)
{
isEnabled = false;
}
else
{
ShipcallType callType = GetShipcallTypeFromCombobox() ?? ShipcallType.Undefined;
switch (callType)
{
case ShipcallType.Departure:
isEnabled &= this.comboBoxDepartureBerth.SelectedItem != null;
isEnabled &= this.datePickerETD.Value.HasValue;
isEnabled &= !(this.datePickerETD.Value.IsTooOld() && this.datePickerETD.Value != this.ShipcallModel.Shipcall?.Etd);
isEnabled &= !this.datePickerETD.Value.IsTooFar();
break;
case ShipcallType.Arrival:
isEnabled &= this.comboBoxArrivalBerth.SelectedItem != null;
isEnabled &= this.datePickerETA.Value.HasValue;
isEnabled &= !(this.datePickerETA.Value.IsTooOld() && this.datePickerETA.Value != this.ShipcallModel.Shipcall?.Eta);
isEnabled &= !this.datePickerETA.Value.IsTooFar();
break;
case ShipcallType.Shifting:
isEnabled &= ((this.comboBoxDepartureBerth.SelectedItem != null) && (this.comboBoxArrivalBerth.SelectedItem != null));
isEnabled &= this.datePickerETD.Value.HasValue;
isEnabled &= this.datePickerETA.Value.HasValue;
isEnabled &= !(this.datePickerETD.Value.IsTooOld() && this.datePickerETD.Value != this.ShipcallModel.Shipcall?.Etd);
isEnabled &= !(this.datePickerETA.Value.IsTooOld() && this.datePickerETA.Value != this.ShipcallModel.Shipcall?.Eta);
if (this.datePickerETA.Value.HasValue && this.datePickerETD.Value.HasValue)
isEnabled &= (this.datePickerETA.Value.Value > this.datePickerETD.Value.Value);
isEnabled &= !this.datePickerETD.Value.IsTooFar();
isEnabled &= !this.datePickerETA.Value.IsTooFar();
break;
}
}
isEnabled &= this.comboBoxAgency.SelectedItem != null;
this.buttonOK.IsEnabled = isEnabled;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.ShipcallModel.Shipcall.Type = GetShipcallTypeFromCombobox() ?? ShipcallType.Undefined;
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
this.ShipcallModel.Shipcall.ShipId = ((ShipModel)this.comboBoxShip.SelectedItem).Ship.Id;
this.ShipcallModel.Ship = ((ShipModel)this.comboBoxShip.SelectedItem).Ship;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCancelled.IsChecked;
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
{
this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
}
else // shifting
{
this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null;
this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null;
this.ShipcallModel.ShiftSequence = (byte?) this.integerUpDownShiftingCount.Value;
}
Participant? participant;
participant = (Participant?)this.comboBoxAgency.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.AGENCY
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = pa;
}
else
{
// AGENCY was set before and now is set to nothing
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
this.ShipcallModel.AssignedParticipants.Remove(ParticipantType.AGENCY);
}
// BSMD and port authority are always added
// get port authority from berth
int? berthId = this.ShipcallModel.Shipcall.ArrivalBerthId;
berthId ??= this.ShipcallModel.Shipcall.DepartureBerthId;
if (berthId != null)
{
Berth? selectedBerth = BreCalLists.Berths.Find((x) => x.Id == berthId);
if (selectedBerth?.AuthorityId != null)
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(selectedBerth.AuthorityId.Value))
{
ParticipantAssignment pab = new()
{
ParticipantId = selectedBerth.AuthorityId.Value,
Type = (int)ParticipantType.PORT_ADMINISTRATION
};
this.ShipcallModel.AssignedParticipants[ParticipantType.PORT_ADMINISTRATION] = pab;
}
}
ParticipantAssignment pa = new()
{
ParticipantId = App.Participant.Id,
Type = (int)ParticipantType.BSMD
};
this.ShipcallModel.AssignedParticipants[ParticipantType.BSMD] = pa;
}
// set the time reference value (which point do all times refer to?)
this.ShipcallModel.Shipcall.TimeRefPoint = this.comboBoxTimeRef.SelectedIndex;
this.ShipcallModel.Shipcall.PortId = ((Port) this.comboBoxHarbour.SelectedItem).Id;
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
this.comboBoxTimeRef.SelectedIndex = this.ShipcallModel.Shipcall.TimeRefPoint ?? 1;
this.comboBoxCategories.SelectedItem = new EnumToStringConverter().Convert(this.ShipcallModel.Shipcall.Type, typeof(ShipcallType), new object(), System.Globalization.CultureInfo.CurrentCulture);
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
if (BreCalLists.Ships.Find(x => x.Ship.Id == this.ShipcallModel.Shipcall.ShipId) != null)
{
this.comboBoxShip.SelectedValue = this.ShipcallModel.Shipcall.ShipId;
} else
{
this.comboBoxShip.IsEnabled = false;
}
this.checkBoxCancelled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
if (BreCalLists.PortLookupDict.ContainsKey(this.ShipcallModel.Shipcall.PortId))
this.comboBoxHarbour.SelectedValue = this.ShipcallModel.Shipcall.PortId;
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(this.ShipcallModel.Shipcall.PortId);
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
// Filter agency combobox by port
List<Participant> availableAgencies = BreCalLists.GetParticipants(this.ShipcallModel.Shipcall.PortId, ParticipantType.AGENCY);
this.comboBoxAgency.ItemsSource = availableAgencies;
if (this.ShipcallModel.Shipcall.Type != ShipcallType.Shifting) // incoming, outgoing
{
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
}
else // shifting
{
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
}
if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new();
if(this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId))
{
this.comboBoxAgency.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId;
}
}
this.comboBoxHarbour.SelectionChanged += this.comboBoxHarbour_SelectionChanged;
this.comboBoxHarbour.IsEnabled = this.ShipcallModel.AllowPortChange;
}
}
private void EnableControls()
{
bool isBsmd = App.Participant.IsTypeFlagSet(ParticipantType.BSMD);
bool isAgency = App.Participant.IsTypeFlagSet(ParticipantType.AGENCY);
bool editRightGrantedForBSMD = false;
if (this.ShipcallModel.Shipcall?.Canceled ?? false) return; // do not allow edit on canceled shipcall
// Special case: Selected Agency allows BSMD to edit their fields
if (this.comboBoxAgency.SelectedIndex >= 0)
{
int agencyParticipantId = (int)this.comboBoxAgency.SelectedValue;
Participant? p = BreCalLists.Participants.Find(x => x.Id == agencyParticipantId);
if (p != null)
{
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD) && isBsmd)
isAgency = true;
if(p.IsFlagSet(ParticipantFlag.ALLOW_BSMD))
editRightGrantedForBSMD = true;
}
}
this.comboBoxAgency.IsEnabled = isBsmd;
this.comboBoxArrivalBerth.IsEnabled = isBsmd || isAgency;
this.comboBoxCategories.IsEnabled = isBsmd;
this.comboBoxDepartureBerth.IsEnabled = isBsmd || isAgency;
this.comboBoxShip.IsEnabled = isBsmd;
this.datePickerETA.IsEnabled = isAgency || isBsmd;
this.datePickerETD.IsEnabled = isAgency || isBsmd;
this.labelBSMDGranted.Visibility = editRightGrantedForBSMD ? Visibility.Visible : Visibility.Hidden;
this.comboBoxHarbour.IsEnabled = this.IsCreate && this.ShipcallModel.AllowPortChange;
this.comboBoxCategories_SelectionChanged(null, null);
}
#endregion
#region control event handlers
private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckForCompletion();
}
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckForCompletion();
}
private void comboBoxArrivalBerth_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.CheckForCompletion();
}
private void comboBoxDepartureBerth_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.CheckForCompletion();
}
private void buttonEditShips_Click(object sender, RoutedEventArgs e)
{
ShipListDialog shipListDialog = new()
{
ShipApi = this.ShipApi
};
shipListDialog.ShowDialog();
// reload combobox
this.comboBoxShip.ItemsSource = null;
this.comboBoxShip.ItemsSource = BreCalLists.Ships;
}
private void comboBoxHarbour_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Port port = (Port)this.comboBoxHarbour.SelectedItem;
if (port == null) return;
// Filter berth selection combobox by port
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(port.Id);
this.comboBoxArrivalBerth.ItemsSource = null;
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
this.comboBoxDepartureBerth.ItemsSource = null;
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
// Filter agency combobox by port
List<Participant> availableAgencies = BreCalLists.GetParticipants(port.Id, ParticipantType.AGENCY);
this.comboBoxAgency.ItemsSource = null;
this.comboBoxAgency.ItemsSource = availableAgencies;
}
#endregion
}
}

View File

@ -0,0 +1,136 @@
<Window x:Class="BreCalClient.EditTimesAgencyIncomingControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="403" Width="900" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Window.Resources>
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.18*"/>
<ColumnDefinition Width=".4*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".3*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textIncoming}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_down_red.png" />
</Grid>
<Label Content="ETA" x:Name="labelETA" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETA" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETA_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_End_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged">
</ComboBox>
<Label Content="{x:Static p:Resources.textPierside}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="3" Margin="2" >
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerthRemarks}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxBerthRemarks" Grid.Column="1" Grid.Row="4" Margin="2" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"/>
<Label Content="{x:Static p:Resources.textDraft}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right" FontWeight="Bold" />
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="6" Margin="2" FormatString="N2" Minimum="0" Maximum="50" MaxLength="5" ValueChanged="doubleUpDownDraft_ValueChanged"/>
<Label Content="{x:Static p:Resources.textTidalWindow}" FontWeight="DemiBold" Grid.Column="0" Grid.Row="7" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textFrom}" Grid.Column="0" Grid.Row="8" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textTo}" Grid.Column="0" Grid.Row="9" HorizontalContentAlignment="Right"/>
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="1" Grid.Row="8" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="1" Grid.Row="9" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="10" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxCanceled" Grid.Column="1" Grid.Row="10" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textAnchored}" Grid.Column="2" Grid.Row="0" HorizontalContentAlignment="Right"/>
<CheckBox x:Name="checkBoxAnchored" Grid.Column="3" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" />
<Label Content="{x:Static p:Resources.textTugRequired}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTug" Click="contextMenuItemClearTug_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRecommendedTugs}" Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownRecommendedTugs" Grid.Column="3" Grid.Row="2" Minimum="0" Margin="2" Maximum="10"/>
<Label Content="{x:Static p:Resources.textPilotRequired}" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPilot" Click="contextMenuItemClearPilot_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooring}" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearMooring" Click="contextMenuItemClearMooring_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxMooredLock" Grid.Column="3" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTerminal}" Grid.Column="2" Grid.Row="6" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTerminal" Grid.Column="3" Grid.Row="6" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTerminal" Click="contextMenuItemClearTerminal_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBunkering}" Grid.Column="3" Grid.Row="7" />
<Label Content="{x:Static p:Resources.textReplenishingTerminal}" Grid.Column="3" Grid.Row="8" />
<Label Content="{x:Static p:Resources.textReplenishingLock}" Grid.Column="3" Grid.Row="9" />
<CheckBox x:Name="checkBoxBunkering" Grid.Column="2" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
<CheckBox x:Name="checkBoxReplenishingTerminal" Grid.Column="2" Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
<CheckBox x:Name="checkBoxReplenishingLock" Grid.Column="2" Grid.Row="9" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRemarks}" Grid.Row="10" Grid.Column="2" HorizontalAlignment="Right"/>
<TextBox x:Name="textBoxRemarks" Grid.Column="3" Grid.Row="10" Margin="2" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"/>
<StackPanel Grid.Row="14" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,434 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for incoming shipcalls
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesAgencyIncomingControl.xaml
/// </summary>
public partial class EditTimesAgencyIncomingControl : Window, IEditTimesControl
{
#region Fields
bool _editing = false;
#endregion
#region Construction
public EditTimesAgencyIncomingControl()
{
InitializeComponent();
}
#endregion
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
int portId = this.ShipcallModel.Shipcall.PortId;
this.comboBoxArrivalBerth.ItemsSource = BreCalLists.GetBerthsByPort(portId);
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
this.Title = this.ShipcallModel?.Title;
Participant? p = null;
if (this.ShipcallModel != null)
{
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false;
if (p != null)
{
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
}
_editing = (this.Times.ParticipantId == App.Participant.Id) ||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if ((this.datePickerETA.Value != this.Times.EtaBerth) || (this.datePickerETA_End.Value != this.Times.EtaIntervalEnd)) // something has changed
{
if (datePickerETA.Value.IsTooOld() || datePickerETA_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if (this.datePickerETA.Value.HasValue && this.datePickerETA_End.Value.HasValue && this.datePickerETA.Value > this.datePickerETA_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
}
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo)) // something has changed
{
if(datePickerTidalWindowTo.Value.IsTooOld() || this.datePickerTidalWindowFrom.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textTidalBothValues;
return false;
}
}
if(this.datePickerETA.Value.IsTooFar() || this.datePickerETA_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETA_End.Value.HasValue && !this.datePickerETA.Value.HasValue) ||
(this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.Times.EtaBerth = this.datePickerETA.Value;
this.Times.EtaIntervalEnd = this.datePickerETA_End.Value;
if (this.comboBoxPierside.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0);
}
else
{
this.ShipcallModel.Shipcall.PierSide = null;
}
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
this.ShipcallModel.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
this.ShipcallModel.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
if (!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new() {
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.MOORING
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment;
}
participant = (Participant?)this.comboBoxPilot.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.PILOT
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment;
}
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TERMINAL
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment;
}
participant = (Participant?)this.comboBoxTug.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TUG
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment;
}
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
if(this.Times.EtaBerth.HasValue)
{
this.datePickerETA.Value = this.Times.EtaBerth.Value;
}
else
{
// if not set through times use value of BSMD entry
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
}
this.datePickerETA_End.Value = this.Times.EtaIntervalEnd;
if (Times.BerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = Times.BerthId;
else if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
{
if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
else this.comboBoxPierside.SelectedIndex = 1;
}
this.textBoxBerthRemarks.Text = this.Times.BerthInfo;
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering ?? false;
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock ?? false;
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal ?? false;
if ((this.ShipcallModel.Shipcall.TimeRefPoint ?? 0) == 0)
this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth;
else
this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
if(!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
{
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
{
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
{
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
{
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
}
}
}
}
private void EnableControls()
{
this.datePickerETA.IsEnabled = _editing;
this.datePickerETA_End.IsEnabled = _editing;
this.comboBoxArrivalBerth.IsEnabled = _editing;
this.comboBoxPierside.IsEnabled = _editing;
this.textBoxBerthRemarks.IsReadOnly = !_editing;
this.doubleUpDownDraft.IsEnabled = _editing;
this.datePickerTidalWindowFrom.IsEnabled = _editing;
this.datePickerTidalWindowTo.IsEnabled = _editing;
this.checkBoxCanceled.IsEnabled = _editing;
this.checkBoxAnchored.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
this.comboBoxTerminal.IsEnabled = _editing;
this.checkBoxBunkering.IsEnabled = _editing;
this.checkBoxReplenishingTerminal.IsEnabled = _editing;
this.checkBoxReplenishingLock.IsEnabled = _editing;
this.textBoxRemarks.IsReadOnly = !_editing;
CheckOKButton();
}
private bool RequiredFieldsSet()
{
bool areSet = this.datePickerETA.Value.HasValue &&
this.doubleUpDownDraft.Value.HasValue &&
this.comboBoxArrivalBerth.SelectedIndex >= 0;
if (areSet && this.datePickerETA_End.Value.HasValue)
areSet &= (this.datePickerETA.Value < this.datePickerETA_End.Value);
return areSet;
}
private void CheckOKButton()
{
this.buttonOK.IsEnabled = _editing && RequiredFieldsSet() && !(this.ShipcallModel.Shipcall?.Canceled ?? false);
}
#endregion
#region event handlers
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTug.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TUG);
}
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPilot.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.PILOT);
}
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
{
this.comboBoxMooring.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.MOORING);
}
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
private void doubleUpDownDraft_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
private void comboBoxArrivalBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
this.CheckOKButton();
}
private void datePickerETA_End_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
#endregion
}
}

View File

@ -0,0 +1,125 @@
<Window x:Class="BreCalClient.EditTimesAgencyOutgoingControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="375" Width="900" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.18*"/>
<ColumnDefinition Width=".4*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".3*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textOutgoing}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_up_blue.png" />
</Grid>
<Label Content="ETD" x:Name="labelETD" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Row="1" Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETD" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged" AllowTextInput="True" />
<local:DateTimePickerExt x:Name="datePickerETD_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged" />
<Label Content="{x:Static p:Resources.textPierside}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="3" Margin="2" >
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerthRemarks}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxBerthRemarks" Grid.Column="1" Grid.Row="4" Margin="2" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<Label Content="{x:Static p:Resources.textDraft}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="6" Margin="2" FormatString="N2" Minimum="0" Maximum="50" MaxLength="5" ValueChanged="doubleUpDownDraft_ValueChanged"/>
<Label Content="{x:Static p:Resources.textTidalWindow}" FontWeight="DemiBold" Grid.Column="0" Grid.Row="7" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textFrom}" Grid.Column="0" Grid.Row="8" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textTo}" Grid.Column="0" Grid.Row="9" HorizontalContentAlignment="Right"/>
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="1" Grid.Row="8" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="1" Grid.Row="9" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="10" HorizontalContentAlignment="Right" VerticalAlignment="Center" />
<CheckBox x:Name="checkBoxCanceled" Grid.Column="1" Grid.Row="10" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTugRequired}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTug" Click="contextMenuItemClearTug_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRecommendedTugs}" Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownRecommendedTugs" Grid.Column="3" Grid.Row="2" Minimum="0" Margin="2" Maximum="10"/>
<Label Content="{x:Static p:Resources.textPilotRequired}" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPilot" Click="contextMenuItemClearPilot_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooring}" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearMooring" Click="contextMenuItemClearMooring_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxMooredLock" Grid.Column="3" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTerminal}" Grid.Column="2" Grid.Row="6" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTerminal" Grid.Column="3" Grid.Row="6" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTerminal" Click="contextMenuItemClearTerminal_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRainSensitiveCargo}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="7" HorizontalAlignment="Right" />
<CheckBox x:Name="checkBoxRainsensitiveCargo" Grid.Column="3" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRemarks}" Grid.Column="2" Grid.Row="8" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxRemarks" Grid.Column="3" Grid.Row="8" Margin="2" Grid.RowSpan="4" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<StackPanel Grid.Row="12" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,419 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for outgoing shipcalls
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesAgencyOutgoingControl.xaml
/// </summary>
public partial class EditTimesAgencyOutgoingControl : Window, IEditTimesControl
{
#region Fields
bool _editing = false;
#endregion
#region Construction
public EditTimesAgencyOutgoingControl()
{
InitializeComponent();
}
#endregion
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
int portId = this.ShipcallModel.Shipcall.PortId;
this.comboBoxDepartureBerth.ItemsSource = BreCalLists.GetBerthsByPort(portId);
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
this.Title = this.ShipcallModel?.Title;
Participant? p = null;
if (this.ShipcallModel != null)
{
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false;
if (p != null)
{
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
}
_editing = (this.Times.ParticipantId == App.Participant.Id) ||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if((this.datePickerETD.Value != this.Times.EtdBerth) || (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
if (datePickerETD.Value.IsTooOld() || datePickerETD_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETD.Value.HasValue && this.datePickerETD_End.Value.HasValue && this.datePickerETD.Value > this.datePickerETD_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
if (this.datePickerTidalWindowTo.Value.IsTooOld() || this.datePickerTidalWindowFrom.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textTidalBothValues;
return false;
}
if (this.datePickerETD.Value.IsTooFar() || this.datePickerETD_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETD_End.Value.HasValue && !this.datePickerETD.Value.HasValue) ||
(this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.Times.EtdBerth = this.datePickerETD.Value;
this.Times.EtdIntervalEnd = this.datePickerETD_End.Value;
if (this.comboBoxPierside.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0);
}
else
{
this.ShipcallModel.Shipcall.PierSide = null;
}
this.Times.BerthId = (int?)this.comboBoxDepartureBerth.SelectedValue;
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
if(!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.MOORING
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment;
}
participant = (Participant?)this.comboBoxPilot.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.PILOT
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment;
}
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TERMINAL
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment;
}
participant = (Participant?)this.comboBoxTug.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TUG
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment;
}
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
if (this.Times.EtdBerth.HasValue)
{
this.datePickerETD.Value = this.Times.EtdBerth.Value;
}
else
{
// if not set through times use value of BSMD entry
if (this.ShipcallModel.Shipcall.Etd != DateTime.MinValue)
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
}
this.datePickerETD_End.Value = this.Times.EtdIntervalEnd;
if (this.Times.BerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.Times.BerthId;
else if (this.ShipcallModel.Shipcall.DepartureBerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
{
if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPierside.SelectedIndex = 0;
else this.comboBoxPierside.SelectedIndex = 1;
}
this.textBoxBerthRemarks.Text = this.Times.BerthInfo;
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
if ((this.ShipcallModel.Shipcall.TimeRefPoint ?? 0) == 0)
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth;
else
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
if (!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
{
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
{
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
{
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
{
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
}
}
}
}
private void EnableControls()
{
this.datePickerETD.IsEnabled = _editing;
this.datePickerETD_End.IsEnabled = _editing;
this.comboBoxDepartureBerth.IsEnabled = _editing;
this.comboBoxPierside.IsEnabled = _editing;
this.textBoxBerthRemarks.IsReadOnly = !_editing;
this.doubleUpDownDraft.IsEnabled = _editing;
this.datePickerTidalWindowFrom.IsEnabled = _editing;
this.datePickerTidalWindowTo.IsEnabled = _editing;
this.checkBoxCanceled.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
this.comboBoxTerminal.IsEnabled = _editing;
this.checkBoxRainsensitiveCargo.IsEnabled = _editing;
this.textBoxRemarks.IsReadOnly = !_editing;
CheckOKButton();
}
private bool RequiredFieldsSet()
{
bool areSet = this.datePickerETD.Value.HasValue &&
this.doubleUpDownDraft.Value.HasValue &&
this.comboBoxDepartureBerth.SelectedIndex >= 0;
if (areSet && this.datePickerETD_End.Value.HasValue)
areSet &= (this.datePickerETD_End.Value > this.datePickerETD.Value);
return areSet;
}
private void CheckOKButton()
{
this.buttonOK.IsEnabled = _editing && RequiredFieldsSet() && !(this.ShipcallModel.Shipcall?.Canceled ?? false);
}
#endregion
#region event handlers
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTug.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TUG);
}
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPilot.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.PILOT);
}
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
{
this.comboBoxMooring.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.MOORING);
}
private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxDepartureBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void comboBoxDepartureBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
CheckOKButton();
}
private void doubleUpDownDraft_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
#endregion
}
}

View File

@ -0,0 +1,156 @@
<Window x:Class="BreCalClient.EditTimesAgencyShiftingControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditShipcall}" Height="490" Width="900" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.18*"/>
<ColumnDefinition Width=".4*" />
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width=".3*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textShiftingFrom}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_right_green.png" />
</Grid>
<Label Content="{x:Static p:Resources.textETDBerth}" Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETD" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETD_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETD_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textTerminal}" Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTerminal" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTerminal" Click="contextMenuItemClearTerminal_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxDepartureBerth" Grid.Column="1" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxDepartureBerth_SelectionChanged">
</ComboBox>
<Label Content="{x:Static p:Resources.textDraft}" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<xctk:DoubleUpDown x:Name="doubleUpDownDraft" Grid.Column="1" Grid.Row="4" Margin="2" FormatString="N2" Minimum="0" Maximum="50" MaxLength="5" ValueChanged="doubleUpDownDraft_ValueChanged"/>
<Label Content="{x:Static p:Resources.textTidalWindow}" FontWeight="DemiBold" Grid.Column="0" Grid.Row="5" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textFrom}" Grid.Column="0" Grid.Row="6" HorizontalContentAlignment="Right"/>
<Label Content="{x:Static p:Resources.textTo}" Grid.Column="0" Grid.Row="7" HorizontalContentAlignment="Right"/>
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="1" Grid.Row="6" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="1" Grid.Row="7" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<Grid Grid.Row="8" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{x:Static p:Resources.textShiftingTo}" FontWeight="DemiBold"/>
<Image Margin="2" Grid.Column="1" Source="Resources/arrow_right_green.png" />
</Grid>
<Label Content="{x:Static p:Resources.textETABerth}" Grid.Column="0" Grid.Row="9" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<Grid Grid.Column="1" Grid.Row="9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt x:Name="datePickerETA" Grid.Column="0" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_ValueChanged"/>
<local:DateTimePickerExt x:Name="datePickerETA_End" Grid.Column="1" Grid.Row="0" Margin="2" Format="Custom" FormatString="dd.MM. yyyy HH:mm" ValueChanged="datePickerETA_ValueChanged"/>
</Grid>
<Label Content="{x:Static p:Resources.textBerth}" Grid.Column="0" Grid.Row="10" HorizontalContentAlignment="Right" FontWeight="Bold"/>
<ComboBox Name="comboBoxArrivalBerth" Grid.Column="1" Grid.Row="10" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" SelectionChanged="comboBoxArrivalBerth_SelectionChanged" />
<Label Content="{x:Static p:Resources.textPierside}" Grid.Column="0" Grid.Row="11" HorizontalContentAlignment="Right" />
<ComboBox x:Name="comboBoxPiersideArrival" Grid.Column="1" Grid.Row="11" Margin="2" >
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textBerthRemarks}" Grid.Column="0" Grid.Row="12" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxBerthRemarksArrival" Grid.Column="1" Grid.Row="12" Margin="2,1,2,3" Grid.RowSpan="2" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<Label Content="{x:Static p:Resources.textCancelled}" Grid.Column="0" Grid.Row="14" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxCanceled" Grid.Column="1" Grid.Row="14" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textTugRequired}" Grid.Column="2" Grid.Row="1" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxTug" Grid.Column="3" Grid.Row="1" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearTug" Click="contextMenuItemClearTug_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textRecommendedTugs}" Grid.Column="2" Grid.Row="2" HorizontalContentAlignment="Right"/>
<xctk:IntegerUpDown x:Name="integerUpDownRecommendedTugs" Grid.Column="3" Grid.Row="2" Minimum="0" Margin="2" Maximum="10"/>
<Label Content="{x:Static p:Resources.textPilotRequired}" Grid.Column="2" Grid.Row="3" HorizontalContentAlignment="Right" />
<ComboBox Name="comboBoxPilot" Grid.Column="3" Grid.Row="3" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPilot" Click="contextMenuItemClearPilot_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooring}" Grid.Column="2" Grid.Row="4" HorizontalContentAlignment="Right"/>
<ComboBox Name="comboBoxMooring" Grid.Column="3" Grid.Row="4" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearMooring" Click="contextMenuItemClearMooring_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<Label Content="{x:Static p:Resources.textMooredLock}" Grid.Column="2" Grid.Row="5" HorizontalContentAlignment="Right" />
<CheckBox x:Name="checkBoxMooredLock" Grid.Column="3" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRainSensitiveCargo}" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="6" HorizontalAlignment="Right" />
<CheckBox x:Name="checkBoxRainsensitiveCargo" Grid.Column="3" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,4,0" />
<Label Content="{x:Static p:Resources.textRemarks}" Grid.Column="2" Grid.Row="7" HorizontalContentAlignment="Right" />
<TextBox x:Name="textBoxRemarks" Grid.Column="3" Grid.Row="7" Margin="2,1,2,3" Grid.RowSpan="7" VerticalContentAlignment="Top" AcceptsReturn="True" MaxLength="512"/>
<StackPanel Grid.Row="15" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="False"/>
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,473 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for shifting operations
//
using BreCalClient.misc.Model;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using static BreCalClient.Extensions;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesAgencyShiftingControl.xaml
/// </summary>
public partial class EditTimesAgencyShiftingControl : Window, IEditTimesControl
{
#region Fields
bool _editing = false;
#endregion
#region Construction
public EditTimesAgencyShiftingControl()
{
InitializeComponent();
}
#endregion
#region Properties
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
int portId = this.ShipcallModel.Shipcall.PortId;
List<Berth> availableBerths = BreCalLists.GetBerthsByPort(portId);
this.comboBoxArrivalBerth.ItemsSource = availableBerths;
this.comboBoxDepartureBerth.ItemsSource = availableBerths;
this.comboBoxMooring.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.MOORING);
this.comboBoxPilot.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.PILOT);
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
Participant? p = null;
if (this.ShipcallModel != null)
{
this.Title = this.ShipcallModel.Title;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
p = BreCalLists.Participants.Find(x => x.Id == this.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId);
}
bool allowBSMD = false;
if (p != null)
{
allowBSMD = p.IsFlagSet(ParticipantFlag.ALLOW_BSMD);
}
_editing = (this.Times.ParticipantId == App.Participant.Id) ||
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if((this.datePickerETA.Value != this.Times.EtaBerth) || (this.datePickerETA_End.Value != this.Times.EtaIntervalEnd))
{
if (this.datePickerETA.Value.IsTooOld() && this.datePickerETA_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
}
if (this.datePickerETA.Value.HasValue && this.datePickerETA_End.Value.HasValue && this.datePickerETA.Value > this.datePickerETA_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerETD.Value != this.Times.EtdBerth) || (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
if (this.datePickerETD.Value.IsTooOld() || this.datePickerETD_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETD.Value.HasValue && this.datePickerETD_End.Value.HasValue && this.datePickerETD.Value > this.datePickerETD_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
if (this.datePickerTidalWindowFrom.Value.IsTooOld() && this.datePickerTidalWindowTo.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textTidalBothValues;
return false;
}
if (this.datePickerETA.Value.IsTooFar() || this.datePickerETA_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar() ||
this.datePickerETD.Value.IsTooFar() || this.datePickerETD_End.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETA_End.Value.HasValue && !this.datePickerETA.Value.HasValue) ||
(this.datePickerETD_End.Value.HasValue && !this.datePickerETD.Value.HasValue) ||
(this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
if (this.ShipcallModel.Shipcall != null)
{
this.Times.EtdBerth = this.datePickerETD.Value;
this.Times.EtaBerth = this.datePickerETA.Value;
this.Times.EtaIntervalEnd = this.datePickerETA_End.Value;
this.Times.EtdIntervalEnd = this.datePickerETD_End.Value;
this.ShipcallModel.Shipcall.DepartureBerthId = (int)this.comboBoxDepartureBerth.SelectedValue;
if (this.comboBoxPiersideArrival.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPiersideArrival.SelectedIndex == 0);
}
else
{
this.ShipcallModel.Shipcall.PierSide = null;
}
this.Times.BerthInfo = this.textBoxBerthRemarksArrival.Text.Trim();
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
if(!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.MOORING
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = pa;
}
participant = (Participant?)this.comboBoxPilot.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.PILOT
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = pa;
}
participant = (Participant?)this.comboBoxTerminal.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TERMINAL
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = pa;
}
participant = (Participant?)this.comboBoxTug.SelectedItem;
if (participant != null)
{
ParticipantAssignment pa = new()
{
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.TUG
};
this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = pa;
}
}
}
private void CopyToControls()
{
if (this.ShipcallModel == null) return;
if (this.ShipcallModel.Shipcall != null)
{
if (this.Times.EtaBerth.HasValue)
{
this.datePickerETA.Value = this.Times.EtaBerth.Value;
}
else
{
// if not set through times use value of BSMD entry
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
}
if(this.Times.EtdBerth.HasValue)
{
this.datePickerETD.Value = this.Times.EtdBerth.Value;
}
else
{
if (this.ShipcallModel.Shipcall.Etd != DateTime.MinValue)
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
}
this.datePickerETA_End.Value = this.Times.EtaIntervalEnd;
this.datePickerETD_End.Value = this.Times.EtdIntervalEnd;
if (this.Times.BerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.Times.BerthId;
else if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
if (this.ShipcallModel.Shipcall.DepartureBerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
{
if (this.ShipcallModel.Shipcall.PierSide.Value) this.comboBoxPiersideArrival.SelectedIndex = 0;
else this.comboBoxPiersideArrival.SelectedIndex = 1;
}
this.textBoxBerthRemarksArrival.Text = this.Times.BerthInfo;
this.doubleUpDownDraft.Value = this.ShipcallModel.Shipcall.Draft;
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
if (!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId))
{
this.comboBoxMooring.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.MOORING].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.PILOT))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId))
{
this.comboBoxPilot.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.PILOT].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TERMINAL))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId))
{
this.comboBoxTerminal.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TERMINAL].ParticipantId;
}
}
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.TUG))
{
if (BreCalLists.ParticipantLookupDict.ContainsKey(this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId))
{
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
}
}
}
}
private void EnableControls()
{
this.datePickerETD_End.IsEnabled = _editing;
this.datePickerETA_End.IsEnabled = _editing;
this.datePickerETD.IsEnabled = _editing;
this.comboBoxArrivalBerth.IsEnabled = _editing;
this.doubleUpDownDraft.IsEnabled = _editing;
this.datePickerTidalWindowFrom.IsEnabled = _editing;
this.datePickerTidalWindowTo.IsEnabled = _editing;
this.datePickerETA.IsEnabled = _editing;
this.comboBoxDepartureBerth.IsEnabled = _editing;
this.comboBoxPiersideArrival.IsEnabled = _editing;
this.textBoxBerthRemarksArrival.IsReadOnly = !_editing;
this.checkBoxCanceled.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
this.comboBoxTerminal.IsEnabled = _editing;
this.checkBoxRainsensitiveCargo.IsEnabled = _editing;
this.textBoxRemarks.IsReadOnly = !_editing;
CheckOKButton();
}
private bool RequiredFieldsSet()
{
bool areSet = this.datePickerETA.Value.HasValue &&
this.datePickerETD.Value.HasValue &&
this.doubleUpDownDraft.Value.HasValue &&
(this.comboBoxArrivalBerth.SelectedIndex >= 0) &&
(this.comboBoxDepartureBerth.SelectedIndex >= 0);
if (this.datePickerETA_End.Value.HasValue)
areSet &= (this.datePickerETA_End.Value > this.datePickerETA.Value);
if (this.datePickerETD_End.Value.HasValue)
areSet &= (this.datePickerETD_End.Value > this.datePickerETD.Value);
return areSet;
}
private void CheckOKButton()
{
this.buttonOK.IsEnabled = _editing && RequiredFieldsSet() && !(this.ShipcallModel.Shipcall?.Canceled ?? false);
}
#endregion
#region event handlers
private void contextMenuItemDepartureBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxDepartureBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemArrivalBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.ShipcallModel.Berth = "";
}
private void contextMenuItemClearTug_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTug.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TUG);
}
private void contextMenuItemClearPilot_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPilot.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.PILOT);
}
private void contextMenuItemClearMooring_Click(object sender, RoutedEventArgs e)
{
this.comboBoxMooring.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.MOORING);
}
private void contextMenuItemClearTerminal_Click(object sender, RoutedEventArgs e)
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPiersideArrival.SelectedIndex = -1;
}
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void comboBoxDepartureBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
CheckOKButton();
}
private void doubleUpDownDraft_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
CheckOKButton();
}
private void comboBoxArrivalBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
CheckOKButton();
}
#endregion
}
}

View File

@ -0,0 +1,171 @@
<Window x:Class="BreCalClient.EditTimesControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditTimes}" Height="415" Width="500" Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip" Icon="Resources/containership.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".20*" />
<ColumnDefinition Width=".80*" />
<!--ColumnDefinition Width="40" /-->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" x:Name="rowETA" />
<RowDefinition Height="28" x:Name="rowETD" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" x:Name="rowt1" />
<RowDefinition Height="28" x:Name="rowt2" />
<RowDefinition Height="28" x:Name="rowt3" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Button x:Name="buttonFixedOrder" Grid.Row="0" Grid.Column="1" Margin="2" Click="buttonFixedOrder_Click" Width="28" HorizontalAlignment="Left">
<Image x:Name="imageFixedOrder" Source="Resources\lock_open.png" />
</Button>
<!-- Label Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textFixed}" /-->
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textETABerth}" HorizontalContentAlignment="Right" x:Name="labelETA" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textETDBerth}" HorizontalContentAlignment="Right" x:Name="labelETD" />
<Label Grid.Row="3" Grid.Column="0" Content="ATA" HorizontalContentAlignment="Right" x:Name="labelATA" />
<Label Grid.Row="4" Grid.Column="0" Content="ATD" HorizontalContentAlignment="Right" x:Name="labelATD" />
<Label Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textLockTime}" HorizontalContentAlignment="Right" />
<Label Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textZoneEntryTime}" HorizontalContentAlignment="Right" />
<Label Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textTidalWindow}" HorizontalContentAlignment="Right" />
<Label Grid.Row="8" Grid.Column="0" Content="{x:Static p:Resources.textFrom}" HorizontalContentAlignment="Right" />
<Label Grid.Row="9" Grid.Column="0" Content="{x:Static p:Resources.textTo}" HorizontalContentAlignment="Right" />
<Label Grid.Row="10" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" HorizontalContentAlignment="Right" />
<Grid Grid.Row="1" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerETABerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETA" Click="contextMenuItemClearETA_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerETABerth_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETA_End" Click="contextMenuItemClearETA_End_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<Grid Grid.Row="2" Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerETDBerth" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETD" Click="contextMenuItemClearETD_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerETDBerth_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearETD_End" Click="contextMenuItemClearETD_End_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="3" Grid.Column="1" Margin="2" x:Name="datePickerATA" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearATA" Click="contextMenuItemClearATA_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="4" Grid.Column="1" Margin="2" x:Name="datePickerATD" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearATD" Click="contextMenuItemClearATD_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="5" Grid.Column="1" Margin="2" x:Name="datePickerLockTime" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearLockTime" Click="contextMenuItemClearLockTime_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt IsEnabled="False" Grid.Row="6" Grid.Column="1" Margin="2" x:Name="datePickerZoneEntry" Format="Custom" FormatString="dd.MM. yyyy HH:mm">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearZoneEntry" Click="contextMenuItemClearZoneEntry_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<xctk:DateTimePicker Name="datePickerTidalWindowFrom" Grid.Column="1" Grid.Row="8" Margin="2" IsEnabled="False" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<xctk:DateTimePicker Name="datePickerTidalWindowTo" Grid.Column="1" Grid.Row="9" Margin="2" IsEnabled="False" Format="Custom" FormatString="dd.MM. yyyy HH:mm"/>
<TextBox Grid.Row="10" Grid.Column="1" Margin="2" Name="textBoxRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512"/>
<StackPanel Grid.Row="11" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" />
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
<Button Width="28" x:Name="buttonClearAll" Click="buttonClearAll_Click" Margin="2" IsEnabled="False">
<Image Source="Resources\nav_undo_red.png"/>
</Button>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,405 @@
// Copyright (c) 2023 schick Informatik
// Description: Single dialog to edit times for all participant types
// (we might use different controls at a later time)
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
using System.Windows.Media.Imaging;
using Xceed.Wpf.Toolkit;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesControl.xaml
/// </summary>
public partial class EditTimesControl : Window, IEditTimesControl
{
#region Construction
public EditTimesControl()
{
InitializeComponent();
}
#endregion
#region Properties
public Times Times { get; set; } = new();
public Times? AgencyTimes { get; set; } = new();
public ShipcallControlModel ShipcallModel { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.EnableControls();
this.CopyToControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning,
MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void buttonFixedOrder_Click(object sender, RoutedEventArgs e)
{
bool newValue = true;
if (this.Times.EtaBerthFixed ?? false)
newValue = false;
SetLockButton(newValue);
}
private void buttonClearAll_Click(object sender, RoutedEventArgs e)
{
if (System.Windows.MessageBox.Show(BreCalClient.Resources.Resources.textClearAll, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
this.datePickerETABerth.Value = null;
this.datePickerETABerth_End.Value = null;
this.datePickerETDBerth.Value = null;
this.datePickerETDBerth_End.Value = null;
this.datePickerATA.Value = null;
this.datePickerATD.Value = null;
this.datePickerLockTime.Value = null;
this.datePickerZoneEntry.Value = null;
this.textBoxRemarks.Text = null;
this.datePickerTidalWindowFrom.Value = null;
this.datePickerTidalWindowTo.Value = null;
}
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if ((this.datePickerETABerth.Value != this.Times.EtaBerth) || (this.datePickerETABerth_End.Value != this.Times.EtaIntervalEnd))
{
if (this.datePickerETABerth.Value.IsTooOld() || this.datePickerETABerth_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
}
if (this.datePickerETABerth.Value.HasValue && this.datePickerETABerth_End.Value.HasValue && this.datePickerETABerth.Value > this.datePickerETABerth_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if((this.datePickerETDBerth.Value != this.Times.EtdBerth) || (this.datePickerETDBerth_End.Value != this.Times.EtdIntervalEnd))
{
if(this.datePickerETDBerth.Value.IsTooOld() || this.datePickerETDBerth_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETDBerth.Value.HasValue && this.datePickerETDBerth_End.Value.HasValue && this.datePickerETDBerth.Value > this.datePickerETDBerth_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if (this.datePickerLockTime.Value.IsTooOld() && (this.datePickerLockTime.Value != this.Times.LockTime))
{
message = BreCalClient.Resources.Resources.textLockTimeInThePast;
return false;
}
if (this.datePickerZoneEntry.Value.IsTooOld() && (this.datePickerZoneEntry.Value != this.Times.ZoneEntry))
{
message = BreCalClient.Resources.Resources.textZoneEntryInThePast;
return false;
}
if(this.datePickerATA.Value.IsTooFar() || this.datePickerATD.Value.IsTooFar() || this.datePickerETABerth.Value.IsTooFar() || this.datePickerETABerth_End.Value.IsTooFar() ||
this.datePickerETDBerth.Value.IsTooFar() || this.datePickerETDBerth_End.Value.IsTooFar() || this.datePickerLockTime.Value.IsTooFar() || this.datePickerZoneEntry.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerETABerth_End.Value.HasValue && !this.datePickerETABerth.Value.HasValue) || (this.datePickerETDBerth_End.Value.HasValue && !this.datePickerETDBerth.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
if ((Extensions.ParticipantType)this.Times.ParticipantType == Extensions.ParticipantType.PILOT)
{
if ((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo)) // something has changed
{
if (datePickerTidalWindowTo.Value.IsTooOld() || this.datePickerTidalWindowFrom.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textTidalBothValues;
return false;
}
}
}
return true;
}
private void CopyToModel()
{
this.Times.Remarks = this.textBoxRemarks.Text.Trim().Truncate(512);
this.Times.EtaBerth = this.datePickerETABerth.Value;
this.Times.EtdBerth = this.datePickerETDBerth.Value;
this.Times.EtaIntervalEnd = this.datePickerETABerth_End.Value;
this.Times.EtdIntervalEnd = this.datePickerETDBerth_End.Value;
this.Times.LockTime = this.datePickerLockTime.Value;
this.Times.ZoneEntry = this.datePickerZoneEntry.Value;
this.Times.Ata = this.datePickerATA.Value;
this.Times.Atd = this.datePickerATD.Value;
Extensions.ParticipantType pType = (Extensions.ParticipantType)this.Times.ParticipantType;
if ((pType == Extensions.ParticipantType.PILOT) && this.ShipcallModel.Shipcall != null)
{
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
}
}
private void CopyToControls()
{
this.textBoxRemarks.Text = this.Times.Remarks;
this.datePickerETABerth.Value = this.Times.EtaBerth;
if(this.datePickerETABerth.IsEnabled && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaBerth != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) && (this.AgencyTimes?.EtaBerth > DateTime.Now))
{
this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth;
if (this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
}
this.datePickerETDBerth.Value = this.Times.EtdBerth;
if(this.datePickerETDBerth.IsEnabled && (this.Times.EtdBerth == null) && (this.AgencyTimes?.EtdBerth != null) && ((ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting)) && (this.AgencyTimes?.EtdBerth > DateTime.Now))
{
this.datePickerETDBerth.Value = this.AgencyTimes.EtdBerth;
if (this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) is WatermarkTextBox tb) tb.SelectAll();
}
this.datePickerLockTime.Value = this.Times.LockTime;
this.datePickerZoneEntry.Value = this.Times.ZoneEntry;
this.datePickerATA.Value = this.Times.Ata;
this.datePickerATD.Value = this.Times.Atd;
this.datePickerETABerth_End.Value = this.Times.EtaIntervalEnd;
if (this.datePickerETABerth_End.IsEnabled && (this.Times.EtaIntervalEnd == null) && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaIntervalEnd != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival))
{
this.datePickerETABerth_End.Value = this.AgencyTimes.EtaIntervalEnd;
//if (this.datePickerETABerth_End.Template.FindName("PART_TextBox", this.datePickerETABerth_End) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
}
this.datePickerETDBerth_End.Value = this.Times.EtdIntervalEnd;
if (this.datePickerETDBerth_End.IsEnabled && (this.Times.EtdIntervalEnd == null) && (this.Times.EtdBerth == null) && (this.AgencyTimes?.EtdIntervalEnd != null) && ((ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting)))
{
this.datePickerETDBerth_End.Value = this.AgencyTimes.EtdIntervalEnd;
//if (this.datePickerETDBerth_End.Template.FindName("PART_TextBox", this.datePickerETDBerth_End) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
}
if (this.ShipcallModel.Shipcall?.Type != ShipcallType.Shifting)
{
int displayIndex = this.ShipcallModel.Shipcall?.TimeRefPoint ?? 0;
if (displayIndex > 0)
{
this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[displayIndex]);
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[displayIndex]);
}
else
{
this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth;
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth;
}
}
Extensions.ParticipantType pType = (Extensions.ParticipantType)this.Times.ParticipantType;
if ((pType == Extensions.ParticipantType.PILOT) && this.ShipcallModel.Shipcall != null)
{
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
}
else
{
this.rowt1.Height = new(0);
this.rowt2.Height = new(0);
this.rowt3.Height = new(0);
}
this.SetLockButton(this.Times.EtaBerthFixed ?? false);
}
private void EnableControls()
{
Extensions.ParticipantType pType = (Extensions.ParticipantType) this.Times.ParticipantType;
// setting visibility
if (pType != Extensions.ParticipantType.MOORING)
{
this.labelATA.Visibility = Visibility.Hidden;
this.datePickerATA.Visibility = Visibility.Hidden;
this.labelATD.Visibility = Visibility.Hidden;
this.datePickerATD.Visibility = Visibility.Hidden;
}
else
{
if(ShipcallModel.Shipcall?.Type == ShipcallType.Arrival)
{
this.labelATD.Visibility = Visibility.Hidden;
this.datePickerATD.Visibility = Visibility.Hidden;
}
if (ShipcallModel.Shipcall?.Type == ShipcallType.Departure)
{
this.labelATA.Visibility = Visibility.Hidden;
this.datePickerATA.Visibility = Visibility.Hidden;
}
}
if (ShipcallModel.Shipcall?.Type != ShipcallType.Arrival)
{
this.rowETA.Height = new(0);
}
else
{
this.rowETD.Height = new(0);
}
// setting en/dis-abled
if ((this.Times.ParticipantId != App.Participant.Id) || (this.ShipcallModel.Shipcall?.Canceled ?? false))
{
this.buttonFixedOrder.IsEnabled = false;
this.buttonOK.IsEnabled = false;
return; // if this is not "my" entry, there is no editing!
}
this.datePickerETABerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETABerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETDBerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerETDBerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.textBoxRemarks.IsReadOnly = false;
this.buttonClearAll.IsEnabled = true;
switch (pType)
{
case Extensions.ParticipantType.MOORING:
this.datePickerATA.IsEnabled = true;
this.datePickerATD.IsEnabled = true;
break;
case Extensions.ParticipantType.PORT_ADMINISTRATION:
this.datePickerLockTime.IsEnabled = true;
break;
case Extensions.ParticipantType.TUG:
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
break;
case Extensions.ParticipantType.PILOT:
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerTidalWindowFrom.IsEnabled = true;
this.datePickerTidalWindowTo.IsEnabled = true;
break;
}
}
private void SetLockButton(bool newValue)
{
if (newValue)
{
this.Times.EtaBerthFixed = true;
this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock.png", UriKind.RelativeOrAbsolute));
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipUnSetFixedOrder;
}
else
{
this.Times.EtaBerthFixed = false;
this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock_open.png", UriKind.RelativeOrAbsolute));
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipSetFixedOrder;
}
}
#endregion
#region clear value event handler
private void contextMenuItemClearETA_Click(object sender, RoutedEventArgs e)
{
this.datePickerETABerth.Value = null;
}
private void contextMenuItemClearETD_Click(object sender, RoutedEventArgs e)
{
this.datePickerETDBerth.Value = null;
}
private void contextMenuItemClearLockTime_Click(object sender, RoutedEventArgs e)
{
this.datePickerLockTime.Value = null;
}
private void contextMenuItemClearZoneEntry_Click(object sender, RoutedEventArgs e)
{
this.datePickerZoneEntry.Value = null;
}
private void contextMenuItemClearATA_Click(object sender, RoutedEventArgs e)
{
this.datePickerATA.Value = null;
}
private void contextMenuItemClearATD_Click(object sender, RoutedEventArgs e)
{
this.datePickerATD.Value = null;
}
private void contextMenuItemClearETA_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerETABerth_End.Value = null;
}
private void contextMenuItemClearETD_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerETDBerth_End.Value = null;
}
#endregion
}
}

View File

@ -0,0 +1,126 @@
<Window x:Class="BreCalClient.EditTimesTerminalControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:p = "clr-namespace:BreCalClient.Resources"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:local="clr-namespace:BreCalClient"
mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}"
Title="{x:Static p:Resources.textEditTimes}" Loaded="Window_Loaded" Height="295" Width="500" ResizeMode="CanResizeWithGrip" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".3*" />
<ColumnDefinition Width=".7*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" x:Name="rowStart"/>
<RowDefinition Height="28" x:Name="rowEnd"/>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="56" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textOperationsStart}" HorizontalContentAlignment="Right" x:Name="labelStart" />
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textOperationsEnd}" HorizontalContentAlignment="Right" x:Name="labelEnd" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textBerth}" HorizontalAlignment="Right" x:Name="labelBerth"/>
<Label Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textPierside}" HorizontalContentAlignment="Right" x:Name="labelPierside" />
<Label Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textBerthRemarks}" HorizontalContentAlignment="Right" x:Name="labelBerthRemarks"/>
<Label Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textRemarks}" HorizontalContentAlignment="Right" />
<Grid Grid.Row="0" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationStart" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" >
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationStart" Click="contextMenuItemClearOperationStart_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerOperationStart_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationStart_End" Click="contextMenuItemClearOperationStart_End_Click">
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="0" Margin="2" x:Name="datePickerOperationEnd" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False" >
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationEnd" Click="contextMenuItemClearOperationEnd_Click" >
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
<local:DateTimePickerExt Grid.Row="0" Grid.Column="1" Margin="2" x:Name="datePickerOperationEnd_End" Format="Custom" FormatString="dd.MM. yyyy HH:mm" IsEnabled="False">
<xctk:DateTimePicker.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemClearOperationEnd_End" Click="contextMenuItemClearOperationEnd_End_Click">
<MenuItem.Icon>
<Image Source="Resources\delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</xctk:DateTimePicker.ContextMenu>
</local:DateTimePickerExt>
</Grid>
<ComboBox Name="comboBoxBerth" Grid.Column="1" Grid.Row="2" Margin="2" DisplayMemberPath="Name" SelectedValuePath="Id" IsEnabled="False">
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearValue}" Name="contextMenuItemBerth" Click="contextMenuItemBerth_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<ComboBox x:Name="comboBoxPierside" Grid.Column="1" Grid.Row="3" Margin="2" IsEnabled="False">
<ComboBoxItem Content="{x:Static p:Resources.textPort}" />
<ComboBoxItem Content="{x:Static p:Resources.textStarboard}" />
<ComboBox.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.textClearAssignment}" Name="contextMenuItemClearPierside" Click="contextMenuItemClearPierside_Click" />
</ContextMenu>
</ComboBox.ContextMenu>
</ComboBox>
<TextBox Grid.Row="4" Grid.Column="1" Margin="2" Name="textBoxBerthRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512" />
<TextBox Grid.Row="5" Grid.Column="1" Margin="2" Name="textBoxRemarks" TextWrapping="Wrap" AcceptsReturn="True" SpellCheck.IsEnabled="True" AcceptsTab="False" IsReadOnly="True" MaxLength="512" />
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width= "80" Margin="2" Content="{x:Static p:Resources.textOK}" x:Name="buttonOK" Click="buttonOK_Click" IsEnabled="True"/>
<Button Width="80" Margin="2" Content="{x:Static p:Resources.textCancel}" x:Name="buttonCancel" Click="buttonCancel_Click"/>
<Button Width="28" x:Name="buttonClearAll" Click="buttonClearAll_Click" Margin="2" IsEnabled="False">
<Image Source="Resources\nav_undo_red.png"/>
</Button>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,241 @@
// Copyright (c) 2023 schick Informatik
// Description: Terminals have all different fields so a different dialog
//
using BreCalClient.misc.Model;
using System;
using System.Windows;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for EditTimesTerminalControl.xaml
/// </summary>
public partial class EditTimesTerminalControl : Window, IEditTimesControl
{
public EditTimesTerminalControl()
{
InitializeComponent();
}
#region Properties
public Times Times { get; set; } = new();
public ShipcallControlModel ShipcallModel { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
this.comboBoxBerth.ItemsSource = BreCalLists.GetBerthsByPort(this.ShipcallModel.Shipcall.PortId);
else
this.comboBoxBerth.ItemsSource = BreCalLists.Berths;
this.CopyToControls();
this.EnableControls();
}
private void contextMenuItemClearOperationStart_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationStart.Value = null;
}
private void contextMenuItemClearOperationEnd_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationEnd.Value = null;
}
private void contextMenuItemClearOperationStart_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationStart_End.Value = null;
}
private void contextMenuItemClearOperationEnd_End_Click(object sender, RoutedEventArgs e)
{
this.datePickerOperationEnd_End.Value = null;
}
private void contextMenuItemBerth_Click(object sender, RoutedEventArgs e)
{
this.comboBoxBerth.SelectedIndex -= 1;
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
if (!CheckValues(out string message))
{
System.Windows.MessageBox.Show(message, BreCalClient.Resources.Resources.textWarning, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
this.CopyToModel();
this.DialogResult = true;
this.Close();
}
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
private void buttonClearAll_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show(BreCalClient.Resources.Resources.textClearAll, BreCalClient.Resources.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
this.datePickerOperationStart.Value = null;
this.datePickerOperationStart_End.Value = null;
this.datePickerOperationEnd.Value = null;
this.datePickerOperationEnd_End.Value = null;
this.comboBoxBerth.SelectedIndex = -1;
this.comboBoxPierside.SelectedIndex = -1;
this.textBoxRemarks.Text = null;
this.textBoxBerthRemarks.Text = null;
}
}
#endregion
#region private methods
private bool CheckValues(out string message)
{
message = "";
if((this.datePickerOperationStart.Value != this.Times.OperationsStart) || (this.datePickerOperationStart_End.Value != this.Times.EtaIntervalEnd))
{
if(this.datePickerOperationStart.Value.IsTooOld() || this.datePickerOperationStart_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textOperationStartInThePast;
return false;
}
}
if (this.datePickerOperationStart.Value.HasValue && this.datePickerOperationStart_End.Value.HasValue && this.datePickerOperationStart.Value > this.datePickerOperationStart_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if ((this.datePickerOperationEnd.Value != this.Times.OperationsEnd) || (this.datePickerOperationEnd_End.Value != this.Times.EtdIntervalEnd))
{
if(this.datePickerOperationEnd.Value.IsTooOld() || this.datePickerOperationEnd_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textOperationEndInThePast;
return false;
}
}
if (this.datePickerOperationEnd.Value.HasValue && this.datePickerOperationEnd_End.Value.HasValue && this.datePickerOperationEnd.Value > this.datePickerOperationEnd_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if(this.datePickerOperationEnd.Value.IsTooFar() || this.datePickerOperationEnd_End.Value.IsTooFar() || this.datePickerOperationStart.Value.IsTooFar() || this.datePickerOperationStart_End.Value.IsTooFar())
{
message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
return false;
}
if((this.datePickerOperationEnd_End.Value.HasValue && !this.datePickerOperationEnd.Value.HasValue) || (this.datePickerOperationStart_End.Value.HasValue && !this.datePickerOperationStart.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
private void CopyToModel()
{
this.Times.PierSide = this.comboBoxPierside.SelectedIndex switch
{
0 => true,
1 => false,
_ => null,
};
this.Times.OperationsStart = this.datePickerOperationStart.Value;
this.Times.OperationsEnd = this.datePickerOperationEnd.Value;
this.Times.EtaIntervalEnd = this.datePickerOperationStart_End.Value;
this.Times.EtdIntervalEnd = this.datePickerOperationEnd_End.Value;
this.Times.BerthId = (this.comboBoxBerth.SelectedItem != null) ? ((Berth)this.comboBoxBerth.SelectedItem).Id : null;
this.Times.Remarks = this.textBoxRemarks.Text.Trim();
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
}
private void CopyToControls()
{
this.datePickerOperationStart.Value = this.Times.OperationsStart;
this.datePickerOperationEnd.Value = this.Times.OperationsEnd;
this.datePickerOperationStart_End.Value = this.Times.EtaIntervalEnd;
this.datePickerOperationEnd_End.Value = this.Times.EtdIntervalEnd;
if(this.Times.PierSide == null) { this.comboBoxPierside.SelectedIndex = -1; }
else this.comboBoxPierside.SelectedIndex = (this.Times.PierSide ?? false) ? 0 : 1;
this.comboBoxBerth.SelectedValue = this.Times.BerthId;
this.textBoxRemarks.Text = this.Times.Remarks;
this.textBoxBerthRemarks.Text = this.Times.BerthInfo;
switch (ShipcallModel.Shipcall?.Type)
{
case ShipcallType.Arrival:
this.labelEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd_End.Visibility = Visibility.Hidden;
this.rowEnd.Height = new(0);
break;
case ShipcallType.Departure:
this.rowStart.Height = new(0);
this.labelBerth.Visibility = Visibility.Hidden;
this.comboBoxBerth.Visibility= Visibility.Hidden;
this.labelPierside.Visibility = Visibility.Hidden;
this.comboBoxPierside.Visibility = Visibility.Hidden;
this.labelBerthRemarks.Visibility = Visibility.Hidden;
this.textBoxBerthRemarks.Visibility = Visibility.Hidden;
break;
case ShipcallType.Shifting:
this.rowStart.Height = new(0);
this.labelBerth.Visibility = Visibility.Hidden;
this.comboBoxBerth.Visibility = Visibility.Hidden;
this.labelPierside.Visibility = Visibility.Hidden;
this.comboBoxPierside.Visibility = Visibility.Hidden;
this.labelBerthRemarks.Visibility = Visibility.Hidden;
this.textBoxBerthRemarks.Visibility = Visibility.Hidden;
break;
}
}
private void EnableControls()
{
if ((this.Times.ParticipantId != App.Participant.Id) || (this.ShipcallModel.Shipcall?.Canceled ?? false))
{
this.buttonOK.IsEnabled = false;
return;
}
this.datePickerOperationStart.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.datePickerOperationStart_End.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.datePickerOperationEnd.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerOperationEnd_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.comboBoxBerth.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.comboBoxPierside.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.textBoxBerthRemarks.IsReadOnly = ShipcallModel.Shipcall?.Type != ShipcallType.Arrival;
this.textBoxRemarks.IsReadOnly = false;
this.buttonClearAll.IsEnabled = true;
}
#endregion
}
}

View File

@ -0,0 +1,71 @@
// Copyright (c) 2024- schick Informatik
// Description: Helpers to display localized Enum values in Comboboxes
// https://stackoverflow.com/questions/29658721/enum-in-wpf-comboxbox-with-localized-names
//
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;
namespace BreCalClient
{
#region class EnumToStringConverter
public sealed class EnumToStringConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{ return null; }
return Resources.Resources.ResourceManager.GetString(value.ToString() ?? "");
}
public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string str = (string)value;
foreach (object enumValue in Enum.GetValues(targetType))
{
if (str == Resources.Resources.ResourceManager.GetString(enumValue.ToString() ?? ""))
{ return enumValue; }
}
return null;
}
}
#endregion
#region class EnumerateExtension
public sealed class EnumerateExtension : MarkupExtension
{
public Type Type { get; set; }
public EnumerateExtension(Type type)
{
this.Type = type;
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
string[] names = Enum.GetNames(Type);
// skip value "0" == "Unknown" (we dont want this selectable in the Combobox)
// NOTE: This will only work in the future if the first element is always "undefined" aka unused
string[] values = new string[names.Length - 1];
for (int i = 0; i < names.Length - 1; i++)
{
values[i] = Resources.Resources.ResourceManager.GetString(names[i + 1]) ?? names[i];
}
return values;
}
}
#endregion
}

View File

@ -0,0 +1,174 @@
// Copyright (c) 2023 schick Informatik
// Description: some helpers
//
using BreCalClient.misc.Model;
using System;
using System.ComponentModel;
namespace BreCalClient
{
public static class Extensions
{
#region Enum
/// <summary>
/// Copied from models clunky I know
/// </summary>
[Flags]
public enum ParticipantType
{
[Description("not assigned")]
NONE = 0,
[Description("BSMD")]
BSMD = 1,
[Description("Terminal")]
TERMINAL = 2,
[Description("Flusslotsen")]
PILOT = 4,
[Description("Agentur")]
AGENCY = 8,
[Description("Festmacher")]
MOORING = 16,
[Description("Hafenamt")]
PORT_ADMINISTRATION = 32,
[Description("Schlepper")]
TUG = 64,
}
/// <summary>
/// Custom participant flags
/// </summary>
[Flags]
public enum ParticipantFlag
{
[Description("allow BSMD initial info")]
ALLOW_BSMD = 1,
}
public enum SortOrder
{
SHIP_NAME,
ETA_ETD,
MODIFIED
}
#endregion
#region public helper
public static bool IsTooFar(this DateTime datetime)
{
return datetime > DateTime.Now.AddYears(1);
}
public static bool IsTooFar(this DateTime? datetime)
{
if (datetime == null) return false;
return datetime > DateTime.Now.AddYears(1);
}
public static bool IsTooOld(this DateTime? datetime)
{
if (datetime == null) return false;
{
return datetime < DateTime.Now.AddDays(-1);
}
}
public static bool IsTypeFlagSet(this Participant participant, ParticipantType flag)
{
return (participant.Type & (uint)flag) != 0;
}
public static bool IsFlagSet(this Participant participant, ParticipantFlag flag)
{
return (participant.Flags & (uint)flag) != 0;
}
public static string Truncate(this string value, int maxLength)
{
if (string.IsNullOrEmpty(value)) return value;
return value.Length <= maxLength ? value : value[..maxLength];
}
public static string TruncateDots(this string value, int maxLength)
{
if(string.IsNullOrEmpty(value)) return value;
if (value.Length <= maxLength) return value;
if (value.Length > (maxLength + 1))
{
int i = maxLength - 2;
for (; (i > 0) && !(char.IsWhiteSpace(value[i])); i--) ; // try to put the "..." at a word break
return value.Substring(0, i) + " ...";
}
return value[..maxLength];
}
public static string DisplayTime(this Times times, bool isArrival)
{
if (isArrival)
{
if(times.ParticipantType == (int) ParticipantType.TERMINAL)
{
if(times.OperationsStart.HasValue)
{
string result = times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtaIntervalEnd.HasValue) result = times.OperationsStart.Value.ToString("d.M. HH:mm") + " - " + times.EtaIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
else
{
if(times.EtaBerth.HasValue)
{
string result = times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtaIntervalEnd.HasValue) result = times.EtaBerth.Value.ToString("d.M. HH:mm") + " - " + times.EtaIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
}
else
{
if (times.ParticipantType == (int)ParticipantType.TERMINAL)
{
if(times.OperationsEnd.HasValue)
{
string result = times.OperationsEnd.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtdIntervalEnd.HasValue) result = times.OperationsEnd.Value.ToString("d.M. HH:mm") + " - " + times.EtdIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
else
{
if(times.EtdBerth.HasValue)
{
string result = times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm");
if (times.EtdIntervalEnd.HasValue) result = times.EtdBerth.Value.ToString("d.M. HH:mm") + " - " + times.EtdIntervalEnd.Value.ToString("d.M. HH:mm");
return result;
}
else
{
return "- / -";
}
}
}
}
#endregion
}
}

View File

@ -0,0 +1,39 @@
<UserControl x:Class="BreCalClient.HistoryControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BreCalClient"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d"
d:DesignHeight="46" d:DesignWidth="800">
<Border BorderBrush="Black" BorderThickness="0 0 0 .5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="14" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textShip}" VerticalAlignment="Center" Foreground="Gray" />
<TextBlock Grid.Row="0" Grid.Column="1" FontSize="10" FontWeight="DemiBold" VerticalAlignment="Center" x:Name="textBlockShipcallType" />
<TextBlock Grid.Row="0" Grid.Column="2" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textTimestamp}" VerticalAlignment="Center" Foreground="Gray"/>
<TextBlock Grid.Row="0" Grid.Column="3" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textOperation}" VerticalAlignment="Center" Foreground="Gray"/>
<TextBlock Grid.Row="0" Grid.Column="4" FontSize="10" FontWeight="DemiBold" Text="{x:Static p:Resources.textParticipant}" VerticalAlignment="Center" Foreground="Gray"/>
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="textBlockShip" FontWeight="DemiBold">
<Hyperlink Click="textBlockShip_Click">
<TextBlock x:Name="hyperLinkShip" />
</Hyperlink>
</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="textBlockEta" />
<TextBlock Grid.Row="1" Grid.Column="2" x:Name="textBlockTimestamp" />
<TextBlock Grid.Row="1" Grid.Column="3" x:Name="textBlockOperation" />
<TextBlock Grid.Row="1" Grid.Column="4" x:Name="textBlockParticipant" />
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,38 @@
// Copyright (c) 2024- schick Informatik
// Description: display single history element (later shown in a list)
//
using BreCalClient.misc.Model;
using System;
using System.Windows.Controls;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for HistoryControl.xaml
/// </summary>
public partial class HistoryControl : UserControl
{
private readonly History _history;
public event Action<int>? HistorySelected;
public HistoryControl(string ship, History history, string callType, string etaetd)
{
InitializeComponent();
_history = history;
this.textBlockOperation.Text = $"{history.Operation} on {history.Type}";
this.hyperLinkShip.Text = ship;
if(BreCalLists.ParticipantLookupDict.ContainsKey(history.ParticipantId))
this.textBlockParticipant.Text = BreCalLists.ParticipantLookupDict[history.ParticipantId].Name;
this.textBlockTimestamp.Text = history.Timestamp.ToString();
this.textBlockEta.Text = etaetd;
this.textBlockShipcallType.Text = callType;
}
private void textBlockShip_Click(object sender, System.Windows.RoutedEventArgs e)
{
this.HistorySelected?.Invoke(_history.ShipcallId);
}
}
}

View File

@ -0,0 +1,32 @@
<Window x:Class="BreCalClient.HistoryDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d" Left="{local:SettingBinding W4Left}" Top="{local:SettingBinding W4Top}"
Title="{x:Static p:Resources.textChangeHistory}" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="2">
<StackPanel x:Name="stackPanel"/>
</ScrollViewer>
<Grid Grid.Row="1" Grid.Column="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="22" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<CheckBox x:Name="checkboxMyOwnOnly" VerticalContentAlignment="Center" Grid.Column="0" Margin="2" Checked="checkboxMyOwnOnly_Checked" Unchecked="checkboxMyOwnOnly_Checked" />
<Label Content="{x:Static p:Resources.textMineOnly}" Grid.Column="1" />
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Right" />
</Grid>
</Grid>
</Window>

View File

@ -0,0 +1,136 @@
// Copyright (c) 2024- schick Informatik
// Description:
//
using BreCalClient.misc.Api;
using BreCalClient.misc.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Printing;
using System.Windows;
using System.Windows.Input;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for HistoryDialog.xaml
/// </summary>
public partial class HistoryDialog : Window
{
#region Fields
private readonly ConcurrentDictionary<int, ShipcallControlModel> _shipcalls;
private readonly StaticApi _staticApi;
#endregion
#region delegate/event to react to history item selection
public event Action<int>? HistoryItemSelected;
#endregion
#region Construction
public HistoryDialog(ConcurrentDictionary<int, ShipcallControlModel> shipcalls, StaticApi staticApi)
{
InitializeComponent();
_shipcalls = shipcalls;
_staticApi = staticApi;
}
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Mouse.OverrideCursor = Cursors.Wait;
RefreshHistory();
}
private void buttonClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void checkboxMyOwnOnly_Checked(object sender, RoutedEventArgs e)
{
Mouse.OverrideCursor = Cursors.Wait;
RefreshHistory();
}
#endregion
#region private methods
private async void RefreshHistory()
{
List<History> allHistories = new();
this.stackPanel.Children.Clear();
foreach (int shipcall_id in _shipcalls.Keys)
{
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
System.Diagnostics.Trace.WriteLine($"{shipcallHistory.Count} history elements loaded for shipcall {shipcall_id}");
allHistories.AddRange( shipcallHistory );
}
// sort all entries
allHistories.Sort((x, y) => { return y.Timestamp.CompareTo(x.Timestamp); });
EnumToStringConverter enumToStringConverter = new();
// create controls for all entries
foreach (History history in allHistories)
{
if (FilterShipcall(history.ShipcallId)) continue;
string shipname = "";
Ship? ship = this._shipcalls[history.ShipcallId].Ship;
if (ship != null)
shipname = ship.Name;
string etaetd = "", calltype = "";
if (_shipcalls.ContainsKey(history.ShipcallId))
{
etaetd = _shipcalls[history.ShipcallId].GetETAETD();
if (_shipcalls[history.ShipcallId].Shipcall != null)
{
ShipcallType? type = _shipcalls[history.ShipcallId].Shipcall?.Type;
if (type != null) calltype = (string) (enumToStringConverter.Convert(type ?? ShipcallType.Undefined, typeof(ShipcallType), new(), System.Globalization.CultureInfo.CurrentCulture) ?? "");
}
}
HistoryControl hc = new(shipname, history, calltype, etaetd);
hc.HistorySelected += (x) => { HistoryItemSelected?.Invoke(x); }; // bubble event
this.stackPanel.Children.Add(hc);
}
Mouse.OverrideCursor = null;
}
bool FilterShipcall(int shipcallId)
{
bool result = true;
if (shipcallId < 0) return result;
if(_shipcalls.TryGetValue(shipcallId, out ShipcallControlModel? scm))
{
if(this.checkboxMyOwnOnly.IsChecked ?? false)
{
foreach(ParticipantAssignment p in scm.AssignedParticipants.Values)
{
if (p.ParticipantId.Equals(App.Participant.Id)) return false;
}
}
else
{
return false;
}
}
return result;
}
#endregion
}
}

View File

@ -0,0 +1,22 @@
// Copyright (c) 2023 schick Informatik
// Description: Interfaces to simplify dialog handling
//
using BreCalClient.misc.Model;
namespace BreCalClient
{
internal interface IEditTimesControl
{
Times Times { get; set; }
string Title { get; set; }
ShipcallControlModel ShipcallModel { get; set; }
bool? ShowDialog();
}
}

View File

@ -0,0 +1,186 @@
<Window x:Class="BreCalClient.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:sets="clr-namespace:BreCalClient.Properties"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d"
Title="{DynamicResource textApplicationTitle}" Height="{local:SettingBinding Height}" Width="{local:SettingBinding Width}"
Top="{local:SettingBinding Top}" Left="{local:SettingBinding Left}" Loaded="Window_Loaded" Closing="Window_Closing" Icon="Resources/containership.ico">
<Window.Resources>
<local:BoolToIndexConverter x:Key="boolToIndexConverter" />
</Window.Resources>
<xctk:BusyIndicator Name="busyIndicator" IsBusy="True">
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</xctk:BusyIndicator.ProgressBarStyle>
<xctk:BusyIndicator.BusyContent>
<Grid Width="320">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="84" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Content="{x:Static p:Resources.textUserlogin}" Grid.Row="0" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textUsername}" Grid.Row="1" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textPassword}" Grid.Row="2" VerticalContentAlignment="Center" />
<TextBox Name="textUsername" Grid.Row="1" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" />
<PasswordBox Name="textPassword" Grid.Row="2" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" PasswordChar="*"/>
<Label Name="labelLoginResult" Grid.Row="3" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" />
<Button Name="buttonLogin" Content="{x:Static p:Resources.textLogin}" Grid.Row="4" Grid.Column="0" Margin="2" Click="buttonLogin_Click" IsDefault="True" />
<Button Name="buttonExit" Content="{x:Static p:Resources.textExit}" Grid.Row="4" Grid.Column="1" Margin="2" Click="buttonExit_Click" />
<TextBlock FontSize="10" TextWrapping="Wrap" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" >
<Underline>Hinweis</Underline>:<LineBreak />
Mit der Anmeldung in Bremen Calling akzeptieren Sie die Bedingungen<LineBreak />
des Systems, die Sie in der aktuell gültigen Fassung unter dem nachfolgenden Link
einsehen können: <Hyperlink NavigateUri="https://www.bsmd-emswe.eu/disclaimer.html" RequestNavigate="Hyperlink_RequestNavigate">Datenschutzerklärung</Hyperlink>.
</TextBlock>
</Grid>
</xctk:BusyIndicator.BusyContent>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="56" />
<RowDefinition Height="28" />
<RowDefinition Height="34" />
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<local:SearchFilterControl Grid.Row="0" x:Name="searchFilterControl" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60" />
<ColumnDefinition Width=".1*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".1*" />
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".1*" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<Button Margin="2" Grid.Column="0" Content="{x:Static p:Resources.textNewDots}" x:Name="buttonNew" Visibility="Hidden" Click="buttonNew_Click" Background="Transparent"/>
<Label Content="{x:Static p:Resources.textSortOrder}" Grid.Column="1" HorizontalContentAlignment="Right"/>
<Grid Grid.Column="2" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<ComboBox x:Name="comboBoxSortOrder" Margin="2" Grid.Column="0" SelectionChanged="comboBoxSortOrder_SelectionChanged" />
<CheckBox x:Name="checkboxShowCancelledCalls" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="2" Checked="checkboxShowCancelledCalls_Checked" Unchecked="checkboxShowCancelledCalls_Checked" />
<Label Content="{x:Static p:Resources.textShowCancelledShipcalls}" Grid.Column="2" />
</Grid>
<Label Content="{x:Static p:Resources.textHarbour}" Grid.Column="3" HorizontalAlignment="Right" />
<xctk:CheckComboBox x:Name="comboBoxPorts" Margin="2" Grid.Column="4" ItemSelectionChanged="comboBoxPorts_ItemSelectionChanged" DisplayMemberPath="Name" />
<Button Margin="2" Grid.Column="6" Content="{x:Static p:Resources.textClearFilters}" x:Name="buttonClearFilter" Click="buttonClearFilter_Click" Background="Transparent" />
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".13*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
<ColumnDefinition Width=".15*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="1" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textAgency}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="2" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textMooring}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="3" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textPortAuthority}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="4" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textPilots}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="5" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTug}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
<Label Grid.Column="6" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" Foreground="White" Content="{x:Static p:Resources.textTerminal}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
</Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
<StackPanel x:Name="stackPanel"/>
</ScrollViewer>
<StatusBar Grid.Row="4">
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="26" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="0">
<TextBlock Name="labelGeneralStatus" FontSize="9"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="1"/>
<StatusBarItem Grid.Column="2">
<TextBlock Name="labelVersion"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="3"/>
<StatusBarItem Grid.Column="4">
<TextBlock Name="labelUsername"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="5"/>
<StatusBarItem Grid.Column="6">
<Button x:Name="buttonInfo" Content="?" Click="buttonInfo_Click" Width="20" ToolTip="{x:Static p:Resources.textInfoChangePW}"/>
</StatusBarItem>
<Separator Grid.Column="7"/>
<StatusBarItem Grid.Column="8">
<Button x:Name="buttonHistory" Click="buttonHistory_Click" Width="20" ToolTip="{x:Static p:Resources.textShowHistory}">
<Image Source="./Resources/clock.png"/>
</Button>
</StatusBarItem>
<Separator Grid.Column="9"/>
<StatusBarItem Grid.Column="10">
<Button x:Name="buttonNotifications" Click="buttonNotifications_Click" Width="20" ToolTip="{x:Static p:Resources.textShowNotifications}">
<Image Source="./Resources/bell3.png"/>
</Button>
</StatusBarItem>
<Separator Grid.Column="9"/>
<StatusBarItem Grid.Column="12">
<TextBlock Name="labelStatusBar"></TextBlock>
</StatusBarItem>
<Separator Grid.Column="13"/>
<StatusBarItem Grid.Column="14">
<Button x:Name="buttonManualRefresh" Width="20" Click="buttonManualRefresh_Click" ToolTip="{x:Static p:Resources.textTriggerManualRefresh}">
<Image Source="./Resources/nav_refresh_green.png"/>
</Button>
</StatusBarItem>
<StatusBarItem Grid.Column="15">
<TextBlock x:Name="labelLatestUpdate" />
</StatusBarItem>
<Separator Grid.Column="16"/>
<StatusBarItem Grid.Column="17">
<ProgressBar Name="generalProgressStatus" Width="90" Height="16" Foreground="LightGray"/>
</StatusBarItem>
</StatusBar>
</Grid>
</xctk:BusyIndicator>
</Window>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
<Window x:Class="BreCalClient.NotificationDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p = "clr-namespace:BreCalClient.Resources"
mc:Ignorable="d" Left="{local:SettingBinding W5Left}" Top="{local:SettingBinding W5Top}"
Title="{x:Static p:Resources.textNotifications}" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<local:ENIDataGrid x:Name="dataGridNotifications" Grid.Row="0" SelectionMode="Single" IsReadOnly="True" AutoGenerateColumns="False"
CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<local:ENIDataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Style.Triggers>
<DataTrigger Binding="{Binding NotificationType}" Value="Assignment">
<Setter Property="Foreground" Value="Blue"/>
</DataTrigger>
<DataTrigger Binding="{Binding NotificationType}" Value="Next24h">
<Setter Property="Foreground" Value="DarkOrange"/>
</DataTrigger>
<DataTrigger Binding="{Binding NotificationType}" Value="TimeConflict">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding NotificationType}" Value="TimeConflictResolved">
<Setter Property="Foreground" Value="Green"/>
</DataTrigger>
<DataTrigger Binding="{Binding NotificationType}" Value="Unassigned">
<Setter Property="Foreground" Value="DarkGray"/>
</DataTrigger>
<DataTrigger Binding="{Binding NotificationType}" Value="MissingData">
<Setter Property="Foreground" Value="Yellow" />
<Setter Property="Background" Value="DarkGray" />
</DataTrigger>
<DataTrigger Binding="{Binding NotificationType}" Value="Cancelled">
<Setter Property="Background" Value="LightGray" />
</DataTrigger>
</Style.Triggers>
</Style>
</local:ENIDataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static p:Resources.textType}" Binding="{Binding Path=NotificationDisplay}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static p:Resources.textDate}" Binding="{Binding Path=NotificationDate}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static p:Resources.textShip}" Binding="{Binding Path=Ship}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static p:Resources.textShipcall}" Binding="{Binding Path=ShipcallType}" IsReadOnly="True"/>
<DataGridTextColumn Header="ETA/ETD" Binding="{Binding Path=ETA}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static p:Resources.textBerth}" Binding="{Binding Path=Berth}" IsReadOnly="True"/>
</DataGrid.Columns>
</local:ENIDataGrid>
<Grid Grid.Row="1" Grid.Column="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="22" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width=".2*" />
</Grid.ColumnDefinitions>
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Right" />
</Grid>
</Grid>
</Window>

View File

@ -0,0 +1,44 @@
// Copyright (c) 2024- schick Informatik
// Description:
//
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace BreCalClient
{
/// <summary>
/// Interaction logic for NotificationDialog.xaml
/// </summary>
public partial class NotificationDialog : Window
{
public NotificationDialog()
{
InitializeComponent();
}
internal ObservableCollection<AppNotification>? AppNotifications { get; set; }
private void buttonClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.dataGridNotifications.ItemsSource = AppNotifications;
}
}
}

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.8.0.0</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Debug</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<ErrorReportUrl>https://www.textbausteine.net/</ErrorReportUrl>
<GenerateManifests>true</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>https://www.bsmd-emswe.eu/develclient/</InstallUrl>
<IsRevisionIncremented>False</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<ProductName>Bremen calling development client</ProductName>
<PublishDir>bin\Debug\net8.0-windows7.0\win-x64\app.publish\</PublishDir>
<PublishUrl>bin\publish.devel\</PublishUrl>
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>True</PublishReadyToRun>
<PublishSingleFile>True</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<SuiteName>Bremen calling</SuiteName>
<SupportUrl>https://www.textbausteine.net/</SupportUrl>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>True</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
<MinimumRequiredVersion>1.8.0.0</MinimumRequiredVersion>
<SkipPublishVerification>false</SkipPublishVerification>
</PropertyGroup>
<ItemGroup>
<PublishFile Include="containership.ico">
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>true</IncludeHash>
<FileType>File</FileType>
</PublishFile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>6.0</ApplicationVersion>
<BootstrapperEnabled>False</BootstrapperEnabled>
<Configuration>Release</Configuration>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<ErrorReportUrl>http://www.textbausteine.net</ErrorReportUrl>
<GenerateManifests>true</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>https://www.bsmd-emswe.eu/client/</InstallUrl>
<IsRevisionIncremented>False</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<PublishDir>bin\Release\net6.0-windows\win-x64\app.publish\</PublishDir>
<PublishUrl>bin\publish\</PublishUrl>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishSingleFile>True</PublishSingleFile>
<SelfContained>True</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<TargetFramework>net6.0-windows</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>False</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<ErrorReportUrl>https://www.bsmd-emswe.eu/</ErrorReportUrl>
<ProductName>BreCalClient</ProductName>
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
<SuiteName>Bremen calling client</SuiteName>
<SupportUrl>https://www.bsmd-emswe.eu/</SupportUrl>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SkipPublishVerification>false</SkipPublishVerification>
</PropertyGroup>
<ItemGroup>
<PublishFile Include="containership.ico">
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>true</IncludeHash>
<FileType>File</FileType>
</PublishFile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>5</ApplicationRevision>
<ApplicationVersion>1.7.0.7</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Debug</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<ErrorReportUrl>https://www.textbausteine.net/</ErrorReportUrl>
<GenerateManifests>true</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>https://www.bsmd-emswe.eu/testclient/</InstallUrl>
<IsRevisionIncremented>False</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<PublishUrl>bin\publish.test\</PublishUrl>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>True</PublishReadyToRun>
<PublishSingleFile>True</PublishSingleFile>
<SelfContained>True</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>True</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<ErrorReportUrl>https://www.bsmd-emswe.eu/</ErrorReportUrl>
<ProductName>Bremen Calling Testclient</ProductName>
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
<SuiteName>Bremen Calling</SuiteName>
<SupportUrl>http://www.textbausteine.net/</SupportUrl>
<PublishDir>bin\Debug\net8.0-windows7.0\win-x64\app.publish\</PublishDir>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SkipPublishVerification>false</SkipPublishVerification>
<MinimumRequiredVersion>1.7.0.7</MinimumRequiredVersion>
</PropertyGroup>
<ItemGroup>
<PublishFile Include="containership.ico">
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>true</IncludeHash>
<FileType>File</FileType>
</PublishFile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,265 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BreCalClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("#751D1F")]
public string BG_COLOR {
get {
return ((string)(this["BG_COLOR"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("!!Bremen calling Entwicklungsversion!!")]
public string APP_TITLE {
get {
return ((string)(this["APP_TITLE"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://www.textbausteine.net/")]
public string LOGO_IMAGE_URL {
get {
return ((string)(this["LOGO_IMAGE_URL"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FilterCriteria {
get {
return ((string)(this["FilterCriteria"]));
}
set {
this["FilterCriteria"] = value;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("https://brecaltest.bsmd-emswe.eu")]
public string API_URL {
get {
return ((string)(this["API_URL"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("800")]
public double Width {
get {
return ((double)(this["Width"]));
}
set {
this["Width"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("450")]
public double Height {
get {
return ((double)(this["Height"]));
}
set {
this["Height"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double Left {
get {
return ((double)(this["Left"]));
}
set {
this["Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double Top {
get {
return ((double)(this["Top"]));
}
set {
this["Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W1Left {
get {
return ((double)(this["W1Left"]));
}
set {
this["W1Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W1Top {
get {
return ((double)(this["W1Top"]));
}
set {
this["W1Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W2Left {
get {
return ((double)(this["W2Left"]));
}
set {
this["W2Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W2Top {
get {
return ((double)(this["W2Top"]));
}
set {
this["W2Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W3Left {
get {
return ((double)(this["W3Left"]));
}
set {
this["W3Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W3Top {
get {
return ((double)(this["W3Top"]));
}
set {
this["W3Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W4Left {
get {
return ((double)(this["W4Left"]));
}
set {
this["W4Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W4Top {
get {
return ((double)(this["W4Top"]));
}
set {
this["W4Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FilterCriteriaMap {
get {
return ((string)(this["FilterCriteriaMap"]));
}
set {
this["FilterCriteriaMap"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::System.Collections.Specialized.StringCollection Notifications {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["Notifications"]));
}
set {
this["Notifications"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W5Top {
get {
return ((double)(this["W5Top"]));
}
set {
this["W5Top"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public double W5Left {
get {
return ((double)(this["W5Left"]));
}
set {
this["W5Left"] = value;
}
}
}
}

View File

@ -0,0 +1,69 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BreCalClient.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="BG_COLOR" Type="System.String" Scope="Application">
<Value Profile="(Default)">#751D1F</Value>
</Setting>
<Setting Name="APP_TITLE" Type="System.String" Scope="Application">
<Value Profile="(Default)">!!Bremen calling Entwicklungsversion!!</Value>
</Setting>
<Setting Name="LOGO_IMAGE_URL" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://www.textbausteine.net/</Value>
</Setting>
<Setting Name="FilterCriteria" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="API_URL" Type="System.String" Scope="Application">
<Value Profile="(Default)">https://brecaltest.bsmd-emswe.eu</Value>
</Setting>
<Setting Name="Width" Type="System.Double" Scope="User">
<Value Profile="(Default)">800</Value>
</Setting>
<Setting Name="Height" Type="System.Double" Scope="User">
<Value Profile="(Default)">450</Value>
</Setting>
<Setting Name="Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W1Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W1Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W2Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W2Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W3Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W3Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W4Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W4Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="FilterCriteriaMap" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Notifications" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="W5Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W5Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,40 @@
# Bremen calling WPF client
## Introduction
## API / code generation
The Rest API client is generated from the OpenAPI specification [BreCalApi.yaml](../../misc/BreCalApiyaml) into the C# file [BreCalApi.cs](../../misc/BreCalApi.cs).
In order to do so an extension for Visual Studio needs to be installed: REST API Client Code Generator for VS 2022.
https://marketplace.visualstudio.com/items?itemName=ChristianResmaHelle.ApiClientCodeGenerator2022
This extension has multiple generators, for this project OpenApiCodeGenerator is used (must be set on the yaml file in the project settings).
Internally this uses Java, currently > 55 which translates into Java JDK 17 LTS.
If code generation is not working please have a look in the output pane and select appropriate output source.
## Installation
The client is deployed via ClickOnce.
To deploy the test client, leave everything as it is in develop branch and publish using the profile [ClickOnceTestProfile.pubxml](./Properties/PublishProfiles/ClickOnceTestProfile.pubxml).
To deploy the productive version, use the profile [ClickOnceProfile.pubxml](./Properties/PublishProfiles/ClickOnceProfile.pubxml).
You will also need to change the AssemblyName in BreCalClient.csproj back to BreCalClient.
```xml
<AssemblyName>BreCalClient</AssemblyName>
```
Resources are embedded in the assembly. Therefore wherever Resources are referenced via assembly name this name has to be adjusted as well. For example:
```C++
this.imageShipcallType.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalClient;component/Resources/arrow_right_green.png"));
```
It is debatable if the single contained file deployment makes sense at this point. Installation file size
is at about 150MB which takes a long time to upload however it should run on any current windows installation.
Theoretically it should also work on Linux.
### Signing
Currently neither assemblies nor the installation is signed. This probably only makes sense with a paid public code signing certificate.

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More