Compare commits

...

291 Commits

Author SHA1 Message Date
philipp lang a456cc1889 Fix: Sort participants by created_at
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-12-16 14:18:02 +01:00
philipp lang 784b49c3dd Add invoice full text search
continuous-integration/drone/push Build is failing Details
2024-12-15 16:05:38 +01:00
philipp lang c3a0381a0a Fix invoice settings when fields are empty
continuous-integration/drone/push Build is passing Details
2024-12-15 12:06:44 +01:00
philipp lang 101ac7402a Add Phpunit to gitignore
continuous-integration/drone/push Build is passing Details
2024-12-15 11:56:13 +01:00
philipp lang 2c38488962 Remove cross
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-12-13 19:13:30 +01:00
philipp lang 8a26276e28 Rename document
continuous-integration/drone/push Build is passing Details
2024-12-13 19:03:40 +01:00
philipp lang 4651a4cb96 Lint
continuous-integration/drone/push Build is passing Details
2024-12-13 14:37:13 +01:00
philipp lang 688e10e230 Lint
continuous-integration/drone/push Build is failing Details
2024-12-13 11:56:02 +01:00
philipp lang 267da38c6b Lint
continuous-integration/drone/push Build is passing Details
2024-12-13 02:46:44 +01:00
philipp lang 499c61afff Lint 2024-12-13 02:44:08 +01:00
philipp lang 02531938b3 Lint 2024-12-13 02:42:08 +01:00
philipp lang 1c53e81f1a Lint 2024-12-13 02:40:33 +01:00
philipp lang 98712093b2 Lint 2024-12-13 02:36:17 +01:00
philipp lang a32ef33113 Move engine 2024-12-13 02:33:12 +01:00
philipp lang 088ea4f0a2 Lint 2024-12-13 02:28:41 +01:00
philipp lang 4ac89da124 Lint 2024-12-13 02:16:09 +01:00
philipp lang 286ceea0d4 Lint 2024-12-13 01:59:24 +01:00
philipp lang 52ac5937a4 Add validation 2024-12-13 01:59:09 +01:00
philipp lang 4690e86bbf Add gallier document 2024-12-13 01:54:02 +01:00
philipp lang 1a4a7c3652 Add base gallier document 2024-12-13 00:58:44 +01:00
philipp lang b05c5025c0 Add button to mark invoice as paid
continuous-integration/drone/push Build is passing Details
2024-12-12 21:26:51 +01:00
philipp lang acf7b94094 Update CHANGELOG
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/tag Build is passing Details
2024-12-12 16:37:20 +01:00
philipp lang 57b1efb065 Add registration_from and registration_until to frontend api
continuous-integration/drone/push Build is passing Details
2024-12-12 15:42:35 +01:00
philipp lang 3e563f8390 Add registration_from and registration_to fields 2024-12-12 15:21:03 +01:00
philipp lang 0a5590d533 Remove CreatesApplication Trait 2024-12-12 13:56:13 +01:00
philipp lang 10deaf15a1 Update form edit view 2024-12-12 13:45:42 +01:00
philipp lang ae447a7a60 Add fileshare and web setting on bin/run 2024-12-12 13:45:26 +01:00
philipp lang baea21807a Update CHANGELOG
continuous-integration/drone/push Build is passing Details
2024-12-12 13:21:05 +01:00
philipp lang 58426c5537 Fix tests
continuous-integration/drone/push Build was killed Details
2024-12-12 12:18:49 +01:00
philipp lang 84cd13c085 Fix migration
continuous-integration/drone/push Build is failing Details
2024-12-12 03:12:26 +01:00
philipp lang b8d2b37057 Add sorting frontend for participants list
continuous-integration/drone/push Build is failing Details
2024-12-12 03:07:10 +01:00
philipp lang 44eb3719b9 Update tests
continuous-integration/drone/push Build is passing Details
2024-12-12 02:35:27 +01:00
philipp lang c65a208e34 Add frontend for sorting
continuous-integration/drone/push Build was killed Details
2024-12-12 02:33:10 +01:00
philipp lang 95a8d4d689 Fix page navigation 2024-12-12 02:27:58 +01:00
philipp lang e1e8669beb Fix tests
continuous-integration/drone/push Build is failing Details
2024-12-12 01:32:01 +01:00
philipp lang a3ecfa756d Add sorting to participant list
continuous-integration/drone/push Build was killed Details
2024-12-12 01:26:22 +01:00
philipp lang 70e085a49e Fix: Dont update form when not using meilisearch
continuous-integration/drone/push Build is failing Details
2024-12-12 00:50:05 +01:00
philipp lang 1178b011e0 Lint
continuous-integration/drone/push Build was killed Details
2024-12-12 00:36:56 +01:00
philipp lang 6a91e857d2 Add filtering for participant index
continuous-integration/drone/push Build was killed Details
2024-12-12 00:30:59 +01:00
philipp lang 82baf67a73 Lint 2024-12-11 22:37:49 +01:00
philipp lang 36466420f6 Lint 2024-12-11 22:36:25 +01:00
philipp lang 54c37fccd1 Add searchable participants via full text 2024-12-11 22:32:23 +01:00
philipp lang d03f036a2b Move ParticipantIndexActionTest to EndToEnd 2024-12-10 01:28:35 +01:00
philipp lang 75d11f9860 Update formsettings when copying db 2024-12-10 00:58:05 +01:00
philipp lang da4d553ea6 Update CHANGELOG
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-12-09 14:08:52 +01:00
philipp lang 5bad88c5f4 Add config for job batching
continuous-integration/drone/push Build is passing Details
2024-12-09 14:08:02 +01:00
philipp lang 75dc0d9769 Update CHANGELOG
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-11-20 11:11:26 +01:00
philipp lang 9fc8548504 Fix: Dont remember past events
continuous-integration/drone/push Build is passing Details
2024-11-20 11:10:24 +01:00
philipp lang c990ce3171 Fix Color of lilie svg
continuous-integration/drone/push Build is failing Details
2024-11-18 23:06:36 +01:00
philipp lang e7f63d19e5 Add imagick extension
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-11-13 19:44:40 +01:00
philipp lang f549b31862 Update medialibrary-helper
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-11-13 14:36:29 +01:00
philipp lang 1f4efb22d3 Install imagemagick 2024-11-13 14:35:54 +01:00
philipp lang 3e725d9842 Install imagick extension 2024-11-13 13:14:45 +01:00
philipp lang 16d3bc51a3 Fix php version of deploy
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-11-12 01:20:41 +01:00
philipp lang 0467f24ff6 Update composer in nginx.Dockerfile
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2024-11-12 00:39:40 +01:00
philipp lang ed1a8f30bc Update composer version in Dockerfile
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2024-11-11 23:43:17 +01:00
philipp lang e5066af192 Add instruction for building adrema-base image 2024-11-11 23:36:09 +01:00
philipp lang 31afa2e418 Add Changelog 2024-11-11 23:35:55 +01:00
philipp lang a897690e7a Add keepdata to member form
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2024-11-07 01:29:26 +01:00
philipp lang 24ed5d4ab9 Lint 2024-11-07 00:38:28 +01:00
philipp lang e807aff3e6 Remove default arch tests
continuous-integration/drone/push Build is passing Details
2024-10-28 23:54:21 +01:00
philipp lang 096224fe98 Lint
continuous-integration/drone/push Build is passing Details
2024-09-23 02:01:35 +02:00
philipp lang 646ce647da Move Dashboard Route to DashboardServiceProvider 2024-09-23 01:53:46 +02:00
philipp lang f858716e57 Add Arch tests
continuous-integration/drone/push Build is passing Details
2024-09-22 22:58:31 +02:00
philipp lang 1521aba1f8 Fix drone
continuous-integration/drone/push Build is passing Details
2024-09-22 19:39:36 +02:00
philipp lang 664b88564d Fix phpstan
continuous-integration/drone/push Build is failing Details
2024-09-22 18:25:42 +02:00
philipp lang d30a2336cf Fix tests
continuous-integration/drone/push Build is failing Details
2024-09-22 17:32:29 +02:00
philipp lang a5f1c90003 Fix tests
continuous-integration/drone/push Build is failing Details
2024-09-22 12:28:10 +02:00
philipp lang c3908b714b Update laravel-nami
continuous-integration/drone/push Build is failing Details
2024-09-22 03:02:15 +02:00
philipp lang 2f1e02151f Fix tests 2024-09-22 03:02:10 +02:00
philipp lang eaf014b7c7 Touch env file while testing with drone
continuous-integration/drone/push Build is failing Details
2024-09-22 02:30:25 +02:00
philipp lang 94d34d1afa Add Pail 2024-09-22 02:15:59 +02:00
philipp lang 9b700be889 Update laravel-nami
continuous-integration/drone/push Build was killed Details
2024-09-22 02:13:12 +02:00
philipp lang e1ec6ad9df update composer in drone
continuous-integration/drone/push Build is failing Details
2024-09-22 02:03:58 +02:00
philipp lang aaa236fcd5 Fix tests
continuous-integration/drone/push Build is failing Details
2024-09-22 01:41:56 +02:00
philipp lang 4d74e53fc2 Update Activity UpdateTest 2024-09-22 00:06:03 +02:00
philipp lang b8d389bdb9 Lint Activity EditTest 2024-09-21 23:43:51 +02:00
philipp lang 3a4c99f154 Add Laravel 11 support
continuous-integration/drone/push Build was killed Details
2024-09-21 22:46:38 +02:00
philipp lang fca7fc463e Update php to 8.3
continuous-integration/drone/push Build is passing Details
2024-09-21 21:55:16 +02:00
philipp lang 767df11e4f Fix tests
continuous-integration/drone/push Build is passing Details
2024-09-21 18:56:53 +02:00
philipp lang 295d85f4f8 Add Pestphp
continuous-integration/drone/push Build is failing Details
2024-09-21 18:29:47 +02:00
philipp lang 42ccd32740 Fix tests
continuous-integration/drone/push Build is failing Details
2024-09-21 17:46:07 +02:00
philipp lang bbcf2fd768 Update to laravel 10
continuous-integration/drone/push Build is failing Details
2024-09-21 17:42:11 +02:00
philipp lang b335c20777 Update CHANGELOG
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-09-12 11:17:45 +02:00
philipp lang c63c8316b5 Update adrema-form
continuous-integration/drone/push Build is passing Details
2024-09-12 11:15:58 +02:00
philipp lang 2e6c27b8f1 Update CHANGELOG
continuous-integration/drone/tag Build is failing Details
continuous-integration/drone/push Build is passing Details
2024-08-30 22:38:04 +02:00
philipp lang 1cf8d34b78 Fix tests
continuous-integration/drone/push Build is passing Details
2024-08-30 22:04:14 +02:00
philipp lang e3b52bf901 Fixed tests
continuous-integration/drone/push Build is failing Details
2024-08-30 21:06:16 +02:00
philipp lang 76e7b06630 Fix tests
continuous-integration/drone/push Build is failing Details
2024-08-30 20:06:10 +02:00
philipp lang 21def11ae9 Fixed: Dont display efz and ps for inactive memberships
continuous-integration/drone/push Build is failing Details
2024-08-30 19:04:18 +02:00
philipp lang 565b1ffbce Lint
continuous-integration/drone/push Build is failing Details
2024-08-28 21:02:53 +02:00
philipp lang ef70203c8a Remove Member toolbar button
continuous-integration/drone/push Build is failing Details
2024-08-28 16:30:26 +02:00
philipp lang b3a29c706c Lint 2024-08-28 13:32:52 +02:00
philipp lang 298140e387 Set default member model as meta 2024-08-28 13:26:30 +02:00
philipp lang 151477dbdd Lint 2024-08-27 23:21:10 +02:00
philipp lang a01e8adf8a Add backdrop 2024-08-27 18:19:52 +02:00
philipp lang 547c9edfd5 Update CHANGELOG
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-08-25 14:11:18 +02:00
philipp lang 6e09e2ec0d Fix: Show all groups in conditions 2024-08-25 14:10:22 +02:00
philipp lang 9d37ebefc5 Update CHANGELOG
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/tag Build is passing Details
2024-08-25 10:39:45 +02:00
philipp lang 11b1e6a198 Lint migrations
continuous-integration/drone/push Build is passing Details
2024-08-23 22:25:25 +02:00
philipp lang 5008244de2 Add conditions for group fields
continuous-integration/drone/push Build is failing Details
2024-08-23 17:57:20 +02:00
philipp lang 8b3b3de9a8 Fix: update single name in migrations
continuous-integration/drone/push Build is failing Details
2024-08-02 12:05:21 +02:00
philipp lang d9adb526ce Remove Setting store actions
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2024-08-01 16:26:38 +02:00
philipp lang daf6e87814 Remove Middleware 2024-08-01 16:26:38 +02:00
philipp lang 2056e1ad6b Fixed tests 2024-08-01 16:26:38 +02:00
philipp lang a4eba23bff Remove viewable interface 2024-08-01 16:26:38 +02:00
philipp lang ad8cd58b4f Add SettingView action 2024-08-01 16:26:38 +02:00
philipp lang 3a4908f505 Move Indexable to Viewable 2024-08-01 16:26:38 +02:00
philipp lang 291eec3849 Update CHANGELOG
continuous-integration/drone/push Build is passing Details
2024-08-01 12:15:28 +02:00
philipp lang 0e0f23c17e Fix user principal
continuous-integration/drone/push Build is passing Details
2024-08-01 12:13:33 +02:00
philipp lang 6d204b948e Add avatar image
continuous-integration/drone/push Build is failing Details
2024-07-31 22:41:02 +02:00
philipp lang 977e427abb Lint 2024-07-31 22:30:13 +02:00
philipp lang 46e070a029 Lint 2024-07-31 22:25:54 +02:00
philipp lang 84e05fbc52 Update changelog 2024-07-31 21:39:14 +02:00
philipp lang 343b0d418d Add RememberWeeks setting for remembering invoices
continuous-integration/drone/push Build is passing Details
2024-07-31 21:37:18 +02:00
philipp lang fe258198f4 Add daily invoice sending 2024-07-31 21:19:02 +02:00
philipp lang 8317fdca90 Update changelog
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2024-07-30 23:12:12 +02:00
philipp lang 32ec479975 Display for_members field when nami field is set
continuous-integration/drone/push Build is passing Details
2024-07-30 23:10:24 +02:00
philipp lang ac45e0c8fa Fix tests
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-07-25 12:53:40 +02:00
philipp lang 6f1ab73bae Update changelog 2024-07-25 11:14:43 +02:00
philipp lang c95658ae65 Fix prevention moreps
continuous-integration/drone/push Build is failing Details
2024-07-25 11:13:40 +02:00
philipp lang d64ea85be6 Update Changelog
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-07-25 09:41:02 +02:00
philipp lang 22157b5d50 Add prevention items frontend
continuous-integration/drone/push Build is passing Details
2024-07-25 00:17:31 +02:00
philipp lang 107b616bc1 Update base 2024-07-24 22:26:52 +02:00
philipp lang d7cc80afe9 Lint
continuous-integration/drone/push Build is passing Details
2024-07-24 22:26:38 +02:00
philipp lang db6248999a Update CHANGELOG
continuous-integration/drone/push Build is failing Details
2024-07-24 16:13:36 +02:00
philipp lang 9c568176ce Fixed: Display all forms on index page
continuous-integration/drone/push Build is failing Details
2024-07-24 16:11:29 +02:00
philipp lang d56cb253a9 Add Excel export for participants
continuous-integration/drone/push Build is failing Details
2024-07-23 22:59:23 +02:00
philipp lang 5fcee5f284 Move Creation of excel document to own action 2024-07-23 22:59:23 +02:00
philipp lang b01ff9a677 Add prevention items 2024-07-23 22:59:23 +02:00
philipp lang 0d76b3cc5f Revert "Install adrema-form dependencies in docker"
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
This reverts commit eee0c64106.
2024-07-21 16:09:41 +02:00
philipp lang 0972ad65a7 Update changelog
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-07-18 16:03:10 +02:00
philipp lang 259465189f Update changelog
continuous-integration/drone/push Build is passing Details
2024-07-18 16:02:49 +02:00
philipp lang 306fef3e07 Add Verhaltenskodex prevention
continuous-integration/drone/push Build is passing Details
2024-07-18 13:58:21 +02:00
philipp lang ca0dd11336 Check for APP_KEY in every PHP Container
continuous-integration/drone/push Build is passing Details
2024-07-18 01:41:35 +02:00
philipp lang 89a8feb278 Clear node_modules in drone 2024-07-18 01:41:12 +02:00
philipp lang 8f7edadb99 Remove invoice volume 2024-07-18 01:40:55 +02:00
philipp lang eee0c64106 Install adrema-form dependencies in docker 2024-07-18 01:40:37 +02:00
philipp lang e50269d031 Move tex templates to invoice folder 2024-07-18 01:38:41 +02:00
philipp lang dc40728fca Mod helps
continuous-integration/drone/push Build is failing Details
2024-07-18 01:16:02 +02:00
philipp lang dfa17ed3db Update node version
continuous-integration/drone/push Build is failing Details
2024-07-18 00:59:15 +02:00
philipp lang 77c57794e1 Remove silvaletter dir
continuous-integration/drone/push Build is failing Details
2024-07-17 23:49:03 +02:00
philipp lang 1347347324 Add compose invoice dir
continuous-integration/drone/push Build is failing Details
2024-07-17 23:29:00 +02:00
philipp lang cd9cc607f4 Add silvaletter template
continuous-integration/drone/push Build is failing Details
2024-07-17 23:18:25 +02:00
philipp lang 6f1efb7470 Update silvaletter package 2024-07-17 22:54:50 +02:00
philipp lang 5fd050e116 Move template dir from default to invoice 2024-07-17 22:51:53 +02:00
philipp lang 3a53777dbd Update README 2024-07-17 22:45:16 +02:00
philipp lang 1ad2e6a978 Fix typo 2024-07-17 22:38:16 +02:00
philipp lang ac76d23941 Move template files of bill and remember invoice 2024-07-17 22:35:06 +02:00
philipp lang b67fa85539 Update Changelog
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2024-07-15 17:56:53 +02:00
philipp lang 5641006e2b Add mail data from template to form
continuous-integration/drone/push Build was killed Details
2024-07-15 17:13:23 +02:00
philipp lang 607038af6b Lint 2024-07-15 17:05:21 +02:00
philipp lang 189b83f2a5 Update migrations 2024-07-15 17:05:02 +02:00
philipp lang 3f4c655e5e Disable is_dirty when link not found 2024-07-15 17:00:42 +02:00
philipp lang 158cd2d352 Lint 2024-07-15 16:59:29 +02:00
philipp lang bf1388dbd9 Lint
continuous-integration/drone/push Build is passing Details
2024-07-14 22:16:34 +02:00
philipp lang aa20329a62 Lint
continuous-integration/drone/push Build is failing Details
2024-07-14 21:44:33 +02:00
philipp lang 09de9a5510 Add frontnd for formtemplate mails
continuous-integration/drone/push Build is failing Details
2024-07-14 20:53:26 +02:00
philipp lang 2982ae035f Lint 2024-07-14 20:53:15 +02:00
philipp lang 46740b14a2 Add mail_top and mail_bottom for formtemplates
continuous-integration/drone/push Build is failing Details
2024-07-14 20:20:56 +02:00
philipp lang 885eaa5df5 Fix migrations
continuous-integration/drone/push Build is failing Details
2024-07-14 20:19:17 +02:00
philipp lang 757042bdd2 Fix migrations
continuous-integration/drone/push Build is failing Details
2024-07-14 19:57:37 +02:00
philipp lang c3f6d3827b Add EditorData for forms texts
continuous-integration/drone/push Build is failing Details
2024-07-14 19:29:42 +02:00
philipp lang 1ef7995ec2 Update Changelog
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-07-14 12:13:59 +02:00
philipp lang c8676aef6d Fix tests
continuous-integration/drone/push Build is passing Details
2024-07-14 00:37:38 +02:00
philipp lang cf93b8eff0 Lint
continuous-integration/drone/push Build is failing Details
2024-07-14 00:11:18 +02:00
philipp lang e2a2d746a3 Fix tests
continuous-integration/drone/push Build is failing Details
2024-07-14 00:05:53 +02:00
philipp lang aabba32f89 Fix drone
continuous-integration/drone/push Build was killed Details
2024-07-13 23:31:17 +02:00
philipp lang 11b97a634b Fix drone
continuous-integration/drone/push Build was killed Details
2024-07-13 22:50:17 +02:00
philipp lang 26cb7fd9f1 Add drone nextcloud service
continuous-integration/drone/push Build is failing Details
2024-07-13 22:36:08 +02:00
philipp lang 2b48f42734 Add nextcloud connections
continuous-integration/drone/push Build was killed Details
2024-07-13 22:30:34 +02:00
philipp lang 74867cb09f Add file conversion to jpeg
continuous-integration/drone/push Build is failing Details
2024-07-13 19:49:50 +02:00
philipp lang d4057ff08f Add filter for participants
continuous-integration/drone/push Build is failing Details
2024-07-13 18:48:11 +02:00
philipp lang 657a648f46 Add: Store participant 2024-07-13 18:24:43 +02:00
philipp lang d9c45f5236 Fix participant update 2024-07-13 17:54:23 +02:00
philipp lang 5d48521875 Fix fileshare skeleton 2024-07-13 17:44:03 +02:00
philipp lang 98976700a9 Mod db maintain
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-07-13 14:08:42 +02:00
philipp lang 790332b25c Lint
continuous-integration/drone/push Build is passing Details
2024-07-12 20:42:30 +02:00
philipp lang 56c28ae00e Add form to edit
continuous-integration/drone/push Build is failing Details
2024-07-12 20:18:41 +02:00
philipp lang a603aca80c Add backend for update 2024-07-12 20:15:24 +02:00
philipp lang c05434a7fb Add participant fields link 2024-07-12 19:49:47 +02:00
philipp lang 248499dc60 Fixed condition default
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/tag Build is passing Details
2024-07-12 19:18:35 +02:00
philipp lang ad7fe80236 Fix tests
continuous-integration/drone/push Build is failing Details
2024-07-12 18:27:18 +02:00
philipp lang dbde189575 Fix prevention for leaders
continuous-integration/drone/push Build is failing Details
2024-07-12 18:07:33 +02:00
philipp lang 146cbb0bef Add prevention conditions 2024-07-12 18:07:33 +02:00
philipp lang e6477fff2b Add conditions form 2024-07-12 18:07:33 +02:00
philipp lang 3c725c0efc Lint 2024-07-12 18:07:33 +02:00
philipp lang f632a8bb8f Lint 2024-07-12 18:07:33 +02:00
philipp lang 2f03dccebb Add data for conditions 2024-07-12 18:07:33 +02:00
philipp lang 235f439d51 Update adrema-form
continuous-integration/drone/push Build is passing Details
2024-07-11 15:15:50 +02:00
philipp lang cf77797512 Fix PreventionRememberAction
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-07-10 00:52:05 +02:00
philipp lang d44ad4bc53 Fix migration
continuous-integration/drone/tag Build is passing Details
2024-07-10 00:19:29 +02:00
philipp lang 94597e57c1 Fix migration
continuous-integration/drone/tag Build was killed Details
2024-07-10 00:18:18 +02:00
philipp lang a9ecdfe4bb Lint
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/tag Build is failing Details
2024-07-08 23:17:14 +02:00
philipp lang 10a966c6ad Lint 2024-07-08 23:06:45 +02:00
philipp lang 3b63a73161 Fix tests
continuous-integration/drone/push Build is failing Details
2024-07-08 22:39:11 +02:00
philipp lang 4e453a73a6 Fix tests 2024-07-08 21:42:31 +02:00
philipp lang 96cf0b7dd5 Fix EditorData cache
continuous-integration/drone/push Build is failing Details
2024-07-08 20:48:08 +02:00
philipp lang b2e85211a7 Add prevention_text field
continuous-integration/drone/push Build is failing Details
2024-07-06 15:14:53 +02:00
philipp lang 3dacfb3e54 Add prevention_text to form 2024-07-06 15:08:13 +02:00
philipp lang c9ccebc8f3 Lint
continuous-integration/drone/push Build is failing Details
2024-07-04 23:58:46 +02:00
philipp lang b6aaf6b2e1 Add todos
continuous-integration/drone/push Build is failing Details
2024-07-04 23:56:47 +02:00
philipp lang 793e4bacbd Add mail view 2024-07-04 23:54:37 +02:00
philipp lang 6c44a25638 Composer update
continuous-integration/drone/push Build is failing Details
2024-07-04 23:38:38 +02:00
philipp lang 8609f1e9c6 Fix: Cast Data object from Settings 2024-07-04 22:29:29 +02:00
philipp lang 0d07975e53 Fix tests
continuous-integration/drone/push Build is failing Details
2024-07-04 22:12:45 +02:00
philipp lang f7d9328447 Fix: Dont Send mail to participants without mail 2024-07-04 22:09:24 +02:00
philipp lang d26bdd72fb Fix tests
continuous-integration/drone/push Build is failing Details
2024-07-04 21:42:19 +02:00
philipp lang ff40b9e805 Add prevention settings
continuous-integration/drone/push Build is failing Details
2024-07-04 21:01:14 +02:00
philipp lang 92997aa78f Lint 2024-07-04 20:04:51 +02:00
philipp lang ee02b8df3a Add prevention 2024-07-04 20:04:49 +02:00
philipp lang 8ec4e4eb59 Fix db maintain
continuous-integration/drone/push Build is passing Details
2024-07-04 01:40:43 +02:00
philipp lang fc70107aa3 Optimize telescope table when pruning
continuous-integration/drone/push Build is failing Details
2024-07-04 00:56:20 +02:00
philipp lang 5661d66770 Add search result component
continuous-integration/drone/push Build is passing Details
2024-07-03 17:43:49 +02:00
philipp lang 0a8ecedb0f Update search 2024-07-03 17:31:06 +02:00
philipp lang fd9aff25fe Add hits to searchModal 2024-07-03 17:20:47 +02:00
philipp lang c65a25ed2a Fix: Switch input should not be invisible 2024-07-03 17:17:44 +02:00
philipp lang ced2d577c0 Lint 2024-07-03 17:12:57 +02:00
philipp lang aafef695aa Lint 2024-07-03 17:12:32 +02:00
philipp lang 44a39fc5a8 Lint 2024-07-03 17:10:04 +02:00
philipp lang 46a353d674 Fix event name im contribution 2024-07-03 17:09:34 +02:00
philipp lang fed0e95f14 Fix switch with array 2024-07-03 17:07:14 +02:00
philipp lang d1dfcb3a04 Add dev url for search 2024-07-03 17:03:53 +02:00
philipp lang 7f9be4262c Lint 2024-07-03 16:37:58 +02:00
philipp lang 99a28f44dd Dont match Email Nami Field
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-07-03 11:01:16 +02:00
philipp lang 9c93b13032 Fix: Dont reset page when assigning members
continuous-integration/drone/push Build is passing Details
2024-07-02 21:42:38 +02:00
philipp lang 231ed3b4ad Lint
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details
2024-07-02 18:44:42 +02:00
philipp lang ccfeb85e4b Fix tests
continuous-integration/drone/push Build is failing Details
2024-07-02 18:19:40 +02:00
philipp lang 445a8ae962 Add assign for participant
continuous-integration/drone/push Build is failing Details
2024-07-02 18:04:55 +02:00
philipp lang 0741984858 Lint 2024-07-02 17:44:28 +02:00
philipp lang 69a3ed2a60 Add member_id for participants 2024-07-02 16:04:07 +02:00
philipp lang bbdc9e9dfb Fix tests
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-07-01 12:08:59 +02:00
philipp lang 7e39a4da84 Fix tests
continuous-integration/drone/push Build is failing Details
2024-06-30 23:50:01 +02:00
philipp lang ae450ef9ae Add table export
continuous-integration/drone/push Build is failing Details
2024-06-30 23:36:44 +02:00
philipp lang 2425ff6638 Add adapter test 2024-06-30 21:04:54 +02:00
philipp lang 2586669c96 Delete skeleton dir when container starts 2024-06-30 21:04:20 +02:00
philipp lang af124f897b Fix Form export
continuous-integration/drone/push Build is passing Details
2024-06-30 18:51:14 +02:00
philipp lang c78c1cfee7 Make Export not nullable
continuous-integration/drone/push Build is failing Details
2024-06-30 18:10:53 +02:00
philipp lang bbd3237330 Add fields for form export
continuous-integration/drone/push Build is passing Details
2024-06-29 19:09:00 +02:00
philipp lang fcc01d26ac Lint
continuous-integration/drone/push Build is passing Details
2024-06-29 18:54:56 +02:00
philipp lang 93d30d10eb Add export to form
continuous-integration/drone/push Build is failing Details
2024-06-29 18:02:23 +02:00
philipp lang c7fc76466e Add fileshare to groups
continuous-integration/drone/push Build is passing Details
2024-06-29 14:36:35 +02:00
philipp lang 6aaeb75b2a Add remote selector
continuous-integration/drone/push Build is passing Details
2024-06-29 13:13:11 +02:00
philipp lang 8c3dc2211b Add loading component 2024-06-29 11:27:08 +02:00
philipp lang d06ae7acb5 Lint
continuous-integration/drone/push Build is passing Details
2024-06-29 11:23:33 +02:00
philipp lang 63c62dc958 Fix: Return Basename instead of Filename 2024-06-29 10:34:40 +02:00
philipp lang 71903936a3 Add api for listing subdirectories
continuous-integration/drone/push Build is failing Details
2024-06-28 23:56:34 +02:00
philipp lang 0ad6b40393 Add tests 2024-06-28 22:26:38 +02:00
philipp lang f04cf7a1b2 Install webdav filesystem 2024-06-28 22:26:09 +02:00
philipp lang 94cc0147bc Add fileshare api 2024-06-28 15:51:40 +02:00
philipp lang 73633d7628 Move component assertion 2024-06-28 15:51:40 +02:00
philipp lang 5482d47f0c Rename fileshare 2024-06-28 15:51:40 +02:00
philipp lang e1c3240290 Add update for fileshares 2024-06-28 15:51:40 +02:00
philipp lang e9e0be83cc Add: Store connection frontend 2024-06-28 15:51:40 +02:00
philipp lang 32e7f8c41d Rename test files 2024-06-28 15:51:40 +02:00
philipp lang 4cfa70e534 Lint 2024-06-28 15:51:40 +02:00
philipp lang 45597558e3 Add owncloud domain to drone 2024-06-28 15:51:40 +02:00
philipp lang c99a5a0369 Add owncloud application to drone 2024-06-28 15:51:40 +02:00
philipp lang 258093f2c4 Add fileshare storage 2024-06-28 15:51:40 +02:00
philipp lang f16b58dbc6 Add type information to index 2024-06-28 15:51:40 +02:00
philipp lang 8609a648fd Add fileshare index 2024-06-28 15:51:40 +02:00
philipp lang b15b806948 Remove switch and form css
continuous-integration/drone/push Build is passing Details
2024-06-28 15:50:40 +02:00
philipp lang 19b13133a6 Mod fields
continuous-integration/drone/push Build is passing Details
2024-06-28 14:26:12 +02:00
philipp lang d22e4b597f Add field appearance 2024-06-28 14:04:20 +02:00
philipp lang f100135f33 move classes 2024-06-28 13:43:38 +02:00
philipp lang efc9a397f3 Fix default for subscription 2024-06-28 12:47:41 +02:00
philipp lang ab06c7de5d Add validator for text modelValue 2024-06-28 12:45:43 +02:00
philipp lang a9dea10a17 Add recertified to member default 2024-06-28 12:45:23 +02:00
philipp lang dd4468808b Remove name prop from f-text component 2024-06-28 12:43:05 +02:00
philipp lang 1ef8cfdec8 Mod text component
continuous-integration/drone/push Build is passing Details
2024-06-28 12:13:08 +02:00
philipp lang b6c9eea8ea Cleanup 2024-06-28 12:13:08 +02:00
philipp lang 12eb5016c8 remove console log
continuous-integration/drone/push Build is passing Details
2024-06-28 12:12:02 +02:00
philipp lang 75d9301033 Add echo port via mode
continuous-integration/drone/push Build is passing Details
2024-06-28 12:10:18 +02:00
philipp lang 8c820ab24d Add cy data to invoice edit button
continuous-integration/drone/push Build is failing Details
2024-06-28 08:40:58 +02:00
philipp lang d26463d43c Add run script 2024-06-28 08:38:05 +02:00
philipp lang 4fda17d2c6 make siteName optional in api index 2024-06-28 08:36:57 +02:00
philipp lang 094a84c745 Lint text component 2024-06-28 08:30:35 +02:00
philipp lang 1630bce795 Add table toggle for participant index
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-06-21 00:25:14 +02:00
philipp lang cce9d4fa3e Add id to participant index 2024-06-21 00:24:27 +02:00
philipp lang 323f136e40 Add useTableToggle composable for group index 2024-06-21 00:23:31 +02:00
philipp lang 820b317b57 Add has_nami_field to participant component 2024-06-20 23:31:09 +02:00
philipp lang 43c528fc46 Add has_nami and two participant urls to form 2024-06-20 23:29:23 +02:00
philipp lang e9e8b193f4 Add pagination for participant api index parent 2024-06-20 23:25:47 +02:00
philipp lang 646b292249 Add has_nami to participant api index 2024-06-20 23:25:14 +02:00
philipp lang 0526b52b6b Lint 2024-06-20 00:12:15 +02:00
philipp lang 1a5675634f Add children filter to participant index
continuous-integration/drone/push Build is passing Details
2024-06-19 23:51:20 +02:00
philipp lang 73089ae654 Add TableToggleButton for group index
continuous-integration/drone/push Build is passing Details
2024-06-19 22:36:24 +02:00
philipp lang e4f195ee3e Add TableToggleButton component 2024-06-19 22:00:18 +02:00
philipp lang 87377dab06 Add toggle 2024-06-19 21:33:59 +02:00
philipp lang 668cf9d292 Fixed: Dont sync member when member is manual
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-06-19 13:05:45 +02:00
philipp lang 03c19aa5fb Validate fields for manual member
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2024-06-19 10:30:07 +02:00
371 changed files with 11402 additions and 6780 deletions

