fixes
This commit is contained in:
1 parent
e97c7cd0f4
commit
95315d1453
8 files changed
+88
-70
No files matched your search
@@ -3,7 +3,7 @@
|
|||||||
namespace App\Filament\Resources\Events\Tables;
|
namespace App\Filament\Resources\Events\Tables;
|
||||||
|
|
||||||
use App\Filament\Resources\Events\Tables\Tools\CompareOptions;
|
use App\Filament\Resources\Events\Tables\Tools\CompareOptions;
|
||||||
use App\Filament\Resources\Events\Tables\Tools\LoadBettype;
|
use App\Filament\Resources\Events\Tables\Tools\LoadBettypeSettings;
|
||||||
use App\Filament\Resources\Events\Tables\Tools\LoadCompareDifferences;
|
use App\Filament\Resources\Events\Tables\Tools\LoadCompareDifferences;
|
||||||
use App\Filament\Resources\Events\Tables\Tools\LoadMultiline;
|
use App\Filament\Resources\Events\Tables\Tools\LoadMultiline;
|
||||||
use App\Filament\Tables\Columns\ColumnOdds;
|
use App\Filament\Tables\Columns\ColumnOdds;
|
||||||
@@ -59,7 +59,7 @@ class EventsTable
|
|||||||
{
|
{
|
||||||
LoadMultiline::load();
|
LoadMultiline::load();
|
||||||
|
|
||||||
LoadBettype::load();
|
LoadBettypeSettings::load();
|
||||||
|
|
||||||
return $table
|
return $table
|
||||||
->striped()
|
->striped()
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ namespace App\Filament\Resources\Events\Tables\Tools;
|
|||||||
use App\Filament\Resources\Events\Tables\EventsTable;
|
use App\Filament\Resources\Events\Tables\EventsTable;
|
||||||
use App\Models\BettypeUser;
|
use App\Models\BettypeUser;
|
||||||
|
|
||||||
class LoadBettype
|
class LoadBettypeSettings
|
||||||
{
|
{
|
||||||
public static function load()
|
public static function load()
|
||||||
{
|
{
|
||||||
@@ -29,16 +29,19 @@ class PersonalNotificationTable extends Component implements HasActions, HasSche
|
|||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->query(PersonalNotification::query()->with('bookmaker')->where('user_id', auth()->user()->id))
|
->query(PersonalNotification::query()
|
||||||
|
->with('bookmaker')
|
||||||
|
->where('alarm_level_id', '>', 1)
|
||||||
|
->where('user_id', auth()->user()->id))
|
||||||
->description('Send a notification when favorit enters an alarm level.')
|
->description('Send a notification when favorit enters an alarm level.')
|
||||||
->striped()
|
->striped()
|
||||||
->columns([
|
->columns([
|
||||||
BookmakerIcon::make('bookmaker.icon')
|
|
||||||
->label('Bookmaker')->size('lg'),
|
|
||||||
TextColumn::make('alarm_level.name')
|
TextColumn::make('alarm_level.name')
|
||||||
->color(fn ($record) => $record->alarm_level->color)
|
->color(fn ($record) => $record->alarm_level->color)
|
||||||
->weight(FontWeight::Black)
|
->weight(FontWeight::Black),
|
||||||
->extraCellAttributes(['class' => 'alarm-level-style']),
|
BookmakerIcon::make('bookmaker.icon')
|
||||||
|
->alignCenter()
|
||||||
|
->label('Bookmaker')->size('sm'),
|
||||||
])
|
])
|
||||||
->defaultSort('alarm_level_id', 'desc')
|
->defaultSort('alarm_level_id', 'desc')
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
|
|||||||
@@ -4,19 +4,18 @@ namespace App\Livewire;
|
|||||||
|
|
||||||
use App\Mail\UserNotification;
|
use App\Mail\UserNotification;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Actions\Action;
|
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Actions\Contracts\HasActions;
|
use Filament\Actions\Contracts\HasActions;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\MarkdownEditor;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\Toggle;
|
use Filament\Forms\Components\Toggle;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||||
use Filament\Schemas\Contracts\HasSchemas;
|
use Filament\Schemas\Contracts\HasSchemas;
|
||||||
use Filament\Support\Enums\Width;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
|
||||||
use Filament\Tables\Concerns\InteractsWithTable;
|
use Filament\Tables\Concerns\InteractsWithTable;
|
||||||
use Filament\Tables\Contracts\HasTable;
|
use Filament\Tables\Contracts\HasTable;
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@@ -27,53 +26,53 @@ class UserNotifications extends Component implements HasActions, HasSchemas, Has
|
|||||||
use InteractsWithSchemas;
|
use InteractsWithSchemas;
|
||||||
use InteractsWithTable;
|
use InteractsWithTable;
|
||||||
|
|
||||||
protected Table $table2;
|
public ?array $data = [];
|
||||||
|
|
||||||
public function table(Table $table): Table
|
public function mount(): void
|
||||||
{
|
{
|
||||||
return $table
|
$this->form->fill();
|
||||||
->query(User::query()->where('client_id', auth()->user()->client_id)->orwhereIn('id', [1, 2]))
|
}
|
||||||
->description('Send a message to one of the user listed')
|
|
||||||
->columns([
|
public function form(Schema $schema): Schema
|
||||||
TextColumn::make('name')->icon('phosphor-user-duotone')->searchable(),
|
{
|
||||||
TextColumn::make('email')->icon('phosphor-envelope-duotone'),
|
return $schema
|
||||||
|
->components([
|
||||||
|
Select::make('recipient')
|
||||||
|
->placeholder('Select an recipient')
|
||||||
|
->required()
|
||||||
|
->options(fn () => User::query()->where('client_id', auth()->user()->client_id)->orwhereIn('id', [1, 2])->pluck('name', 'id')),
|
||||||
|
Toggle::make('notify_by_email')->label('Send also as E-Mail'),
|
||||||
|
TextInput::make('subject')
|
||||||
|
->required(),
|
||||||
|
MarkdownEditor::make('message')
|
||||||
|
->required(),
|
||||||
])
|
])
|
||||||
->recordActions([
|
->statePath('data');
|
||||||
Action::make('notification')
|
}
|
||||||
->icon('phosphor-note-pencil-duotone')
|
|
||||||
->tooltip('Create a notification')
|
|
||||||
->modalHeading(fn ($record) => 'Send a notification to '.$record->name)
|
|
||||||
->iconButton()
|
|
||||||
->modalWidth(Width::Large)
|
|
||||||
// ->modalDescription('Send a notification')
|
|
||||||
->modalSubmitActionLabel('Send')
|
|
||||||
->modalIcon('phosphor-envelope-duotone')
|
|
||||||
->schema([
|
|
||||||
Textarea::make('message')
|
|
||||||
->required()
|
|
||||||
->rows(4),
|
|
||||||
Toggle::make('notify_by_email')->label('Send also as email')
|
|
||||||
// ->belowContent('Notify me also by e-mail')
|
|
||||||
->onColor('info')
|
|
||||||
->offColor('gray'),
|
|
||||||
])->action(function (array $data, $record) {
|
|
||||||
|
|
||||||
if ($data['notify_by_email']) {
|
public function create(): void
|
||||||
Mail::to($record)
|
{
|
||||||
->send(new UserNotification($data['message']));
|
$data = $this->form->getState();
|
||||||
}
|
|
||||||
Notification::make()
|
|
||||||
->title('Notification from '.$record->name)
|
|
||||||
->icon('phosphor-envelope-duotone')
|
|
||||||
->body($data['message'])
|
|
||||||
->sendToDatabase($record);
|
|
||||||
|
|
||||||
Notification::make()
|
$recipient = User::find((int) $data['recipient']);
|
||||||
->title('Message send successfully')
|
|
||||||
->success()
|
if ($recipient) {
|
||||||
->send();
|
if ($data['notify_by_email']) {
|
||||||
}),
|
Mail::to($recipient)->send(new UserNotification($data['subject'], $data['message']));
|
||||||
]);
|
}
|
||||||
|
Notification::make()
|
||||||
|
->title($data['subject'])
|
||||||
|
->icon('phosphor-envelope-duotone')
|
||||||
|
->body($data['message'])
|
||||||
|
->sendToDatabase($recipient);
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Message send successfully')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
$this->dispatch('close-modal', id: 'send_message_modal');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@@ -14,11 +14,15 @@ class UserNotification extends Mailable
|
|||||||
|
|
||||||
protected string $message;
|
protected string $message;
|
||||||
|
|
||||||
|
protected string $subject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct($message)
|
public function __construct($subject, $message)
|
||||||
{
|
{
|
||||||
|
$this->subject = $subject;
|
||||||
|
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +32,7 @@ class UserNotification extends Mailable
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: 'NUH-Odds Notification',
|
subject: $this->subject,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div>
|
<div>
|
||||||
<x-sport-header>
|
<x-sport-header>
|
||||||
{{ auth()->user()->sport->name }}
|
{{ auth()->user()->sport->name }}
|
||||||
</x-sport-header>
|
</x-sport-header>
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,9 @@
|
|||||||
</x-filament::dropdown.list>
|
</x-filament::dropdown.list>
|
||||||
</x-filament::dropdown>
|
</x-filament::dropdown>
|
||||||
|
|
||||||
{{-- Notifications --}}
|
{{-- Notifications --}}
|
||||||
|
|
||||||
<x-filament::modal width="2xl" icon="phosphor-warning-duotone" :close-by-clicking-away="true" :close-by-escaping="true"
|
{{-- <x-filament::modal width="2xl" icon="phosphor-warning-duotone" :close-by-clicking-away="true" :close-by-escaping="true"
|
||||||
:close-button="true">
|
:close-button="true">
|
||||||
<x-slot name="trigger">
|
<x-slot name="trigger">
|
||||||
<x-filament::button outlined icon="phosphor-warning-duotone" class="my-auto" color="gray"
|
<x-filament::button outlined icon="phosphor-warning-duotone" class="my-auto" color="gray"
|
||||||
@@ -75,12 +75,12 @@
|
|||||||
|
|
||||||
@livewire('personal-notification-table')
|
@livewire('personal-notification-table')
|
||||||
|
|
||||||
</x-filament::modal>
|
</x-filament::modal> --}}
|
||||||
|
|
||||||
{{-- Send Message --}}
|
{{-- Send Message --}}
|
||||||
|
|
||||||
<x-filament::modal slide-over width="2xl" icon="phosphor-paper-plane-tilt-duotone" :close-by-clicking-away="true" :close-by-escaping="true"
|
<x-filament::modal width="2xl" id="send_message_modal" icon="phosphor-paper-plane-tilt-duotone"
|
||||||
:close-button="true">
|
:close-by-clicking-away="true" :close-by-escaping="true" :close-button="true">
|
||||||
<x-slot name="trigger">
|
<x-slot name="trigger">
|
||||||
<x-filament::button outlined icon="phosphor-paper-plane-tilt-duotone" class="my-auto" color="gray"
|
<x-filament::button outlined icon="phosphor-paper-plane-tilt-duotone" class="my-auto" color="gray"
|
||||||
tooltip="Send Message">
|
tooltip="Send Message">
|
||||||
@@ -97,17 +97,18 @@
|
|||||||
|
|
||||||
{{-- Event Mapper --}}
|
{{-- Event Mapper --}}
|
||||||
|
|
||||||
<x-filament::modal width="screen" icon="phosphor-arrows-in-line-horizontal" :close-by-clicking-away="true" :close-by-escaping="true" :close-button="true">
|
<x-filament::modal width="screen" icon="phosphor-arrows-in-line-horizontal" :close-by-clicking-away="true" :close-by-escaping="true"
|
||||||
|
:close-button="true">
|
||||||
<x-slot name="trigger">
|
<x-slot name="trigger">
|
||||||
<x-filament::button outlined icon="phosphor-arrows-in-line-horizontal" color="gray"
|
<x-filament::button outlined icon="phosphor-arrows-in-line-horizontal" color="gray" class="my-auto"
|
||||||
class="my-auto" tooltip="Event Mapper">
|
tooltip="Event Mapper">
|
||||||
</x-filament::button>
|
</x-filament::button>
|
||||||
</x-slot>
|
</x-slot>
|
||||||
|
|
||||||
<x-slot name="heading">
|
<x-slot name="heading">
|
||||||
<div class="flex justify-end items-center gap-20">
|
<div class="flex justify-end items-center gap-20">
|
||||||
<x-sport-header>
|
<x-sport-header>
|
||||||
Event Mapper {{ auth()->user()->sport->name }}
|
Event Mapper {{ auth()->user()->sport->name }}
|
||||||
</x-sport-header>
|
</x-sport-header>
|
||||||
@php
|
@php
|
||||||
if (!auth()->user()->provider_id) {
|
if (!auth()->user()->provider_id) {
|
||||||
@@ -230,7 +231,8 @@
|
|||||||
|
|
||||||
{{-- Calculation --}}
|
{{-- Calculation --}}
|
||||||
|
|
||||||
<x-filament::modal slide-over width="4xl" icon="phosphor-sliders" :close-by-clicking-away="true" :close-by-escaping="true" :close-button="true">
|
<x-filament::modal slide-over width="4xl" icon="phosphor-sliders" :close-by-clicking-away="true" :close-by-escaping="true"
|
||||||
|
:close-button="true">
|
||||||
<x-slot name="trigger">
|
<x-slot name="trigger">
|
||||||
<x-filament::button icon="phosphor-sliders" color="gray" class="my-auto" wire:click="setUser"
|
<x-filament::button icon="phosphor-sliders" color="gray" class="my-auto" wire:click="setUser"
|
||||||
tooltip="Comparing Bookmaker">
|
tooltip="Comparing Bookmaker">
|
||||||
@@ -246,7 +248,8 @@
|
|||||||
</x-filament::modal>
|
</x-filament::modal>
|
||||||
|
|
||||||
{{-- Custom Groups --}}
|
{{-- Custom Groups --}}
|
||||||
<x-filament::modal width="4xl" icon="phosphor-user-list" :close-by-clicking-away="true" :close-by-escaping="true" :close-button="true">
|
<x-filament::modal width="4xl" icon="phosphor-user-list" :close-by-clicking-away="true" :close-by-escaping="true"
|
||||||
|
:close-button="true">
|
||||||
<x-slot name="trigger">
|
<x-slot name="trigger">
|
||||||
<x-filament::button outlined icon="phosphor-user-list" color="gray" class="my-auto"
|
<x-filament::button outlined icon="phosphor-user-list" color="gray" class="my-auto"
|
||||||
tooltip="Custom Groups">
|
tooltip="Custom Groups">
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
<div>
|
<div>
|
||||||
{{ $this->table }}
|
<form wire:submit="create">
|
||||||
|
{{ $this->form }}
|
||||||
|
|
||||||
|
<x-filament::button type="submit" class="my-5" icon="phosphor-paper-plane-tilt-duotone">
|
||||||
|
Send Message
|
||||||
|
</x-filament::button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<x-filament-actions::modals />
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user