<?php

namespace App\Http\Controllers;

use App\Models\CareMonth;
use App\Models\CareMonthEntry;
use App\Models\Client;
use App\Models\Pro;
use App\Models\SectionTemplate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;

class CareMonthController extends Controller
{
    public function dashboard(Request $request, Client $patient, CareMonth $careMonth )
    {
        $files = File::allFiles(resource_path('views/app/entry-templates/cm'));
        $cmTemplates = [];
        foreach ($files as $file) {
            $tName = str_replace(".blade.php", "", $file->getFilename());
            if($tName !== 'default' && strpos($tName, '-narration') === FALSE) {
                $cmTemplates[] = $tName;
            }
        }

        $files = File::allFiles(resource_path('views/app/entry-templates/rm'));
        $rmTemplates = [];
        foreach ($files as $file) {
            $tName = str_replace(".blade.php", "", $file->getFilename());
            if($tName !== 'default' && strpos($tName, '-narration') === FALSE) {
                $rmTemplates[] = $tName;
            }
        }

        $pros = $this->pros;
        return view('app.patient.care-month.dashboard', compact('patient', 'careMonth', 'pros', 'cmTemplates', 'rmTemplates'));
    }

}
