wip
This commit is contained in:
1 parent
6f40d5df30
commit
8d347aeba7
8 files changed
+114
-44
No files matched your search
@@ -23,14 +23,9 @@ use Filament\Actions\ActionGroup;
|
|||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
|
||||||
use Filament\Forms\Components\Checkbox;
|
|
||||||
use Filament\Forms\Components\Hidden;
|
use Filament\Forms\Components\Hidden;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Infolists\Components\TextEntry;
|
|
||||||
use Filament\Schemas\Components\Grid;
|
|
||||||
use Filament\Schemas\Components\Section;
|
|
||||||
use Filament\Schemas\Components\Utilities\Get;
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
use Filament\Support\Enums\FontWeight;
|
use Filament\Support\Enums\FontWeight;
|
||||||
use Filament\Support\Enums\VerticalAlignment;
|
use Filament\Support\Enums\VerticalAlignment;
|
||||||
@@ -40,6 +35,7 @@ use Filament\Tables\Enums\FiltersLayout;
|
|||||||
use Filament\Tables\Filters\Filter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Tables\Filters\Indicator;
|
use Filament\Tables\Filters\Indicator;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@@ -66,7 +62,7 @@ class EventsTable
|
|||||||
->poll('10s')
|
->poll('10s')
|
||||||
->striped()
|
->striped()
|
||||||
->deferLoading()
|
->deferLoading()
|
||||||
->defaultPaginationPageOption(5)
|
->defaultPaginationPageOption(50)
|
||||||
->paginated([5, 10, 15])
|
->paginated([5, 10, 15])
|
||||||
->columns([
|
->columns([
|
||||||
IconColumn::make('sport.icon')
|
IconColumn::make('sport.icon')
|
||||||
@@ -515,30 +511,16 @@ class EventsTable
|
|||||||
->emptyStateDescription('Modify the filter')
|
->emptyStateDescription('Modify the filter')
|
||||||
->recordActions([
|
->recordActions([
|
||||||
Action::make('note')
|
Action::make('note')
|
||||||
|
// ->before(fn () => $this->pollingInterval = null)
|
||||||
|
// ->after(fn () => $this->pollingInterval = '1s')
|
||||||
->iconButton()->icon('phosphor-note')->color('gray')
|
->iconButton()->icon('phosphor-note')->color('gray')
|
||||||
->tooltip('Add a note')
|
->tooltip('Add a note')
|
||||||
->schema([
|
->modalSubmitAction(false)
|
||||||
Grid::make(2)
|
->modalCancelAction(fn (Action $action) => $action->label('Close'))
|
||||||
->schema([
|
->modalContent(fn ($record): View => view(
|
||||||
Section::make('Details')
|
'filament.tables.columns.make-note',
|
||||||
->schema([
|
['record' => $record],
|
||||||
TextInput::make('name'),
|
)),
|
||||||
Select::make('position')
|
|
||||||
->options([
|
|
||||||
'developer' => 'Developer',
|
|
||||||
'designer' => 'Designer',
|
|
||||||
]),
|
|
||||||
Checkbox::make('is_admin'),
|
|
||||||
]),
|
|
||||||
Section::make('Auditing')
|
|
||||||
->schema([
|
|
||||||
TextEntry::make('created_at')
|
|
||||||
->dateTime(),
|
|
||||||
TextEntry::make('updated_at')
|
|
||||||
->dateTime(),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
Action::make('notify')->iconButton()->icon('phosphor-bell')->color('gray')->tooltip('Add a notifications'),
|
Action::make('notify')->iconButton()->icon('phosphor-bell')->color('gray')->tooltip('Add a notifications'),
|
||||||
Action::make('star')
|
Action::make('star')
|
||||||
->iconButton()
|
->iconButton()
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\UserNote;
|
||||||
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
|
use Filament\Actions\Contracts\HasActions;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||||
|
use Filament\Schemas\Contracts\HasSchemas;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Concerns\InteractsWithTable;
|
||||||
|
use Filament\Tables\Contracts\HasTable;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class EditUserNote extends Component implements HasActions, HasSchemas, HasTable
|
||||||
|
{
|
||||||
|
use InteractsWithActions;
|
||||||
|
use InteractsWithSchemas;
|
||||||
|
use InteractsWithTable;
|
||||||
|
|
||||||
|
public $record;
|
||||||
|
|
||||||
|
public ?array $data = [];
|
||||||
|
|
||||||
|
public function mount($record)
|
||||||
|
{
|
||||||
|
$this->record = $record;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
Textarea::make('message')->required()->rows(2)->label('Add a new note'),
|
||||||
|
])
|
||||||
|
->statePath('data');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(): void
|
||||||
|
{
|
||||||
|
dd($this->form->getState());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
// ->headerActions([
|
||||||
|
// Action::make()
|
||||||
|
// ->label('New note')
|
||||||
|
// ->icon('phosphor-plus')
|
||||||
|
// ->action(function () {
|
||||||
|
// UserNote::insert(['event_id' => $this->record->id, 'bookmaker_id' => auth()->user()->bookmaker_id, 'user_id' => auth()->user()->id]);
|
||||||
|
// }),
|
||||||
|
// ])
|
||||||
|
->query(UserNote::query()->where('event_id', $this->record->id)->where('bookmaker_id', auth()->user()->bookmaker_id)->where('user_id', auth()->user()->id))
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('message')->label('Notes'),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
// ...
|
||||||
|
])
|
||||||
|
->recordActions([
|
||||||
|
// ...
|
||||||
|
])
|
||||||
|
->toolbarActions([
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('livewire.edit-user-note');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Message extends Model
|
class UserNote extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'event_id',
|
'event_id',
|
||||||
+2
-2
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('messages', function (Blueprint $table) {
|
Schema::create('user_notes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events');
|
$table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events');
|
||||||
$table->integer('bookmaker_id')->default(0);
|
$table->integer('bookmaker_id')->default(0);
|
||||||
@@ -27,6 +27,6 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('messages');
|
Schema::dropIfExists('user_notes');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -17,10 +17,6 @@ button[wire\:click="resetTableFiltersForm"] {
|
|||||||
/* background-color: #0f172b; */
|
/* background-color: #0f172b; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.fi-ta-content-ctn {
|
|
||||||
min-height: 350px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .fi-ta-header-toolbar {
|
/* .fi-ta-header-toolbar {
|
||||||
@apply flex-row-reverse;
|
@apply flex-row-reverse;
|
||||||
} */
|
} */
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
@livewire('edit-user-note', ['record' => $record])
|
||||||
|
</div>
|
||||||
@@ -6,19 +6,23 @@
|
|||||||
<div class="my-auto flex flex-col gap-4">
|
<div class="my-auto flex flex-col gap-4">
|
||||||
<div x-data="{ pop: '{{ $str }}' }">
|
<div x-data="{ pop: '{{ $str }}' }">
|
||||||
<template x-ref="template">
|
<template x-ref="template">
|
||||||
<p x-html="pop" class="z-1000"></p>
|
<p x-html="pop"></p>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<x-filament::icon-button icon="phosphor-chat-centered-text" color="gray" size="sm"
|
<x-filament::icon-button icon="phosphor-chat-centered-text" color="gray" size="sm"
|
||||||
x-tooltip.html="{ content: () =>
|
x-tooltip.html="{ content: () =>
|
||||||
$refs.template.innerHTML,
|
$refs.template.innerHTML,
|
||||||
placement: 'auto',
|
placement: 'auto',
|
||||||
allowHTML: true,
|
allowHTML: true,
|
||||||
theme: $store.theme,
|
theme: $store.theme,
|
||||||
appendTo: $root,
|
class: 'tooltip',
|
||||||
strategy: 'fixed',
|
appendTo: $root,
|
||||||
interactive: true,
|
strategy: 'fixed',
|
||||||
zIndex: 9999,
|
interactive: false,
|
||||||
|
zIndex: 99999,
|
||||||
|
popperOptions: {
|
||||||
|
strategy: 'fixed',
|
||||||
|
},
|
||||||
}" />
|
}" />
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<div class="flex flex-col gap-10">
|
||||||
|
<div>
|
||||||
|
{{ $this->table }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ $this->form }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in new issue
Block a user