mokhosh / filament-kanban

Add kanban boards to your Filament pages
https://filamentphp.com/plugins/mokhosh-kanban
MIT License
228 stars 32 forks source link

[Bug]: Card Break when drag to other status #25

Closed putrafajarh closed 4 months ago

putrafajarh commented 4 months ago

What happened?

When i drag to other status or edit modal, the view break, but the functionality okay

Screenshot 2024-03-13 at 14 38 22

already npm run dev

Did i miss something?

How to reproduce the bug

<?php

namespace App\Filament\Pages;

use Mokhosh\FilamentKanban\Pages\KanbanBoard;
use App\Models\Lead;
use App\Models\Funnel;
use Illuminate\Support\Collection;
use Filament\Forms;

class DentalKanbanBoard extends KanbanBoard
{
    protected static string $model = Lead::class;
    // protected static string $statusEnum = ModelStatus::class;

    protected static string $recordTitleAttribute = 'sales_id';

    protected static string $recordStatusAttribute = 'funnel_id';

    protected function statuses(): Collection
    {
        $funnels = Funnel::where('division_id', 1)->get();
        return $funnels->map(function ($funnel) {
            return [
                'id' => $funnel->id,
                'title' => $funnel->title,
            ];
        });
    }

    protected function getEditModalFormSchema(?int $recordId): array
    {
        return [
            Forms\Components\TextInput::make('sales_id')->required(),
        ];
    }
}

Package Version

^2.7

PHP Version

8.2

Laravel Version

10

Which operating systems does with happen with?

macOS

Which browsers does with happen with?

No response

Notes

No response

mokhosh commented 4 months ago

I copy/pasted your code and tried to recreate missing parts by guessing, and it worked without any issues.

Can you create a reproduction repository so I can see your issue? Or maybe provide more info?

putrafajarh commented 4 months ago

it's really weird,

somehow this < operator breaks the laravel blade, I just try with simple logic @if(1 < 3)

when i try to move ur logic from

@if($record->timestamps && now()->diffInSeconds($record->{$record::UPDATED_AT}) < 3)

to

@if($record->timestamps && 3 > now()->diffInSeconds($record->{$record::UPDATED_AT}))

now it works really well..

mokhosh commented 4 months ago

huh. maybe looking at the generated php view could help us track down the bug.

or maybe something else specific to your code makes this happen cause it seems to be working fine in my apps.

i would still appreciate a reproduction repo.

putrafajarh commented 4 months ago

Sorry @mokhosh, i cant reproduce it too with fresh install,

I think its a problem with my project, and it is not a bug for this filament-kanban