nostrodamned
nostrodamned
FFilament
Created by nostrodamned on 5/23/2024 in #❓┊help
Having issues with Test using laravel-modules and FilamentPHP
Thanks!
10 replies
FFilament
Created by nostrodamned on 5/23/2024 in #❓┊help
Having issues with Test using laravel-modules and FilamentPHP
ahh getting somewhere
test('can register User', function () {

livewire(Register::class)
->fillForm([
'name' => 'John Ford',
'email' => 'test@test.com',
'password' => 'password',
'passwordConfirmation' => 'password'
])
->call('register')
->assertHasNoErrors(['name', 'email', 'password', 'passwordConfirmation']);

$this->assertDatabaseHas('users',[
'name' => 'John Doe',
'email' => 'test@test.com',
]);
});
test('can register User', function () {

livewire(Register::class)
->fillForm([
'name' => 'John Ford',
'email' => 'test@test.com',
'password' => 'password',
'passwordConfirmation' => 'password'
])
->call('register')
->assertHasNoErrors(['name', 'email', 'password', 'passwordConfirmation']);

$this->assertDatabaseHas('users',[
'name' => 'John Doe',
'email' => 'test@test.com',
]);
});
GOT IT!! 🙂 it has to use the register class from filament 🙂 @Dennis Koch you pointed me in right direction
10 replies
FFilament
Created by nostrodamned on 5/23/2024 in #❓┊help
Having issues with Test using laravel-modules and FilamentPHP
mmm it would be the default registration page for filament so the Users class may not make sense?
10 replies
FFilament
Created by nostrodamned on 5/23/2024 in #❓┊help
Having issues with Test using laravel-modules and FilamentPHP
but this is the user registration - before the tenant creation? @Dennis Koch
10 replies
FFilament
Created by nostrodamned on 5/23/2024 in #❓┊help
Having issues with Test using laravel-modules and FilamentPHP
but the tenant isnt created yet?
10 replies
FFilament
Created by nostrodamned on 5/23/2024 in #❓┊help
Having issues with Test using laravel-modules and FilamentPHP
ok getting closer I now get this Modules\Auth\tests\Feature\RegistrationTest > can register User ViewException
Missing required parameter for [Route: filament.admin.resources.users.index] [URI: admin/users] [Missing parameter: tenant]. (View: /Users/craigvonchamier/Herd/TAC/vendor/filament/filament/resources/views/components/page/index.blade.php) (View: /Users/craigvonchamier/Herd/TAC/vendor/filament/filament/resources/views/components/page/index.blade.php) (View: /Users/craigvonchamier/Herd/TAC/vendor/filament/filament/resources/views/components/page/index.blade.php) Using the User::class
10 replies
FFilament
Created by Dwayne on 3/29/2024 in #❓┊help
The session is not shared across multiple domains with tenancy
if you set the SESSION_DOMAIN=.yourdomain.com in env sessions will be persisted across subdomains @Dwayne @awcodes - just did this with socialite login and seems to work
17 replies
FFilament
Created by Jocka on 2/4/2024 in #❓┊help
How to consume an external API with Filament Tables
8 replies
FFilament
Created by nostrodamned on 4/20/2024 in #❓┊help
Add header Actions to a slideover
ah darnit ok thanks 🙂
6 replies
FFilament
Created by nostrodamned on 4/12/2024 in #❓┊help
Best Way to create invoice number preview
@toeknee thanks for your help it led me in right direction!
<?php


class Invoices extends Page implements HasForms
{
...

public ?array $data = [];

public function form(Form $form): Form
{
return $form->schema(
[ TextInput::make('finance_invoice_start_number')
->live(onBlur: true)
->afterStateUpdated(function ($state, Set $set, Get $get) {
$preview = self::generatePreview($get);
dump('Updating start number, new preview: '.$preview);
$set('invoicePreview', $preview);
}),

TextInput::make('finance_invoice_suffix')
->live(onBlur: true)
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', self::generatePreview($get))
)
->hintIcon('heroicon-m-question-mark-circle', tooltip: 'The suffix for the invoice number.'),

TextInput::make('finance_invoice_number_padding')
->live(onBlur: true)
->numeric()
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', self::generatePreview($get))
),

Placeholder::make('invoicePreview')
->live()
->content(fn (Get $get) => self::generatePreview($get)),

// ...Finance\Forms\InvoiceSettingsForm::getForm(),

])->statePath('data');

}

public static function generatePreview(Get $get): string
{
$startNumber = $get('finance_invoice_start_number');
$suffix = $get('finance_invoice_suffix');
$padding = max(0, intval($get('finance_invoice_number_padding')));
$formattedNumber = str_pad($startNumber, $padding, '0', STR_PAD_LEFT);

return $formattedNumber.$suffix;
}
}
<?php


