Douglas Gough
Douglas Gough
FFilament
Created by Douglas Gough on 11/21/2024 in #❓┊help
Livewire not finding component?
I've created a resource with a view page. When I visit the page I get an error saying Undefined variable $jobStatus. The error is generated from the blade view. I've gone over the code and can't see the error. It's probably something simple but I'm missing it. Any help is appreciated. On the view page I'm calling a livewire component like this:
class ViewPanImport extends ViewRecord
{
protected static string $resource = PanImportResource::class;

protected static string $view = 'livewire.pan-import-progress';

}
class ViewPanImport extends ViewRecord
{
protected static string $resource = PanImportResource::class;

protected static string $view = 'livewire.pan-import-progress';

}
This is the view at the path resources/views/livewire/pan-import-progress.blade.php
<div wire:poll.5s="checkJobStatus">
@if ($jobStatus === 0)
<p>The import is in progress.</p>
<x-filament::loading-indicator class="h-10 w-10 text-primary-500" />
@elseif ($jobStatus === 1)
<p>The import is finished.</p>
@endif
</div>
<div wire:poll.5s="checkJobStatus">
@if ($jobStatus === 0)
<p>The import is in progress.</p>
<x-filament::loading-indicator class="h-10 w-10 text-primary-500" />
@elseif ($jobStatus === 1)
<p>The import is finished.</p>
@endif
</div>
And this is the component at app/livewire/PanImportProgress.php
namespace App\Livewire;

use Livewire\Component;
use App\Models\PanImport;

class PanImportProgress extends Component
{

public $record;
public $jobStatus;
public $panImport;

public function mount($record): void
{
$this->record = $record;
$this->jobStatus = 0;
$this->checkJobStatus();
}

public function checkJobStatus(): void
{
$this->panImport = PanImport::findOrFail($this->record);
$this->jobStatus = $this->panImport->status;
}


public function render()
{
return view('livewire.pan-import-progress', [
'jobStatus' => $this->jobStatus,
]);
}
}
namespace App\Livewire;

use Livewire\Component;
use App\Models\PanImport;

class PanImportProgress extends Component
{

public $record;
public $jobStatus;
public $panImport;

public function mount($record): void
{
$this->record = $record;
$this->jobStatus = 0;
$this->checkJobStatus();
}

public function checkJobStatus(): void
{
$this->panImport = PanImport::findOrFail($this->record);
$this->jobStatus = $this->panImport->status;
}


public function render()
{
return view('livewire.pan-import-progress', [
'jobStatus' => $this->jobStatus,
]);
}
}
4 replies
FFilament
Created by Douglas Gough on 10/15/2024 in #❓┊help
ImportAction bypass FileUpload and pass filename directly
I upload files and convert them to CSV. They are stored on the server and a record is created in the database. I want to display an 'Import' link on each table row that passes the local filepath directly to the Import Action, rather than using FileUpload. I would like to see the modal that maps CSV columns to DB columns instead of seeing FileUpload. Is this possible?
4 replies