mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-13 05:26:47 +00:00
🆕 feat(database): add 'no_email' field to 'einundzwanzig_plebs' table for user email preferences
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration {
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('einundzwanzig_plebs', function (Blueprint $table) {
|
||||||
|
$table->boolean('no_email')->default(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('einundzwanzig_plebs', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -20,6 +20,8 @@ use function Laravel\Folio\{middleware, name};
|
|||||||
name('association.profile');
|
name('association.profile');
|
||||||
|
|
||||||
state([
|
state([
|
||||||
|
'no' => false,
|
||||||
|
'showEmail' => true,
|
||||||
'fax' => '',
|
'fax' => '',
|
||||||
'email' => '',
|
'email' => '',
|
||||||
'yearsPaid' => [],
|
'yearsPaid' => [],
|
||||||
@@ -43,6 +45,8 @@ on([
|
|||||||
])
|
])
|
||||||
->where('pubkey', $pubkey)->first();
|
->where('pubkey', $pubkey)->first();
|
||||||
$this->email = $this->currentPleb->email;
|
$this->email = $this->currentPleb->email;
|
||||||
|
$this->no = $this->currentPleb->no_email;
|
||||||
|
$this->showEmail = !$this->no;
|
||||||
if ($this->currentPleb->association_status === \App\Enums\AssociationStatus::ACTIVE) {
|
if ($this->currentPleb->association_status === \App\Enums\AssociationStatus::ACTIVE) {
|
||||||
$this->amountToPay = config('app.env') === 'production' ? 21000 : 1;
|
$this->amountToPay = config('app.env') === 'production' ? 21000 : 1;
|
||||||
}
|
}
|
||||||
@@ -66,6 +70,12 @@ on([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
updated([
|
updated([
|
||||||
|
'no' => function () {
|
||||||
|
$this->showEmail = !$this->no;
|
||||||
|
$this->currentPleb->update([
|
||||||
|
'no_email' => $this->no,
|
||||||
|
]);
|
||||||
|
},
|
||||||
'fax' => function () {
|
'fax' => function () {
|
||||||
$this->js('alert("Markus Turm wird sich per Fax melden!")');
|
$this->js('alert("Markus Turm wird sich per Fax melden!")');
|
||||||
},
|
},
|
||||||
@@ -476,14 +486,27 @@ $loadEvents = function () {
|
|||||||
sichern
|
sichern
|
||||||
diese Adresse AES-256 verschlüsselt in der Datenbank ab.
|
diese Adresse AES-256 verschlüsselt in der Datenbank ab.
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2">
|
<div
|
||||||
|
class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2 text-amber-500">
|
||||||
|
<x-toggle xl warning
|
||||||
|
wire:model.live="no"
|
||||||
|
label="NEIN">
|
||||||
|
<x-slot name="description">
|
||||||
|
<span class="py-2 text-amber-500">Ich informiere mich selbst in der News Sektion und gebe keine E-Mail Adresse raus.</span>
|
||||||
|
</x-slot>
|
||||||
|
</x-toggle>
|
||||||
|
</div>
|
||||||
|
@if($showEmail)
|
||||||
|
<div wire:key="showEmail"
|
||||||
|
class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2">
|
||||||
<x-input wire:model.live.debounce="fax" label="Fax-Nummer"/>
|
<x-input wire:model.live.debounce="fax" label="Fax-Nummer"/>
|
||||||
<x-input wire:model.live.debounce="email"
|
<x-input wire:model.live.debounce="email"
|
||||||
label="E-Mail Adresse"/>
|
label="E-Mail Adresse"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex space-x-2 mt-2">
|
<div wire:key="showSave" class="flex space-x-2 mt-2">
|
||||||
<x-button wire:click="saveEmail" label="Speichern"/>
|
<x-button wire:click="saveEmail" label="Speichern"/>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user