class Invoices extends Page implements HasForms
{
...

public ?array $data = [];

public function form(Form $form): Form
{
return $form->schema(
[ TextInput::make('finance_invoice_start_number')
->live(onBlur: true)
->afterStateUpdated(function ($state, Set $set, Get $get) {
$preview = self::generatePreview($get);
dump('Updating start number, new preview: '.$preview);
$set('invoicePreview', $preview);
}),

TextInput::make('finance_invoice_suffix')
->live(onBlur: true)
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', self::generatePreview($get))
)
->hintIcon('heroicon-m-question-mark-circle', tooltip: 'The suffix for the invoice number.'),

TextInput::make('finance_invoice_number_padding')
->live(onBlur: true)
->numeric()
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', self::generatePreview($get))
),

Placeholder::make('invoicePreview')
->live()
->content(fn (Get $get) => self::generatePreview($get)),

// ...Finance\Forms\InvoiceSettingsForm::getForm(),

])->statePath('data');

}

public static function generatePreview(Get $get): string
{
$startNumber = $get('finance_invoice_start_number');
$suffix = $get('finance_invoice_suffix');
$padding = max(0, intval($get('finance_invoice_number_padding')));
$formattedNumber = str_pad($startNumber, $padding, '0', STR_PAD_LEFT);

return $formattedNumber.$suffix;
}
}
9 replies
FFilament
Created by nostrodamned on 4/12/2024 in #❓┊help
Best Way to create invoice number preview
I did try
TextInput::make('finance_invoice_start_number')
->live(onBlur: true)
->afterStateUpdated(function ($state, Set $set, Get $get) {
$preview = $this->generatePreview($get);
dump('Updating start number, new preview: '.$preview);
$set('invoicePreview', $preview);
})
,

TextInput::make('finance_invoice_suffix')
->live(onBlur: true)
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', $this->generatePreview($get))
)
,

TextInput::make('finance_invoice_number_padding')
->live(onBlur: true)
->numeric()
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', $this->generatePreview($get))
)
->hintIcon('heroicon-m-question-mark-circle', tooltip: 'The number of digits to pad the invoice number with.'),

Placeholder::make('invoicePreview')
->live()
->content(fn (Get $get) => $get('invoicePreview')),
])
TextInput::make('finance_invoice_start_number')
->live(onBlur: true)
->afterStateUpdated(function ($state, Set $set, Get $get) {
$preview = $this->generatePreview($get);
dump('Updating start number, new preview: '.$preview);
$set('invoicePreview', $preview);
})
,

TextInput::make('finance_invoice_suffix')
->live(onBlur: true)
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', $this->generatePreview($get))
)
,

TextInput::make('finance_invoice_number_padding')
->live(onBlur: true)
->numeric()
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('invoicePreview', $this->generatePreview($get))
)
->hintIcon('heroicon-m-question-mark-circle', tooltip: 'The number of digits to pad the invoice number with.'),

Placeholder::make('invoicePreview')
->live()
->content(fn (Get $get) => $get('invoicePreview')),
])
with this function
private function generatePreview(Get $get): string
{
$startNumber = $get('finance_invoice_start_number');
$suffix = $get('finance_invoice_suffix');
$padding = max(0, intval($get('finance_invoice_number_padding')));
$formattedNumber = str_pad($startNumber, $padding, '0', STR_PAD_LEFT);
return $formattedNumber.$suffix;
}
private function generatePreview(Get $get): string
{
$startNumber = $get('finance_invoice_start_number');
$suffix = $get('finance_invoice_suffix');
$padding = max(0, intval($get('finance_invoice_number_padding')));
$formattedNumber = str_pad($startNumber, $padding, '0', STR_PAD_LEFT);
return $formattedNumber.$suffix;
}
but it doesnt update the placeholder @toeknee
9 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
ok and on your settings resource?
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
ok last attempt for me - so on your clusters do you have protected static ?int $navigationSort = 1;
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
this will completely override the nav and you can do what you wish with it >navigation(function (NavigationBuilder $builder): NavigationBuilder { return $builder->items([ NavigationItem::make('Dashboard') ->icon('heroicon-o-home') ->isActiveWhen(fn (): bool => request()->routeIs('filament.admin.pages.dashboard')) ->url(fn (): string => Dashboard::getUrl()), ....
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
Sorry i have given you all the ideas I have, and as @Blackpig says...
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
you can put logic to change the state when you are on the url
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
have you tried it?
54 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
as a render hook
54 replies