View File

@ -1,13 +1,14 @@
FROM php:8.1.6-fpm as php FROM php:8.3.11-fpm as php
WORKDIR /app WORKDIR /app
RUN ls /app RUN ls /app
RUN apt-get update RUN apt-get update
RUN apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip poppler-utils libpng-dev libjpeg-dev default-mysql-client RUN apt-get install -y rsync libcurl3-dev apt-utils zlib1g-dev libpng-dev libicu-dev libonig-dev unzip poppler-utils libpng-dev libjpeg-dev default-mysql-client libzip-dev imagemagick libmagickwand-dev
RUN apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils RUN apt-get install -y --no-install-recommends texlive-base texlive-latex-base texlive-pictures texlive-latex-extra texlive-lang-german texlive-plain-generic texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils
RUN docker-php-ext-install pdo_mysql curl gd exif intl mbstring pcntl RUN docker-php-ext-install pdo_mysql curl exif intl mbstring pcntl zip
RUN pecl install redis && docker-php-ext-enable redis RUN pecl install redis && docker-php-ext-enable redis
RUN pecl install imagick && docker-php-ext-enable imagick
RUN docker-php-ext-configure gd --with-jpeg RUN docker-php-ext-configure gd --with-jpeg
RUN docker-php-ext-enable gd RUN docker-php-ext-install gd
RUN usermod -s /bin/bash www-data RUN usermod -s /bin/bash www-data
RUN echo 'memory_limit = 2G' >> /usr/local/etc/php/conf.d/99-custom-php-memlimit.ini RUN echo 'memory_limit = 2G' >> /usr/local/etc/php/conf.d/99-custom-php-memlimit.ini

6
.docker/bin/build_base Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
docker buildx build -f .docker/base.Dockerfile .
docker image tag sha256:... zoomyboy/adrema-base
docker push zoomyboy/adrema-base

View File

