Compare commits
571 Commits
Author | SHA1 | Date |
---|---|---|
philipp lang | a456cc1889 | |
philipp lang | 784b49c3dd | |
philipp lang | c3a0381a0a | |
philipp lang | 101ac7402a | |
philipp lang | 2c38488962 | |
philipp lang | 8a26276e28 | |
philipp lang | 4651a4cb96 | |
philipp lang | 688e10e230 | |
philipp lang | 267da38c6b | |
philipp lang | 499c61afff | |
philipp lang | 02531938b3 | |
philipp lang | 1c53e81f1a | |
philipp lang | 98712093b2 | |
philipp lang | a32ef33113 | |
philipp lang | 088ea4f0a2 | |
philipp lang | 4ac89da124 | |
philipp lang | 286ceea0d4 | |
philipp lang | 52ac5937a4 | |
philipp lang | 4690e86bbf | |
philipp lang | 1a4a7c3652 | |
philipp lang | b05c5025c0 | |
philipp lang | acf7b94094 | |
philipp lang | 57b1efb065 | |
philipp lang | 3e563f8390 | |
philipp lang | 0a5590d533 | |
philipp lang | 10deaf15a1 | |
philipp lang | ae447a7a60 | |
philipp lang | baea21807a | |
philipp lang | 58426c5537 | |
philipp lang | 84cd13c085 | |
philipp lang | b8d2b37057 | |
philipp lang | 44eb3719b9 | |
philipp lang | c65a208e34 | |
philipp lang | 95a8d4d689 | |
philipp lang | e1e8669beb | |
philipp lang | a3ecfa756d | |
philipp lang | 70e085a49e | |
philipp lang | 1178b011e0 | |
philipp lang | 6a91e857d2 | |
philipp lang | 82baf67a73 | |
philipp lang | 36466420f6 | |
philipp lang | 54c37fccd1 | |
philipp lang | d03f036a2b | |
philipp lang | 75d11f9860 | |
philipp lang | da4d553ea6 | |
philipp lang | 5bad88c5f4 | |
philipp lang | 75dc0d9769 | |
philipp lang | 9fc8548504 | |
philipp lang | c990ce3171 | |
philipp lang | e7f63d19e5 | |
philipp lang | f549b31862 | |
philipp lang | 1f4efb22d3 | |
philipp lang | 3e725d9842 | |
philipp lang | 16d3bc51a3 | |
philipp lang | 0467f24ff6 | |
philipp lang | ed1a8f30bc | |
philipp lang | e5066af192 | |
philipp lang | 31afa2e418 | |
philipp lang | a897690e7a | |
philipp lang | 24ed5d4ab9 | |
philipp lang | e807aff3e6 | |
philipp lang | 096224fe98 | |
philipp lang | 646ce647da | |
philipp lang | f858716e57 | |
philipp lang | 1521aba1f8 | |
philipp lang | 664b88564d | |
philipp lang | d30a2336cf | |
philipp lang | a5f1c90003 | |
philipp lang | c3908b714b | |
philipp lang | 2f1e02151f | |
philipp lang | eaf014b7c7 | |
philipp lang | 94d34d1afa | |
philipp lang | 9b700be889 | |
philipp lang | e1ec6ad9df | |
philipp lang | aaa236fcd5 | |
philipp lang | 4d74e53fc2 | |
philipp lang | b8d389bdb9 | |
philipp lang | 3a4c99f154 | |
philipp lang | fca7fc463e | |
philipp lang | 767df11e4f | |
philipp lang | 295d85f4f8 | |
philipp lang | 42ccd32740 | |
philipp lang | bbcf2fd768 | |
philipp lang | b335c20777 | |
philipp lang | c63c8316b5 | |
philipp lang | 2e6c27b8f1 | |
philipp lang | 1cf8d34b78 | |
philipp lang | e3b52bf901 | |
philipp lang | 76e7b06630 | |
philipp lang | 21def11ae9 | |
philipp lang | 565b1ffbce | |
philipp lang | ef70203c8a | |
philipp lang | b3a29c706c | |
philipp lang | 298140e387 | |
philipp lang | 151477dbdd | |
philipp lang | a01e8adf8a | |
philipp lang | 547c9edfd5 | |
philipp lang | 6e09e2ec0d | |
philipp lang | 9d37ebefc5 | |
philipp lang | 11b1e6a198 | |
philipp lang | 5008244de2 | |
philipp lang | 8b3b3de9a8 | |
philipp lang | d9adb526ce | |
philipp lang | daf6e87814 | |
philipp lang | 2056e1ad6b | |
philipp lang | a4eba23bff | |
philipp lang | ad8cd58b4f | |
philipp lang | 3a4908f505 | |
philipp lang | 291eec3849 | |
philipp lang | 0e0f23c17e | |
philipp lang | 6d204b948e | |
philipp lang | 977e427abb | |
philipp lang | 46e070a029 | |
philipp lang | 84e05fbc52 | |
philipp lang | 343b0d418d | |
philipp lang | fe258198f4 | |
philipp lang | 8317fdca90 | |
philipp lang | 32ec479975 | |
philipp lang | ac45e0c8fa | |
philipp lang | 6f1ab73bae | |
philipp lang | c95658ae65 | |
philipp lang | d64ea85be6 | |
philipp lang | 22157b5d50 | |
philipp lang | 107b616bc1 | |
philipp lang | d7cc80afe9 | |
philipp lang | db6248999a | |
philipp lang | 9c568176ce | |
philipp lang | d56cb253a9 | |
philipp lang | 5fcee5f284 | |
philipp lang | b01ff9a677 | |
philipp lang | 0d76b3cc5f | |
philipp lang | 0972ad65a7 | |
philipp lang | 259465189f | |
philipp lang | 306fef3e07 | |
philipp lang | ca0dd11336 | |
philipp lang | 89a8feb278 | |
philipp lang | 8f7edadb99 | |
philipp lang | eee0c64106 | |
philipp lang | e50269d031 | |
philipp lang | dc40728fca | |
philipp lang | dfa17ed3db | |
philipp lang | 77c57794e1 | |
philipp lang | 1347347324 | |
philipp lang | cd9cc607f4 | |
philipp lang | 6f1efb7470 | |
philipp lang | 5fd050e116 | |
philipp lang | 3a53777dbd | |
philipp lang | 1ad2e6a978 | |
philipp lang | ac76d23941 | |
philipp lang | b67fa85539 | |
philipp lang | 5641006e2b | |
philipp lang | 607038af6b | |
philipp lang | 189b83f2a5 | |
philipp lang | 3f4c655e5e | |
philipp lang | 158cd2d352 | |
philipp lang | bf1388dbd9 | |
philipp lang | aa20329a62 | |
philipp lang | 09de9a5510 | |
philipp lang | 2982ae035f | |
philipp lang | 46740b14a2 | |
philipp lang | 885eaa5df5 | |
philipp lang | 757042bdd2 | |
philipp lang | c3f6d3827b | |
philipp lang | 1ef7995ec2 | |
philipp lang | c8676aef6d | |
philipp lang | cf93b8eff0 | |
philipp lang | e2a2d746a3 | |
philipp lang | aabba32f89 | |
philipp lang | 11b97a634b | |
philipp lang | 26cb7fd9f1 | |
philipp lang | 2b48f42734 | |
philipp lang | 74867cb09f | |
philipp lang | d4057ff08f | |
philipp lang | 657a648f46 | |
philipp lang | d9c45f5236 | |
philipp lang | 5d48521875 | |
philipp lang | 98976700a9 | |
philipp lang | 790332b25c | |
philipp lang | 56c28ae00e | |
philipp lang | a603aca80c | |
philipp lang | c05434a7fb | |
philipp lang | 248499dc60 | |
philipp lang | ad7fe80236 | |
philipp lang | dbde189575 | |
philipp lang | 146cbb0bef | |
philipp lang | e6477fff2b | |
philipp lang | 3c725c0efc | |
philipp lang | f632a8bb8f | |
philipp lang | 2f03dccebb | |
philipp lang | 235f439d51 | |
philipp lang | cf77797512 | |
philipp lang | d44ad4bc53 | |
philipp lang | 94597e57c1 | |
philipp lang | a9ecdfe4bb | |
philipp lang | 10a966c6ad | |
philipp lang | 3b63a73161 | |
philipp lang | 4e453a73a6 | |
philipp lang | 96cf0b7dd5 | |
philipp lang | b2e85211a7 | |
philipp lang | 3dacfb3e54 | |
philipp lang | c9ccebc8f3 | |
philipp lang | b6aaf6b2e1 | |
philipp lang | 793e4bacbd | |
philipp lang | 6c44a25638 | |
philipp lang | 8609f1e9c6 | |
philipp lang | 0d07975e53 | |
philipp lang | f7d9328447 | |
philipp lang | d26bdd72fb | |
philipp lang | ff40b9e805 | |
philipp lang | 92997aa78f | |
philipp lang | ee02b8df3a | |
philipp lang | 8ec4e4eb59 | |
philipp lang | fc70107aa3 | |
philipp lang | 5661d66770 | |
philipp lang | 0a8ecedb0f | |
philipp lang | fd9aff25fe | |
philipp lang | c65a25ed2a | |
philipp lang | ced2d577c0 | |
philipp lang | aafef695aa | |
philipp lang | 44a39fc5a8 | |
philipp lang | 46a353d674 | |
philipp lang | fed0e95f14 | |
philipp lang | d1dfcb3a04 | |
philipp lang | 7f9be4262c | |
philipp lang | 99a28f44dd | |
philipp lang | 9c93b13032 | |
philipp lang | 231ed3b4ad | |
philipp lang | ccfeb85e4b | |
philipp lang | 445a8ae962 | |
philipp lang | 0741984858 | |
philipp lang | 69a3ed2a60 | |
philipp lang | bbdc9e9dfb | |
philipp lang | 7e39a4da84 | |
philipp lang | ae450ef9ae | |
philipp lang | 2425ff6638 | |
philipp lang | 2586669c96 | |
philipp lang | af124f897b | |
philipp lang | c78c1cfee7 | |
philipp lang | bbd3237330 | |
philipp lang | fcc01d26ac | |
philipp lang | 93d30d10eb | |
philipp lang | c7fc76466e | |
philipp lang | 6aaeb75b2a | |
philipp lang | 8c3dc2211b | |
philipp lang | d06ae7acb5 | |
philipp lang | 63c62dc958 | |
philipp lang | 71903936a3 | |
philipp lang | 0ad6b40393 | |
philipp lang | f04cf7a1b2 | |
philipp lang | 94cc0147bc | |
philipp lang | 73633d7628 | |
philipp lang | 5482d47f0c | |
philipp lang | e1c3240290 | |
philipp lang | e9e0be83cc | |
philipp lang | 32e7f8c41d | |
philipp lang | 4cfa70e534 | |
philipp lang | 45597558e3 | |
philipp lang | c99a5a0369 | |
philipp lang | 258093f2c4 | |
philipp lang | f16b58dbc6 | |
philipp lang | 8609a648fd | |
philipp lang | b15b806948 | |
philipp lang | 19b13133a6 | |
philipp lang | d22e4b597f | |
philipp lang | f100135f33 | |
philipp lang | efc9a397f3 | |
philipp lang | ab06c7de5d | |
philipp lang | a9dea10a17 | |
philipp lang | dd4468808b | |
philipp lang | 1ef8cfdec8 | |
philipp lang | b6c9eea8ea | |
philipp lang | 12eb5016c8 | |
philipp lang | 75d9301033 | |
philipp lang | 8c820ab24d | |
philipp lang | d26463d43c | |
philipp lang | 4fda17d2c6 | |
philipp lang | 094a84c745 | |
philipp lang | 1630bce795 | |
philipp lang | cce9d4fa3e | |
philipp lang | 323f136e40 | |
philipp lang | 820b317b57 | |
philipp lang | 43c528fc46 | |
philipp lang | e9e8b193f4 | |
philipp lang | 646b292249 | |
philipp lang | 0526b52b6b | |
philipp lang | 1a5675634f | |
philipp lang | 73089ae654 | |
philipp lang | e4f195ee3e | |
philipp lang | 87377dab06 | |
philipp lang | 668cf9d292 | |
philipp lang | 03c19aa5fb | |
philipp lang | 40407214e3 | |
philipp lang | 49afcafbb2 | |
philipp lang | 8f6b8e466a | |
philipp lang | af6dd35a5b | |
philipp lang | 402e0fe5ee | |
philipp lang | 9252686e78 | |
philipp lang | c9885a8c9c | |
philipp lang | a71af994bb | |
philipp lang | f03459de58 | |
philipp lang | 3f3ecf0071 | |
philipp lang | fa2d93174a | |
philipp lang | cb3cc087d6 | |
philipp lang | 86aaf55d21 | |
philipp lang | 700d69d1a2 | |
philipp lang | 452505632e | |
philipp lang | 6ae61655de | |
philipp lang | df202d9a9a | |
philipp lang | da02a76e21 | |
philipp lang | edfd5dcbe7 | |
philipp lang | ccea9ab094 | |
philipp lang | 348fca4dd0 | |
philipp lang | 1ee2e72347 | |
philipp lang | 393d1f391c | |
philipp lang | 7e152c017a | |
philipp lang | 2b976ac03e | |
philipp lang | 68a47e3fb9 | |
philipp lang | 917a3932e1 | |
philipp lang | 5bd52e7b51 | |
philipp lang | db640c8185 | |
philipp lang | 0fb259a373 | |
philipp lang | e299e8b159 | |
philipp lang | 35a8c59055 | |
philipp lang | 0c49166392 | |
philipp lang | c4aa9b1051 | |
philipp lang | e5008d127d | |
philipp lang | a9eafb44be | |
philipp lang | e10742d298 | |
philipp lang | c0daff972b | |
philipp lang | 30d670a575 | |
philipp lang | b1581bf9c8 | |
philipp lang | b3354e1474 | |
philipp lang | ce6cc215bd | |
philipp lang | c4cec65249 | |
philipp lang | 36a9b21028 | |
philipp lang | 1c4b0b5e46 | |
philipp lang | 8f285b4aa6 | |
philipp lang | 9954ba1ee4 | |
philipp lang | 35c817d1c2 | |
philipp lang | 60c80deefe | |
philipp lang | 868dc5cf02 | |
philipp lang | 38ac195924 | |
philipp lang | 36b195b78a | |
philipp lang | 8e3054da49 | |
philipp lang | f05a919b9c | |
philipp lang | e0bd7c5add | |
philipp lang | 47cbc3321c | |
philipp lang | 2984ad9372 | |
philipp lang | 0ba8c58c76 | |
philipp lang | 0437511bf1 | |
philipp lang | 1328f359b2 | |
philipp lang | 4997895dfb | |
philipp lang | 4f1c02acac | |
philipp lang | ae39c8dd31 | |
philipp lang | dbffb4b394 | |
philipp lang | 1929c8c216 | |
philipp lang | 21dfc4f0b2 | |
philipp lang | 5e2427ee81 | |
philipp lang | 37c8f35b58 | |
philipp lang | 5310686b9c | |
philipp lang | 2363be7d61 | |
philipp lang | 2abe061c4f | |
philipp lang | fde1a9d169 | |
philipp lang | 1f4173caf8 | |
philipp lang | 6ad639730a | |
philipp lang | 096e44b767 | |
philipp lang | e08ad63313 | |
philipp lang | 594c45aede | |
philipp lang | aa81843df1 | |
philipp lang | adf0ae183e | |
philipp lang | 4095d218bd | |
philipp lang | 4b2ac19b78 | |
philipp lang | bf6e0fac85 | |
philipp lang | 85560ebec2 | |
philipp lang | daca017d96 | |
philipp lang | fd1e0bb9e1 | |
philipp lang | 913e45eb75 | |
philipp lang | 46ff7a0ca8 | |
philipp lang | f70c0db783 | |
philipp lang | df4f911d8e | |
philipp lang | 2691894b78 | |
philipp lang | edffe0ef80 | |
philipp lang | 58bb5ec87f | |
philipp lang | e480eb330e | |
philipp lang | c62f8ec676 | |
philipp lang | 55d253aa7b | |
philipp lang | f84decbb52 | |
philipp lang | 8117cfb4f4 | |
philipp lang | a6a8983ae9 | |
philipp lang | 8b42a62b2d | |
philipp lang | e6261d42ff | |
philipp lang | 56e0223492 | |
philipp lang | 5e49e5bd59 | |
philipp lang | 93d4511ee8 | |
philipp lang | 63583b9b25 | |
philipp lang | 1509efd881 | |
philipp lang | ab7e20becd | |
philipp lang | 0e2ebd9593 | |
philipp lang | 58feb20545 | |
philipp lang | a1b0f6496c | |
philipp lang | 45b559ea17 | |
philipp lang | 34ab000e37 | |
philipp lang | bd6ccf030b | |
philipp lang | 2ba31a0678 | |
philipp lang | edc7aaccd6 | |
philipp lang | 5d1571012d | |
philipp lang | 43821ec416 | |
philipp lang | c3f58cebc6 | |
philipp lang | f05c85a035 | |
philipp lang | 0e69e7c7f1 | |
philipp lang | f3f092bdf5 | |
philipp lang | 44ea68cce7 | |
philipp lang | c0096c0794 | |
philipp lang | 05bcb376c8 | |
philipp lang | 913cabc7a3 | |
philipp lang | 7cc1f349a1 | |
philipp lang | 8d2f8ec03d | |
philipp lang | 9144ae1028 | |
philipp lang | c3a2417cac | |
philipp lang | 91943a6321 | |
philipp lang | 6f03063cba | |
philipp lang | 5d576cda6a | |
philipp lang | 2a979d932e | |
philipp lang | 80def4abde | |
philipp lang | 64c2cb9408 | |
philipp lang | 78d6c6d864 | |
philipp lang | a0842afd47 | |
philipp lang | 43846d1703 | |
philipp lang | 171dd51200 | |
philipp lang | c844f2143a | |
philipp lang | 6ac539417f | |
philipp lang | 56ad09c6fa | |
philipp lang | 2f2e95cd23 | |
philipp lang | 3d270ce9a4 | |
philipp lang | eaa880127d | |
philipp lang | 6f334765bf | |
philipp lang | b806cafc8b | |
philipp lang | ada03a11ea | |
philipp lang | a12cb53274 | |
philipp lang | 458c643615 | |
philipp lang | 60b0052622 | |
philipp lang | 0bc00207b2 | |
philipp lang | 8cd2f74477 | |
philipp lang | 9d11294fde | |
philipp lang | acec968963 | |
philipp lang | 3cbb4768e8 | |
philipp lang | 09e3bcab9e | |
philipp lang | 66a76ad2b1 | |
philipp lang | 5919082211 | |
philipp lang | 2a5c203cc0 | |
philipp lang | 5f48b4e64d | |
philipp lang | 5f47729bb6 | |
philipp lang | c9cbf86626 | |
philipp lang | 8713f941c1 | |
philipp lang | 26ce8637c1 | |
philipp lang | ebf7a1d5c9 | |
philipp lang | b86b2b6063 | |
philipp lang | 94397165c6 | |
philipp lang | 9d7d039530 | |
philipp lang | 34fb96dabe | |
philipp lang | f601167893 | |
philipp lang | 54b650fb91 | |
philipp lang | f24064b9f3 | |
philipp lang | a96d879023 | |
philipp lang | b194e77966 | |
philipp lang | a830f366ad | |
philipp lang | 974c73af71 | |
philipp lang | 445590e060 | |
philipp lang | ef47480cc9 | |
philipp lang | 35b269c647 | |
philipp lang | e508dd9e6f | |
philipp lang | 891f0c21ad | |
philipp lang | a0bcd99642 | |
philipp lang | 857051434e | |
philipp lang | c7b23df01e | |
philipp lang | 7361dcccff | |
philipp lang | 590696750b | |
philipp lang | 48383b25da | |
philipp lang | de76e195e7 | |
philipp lang | ff6c2bbc2c | |
philipp lang | 5d9d7a0ffc | |
philipp lang | 89429f9812 | |
philipp lang | b813664632 | |
philipp lang | a7394e12aa | |
philipp lang | ddb44d64d6 | |
philipp lang | 3d62970baf | |
philipp lang | 9a3a0402d9 | |
philipp lang | 665b43c797 | |
philipp lang | ee926467ed | |
philipp lang | 4ffc14d503 | |
philipp lang | 1edbdab8fd | |
philipp lang | 6e6a4595cd | |
philipp lang | e3a0ca7673 | |
philipp lang | 28c821eeaf | |
philipp lang | e45a59c5ff | |
philipp lang | d3c1e89a03 | |
Philipp Lang | 6ede944d85 | |
Philipp Lang | b69c895921 | |
Philipp Lang | 539e41cffe | |
philipp lang | bdf3fa54a9 | |
philipp lang | 97fabf0f24 | |
philipp lang | e011b52534 | |
philipp lang | e005ed0d0d | |
philipp lang | ae19a6ed2b | |
philipp lang | 4ce7d428d4 | |
philipp lang | e6d0a30c7f | |
philipp lang | d16f02c8b3 | |
philipp lang | 888f4ee976 | |
philipp lang | 2a6e3aac03 | |
philipp lang | 7abf746897 | |
philipp lang | ed8e7b045d | |
philipp lang | 2a2cbd196d | |
philipp lang | 4690e0037f | |
philipp lang | 1d28827353 | |
philipp lang | 703084dbc1 | |
philipp lang | 7aa445ca74 | |
philipp lang | a2d7a36fc1 | |
philipp lang | 23c60d4330 | |
philipp lang | 79f1c71dd9 | |
philipp lang | 452416d0a4 | |
philipp lang | 589b713907 | |
philipp lang | eb60852bbf | |
philipp lang | c3db854eb5 | |
philipp lang | 5cf49489d5 | |
philipp lang | 7d880c6e29 | |
philipp lang | 743c041c35 | |
philipp lang | d3ad48ed30 | |
philipp lang | 4776c0d71b | |
philipp lang | 9355daee7e | |
philipp lang | 89b5cbd4b5 | |
philipp lang | c8bc69ae30 | |
philipp lang | 0fde33803b | |
philipp lang | 1b5c83a414 | |
philipp lang | e0558e4b13 | |
philipp lang | b421f85d89 | |
philipp lang | 0eb8928b22 | |
philipp lang | f1d4d3e428 | |
philipp lang | 5b2a290b49 | |
philipp lang | f55c174019 | |
philipp lang | d597d5ea2b | |
Philipp Lang | d4c8fdff3f | |
philipp lang | b26935fc07 | |
philipp lang | 4ddf76943d | |
philipp lang | d7e7fb3c27 | |
philipp lang | 87ee15936d | |
Philipp Lang | 6262ccdd28 | |
Philipp Lang | b109d40ebb | |
Philipp Lang | 3c81dfe7db | |
philipp lang | cc52437568 | |
philipp lang | ac28466c8d | |
philipp lang | bde8d48807 | |
philipp lang | 288533efd3 | |
philipp lang | 104b04b639 | |
philipp lang | 8bf0019c98 | |
philipp lang | 9f85809195 | |
philipp lang | 131690262e | |
philipp lang | edb1eeb0d8 | |
philipp lang | 2ecd4b9643 | |
Philipp Lang | ae679641d7 | |
philipp lang | d692cf3bdf | |
philipp lang | 339e76d874 | |
Arwed Molitor | 2d02c79c86 | |
Arwed Molitor | e21e818ac6 | |
Arwed Molitor | fecd461aef | |
philipp lang | 58d7c5671f | |
philipp lang | 54cf187ff5 | |
philipp lang | 0575fe4e5c | |
philipp lang | 3567dc3620 | |
philipp lang | 4fcdf91414 | |
philipp lang | 94f8ea3b67 | |
philipp lang | 32cc9feee0 |
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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: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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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'
|
||||||
|
|
66
.drone.yml
66
.drone.yml
|
@ -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:17.9.0-slim
|
image: mysql:oracle
|
||||||
commands:
|
commands:
|
||||||
- npm ci && 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:
|
||||||
|
|
|
@ -8,13 +8,15 @@ yarn-error.log
|
||||||
/public/build
|
/public/build
|
||||||
/public/vendor
|
/public/vendor
|
||||||
storage/*.key
|
storage/*.key
|
||||||
vendor/
|
/storage/media-library/*
|
||||||
|
/vendor/
|
||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
Homestead.json
|
Homestead.json
|
||||||
.vagrant/
|
.vagrant/
|
||||||
.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/
|
||||||
|
@ -37,3 +39,5 @@ Homestead.json
|
||||||
/resources/img/sprite.svg
|
/resources/img/sprite.svg
|
||||||
/public/sprite.svg
|
/public/sprite.svg
|
||||||
/.php-cs-fixer.cache
|
/.php-cs-fixer.cache
|
||||||
|
/groups.sql
|
||||||
|
/.phpunit.cache
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
[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
|
||||||
[submodule "packages/tex"]
|
[submodule "packages/tex"]
|
||||||
path = packages/tex
|
path = packages/tex
|
||||||
url = https://git.zoomyboy.de/pille/tex
|
url = https://git.zoomyboy.de/pille/tex
|
||||||
|
[submodule "packages/adrema-form"]
|
||||||
|
path = packages/adrema-form
|
||||||
|
url = https://git.zoomyboy.de/silva/adrema-form.git
|
||||||
|
[submodule "packages/medialibrary-helper"]
|
||||||
|
path = packages/medialibrary-helper
|
||||||
|
url = https://git.zoomyboy.de/zoomyboy/medialibrary-helper.git
|
||||||
|
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
|
||||||
|
|
|
@ -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.
|
|
@ -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
|
||||||
|
|
|
@ -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()]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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'];
|
||||||
|
|
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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']),
|
||||||
|
@ -72,13 +72,23 @@ class MemberData extends Data
|
||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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\HasPdfBackground;
|
||||||
use App\Country;
|
use App\Country;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
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
|
||||||
*/
|
*/
|
||||||
|
@ -20,9 +22,11 @@ class BdkjHesse extends ContributionDocument
|
||||||
public string $zipLocation,
|
public string $zipLocation,
|
||||||
public ?Country $country,
|
public ?Country $country,
|
||||||
public Collection $members,
|
public Collection $members,
|
||||||
|
public string $eventName,
|
||||||
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
|
||||||
|
@ -46,6 +50,7 @@ class BdkjHesse 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(20),
|
members: MemberData::fromModels($request['members'])->chunk(20),
|
||||||
|
eventName: $request['eventName'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +65,7 @@ class BdkjHesse 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(20),
|
members: MemberData::fromApi($request['member_data'])->chunk(20),
|
||||||
|
eventName: $request['eventName'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,36 +116,9 @@ class BdkjHesse extends ContributionDocument
|
||||||
return $member->birthYear();
|
return $member->birthYear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function basename(): string
|
|
||||||
{
|
|
||||||
return 'zuschuesse-bdkj-hessen';
|
|
||||||
}
|
|
||||||
|
|
||||||
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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,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',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,19 @@
|
||||||
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 App\Invoice\InvoiceSettings;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Zoomyboy\Tex\Engine;
|
|
||||||
use Zoomyboy\Tex\Template;
|
|
||||||
|
|
||||||
class CityFrankfurtMainDocument extends ContributionDocument
|
class CityFrankfurtMainDocument extends ContributionDocument
|
||||||
{
|
{
|
||||||
|
use HasPdfBackground;
|
||||||
|
use FormatsDates;
|
||||||
|
|
||||||
|
public string $fromName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection<int, Collection<int, MemberData>> $members
|
* @param Collection<int, Collection<int, MemberData>> $members
|
||||||
*/
|
*/
|
||||||
|
@ -20,9 +25,12 @@ class CityFrankfurtMainDocument extends ContributionDocument
|
||||||
public string $zipLocation,
|
public string $zipLocation,
|
||||||
public ?Country $country,
|
public ?Country $country,
|
||||||
public Collection $members,
|
public Collection $members,
|
||||||
|
public string $eventName,
|
||||||
public ?string $filename = '',
|
public ?string $filename = '',
|
||||||
public string $type = 'F',
|
public string $type = 'F',
|
||||||
) {
|
) {
|
||||||
|
$this->setEventName($eventName);
|
||||||
|
$this->fromName = app(InvoiceSettings::class)->from_long;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +44,7 @@ class CityFrankfurtMainDocument 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(15),
|
members: MemberData::fromModels($request['members'])->chunk(15),
|
||||||
|
eventName: $request['eventName'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,20 +59,10 @@ class CityFrankfurtMainDocument 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(15),
|
members: MemberData::fromApi($request['member_data'])->chunk(15),
|
||||||
|
eventName: $request['eventName'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -74,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';
|
|
||||||
}
|
|
||||||
|
|
||||||
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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,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',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -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()]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Contribution\Traits;
|
||||||
|
|
||||||
|
use Zoomyboy\Tex\Engine;
|
||||||
|
|
||||||
|
trait HasPdfBackground
|
||||||
|
{
|
||||||
|
public function getEngine(): Engine
|
||||||
|
{
|
||||||
|
return Engine::PDFLATEX;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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> */
|
||||||
|
|
|
@ -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');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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,7 +178,7 @@ 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,
|
||||||
];
|
];
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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');
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,
|
||||||
|
];
|
||||||
|
}
|
|
@ -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'),
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\FormSettings;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class ClearFrontendCacheAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
Http::get(app(FormSettings::class)->clearCacheUrl);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
|
|
||||||
|
class ExportAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
public function handle(Form $form): string
|
||||||
|
{
|
||||||
|
return CreateExcelDocumentAction::run($form, $form->participants);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Form $form, ActionRequest $request): StreamedResponse
|
||||||
|
{
|
||||||
|
$contents = $this->handle($form);
|
||||||
|
|
||||||
|
$filename = 'tn-' . $form->slug . '.xlsx';
|
||||||
|
Storage::disk('temp')->put($filename, $contents);
|
||||||
|
|
||||||
|
return Storage::disk('temp')->download($filename);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Scopes\FormFilterScope;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Resources\FormApiResource;
|
||||||
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class FormApiListAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $filter
|
||||||
|
* @return LengthAwarePaginator<Form>
|
||||||
|
*/
|
||||||
|
public function handle(string $filter, int $perPage): LengthAwarePaginator
|
||||||
|
{
|
||||||
|
return FormFilterScope::fromRequest($filter)->getQuery()->paginate($perPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(ActionRequest $request): AnonymousResourceCollection
|
||||||
|
{
|
||||||
|
return FormApiResource::collection($this->handle(
|
||||||
|
$request->input('filter', ''),
|
||||||
|
$request->input('perPage', 9999)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Lib\Events\Succeeded;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class FormDestroyAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
public function asController(Form $form): void
|
||||||
|
{
|
||||||
|
$form->delete();
|
||||||
|
|
||||||
|
ClearFrontendCacheAction::run();
|
||||||
|
|
||||||
|
Succeeded::message('Veranstaltung gelöscht.')->dispatch();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Scopes\FormFilterScope;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Resources\FormResource;
|
||||||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class FormIndexAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return LengthAwarePaginator<Form>
|
||||||
|
*/
|
||||||
|
public function handle(string $filter): LengthAwarePaginator
|
||||||
|
{
|
||||||
|
return FormFilterScope::fromRequest($filter)->getQuery()->query(fn ($query) => $query->withCount('participants'))->paginate(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(ActionRequest $request): Response
|
||||||
|
{
|
||||||
|
session()->put('menu', 'form');
|
||||||
|
session()->put('title', 'Veranstaltungen');
|
||||||
|
|
||||||
|
return Inertia::render('form/Index', [
|
||||||
|
'data' => FormResource::collection($this->handle($request->input('filter', ''))),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Lib\Events\Succeeded;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
|
||||||
|
class FormStoreAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
use HasValidation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalRules(),
|
||||||
|
'description.time' => 'required|integer',
|
||||||
|
'description.blocks' => 'required|array',
|
||||||
|
'description.version' => 'required|string',
|
||||||
|
'excerpt' => 'required|string|max:130',
|
||||||
|
'from' => 'required|date',
|
||||||
|
'to' => 'required|date',
|
||||||
|
'registration_from' => 'present|nullable|date',
|
||||||
|
'registration_until' => 'present|nullable|date',
|
||||||
|
'header_image' => 'required|exclude',
|
||||||
|
'mailattachments' => 'present|array|exclude',
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
'is_private' => 'boolean',
|
||||||
|
'export' => 'nullable|array',
|
||||||
|
'needs_prevention' => 'present|boolean',
|
||||||
|
'prevention_text' => 'array',
|
||||||
|
'prevention_conditions' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $attributes
|
||||||
|
*/
|
||||||
|
public function handle(array $attributes): Form
|
||||||
|
{
|
||||||
|
return tap(Form::create($attributes), function ($form) {
|
||||||
|
$form->setDeferredUploads(request()->input('header_image'));
|
||||||
|
$form->setDeferredUploads(request()->input('mailattachments'));
|
||||||
|
ClearFrontendCacheAction::run();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function getValidationAttributes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalValidationAttributes(),
|
||||||
|
'from' => 'Start',
|
||||||
|
'to' => 'Ende',
|
||||||
|
'header_image' => 'Bild',
|
||||||
|
'description.blocks' => 'Beschreibung',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$this->handle($request->validated());
|
||||||
|
|
||||||
|
Succeeded::message('Veranstaltung gespeichert.')->dispatch();
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Lib\Editor\Condition;
|
||||||
|
use App\Lib\Events\Succeeded;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
|
||||||
|
class FormUpdateAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
use HasValidation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalRules(),
|
||||||
|
'description' => 'required|array',
|
||||||
|
'description.time' => 'required|integer',
|
||||||
|
'description.blocks' => 'required|array',
|
||||||
|
'description.version' => 'required|string',
|
||||||
|
'excerpt' => 'required|string|max:130',
|
||||||
|
'from' => 'required|date',
|
||||||
|
'to' => 'required|date',
|
||||||
|
'registration_from' => 'present|nullable|date',
|
||||||
|
'registration_until' => 'present|nullable|date',
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
'is_private' => 'boolean',
|
||||||
|
'export' => 'nullable|array',
|
||||||
|
'needs_prevention' => 'present|boolean',
|
||||||
|
'prevention_text' => 'array',
|
||||||
|
'prevention_conditions' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $attributes
|
||||||
|
*/
|
||||||
|
public function handle(Form $form, array $attributes): Form
|
||||||
|
{
|
||||||
|
$form->update($attributes);
|
||||||
|
|
||||||
|
ClearFrontendCacheAction::run();
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function getValidationAttributes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalValidationAttributes(),
|
||||||
|
'from' => 'Start',
|
||||||
|
'to' => 'Ende',
|
||||||
|
'description.blocks' => 'Beschreibung',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Form $form, ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$this->handle($form, $request->validated());
|
||||||
|
|
||||||
|
Succeeded::message('Veranstaltung aktualisiert.')->dispatch();
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
|
||||||
|
class FormUpdateMetaAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
/** @var Form */
|
||||||
|
$form = request()->route('form');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'sorting' => 'array',
|
||||||
|
'sorting.by' => 'required|string',
|
||||||
|
'sorting.direction' => 'required|boolean',
|
||||||
|
'active_columns' => 'array',
|
||||||
|
'active_columns.*' => ['string', Rule::in([...$form->getFields()->pluck('key')->toArray(), 'created_at', 'prevention'])]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $input
|
||||||
|
*/
|
||||||
|
public function handle(Form $form, array $input): void
|
||||||
|
{
|
||||||
|
$form->update(['meta' => $input]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Form $form, ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$this->handle($form, $request->validated());
|
||||||
|
|
||||||
|
return response()->json($form->fresh()->meta);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Formtemplate;
|
||||||
|
use App\Lib\Events\Succeeded;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class FormtemplateDestroyAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
public function handle(Formtemplate $formtemplate): void
|
||||||
|
{
|
||||||
|
$formtemplate->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Formtemplate $formtemplate): JsonResponse
|
||||||
|
{
|
||||||
|
$this->handle($formtemplate);
|
||||||
|
|
||||||
|
Succeeded::message('Vorlage gelöscht.')->dispatch();
|
||||||
|
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Formtemplate;
|
||||||
|
use App\Form\Resources\FormtemplateResource;
|
||||||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class FormtemplateIndexAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return LengthAwarePaginator<Formtemplate>
|
||||||
|
*/
|
||||||
|
public function handle(): LengthAwarePaginator
|
||||||
|
{
|
||||||
|
return Formtemplate::paginate(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(): Response
|
||||||
|
{
|
||||||
|
session()->put('menu', 'form');
|
||||||
|
session()->put('title', 'Formular-Vorlagen');
|
||||||
|
|
||||||
|
return Inertia::render('formtemplate/Index', [
|
||||||
|
'data' => FormtemplateResource::collection($this->handle()),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Formtemplate;
|
||||||
|
use App\Lib\Events\Succeeded;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class FormtemplateStoreAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
use HasValidation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalRules(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function getValidationAttributes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalValidationAttributes(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $attributes
|
||||||
|
*/
|
||||||
|
public function handle(array $attributes): Formtemplate
|
||||||
|
{
|
||||||
|
return Formtemplate::create($attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$this->handle($request->validated());
|
||||||
|
|
||||||
|
Succeeded::message('Vorlage gespeichert.')->dispatch();
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Formtemplate;
|
||||||
|
use App\Lib\Events\Succeeded;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class FormtemplateUpdateAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
use HasValidation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalRules(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function getValidationAttributes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...$this->globalValidationAttributes(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $attributes
|
||||||
|
*/
|
||||||
|
public function handle(Formtemplate $formtemplate, array $attributes): void
|
||||||
|
{
|
||||||
|
$formtemplate->update($attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Formtemplate $formtemplate, ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$this->handle($formtemplate, $request->validated());
|
||||||
|
|
||||||
|
Succeeded::message('Vorlage aktualisiert.')->dispatch();
|
||||||
|
|
||||||
|
return response()->json([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use App\Form\Fields\Field;
|
||||||
|
use Illuminate\Validation\Validator;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
|
||||||
|
trait HasValidation
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function globalRules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'config' => 'array',
|
||||||
|
'config.sections.*.name' => 'required',
|
||||||
|
'config.sections.*.intro' => 'nullable|string',
|
||||||
|
'config.sections.*.fields' => 'array',
|
||||||
|
'config.sections.*.fields.*.name' => 'required|string',
|
||||||
|
'config.sections.*.fields.*.type' => ['required', 'string', Rule::in(array_column(Field::asMeta(), 'id'))],
|
||||||
|
'config.sections.*.fields.*.key' => ['required', 'string', 'regex:/^[a-zA-Z_]*$/'],
|
||||||
|
'config.sections.*.fields.*.columns' => 'required|array',
|
||||||
|
'config.sections.*.fields.*.*' => '',
|
||||||
|
'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.desktop' => 'required|numeric|gt:0|lte:6',
|
||||||
|
'mail_top' => 'array',
|
||||||
|
'mail_bottom' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function globalValidationAttributes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'config.sections.*.name' => 'Sektionsname',
|
||||||
|
'config.sections.*.fields.*.name' => 'Feldname',
|
||||||
|
'config.sections.*.fields.*.type' => 'Feldtyp',
|
||||||
|
'config.sections.*.fields.*.key' => 'Feldkey',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withValidator(Validator $validator, ActionRequest $request): void
|
||||||
|
{
|
||||||
|
if (!$validator->passes()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($request->input('config.sections') as $sindex => $section) {
|
||||||
|
foreach (data_get($section, 'fields') as $findex => $field) {
|
||||||
|
$fieldClass = Field::classFromType($field['type']);
|
||||||
|
if (!$fieldClass) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($fieldClass::metaRules() as $fieldName => $rules) {
|
||||||
|
$validator->addRules(["config.sections.{$sindex}.fields.{$findex}.{$fieldName}" => $rules]);
|
||||||
|
}
|
||||||
|
foreach ($fieldClass::metaAttributes() as $fieldName => $attribute) {
|
||||||
|
$validator->addCustomAttributes(["config.sections.{$sindex}.fields.{$findex}.{$fieldName}" => $attribute]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class IsDirtyAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'config' => 'array|present',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(Form $form, ActionRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$form->config = $request->input('config');
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'result' => $form->isDirty('config'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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')]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Lib\JobMiddleware\JobChannels;
|
||||||
|
use App\Lib\JobMiddleware\WithJobState;
|
||||||
|
use App\Lib\Queue\TracksJob;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class ParticipantDestroyAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
use TracksJob;
|
||||||
|
|
||||||
|
public function handle(int $participantId): void
|
||||||
|
{
|
||||||
|
Participant::findOrFail($participantId)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Participant $participant): void
|
||||||
|
{
|
||||||
|
$this->startJob($participant->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $parameters
|
||||||
|
*/
|
||||||
|
public function jobState(WithJobState $jobState, ...$parameters): WithJobState
|
||||||
|
{
|
||||||
|
return $jobState
|
||||||
|
->after('Teilnehmer gelöscht.')
|
||||||
|
->failed('Löschen von Teilnehmer fehlgeschlagen.')
|
||||||
|
->shouldReload(JobChannels::make()->add('participant'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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(),
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Form\Resources\ParticipantResource;
|
||||||
|
use App\Form\Scopes\ParticipantFilterScope;
|
||||||
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||||
|
use Laravel\Scout\Builder;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class ParticipantIndexAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Builder<Participant>
|
||||||
|
*/
|
||||||
|
protected function getQuery(Form $form, ParticipantFilterScope $filter): Builder
|
||||||
|
{
|
||||||
|
return $filter->setForm($form)->getQuery()
|
||||||
|
->query(fn ($q) => $q->withCount('children')->with('form'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asController(Form $form, ?int $parent = null): AnonymousResourceCollection
|
||||||
|
{
|
||||||
|
$filter = ParticipantFilterScope::fromRequest(request()->input('filter', ''))->parent($parent);
|
||||||
|
|
||||||
|
$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)]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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([]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Actions;
|
||||||
|
|
||||||
|
use App\Form\Data\FieldCollection;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Member\Member;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|
||||||
|
class RegisterAction
|
||||||
|
{
|
||||||
|
use AsAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $input
|
||||||
|
*/
|
||||||
|
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)
|
||||||
|
->withNamiType()
|
||||||
|
->reduce(fn ($query, $field) => $field->namiType->performQuery($query, $field->value), (new Member())->newQuery());
|
||||||
|
$member = $form->getFields()->withNamiType()->count() && $memberQuery->count() === 1 ? $memberQuery->first() : null;
|
||||||
|
|
||||||
|
$participant = $form->participants()->create([
|
||||||
|
'data' => $input,
|
||||||
|
'member_id' => $member?->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$form->getFields()->each(fn ($field) => $field->afterRegistration($form, $participant, $input));
|
||||||
|
|
||||||
|
$participant->sendConfirmationMail();
|
||||||
|
ExportSyncAction::dispatch($form->id);
|
||||||
|
|
||||||
|
return $participant;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 asController(ActionRequest $request, Form $form): JsonResponse
|
||||||
|
{
|
||||||
|
$participant = $this->handle($form, $request->validated());
|
||||||
|
|
||||||
|
return response()->json($participant);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Casts;
|
||||||
|
|
||||||
|
use App\Form\Fields\Field;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Spatie\LaravelData\Casts\Cast;
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
use Spatie\LaravelData\Support\Creation\CreationContext;
|
||||||
|
use Spatie\LaravelData\Support\DataProperty;
|
||||||
|
|
||||||
|
class CollectionCast implements Cast
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param class-string<Data> $target
|
||||||
|
*/
|
||||||
|
public function __construct(public string $target)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<int, array<string, mixed>> $value
|
||||||
|
* @return Collection<int, Data>
|
||||||
|
*/
|
||||||
|
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed
|
||||||
|
{
|
||||||
|
return collect($value)->map(fn ($item) => $this->target::from($item));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Casts;
|
||||||
|
|
||||||
|
use App\Form\Data\FieldCollection;
|
||||||
|
use App\Form\Fields\Field;
|
||||||
|
use Spatie\LaravelData\Casts\Cast;
|
||||||
|
use Spatie\LaravelData\Support\Creation\CreationContext;
|
||||||
|
use Spatie\LaravelData\Support\DataProperty;
|
||||||
|
|
||||||
|
class FieldCollectionCast implements Cast
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array<int, array<string, string>> $value
|
||||||
|
* @return FieldCollection
|
||||||
|
*/
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Contracts;
|
||||||
|
|
||||||
|
interface Filterable
|
||||||
|
{
|
||||||
|
/** @param mixed $value */
|
||||||
|
public function filter($value): string;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Data;
|
||||||
|
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
|
||||||
|
class ColumnData extends Data
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
public int $mobile,
|
||||||
|
public int $tablet,
|
||||||
|
public int $desktop,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,144 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Data;
|
||||||
|
|
||||||
|
use App\Form\Contracts\Filterable;
|
||||||
|
use App\Form\Enums\SpecialType;
|
||||||
|
use App\Form\Fields\Field;
|
||||||
|
use App\Form\Fields\NamiField;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends Collection<int, Field>
|
||||||
|
*/
|
||||||
|
class FieldCollection extends Collection
|
||||||
|
{
|
||||||
|
|
||||||
|
public function forMembers(): self
|
||||||
|
{
|
||||||
|
return $this->filter(fn ($field) => $field->forMembers === true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withNamiType(): self
|
||||||
|
{
|
||||||
|
return $this->filter(fn ($field) => $field->namiType !== null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function noNamiType(): self
|
||||||
|
{
|
||||||
|
return $this->filter(fn ($field) => $field->namiType === null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function noNamiField(): self
|
||||||
|
{
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
public function getMailRecipient(): ?stdClass
|
||||||
|
{
|
||||||
|
$email = $this->findBySpecialType(SpecialType::EMAIL)?->value;
|
||||||
|
|
||||||
|
return $this->getFullname() && $email
|
||||||
|
? (object) [
|
||||||
|
'name' => $this->getFullname(),
|
||||||
|
"email" => $email,
|
||||||
|
] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFullname(): ?string
|
||||||
|
{
|
||||||
|
$firstname = $this->findBySpecialType(SpecialType::FIRSTNAME)?->value;
|
||||||
|
$lastname = $this->findBySpecialType(SpecialType::LASTNAME)?->value;
|
||||||
|
|
||||||
|
return $firstname && $lastname ? "$firstname $lastname" : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $input
|
||||||
|
*/
|
||||||
|
public static function fromRequest(Form $form, array $input): self
|
||||||
|
{
|
||||||
|
return $form->getFields()->map(function ($field) use ($input) {
|
||||||
|
$field->value = array_key_exists($field->key, $input) ? $input[$field->key] : $field->default();
|
||||||
|
return $field;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find(Field $givenField): ?Field
|
||||||
|
{
|
||||||
|
return $this->findByKey($givenField->key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findByKey(string $key): ?Field
|
||||||
|
{
|
||||||
|
return $this->first(fn ($field) => $field->key === $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function present(): array
|
||||||
|
{
|
||||||
|
$attributes = collect([]);
|
||||||
|
|
||||||
|
foreach ($this as $field) {
|
||||||
|
$attributes = $attributes->merge($field->present());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attributes->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
public function names(): array
|
||||||
|
{
|
||||||
|
return $this->map(fn ($field) => $field->name)->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
public function presentValues(): array
|
||||||
|
{
|
||||||
|
return $this->map(fn ($field) => $field->presentRaw())->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function findBySpecialType(SpecialType $specialType): ?Field
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Data;
|
||||||
|
|
||||||
|
use App\Form\Casts\CollectionCast;
|
||||||
|
use App\Form\Transformers\CollectionTransformer;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
use Spatie\LaravelData\Attributes\WithCast;
|
||||||
|
use Spatie\LaravelData\Attributes\WithTransformer;
|
||||||
|
|
||||||
|
class FormConfigData extends Data
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection<int, SectionData> $sections
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
#[WithCast(CollectionCast::class, target: SectionData::class)]
|
||||||
|
#[WithTransformer(CollectionTransformer::class, target: SectionData::class)]
|
||||||
|
public Collection $sections
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fields(): FieldCollection
|
||||||
|
{
|
||||||
|
return $this->sections->reduce(
|
||||||
|
fn ($carry, $current) => $carry->merge($current->fields->all()),
|
||||||
|
new FieldCollection([])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Data;
|
||||||
|
|
||||||
|
use App\Form\Casts\FieldCollectionCast;
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
use App\Form\Transformers\FieldCollectionTransformer;
|
||||||
|
use Spatie\LaravelData\Attributes\WithCast;
|
||||||
|
use Spatie\LaravelData\Attributes\WithTransformer;
|
||||||
|
|
||||||
|
class SectionData extends Data
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
public string $name,
|
||||||
|
#[WithCast(FieldCollectionCast::class)]
|
||||||
|
#[WithTransformer(FieldCollectionTransformer::class)]
|
||||||
|
public FieldCollection $fields,
|
||||||
|
public ?string $intro
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Editor;
|
||||||
|
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Lib\Editor\Condition;
|
||||||
|
use App\Lib\Editor\ConditionResolver;
|
||||||
|
|
||||||
|
class FormConditionResolver extends ConditionResolver
|
||||||
|
{
|
||||||
|
|
||||||
|
private Participant $participant;
|
||||||
|
|
||||||
|
public function forParticipant(Participant $participant): self
|
||||||
|
{
|
||||||
|
$this->participant = $participant;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function filterCondition(Condition $condition): bool
|
||||||
|
{
|
||||||
|
if (!$condition->hasStatements()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($condition->ifs as $if) {
|
||||||
|
$field = $this->participant->getFields()->findByKey($if->field);
|
||||||
|
$matches = $field->matches($if->comparator, $if->value);
|
||||||
|
if ($matches && $condition->isAny()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!$matches && $condition->isAll()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($condition->isAny()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Enums;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Group\Enums\Level;
|
||||||
|
use App\Member\Member;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
|
enum NamiType: string
|
||||||
|
{
|
||||||
|
case FIRSTNAME = 'Vorname';
|
||||||
|
case LASTNAME = 'Nachname';
|
||||||
|
case NICKNAME = 'Spitzname';
|
||||||
|
case BIRTHDAY = 'Geburtstag';
|
||||||
|
case REGION = 'Bezirk';
|
||||||
|
case STAMM = 'Stamm';
|
||||||
|
case EMAIL = 'E-Mail-Adresse';
|
||||||
|
case ADDRESS = 'Adresse';
|
||||||
|
case ZIP = 'PLZ';
|
||||||
|
case LOCATION = 'Ort';
|
||||||
|
case GENDER = 'Geschlecht';
|
||||||
|
case MOBILEPHONE = 'Handynummer';
|
||||||
|
case AGE = 'Alter (zum Zeitpunkt der Anmeldung)';
|
||||||
|
case AGEEVENT = 'Alter (zum Zeitpunkt der Veranstaltung)';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, array{name: string, id: string}>
|
||||||
|
*/
|
||||||
|
public static function forSelect(): array
|
||||||
|
{
|
||||||
|
return collect(static::cases())
|
||||||
|
->map(fn ($case) => ['id' => $case->value, 'name' => $case->value])
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMemberAttribute(Member $member, Form $form): ?string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
static::FIRSTNAME => $member->firstname,
|
||||||
|
static::LASTNAME => $member->lastname,
|
||||||
|
static::BIRTHDAY => $member->birthday?->format('Y-m-d'),
|
||||||
|
static::REGION => $this->matchRegion($member),
|
||||||
|
static::STAMM => $this->matchGroup($member),
|
||||||
|
static::EMAIL => $member->email,
|
||||||
|
static::ADDRESS => $member->address,
|
||||||
|
static::ZIP => $member->zip,
|
||||||
|
static::LOCATION => $member->location,
|
||||||
|
static::NICKNAME => $member->nickname,
|
||||||
|
static::GENDER => $member->gender?->name,
|
||||||
|
static::AGE => intVal($member->birthday->diffInYears(now())),
|
||||||
|
static::AGEEVENT => $member->birthday->diffInYears($form->from),
|
||||||
|
static::MOBILEPHONE => $member->mobile_phone,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Builder<Member> $query
|
||||||
|
* @return Builder<Member>
|
||||||
|
*/
|
||||||
|
public function performQuery(Builder $query, mixed $value): Builder
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
static::FIRSTNAME => $query->where('firstname', $value),
|
||||||
|
static::LASTNAME => $query->where('lastname', $value),
|
||||||
|
static::BIRTHDAY => $query->where('birthday', $value),
|
||||||
|
default => $query,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function matchGroup(Member $member): ?int
|
||||||
|
{
|
||||||
|
if ($member->group->level === Level::GROUP) {
|
||||||
|
return $member->group_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function matchRegion(Member $member): ?int
|
||||||
|
{
|
||||||
|
if ($member->group->parent?->level === Level::REGION) {
|
||||||
|
return $member->group->parent->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($member->group->level === Level::REGION) {
|
||||||
|
return $member->group_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Enums;
|
||||||
|
|
||||||
|
enum SpecialType: string
|
||||||
|
{
|
||||||
|
case FIRSTNAME = 'Vorname';
|
||||||
|
case LASTNAME = 'Nachname';
|
||||||
|
case EMAIL = 'E-Mail-Adresse';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, array{name: string, id: string}>
|
||||||
|
*/
|
||||||
|
public static function forSelect(): array
|
||||||
|
{
|
||||||
|
return collect(static::cases())
|
||||||
|
->map(fn ($case) => ['id' => $case->value, 'name' => $case->value])
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Contracts\Filterable;
|
||||||
|
use App\Form\Matchers\BooleanMatcher;
|
||||||
|
use App\Form\Matchers\Matcher;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Form\Presenters\BooleanPresenter;
|
||||||
|
use App\Form\Presenters\Presenter;
|
||||||
|
use Faker\Generator;
|
||||||
|
|
||||||
|
class CheckboxField extends Field implements Filterable
|
||||||
|
{
|
||||||
|
public bool $required;
|
||||||
|
public string $description;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Checkbox';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'description', 'default' => '', 'rules' => ['description' => 'required|string'], 'label' => 'Beschreibung'],
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'description' => $faker->text(),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->key => $this->required ? ['boolean', 'accepted'] : ['present', 'boolean'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->key => $this->name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPresenter(): Presenter
|
||||||
|
{
|
||||||
|
return app(BooleanPresenter::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMatcher(): Matcher
|
||||||
|
{
|
||||||
|
return app(BooleanMatcher::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function filter($value): string
|
||||||
|
{
|
||||||
|
$asString = $value ? 'true' : 'false';
|
||||||
|
|
||||||
|
return "{$this->key} = $asString";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Form\Presenters\EnumPresenter;
|
||||||
|
use App\Form\Presenters\Presenter;
|
||||||
|
use Faker\Generator;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class CheckboxesField extends Field
|
||||||
|
{
|
||||||
|
/** @var array<int, string> */
|
||||||
|
public array $options;
|
||||||
|
public ?int $min;
|
||||||
|
public ?int $max;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Checkboxes';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'options', 'default' => [], 'rules' => ['options' => 'array', 'options.*' => 'required|string'], 'label' => 'Optionen'],
|
||||||
|
['key' => 'min', 'default' => null, 'rules' => ['min' => 'present'], 'label' => 'minimale Anzahl'],
|
||||||
|
['key' => 'max', 'default' => null, 'rules' => ['max' => 'present'], 'label' => 'maximale Anzahl'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'options' => $faker->words(4),
|
||||||
|
'min' => null,
|
||||||
|
'max' => null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
$globalRules = ['array'];
|
||||||
|
|
||||||
|
if ($this->min > 0) {
|
||||||
|
$globalRules[] = 'min:' . $this->min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->max > 0) {
|
||||||
|
$globalRules[] = 'max:' . $this->max;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
$this->key => $globalRules,
|
||||||
|
$this->key . '.*' => ['string', Rule::in($this->options)],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
...collect($this->options)->mapWithKeys(fn ($option, $key) => [$this->key . '.' . $key => $this->name])->toArray(),
|
||||||
|
$this->key => $this->name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPresenter(): Presenter
|
||||||
|
{
|
||||||
|
return app(EnumPresenter::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Contracts\Displayable;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Form\Presenters\DatePresenter;
|
||||||
|
use App\Form\Presenters\Presenter;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Faker\Generator;
|
||||||
|
|
||||||
|
class DateField extends Field
|
||||||
|
{
|
||||||
|
|
||||||
|
public bool $required;
|
||||||
|
public bool $maxToday;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Datum';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
['key' => 'max_today', 'default' => false, 'rules' => ['required' => 'present|boolean'], 'label' => 'Nur daten bis heute erlauben'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
'max_today' => $faker->boolean(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
$rules = [$this->required ? 'required' : 'nullable'];
|
||||||
|
|
||||||
|
$rules[] = 'date';
|
||||||
|
|
||||||
|
if ($this->maxToday) {
|
||||||
|
$rules[] = 'before_or_equal:' . now()->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$this->key => $rules];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->key => $this->name,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->key . '.before_or_equal' => $this->name . ' muss ein Datum vor oder gleich dem ' . now()->format('d.m.Y') . ' sein.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPresenter(): Presenter
|
||||||
|
{
|
||||||
|
return app(DatePresenter::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Contracts\Filterable;
|
||||||
|
use App\Form\Matchers\Matcher;
|
||||||
|
use App\Form\Matchers\SingleValueMatcher;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use Faker\Generator;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class DropdownField extends Field implements Filterable
|
||||||
|
{
|
||||||
|
public bool $required;
|
||||||
|
/** @var array<int, string> */
|
||||||
|
public array $options;
|
||||||
|
public bool $allowcustom;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Dropdown';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'options', 'default' => [], 'rules' => ['options' => 'present|array', 'options.*' => 'string'], 'label' => 'Optionen'],
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
['key' => 'allowcustom', 'default' => false, 'rules' => ['required' => 'present|boolean'], 'label' => 'Eigene Option erlauben'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'options' => $faker->words(4),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
'allowcustom' => $faker->boolean(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
$rules = $this->required ? ['required', 'string'] : ['nullable', 'string'];
|
||||||
|
|
||||||
|
if (!$this->allowcustom) {
|
||||||
|
$rules[] = Rule::in($this->options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
$this->key => $rules
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMatcher(): Matcher
|
||||||
|
{
|
||||||
|
return app(SingleValueMatcher::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
public function filter($value): string
|
||||||
|
{
|
||||||
|
if (is_null($value)) {
|
||||||
|
return "{$this->key} IS NULL";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->key . ' = \'' . $value . '\'';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
|
||||||
|
class EmailField extends TextField
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'E-Mail-Adresse';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->required ? ['required', 'string', 'email'] : ['nullable', 'email', 'string']];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Data\ColumnData;
|
||||||
|
use App\Form\Enums\NamiType;
|
||||||
|
use App\Form\Enums\SpecialType;
|
||||||
|
use App\Form\Matchers\Matcher;
|
||||||
|
use App\Form\Matchers\SingleValueMatcher;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Form\Presenters\DefaultPresenter;
|
||||||
|
use App\Form\Presenters\Presenter;
|
||||||
|
use App\Lib\Editor\Comparator;
|
||||||
|
use Faker\Generator;
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
use Spatie\LaravelData\Attributes\MapInputName;
|
||||||
|
use Spatie\LaravelData\Attributes\MapOutputName;
|
||||||
|
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
|
||||||
|
|
||||||
|
#[MapInputName(SnakeCaseMapper::class)]
|
||||||
|
#[MapOutputName(SnakeCaseMapper::class)]
|
||||||
|
abstract class Field extends Data
|
||||||
|
{
|
||||||
|
|
||||||
|
public string $key;
|
||||||
|
public string $name;
|
||||||
|
public ?NamiType $namiType = null;
|
||||||
|
public ColumnData $columns;
|
||||||
|
public bool $forMembers;
|
||||||
|
public ?SpecialType $specialType = null;
|
||||||
|
public ?string $hint;
|
||||||
|
public ?string $intro;
|
||||||
|
|
||||||
|
/** @var mixed */
|
||||||
|
public $value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<array-key, mixed> $input
|
||||||
|
*/
|
||||||
|
abstract public function afterRegistration(Form $form, Participant $participant, array $input): void;
|
||||||
|
|
||||||
|
abstract public static function name(): string;
|
||||||
|
|
||||||
|
/** @return array<int, array{key: string, default: mixed, label: string, rules: array<string, mixed>}> */
|
||||||
|
abstract public static function meta(): array;
|
||||||
|
|
||||||
|
/** @return mixed */
|
||||||
|
abstract public static function default();
|
||||||
|
|
||||||
|
/** @return array<string, mixed> */
|
||||||
|
abstract public function getRegistrationRules(Form $form): array;
|
||||||
|
|
||||||
|
/** @return array<string, mixed> */
|
||||||
|
abstract public function getRegistrationAttributes(Form $form): array;
|
||||||
|
|
||||||
|
/** @return array<string, mixed> */
|
||||||
|
abstract public function getRegistrationMessages(Form $form): array;
|
||||||
|
|
||||||
|
/** @return array<string, mixed> */
|
||||||
|
abstract public static function fake(Generator $faker): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, array<string, mixed>>
|
||||||
|
*/
|
||||||
|
public static function asMeta(): array
|
||||||
|
{
|
||||||
|
return array_map(fn ($class) => $class::allMeta(), self::classNames());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, class-string<self>>
|
||||||
|
*/
|
||||||
|
private static function classNames(): array
|
||||||
|
{
|
||||||
|
return collect(glob(base_path('app/Form/Fields/*.php')))
|
||||||
|
->filter(fn ($fieldClass) => preg_match('/[A-Za-z]Field\.php$/', $fieldClass) === 1)
|
||||||
|
->map(fn ($fieldClass) => str($fieldClass)->replaceFirst(base_path(''), '')->replace('/app', '/App')->replace('.php', '')->replace('/', '\\')->toString())
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return class-string<Field>
|
||||||
|
*/
|
||||||
|
public static function classFromType(string $type): ?string
|
||||||
|
{
|
||||||
|
/** @var class-string<Field> */
|
||||||
|
$fieldClass = '\\App\\Form\\Fields\\' . $type;
|
||||||
|
if (!class_exists($fieldClass)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fieldClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function present()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->key => $this->value,
|
||||||
|
$this->getDisplayAttribute() => $this->presentRaw(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function presentRaw(): string
|
||||||
|
{
|
||||||
|
return $this->getPresenter()->present($this->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function metaAttributes(): array
|
||||||
|
{
|
||||||
|
return collect(static::meta())->mapWithKeys(fn ($meta) => [$meta['key'] => $meta['label']])->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
**/
|
||||||
|
public static function metaRules(): array
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
foreach (static::meta() as $meta) {
|
||||||
|
foreach ($meta['rules'] as $fieldName => $rules) {
|
||||||
|
$result[$fieldName] = $rules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function type(): string
|
||||||
|
{
|
||||||
|
return class_basename(static::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public static function allMeta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => static::type(),
|
||||||
|
'name' => static::name(),
|
||||||
|
'default' => [
|
||||||
|
'name' => '',
|
||||||
|
'type' => static::type(),
|
||||||
|
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6],
|
||||||
|
'value' => static::default(),
|
||||||
|
'nami_type' => null,
|
||||||
|
'for_members' => true,
|
||||||
|
'special_type' => null,
|
||||||
|
'hint' => '',
|
||||||
|
'intro' => '',
|
||||||
|
...collect(static::meta())->mapWithKeys(fn ($meta) => [$meta['key'] => $meta['default']])->toArray(),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPresenter(): Presenter
|
||||||
|
{
|
||||||
|
return app(DefaultPresenter::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDisplayAttribute(): string
|
||||||
|
{
|
||||||
|
return $this->key . '_display';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function matches(Comparator $comparator, mixed $value): bool
|
||||||
|
{
|
||||||
|
return $this->getMatcher()->setValue($this->value)->matches($comparator, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMatcher(): Matcher
|
||||||
|
{
|
||||||
|
return app(SingleValueMatcher::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @param mixed $value */
|
||||||
|
public function filter($value): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Form\Presenters\GroupPresenter;
|
||||||
|
use App\Form\Presenters\Presenter;
|
||||||
|
use App\Group;
|
||||||
|
use App\Group\Enums\Level;
|
||||||
|
use Faker\Generator;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class GroupField extends Field
|
||||||
|
{
|
||||||
|
public bool $required;
|
||||||
|
public ?string $parentField = null;
|
||||||
|
public ?int $parentGroup = null;
|
||||||
|
public bool $hasEmptyOption;
|
||||||
|
public ?string $emptyOptionValue;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Gruppierungs-Auswahl';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
['key' => 'parent_field', 'default' => null, 'rules' => ['parent_field' => 'present|nullable|string'], 'label' => 'Übergeordnetes Feld'],
|
||||||
|
['key' => 'parent_group', 'default' => null, 'rules' => ['parent_group' => ['present', 'nullable', Rule::in(Group::pluck('id')->toArray())]], 'label' => 'Übergeordnete Gruppierung'],
|
||||||
|
['key' => 'has_empty_option', 'default' => false, 'rules' => ['has_empty_option' => ['present', 'boolean']], 'label' => 'Leere Option erlauben'],
|
||||||
|
['key' => 'empty_option_value', 'default' => '', 'rules' => ['empty_option_value' => ['present', 'nullable', 'string']], 'label' => 'Leere Option'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
'parent_field' => null,
|
||||||
|
'parent_group' => null,
|
||||||
|
'has_empty_option' => $faker->boolean(),
|
||||||
|
'empty_option_value' => '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
|
||||||
|
$rules = [$this->required ? 'required' : 'nullable'];
|
||||||
|
|
||||||
|
$rules[] = 'integer';
|
||||||
|
|
||||||
|
if ($this->parentGroup) {
|
||||||
|
$rules[] = Rule::in(Group::find($this->parentGroup)->children()->pluck('id')->push(-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->parentField && request()->input($this->parentField) && request()->input($this->parentField) !== -1) {
|
||||||
|
$rules[] = Rule::in(Group::find(request()->input($this->parentField))->children()->pluck('id')->push(-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$this->key => $rules];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPresenter(): Presenter
|
||||||
|
{
|
||||||
|
return app(GroupPresenter::class)->field($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Data\FieldCollection;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Form\Presenters\NamiPresenter;
|
||||||
|
use App\Form\Presenters\Presenter;
|
||||||
|
use App\Member\Member;
|
||||||
|
use Faker\Generator;
|
||||||
|
|
||||||
|
class NamiField extends Field
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'NaMi-Mitglieder';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public static function default(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
$rules = [$this->key => 'present|array'];
|
||||||
|
$inputMembers = request($this->key);
|
||||||
|
|
||||||
|
foreach ($form->getFields()->noNamiField()->forMembers() as $field) {
|
||||||
|
foreach ($field->getRegistrationRules($form) as $ruleKey => $rule) {
|
||||||
|
foreach ($inputMembers as $memberIndex => $inputMember) {
|
||||||
|
$rules[$this->key . '.' . $memberIndex . '.' . $ruleKey] = !$inputMember['id'] || $field->namiType === null ? $rule : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
$this->key . '.*.id' => ['nullable', 'numeric', 'exists:members,mitgliedsnr'],
|
||||||
|
...$rules,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
$rules = [];
|
||||||
|
$inputMembers = request($this->key);
|
||||||
|
|
||||||
|
if (!is_array($inputMembers)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($form->getFields()->noNamiField()->forMembers() as $field) {
|
||||||
|
foreach ($field->getRegistrationRules($form) as $ruleKey => $rule) {
|
||||||
|
foreach ($inputMembers as $memberIndex => $inputMember) {
|
||||||
|
$message = $field->name . ' für ein Mitglied';
|
||||||
|
$rules = array_merge(
|
||||||
|
$rules,
|
||||||
|
str($ruleKey)->contains('*')
|
||||||
|
? collect(request($this->key . '.' . $memberIndex . '.' . $field->key))
|
||||||
|
->mapWithKeys(fn ($value, $key) => [$this->key . '.' . $memberIndex . '.' . str($ruleKey)->replace('*', $key) => $message])
|
||||||
|
->toArray()
|
||||||
|
: [$this->key . '.' . $memberIndex . '.' . $ruleKey => $message]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($inputMembers as $memberIndex => $inputMember) {
|
||||||
|
$rules[$this->key . '.' . $memberIndex . '.id'] = 'Mitglied Nr ' . $inputMember['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
$this->key => $this->name,
|
||||||
|
...$rules,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
foreach ($input[$this->key] as $memberData) {
|
||||||
|
$member = $memberData['id'] ? Member::firstWhere(['mitgliedsnr' => $memberData['id']]) : null;
|
||||||
|
$data = [];
|
||||||
|
foreach (FieldCollection::fromRequest($form, $memberData) as $field) {
|
||||||
|
$data[$field->key] = $field->namiType === null || $member === null
|
||||||
|
? $field->value
|
||||||
|
: $field->namiType->getMemberAttribute($member, $form);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[$this->key] = [];
|
||||||
|
$form->participants()->create(['data' => $data, 'member_id' => $member?->id, 'parent_id' => $participant->id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPresenter(): Presenter
|
||||||
|
{
|
||||||
|
return app(NamiPresenter::class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use Faker\Generator;
|
||||||
|
|
||||||
|
class NumberField extends Field
|
||||||
|
{
|
||||||
|
|
||||||
|
public bool $required;
|
||||||
|
public ?int $min;
|
||||||
|
public ?int $max;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Numerisch';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
['key' => 'min', 'default' => null, 'rules' => ['min' => 'present|nullable|numeric'], 'label' => 'minimaler Wert'],
|
||||||
|
['key' => 'max', 'default' => null, 'rules' => ['min' => 'present|nullable|numeric'], 'label' => 'maximaler Wert'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default(): ?int
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
'min' => $faker->numberBetween(0, 100),
|
||||||
|
'max' => $faker->numberBetween(0, 100),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
$minmax = [];
|
||||||
|
|
||||||
|
if ($this->min !== null) {
|
||||||
|
$minmax[] = 'gte:' . $this->min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->max !== null) {
|
||||||
|
$minmax[] = 'lte:' . $this->max;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$this->key => $this->required ? ['required', 'integer', ...$minmax] : ['nullable', 'integer', ...$minmax]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Contracts\Filterable;
|
||||||
|
use App\Form\Matchers\Matcher;
|
||||||
|
use App\Form\Matchers\SingleValueMatcher;
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use Faker\Generator;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class RadioField extends Field implements Filterable
|
||||||
|
{
|
||||||
|
public bool $required;
|
||||||
|
/** @var array<int, string> */
|
||||||
|
public array $options;
|
||||||
|
public bool $allowcustom;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Radio';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'options', 'default' => [], 'rules' => ['options' => 'present|array', 'options.*' => 'required|string'], 'label' => 'Optionen'],
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
['key' => 'allowcustom', 'default' => false, 'rules' => ['required' => 'present|boolean'], 'label' => 'Eigene Option erlauben'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'options' => $faker->words(4),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
'allowcustom' => $faker->boolean(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
$rules = $this->required ? ['required', 'string'] : ['nullable', 'string'];
|
||||||
|
|
||||||
|
if (!$this->allowcustom) {
|
||||||
|
$rules[] = Rule::in($this->options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
$this->key => $rules
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMatcher(): Matcher
|
||||||
|
{
|
||||||
|
return app(SingleValueMatcher::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function filter($value): string
|
||||||
|
{
|
||||||
|
if (is_null($value)) {
|
||||||
|
return "{$this->key} IS NULL";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->key . ' = \'' . $value . '\'';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use Faker\Generator;
|
||||||
|
|
||||||
|
class TextField extends Field
|
||||||
|
{
|
||||||
|
|
||||||
|
public bool $required;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Text';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->required ? ['required', 'string'] : ['nullable', 'string']];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Fields;
|
||||||
|
|
||||||
|
use App\Form\Models\Form;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use Faker\Generator;
|
||||||
|
|
||||||
|
class TextareaField extends Field
|
||||||
|
{
|
||||||
|
public bool $required;
|
||||||
|
public int $rows;
|
||||||
|
|
||||||
|
public static function name(): string
|
||||||
|
{
|
||||||
|
return 'Textarea';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function meta(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
['key' => 'rows', 'default' => 5, 'rules' => ['rows' => 'present|integer|gt:0'], 'label' => 'Zeilen'],
|
||||||
|
['key' => 'required', 'default' => true, 'rules' => ['required' => 'present|boolean'], 'label' => 'Erforderlich'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function default(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fake(Generator $faker): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'rows' => $faker->numberBetween(5, 10),
|
||||||
|
'required' => $faker->boolean(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationRules(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->required ? ['required', 'string'] : ['nullable', 'string']];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationAttributes(Form $form): array
|
||||||
|
{
|
||||||
|
return [$this->key => $this->name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getRegistrationMessages(Form $form): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function afterRegistration(Form $form, Participant $participant, array $input): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form;
|
||||||
|
|
||||||
|
use App\Form\Actions\SettingStoreAction;
|
||||||
|
use App\Setting\Contracts\Storeable;
|
||||||
|
use App\Setting\LocalSettings;
|
||||||
|
use Lorisleiva\Actions\ActionRequest;
|
||||||
|
|
||||||
|
class FormSettings extends LocalSettings implements Storeable
|
||||||
|
{
|
||||||
|
public string $registerUrl;
|
||||||
|
public string $clearCacheUrl;
|
||||||
|
|
||||||
|
public static function group(): string
|
||||||
|
{
|
||||||
|
return 'form';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function title(): string
|
||||||
|
{
|
||||||
|
return 'Formulare';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'registerUrl' => 'present|string',
|
||||||
|
'clearCacheUrl' => 'present|string',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeSave(ActionRequest $request): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function viewData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'data' => [
|
||||||
|
'data' => [
|
||||||
|
'registerUrl' => $this->registerUrl,
|
||||||
|
'clearCacheUrl' => $this->clearCacheUrl,
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Mails;
|
||||||
|
|
||||||
|
use App\Form\Data\FormConfigData;
|
||||||
|
use App\Form\Editor\FormConditionResolver;
|
||||||
|
use App\Form\Models\Participant;
|
||||||
|
use App\Lib\Editor\Condition;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Attachment;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class ConfirmRegistrationMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public string $fullname;
|
||||||
|
public FormConfigData $config;
|
||||||
|
/** @var array<int, mixed> */
|
||||||
|
public array $topText;
|
||||||
|
/** @var array<int, mixed> */
|
||||||
|
public array $bottomText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(public Participant $participant)
|
||||||
|
{
|
||||||
|
$conditionResolver = app(FormConditionResolver::class)->forParticipant($participant);
|
||||||
|
$this->fullname = $participant->getFields()->getFullname();
|
||||||
|
$this->config = $participant->getConfig();
|
||||||
|
$this->topText = $conditionResolver->makeBlocks($participant->form->mail_top);
|
||||||
|
$this->bottomText = $conditionResolver->makeBlocks($participant->form->mail_bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Mail\Mailables\Envelope
|
||||||
|
*/
|
||||||
|
public function envelope()
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'Deine Anmeldung zu ' . $this->participant->form->name,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Mail\Mailables\Content
|
||||||
|
*/
|
||||||
|
public function content()
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
markdown: 'mail.form.confirm-registration',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments()
|
||||||
|
{
|
||||||
|
$conditionResolver = app(FormConditionResolver::class)->forParticipant($this->participant);
|
||||||
|
|
||||||
|
return $this->participant->form->getMedia('mailattachments')
|
||||||
|
->filter(fn ($media) => $conditionResolver->filterCondition(Condition::fromMedia($media)))
|
||||||
|
->map(fn ($media) => Attachment::fromStorageDisk($media->disk, $media->getPathRelativeToRoot()))
|
||||||
|
->all();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Matchers;
|
||||||
|
|
||||||
|
class BooleanMatcher extends SingleValueMatcher
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Form\Matchers;
|
||||||
|
|
||||||
|
use App\Lib\Editor\Comparator;
|
||||||
|
|
||||||
|
abstract class Matcher
|
||||||
|
{
|
||||||
|
|
||||||
|
public mixed $value;
|
||||||
|
|
||||||
|
public function setValue(mixed $value): self
|
||||||
|
{
|
||||||
|
$this->value = $value;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public function matches(Comparator $comparator, mixed $value): bool;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue