Modificación del userController para el cambnio de rol si es alumno o docente
This commit is contained in:
@@ -0,0 +1,213 @@
|
||||
@extends('layouts.landing')
|
||||
|
||||
@section('title', 'Acta de Calificaciones')
|
||||
|
||||
@section('head')
|
||||
<style>
|
||||
@media print {
|
||||
.no-print { display: none !important; }
|
||||
body { font-size: 12px; }
|
||||
.card { border: none !important; box-shadow: none !important; }
|
||||
.card-header { background: none !important; border-bottom: 2px solid #333 !important; }
|
||||
table { font-size: 11px; }
|
||||
}
|
||||
.calificacion-cell { min-width: 70px; text-align: center; }
|
||||
.promedio-cell { min-width: 80px; text-align: center; font-weight: bold; }
|
||||
th.rotate { height: 130px; white-space: nowrap; vertical-align: bottom; }
|
||||
th.rotate > div { transform: rotate(-60deg); transform-origin: bottom left; width: 30px; padding-bottom: 5px; }
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<div class="d-sm-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h6 class="m-0 font-weight-bold text-primary">
|
||||
Acta de Calificaciones
|
||||
</h6>
|
||||
<small class="text-muted">
|
||||
{{ $material->name }} · Grupo: {{ $grupo->clave }}
|
||||
</small>
|
||||
</div>
|
||||
<div class="no-print">
|
||||
<a href="{{ route('grupo.material.tareas', [$grupo, $material]) }}"
|
||||
class="btn btn-sm btn-secondary shadow-sm mr-2">
|
||||
<i class="fas fa-arrow-left fa-sm"></i> Regresar
|
||||
</a>
|
||||
<button onclick="window.print()" class="btn btn-sm btn-primary shadow-sm">
|
||||
<i class="fas fa-print fa-sm"></i> Imprimir
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
{{-- Resumen --}}
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-3 col-sm-6 mb-3">
|
||||
<div class="card border-left-primary shadow-sm h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
|
||||
Total de Tareas
|
||||
</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ $tareas->count() }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 mb-3">
|
||||
<div class="card border-left-success shadow-sm h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">
|
||||
Total de Alumnos
|
||||
</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ $alumnos->count() }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 mb-3">
|
||||
<div class="card border-left-info shadow-sm h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
|
||||
Materia
|
||||
</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ $material->name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6 mb-3">
|
||||
<div class="card border-left-warning shadow-sm h-100 py-2">
|
||||
<div class="card-body">
|
||||
<div class="text-xs font-weight-bold text-warning text-uppercase mb-1">
|
||||
Generado
|
||||
</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
||||
{{ \Carbon\Carbon::now()->format('d/m/Y') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($tareas->isEmpty())
|
||||
<div class="alert alert-info">No hay tareas registradas para esta materia.</div>
|
||||
@elseif ($alumnos->isEmpty())
|
||||
<div class="alert alert-info">No hay alumnos inscritos en este grupo.</div>
|
||||
@else
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-sm" style="width:100%">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th class="align-middle" style="min-width:40px">#</th>
|
||||
<th class="align-middle" style="min-width:180px">Alumno</th>
|
||||
@foreach ($tareas as $tarea)
|
||||
<th class="rotate calificacion-cell">
|
||||
<div title="{{ $tarea->titulo }}">
|
||||
{{ Str::limit($tarea->titulo, 25) }}
|
||||
</div>
|
||||
</th>
|
||||
@endforeach
|
||||
<th class="align-middle promedio-cell text-center"
|
||||
style="background:#1a3a5c; color:#fff;">
|
||||
Promedio Final
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php $fila = 1; @endphp
|
||||
@foreach ($alumnos as $alumno)
|
||||
@php
|
||||
$user = $alumno->alumnos->first();
|
||||
$nombre = $user?->name ?? 'Sin nombre';
|
||||
$calificaciones = [];
|
||||
$sumaCal = 0;
|
||||
$countCal = 0;
|
||||
|
||||
foreach ($tareas as $tarea) {
|
||||
$entrega = $entregas[$alumno->id][$tarea->id] ?? null;
|
||||
$cal = ($entrega && $entrega->status === 'calificada')
|
||||
? $entrega->calificacion
|
||||
: null;
|
||||
$calificaciones[$tarea->id] = [
|
||||
'valor' => $cal,
|
||||
'status' => $entrega?->status ?? 'sin_subir',
|
||||
];
|
||||
if ($cal !== null) {
|
||||
$sumaCal += $cal;
|
||||
$countCal++;
|
||||
}
|
||||
}
|
||||
|
||||
$promedio = $countCal > 0 ? round($sumaCal / $countCal, 1) : null;
|
||||
@endphp
|
||||
<tr>
|
||||
<td class="text-center align-middle">{{ $fila++ }}</td>
|
||||
<td class="align-middle">{{ $nombre }}</td>
|
||||
@foreach ($tareas as $tarea)
|
||||
@php $data = $calificaciones[$tarea->id]; @endphp
|
||||
<td class="calificacion-cell align-middle">
|
||||
@if ($data['valor'] !== null)
|
||||
<span class="{{ $data['valor'] >= 6 ? 'text-success' : 'text-danger' }} font-weight-bold">
|
||||
{{ number_format($data['valor'], 1) }}
|
||||
</span>
|
||||
@elseif ($data['status'] === 'pendiente')
|
||||
<span class="text-warning" title="Pendiente de calificar">
|
||||
<i class="fas fa-clock"></i>
|
||||
</span>
|
||||
@elseif ($data['status'] === 'sin_subir')
|
||||
<span class="text-muted" title="Sin entregar">—</span>
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
<td class="promedio-cell align-middle" style="background:#f8f9fc;">
|
||||
@if ($promedio !== null)
|
||||
<span class="badge badge-pill {{ $promedio >= 6 ? 'badge-success' : 'badge-danger' }}"
|
||||
style="font-size:.95rem; padding:.4em .7em;">
|
||||
{{ number_format($promedio, 1) }}
|
||||
</span>
|
||||
@else
|
||||
<span class="text-muted">S/C</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 no-print">
|
||||
<small class="text-muted">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
El promedio final se calcula únicamente sobre las tareas ya calificadas.
|
||||
<strong>—</strong> = sin entregar |
|
||||
<i class="fas fa-clock text-warning"></i> = entregada, pendiente de calificación |
|
||||
<strong>S/C</strong> = sin calificaciones registradas.
|
||||
</small>
|
||||
</div>
|
||||
|
||||
{{-- Firma para impresión --}}
|
||||
<div class="row mt-5 d-none d-print-flex">
|
||||
<div class="col-4 text-center">
|
||||
<div style="border-top:1px solid #333; padding-top:8px; margin-top:50px;">
|
||||
Firma del Docente
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div style="border-top:1px solid #333; padding-top:8px; margin-top:50px;">
|
||||
Firma del Director
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div style="border-top:1px solid #333; padding-top:8px; margin-top:50px;">
|
||||
Sello de la Institución
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -24,6 +24,10 @@
|
||||
<a href="{{ route('grupo.administrar', $grupo) }}" class="btn btn-sm btn-secondary shadow-sm mr-2">
|
||||
<i class="fas fa-arrow-left fa-sm"></i> Regresar
|
||||
</a>
|
||||
<a href="{{ route('grupo.material.tareas.acta', [$grupo, $material]) }}"
|
||||
class="btn btn-sm btn-success shadow-sm mr-2">
|
||||
<i class="fas fa-file-alt fa-sm text-white-50"></i> Generar Acta
|
||||
</a>
|
||||
<a href="{{ route('grupo.material.tareas.create', [$grupo, $material]) }}"
|
||||
class="btn btn-sm btn-primary shadow-sm">
|
||||
<i class="fas fa-plus fa-sm text-white-50"></i> Nueva Tarea
|
||||
|
||||
@@ -1,147 +1,315 @@
|
||||
@extends('layouts.landing')
|
||||
|
||||
@section('head')
|
||||
@include('layouts._partials.tablaStyle')
|
||||
@endsection
|
||||
|
||||
@section('title', 'Mis Tareas')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">Mis Tareas</h6>
|
||||
|
||||
{{-- Alertas de sesión --}}
|
||||
@if (session('info'))
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
<strong>{{ session('info') }}</strong>
|
||||
<button type="button" class="close" data-dismiss="alert"><span>×</span></button>
|
||||
</div>
|
||||
@endif
|
||||
@if (session('error'))
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<strong>{{ session('error') }}</strong>
|
||||
<button type="button" class="close" data-dismiss="alert"><span>×</span></button>
|
||||
</div>
|
||||
@endif
|
||||
@if ($errors->has('entrega'))
|
||||
<div class="alert alert-warning alert-dismissible fade show">
|
||||
<strong>{{ $errors->first('entrega') }}</strong>
|
||||
<button type="button" class="close" data-dismiss="alert"><span>×</span></button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Sin ciclo activo --}}
|
||||
@if (!$cicloActual)
|
||||
<div class="alert alert-info">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
No hay un ciclo escolar activo en este momento. Contacta a tu coordinador.
|
||||
</div>
|
||||
@else
|
||||
|
||||
{{-- ══════════════════════════════════════════════════
|
||||
SECCIÓN 1: TAREAS POR ENTREGAR (ciclo actual)
|
||||
══════════════════════════════════════════════════ --}}
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3 d-flex align-items-center justify-content-between">
|
||||
<h6 class="m-0 font-weight-bold text-primary">
|
||||
<i class="fas fa-tasks mr-1"></i> Tareas por Entregar
|
||||
</h6>
|
||||
<span class="badge badge-primary badge-pill">{{ $cicloActual->name }}</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if ($tareasPendientes->isEmpty())
|
||||
<div class="alert alert-success mb-0">
|
||||
<i class="fas fa-check-circle"></i> ¡Estás al corriente! No tienes tareas pendientes de entrega.
|
||||
</div>
|
||||
@else
|
||||
@php $pendientesAgrupadas = $tareasPendientes->groupBy('material_id'); @endphp
|
||||
|
||||
@foreach ($pendientesAgrupadas as $materialId => $grupoTareas)
|
||||
@php
|
||||
$material = $grupoTareas->first()->material;
|
||||
$grupo = $grupoTareas->first()->grupo;
|
||||
$vencidas = $grupoTareas->filter(fn($t) =>
|
||||
$t->fecha_entrega && \Carbon\Carbon::parse($t->fecha_entrega)->isPast()
|
||||
)->count();
|
||||
@endphp
|
||||
|
||||
<div class="card border mb-3 shadow-sm">
|
||||
<div class="card-header d-flex justify-content-between align-items-center"
|
||||
data-toggle="collapse"
|
||||
data-target="#pend-mat-{{ $materialId }}"
|
||||
aria-expanded="true"
|
||||
style="cursor:pointer; user-select:none;">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="fas fa-book-open mr-2 text-primary"></i>
|
||||
<div>
|
||||
<h6 class="mb-0 font-weight-bold">{{ $material->name }}</h6>
|
||||
<small class="text-muted">Grupo: {{ $grupo->clave }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center">
|
||||
@if ($vencidas > 0)
|
||||
<span class="badge badge-danger badge-pill mr-1"
|
||||
title="{{ $vencidas }} tarea(s) vencida(s)">
|
||||
{{ $vencidas }} vencida(s)
|
||||
</span>
|
||||
@endif
|
||||
<span class="badge badge-warning badge-pill mr-2">
|
||||
{{ $grupoTareas->count() }} por entregar
|
||||
</span>
|
||||
<i class="fas fa-chevron-down text-muted accordion-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="pend-mat-{{ $materialId }}" class="collapse show">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Tarea</th>
|
||||
<th style="width:130px">Fecha límite</th>
|
||||
<th>Entregar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($grupoTareas as $tarea)
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<strong>{{ $tarea->titulo }}</strong>
|
||||
@if ($tarea->descripcion)
|
||||
<p class="text-muted small mb-0">
|
||||
{{ Str::limit($tarea->descripcion, 100) }}
|
||||
</p>
|
||||
@endif
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
@if ($tarea->fecha_entrega)
|
||||
{{ \Carbon\Carbon::parse($tarea->fecha_entrega)->format('d/m/Y') }}
|
||||
@if (\Carbon\Carbon::parse($tarea->fecha_entrega)->isPast())
|
||||
<br><span class="badge badge-danger">Vencida</span>
|
||||
@else
|
||||
<br><span class="badge badge-success">Activa</span>
|
||||
@endif
|
||||
@else
|
||||
<span class="text-muted">Sin fecha</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<form action="{{ route('tarea.entregar', $tarea) }}"
|
||||
method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group mb-1">
|
||||
<textarea name="texto"
|
||||
class="form-control form-control-sm"
|
||||
rows="3"
|
||||
placeholder="Escribe tu respuesta aquí (opcional)..."></textarea>
|
||||
</div>
|
||||
<div class="form-group mb-1">
|
||||
<div class="custom-file">
|
||||
<input type="file"
|
||||
class="custom-file-input"
|
||||
id="archivo_{{ $tarea->id }}"
|
||||
name="archivo">
|
||||
<label class="custom-file-label small"
|
||||
for="archivo_{{ $tarea->id }}">
|
||||
Adjuntar archivo (opcional)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="btn btn-primary btn-sm btn-block mt-1">
|
||||
<i class="fas fa-upload fa-sm"></i> Entregar
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{-- ══════════════════════════════════════════════════
|
||||
SECCIÓN 2: TAREAS YA ENTREGADAS
|
||||
══════════════════════════════════════════════════ --}}
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3 d-flex align-items-center justify-content-between">
|
||||
<h6 class="m-0 font-weight-bold text-success">
|
||||
<i class="fas fa-check-double mr-1"></i> Tareas Entregadas
|
||||
</h6>
|
||||
<span class="badge badge-success badge-pill">{{ $tareasEntregadas->count() }}</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if ($tareasEntregadas->isEmpty())
|
||||
<div class="alert alert-info mb-0">
|
||||
Aún no has entregado ninguna tarea en este ciclo.
|
||||
</div>
|
||||
@else
|
||||
@php $entregadasAgrupadas = $tareasEntregadas->groupBy('material_id'); @endphp
|
||||
|
||||
@if (session('info'))
|
||||
<div class="alert alert-success"><strong>{{ session('info') }}</strong></div>
|
||||
@endif
|
||||
@if (session('error'))
|
||||
<div class="alert alert-danger"><strong>{{ session('error') }}</strong></div>
|
||||
@endif
|
||||
@if ($errors->has('entrega'))
|
||||
<div class="alert alert-warning"><strong>{{ $errors->first('entrega') }}</strong></div>
|
||||
@endif
|
||||
@foreach ($entregadasAgrupadas as $materialId => $grupoTareas)
|
||||
@php
|
||||
$material = $grupoTareas->first()->material;
|
||||
$grupo = $grupoTareas->first()->grupo;
|
||||
$calificadas = $grupoTareas->filter(
|
||||
fn($t) => ($entregasMap[$t->id]->status ?? '') === 'calificada'
|
||||
)->count();
|
||||
$pendientes = $grupoTareas->count() - $calificadas;
|
||||
@endphp
|
||||
|
||||
@if (!isset($tareas) || $tareas->isEmpty())
|
||||
<div class="alert alert-info">No tienes tareas asignadas en tus grupos.</div>
|
||||
@else
|
||||
<div class="table-responsive">
|
||||
<table id="tcont" class="table table-striped table-bordered table-hover" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tarea</th>
|
||||
<th>Materia</th>
|
||||
<th>Grupo</th>
|
||||
<th>Fecha límite</th>
|
||||
<th>Status</th>
|
||||
<th>Calificación</th>
|
||||
<th>Tu entrega / Acción</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($tareas as $tarea)
|
||||
@php $entrega = $entregasMap[$tarea->id] ?? null; $status = $entrega?->status ?? 'sin_subir'; @endphp
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ $tarea->titulo }}</strong>
|
||||
@if ($tarea->descripcion)
|
||||
<p class="text-muted small mb-0">{{ Str::limit($tarea->descripcion, 80) }}</p>
|
||||
<div class="card border mb-3 shadow-sm">
|
||||
<div class="card-header d-flex justify-content-between align-items-center"
|
||||
data-toggle="collapse"
|
||||
data-target="#entr-mat-{{ $materialId }}"
|
||||
aria-expanded="false"
|
||||
style="cursor:pointer; user-select:none;">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="fas fa-book-open mr-2 text-success"></i>
|
||||
<div>
|
||||
<h6 class="mb-0 font-weight-bold">{{ $material->name }}</h6>
|
||||
<small class="text-muted">Grupo: {{ $grupo->clave }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center">
|
||||
@if ($pendientes > 0)
|
||||
<span class="badge badge-warning badge-pill mr-1"
|
||||
title="{{ $pendientes }} esperando calificación">
|
||||
{{ $pendientes }} por calificar
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $tarea->material->name }}</td>
|
||||
<td>{{ $tarea->grupo->clave }}</td>
|
||||
<td>
|
||||
@if ($tarea->fecha_entrega)
|
||||
{{ \Carbon\Carbon::parse($tarea->fecha_entrega)->format('d/m/Y') }}
|
||||
@if (\Carbon\Carbon::parse($tarea->fecha_entrega)->isPast())
|
||||
<span class="badge badge-danger">Vencida</span>
|
||||
@else
|
||||
<span class="badge badge-success">Activa</span>
|
||||
@endif
|
||||
@else
|
||||
<span class="text-muted">Sin fecha</span>
|
||||
@if ($calificadas > 0)
|
||||
<span class="badge badge-success badge-pill mr-1">
|
||||
{{ $calificadas }} calificada(s)
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($status === 'sin_subir')
|
||||
<span class="badge badge-secondary">Sin subir</span>
|
||||
@elseif ($status === 'pendiente')
|
||||
<span class="badge badge-warning">Pendiente</span>
|
||||
@else
|
||||
<span class="badge badge-success">Calificada</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($status === 'calificada' && $entrega)
|
||||
<strong class="text-success">{{ number_format($entrega->calificacion, 1) }}</strong>
|
||||
@if ($entrega->comentario)
|
||||
<br><small class="text-muted">{{ $entrega->comentario }}</small>
|
||||
@endif
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($status === 'sin_subir')
|
||||
{{-- Formulario de entrega: texto y/o archivo --}}
|
||||
<form action="{{ route('tarea.entregar', $tarea) }}" method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group mb-1">
|
||||
<textarea name="texto" class="form-control form-control-sm"
|
||||
rows="3" placeholder="Escribe tu respuesta aquí (opcional)..."></textarea>
|
||||
</div>
|
||||
<div class="form-group mb-1">
|
||||
<div class="custom-file">
|
||||
<input type="file" class="custom-file-input" id="archivo_{{ $tarea->id }}" name="archivo">
|
||||
<label class="custom-file-label small" for="archivo_{{ $tarea->id }}">
|
||||
Adjuntar archivo (opcional)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-sm btn-block mt-1">
|
||||
<i class="fas fa-upload fa-sm"></i> Entregar
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@elseif ($status === 'pendiente' || $status === 'calificada')
|
||||
{{-- Mostrar lo que entregó --}}
|
||||
@if ($entrega?->texto)
|
||||
<div class="border rounded p-2 bg-light mb-2" style="max-height:120px;overflow-y:auto;font-size:.85rem;">
|
||||
{{ $entrega->texto }}
|
||||
</div>
|
||||
@endif
|
||||
@if ($entrega?->archivo)
|
||||
<a href="{{ route('files.serve', $entrega->archivo) }}"
|
||||
target="_blank" class="btn btn-sm btn-outline-info">
|
||||
<i class="fas fa-eye fa-sm"></i> Ver archivo entregado
|
||||
</a>
|
||||
@endif
|
||||
@if (!$entrega?->texto && !$entrega?->archivo)
|
||||
<span class="text-muted small">Sin contenido registrado</span>
|
||||
@endif
|
||||
@if ($status === 'pendiente')
|
||||
<br><small class="text-warning"><i class="fas fa-clock"></i> Esperando calificación</small>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
<span class="badge badge-secondary badge-pill mr-2">
|
||||
{{ $grupoTareas->count() }} total
|
||||
</span>
|
||||
<i class="fas fa-chevron-down text-muted accordion-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="entr-mat-{{ $materialId }}" class="collapse">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Tarea</th>
|
||||
<th style="width:110px">Status</th>
|
||||
<th style="width:90px">Calificación</th>
|
||||
<th>Lo que entregaste</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($grupoTareas as $tarea)
|
||||
@php
|
||||
$entrega = $entregasMap[$tarea->id] ?? null;
|
||||
$status = $entrega?->status ?? 'sin_subir';
|
||||
@endphp
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<strong>{{ $tarea->titulo }}</strong>
|
||||
@if ($tarea->descripcion)
|
||||
<p class="text-muted small mb-0">
|
||||
{{ Str::limit($tarea->descripcion, 80) }}
|
||||
</p>
|
||||
@endif
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
@if ($status === 'pendiente')
|
||||
<span class="badge badge-warning">
|
||||
<i class="fas fa-clock"></i> Pendiente
|
||||
</span>
|
||||
@else
|
||||
<span class="badge badge-success">
|
||||
<i class="fas fa-check"></i> Calificada
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="align-middle text-center">
|
||||
@if ($status === 'calificada' && $entrega)
|
||||
<strong class="text-success h5 mb-0">
|
||||
{{ number_format($entrega->calificacion, 1) }}
|
||||
</strong>
|
||||
@if ($entrega->comentario)
|
||||
<br><small class="text-muted">{{ $entrega->comentario }}</small>
|
||||
@endif
|
||||
@else
|
||||
<span class="text-muted small">Esperando...</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="align-middle">
|
||||
@if ($entrega?->texto)
|
||||
<div class="border rounded p-2 bg-light"
|
||||
style="max-height:100px;overflow-y:auto;font-size:.85rem;">
|
||||
{{ $entrega->texto }}
|
||||
</div>
|
||||
@endif
|
||||
@if ($entrega?->archivo)
|
||||
<a href="{{ route('files.serve', $entrega->archivo) }}"
|
||||
target="_blank"
|
||||
class="btn btn-sm btn-outline-info mt-1">
|
||||
<i class="fas fa-eye fa-sm"></i> Ver archivo
|
||||
</a>
|
||||
@endif
|
||||
@if (!$entrega?->texto && !$entrega?->archivo)
|
||||
<span class="text-muted small">Sin contenido registrado</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif {{-- fin @if $cicloActual --}}
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
@include('layouts._partials.tablaScript')
|
||||
<script>
|
||||
document.querySelectorAll('.custom-file-input').forEach(input => {
|
||||
input.addEventListener('change', function () {
|
||||
@@ -149,5 +317,16 @@ document.querySelectorAll('.custom-file-input').forEach(input => {
|
||||
this.nextElementSibling.textContent = fileName;
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-toggle="collapse"]').forEach(header => {
|
||||
const target = document.querySelector(header.dataset.target);
|
||||
if (!target) return;
|
||||
const icon = header.querySelector('.accordion-icon');
|
||||
if (target.classList.contains('show') && icon) {
|
||||
icon.classList.add('fa-rotate-180');
|
||||
}
|
||||
target.addEventListener('show.bs.collapse', () => icon?.classList.add('fa-rotate-180'));
|
||||
target.addEventListener('hide.bs.collapse', () => icon?.classList.remove('fa-rotate-180'));
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user