Hi,
at first i created a computed field
Text::make('Status', function () {
return view('partials.status', [
'is_passing' => $this->isPassing(),
'is_paid' => $this->isPaid(),
'id' => $this->id,
])->render();
})->asHtml(),
than i created also the methods isPassing and isPaid in my resource
protected function isPassing(){
return $this->canceled == 1;
}
protected function isPaid(){
return $this->invoice_paid == 1;
}
finally the bladefile for the view
@if ($is_passing)
<div class="test" style="background: red;">
<span><b>CANCELED</b></span>
<style>
[dusk="{{$id}}-row"]{
background: #ffdddd !Important;
}
</style>
</div>
@elseif ($is_paid)
<span><b>DONE</b></span>
@if ($is_passing)
<span><b>CANCELED</b></span>
@endif
<style>
[dusk="{{$id}}-row"]{
background: #dff0d8 !Important;
}
</style>
@endif
nova doesnt have classes for eacht row, so i used dusk..