<?php

use App\Models\Introductif;
use App\Models\ReportQuarter;
use Livewire\Component;

return new class extends Component
{
    public $data = null;
    public $input;
    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();
        $text = $report ? Introductif::where('report_quarter_id', $report->id)->first():null;

        $paragraphs = explode("\n", $text ? $text->content:null);
        $paragraphs = array_map(function ($p) {
            return ucfirst(trim($p));
        }, $paragraphs);
        $this->data = implode("\n", $paragraphs);
    }

    public function myInput() {
        $this->input = $this->data;
    }


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