@ -1,11 +1,11 @@
FROM composer:2.2.7 as composer FROM composer:2.7.9 as composer
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
RUN composer install --ignore-platform-reqs --no-dev RUN composer install --ignore-platform-reqs --no-dev
RUN php artisan telescope:publish RUN php artisan telescope:publish
RUN php artisan horizon:publish RUN php artisan horizon:publish
FROM node:18.13.0-slim as node FROM node:20.15.0-slim as node
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
RUN npm install && npm run prod && npm run img && rm -R node_modules RUN npm install && npm run prod && npm run img && rm -R node_modules

View File

@ -1,9 +1,9 @@
FROM composer:2.2.7 as composer FROM composer:2.7.9 as composer
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
RUN composer install --ignore-platform-reqs --no-dev RUN composer install --ignore-platform-reqs --no-dev
FROM node:17.9.0-slim as node FROM node:20.15.0-slim as node
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
RUN npm install && npm run prod && npm run img && rm -R node_modules RUN npm install && npm run prod && npm run img && rm -R node_modules
@ -20,7 +20,7 @@ RUN php artisan horizon:publish
USER root USER root
COPY ./.docker/php /bin COPY ./.docker/php /bin
VOLUME ["/app/packages/laravel-nami/.cookies", "/app/storage/app"] VOLUME ["/app/packages/laravel-nami/.cookies", "/app/storage/app", "/app/resources/views/tex/invoice"]
EXPOSE 9000 EXPOSE 9000

View File

@ -15,6 +15,11 @@ mkdir -p /app/storage/app/public || true
chown -R www-data:www-data /app/packages/laravel-nami/.cookies chown -R www-data:www-data /app/packages/laravel-nami/.cookies
chown -R www-data:www-data /app/storage/app chown -R www-data:www-data /app/storage/app
if [ $APP_KEY = "YOUR_APP_KEY" ]; then
echo "----------------------- Keinen APP KEY gefunden. Key wird generiert: $(su www-data -c 'php artisan key:generate --show') ----------------------- Füge diesen Key als APP_KEY ein ---------------------"
exit 1
fi
if [ $1 == "horizon" ]; then if [ $1 == "horizon" ]; then
wait_for_db wait_for_db
su www-data -c 'php artisan horizon' su www-data -c 'php artisan horizon'
@ -22,10 +27,6 @@ fi
if [ $1 == "app" ]; then if [ $1 == "app" ]; then
# --------------------------- ensure appkey is set ---------------------------- # --------------------------- ensure appkey is set ----------------------------
if [ $APP_KEY = "YOUR_APP_KEY" ]; then
echo "----------------------- Keinen APP KEY gefunden. Key wird generiert: $(su www-data -c 'php artisan key:generate --show') ----------------------- Füge diesen Key als APP_KEY ein ---------------------"
exit 1
fi
wait_for_db wait_for_db
php -r '$connection = new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'"); $connection->query("DESCRIBE migrations");' > /dev/null || php artisan migrate --seed --force php -r '$connection = new PDO("mysql:host='$DB_HOST';dbname='$DB_DATABASE'", "'$DB_USERNAME'", "'$DB_PASSWORD'"); $connection->query("DESCRIBE migrations");' > /dev/null || php artisan migrate --seed --force
su www-data -c 'php artisan migrate --force' su www-data -c 'php artisan migrate --force'

View File

@ -12,7 +12,7 @@ steps:
- git submodule update --init --recursive - git submodule update --init --recursive
- name: composer_dev - name: composer_dev
image: composer:2.2.7 image: composer:2.7.9
commands: commands:
- composer install --ignore-platform-reqs --dev - composer install --ignore-platform-reqs --dev
@ -21,14 +21,25 @@ steps:
commands: commands:
- while ! mysqladmin ping -h db -u db -pdb --silent; do sleep 1; done - while ! mysqladmin ping -h db -u db -pdb --silent; do sleep 1; done
- name: node - name: ocdb_healthcheck
image: node:18.13.0-slim image: mysql:oracle
commands: commands:
- npm ci && cd packages/adrema-form && npm ci && npm run build && cd ../../ && npm run img && npm run prod && rm -R node_modules - while ! mysqladmin ping -h ownclouddb -u owncloud -powncloud --silent; do sleep 1; done
- name: oc_healthcheck
image: zoomyboy/adrema-base:latest
commands:
- while ! curl --silent 'http://owncloudserver:8080/ocs/v1.php/cloud/capabilities?format=json' -u admin:admin | grep '"status":"ok"'; do sleep 1; done
- name: node
image: node:20.15.0-slim
commands:
- npm ci && cd packages/adrema-form && npm ci && npm run build && rm -R node_modules && cd ../../ && npm run img && npm run prod && rm -R node_modules
- name: tests - name: tests
image: zoomyboy/adrema-base:latest image: zoomyboy/adrema-base:latest
commands: commands:
- touch .env
- php artisan migrate - php artisan migrate
- php artisan test - php artisan test
- rm -f .env - rm -f .env
@ -58,6 +69,8 @@ steps:
XELATEX_BIN: /usr/bin/xelatex XELATEX_BIN: /usr/bin/xelatex
SCOUT_DRIVER: database SCOUT_DRIVER: database
MEILI_MASTER_KEY: abc MEILI_MASTER_KEY: abc
TEST_OWNCLOUD_DOMAIN: http://owncloudserver:8080
TEST_NEXTCLOUD_DOMAIN: http://nextcloudserver:80
- name: docker_app_push - name: docker_app_push
image: plugins/docker image: plugins/docker
@ -90,7 +103,7 @@ steps:
event: tag event: tag
- name: deploy - name: deploy
image: php:8.1.6 image: zoomyboy/adrema-base:latest
environment: environment:
SSH_KEY: SSH_KEY:
from_secret: deploy_private_key from_secret: deploy_private_key
@ -123,7 +136,7 @@ steps:
event: push event: push
- name: composer_no_dev - name: composer_no_dev
image: composer:2.2.7 image: composer:2.7.9
commands: commands:
- composer install --ignore-platform-reqs --no-dev - composer install --ignore-platform-reqs --no-dev
@ -160,6 +173,47 @@ services:
image: getmeili/meilisearch:v1.6 image: getmeili/meilisearch:v1.6
commands: commands:
- meilisearch --master-key="abc" - meilisearch --master-key="abc"
- name: ownclouddb
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: owncloud
MYSQL_USER: owncloud
MYSQL_PASSWORD: owncloud
MYSQL_DATABASE: owncloud
MARIADB_AUTO_UPGRADE: 1
- name: owncloudserver
image: owncloud/server:10.10.0
environment:
OWNCLOUD_DOMAIN: http://owncloudserver:8080
OWNCLOUD_TRUSTED_DOMAINS: owncloudserver
OWNCLOUD_DB_TYPE: mysql
OWNCLOUD_DB_NAME: owncloud
OWNCLOUD_DB_USERNAME: owncloud
OWNCLOUD_DB_PASSWORD: owncloud
OWNCLOUD_DB_HOST: ownclouddb
OWNCLOUD_ADMIN_USERNAME: admin
OWNCLOUD_ADMIN_PASSWORD: admin
OWNCLOUD_MYSQL_UTF8MB4: true
OWNCLOUD_REDIS_ENABLED: false
OWNCLOUD_REDIS_HOST: false
- name: nextclouddb
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: nextcloud
MYSQL_DATABASE: nextcloud
MARIADB_AUTO_UPGRADE: 1
- name: nextcloudserver
image: nextcloud
environment:
MYSQL_PASSWORD: nextcloud
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_HOST: nextclouddb
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
NEXTCLOUD_TRUSTED_DOMAINS: nextcloudserver
trigger: trigger:
event: event:

2
.gitignore vendored
View File

@ -16,6 +16,7 @@ Homestead.json
.phpunit.result.cache .phpunit.result.cache
/storage/temp/ /storage/temp/
/storage/debugbar/ /storage/debugbar/
/tests/Fileshare/oc_tmp/*
# User data files # User data files
/data/ /data/
@ -39,3 +40,4 @@ Homestead.json
/public/sprite.svg /public/sprite.svg
/.php-cs-fixer.cache /.php-cs-fixer.cache
/groups.sql /groups.sql
/.phpunit.cache

9
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "packages/silvaletter"]
path = packages/silvaletter
url = https://git.zoomyboy.de/silva/silvaletter.git
[submodule "packages/laravel-nami"] [submodule "packages/laravel-nami"]
path = packages/laravel-nami path = packages/laravel-nami
url = https://git.zoomyboy.de/silva/laravel-nami-api url = https://git.zoomyboy.de/silva/laravel-nami-api
@ -14,3 +11,9 @@
path = packages/medialibrary-helper path = packages/medialibrary-helper
url = https://git.zoomyboy.de/zoomyboy/medialibrary-helper.git url = https://git.zoomyboy.de/zoomyboy/medialibrary-helper.git
branch = version2 branch = version2
[submodule "packages/flysystem-webdav"]
path = packages/flysystem-webdav
url = https://github.com/zoomyboy/flysystem-webdav.git
[submodule "packages/table-document"]
path = packages/table-document
url = https://git.zoomyboy.de/zoomyboy/table-document.git

94
CHANGELOG.md Normal file
View File

@ -0,0 +1,94 @@
# Letzte Änderungen
### 1.12.2
- Zuschussliste Gallier
### 1.12.1
- In Teilnehmer-Liste von Veranstaltungen kann nun sortiert und gefiltert werden.
- Formulare: Feld Registrierung von / bis
### 1.11.5
- Fix: Synchronisation von NaMi-Mitgliedern
### 1.11.4
- Fix: Nicht an Präventions-Unterlagen für vergangene Veranstaltungen erinnern
### 1.11.1
- Es kann nun auch das Feld "Datenweiterverwendung" über Adrema gepflegt werden.
### 1.10.20
- Fixed: Bei Textfeldern wird nun die Einleitung dargestellt
### 1.10.19
- Fixed: Erweiterte Führungszeugnisse und Präventionsschulungen nur für aktive Mitgliedschaften auf Dashboard anzeigen
### 1.10.18
- Fixed: All Gruppen als Option anbieten bei Bedingungen
### 1.10.17
- Es können nun auch Bedingungen für Felder vom Typ Gruppierung definiert werden
### 1.10.16
- Rechnungen und Erinnerungen werden nun automatisch täglich um 10 Uhr verschickt
- Es kann eingestellt werden, nach wie vielen Wochen an Rechnungen erinnert werden soll (Standard: 12)
- Name und Profilbild des angemeldeten Benutzers wird nun oben rechts angezeigt
### 1.10.15
- "Für Mitglieder zusätzlich abfragen" kann nun im Formular auch gesetzt werden, wenn ein NaMi Feld ausgewählt ist.
### 1.10.14
- Fixed: Ist eine Präventionsschulung älter als 5 Jahre, so ist nur eine Auffrischungs-Schulung erforderlich
### 1.10.13
- Bei Veranstaltungs-Übersicht alle Veranstaltungen anzeigen
- Download von Teilnehmern als Tabellen-Dokument
- Spalte "Prävention" bei TN-Liste eingefügt für benötigte Unterlagen
### 1.10.11
- Bei Prävention auch an Verhaltenskodex erinnern
### 1.10.10
- Eine Formular-Vorlage kann nun auch Mail-Inhalte enthalten, die für die Formulare übernommen werden
### 1.10.9
- Nextcloud als neuen Type bei Datei-Verbindungen angelegt
### 1.10.8
- Anmeldeformulare: Bearbeiten von Teilnehmer\*innen ist nun möglich
### 1.10.7
- Anmeldeformulare: Versenden von Präventions-Unterlagen können nun an eine Feld-Bedingung geknüpft werden innerhalb der Veranstaltung
### 1.10.6
- Kleinere Fehler behoben
### 1.10.5
- Kleinere Fehler behoben
### 1.10.4
- Anmeldeformular: Erinnerung an Präventions-Unterlagen bei Teilnehmer\*innnen
### 1.10.3
- Anmeldeformulare: Ist NaMi-Feld "E-Mail" ausgewählt bei Formular-Feldern, muss die E-Mail-Adresse nun nicht mehr auf das Mitglied matchen. Dies ist nur noch bei Formular-Feldern mit NaMi-Feldern "Vorname", "Nachname" und "Geburtsdatum" der Fall.

View File

@ -85,6 +85,12 @@ Außerdem ist AdReMa auch problemlos auf Handys und Tablets bedienbar ("mobiles
7. Nach kurzer Zeit ist AdReMa über <http://localhost:8000> erreichbar und es kann sich mit dem zuvor festgelegten Login eingeloggt werden 7. Nach kurzer Zeit ist AdReMa über <http://localhost:8000> erreichbar und es kann sich mit dem zuvor festgelegten Login eingeloggt werden
### Individuelle anpassungen
#### Rechnungswesen
Bei dem Setup wird im Daten-Verzeichniss ein Ordner `./data/setup` angelegt. Hier kann das Logo des Stammes in den Briefkopf eingefügt werden. Zusätzlich kann der Text der Rechnung und der Zahlungserinnerung angepasst werden, dafür ist ein grundlegendes Verständnis für `.tex` Datein erforderlich.
## Nutzen des Entwicklungssystmes ## Nutzen des Entwicklungssystmes
1. Klonen des Reposetories 1. Klonen des Reposetories

View File

@ -0,0 +1,23 @@
<?php
namespace App\Actions;
use DB;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Http;
use Laravel\Telescope\Console\PruneCommand;
use Lorisleiva\Actions\Concerns\AsAction;
class DbMaintainAction
{
use AsAction;
public string $commandSignature = 'db:maintain';
public function handle(): void
{
Artisan::call(PruneCommand::class, ['--hours' => 168]); // 168h = 7 Tage
DB::select('optimize table telescope_entries');
Http::post('https://zoomyboy.de/maintain', ['url' => url()->current()]);
}
}

View File

@ -50,6 +50,7 @@ class InsertMemberAction
'nationality_id' => Nationality::where('nami_id', $member->nationalityId)->firstOrFail()->id, 'nationality_id' => Nationality::where('nami_id', $member->nationalityId)->firstOrFail()->id,
'mitgliedsnr' => $member->memberId, 'mitgliedsnr' => $member->memberId,
'version' => $member->version, 'version' => $member->version,
'keepdata' => $member->keepdata,
]); ]);
} }

View File

@ -4,12 +4,14 @@ namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Cviebrock\EloquentSluggable\Sluggable; use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\ActivityFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Activity extends Model class Activity extends Model
{ {
/** @use HasFactory<ActivityFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;
use Sluggable; use Sluggable;

View File

@ -2,11 +2,13 @@
namespace App; namespace App;
use Database\Factories\ConfessionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Confession extends Model class Confession extends Model
{ {
/** @use HasFactory<ConfessionFactory> */
use HasFactory; use HasFactory;
public $fillable = ['name', 'nami_id', 'is_null']; public $fillable = ['name', 'nami_id', 'is_null'];

View File

@ -2,11 +2,12 @@
namespace App\Console; namespace App\Console;
use App\Actions\DbMaintainAction;
use App\Form\Actions\PreventionRememberAction;
use App\Initialize\InitializeMembers; use App\Initialize\InitializeMembers;
use App\Invoice\Actions\InvoiceSendAction; use App\Invoice\Actions\InvoiceSendAction;
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Laravel\Telescope\Console\PruneCommand;
class Kernel extends ConsoleKernel class Kernel extends ConsoleKernel
{ {
@ -18,6 +19,8 @@ class Kernel extends ConsoleKernel
protected $commands = [ protected $commands = [
InvoiceSendAction::class, InvoiceSendAction::class,
InitializeMembers::class, InitializeMembers::class,
DbMaintainAction::class,
PreventionRememberAction::class,
]; ];
/** /**
@ -27,8 +30,10 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->command(PruneCommand::class, ['--hours' => 168])->daily(); // 168h = 7 Tage $schedule->command(DbMaintainAction::class)->daily();
$schedule->command(InitializeMembers::class)->dailyAt('03:00'); $schedule->command(InitializeMembers::class)->dailyAt('03:00');
$schedule->command(PreventionRememberAction::class)->dailyAt('11:00');
$schedule->command(InvoiceSendAction::class)->dailyAt('10:00');
} }
/** /**

View File

@ -8,6 +8,7 @@ use App\Contribution\Documents\RdpNrwDocument;
use App\Contribution\Documents\CityRemscheidDocument; use App\Contribution\Documents\CityRemscheidDocument;
use App\Contribution\Documents\CitySolingenDocument; use App\Contribution\Documents\CitySolingenDocument;
use App\Contribution\Documents\CityFrankfurtMainDocument; use App\Contribution\Documents\CityFrankfurtMainDocument;
use App\Contribution\Documents\WuppertalDocument;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
@ -22,15 +23,16 @@ class ContributionFactory
CityRemscheidDocument::class, CityRemscheidDocument::class,
CityFrankfurtMainDocument::class, CityFrankfurtMainDocument::class,
BdkjHesse::class, BdkjHesse::class,
WuppertalDocument::class,
]; ];
/** /**
* @return Collection<int, array{title: mixed, class: mixed}> * @return Collection<int, array{title: string, class: class-string<ContributionDocument>}>
*/ */
public function compilerSelect(): Collection public function compilerSelect(): Collection
{ {
return collect($this->documents)->map(fn ($document) => [ return collect($this->documents)->map(fn ($document) => [
'title' => $document::getName(), 'title' => $document::buttonName(),
'class' => $document, 'class' => $document,
]); ]);
} }

View File

@ -29,7 +29,7 @@ class MemberData extends Data
*/ */
public static function fromModels(array $ids): Collection public static function fromModels(array $ids): Collection
{ {
return Member::whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::withoutMagicalCreationFrom([ return Member::whereIn('id', $ids)->orderByRaw('lastname, firstname')->get()->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([
...$member->toArray(), ...$member->toArray(),
'birthday' => $member->birthday->toAtomString(), 'birthday' => $member->birthday->toAtomString(),
'isLeader' => $member->isLeader(), 'isLeader' => $member->isLeader(),
@ -44,7 +44,7 @@ class MemberData extends Data
*/ */
public static function fromApi(array $data): Collection public static function fromApi(array $data): Collection
{ {
return collect($data)->map(fn ($member) => self::withoutMagicalCreationFrom([ return collect($data)->map(fn ($member) => self::factory()->withoutMagicalCreation()->from([
...$member, ...$member,
'birthday' => Carbon::parse($member['birthday'])->toAtomString(), 'birthday' => Carbon::parse($member['birthday'])->toAtomString(),
'gender' => Gender::fromString($member['gender']), 'gender' => Gender::fromString($member['gender']),
@ -54,31 +54,41 @@ class MemberData extends Data
public function fullname(): string public function fullname(): string
{ {
return $this->firstname.' '.$this->lastname; return $this->firstname . ' ' . $this->lastname;
} }
public function separatedName(): string public function separatedName(): string
{ {
return $this->lastname.', '.$this->firstname; return $this->lastname . ', ' . $this->firstname;
} }
public function fullAddress(): string public function fullAddress(): string
{ {
return $this->address.', '.$this->zip.' '.$this->location; return $this->address . ', ' . $this->zip . ' ' . $this->location;
} }
public function city(): string public function city(): string
{ {
return $this->zip.' '.$this->location; return $this->zip . ' ' . $this->location;
} }
public function age(): string public function age(): int
{ {
return (string) $this->birthday->diffInYears(now()) ?: ''; return intval($this->birthday->diffInYears(now()));
} }
public function birthYear(): string public function birthYear(): string
{ {
return (string) $this->birthday->year; return (string) $this->birthday->year;
} }
public function birthdayHuman(): string
{
return $this->birthday->format('d.m.Y');
}
public function genderLetter(): string
{
return $this->gender->short;
}
} }

View File

@ -3,15 +3,16 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class BdkjHesse extends ContributionDocument class BdkjHesse extends ContributionDocument
{ {
use HasPdfBackground;
/** /**
* @param Collection<int, Collection<int, MemberData>> $members * @param Collection<int, Collection<int, MemberData>> $members
*/ */
@ -25,6 +26,7 @@ class BdkjHesse extends ContributionDocument
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
) { ) {
$this->setEventName($eventName);
} }
public function dateFrom(): string public function dateFrom(): string
@ -74,7 +76,7 @@ class BdkjHesse extends ContributionDocument
public function durationDays(): int public function durationDays(): int
{ {
return Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom)) + 1; return intVal(Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom))) + 1;
} }
/** /**
@ -114,36 +116,9 @@ class BdkjHesse extends ContributionDocument
return $member->birthYear(); return $member->birthYear();
} }
public function basename(): string
{
return 'zuschuesse-bdkj-hessen' . Str::slug($this->eventName);
}
public function view(): string
{
return 'tex.contribution.bdkj-hesse';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string public static function getName(): string
{ {
return 'Für BDKJ Hessen erstellen'; return 'BDKJ Hessen';
} }
/** /**
@ -156,7 +131,6 @@ class BdkjHesse extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d', 'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id', 'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string', 'zipLocation' => 'required|string',
'eventName' => 'required|string',
]; ];
} }
} }

View File

@ -3,16 +3,17 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use App\Invoice\InvoiceSettings; use App\Invoice\InvoiceSettings;
use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CityFrankfurtMainDocument extends ContributionDocument class CityFrankfurtMainDocument extends ContributionDocument
{ {
use HasPdfBackground;
use FormatsDates;
public string $fromName; public string $fromName;
/** /**
@ -28,6 +29,7 @@ class CityFrankfurtMainDocument extends ContributionDocument
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
) { ) {
$this->setEventName($eventName);
$this->fromName = app(InvoiceSettings::class)->from_long; $this->fromName = app(InvoiceSettings::class)->from_long;
} }
@ -61,17 +63,6 @@ class CityFrankfurtMainDocument extends ContributionDocument
); );
} }
public function dateFromHuman(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y');
}
public function dateUntilHuman(): string
{
return Carbon::parse($this->dateUntil)->format('d.m.Y');
}
public function countryName(): string public function countryName(): string
{ {
return $this->country->name; return $this->country->name;
@ -82,56 +73,9 @@ class CityFrankfurtMainDocument extends ContributionDocument
return count($this->members); return count($this->members);
} }
public function memberShort(MemberData $member): string
{
return $member->isLeader ? 'L' : '';
}
public function memberName(MemberData $member): string
{
return $member->separatedName();
}
public function memberAddress(MemberData $member): string
{
return $member->fullAddress();
}
public function memberAge(MemberData $member): string
{
return $member->age();
}
public function basename(): string
{
return 'zuschuesse-frankfurt-' . Str::slug($this->eventName);
}
public function view(): string
{
return 'tex.contribution.city-frankfurt-main';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string public static function getName(): string
{ {
return 'Für Frankfurt erstellen'; return 'Frankfurt';
} }
/** /**
@ -144,7 +88,6 @@ class CityFrankfurtMainDocument extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d', 'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id', 'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string', 'zipLocation' => 'required|string',
'eventName' => 'required|string',
]; ];
} }
} }

View File

@ -3,15 +3,17 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use App\Member\Member; use App\Member\Member;
use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CityRemscheidDocument extends ContributionDocument class CityRemscheidDocument extends ContributionDocument
{ {
use HasPdfBackground;
use FormatsDates;
/** /**
* @param Collection<int, Collection<int, Member>> $leaders * @param Collection<int, Collection<int, Member>> $leaders
* @param Collection<int, Collection<int, Member>> $children * @param Collection<int, Collection<int, Member>> $children
@ -25,17 +27,9 @@ class CityRemscheidDocument extends ContributionDocument
public Collection $children, public Collection $children,
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
public string $eventName = '',
) { ) {
} $this->setEventName($eventName);
public function niceDateFrom(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y');
}
public function niceDateUntil(): string
{
return Carbon::parse($this->dateUntil)->format('d.m.Y');
} }
/** /**
@ -52,6 +46,7 @@ class CityRemscheidDocument extends ContributionDocument
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
leaders: $leaders->values()->toBase()->chunk(6), leaders: $leaders->values()->toBase()->chunk(6),
children: $children->values()->toBase()->chunk(20), children: $children->values()->toBase()->chunk(20),
eventName: $request['eventName'],
); );
} }
@ -70,39 +65,13 @@ class CityRemscheidDocument extends ContributionDocument
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
leaders: $leaders->values()->toBase()->chunk(6), leaders: $leaders->values()->toBase()->chunk(6),
children: $children->values()->toBase()->chunk(20), children: $children->values()->toBase()->chunk(20),
eventName: $request['eventName'],
); );
} }
public function basename(): string
{
return 'zuschuesse-remscheid';
}
public function view(): string
{
return 'tex.contribution.city-remscheid';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string public static function getName(): string
{ {
return 'Für Remscheid erstellen'; return 'Remscheid';
} }
/** /**

View File

@ -6,9 +6,7 @@ use App\Contribution\Data\MemberData;
use App\Invoice\InvoiceSettings; use App\Invoice\InvoiceSettings;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Zoomyboy\Tex\Engine; use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class CitySolingenDocument extends ContributionDocument class CitySolingenDocument extends ContributionDocument
{ {
@ -25,6 +23,7 @@ class CitySolingenDocument extends ContributionDocument
public string $eventName, public string $eventName,
public string $type = 'F', public string $type = 'F',
) { ) {
$this->setEventName($eventName);
$this->fromName = app(InvoiceSettings::class)->from_long; $this->fromName = app(InvoiceSettings::class)->from_long;
} }
@ -74,11 +73,6 @@ class CitySolingenDocument extends ContributionDocument
return Carbon::parse($this->dateUntil)->format('d.m.Y'); return Carbon::parse($this->dateUntil)->format('d.m.Y');
} }
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function checkboxes(): string public function checkboxes(): string
{ {
$output = ''; $output = '';
@ -94,16 +88,6 @@ class CitySolingenDocument extends ContributionDocument
return $firstRow . "\n" . $secondRow; return $firstRow . "\n" . $secondRow;
} }
public function basename(): string
{
return 'zuschuesse-solingen-' . Str::slug($this->eventName);
}
public function view(): string
{
return 'tex.contribution.city-solingen';
}
public function getEngine(): Engine public function getEngine(): Engine
{ {
return Engine::PDFLATEX; return Engine::PDFLATEX;
@ -111,7 +95,7 @@ class CitySolingenDocument extends ContributionDocument
public static function getName(): string public static function getName(): string
{ {
return 'Für Stadt Solingen erstellen'; return 'Stadt Solingen';
} }
/** /**
@ -123,7 +107,6 @@ class CitySolingenDocument extends ContributionDocument
'dateFrom' => 'required|string|date_format:Y-m-d', 'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d', 'dateUntil' => 'required|string|date_format:Y-m-d',
'zipLocation' => 'required|string', 'zipLocation' => 'required|string',
'eventName' => 'required|string',
]; ];
} }
} }

View File

@ -3,9 +3,12 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use Zoomyboy\Tex\Document; use Zoomyboy\Tex\Document;
use Zoomyboy\Tex\Template;
abstract class ContributionDocument extends Document abstract class ContributionDocument extends Document
{ {
private string $eventName;
abstract public static function getName(): string; abstract public static function getName(): string;
/** /**
@ -29,8 +32,34 @@ abstract class ContributionDocument extends Document
public static function globalRules(): array public static function globalRules(): array
{ {
return [ return [
'eventName' => 'required|string',
'members' => 'present|array|min:1', 'members' => 'present|array|min:1',
'members.*' => 'integer|exists:members,id', 'members.*' => 'integer|exists:members,id',
]; ];
} }
public static function buttonName(): string
{
return 'Für ' . static::getName() . ' erstellen';;
}
public function setEventName(string $eventName): void
{
$this->eventName = $eventName;
}
public function basename(): string
{
return str('Zuschüsse ')->append($this->getName())->append(' ')->append($this->eventName)->slug();
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function view(): string
{
return 'tex.contribution.' . str(class_basename(static::class))->replace('Document', '')->kebab()->toString();
}
} }

View File

@ -3,14 +3,16 @@
namespace App\Contribution\Documents; namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData; use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country; use App\Country;
use Carbon\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Zoomyboy\Tex\Engine;
use Zoomyboy\Tex\Template;
class RdpNrwDocument extends ContributionDocument class RdpNrwDocument extends ContributionDocument
{ {
use HasPdfBackground;
use FormatsDates;
/** /**
* @param Collection<int, Collection<int, MemberData>> $members * @param Collection<int, Collection<int, MemberData>> $members
*/ */
@ -22,14 +24,9 @@ class RdpNrwDocument extends ContributionDocument
public Collection $members, public Collection $members,
public ?string $filename = '', public ?string $filename = '',
public string $type = 'F', public string $type = 'F',
public string $eventName = '',
) { ) {
} $this->setEventName($eventName);
public function dateRange(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y')
. ' - '
. Carbon::parse($this->dateUntil)->format('d.m.Y');
} }
/** /**
@ -43,6 +40,7 @@ class RdpNrwDocument extends ContributionDocument
zipLocation: $request['zipLocation'], zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromModels($request['members'])->chunk(17), members: MemberData::fromModels($request['members'])->chunk(17),
eventName: $request['eventName'],
); );
} }
@ -57,6 +55,7 @@ class RdpNrwDocument extends ContributionDocument
zipLocation: $request['zipLocation'], zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(), country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromApi($request['member_data'])->chunk(17), members: MemberData::fromApi($request['member_data'])->chunk(17),
eventName: $request['eventName'],
); );
} }
@ -65,65 +64,9 @@ class RdpNrwDocument extends ContributionDocument
return $this->country->name; return $this->country->name;
} }
public function memberShort(MemberData $member): string
{
return $member->isLeader ? 'L' : '';
}
public function memberName(MemberData $member): string
{
return $member->separatedName();
}
public function memberAddress(MemberData $member): string
{
return $member->fullAddress();
}
public function memberGender(MemberData $member): string
{
if (!$member->gender) {
return '';
}
return strtolower(substr($member->gender->name, 0, 1));
}
public function memberAge(MemberData $member): string
{
return $member->age();
}
public function basename(): string
{
return 'zuschuesse-rdp-nrw';
}
public function view(): string
{
return 'tex.contribution.rdp-nrw';
}
public function template(): Template
{
return Template::make('tex.templates.contribution');
}
public function setFilename(string $filename): static
{
$this->filename = $filename;
return $this;
}
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
public static function getName(): string public static function getName(): string
{ {
return 'Für RdP NRW erstellen'; return 'RdP NRW';
} }
/** /**
@ -136,7 +79,6 @@ class RdpNrwDocument extends ContributionDocument
'dateUntil' => 'required|string|date_format:Y-m-d', 'dateUntil' => 'required|string|date_format:Y-m-d',
'country' => 'required|integer|exists:countries,id', 'country' => 'required|integer|exists:countries,id',
'zipLocation' => 'required|string', 'zipLocation' => 'required|string',
'eventName' => 'required|string',
]; ];
} }
} }

View File

@ -0,0 +1,79 @@
<?php
namespace App\Contribution\Documents;
use App\Contribution\Data\MemberData;
use App\Contribution\Traits\FormatsDates;
use App\Contribution\Traits\HasPdfBackground;
use App\Country;
use Illuminate\Support\Collection;
class WuppertalDocument extends ContributionDocument
{
use HasPdfBackground;
use FormatsDates;
/**
* @param Collection<int, Collection<int, MemberData>> $members
*/
public function __construct(
public string $dateFrom,
public string $dateUntil,
public string $zipLocation,
public ?Country $country,
public Collection $members,
public ?string $filename = '',
public string $type = 'F',
public string $eventName = '',
) {
$this->setEventName($eventName);
}
/**
* {@inheritdoc}
*/
public static function fromRequest(array $request): self
{
return new self(
dateFrom: $request['dateFrom'],
dateUntil: $request['dateUntil'],
zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromModels($request['members'])->chunk(14),
eventName: $request['eventName'],
);
}
/**
* {@inheritdoc}
*/
public static function fromApiRequest(array $request): self
{
return new self(
dateFrom: $request['dateFrom'],
dateUntil: $request['dateUntil'],
zipLocation: $request['zipLocation'],
country: Country::where('id', $request['country'])->firstOrFail(),
members: MemberData::fromApi($request['member_data'])->chunk(14),
eventName: $request['eventName'],
);
}
public static function getName(): string
{
return 'Wuppertal';
}
/**
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
'dateFrom' => 'required|string|date_format:Y-m-d',
'dateUntil' => 'required|string|date_format:Y-m-d',
'zipLocation' => 'required|string',
];
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Contribution\Traits;
use Carbon\Carbon;
trait FormatsDates
{
public function niceDateFrom(): string
{
return Carbon::parse($this->dateFrom)->format('d.m.Y');
}
public function niceDateUntil(): string
{
return Carbon::parse($this->dateUntil)->format('d.m.Y');
}
public function dateRange(): string
{
return implode(' - ', [$this->niceDateFrom(), $this->niceDateUntil()]);
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Contribution\Traits;
use Zoomyboy\Tex\Engine;
trait HasPdfBackground
{
public function getEngine(): Engine
{
return Engine::PDFLATEX;
}
}

View File

@ -3,11 +3,13 @@
namespace App; namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\CountryFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Country extends Model class Country extends Model
{ {
/** @use HasFactory<CountryFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -3,11 +3,13 @@
namespace App\Course\Models; namespace App\Course\Models;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\Course\Models\CourseFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Course extends Model class Course extends Model
{ {
/** @use HasFactory<CourseFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -3,12 +3,14 @@
namespace App\Course\Models; namespace App\Course\Models;
use App\Member\Member; use App\Member\Member;
use Database\Factories\Course\Models\CourseMemberFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CourseMember extends Model class CourseMember extends Model
{ {
/** @use HasFactory<CourseMemberFactory> */
use HasFactory; use HasFactory;
/** @var array<int, string> */ /** @var array<int, string> */

View File

@ -2,7 +2,9 @@
namespace App\Dashboard; namespace App\Dashboard;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use App\Dashboard\Actions\IndexAction as DashboardIndexAction;
class DashboardServiceProvider extends ServiceProvider class DashboardServiceProvider extends ServiceProvider
{ {
@ -23,5 +25,8 @@ class DashboardServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
app(Router::class)->middleware(['web', 'auth:web'])->group(function ($router) {
$router->get('/', DashboardIndexAction::class)->name('home');
});
} }
} }

View File

@ -8,9 +8,6 @@ use Sabre\CardDAV\Backend\AbstractBackend;
use Sabre\DAV\PropPatch; use Sabre\DAV\PropPatch;
use Sabre\VObject\Component\VCard; use Sabre\VObject\Component\VCard;
/**
* @template M as array{lastmodified: int, etag: string, uri: string, id: int, size: int}
*/
class AddressBookBackend extends AbstractBackend class AddressBookBackend extends AbstractBackend
{ {
/** /**
@ -115,7 +112,7 @@ class AddressBookBackend extends AbstractBackend
* *
* @param mixed $addressbookId * @param mixed $addressbookId
* *
* @return array<int, M> * @return array<int, AddressBookCard>
*/ */
public function getCards($addressbookId): array public function getCards($addressbookId): array
{ {
@ -133,7 +130,7 @@ class AddressBookBackend extends AbstractBackend
* @param mixed $addressBookId * @param mixed $addressBookId
* @param string $cardUri * @param string $cardUri
* *
* @return M * @return AddressBookCard|bool
*/ */
public function getCard($addressBookId, $cardUri) public function getCard($addressBookId, $cardUri)
{ {
@ -158,8 +155,9 @@ class AddressBookBackend extends AbstractBackend
* If the backend supports this, it may allow for some speed-ups. * If the backend supports this, it may allow for some speed-ups.
* *
* @param mixed $addressBookId * @param mixed $addressBookId
* @param array<int, string> $uris
* *
* @return array * @return array<int, mixed>
*/ */
public function getMultipleCards($addressBookId, array $uris) public function getMultipleCards($addressBookId, array $uris)
{ {
@ -248,7 +246,7 @@ class AddressBookBackend extends AbstractBackend
} }
/** /**
* @return M * @return AddressBookCard
*/ */
private function cardMeta(Member $member): array private function cardMeta(Member $member): array
{ {

View File

@ -136,10 +136,11 @@ class Principal implements PrincipalBackendInterface
* *
* @param string $principal * @param string $principal
* *
* @return array * @return array<int, string>|null
*/ */
public function getGroupMemberSet($principal) public function getGroupMemberSet($principal)
{ {
return [];
} }
/** /**
@ -147,7 +148,7 @@ class Principal implements PrincipalBackendInterface
* *
* @param string $principal * @param string $principal
* *
* @return array * @return array<int, string>|null
*/ */
public function getGroupMembership($principal) public function getGroupMembership($principal)
{ {
@ -155,7 +156,7 @@ class Principal implements PrincipalBackendInterface
return null; return null;
} }
return ['addressbooks/'.$matches[1]]; return ['addressbooks/' . $matches[1]];
} }
/** /**
@ -164,6 +165,8 @@ class Principal implements PrincipalBackendInterface
* The principals should be passed as a list of uri's. * The principals should be passed as a list of uri's.
* *
* @param string $principal * @param string $principal
* @param array<int, string> $members
* @return void
*/ */
public function setGroupMemberSet($principal, array $members) public function setGroupMemberSet($principal, array $members)
{ {
@ -175,8 +178,8 @@ class Principal implements PrincipalBackendInterface
private function userToPrincipal(User $user): array private function userToPrincipal(User $user): array
{ {
return [ return [
'{DAV:}displayname' => $user->name, '{DAV:}displayname' => $user->firstname . ' ' . $user->lastname,
'uri' => 'principals/'.$user->email, 'uri' => 'principals/' . $user->email,
'{http://sabredav.org/ns}email-address' => $user->email, '{http://sabredav.org/ns}email-address' => $user->email,
]; ];
} }

View File

@ -9,6 +9,7 @@ use Sabre\CardDAV\AddressBookRoot;
use Sabre\CardDAV\Plugin as CardDAVPlugin; use Sabre\CardDAV\Plugin as CardDAVPlugin;
use Sabre\DAV\Auth\Plugin as AuthPlugin; use Sabre\DAV\Auth\Plugin as AuthPlugin;
use Sabre\DAV\Browser\Plugin as BrowserPlugin; use Sabre\DAV\Browser\Plugin as BrowserPlugin;
use Sabre\DAV\ServerPlugin;
use Sabre\DAVACL\AbstractPrincipalCollection; use Sabre\DAVACL\AbstractPrincipalCollection;
use Sabre\DAVACL\Plugin as AclPlugin; use Sabre\DAVACL\Plugin as AclPlugin;
use Sabre\DAVACL\PrincipalCollection; use Sabre\DAVACL\PrincipalCollection;
@ -50,6 +51,9 @@ class ServiceProvider extends BaseServiceProvider
]; ];
} }
/**
* @return array<int, ServerPlugin>
*/
private function plugins(): array private function plugins(): array
{ {
$authBackend = new AuthBackend(); $authBackend = new AuthBackend();

View File

@ -19,7 +19,7 @@ class EfzPendingBlock extends Block
}) })
->whereCurrentGroup() ->whereCurrentGroup()
->orderByRaw('lastname, firstname') ->orderByRaw('lastname, firstname')
->whereHas('memberships', fn ($builder) => $builder->isLeader()); ->whereHas('memberships', fn ($builder) => $builder->isLeader()->active());
} }
/** /**

View File

@ -12,15 +12,14 @@ class Handler extends ExceptionHandler
/** /**
* A list of the exception types that are not reported. * A list of the exception types that are not reported.
* *
* @var string[] * @var array<int, class-string<Throwable>>
*/ */
protected $dontReport = [ protected $dontReport = [];
];
/** /**
* A list of the inputs that are never flashed for validation exceptions. * A list of the inputs that are never flashed for validation exceptions.
* *
* @var string[] * @var array<int, string>
*/ */
protected $dontFlash = [ protected $dontFlash = [
'password', 'password',

View File

@ -4,12 +4,14 @@ namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use App\Payment\Subscription; use App\Payment\Subscription;
use Database\Factories\FeeFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
class Fee extends Model class Fee extends Model
{ {
/** @use HasFactory<FeeFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;

View File

@ -0,0 +1,21 @@
<?php
namespace App\Fileshare\Actions;
use App\Fileshare\Models\Fileshare;
use App\Fileshare\Resources\FileshareResource;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Lorisleiva\Actions\Concerns\AsAction;
class FileshareApiIndexAction
{
use AsAction;
public function handle(): AnonymousResourceCollection
{
session()->put('menu', 'setting');
session()->put('title', 'Datei-Verbindungen');
return FileshareResource::collection(Fileshare::paginate(15));
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Fileshare\Actions;
use App\Fileshare\Models\Fileshare;
use App\Lib\Events\Succeeded;
use Illuminate\Validation\ValidationException;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class FileshareStoreAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'name' => 'required|string|max:255',
'type' => 'required|string|max:255|exclude',
'config' => 'array|exclude',
];
}
public function asController(ActionRequest $request): void
{
$type = $request->input('type')::from($request->input('config'));
if (!$type->check()) {
throw ValidationException::withMessages(['type' => 'Verbindung fehlgeschlagen']);
}
Fileshare::create([
...$request->validated(),
'type' => $type,
]);
Succeeded::message('Verbindung erstellt.')->dispatch();
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Fileshare\Actions;
use App\Fileshare\Models\Fileshare;
use App\Lib\Events\Succeeded;
use Illuminate\Validation\ValidationException;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class FileshareUpdateAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'name' => 'required|string|max:255',
'type' => 'required|string|max:255|exclude',
'config' => 'array|exclude',
];
}
public function handle(ActionRequest $request, Fileshare $fileshare): void
{
$type = $request->input('type')::from($request->input('config'));
if (!$type->check()) {
throw ValidationException::withMessages(['type' => 'Verbindung fehlgeschlagen']);
}
$fileshare->update([
...$request->validated(),
'type' => $type,
]);
Succeeded::message('Verbindung bearbeitet.')->dispatch();
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Fileshare\Actions;
use App\Fileshare\Data\ResourceData;
use App\Fileshare\Models\Fileshare;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\LaravelData\DataCollection;
class ListFilesAction
{
use AsAction;
/**
* @return DataCollection<int, ResourceData>
*/
public function handle(ActionRequest $request, Fileshare $fileshare): DataCollection
{
return ResourceData::collect($fileshare->type->getSubDirectories($request->input('parent')), DataCollection::class)->wrap('data');
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Fileshare\ConnectionTypes;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\Collection;
use Spatie\LaravelData\Data;
abstract class ConnectionType extends Data
{
abstract public function check(): bool;
/**
* @return array<string, mixed>
*/
abstract public static function defaults(): array;
abstract public static function title(): string;
abstract public function getFilesystem(): FilesystemAdapter;
/**
* @return array<int, array{label: string, key: string, type: string}>
*/
abstract public static function fields(): array;
/**
* @return array<int, mixed>
*/
public static function forSelect(): array
{
return self::types()
->map(fn ($file) => ['id' => $file, 'name' => $file::title(), 'defaults' => $file::defaults(), 'fields' => $file::fields()])
->toArray();
}
/**
* @return array<int, string>
*/
public function getSubDirectories(?string $parent): array
{
$filesystem = $this->getFilesystem();
return $filesystem->directories($parent ?: '/');
}
/**
* @return Collection<int, class-string<ConnectionType>>
*/
private static function types(): Collection
{
return collect(glob(base_path('app/Fileshare/ConnectionTypes/*')))
->map(fn ($file) => 'App\\Fileshare\\ConnectionTypes\\' . pathinfo($file, PATHINFO_FILENAME))
->filter(fn ($file) => $file !== static::class)
->values();
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Fileshare\ConnectionTypes;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Http;
use League\Flysystem\Filesystem;
use League\Flysystem\WebDAV\WebDAVAdapter;
use Sabre\DAV\Client;
class NextcloudConnection extends OwncloudConnection
{
public function check(): bool
{
try {
$response = Http::withoutVerifying()
->withBasicAuth($this->user, $this->password)
->withHeaders(['OCS-APIRequest' => 'true'])
->acceptJson()
->get($this->baseUrl . '/ocs/v2.php/cloud/capabilities');
return $response->ok();
} catch (ConnectionException $e) {
return false;
}
}
public static function title(): string
{
return 'Nextcloud';
}
public function getFilesystem(): FilesystemAdapter
{
$adapter = new WebDAVAdapter(new Client([
'baseUri' => $this->baseUrl . '/remote.php/dav/files/' . $this->user,
'userName' => $this->user,
'password' => $this->password,
]), '/remote.php/dav/files/' . $this->user);
return new FilesystemAdapter(new Filesystem($adapter), $adapter);
}
}

View File

@ -0,0 +1,76 @@
<?php
namespace App\Fileshare\ConnectionTypes;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Http;
use League\Flysystem\Filesystem;
use League\Flysystem\WebDAV\WebDAVAdapter;
use Sabre\DAV\Client;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
#[MapInputName(SnakeCaseMapper::class)]
#[MapOutputName(SnakeCaseMapper::class)]
class OwncloudConnection extends ConnectionType
{
public function __construct(
public string $user,
public string $password,
public string $baseUrl,
) {
}
public function check(): bool
{
try {
$response = Http::withoutVerifying()->withBasicAuth($this->user, $this->password)->acceptJson()->get($this->baseUrl . '/ocs/v1.php/cloud/capabilities?format=json');
return $response->ok();
} catch (ConnectionException $e) {
return false;
}
}
/**
* @inheritdoc
*/
public static function defaults(): array
{
return [
'user' => '',
'password' => '',
'base_url' => '',
];
}
public static function title(): string
{
return 'Owncloud';
}
/**
* @inheritdoc
*/
public static function fields(): array
{
return [
['label' => 'URL', 'key' => 'base_url', 'type' => 'text'],
['label' => 'Benutzer', 'key' => 'user', 'type' => 'text'],
['label' => 'Passwort', 'key' => 'password', 'type' => 'password'],
];
}
public function getFilesystem(): FilesystemAdapter
{
$adapter = new WebDAVAdapter(new Client([
'baseUri' => $this->baseUrl . '/remote.php/dav/files/' . $this->user,
'userName' => $this->user,
'password' => $this->password,
]), '/remote.php/dav/files/' . $this->user);
return new FilesystemAdapter(new Filesystem($adapter), $adapter);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Fileshare\Data;
use App\Fileshare\Models\Fileshare;
use Illuminate\Filesystem\FilesystemAdapter;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
#[MapInputName(SnakeCaseMapper::class)]
#[MapOutputName(SnakeCaseMapper::class)]
class FileshareResourceData extends Data
{
public function __construct(public int $connectionId, public string $resource)
{
}
public function getConnection(): Fileshare
{
return Fileshare::find($this->connectionId);
}
public function getStorage(): FilesystemAdapter
{
return $this->getConnection()->type->getFilesystem();
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Fileshare\Data;
use Spatie\LaravelData\Data;
class ResourceData extends Data
{
public function __construct(public string $name, public string $path, public string $parent)
{
}
public static function fromString(string $path): self
{
$dir = '/' . trim($path, '\\/');
return self::from([
'path' => $dir,
'name' => pathinfo($dir, PATHINFO_BASENAME),
'parent' => pathinfo($dir, PATHINFO_DIRNAME),
]);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Fileshare;
use App\Fileshare\Models\Fileshare;
use App\Fileshare\Resources\FileshareResource;
use App\Setting\LocalSettings;
class FileshareSettings extends LocalSettings
{
public static function group(): string
{
return 'fileshare';
}
public static function title(): string
{
return 'Datei-Verbindungen';
}
/**
* @inheritdoc
*/
public function viewData(): array
{
return [
'data' => FileshareResource::collection(Fileshare::paginate(15))
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Fileshare\Models;
use App\Fileshare\ConnectionTypes\ConnectionType;
use Database\Factories\Fileshare\Models\FileshareFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Fileshare extends Model
{
/** @use HasFactory<FileshareFactory> */
use HasFactory;
public $guarded = [];
public $casts = [
'type' => ConnectionType::class,
];
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Fileshare\Resources;
use App\Fileshare\ConnectionTypes\ConnectionType;
use App\Fileshare\Models\Fileshare;
use App\Lib\HasMeta;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin Fileshare
*/
class FileshareResource extends JsonResource
{
use HasMeta;
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array<string, mixed>
*/
public function toArray($request)
{
return [
'name' => $this->name,
'is_active' => $this->type->check(),
'type' => get_class($this->type),
'config' => $this->type->toArray(),
'id' => $this->id,
'type_human' => $this->type::title(),
'links' => [
'update' => route('fileshare.update', ['fileshare' => $this->getModel()]),
]
];
}
/**
* @return array<string, mixed>
*/
public static function meta(): array
{
return [
'default' => [
'name' => '',
'type' => null,
'config' => null,
],
'types' => ConnectionType::forSelect(),
'links' => [
'store' => route('fileshare.store'),
]
];
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Form;
use App\Form\Models\Participant;
use Illuminate\Database\Eloquent\Collection;
use Lorisleiva\Actions\Concerns\AsAction;
use Zoomyboy\TableDocument\SheetData;
use Zoomyboy\TableDocument\TableDocumentData;
class CreateExcelDocumentAction
{
use AsAction;
public Form $form;
/**
* @param Collection<int, Participant> $participants
*/
public function handle(Form $form, Collection $participants): string
{
$this->form = $form;
return file_get_contents($this->allSheet($participants)->compile($this->tempPath()));
}
/**
* @param Collection<int, Participant> $participants
*/
private function allSheet(Collection $participants): TableDocumentData
{
$document = TableDocumentData::from(['title' => 'Anmeldungen für ' . $this->form->name, 'sheets' => []]);
$headers = $this->form->getFields()->map(fn ($field) => $field->name)->toArray();
$document->addSheet(SheetData::from([
'header' => $headers,
'data' => $participants
->map(fn ($participant) => $this->form->getFields()->map(fn ($field) => $participant->getFields()->find($field)->presentRaw())->toArray())
->toArray(),
'name' => 'Alle',
]));
if ($this->form->export->groupBy) {
$groups = $participants->groupBy(fn ($participant) => $participant->getFields()->findByKey($this->form->export->groupBy)->presentRaw());
foreach ($groups as $name => $participants) {
$document->addSheet(SheetData::from([
'header' => $headers,
'data' => $participants
->map(fn ($participant) => $this->form->getFields()->map(fn ($field) => $participant->getFields()->find($field)->presentRaw())->toArray())
->toArray(),
'name' => $name,
]));
}
$document->addSheet(SheetData::from([
'header' => ['Wert', 'Anzahl'],
'data' => $groups->map(fn ($participants, $name) => [$name, (string) count($participants)])->toArray(),
'name' => 'Statistik',
]));
}
return $document;
}
private function tempPath(): string
{
return sys_get_temp_dir() . '/' . str()->uuid()->toString();
}
}

View File

@ -15,22 +15,14 @@ class ExportAction
public function handle(Form $form): string public function handle(Form $form): string
{ {
$csv = Writer::createFromString(); return CreateExcelDocumentAction::run($form, $form->participants);
$csv->insertOne($form->getFields()->names());
foreach ($form->participants as $participant) {
$csv->insertOne($participant->getFields()->presentValues());
}
return $csv->toString();
} }
public function asController(Form $form, ActionRequest $request): StreamedResponse public function asController(Form $form, ActionRequest $request): StreamedResponse
{ {
$contents = $this->handle($form); $contents = $this->handle($form);
$filename = 'tn-' . $form->slug . '.csv'; $filename = 'tn-' . $form->slug . '.xlsx';
Storage::disk('temp')->put($filename, $contents); Storage::disk('temp')->put($filename, $contents);
return Storage::disk('temp')->download($filename); return Storage::disk('temp')->download($filename);

View File

@ -0,0 +1,41 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Form;
use App\Group;
use Lorisleiva\Actions\Concerns\AsAction;
class ExportSyncAction
{
use AsAction;
public Form $form;
public function handle(Form $form): void
{
if (!$form->export->root) {
return;
}
$storage = $form->export->root->getStorage();
$storage->put($form->export->root->resource . '/Anmeldungen ' . $form->name . '.xlsx', CreateExcelDocumentAction::run($form, $form->participants));
if ($form->export->toGroupField) {
foreach ($form->participants->groupBy(fn ($participant) => $participant->data[$form->export->toGroupField]) as $groupId => $participants) {
$group = Group::find($groupId);
if (!$group?->fileshare) {
continue;
}
$group->fileshare->getStorage()->put($group->fileshare->resource . '/Anmeldungen ' . $form->name . '.xlsx', CreateExcelDocumentAction::run($form, $participants));
}
}
}
public function asJob(int $formId): void
{
$this->handle(Form::find($formId));
}
}

View File

@ -27,7 +27,7 @@ class FormApiListAction
{ {
return FormApiResource::collection($this->handle( return FormApiResource::collection($this->handle(
$request->input('filter', ''), $request->input('filter', ''),
$request->input('perPage', 10) $request->input('perPage', 9999)
)); ));
} }
} }

View File

@ -28,12 +28,14 @@ class FormStoreAction
'to' => 'required|date', 'to' => 'required|date',
'registration_from' => 'present|nullable|date', 'registration_from' => 'present|nullable|date',
'registration_until' => 'present|nullable|date', 'registration_until' => 'present|nullable|date',
'mail_top' => 'array',
'mail_bottom' => 'array',
'header_image' => 'required|exclude', 'header_image' => 'required|exclude',
'mailattachments' => 'present|array|exclude', 'mailattachments' => 'present|array|exclude',
'is_active' => 'boolean', 'is_active' => 'boolean',
'is_private' => 'boolean', 'is_private' => 'boolean',
'export' => 'nullable|array',
'needs_prevention' => 'present|boolean',
'prevention_text' => 'array',
'prevention_conditions' => 'array',
]; ];
} }

View File

@ -3,6 +3,7 @@
namespace App\Form\Actions; namespace App\Form\Actions;
use App\Form\Models\Form; use App\Form\Models\Form;
use App\Lib\Editor\Condition;
use App\Lib\Events\Succeeded; use App\Lib\Events\Succeeded;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
@ -29,10 +30,12 @@ class FormUpdateAction
'to' => 'required|date', 'to' => 'required|date',
'registration_from' => 'present|nullable|date', 'registration_from' => 'present|nullable|date',
'registration_until' => 'present|nullable|date', 'registration_until' => 'present|nullable|date',
'mail_top' => 'array',
'mail_bottom' => 'array',
'is_active' => 'boolean', 'is_active' => 'boolean',
'is_private' => 'boolean', 'is_private' => 'boolean',
'export' => 'nullable|array',
'needs_prevention' => 'present|boolean',
'prevention_text' => 'array',
'prevention_conditions' => 'array',
]; ];
} }

View File

@ -22,10 +22,10 @@ class FormUpdateMetaAction
return [ return [
'sorting' => 'array', 'sorting' => 'array',
'sorting.0' => 'required|string', 'sorting.by' => 'required|string',
'sorting.1' => 'required|string|in:asc,desc', 'sorting.direction' => 'required|boolean',
'active_columns' => 'array', 'active_columns' => 'array',
'active_columns.*' => ['string', Rule::in([...$form->getFields()->pluck('key')->toArray(), 'created_at'])] 'active_columns.*' => ['string', Rule::in([...$form->getFields()->pluck('key')->toArray(), 'created_at', 'prevention'])]
]; ];
} }

View File

@ -28,6 +28,8 @@ trait HasValidation
'config.sections.*.fields.*.columns.mobile' => 'required|numeric|gt:0|lte:2', 'config.sections.*.fields.*.columns.mobile' => 'required|numeric|gt:0|lte:2',
'config.sections.*.fields.*.columns.tablet' => 'required|numeric|gt:0|lte:4', 'config.sections.*.fields.*.columns.tablet' => 'required|numeric|gt:0|lte:4',
'config.sections.*.fields.*.columns.desktop' => 'required|numeric|gt:0|lte:6', 'config.sections.*.fields.*.columns.desktop' => 'required|numeric|gt:0|lte:6',
'mail_top' => 'array',
'mail_bottom' => 'array',
]; ];
} }

View File

@ -0,0 +1,27 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Participant;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class ParticipantAssignAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'member_id' => 'required|exists:members,id',
];
}
public function handle(Participant $participant, ActionRequest $request): void
{
$participant->update(['member_id' => $request->input('member_id')]);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Participant;
use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\Concerns\AsAction;
class ParticipantFieldsAction
{
use AsAction;
public function handle(Participant $participant): JsonResponse
{
return response()->json([
'data' => [
'id' => $participant->id,
'config' => $participant->getConfig(),
]
]);
}
}

View File

@ -7,7 +7,7 @@ use App\Form\Models\Participant;
use App\Form\Resources\ParticipantResource; use App\Form\Resources\ParticipantResource;
use App\Form\Scopes\ParticipantFilterScope; use App\Form\Scopes\ParticipantFilterScope;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection; use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Illuminate\Pagination\LengthAwarePaginator; use Laravel\Scout\Builder;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
class ParticipantIndexAction class ParticipantIndexAction
@ -15,17 +15,24 @@ class ParticipantIndexAction
use AsAction; use AsAction;
/** /**
* @return LengthAwarePaginator<Participant> * @return Builder<Participant>
*/ */
public function handle(Form $form, ParticipantFilterScope $filter): LengthAwarePaginator protected function getQuery(Form $form, ParticipantFilterScope $filter): Builder
{ {
return $form->participants()->withFilter($filter)->with('form')->paginate(15); return $filter->setForm($form)->getQuery()
->query(fn ($q) => $q->withCount('children')->with('form'));
} }
public function asController(Form $form): AnonymousResourceCollection public function asController(Form $form, ?int $parent = null): AnonymousResourceCollection
{ {
$filter = ParticipantFilterScope::fromRequest(request()->input('filter')); $filter = ParticipantFilterScope::fromRequest(request()->input('filter', ''))->parent($parent);
return ParticipantResource::collection($this->handle($form, $filter))
->additional(['meta' => ParticipantResource::meta($form)]); $data = match ($parent) {
null => $this->getQuery($form, $filter)->paginate(15), // initial all elements - paginate
-1 => $this->getQuery($form, $filter)->paginate(15), // initial root elements - parinate
default => $this->getQuery($form, $filter)->get(), // specific parent element - show all
};
return ParticipantResource::collection($data)->additional(['meta' => ParticipantResource::meta($form)]);
} }
} }

View File

@ -0,0 +1,56 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Form;
use App\Form\Models\Participant;
use App\Lib\Events\Succeeded;
use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class ParticipantStoreAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function rules(): array
{
/** @var Form */
$form = request()->route('form');
return $form->getRegistrationRules();
}
/**
* @return array<string, mixed>
*/
public function getValidationAttributes(): array
{
/** @var Form */
$form = request()->route('form');
return $form->getRegistrationAttributes();
}
/**
* @return array<string, mixed>
*/
public function getValidationMessages(): array
{
/** @var Form */
$form = request()->route('form');
return $form->getRegistrationMessages();
}
public function handle(Form $form, ActionRequest $request): JsonResponse
{
$form->participants()->create(['data' => $request->validated()]);
ExportSyncAction::dispatch($form->id);
Succeeded::message('Teilnehmer*in erstellt.')->dispatch();
return response()->json([]);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Participant;
use App\Lib\Events\Succeeded;
use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class ParticipantUpdateAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function rules(): array
{
/** @var Participant */
$participant = request()->route('participant');
return $participant->form->getRegistrationRules();
}
/**
* @return array<string, mixed>
*/
public function getValidationAttributes(): array
{
/** @var Participant */
$participant = request()->route('participant');
return $participant->form->getRegistrationAttributes();
}
/**
* @return array<string, mixed>
*/
public function getValidationMessages(): array
{
/** @var Participant */
$participant = request()->route('participant');
return $participant->form->getRegistrationMessages();
}
public function handle(Participant $participant, ActionRequest $request): JsonResponse
{
$participant->update(['data' => [...$participant->data, ...$request->validated()]]);
ExportSyncAction::dispatch($participant->form->id);
Succeeded::message('Teilnehmer*in bearbeitet.')->dispatch();
return response()->json([]);
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Form\Actions;
use App\Form\Editor\FormConditionResolver;
use App\Form\Models\Participant;
use App\Prevention\Mails\PreventionRememberMail;
use App\Prevention\PreventionSettings;
use Illuminate\Support\Facades\Mail;
use Lorisleiva\Actions\Concerns\AsAction;
class PreventionRememberAction
{
use AsAction;
public string $commandSignature = 'prevention:remember';
public function handle(): void
{
$query = Participant::whereHas(
'form',
fn ($form) => $form
->where('needs_prevention', true)
->where('from', '>=', now())
)
->where(
fn ($q) => $q
->where('last_remembered_at', '<=', now()->subWeeks(2))
->orWhereNull('last_remembered_at')
);
foreach ($query->get() as $participant) {
if (!app(FormConditionResolver::class)->forParticipant($participant)->filterCondition($participant->form->prevention_conditions)) {
continue;
}
if ($participant->getFields()->getMailRecipient() === null || count($participant->preventions()) === 0) {
continue;
}
$body = app(PreventionSettings::class)->refresh()->formmail
->placeholder('formname', $participant->form->name)
->append($participant->form->prevention_text);
Mail::send(new PreventionRememberMail($participant, $body));
$participant->update(['last_remembered_at' => now()]);
}
}
}

View File

@ -7,6 +7,7 @@ use App\Form\Models\Form;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use App\Member\Member; use App\Member\Member;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
@ -19,19 +20,24 @@ class RegisterAction
*/ */
public function handle(Form $form, array $input): Participant public function handle(Form $form, array $input): Participant
{ {
if (!$form->canRegister()) {
throw ValidationException::withMessages(['event' => 'Anmeldung zzt nicht möglich.']);
}
$memberQuery = FieldCollection::fromRequest($form, $input) $memberQuery = FieldCollection::fromRequest($form, $input)
->withNamiType() ->withNamiType()
->reduce(fn ($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery()); ->reduce(fn ($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery());
$mglnr = $form->getFields()->withNamiType()->count() && $memberQuery->count() === 1 ? $memberQuery->first()->mitgliedsnr : null; $member = $form->getFields()->withNamiType()->count() && $memberQuery->count() === 1 ? $memberQuery->first() : null;
$participant = $form->participants()->create([ $participant = $form->participants()->create([
'data' => $input, 'data' => $input,
'mitgliedsnr' => $mglnr, 'member_id' => $member?->id,
]); ]);
$form->getFields()->each(fn ($field) => $field->afterRegistration($form, $participant, $input)); $form->getFields()->each(fn ($field) => $field->afterRegistration($form, $participant, $input));
$participant->sendConfirmationMail(); $participant->sendConfirmationMail();
ExportSyncAction::dispatch($form->id);
return $participant; return $participant;
} }

View File

@ -1,36 +0,0 @@
<?php
namespace App\Form\Actions;
use App\Form\FormSettings;
use Inertia\Inertia;
use Inertia\Response;
use Lorisleiva\Actions\Concerns\AsAction;
class SettingIndexAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function handle(FormSettings $settings): array
{
return [
'data' => [
'register_url' => $settings->registerUrl,
'clear_cache_url' => $settings->clearCacheUrl,
],
];
}
public function asController(FormSettings $settings): Response
{
session()->put('menu', 'setting');
session()->put('title', 'Module');
return Inertia::render('setting/Form', [
'data' => $this->handle($settings),
]);
}
}

View File

@ -1,46 +0,0 @@
<?php
namespace App\Form\Actions;
use App\Form\FormSettings;
use Illuminate\Http\RedirectResponse;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class SettingStoreAction
{
use AsAction;
/**
* @param array<string, mixed> $input
*/
public function handle(array $input): void
{
$settings = app(FormSettings::class);
$settings->fill([
'registerUrl' => $input['register_url'],
'clearCacheUrl' => $input['clear_cache_url'],
]);
$settings->save();
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'register_url' => 'present|string',
'clear_cache_url' => 'present|string',
];
}
public function asController(ActionRequest $request): RedirectResponse
{
$this->handle($request->validated());
return redirect()->back();
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Form\Actions;
use App\Form\Models\Form;
use Lorisleiva\Actions\Concerns\AsAction;
class UpdateParticipantSearchIndexAction
{
use AsAction;
public function handle(Form $form): void
{
if (config('scout.driver') !== 'meilisearch') {
return;
}
$form->searchableUsing()->updateIndexSettings(
$form->participantsSearchableAs(),
[
'filterableAttributes' => [...$form->getFields()->filterables()->getKeys(), 'parent-id'],
'searchableAttributes' => $form->getFields()->searchables()->getKeys(),
'sortableAttributes' => [...$form->getFields()->sortables()->getKeys(), 'id', 'created_at'],
'displayedAttributes' => [...$form->getFields()->filterables()->getKeys(), ...$form->getFields()->searchables()->getKeys(), 'id'],
'pagination' => [
'maxTotalHits' => 1000000,
]
]
);
}
}

View File

@ -6,6 +6,7 @@ use App\Form\Fields\Field;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Data; use Spatie\LaravelData\Data;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
class CollectionCast implements Cast class CollectionCast implements Cast
@ -20,10 +21,9 @@ class CollectionCast implements Cast
/** /**
* @param array<int, array<string, mixed>> $value * @param array<int, array<string, mixed>> $value
* @param array<string, mixed> $context
* @return Collection<int, Data> * @return Collection<int, Data>
*/ */
public function cast(DataProperty $property, mixed $value, array $context): mixed public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed
{ {
return collect($value)->map(fn ($item) => $this->target::from($item)); return collect($value)->map(fn ($item) => $this->target::from($item));
} }

View File

@ -5,16 +5,16 @@ namespace App\Form\Casts;
use App\Form\Data\FieldCollection; use App\Form\Data\FieldCollection;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
class FieldCollectionCast implements Cast class FieldCollectionCast implements Cast
{ {
/** /**
* @param array<int, array<string, mixed>> $value * @param array<int, array<string, string>> $value
* @param array<string, mixed> $context
* @return FieldCollection * @return FieldCollection
*/ */
public function cast(DataProperty $property, mixed $value, array $context): mixed public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed
{ {
return new FieldCollection(collect($value)->map(fn ($value) => Field::classFromType($value['type'])::from($value))->all()); return new FieldCollection(collect($value)->map(fn ($value) => Field::classFromType($value['type'])::from($value))->all());
} }

View File

@ -0,0 +1,9 @@
<?php
namespace App\Form\Contracts;
interface Filterable
{
/** @param mixed $value */
public function filter($value): string;
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Form\Data;
use App\Fileshare\Data\FileshareResourceData;
use App\Form\Fields\Field;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
#[MapInputName(SnakeCaseMapper::class)]
#[MapOutputName(SnakeCaseMapper::class)]
class ExportData extends Data
{
public function __construct(public ?FileshareResourceData $root = null, public ?string $groupBy = null, public ?string $toGroupField = null)
{
}
}

View File

@ -2,6 +2,7 @@
namespace App\Form\Data; namespace App\Form\Data;
use App\Form\Contracts\Filterable;
use App\Form\Enums\SpecialType; use App\Form\Enums\SpecialType;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use App\Form\Fields\NamiField; use App\Form\Fields\NamiField;
@ -35,6 +36,11 @@ class FieldCollection extends Collection
return $this->filter(fn ($field) => !is_a($field, NamiField::class)); return $this->filter(fn ($field) => !is_a($field, NamiField::class));
} }
public function hasNamiField(): bool
{
return $this->first(fn ($field) => is_a($field, NamiField::class)) !== null;
}
/** /**
* @return stdClass * @return stdClass
*/ */
@ -112,4 +118,27 @@ class FieldCollection extends Collection
{ {
return $this->first(fn ($field) => $field->specialType === $specialType); return $this->first(fn ($field) => $field->specialType === $specialType);
} }
public function searchables(): self
{
return $this;
}
public function sortables(): self
{
return $this;
}
public function filterables(): self
{
return $this->filter(fn ($field) => $field instanceof Filterable);
}
/**
* @return array<int, string>
*/
public function getKeys(): array
{
return $this->map(fn ($field) => $field->key)->toArray();
}
} }

View File

@ -3,6 +3,7 @@
namespace App\Form\Editor; namespace App\Form\Editor;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use App\Lib\Editor\Condition;
use App\Lib\Editor\ConditionResolver; use App\Lib\Editor\ConditionResolver;
class FormConditionResolver extends ConditionResolver class FormConditionResolver extends ConditionResolver
@ -20,24 +21,24 @@ class FormConditionResolver extends ConditionResolver
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function filterCondition(string $mode, array $ifs): bool public function filterCondition(Condition $condition): bool
{ {
if (count($ifs) === 0) { if (!$condition->hasStatements()) {
return true; return true;
} }
foreach ($ifs as $if) { foreach ($condition->ifs as $if) {
$field = $this->participant->getFields()->findByKey($if['field']); $field = $this->participant->getFields()->findByKey($if->field);
$matches = $field->matches($if['comparator'], $if['value']); $matches = $field->matches($if->comparator, $if->value);
if ($matches && $mode === 'any') { if ($matches && $condition->isAny()) {
return true; return true;
} }
if (!$matches && $mode === 'all') { if (!$matches && $condition->isAll()) {
return false; return false;
} }
} }
if ($mode === 'any') { if ($condition->isAny()) {
return false; return false;
} }

View File

@ -48,7 +48,7 @@ enum NamiType: string
static::LOCATION => $member->location, static::LOCATION => $member->location,
static::NICKNAME => $member->nickname, static::NICKNAME => $member->nickname,
static::GENDER => $member->gender?->name, static::GENDER => $member->gender?->name,
static::AGE => $member->birthday->diffInYears(now()), static::AGE => intVal($member->birthday->diffInYears(now())),
static::AGEEVENT => $member->birthday->diffInYears($form->from), static::AGEEVENT => $member->birthday->diffInYears($form->from),
static::MOBILEPHONE => $member->mobile_phone, static::MOBILEPHONE => $member->mobile_phone,
}; };
@ -64,7 +64,6 @@ enum NamiType: string
static::FIRSTNAME => $query->where('firstname', $value), static::FIRSTNAME => $query->where('firstname', $value),
static::LASTNAME => $query->where('lastname', $value), static::LASTNAME => $query->where('lastname', $value),
static::BIRTHDAY => $query->where('birthday', $value), static::BIRTHDAY => $query->where('birthday', $value),
static::EMAIL => $query->where('email', $value),
default => $query, default => $query,
}; };
} }

View File

@ -2,6 +2,7 @@
namespace App\Form\Fields; namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\BooleanMatcher; use App\Form\Matchers\BooleanMatcher;
use App\Form\Matchers\Matcher; use App\Form\Matchers\Matcher;
use App\Form\Models\Form; use App\Form\Models\Form;
@ -9,9 +10,8 @@ use App\Form\Models\Participant;
use App\Form\Presenters\BooleanPresenter; use App\Form\Presenters\BooleanPresenter;
use App\Form\Presenters\Presenter; use App\Form\Presenters\Presenter;
use Faker\Generator; use Faker\Generator;
use Illuminate\Validation\Rule;
class CheckboxField extends Field class CheckboxField extends Field implements Filterable
{ {
public bool $required; public bool $required;
public string $description; public string $description;
@ -86,4 +86,11 @@ class CheckboxField extends Field
{ {
return app(BooleanMatcher::class); return app(BooleanMatcher::class);
} }
public function filter($value): string
{
$asString = $value ? 'true' : 'false';
return "{$this->key} = $asString";
}
} }

View File

@ -2,6 +2,7 @@
namespace App\Form\Fields; namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\Matcher; use App\Form\Matchers\Matcher;
use App\Form\Matchers\SingleValueMatcher; use App\Form\Matchers\SingleValueMatcher;
use App\Form\Models\Form; use App\Form\Models\Form;
@ -9,7 +10,7 @@ use App\Form\Models\Participant;
use Faker\Generator; use Faker\Generator;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
class DropdownField extends Field class DropdownField extends Field implements Filterable
{ {
public bool $required; public bool $required;
/** @var array<int, string> */ /** @var array<int, string> */
@ -87,4 +88,14 @@ class DropdownField extends Field
{ {
return app(SingleValueMatcher::class); return app(SingleValueMatcher::class);
} }
/** @inheritdoc */
public function filter($value): string
{
if (is_null($value)) {
return "{$this->key} IS NULL";
}
return $this->key . ' = \'' . $value . '\'';
}
} }

View File

@ -11,6 +11,7 @@ use App\Form\Models\Form;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use App\Form\Presenters\DefaultPresenter; use App\Form\Presenters\DefaultPresenter;
use App\Form\Presenters\Presenter; use App\Form\Presenters\Presenter;
use App\Lib\Editor\Comparator;
use Faker\Generator; use Faker\Generator;
use Spatie\LaravelData\Data; use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\MapInputName;
@ -79,6 +80,9 @@ abstract class Field extends Data
->toArray(); ->toArray();
} }
/**
* @return class-string<Field>
*/
public static function classFromType(string $type): ?string public static function classFromType(string $type): ?string
{ {
/** @var class-string<Field> */ /** @var class-string<Field> */
@ -101,10 +105,7 @@ abstract class Field extends Data
]; ];
} }
/** public function presentRaw(): string
* @return mixed
*/
public function presentRaw()
{ {
return $this->getPresenter()->present($this->value); return $this->getPresenter()->present($this->value);
} }
@ -170,7 +171,7 @@ abstract class Field extends Data
return $this->key . '_display'; return $this->key . '_display';
} }
public function matches(string $comparator, mixed $value): bool public function matches(Comparator $comparator, mixed $value): bool
{ {
return $this->getMatcher()->setValue($this->value)->matches($comparator, $value); return $this->getMatcher()->setValue($this->value)->matches($comparator, $value);
} }
@ -179,4 +180,10 @@ abstract class Field extends Data
{ {
return app(SingleValueMatcher::class); return app(SingleValueMatcher::class);
} }
/** @param mixed $value */
public function filter($value): string
{
return '';
}
} }

