TranceCode
TranceCode
FFilament
Created by TranceCode on 11/13/2024 in #❓┊help
Insert import and export button here!
Thank you bro, i will check this option!
3 replies
FFilament
Created by TranceCode on 11/5/2024 in #❓┊help
How can add a new button in the login for different panel?
No description
10 replies
FFilament
Created by TranceCode on 11/5/2024 in #❓┊help
How can add a new button in the login for different panel?
Sorry guys, i forget the hooks, thank you so much!
10 replies
FFilament
Created by TranceCode on 10/12/2024 in #❓┊help
Help with TinyMCE, duplicate the textarea
maybe it's a better options by @MohamedSabil83
4 replies
FFilament
Created by TranceCode on 10/12/2024 in #❓┊help
Help with TinyMCE, duplicate the textarea
Don't worry bro, i fix this, but now i see this plugins https://filamentphp.com/plugins/mohamedsabil83-tinyeditor
4 replies
FFilament
Created by TranceCode on 6/23/2024 in #❓┊help
SPA mode brings up the menu at the beginning!
Not yet bro, not in my project! do you have the same problem now? i update to last version, i try without my personal theme and the problem continue!
12 replies
FFilament
Created by TranceCode on 8/15/2024 in #❓┊help
how can disable days of week?
Forms\Components\Hidden::make('availabledays')
->reactive(),
Forms\Components\DatePicker::make('fecha')
->label('Fecha')
->minDate(now()->toDateString()) // Fecha mínima de solicitud la actual o mayor
->required()
->reactive()
->native(false)
->firstDayOfWeek(1)
->disabledDates(function (callable $get) {
$availableDays = $get('availabledays') ?? []; // Asegura que sea un array
$reservedDates = $get('disabledDays') ?? []; // Asegura que sea un array
$disabledDates = [];
// Mapear días de la semana
$dayMap = [
'Lunes' => 1,
'Martes' => 2,
'Miercoles' => 3,
'Jueves' => 4,
'Viernes' => 5,
'Sabado' => 6,
'Domingo' => 7,
];
// Filtrar los días permitidos
$allowedDays = array_map(fn($day) => $dayMap[$day] ?? null, $availableDays);
$allowedDays = array_filter($allowedDays, fn($day) => $day !== null);
$unavailableDays = array_diff([0, 1, 2, 3, 4, 5, 6], $allowedDays);
// Generar las fechas deshabilitadas según días no permitidos
$start = Carbon::now();
$end = $start->copy()->addMonths(3); // Ejemplo de rango de 3 meses
while ($start->lessThanOrEqualTo($end)) {
if (in_array($start->dayOfWeek, $unavailableDays)) {
$disabledDates[] = $start->format('Y-m-d');
}
$start->addDay();
}
// Combinar con fechas reservadas
if ($reservedDates) {
$disabledDates = array_merge($disabledDates, $reservedDates);
}
return $disabledDates; // Devuelve un array combinado de fechas deshabilitadas
}),
Forms\Components\Hidden::make('availabledays')
->reactive(),
Forms\Components\DatePicker::make('fecha')
->label('Fecha')
->minDate(now()->toDateString()) // Fecha mínima de solicitud la actual o mayor
->required()
->reactive()
->native(false)
->firstDayOfWeek(1)
->disabledDates(function (callable $get) {
$availableDays = $get('availabledays') ?? []; // Asegura que sea un array
$reservedDates = $get('disabledDays') ?? []; // Asegura que sea un array
$disabledDates = [];
// Mapear días de la semana
$dayMap = [
'Lunes' => 1,
'Martes' => 2,
'Miercoles' => 3,
'Jueves' => 4,
'Viernes' => 5,
'Sabado' => 6,
'Domingo' => 7,
];
// Filtrar los días permitidos
$allowedDays = array_map(fn($day) => $dayMap[$day] ?? null, $availableDays);
$allowedDays = array_filter($allowedDays, fn($day) => $day !== null);
$unavailableDays = array_diff([0, 1, 2, 3, 4, 5, 6], $allowedDays);
// Generar las fechas deshabilitadas según días no permitidos
$start = Carbon::now();
$end = $start->copy()->addMonths(3); // Ejemplo de rango de 3 meses
while ($start->lessThanOrEqualTo($end)) {
if (in_array($start->dayOfWeek, $unavailableDays)) {
$disabledDates[] = $start->format('Y-m-d');
}
$start->addDay();
}
// Combinar con fechas reservadas
if ($reservedDates) {
$disabledDates = array_merge($disabledDates, $reservedDates);
}
return $disabledDates; // Devuelve un array combinado de fechas deshabilitadas
}),
6 replies
FFilament
Created by TranceCode on 8/15/2024 in #❓┊help
how can disable days of week?
that it's not working bro, but thank you, i fix my problem whit this code!
Forms\Components\Select::make('common_area_id')
->label('Tipo de área')
->required()
->relationship('commonareas', 'nombre')
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set) use ($tenant) {
$commonArea = CommonArea::find($state);
if ($commonArea) {
$set('valor', $commonArea->valor);
$set('tramoreserva', "{$commonArea->rangefrom} - {$commonArea->rangeuntil}");
$set('availabledays', $commonArea->availabledays ?? []); // Asegura que sea un array

// Obtener reservas existentes para el área común seleccionada
$reservasExistentes = ReserveArea::where('common_area_id', $state)
->where('company_id', $tenant->id) // Filtrar por tenant logeado
->where('fecha', '>=', now()->toDateString()) // Solo reservas futuras
->pluck('fecha');

// Deshabilitar los días que ya están reservados
$set('disabledDays', $reservasExistentes->toArray());
} else {
$set('valor', '');
$set('tramoreserva', '');
$set('availabledays', []);
$set('disabledDays', []);
}
}),
Forms\Components\Select::make('common_area_id')
->label('Tipo de área')
->required()
->relationship('commonareas', 'nombre')
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set) use ($tenant) {
$commonArea = CommonArea::find($state);
if ($commonArea) {
$set('valor', $commonArea->valor);
$set('tramoreserva', "{$commonArea->rangefrom} - {$commonArea->rangeuntil}");
$set('availabledays', $commonArea->availabledays ?? []); // Asegura que sea un array

// Obtener reservas existentes para el área común seleccionada
$reservasExistentes = ReserveArea::where('common_area_id', $state)
->where('company_id', $tenant->id) // Filtrar por tenant logeado
->where('fecha', '>=', now()->toDateString()) // Solo reservas futuras
->pluck('fecha');

// Deshabilitar los días que ya están reservados
$set('disabledDays', $reservasExistentes->toArray());
} else {
$set('valor', '');
$set('tramoreserva', '');
$set('availabledays', []);
$set('disabledDays', []);
}
}),
6 replies
FFilament
Created by TranceCode on 8/15/2024 in #❓┊help
how can disable days of week?
So my plan is that if Monday exists in my array, it will only be shown as available to select the date Monday, the others that are disabled, if in another row I have Monday, Wednesday and Friday, that these 3 days are available, the others that are deactivated...
6 replies
FFilament
Created by TranceCode on 8/15/2024 in #❓┊help
how can disable days of week?
Forms\Components\Select::make('common_area_id')
->label('Tipo de área')
->required()
->relationship('commonareas', 'nombre')
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$commonArea = CommonArea::find($state);
if($commonArea) {
$set('valor', $commonArea->valor);
$set('tramoreserva', "{$commonArea->rangefrom} - {$commonArea->rangeuntil}");
$set('availabledays', $commonArea->availabledays);
// Show available days
//dd($commonArea->availabledays);
} else {
$set('valor', '');
$set('tramoreserva', '');
$set('availabledays', []);
}
}),
Forms\Components\Hidden::make('availabledays')
->reactive(),
Forms\Components\DatePicker::make('fecha')
->label('Fecha')
->minDate(now()->toDateString()) // Fecha mínima de solicitud la actual o mayor
->required()
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$commonArea = CommonArea::find($get('common_area_id'));
if ($commonArea && !empty($commonArea->availabledays)) {
$set('availabledays', $commonArea->availabledays);
} else {
$set('availabledays', []);
}
})
->disabledDates(function (callable $get) {
$availableDays = $get('availabledays');
if (!$availableDays) {
return [];
}
// Mapeo de los días de la semana a sus índices correspondientes
$dayMap = [
'Domingo' => 0,
'Lunes' => 1,
'Martes' => 2,
'Miercoles' => 3,
'Jueves' => 4,
'Viernes' => 5,
'Sabado' => 6,
];
$allowedDays = array_map(fn($day) => $dayMap[$day] ?? null, $availableDays);
$allowedDays = array_filter($allowedDays, fn($day) => $day !== null);
$unavailableDays = array_diff([0,1,2,3,4,5,6], $allowedDays);
return function (\Carbon\Carbon $date) use ($unavailableDays) {
return in_array($date->dayOfWeek, $unavailableDays);
};
}),
Forms\Components\Select::make('common_area_id')
->label('Tipo de área')
->required()
->relationship('commonareas', 'nombre')
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$commonArea = CommonArea::find($state);
if($commonArea) {
$set('valor', $commonArea->valor);
$set('tramoreserva', "{$commonArea->rangefrom} - {$commonArea->rangeuntil}");
$set('availabledays', $commonArea->availabledays);
// Show available days
//dd($commonArea->availabledays);
} else {
$set('valor', '');
$set('tramoreserva', '');
$set('availabledays', []);
}
}),
Forms\Components\Hidden::make('availabledays')
->reactive(),
Forms\Components\DatePicker::make('fecha')
->label('Fecha')
->minDate(now()->toDateString()) // Fecha mínima de solicitud la actual o mayor
->required()
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$commonArea = CommonArea::find($get('common_area_id'));
if ($commonArea && !empty($commonArea->availabledays)) {
$set('availabledays', $commonArea->availabledays);
} else {
$set('availabledays', []);
}
})
->disabledDates(function (callable $get) {
$availableDays = $get('availabledays');
if (!$availableDays) {
return [];
}
// Mapeo de los días de la semana a sus índices correspondientes
$dayMap = [
'Domingo' => 0,
'Lunes' => 1,
'Martes' => 2,
'Miercoles' => 3,
'Jueves' => 4,
'Viernes' => 5,
'Sabado' => 6,
];
$allowedDays = array_map(fn($day) => $dayMap[$day] ?? null, $availableDays);
$allowedDays = array_filter($allowedDays, fn($day) => $day !== null);
$unavailableDays = array_diff([0,1,2,3,4,5,6], $allowedDays);
return function (\Carbon\Carbon $date) use ($unavailableDays) {
return in_array($date->dayOfWeek, $unavailableDays);
};
}),
6 replies
FFilament
Created by TranceCode on 8/13/2024 in #❓┊help
How can I create a custom dashboard?
In fact, I'm using the Apexchart plugin, brother... thanks man... I wanted to at least modify something like this in my dashboard, maybe that will be more than enough for me...
4 replies
FFilament
Created by TranceCode on 6/23/2024 in #❓┊help
SPA mode brings up the menu at the beginning!
this is my vite configuration:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
'resources/css/filament/company/theme.css',
],
refresh: true,
}),
],
});
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
'resources/css/filament/company/theme.css',
],
refresh: true,
}),
],
});
12 replies
FFilament
Created by TranceCode on 6/23/2024 in #❓┊help
SPA mode brings up the menu at the beginning!
It is supposed that in spa mode it should only update the content of the form section, not the sidebar and topbar menu... I think that is basically where the problem
12 replies
FFilament
Created by TranceCode on 6/23/2024 in #❓┊help
SPA mode brings up the menu at the beginning!
@awcodes disable the theme in my PanelProvider, this line
->viteTheme('resources/css/filament/company/theme.css')
->viteTheme('resources/css/filament/company/theme.css')
but the problem persist, do you have any idea about this problem or any recommendation? Thank you!
12 replies
FFilament
Created by TranceCode on 8/4/2024 in #❓┊help
how can show information in topbar?
No description
3 replies
FFilament
Created by TranceCode on 8/4/2024 in #❓┊help
how can show information in topbar?
I have already found the solution in Panel Provider add this:
->renderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
fn (): View => \view('filament.top'),
)
->renderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
fn (): View => \view('filament.top'),
)
Create a view in resources/filament/top.blade.php and use this line for the position!
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
Here we have more position for show the information in the project https://filamentphp.com/docs/3.x/support/render-hooks#panel-builder-render-hooks
3 replies
FFilament
Created by TranceCode on 7/30/2024 in #❓┊help
DatePicker type moth not working in Firefox and Safari
yeah bro, i saw that! but i don't know if a filament component have a solution for this problem!
3 replies
FFilament
Created by TranceCode on 7/28/2024 in #❓┊help
Multitenant with separated database?
Yes, of course friend, I imagine it is possible, but I'm just asking in case you have ever thought about it, since that would avoid depending on another third-party package for something that has filament configured but it would be great to be able to have it with separate databases, I'm just asking out of curiosity... Thanks bro
6 replies
FFilament
Created by TranceCode on 7/3/2024 in #❓┊help
How can confirm or cancel the action in toggle
Thank you bro, but the row action it's working perfect for me... thank you so much
7 replies
FFilament
Created by TranceCode on 7/3/2024 in #❓┊help
How can confirm or cancel the action in toggle
No description
7 replies