From 603eed4c461521a53942e8be037df2a8a029dd24 Mon Sep 17 00:00:00 2001 From: fsociety Date: Fri, 25 Oct 2024 19:17:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=95=20feat(database):=20add=20'no=5Fem?= =?UTF-8?q?ail'=20field=20to=20'einundzwanzig=5Fplebs'=20table=20for=20use?= =?UTF-8?q?r=20email=20preferences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ail_field_to_einundzwanzig_plebs_table.php | 27 ++++++++++++++ .../views/pages/association/profile.blade.php | 37 +++++++++++++++---- 2 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 database/migrations/2024_10_25_171026_add_no_email_field_to_einundzwanzig_plebs_table.php diff --git a/database/migrations/2024_10_25_171026_add_no_email_field_to_einundzwanzig_plebs_table.php b/database/migrations/2024_10_25_171026_add_no_email_field_to_einundzwanzig_plebs_table.php new file mode 100644 index 0000000..7be6a3a --- /dev/null +++ b/database/migrations/2024_10_25_171026_add_no_email_field_to_einundzwanzig_plebs_table.php @@ -0,0 +1,27 @@ +boolean('no_email')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('einundzwanzig_plebs', function (Blueprint $table) { + // + }); + } +}; diff --git a/resources/views/pages/association/profile.blade.php b/resources/views/pages/association/profile.blade.php index 9ac10dd..b4472c4 100644 --- a/resources/views/pages/association/profile.blade.php +++ b/resources/views/pages/association/profile.blade.php @@ -20,6 +20,8 @@ use function Laravel\Folio\{middleware, name}; name('association.profile'); state([ + 'no' => false, + 'showEmail' => true, 'fax' => '', 'email' => '', 'yearsPaid' => [], @@ -43,6 +45,8 @@ on([ ]) ->where('pubkey', $pubkey)->first(); $this->email = $this->currentPleb->email; + $this->no = $this->currentPleb->no_email; + $this->showEmail = !$this->no; if ($this->currentPleb->association_status === \App\Enums\AssociationStatus::ACTIVE) { $this->amountToPay = config('app.env') === 'production' ? 21000 : 1; } @@ -66,6 +70,12 @@ on([ ]); updated([ + 'no' => function () { + $this->showEmail = !$this->no; + $this->currentPleb->update([ + 'no_email' => $this->no, + ]); + }, 'fax' => function () { $this->js('alert("Markus Turm wird sich per Fax melden!")'); }, @@ -476,14 +486,27 @@ $loadEvents = function () { sichern diese Adresse AES-256 verschlüsselt in der Datenbank ab. -
- - -
-
- +
+ + + Ich informiere mich selbst in der News Sektion und gebe keine E-Mail Adresse raus. + +
+ @if($showEmail) +
+ + +
+
+ +
+ @endif