Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not work with filament moduler package #20

Open
milad4444 opened this issue Apr 23, 2023 · 2 comments
Open

not work with filament moduler package #20

milad4444 opened this issue Apr 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@milad4444
Copy link

im using this widget in my Najam named Module in my filament admin panel
and this error shows
cannot read properties of undefined (reading 'modules.najma.filament.widgets.map')

@milad4444 milad4444 added the bug Something isn't working label Apr 23, 2023
@dmandrade
Copy link
Member

Can you provide a code snippet or a repo with a demo?

@gladjanus43
Copy link

gladjanus43 commented Apr 30, 2024

Im having the same issue.
The widget is loading but the following error is thrown
livewire.js?id=239a5c52:1203 Alpine Expression Error: Cannot read properties of undefined (reading 'leaflet-map-widget')

In the packageRegistered method of my module I initialised a livewire component and it is rendering the view succesfully:
Livewire::component('leaflet-map-widget', LeafletMapWidget::class);

This is the widget class, which I added to the module.

<?php

namespace Uxit\ModuleTransportOrder\Livewire;

use Webbingbrasil\FilamentMaps\Actions;
use Webbingbrasil\FilamentMaps\Marker;
use Webbingbrasil\FilamentMaps\Widgets\MapWidget;

class LeafletMapWidget extends MapWidget
{
    protected int | string | array $columnSpan = 2;

    protected bool $hasBorder = false;

    public function getMarkers(): array
    {
        return [
            Marker::make('pos2')->lat(-15.7942)->lng(-47.8822)->popup('Hello Brasilia!'),
        ];
    }

    public function getActions(): array
    {
        return [
            Actions\ZoomAction::make(),
            Actions\CenterMapAction::make()->zoom(2),
        ];
    }
}

In the view I am then rendering the component, which does correctly show the actions etc but the map is not loading due to the above error

<div>
    <div>
        @livewire('leaflet-map-widget')
    </div>
    <div class="p-4 w-full h-screen flex justify-center">
        <div class="">

            <form wire:submit="create">
                {{ $this->form }}
            </form>

            <x-filament-actions::modals />
        </div>
    </div>
</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants