@extends('admin.layout') @section('title') Affectation des Matériels @endsection @section('content')

Affectation des Matériels


@foreach($affectations as $affectation) @php $materiel = \App\Models\Materiel::find($affectation->materiel_id); $salarie = \App\Models\User::find($affectation->salarie_id); @endphp @endforeach
Photo Matériel Référence Salarié Date d'affectation Date de remise Date de retour Status Action
{{ $i++ }} @if($materiel->photo) @php $photos = json_decode($materiel->photo); @endphp @if(!empty($photos)) @foreach($photos as $photo) @if(file_exists(public_path('uploads/' . $photo))) Photo @break @else No Image @break @endif @endforeach @else No Image @endif @else No Image @endif @if($materiel) {{ $materiel->materiel ?? '' }} @else Matériel supprimé @endif @if($materiel->reference) {{ $materiel->reference ?? '' }} @else Aucun @endif @if($salarie) {{ $salarie->prenom ?? '' }} {{ $salarie->name ?? '' }} @else Salarié supprimé @endif {{ \Carbon\Carbon::parse($affectation->date_de_prise)->format('d/m/Y') ?? '' }} {{ \Carbon\Carbon::parse($affectation->date_de_remise)->format('d/m/Y') ?? '' }} @if($affectation->date_retour) {{ \Carbon\Carbon::parse($affectation->date_retour)->format('d/m/Y') ?? '' }} @else En cours @endif @if($affectation->status == 'returned') Retourné @else Affecté @endif @if($affectation->status != 'returned') Marquer comme retourné @endif Supprimer
@endsection @section('script') @endsection