View File

@ -42,12 +42,13 @@ class NamiField extends Field
public function getRegistrationRules(Form $form): array public function getRegistrationRules(Form $form): array
{ {
$rules = [$this->key => 'present|array']; $rules = [$this->key => 'present|array'];
$inputMembers = request($this->key);
foreach ($form->getFields()->forMembers()->noNamiField() as $field) { foreach ($form->getFields()->noNamiField()->forMembers() as $field) {
$r = $field->getRegistrationRules($form); foreach ($field->getRegistrationRules($form) as $ruleKey => $rule) {
foreach ($inputMembers as $memberIndex => $inputMember) {
foreach ($r as $ruleKey => $rule) { $rules[$this->key . '.' . $memberIndex . '.' . $ruleKey] = !$inputMember['id'] || $field->namiType === null ? $rule : '';
$rules[$this->key . '.*.' . $ruleKey] = $field->namiType === null ? $rule : ''; }
} }
} }
@ -69,12 +70,9 @@ class NamiField extends Field
return []; return [];
} }
$c = $form->getFields()->noNamiField()->forMembers(); foreach ($form->getFields()->noNamiField()->forMembers() as $field) {
foreach ($c as $field) {
foreach ($field->getRegistrationRules($form) as $ruleKey => $rule) { foreach ($field->getRegistrationRules($form) as $ruleKey => $rule) {
foreach ($inputMembers as $memberIndex => $inputMember) { foreach ($inputMembers as $memberIndex => $inputMember) {
$message = $field->name . ' für ein Mitglied'; $message = $field->name . ' für ein Mitglied';
$rules = array_merge( $rules = array_merge(
$rules, $rules,
@ -109,7 +107,7 @@ class NamiField extends Field
public function afterRegistration(Form $form, Participant $participant, array $input): void public function afterRegistration(Form $form, Participant $participant, array $input): void
{ {
foreach ($input[$this->key] as $memberData) { foreach ($input[$this->key] as $memberData) {
$member = Member::firstWhere(['mitgliedsnr' => $memberData['id']]); $member = $memberData['id'] ? Member::firstWhere(['mitgliedsnr' => $memberData['id']]) : null;
$data = []; $data = [];
foreach (FieldCollection::fromRequest($form, $memberData) as $field) { foreach (FieldCollection::fromRequest($form, $memberData) as $field) {
$data[$field->key] = $field->namiType === null || $member === null $data[$field->key] = $field->namiType === null || $member === null
@ -118,7 +116,7 @@ class NamiField extends Field
} }
$data[$this->key] = []; $data[$this->key] = [];
$form->participants()->create(['data' => $data, 'mitgliedsnr' => $memberData['id'], 'parent_id' => $participant->id]); $form->participants()->create(['data' => $data, 'member_id' => $member?->id, 'parent_id' => $participant->id]);
} }
} }

View File

@ -2,6 +2,7 @@
namespace App\Form\Fields; namespace App\Form\Fields;
use App\Form\Contracts\Filterable;
use App\Form\Matchers\Matcher; use App\Form\Matchers\Matcher;
use App\Form\Matchers\SingleValueMatcher; use App\Form\Matchers\SingleValueMatcher;
use App\Form\Models\Form; use App\Form\Models\Form;
@ -9,7 +10,7 @@ use App\Form\Models\Participant;
use Faker\Generator; use Faker\Generator;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
class RadioField extends Field class RadioField extends Field implements Filterable
{ {
public bool $required; public bool $required;
/** @var array<int, string> */ /** @var array<int, string> */
@ -87,4 +88,13 @@ class RadioField extends Field
{ {
return app(SingleValueMatcher::class); return app(SingleValueMatcher::class);
} }
public function filter($value): string
{
if (is_null($value)) {
return "{$this->key} IS NULL";
}
return $this->key . ' = \'' . $value . '\'';
}
} }

View File

@ -2,13 +2,12 @@
namespace App\Form; namespace App\Form;
use App\Form\Actions\SettingIndexAction;
use App\Form\Actions\SettingStoreAction; use App\Form\Actions\SettingStoreAction;
use App\Setting\Contracts\Indexable;
use App\Setting\Contracts\Storeable; use App\Setting\Contracts\Storeable;
use App\Setting\LocalSettings; use App\Setting\LocalSettings;
use Lorisleiva\Actions\ActionRequest;
class FormSettings extends LocalSettings implements Indexable, Storeable class FormSettings extends LocalSettings implements Storeable
{ {
public string $registerUrl; public string $registerUrl;
public string $clearCacheUrl; public string $clearCacheUrl;
@ -18,23 +17,38 @@ class FormSettings extends LocalSettings implements Indexable, Storeable
return 'form'; return 'form';
} }
public static function slug(): string
{
return 'form';
}
public static function title(): string public static function title(): string
{ {
return 'Formulare'; return 'Formulare';
} }
public static function indexAction(): string /**
* @inheritdoc
*/
public function rules(): array
{ {
return SettingIndexAction::class; return [
'registerUrl' => 'present|string',
'clearCacheUrl' => 'present|string',
];
} }
public static function storeAction(): string public function beforeSave(ActionRequest $request): void
{ {
return SettingStoreAction::class; }
/**
* @inheritdoc
*/
public function viewData(): array
{
return [
'data' => [
'data' => [
'registerUrl' => $this->registerUrl,
'clearCacheUrl' => $this->clearCacheUrl,
]
]
];
} }
} }

View File

@ -5,6 +5,7 @@ namespace App\Form\Mails;
use App\Form\Data\FormConfigData; use App\Form\Data\FormConfigData;
use App\Form\Editor\FormConditionResolver; use App\Form\Editor\FormConditionResolver;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use App\Lib\Editor\Condition;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Mail\Attachment; use Illuminate\Mail\Attachment;
use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailable;
@ -18,9 +19,9 @@ class ConfirmRegistrationMail extends Mailable
public string $fullname; public string $fullname;
public FormConfigData $config; public FormConfigData $config;
/** @var array<string, mixed> */ /** @var array<int, mixed> */
public array $topText; public array $topText;
/** @var array<string, mixed> */ /** @var array<int, mixed> */
public array $bottomText; public array $bottomText;
/** /**
@ -71,10 +72,7 @@ class ConfirmRegistrationMail extends Mailable
$conditionResolver = app(FormConditionResolver::class)->forParticipant($this->participant); $conditionResolver = app(FormConditionResolver::class)->forParticipant($this->participant);
return $this->participant->form->getMedia('mailattachments') return $this->participant->form->getMedia('mailattachments')
->filter(fn ($media) => $conditionResolver->filterCondition( ->filter(fn ($media) => $conditionResolver->filterCondition(Condition::fromMedia($media)))
data_get($media->getCustomProperty('conditions'), 'mode', 'all'),
data_get($media->getCustomProperty('conditions'), 'ifs', []),
))
->map(fn ($media) => Attachment::fromStorageDisk($media->disk, $media->getPathRelativeToRoot())) ->map(fn ($media) => Attachment::fromStorageDisk($media->disk, $media->getPathRelativeToRoot()))
->all(); ->all();
} }

View File

@ -2,6 +2,8 @@
namespace App\Form\Matchers; namespace App\Form\Matchers;
use App\Lib\Editor\Comparator;
abstract class Matcher abstract class Matcher
{ {
@ -14,5 +16,5 @@ abstract class Matcher
return $this; return $this;
} }
abstract public function matches(string $comparator, mixed $value): bool; abstract public function matches(Comparator $comparator, mixed $value): bool;
} }

View File

@ -2,24 +2,26 @@
namespace App\Form\Matchers; namespace App\Form\Matchers;
use App\Lib\Editor\Comparator;
class SingleValueMatcher extends Matcher class SingleValueMatcher extends Matcher
{ {
public function matches(string $comparator, mixed $value): bool public function matches(Comparator $comparator, mixed $value): bool
{ {
if ($comparator === 'isEqual' && $value === $this->value) { if ($comparator === Comparator::EQUAL && $value === $this->value) {
return true; return true;
} }
if ($comparator === 'isNotEqual' && $value !== $this->value) { if ($comparator === Comparator::NOTEQUAL && $value !== $this->value) {
return true; return true;
} }
if ($comparator === 'isIn' && in_array($this->value, $value)) { if ($comparator === Comparator::IN && in_array($this->value, $value)) {
return true; return true;
} }
if ($comparator === 'isNotIn' && !in_array($this->value, $value)) { if ($comparator === Comparator::NOTIN && !in_array($this->value, $value)) {
return true; return true;
} }

View File

@ -2,21 +2,29 @@
namespace App\Form\Models; namespace App\Form\Models;
use App\Form\Actions\UpdateParticipantSearchIndexAction;
use App\Form\Data\ExportData;
use App\Form\Data\FieldCollection; use App\Form\Data\FieldCollection;
use App\Form\Data\FormConfigData; use App\Form\Data\FormConfigData;
use App\Lib\Editor\Condition;
use App\Lib\Editor\EditorData;
use App\Lib\Sorting;
use Cviebrock\EloquentSluggable\Sluggable; use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\Form\Models\FormFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Laravel\Scout\Searchable; use Laravel\Scout\Searchable;
use Spatie\Image\Manipulations; use Spatie\Image\Enums\Fit;
use Spatie\MediaLibrary\HasMedia; use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia; use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media; use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Zoomyboy\MedialibraryHelper\DefersUploads; use Zoomyboy\MedialibraryHelper\DefersUploads;
/** @todo replace editor content with EditorData cast */
class Form extends Model implements HasMedia class Form extends Model implements HasMedia
{ {
/** @use HasFactory<FormFactory> */
use HasFactory; use HasFactory;
use Sluggable; use Sluggable;
use InteractsWithMedia; use InteractsWithMedia;
@ -28,16 +36,21 @@ class Form extends Model implements HasMedia
public $casts = [ public $casts = [
'config' => FormConfigData::class, 'config' => FormConfigData::class,
'meta' => 'json', 'meta' => 'json',
'description' => 'json', 'description' => EditorData::class,
'mail_top' => 'json', 'mail_top' => EditorData::class,
'mail_bottom' => 'json', 'mail_bottom' => EditorData::class,
'is_active' => 'boolean', 'is_active' => 'boolean',
'is_private' => 'boolean', 'is_private' => 'boolean',
'export' => ExportData::class,
'needs_prevention' => 'boolean',
'prevention_text' => EditorData::class,
'prevention_conditions' => Condition::class,
'from' => 'datetime',
'to' => 'datetime',
'registration_from' => 'datetime',
'registration_until' => 'datetime',
]; ];
/** @var array<int, string> */
public $dates = ['from', 'to', 'registration_from', 'registration_until'];
/** /**
* @return SluggableConfig * @return SluggableConfig
*/ */
@ -63,8 +76,9 @@ class Form extends Model implements HasMedia
->singleFile() ->singleFile()
->maxWidth(fn () => 500) ->maxWidth(fn () => 500)
->forceFileName(fn (Form $model, string $name) => $model->slug) ->forceFileName(fn (Form $model, string $name) => $model->slug)
->convert(fn () => 'jpg')
->registerMediaConversions(function (Media $media) { ->registerMediaConversions(function (Media $media) {
$this->addMediaConversion('square')->fit(Manipulations::FIT_CROP, 400, 400); $this->addMediaConversion('square')->fit(Fit::Crop, 400, 400);
}); });
$this->addMediaCollection('mailattachments') $this->addMediaCollection('mailattachments')
->withDefaultProperties(fn () => [ ->withDefaultProperties(fn () => [
@ -146,7 +160,7 @@ class Form extends Model implements HasMedia
if (is_null(data_get($model->meta, 'active_columns'))) { if (is_null(data_get($model->meta, 'active_columns'))) {
$model->setAttribute('meta', [ $model->setAttribute('meta', [
'active_columns' => $model->getFields()->count() ? $model->getFields()->take(4)->pluck('key')->toArray() : null, 'active_columns' => $model->getFields()->count() ? $model->getFields()->take(4)->pluck('key')->toArray() : null,
'sorting' => $model->getFields()->count() ? [$model->getFields()->first()->key, 'asc'] : null, 'sorting' => Sorting::by('id'),
]); ]);
return; return;
} }
@ -154,10 +168,37 @@ class Form extends Model implements HasMedia
if (is_array(data_get($model->meta, 'active_columns'))) { if (is_array(data_get($model->meta, 'active_columns'))) {
$model->setAttribute('meta', [ $model->setAttribute('meta', [
...$model->meta, ...$model->meta,
'active_columns' => array_values(array_intersect([...$model->getFields()->pluck('key')->toArray(), 'created_at'], $model->meta['active_columns'])), 'active_columns' => array_values(array_intersect([...$model->getFields()->pluck('key')->toArray(), 'created_at', 'prevention'], $model->meta['active_columns'])),
]); ]);
return; return;
} }
}); });
static::saved(function ($model) {
UpdateParticipantSearchIndexAction::dispatch($model);
});
}
public function participantsSearchableAs(): string
{
return config('scout.prefix') . 'forms_' . $this->id . '_participants';
}
public function defaultSorting(): Sorting
{
return Sorting::from($this->meta['sorting']);
}
public function canRegister(): bool
{
if ($this->registration_from && $this->registration_from->gt(now())) {
return false;
}
if ($this->registration_until && $this->registration_until->lt(now())) {
return false;
}
return true;
} }
} }

View File

@ -3,6 +3,8 @@
namespace App\Form\Models; namespace App\Form\Models;
use App\Form\Data\FormConfigData; use App\Form\Data\FormConfigData;
use App\Lib\Editor\EditorData;
use Database\Factories\Form\Models\FormtemplateFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -11,11 +13,14 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class Formtemplate extends Model class Formtemplate extends Model
{ {
/** @use HasFactory<FormtemplateFactory> */
use HasFactory; use HasFactory;
public $guarded = []; public $guarded = [];
public $casts = [ public $casts = [
'config' => FormConfigData::class, 'config' => FormConfigData::class,
'mail_top' => EditorData::class,
'mail_bottom' => EditorData::class,
]; ];
} }

View File

@ -6,21 +6,30 @@ use App\Form\Data\FieldCollection;
use App\Form\Data\FormConfigData; use App\Form\Data\FormConfigData;
use App\Form\Mails\ConfirmRegistrationMail; use App\Form\Mails\ConfirmRegistrationMail;
use App\Form\Scopes\ParticipantFilterScope; use App\Form\Scopes\ParticipantFilterScope;
use App\Member\Member;
use App\Prevention\Contracts\Preventable;
use Database\Factories\Form\Models\ParticipantFactory;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Laravel\Scout\Searchable;
use stdClass;
class Participant extends Model class Participant extends Model implements Preventable
{ {
/** @use HasFactory<ParticipantFactory> */
use HasFactory; use HasFactory;
use Searchable;
public $guarded = []; public $guarded = [];
public $casts = [ public $casts = [
'data' => 'json', 'data' => 'json',
'last_remembered_at' => 'datetime',
]; ];
/** /**
@ -40,12 +49,11 @@ class Participant extends Model
} }
/** /**
* @param Builder<self> $query * @return BelongsTo<Member, self>
* @return Builder<self>
*/ */
public function scopeWithFilter(Builder $query, ParticipantFilterScope $filter): Builder public function member(): BelongsTo
{ {
return $filter->apply($query); return $this->belongsTo(Member::class);
} }
public function getFields(): FieldCollection public function getFields(): FieldCollection
@ -70,6 +78,40 @@ class Participant extends Model
return; return;
} }
Mail::to($this->getFields()->getMailRecipient())->queue(new ConfirmRegistrationMail($this)); Mail::to($this->getMailRecipient())->queue(new ConfirmRegistrationMail($this));
}
public function preventableLayout(): string
{
return 'mail.prevention.prevention-remember-participant';
}
/**
* @inheritdoc
*/
public function preventions(): array
{
return $this->member?->preventions($this->form->from) ?: [];
}
public function getMailRecipient(): stdClass
{
return $this->getFields()->getMailRecipient();
}
public function preventableSubject(): string
{
return 'Nachweise erforderlich für deine Anmeldung zu ' . $this->form->name;
}
public function searchableAs(): string
{
return $this->form->participantsSearchableAs();
}
/** @return array<string, mixed> */
public function toSearchableArray(): array
{
return [...$this->data, 'parent-id' => $this->parent_id, 'created_at' => $this->created_at->timestamp];
} }
} }

