diff --git a/app/Filament/Resources/Kontos/Schemas/KontoForm.php b/app/Filament/Resources/Kontos/Schemas/KontoForm.php index a43b595..0a4b633 100644 --- a/app/Filament/Resources/Kontos/Schemas/KontoForm.php +++ b/app/Filament/Resources/Kontos/Schemas/KontoForm.php @@ -2,15 +2,20 @@ namespace App\Filament\Resources\Kontos\Schemas; -use Alkoumi\FilamentImageRadioButton\Forms\Components\ImageRadioGroup; use App\Models\Konto; use App\Models\Plan; use Danielebarbaro\LaravelVatEuValidator\Rules\VatNumber; use Filament\Forms\Components\Select; use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; -use Filament\Schemas\Components\Section; +use Filament\Schemas\Components\Tabs; +use Filament\Schemas\Components\Tabs\Tab; use Filament\Schemas\Schema; +use Filament\Support\Enums\Alignment; +use Filament\Support\Enums\IconPosition; +use Filament\Support\Enums\IconSize; +use Filament\Support\Icons\Heroicon; +use JaOcero\RadioDeck\Forms\Components\RadioDeck; use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput; class KontoForm @@ -20,57 +25,77 @@ class KontoForm return $schema ->components([ - // Radio Cards with default features - - // ImageRadioGroup::make('plan_id') - // ->animation(true) - // ->disk('promotion') - // ->label('Plan') - // ->required() - // ->columnSpanFull() - // ->options(fn () => Plan::pluck('promotion', 'id')->toArray()), - Section::make('Firma') - ->inlineLabel() - ->schema([ - TextInput::make('company') - ->label('Firma') - ->required(), - TextInput::make('uid_number') - ->label('UID Nummer') - ->rules([new VatNumber]) - ->required(), - Textarea::make('address') - ->label('Adresse') - ->required(), - TextInput::make('country') - ->label('Land') - ->default('Österreich') - ->required(), - ])->columnSpanFull(), - Section::make('Kontaktperson') - ->inlineLabel() - ->schema([ - TextInput::make('title') - ->label('Title') - ->required(), - Select::make('gender') - ->label('Geschlecht') - ->options([ - 'Herr' => 'Herr', - 'Frau' => 'Frau', - 'Non-binary' => 'Non-binary', - ]) - ->required(), - TextInput::make('name') - ->label('Name') - ->required(), - TextInput::make('email') - ->label('E-Mail') - ->unique(table: Konto::class) - ->required(), - PhoneInput::make('phone') - ->label('Telefon') - ->defaultCountry('AT'), + Tabs::make('Tabs') + ->tabs([ + Tab::make('Zahlungsplan') + ->schema([ + RadioDeck::make('plan_id') + ->label('Wählen sie eine Option') + ->options(fn () => Plan::pluck('name', 'id')->toArray()) + ->descriptions(Plan::options()) + ->icons(fn () => Plan::pluck('icon', 'id')->toArray()) + ->required() + ->iconPosition(IconPosition::Before) // Before | After + ->iconSize(IconSize::TwoExtraLarge) + ->alignment(Alignment::Center) // Start | Center | End + ->padding('px-4 py-6') // Padding around the deck + ->extraCardsAttributes([ // Extra attributes for card elements + 'class' => 'rounded-xl drop-shadow-xl mt-1', + ]) + ->extraOptionsAttributes([ // Extra attributes for option elements + 'class' => 'text-2xl md:text-3xl font-black tracking-tight lg:text-4xl', + ]) + // ->extraDescriptionsAttributes([ // Extra attributes for description elements + // 'class' => 'text-sm font-light', + // ]) + ->colors('primary') + ->columns(3) + ->columnSpanFull(), + ])->columnSpanFull(), + Tab::make('Firma') + ->inlineLabel() + ->schema([ + TextInput::make('company') + ->label('Firma') + ->required(), + TextInput::make('uid_number') + ->label('UID Nummer') + ->rules([new VatNumber]) + ->required(), + Textarea::make('address') + ->label('Adresse') + ->required(), + TextInput::make('country') + ->label('Land') + ->default('Österreich') + ->required(), + ])->columnSpanFull(), + Tab::make('Kontaktperson') + ->inlineLabel() + ->schema([ + TextInput::make('title') + ->label('Title') + ->required(), + Select::make('gender') + ->label('Geschlecht') + ->options([ + 'Herr' => 'Herr', + 'Frau' => 'Frau', + 'Non-binary' => 'Non-binary', + ]) + ->required(), + TextInput::make('name') + ->label('Name') + ->required(), + TextInput::make('email') + ->label('E-Mail') + ->unique(table: Konto::class) + ->required() + ->prefixIcon(Heroicon::Envelope), + PhoneInput::make('phone') + ->label('Telefon') + ->defaultCountry('AT'), + ])->columnSpanFull(), ])->columnSpanFull(), ]); diff --git a/app/Filament/Resources/Kontos/Tables/KontosTable.php b/app/Filament/Resources/Kontos/Tables/KontosTable.php index 08e0f1f..b0e5ee9 100644 --- a/app/Filament/Resources/Kontos/Tables/KontosTable.php +++ b/app/Filament/Resources/Kontos/Tables/KontosTable.php @@ -2,13 +2,14 @@ namespace App\Filament\Resources\Kontos\Tables; -use App\Forms\Components\PlanRadioGroup; use Filament\Actions\Action; use Filament\Actions\EditAction; use Filament\Forms\Components\RichEditor; use Filament\Forms\Components\TextInput; use Filament\Support\Enums\FontWeight; +use Filament\Support\Enums\IconSize; use Filament\Support\Enums\TextSize; +use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -20,6 +21,13 @@ class KontosTable ->columns([ TextColumn::make('company')->label('Firma') ->description(fn ($record): string => $record->address), + IconColumn::make('plan.icon') + ->width('30px') + ->label('') + ->size(IconSize::TwoExtraLarge) + ->color('primary') + ->icon(fn (string $state): string => $state) + ->extraAttributes(['class' => 'rounded-xl border border-gray-200 dark:border-gray-700 drop-shadow-xl']), TextColumn::make('plan.name') ->label('Zahlungs Plan') @@ -28,7 +36,7 @@ class KontosTable TextColumn::make('guthaben') ->size(TextSize::Large) ->weight(FontWeight::Bold) - ->label('Fertig') + ->label('Erstellt') ->color('primary') ->description('Gutachten') ->alignCenter(), @@ -43,20 +51,6 @@ class KontosTable ]) ->recordActions([ EditAction::make()->iconButton()->color('gray'), - Action::make('Konto') - ->iconButton() - ->color('gray') - ->icon('lucide-plane-takeoff') - ->schema([ - PlanRadioGroup::make('plan_id') - ->label('Plan') - ->options(fn () => Plan::pluck('name', 'id')->toArray()), - // ->options([ - // '1' => 'Basic', - // '2' => 'Smart', - // '3' => 'Premium', - // ]), - ]), Action::make('Bezahlen') ->iconButton() ->color('gray') diff --git a/app/Filament/Resources/Plans/Schemas/PlanForm.php b/app/Filament/Resources/Plans/Schemas/PlanForm.php index f609767..69ae951 100644 --- a/app/Filament/Resources/Plans/Schemas/PlanForm.php +++ b/app/Filament/Resources/Plans/Schemas/PlanForm.php @@ -2,7 +2,6 @@ namespace App\Filament\Resources\Plans\Schemas; -use Filament\Forms\Components\FileUpload; use Filament\Forms\Components\Textarea; use Filament\Forms\Components\TextInput; use Filament\Schemas\Schema; @@ -18,10 +17,8 @@ class PlanForm Textarea::make('description')->label('Beschreibung')->required(), TextInput::make('preis')->required()->numeric(), TextInput::make('limit_user')->required()->label('Anzahl Benutzer')->numeric(), - TextInput::make('limit_auftraggeber')->required()->label('Anzahl Auftraggeber')->numeric(), TextInput::make('limit_gutachter')->required()->label('Anzahl Gutachter')->numeric(), - TextInput::make('limit_gutachten')->required()->label('Anzahl Projekte')->numeric(), - FileUpload::make('promotion')->disk('promotion'), + TextInput::make('icon'), ])->inlineLabel()->columns(1); } } diff --git a/app/Filament/Resources/Plans/Tables/PlansTable.php b/app/Filament/Resources/Plans/Tables/PlansTable.php index 257128e..22e1e79 100644 --- a/app/Filament/Resources/Plans/Tables/PlansTable.php +++ b/app/Filament/Resources/Plans/Tables/PlansTable.php @@ -3,7 +3,8 @@ namespace App\Filament\Resources\Plans\Tables; use Filament\Actions\EditAction; -use Filament\Tables\Columns\ImageColumn; +use Filament\Support\Enums\IconSize; +use Filament\Tables\Columns\IconColumn; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -13,15 +14,17 @@ class PlansTable { return $table ->columns([ - ImageColumn::make('promotion')->imageHeight(100)->disk('promotion'), + IconColumn::make('icon') + ->label('') + ->size(IconSize::TwoExtraLarge) + ->color('primary') + ->icon(fn (string $state): string => $state), TextColumn::make('name') ->description(fn ($record): string => $record->description) ->wrap(), TextColumn::make('payment')->label('Plan'), - TextColumn::make('limit_user')->label('B')->tooltip('Benutzer')->badge(), - TextColumn::make('limit_auftraggeber')->label('A')->tooltip('Auftraggeber')->badge(), - TextColumn::make('limit_gutachter')->label('G')->tooltip('Gutachter')->badge(), - TextColumn::make('limit_gutachten')->label('P')->tooltip('Projekte')->badge(), + TextColumn::make('limit_user')->label('Benutzer')->badge(), + TextColumn::make('limit_gutachter')->label('Gutachter')->badge(), TextColumn::make('preis')->money('EUR'), ]) ->recordActions([ @@ -29,9 +32,3 @@ class PlansTable ]); } } -// `file` varchar(255) DEFAULT NULL, -// `preis` int(11) NOT NULL DEFAULT 0, -// `limit_user` int(11) NOT NULL DEFAULT 1, -// `limit_auftraggeber` int(11) NOT NULL DEFAULT 1, -// `limit_gutachter` int(11) NOT NULL DEFAULT 1, -// `limit_gutachten` int(11) D diff --git a/app/Forms/Components/PlanRadioGroup.php b/app/Forms/Components/PlanRadioGroup.php deleted file mode 100644 index 957da04..0000000 --- a/app/Forms/Components/PlanRadioGroup.php +++ /dev/null @@ -1,24 +0,0 @@ -options = $options; - - return $this; - } - - public function getOptions(): array - { - return $this->evaluate($this->options); - } -} diff --git a/app/Models/PaymentPlan.php b/app/Models/PaymentPlan.php deleted file mode 100644 index 83a27b1..0000000 --- a/app/Models/PaymentPlan.php +++ /dev/null @@ -1,10 +0,0 @@ -toArray(); + foreach ($arr as $key => $value) { + $str = '
{let{isMatch:M,score:b,indices:x}=Tt(t,p,m,{location:r+_,distance:c,threshold:o,findAllMatches:h,minMatchCharLength:u,includeMatches:i,ignoreLocation:a});M&&(g=!0),f+=b,M&&x&&(d=[...d,...x])});let A={isMatch:g,score:g?f/this.chunks.length:1};return g&&i&&(A.indices=d),A}},B=class{constructor(t){this.pattern=t}static isMultiMatch(t){return ot(t,this.multiRegex)}static isSingleMatch(t){return ot(t,this.singleRegex)}search(){}};function ot(e,t){let s=e.match(t);return s?s[1]:null}var z=class extends B{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){let s=t===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Y=class extends B{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){let n=t.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}},G=class extends B{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){let s=t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Q=class extends B{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){let s=!t.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}},X=class extends B{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){let s=t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},J=class extends B{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){let s=!t.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}},v=class extends B{constructor(t,{location:s=l.location,threshold:n=l.threshold,distance:i=l.distance,includeMatches:r=l.includeMatches,findAllMatches:c=l.findAllMatches,minMatchCharLength:o=l.minMatchCharLength,isCaseSensitive:h=l.isCaseSensitive,ignoreDiacritics:u=l.ignoreDiacritics,ignoreLocation:a=l.ignoreLocation}={}){super(t),this._bitapSearch=new T(t,{location:s,threshold:n,distance:i,includeMatches:r,findAllMatches:c,minMatchCharLength:o,isCaseSensitive:h,ignoreDiacritics:u,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}},P=class extends B{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let s=0,n,i=[],r=this.pattern.length;for(;(n=t.indexOf(this.pattern,s))>-1;)s=n+r,i.push([n,s-1]);let c=!!i.length;return{isMatch:c,score:c?0:1,indices:i}}},Z=[z,P,G,Q,J,X,Y,v],ht=Z.length,Pt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,jt="|";function Kt(e,t={}){return e.split(jt).map(s=>{let n=s.trim().split(Pt).filter(r=>r&&!!r.trim()),i=[];for(let r=0,c=n.length;r
- @endforeach
-