<?php

use App\Services\Chapter2Service;
use Livewire\Component;

return new class extends Component
{
    public $data;
    public $school;
    public $cutting;
    public $total = 0;
    protected $srvs;

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

    public function mount() {
        $this->data = $this->srvs->getLevel($this->school);
        $this->total = $this->srvs->nbreTotal($this->school, $this->cutting, 'secondaire');
    }

    public function compte($level) {
        $nbre = $this->srvs->nbreBourse($level, $this->school, $this->cutting);
        return $nbre < 9 ? '0'.$nbre:$nbre;
    }

    protected function view($data = [])
    {
        return app('view')->file('C:\Users\EDUCAS\Desktop\App\V4_001\storage\framework/views/livewire/views/d221a406.blade.php', $data);
    }
};