View File

@ -35,6 +35,7 @@ class FormApiResource extends JsonResource
'image' => $this->getMedia('headerImage')->first()->getFullUrl('square'), 'image' => $this->getMedia('headerImage')->first()->getFullUrl('square'),
'is_active' => $this->is_active, 'is_active' => $this->is_active,
'is_private' => $this->is_private, 'is_private' => $this->is_private,
'can_register' => $this->getModel()->canRegister(),
]; ];
} }

View File

@ -2,6 +2,7 @@
namespace App\Form\Resources; namespace App\Form\Resources;
use App\Form\Data\ExportData;
use App\Form\Enums\NamiType; use App\Form\Enums\NamiType;
use App\Form\Enums\SpecialType; use App\Form\Enums\SpecialType;
use App\Form\Fields\Field; use App\Form\Fields\Field;
@ -10,6 +11,7 @@ use App\Form\Scopes\FormFilterScope;
use App\Form\Models\Form; use App\Form\Models\Form;
use App\Form\Models\Formtemplate; use App\Form\Models\Formtemplate;
use App\Group; use App\Group;
use App\Lib\Editor\EditorData;
use App\Lib\HasMeta; use App\Lib\HasMeta;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
@ -46,8 +48,14 @@ class FormResource extends JsonResource
'participants_count' => $this->participants_count, 'participants_count' => $this->participants_count,
'is_active' => $this->is_active, 'is_active' => $this->is_active,
'is_private' => $this->is_private, 'is_private' => $this->is_private,
'has_nami_field' => $this->getFields()->hasNamiField(),
'export' => $this->export,
'needs_prevention' => $this->needs_prevention,
'prevention_text' => $this->prevention_text,
'prevention_conditions' => $this->prevention_conditions,
'links' => [ 'links' => [
'participant_index' => route('form.participant.index', ['form' => $this->getModel()]), 'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
'update' => route('form.update', ['form' => $this->getModel()]), 'update' => route('form.update', ['form' => $this->getModel()]),
'destroy' => route('form.destroy', ['form' => $this->getModel()]), 'destroy' => route('form.destroy', ['form' => $this->getModel()]),
'is_dirty' => route('form.is-dirty', ['form' => $this->getModel()]), 'is_dirty' => route('form.is-dirty', ['form' => $this->getModel()]),
@ -89,7 +97,10 @@ class FormResource extends JsonResource
'config' => null, 'config' => null,
'header_image' => null, 'header_image' => null,
'mailattachments' => [], 'mailattachments' => [],
'prevention_text' => EditorData::default(),
'id' => null, 'id' => null,
'export' => ExportData::from([]),
'prevention_conditions' => ['mode' => 'all', 'ifs' => []],
], ],
'section_default' => [ 'section_default' => [
'name' => '', 'name' => '',

View File

@ -7,6 +7,7 @@ use App\Form\Enums\SpecialType;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use App\Form\Models\Formtemplate; use App\Form\Models\Formtemplate;
use App\Group; use App\Group;
use App\Lib\Editor\EditorData;
use App\Lib\HasMeta; use App\Lib\HasMeta;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
@ -52,6 +53,8 @@ class FormtemplateResource extends JsonResource
], ],
'default' => [ 'default' => [
'name' => '', 'name' => '',
'mail_top' => EditorData::default(),
'mail_bottom' => EditorData::default(),
'config' => [ 'config' => [
'sections' => [], 'sections' => [],
] ]

View File

@ -5,6 +5,7 @@ namespace App\Form\Resources;
use App\Form\Models\Form; use App\Form\Models\Form;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use App\Form\Scopes\ParticipantFilterScope; use App\Form\Scopes\ParticipantFilterScope;
use App\Prevention\Enums\Prevention;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@ -23,10 +24,18 @@ class ParticipantResource extends JsonResource
{ {
return [ return [
...$this->getModel()->getFields()->present(), ...$this->getModel()->getFields()->present(),
'id' => $this->id,
'created_at' => $this->created_at->format('Y-m-d H:i:s'), 'created_at' => $this->created_at->format('Y-m-d H:i:s'),
'created_at_display' => $this->created_at->format('d.m.Y'), 'created_at_display' => $this->created_at->format('d.m.Y'),
'children_count' => $this->children_count,
'member_id' => $this->member_id,
'prevention_items' => $this->member ? Prevention::items($this->member->preventions()) : [],
'links' => [ 'links' => [
'assign' => route('participant.assign', ['participant' => $this->getModel()]),
'destroy' => route('participant.destroy', ['participant' => $this->getModel()]), 'destroy' => route('participant.destroy', ['participant' => $this->getModel()]),
'children' => route('form.participant.index', ['form' => $this->form, 'parent' => $this->id]),
'fields' => route('participant.fields', ['participant' => $this->getModel()]),
'update' => route('participant.update', ['participant' => $this->getModel()]),
] ]
]; ];
} }
@ -53,17 +62,24 @@ class ParticipantResource extends JsonResource
return [ return [
'filter' => ParticipantFilterScope::fromRequest(request()->input('filter', ''))->setForm($form), 'filter' => ParticipantFilterScope::fromRequest(request()->input('filter', ''))->setForm($form),
'form_config' => $form->config,
'default_filter_value' => ParticipantFilterScope::$nan, 'default_filter_value' => ParticipantFilterScope::$nan,
'filters' => $filterData, 'filters' => $filterData,
'form_meta' => $form->meta, 'form_meta' => $form->meta,
'has_nami_field' => $form->getFields()->hasNamiField(),
'links' => [ 'links' => [
'update_form_meta' => route('form.update-meta', ['form' => $form]), 'update_form_meta' => route('form.update-meta', ['form' => $form]),
'store_participant' => route('form.participant.store', ['form' => $form]),
], ],
'columns' => $fieldData->push([ 'columns' => $fieldData->push([
'name' => 'Registriert am', 'name' => 'Registriert am',
'id' => 'created_at', 'id' => 'created_at',
'display_attribute' => 'created_at_display' 'display_attribute' => 'created_at_display'
]) ])->push([
'name' => 'Prävention',
'id' => 'prevention',
'display_attribute' => 'prevention_display'
]),
]; ];
} }
} }

