<?php

use App\Services\Chapter1Service;
use Livewire\Component;

new class extends Component
{
    public $levels;
    public $school;
    public $cutting;
    protected $srvs;

    public function boot(Chapter1Service $srvs) {
        $this->srvs = $srvs;
    }

    public function cmptClass($id) {
        return $this->srvs->cpteClass($id, $this->school, $this->cutting);
    }

    public function cmptEffts($id) {
        return $this->srvs->eftfLevel($id, $this->school, $this->cutting);
    }

    public function clclPourctage($id) {
        return $this->srvs->dataStds($id, $this->school, $this->cutting);
    }

    public function mount() {
        $this->levels = $this->srvs->getLevel($this->school, 4);
    }
};
?>

<div>
    @foreach ($levels as $item)
    <div style="font-size: 13px; margin-bottom: 20px; margin-left: 50px">
        <u>Niveau</u> : <strong>{{ $item->code }}</strong>
    </div>
    <div class="table-responsive" style="margin-bottom: 20px">
        @livewire('pdf.list_classe_1', [
            'class' => $item->id, 
            'cutting' => $cutting, 
            'school' => $school,
            'dta' => $this->clclPourctage($item->id),
            'total' => $this->cmptEffts($item->id)
        ])
    </div>
    @endforeach
</div>