<?php

use Livewire\Component;

use App\Models\ReportQuarter;
use App\Models\AnimateurVisit;
use App\Services\RepportService;
return new class extends Component
{
    public $data = [];
    public $created = [];
    public $matters = [];
    public $classes = [];
    public $users= [];
    public $school;
    public $cutting;

    public function __contruct($cutting, $school) {
        $this->cutting = $cutting;
        $this->school = $school;
    }

    public function mount() {
        $report = ReportQuarter::where('school_id', $this->school)->where('cutting_school_year_id', $this->cutting)->first();
        $dts = $report ? AnimateurVisit::where('report_quarter_id', $report->id)->orderBy('order')->get():[];
        $this->data = $dts;
    }

    public function myInput(RepportService $service) {    
        $data = $service->getData($this->school);
        $this->created = $this->data;
        $this->users= $data[0];
        $this->matters = $data[1];
        $this->classes = $service->getClass($this->school, $this->cutting);
    }

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