View File

@ -4,33 +4,76 @@ namespace App\Form\Scopes;
use App\Form\Models\Form; use App\Form\Models\Form;
use App\Form\Models\Participant; use App\Form\Models\Participant;
use App\Lib\Filter; use App\Lib\ScoutFilter;
use Illuminate\Database\Eloquent\Builder; use App\Lib\Sorting;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Laravel\Scout\Builder;
use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName; use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Mappers\SnakeCaseMapper; use Spatie\LaravelData\Mappers\SnakeCaseMapper;
/** /**
* @extends Filter<Participant> * @extends ScoutFilter<Participant>
*/ */
#[MapInputName(SnakeCaseMapper::class)] #[MapInputName(SnakeCaseMapper::class)]
#[MapOutputName(SnakeCaseMapper::class)] #[MapOutputName(SnakeCaseMapper::class)]
class ParticipantFilterScope extends Filter class ParticipantFilterScope extends ScoutFilter
{ {
public static string $nan = 'deeb3ef4-d185-44b1-a4bc-0a4e7addebc3d8900c6f-a344-4afb-b54e-065ed483a7ba';
private Form $form;
/** /**
* @param array<string, mixed> $data * @param array<string, mixed> $data
* @param array<string, mixed> $options
*/ */
public function __construct( public function __construct(
public ?int $parent = null,
public array $data = [], public array $data = [],
public string $search = '',
public array $options = [],
public ?int $parent = null,
public ?Sorting $sort = null
) { ) {
} }
public static string $nan = 'deeb3ef4-d185-44b1-a4bc-0a4e7addebc3d8900c6f-a344-4afb-b54e-065ed483a7ba'; public function getQuery(): Builder
{
$this->search = $this->search ?: '';
return Participant::search($this->search, function ($engine, string $query, array $options) {
$filter = collect([]);
foreach ($this->form->getFields()->filterables() as $field) {
if ($this->data[$field->key] === static::$nan) {
continue;
}
$filter->push($field->filter($this->data[$field->key]));
}
if ($this->parent === -1) {
$filter->push('parent-id IS NULL');
}
if ($this->parent !== null && $this->parent !== -1) {
$filter->push('parent-id = ' . $this->parent);
}
$options['filter'] = $filter->map(fn ($expression) => "($expression)")->implode(' AND ');
$options['sort'] = $this->sort->toMeilisearch();
return $engine->search($query, [...$this->options, ...$options]);
})->within($this->form->participantsSearchableAs());
}
public function setForm(Form $form): self public function setForm(Form $form): self
{ {
$this->form = $form;
if (is_null($this->sort)) {
$this->sort = $this->form->defaultSorting();
}
foreach ($form->getFields() as $field) { foreach ($form->getFields() as $field) {
if (!Arr::has($this->data, $field->key)) { if (!Arr::has($this->data, $field->key)) {
data_set($this->data, $field->key, static::$nan); data_set($this->data, $field->key, static::$nan);
@ -40,26 +83,10 @@ class ParticipantFilterScope extends Filter
return $this; return $this;
} }
/** public function parent(?int $parent): self
* @inheritdoc
*/
public function apply(Builder $query): Builder
{ {
if ($this->parent === -1) { $this->parent = $parent;
$query = $query->whereNull('parent_id');
}
if (!is_null($this->parent) && $this->parent > 0) { return $this;
$query = $query->where('parent_id', $this->parent);
}
foreach ($this->data as $key => $value) {
if ($value === static::$nan) {
continue;
}
$query = $query->where('data->' . $key, $value);
}
return $query;
} }
} }

View File

@ -5,6 +5,7 @@ namespace App\Form\Transformers;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
use Spatie\LaravelData\Support\Transformation\TransformationContext;
use Spatie\LaravelData\Transformers\Transformer; use Spatie\LaravelData\Transformers\Transformer;
class CollectionTransformer implements Transformer class CollectionTransformer implements Transformer
@ -18,7 +19,7 @@ class CollectionTransformer implements Transformer
* @param Collection<int, Field> $value * @param Collection<int, Field> $value
* @return array<string, mixed> * @return array<string, mixed>
*/ */
public function transform(DataProperty $property, mixed $value): mixed public function transform(DataProperty $property, mixed $value, TransformationContext $context): mixed
{ {
return $value->toArray(); return $value->toArray();
} }

View File

@ -5,6 +5,7 @@ namespace App\Form\Transformers;
use App\Form\Fields\Field; use App\Form\Fields\Field;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\LaravelData\Support\DataProperty; use Spatie\LaravelData\Support\DataProperty;
use Spatie\LaravelData\Support\Transformation\TransformationContext;
use Spatie\LaravelData\Transformers\Transformer; use Spatie\LaravelData\Transformers\Transformer;
class FieldCollectionTransformer implements Transformer class FieldCollectionTransformer implements Transformer
@ -14,7 +15,7 @@ class FieldCollectionTransformer implements Transformer
* @param Collection<int, Field> $value * @param Collection<int, Field> $value
* @return array<string, mixed> * @return array<string, mixed>
*/ */
public function transform(DataProperty $property, mixed $value): mixed public function transform(DataProperty $property, mixed $value, TransformationContext $context): mixed
{ {
return $value->map(fn ($field) => [ return $value->map(fn ($field) => [
...$field->toArray(), ...$field->toArray(),

View File

@ -3,12 +3,15 @@
namespace App; namespace App;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\GenderFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Gender extends Model class Gender extends Model
{ {
use HasNamiField; use HasNamiField;
/** @use HasFactory<GenderFactory> */
use HasFactory; use HasFactory;
public $fillable = ['name', 'nami_id']; public $fillable = ['name', 'nami_id'];
@ -22,6 +25,15 @@ class Gender extends Model
}; };
} }
public function getShortAttribute(): string
{
return match ($this->name) {
'Männlich' => 'm',
'Weiblich' => 'w',
default => ''
};
}
public static function fromString(string $title): self public static function fromString(string $title): self
{ {
return self::firstWhere('name', $title); return self::firstWhere('name', $title);

View File

@ -2,8 +2,10 @@
namespace App; namespace App;
use App\Fileshare\Data\FileshareResourceData;
use App\Group\Enums\Level; use App\Group\Enums\Level;
use App\Nami\HasNamiField; use App\Nami\HasNamiField;
use Database\Factories\GroupFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -11,22 +13,24 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Group extends Model class Group extends Model
{ {
/** @use HasFactory<GroupFactory> */
use HasFactory; use HasFactory;
use HasNamiField; use HasNamiField;
public $fillable = ['nami_id', 'name', 'inner_name', 'level', 'parent_id']; public $fillable = ['nami_id', 'name', 'inner_name', 'level', 'parent_id', 'fileshare'];
public $timestamps = false; public $timestamps = false;
public $casts = [ public $casts = [
'level' => Level::class 'level' => Level::class,
'fileshare' => FileshareResourceData::class,
]; ];
/** /**
* @return BelongsTo<static, self> * @return BelongsTo<self, self>
*/ */
public function parent(): BelongsTo public function parent(): BelongsTo
{ {
return $this->belongsTo(static::class, 'parent_id'); return $this->belongsTo(self::class, 'parent_id');
} }
/** /**
@ -34,7 +38,7 @@ class Group extends Model
*/ */
public function children(): HasMany public function children(): HasMany
{ {
return $this->hasMany(static::class, 'parent_id'); return $this->hasMany(self::class, 'parent_id');
} }
public static function booted(): void public static function booted(): void

View File

@ -6,6 +6,7 @@ use App\Group;
use App\Group\Resources\GroupResource; use App\Group\Resources\GroupResource;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection; use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
class GroupApiIndexAction class GroupApiIndexAction
@ -20,8 +21,12 @@ class GroupApiIndexAction
return Group::get(); return Group::get();
} }
public function asController(?Group $group = null): AnonymousResourceCollection public function asController(ActionRequest $request, ?Group $group = null): AnonymousResourceCollection
{ {
return GroupResource::collection($group ? $group->children()->withCount('children')->get() : Group::where('parent_id', null)->withCount('children')->get()); return GroupResource::collection(
$request->has('all')
? Group::with('children')->get()
: ($group ? $group->children()->withCount('children')->get() : Group::where('parent_id', null)->withCount('children')->get())
);
} }
} }

View File

@ -22,6 +22,9 @@ class GroupBulkstoreAction
'*.id' => 'required|integer|exists:groups,id', '*.id' => 'required|integer|exists:groups,id',
'*.inner_name' => 'required|string|max:255', '*.inner_name' => 'required|string|max:255',
'*.level' => ['required', 'string', Rule::in(Level::values())], '*.level' => ['required', 'string', Rule::in(Level::values())],
'*.fileshare' => 'present|nullable',
'*.fileshare.connection_id' => 'nullable|numeric|exists:fileshares,id',
'*.fileshare.resource' => 'nullable|string',
]; ];
} }
@ -31,7 +34,7 @@ class GroupBulkstoreAction
public function handle(array $groups): void public function handle(array $groups): void
{ {
foreach ($groups as $payload) { foreach ($groups as $payload) {
Group::find($payload['id'])->update(['level' => $payload['level'], 'inner_name' => $payload['inner_name']]); Group::find($payload['id'])->update(['level' => $payload['level'], 'inner_name' => $payload['inner_name'], 'fileshare' => $payload['fileshare']]);
} }
} }

View File

@ -30,6 +30,7 @@ class GroupResource extends JsonResource
'id' => $this->id, 'id' => $this->id,
'level' => $this->level?->value, 'level' => $this->level?->value,
'children_count' => $this->children_count, 'children_count' => $this->children_count,
'fileshare' => $this->fileshare,
'links' => [ 'links' => [
'children' => route('api.group', ['group' => $this->id]), 'children' => route('api.group', ['group' => $this->id]),
] ]

View File

@ -21,7 +21,9 @@ class UserResource extends JsonResource
public function toArray($request): array public function toArray($request): array
{ {
return [ return [
'name' => $this->name, 'firstname' => $this->firstname,
'lastname' => $this->lastname,
'avatar_url' => $this->getGravatarUrl(),
'email' => $this->email, 'email' => $this->email,
'avatar' => [ 'avatar' => [
'src' => Storage::url('avatar.png'), 'src' => Storage::url('avatar.png'),

View File

@ -6,9 +6,9 @@ use Lorisleiva\Actions\Concerns\AsAction;
use App\Invoice\Models\Invoice; use App\Invoice\Models\Invoice;
use App\Invoice\Resources\InvoiceResource; use App\Invoice\Resources\InvoiceResource;
use App\Invoice\Scopes\InvoiceFilterScope; use App\Invoice\Scopes\InvoiceFilterScope;
use Illuminate\Pagination\LengthAwarePaginator;
use Inertia\Inertia; use Inertia\Inertia;
use Inertia\Response; use Inertia\Response;
use Laravel\Scout\Builder;
use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\ActionRequest;
class InvoiceIndexAction class InvoiceIndexAction
@ -17,11 +17,11 @@ class InvoiceIndexAction
/** /**
* @return LengthAwarePaginator<Invoice> * @return Builder<Invoice>
*/ */
public function handle(InvoiceFilterScope $filter): LengthAwarePaginator public function handle(InvoiceFilterScope $filter): Builder
{ {
return Invoice::withFilter($filter)->with('positions')->paginate(15); return $filter->getQuery()->query(fn ($q) => $q->with('positions'));
} }
public function asController(ActionRequest $request): Response public function asController(ActionRequest $request): Response
@ -32,7 +32,7 @@ class InvoiceIndexAction
$filter = InvoiceFilterScope::fromRequest($request->input('filter', '')); $filter = InvoiceFilterScope::fromRequest($request->input('filter', ''));
return Inertia::render('invoice/Index', [ return Inertia::render('invoice/Index', [
'data' => InvoiceResource::collection($this->handle($filter)), 'data' => InvoiceResource::collection($this->handle($filter)->paginate(15)),
]); ]);
} }
} }

View File

@ -4,7 +4,6 @@ namespace App\Invoice\Actions;
use App\Invoice\BillDocument; use App\Invoice\BillDocument;
use App\Invoice\BillKind; use App\Invoice\BillKind;
use App\Invoice\Enums\InvoiceStatus;
use App\Invoice\Mails\BillMail; use App\Invoice\Mails\BillMail;
use App\Invoice\Mails\RememberMail; use App\Invoice\Mails\RememberMail;
use App\Invoice\Models\Invoice; use App\Invoice\Models\Invoice;

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