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. -