wip
This commit is contained in:
@@ -28,19 +28,11 @@ class PilgrimResource extends Resource
|
||||
|
||||
protected static ?string $pluralLabel = 'Zyýaratçylar';
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @return Schema
|
||||
*/
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return PilgrimForm::configure($schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Table $table
|
||||
* @return Table
|
||||
*/
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return PilgrimsTable::configure($table);
|
||||
|
||||
@@ -10,10 +10,6 @@ use Filament\Schemas\Schema;
|
||||
|
||||
class PilgrimForm
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @return Schema
|
||||
*/
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\Programs\Pages;
|
||||
|
||||
use App\Filament\Resources\Programs\ProgramResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
@@ -14,6 +15,7 @@ class ViewProgram extends ViewRecord
|
||||
{
|
||||
return [
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,20 @@
|
||||
|
||||
namespace App\Filament\Resources\Programs;
|
||||
|
||||
use App\Filament\Resources\Programs\Schemas\ProgramForm;
|
||||
use App\Filament\Resources\Programs\Tables\ProgramsTable;
|
||||
use App\Models\Program;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProgramResource extends Resource
|
||||
@@ -26,12 +34,73 @@ class ProgramResource extends Resource
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return ProgramForm::configure($schema);
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label('Programmanyň ady')
|
||||
->required()
|
||||
->default('Adaty')
|
||||
->columnSpanFull(),
|
||||
|
||||
Select::make('group_id')
|
||||
->relationship('group', 'id')
|
||||
->label('Topar')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
|
||||
Repeater::make('days')
|
||||
->label('Günler')
|
||||
->schema([
|
||||
DatePicker::make('day')
|
||||
->label('Gün (dd.mm.yyyy)')
|
||||
->native(false)
|
||||
->required(),
|
||||
Repeater::make('activities')
|
||||
->label('Işler')
|
||||
->schema([
|
||||
TextInput::make('time')->label('Wagty'),
|
||||
TextInput::make('title')->label('Ady')->required(),
|
||||
TextInput::make('description')->label('Düşündirişi'),
|
||||
|
||||
Select::make('iconSet')->label('Ikon toplumy')->options([
|
||||
'FontAwesome' => 'FontAwesome',
|
||||
'FontAwesome5' => 'FontAwesome5',
|
||||
])->default('FontAwesome5')->required(),
|
||||
|
||||
TextInput::make('iconName')->label('Ikon ady')->required(),
|
||||
Select::make('transport')->label('Ulag')->options([
|
||||
'bus' => 'Bus',
|
||||
'car' => 'Car',
|
||||
'train' => 'Train',
|
||||
'plane' => 'Plane',
|
||||
])->default('bus')->required(),
|
||||
])
|
||||
->columns(2),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return ProgramsTable::configure($table);
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')->label('Programmanyň ady')->searchable(),
|
||||
TextColumn::make('group.name')->label('Topar')->searchable(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
ViewAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
@@ -43,4 +112,37 @@ class ProgramResource extends Resource
|
||||
'view' => Pages\ViewProgram::route('/{record}'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
if (! is_array($data['days'])) {
|
||||
$data['days'] = [];
|
||||
} else {
|
||||
$days = [];
|
||||
foreach ($data['days'] as $date => $activities) {
|
||||
$days[] = [
|
||||
'day' => $date,
|
||||
'activities' => $activities,
|
||||
];
|
||||
}
|
||||
$data['days'] = $days;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
$days = [];
|
||||
if (is_array($data['days'])) {
|
||||
foreach ($data['days'] as $day) {
|
||||
if (isset($day['day']) && isset($day['activities'])) {
|
||||
$days[date('d.m.Y', strtotime($day['day']))] = $day['activities'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['days'] = $days;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Programs\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\TimePicker;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ProgramForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('group_id')
|
||||
->relationship('group', 'name')
|
||||
->label('Topar')
|
||||
->required(),
|
||||
Repeater::make('days')
|
||||
->label('Günler')
|
||||
->itemLabel(fn (array $state): ?string => ($state['day_number'] ?? '').'-nji gün')
|
||||
->schema([
|
||||
TextInput::make('day_number')
|
||||
->numeric()
|
||||
->required()
|
||||
->label('Günüň belgisi'),
|
||||
Repeater::make('actions')
|
||||
->label('Actionlar')
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->label('Ady')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Textarea::make('description')
|
||||
->label('Düşündirişi')
|
||||
->columnSpanFull(),
|
||||
TimePicker::make('time')
|
||||
->label('Wagty'),
|
||||
TextInput::make('icon')
|
||||
->label('Ikony')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
])
|
||||
->columns(2),
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Programs\Tables;
|
||||
|
||||
use Filament\Tables\Actions\BulkActionGroup;
|
||||
use Filament\Tables\Actions\DeleteBulkAction;
|
||||
use Filament\Tables\Actions\EditAction;
|
||||
use Filament\Tables\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProgramsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('group.name')
|
||||
->label('Topar')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('days')
|
||||
->label('Gün sany')
|
||||
->getStateUsing(fn ($record) => count($record->days).' gün')
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->label('Döredilen wagty')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->label('Üýtgedilen wagty')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->actions([
|
||||
ViewAction::make(),
|
||||
EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Users;
|
||||
|
||||
use UnitEnum;
|
||||
use App\Filament\Resources\Users\Pages\CreateUser;
|
||||
use App\Filament\Resources\Users\Pages\EditUser;
|
||||
use App\Filament\Resources\Users\Pages\ListUsers;
|
||||
@@ -13,12 +12,13 @@ use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
protected static ?string $model = User::class;
|
||||
|
||||
protected static string | UnitEnum | null $navigationGroup = 'Sazlamalar';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Sazlamalar';
|
||||
|
||||
protected static ?string $navigationLabel = 'Ulanyjylar';
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ class Program extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'group_id',
|
||||
'days',
|
||||
];
|
||||
|
||||
@@ -13,6 +13,7 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('programs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->foreignId('group_id')->constrained()->cascadeOnDelete();
|
||||
$table->json('days');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -14,6 +14,8 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call([
|
||||
UserTableSeeder::class,
|
||||
TeacherTableSeeder::class,
|
||||
GroupSeeder::class,
|
||||
ProgramSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
22
database/seeders/GroupSeeder.php
Normal file
22
database/seeders/GroupSeeder.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Group;
|
||||
use App\Models\Teacher;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class GroupSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
Group::create([
|
||||
'leader_teacher_id' => Teacher::where('name', 'Nurmuhammet')->first()->id,
|
||||
'start_date' => '2025-09-19',
|
||||
'end_date' => '2025-10-03',
|
||||
]);
|
||||
}
|
||||
}
|
||||
217
database/seeders/ProgramSeeder.php
Normal file
217
database/seeders/ProgramSeeder.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Group;
|
||||
use App\Models\Program;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProgramSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$days = [
|
||||
'19.09.2025' => [
|
||||
[
|
||||
'time' => '05:10',
|
||||
'title' => 'Jidda gonmak',
|
||||
'description' => 'Jidda aýraportynda zyýarata gelenleri garşy almak',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'plane',
|
||||
'transport' => 'plane',
|
||||
],
|
||||
[
|
||||
'time' => '',
|
||||
'title' => 'Medinä gitmek',
|
||||
'description' => 'Simkart almak we awtobusa ýerleşmek',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'bus',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => '',
|
||||
'title' => 'Otele ýerleşmek',
|
||||
'description' => 'Otaglara ýerleşmek',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'hotel',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => 'günüň dowamynda',
|
||||
'title' => 'Pygamberimiziň (saw) metjidi',
|
||||
'description' => 'Pygamberimiziň (saw) metjidine zyýarata gitmek',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'mosque',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'20.09.2025' => [
|
||||
[
|
||||
'time' => 'günüň dowamynda',
|
||||
'title' => 'Pygamberimiziň (saw) metjidi',
|
||||
'description' => 'Pygamberimiziň (saw) metjidine zyýarata gitmek',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'mosque',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'21.09.2025' => [
|
||||
[
|
||||
'time' => '07:00',
|
||||
'title' => 'Zyýarat ýerleri',
|
||||
'description' => 'Medine şäherindäki ähli zyýarat ýerlerine zyýarat etmek, Kuba metjidi, Kyblateýin metjidi, Uhud daglary, Hurma baglary',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'gopuram',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => '',
|
||||
'title' => 'Kuran zawody',
|
||||
'description' => 'Eger açyk bolup mümkinçilik bolsa',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'quran',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => 'günüň dowamynda',
|
||||
'title' => 'Pygamberimiziň (saw) metjidi',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'mosque',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'22.09.2025' => [
|
||||
[
|
||||
'time' => '',
|
||||
'title' => 'Myhmanhanadan çykmak',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'hotel',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => '14:00',
|
||||
'title' => 'Mekkä gitmek (Umra)',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'bus',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => '',
|
||||
'title' => 'Best Western oteline ýerleşmek',
|
||||
'description' => 'Otaglara ýerleşmek',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'hotel',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => 'günüň dowamynda',
|
||||
'title' => 'Umra zyýaraty',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'kaaba',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'24.09.2025' => [
|
||||
[
|
||||
'time' => '15:00',
|
||||
'title' => 'Optom bazary',
|
||||
'description' => 'Kakiyya Bazaryna gitmek',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'shopping-bag',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'25.09.2025' => [
|
||||
[
|
||||
'time' => '07:00',
|
||||
'title' => 'Aýşa metjidi (Umra)',
|
||||
'description' => 'Aýşa enemiziň metjidine gitmek',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'mosque',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'26.09.2025' => [
|
||||
[
|
||||
'time' => 'günüň dowamynda',
|
||||
'title' => 'Juma',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'mosque',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'27.09.2025' => [
|
||||
[
|
||||
'time' => '07:00',
|
||||
'title' => 'Gyzyl deňizi we Howa enemize zyýarat',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'water',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'28.09.2025' => [
|
||||
[
|
||||
'time' => '07:00',
|
||||
'title' => 'Mekke zyýaratlary',
|
||||
'description' => 'Arafat dagy, Nur dagy, Sawr dagy, Mina-Muzdalifa daglaryna zyýarat etmek',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'gopuram',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'29.09.2025' => [
|
||||
[
|
||||
'time' => '07:00',
|
||||
'title' => 'Taif şäheri (Umra)',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'mountain',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'01.10.2025' => [
|
||||
[
|
||||
'time' => '23:00',
|
||||
'title' => 'Nur dagyna çykmak',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome5',
|
||||
'iconName' => 'mountain',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
'03.10.2025' => [
|
||||
[
|
||||
'time' => '12:00',
|
||||
'title' => 'Myhmanhanada çykmak',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'hotel',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
[
|
||||
'time' => '',
|
||||
'title' => 'Jidda Aýraporda tarap',
|
||||
'description' => '',
|
||||
'iconSet' => 'FontAwesome',
|
||||
'iconName' => 'bus',
|
||||
'transport' => 'bus',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
Program::create([
|
||||
'name' => 'Adaty Programma',
|
||||
'group_id' => Group::first()->id,
|
||||
'days' => json_encode($days),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user