Parcourir la source

fix upload documenti

FabioFratini il y a 10 mois
Parent
commit
5bbe585060
1 fichiers modifiés avec 42 ajouts et 30 suppressions
  1. 42 30
      resources/views/livewire/member.blade.php

+ 42 - 30
resources/views/livewire/member.blade.php

@@ -734,16 +734,20 @@
                                                         <label for="document_files" class="form-label">File</label>
                                                         <input class="form-control" type="file" wire:model="documents" multiple><br>
                                                         <label for="document_files" class="form-label">Caricati</label>
-                                                        @foreach ($document_files as $idx => $d)
-                                                            <div class="row">
-                                                                <div class="col-6">
-                                                                    <a href="{{ asset('storage/app/public/'.$d) }}" target="_blank" class="form-label">{{$d}}</a>
-                                                                </div>
-                                                                <div class="col-6">
-                                                                    <a wire:click="removeDocument({{$idx}},'self')" class="form-label">(elimina)</a><br>
-                                                                </div>
-                                                            </div>
-                                                        @endforeach
+                                                        @if ($document_files !== null && count(array_filter($document_files)) > 0)
+                                                            @foreach ($document_files as $idx => $d)
+                                                                @if (!empty($d))
+                                                                    <div class="row">
+                                                                        <div class="col-6">
+                                                                            <a href="{{ asset('storage/app/public/'.$d) }}" target="_blank" class="form-label">{{$d}}</a>
+                                                                        </div>
+                                                                        <div class="col-6">
+                                                                            <a wire:click="removeDocument({{$idx}},'self')" class="form-label">(elimina)</a><br>
+                                                                        </div>
+                                                                    </div>
+                                                                @endif
+                                                            @endforeach
+                                                        @endif
                                                     </div>
                                                 </div>
 
@@ -785,16 +789,20 @@
                                                             <label for="father_documents" class="form-label">File</label>
                                                             <input class="form-control" type="file" wire:model="father_documents" multiple><br>
                                                             <label for="father_documents" class="form-label">Caricati</label>
-                                                            @foreach ($father_document_files as $idx => $d)
-                                                                <div class="row">
-                                                                    <div class="col-6">
-                                                                        <a href="{{ asset('storage/app/public/'.$d) }}" target="_blank" class="form-label">{{$d}}</a>
-                                                                    </div>
-                                                                    <div class="col-6">
-                                                                        <a wire:click="removeDocument({{$idx}},'father')" class="form-label">(elimina)</a><br>
-                                                                    </div>
-                                                                </div>
-                                                            @endforeach
+                                                            @if ($father_document_files !== null && count(array_filter($father_document_files)) > 0)
+                                                                @foreach ($father_document_files as $idx => $d)
+                                                                    @if (!empty($d))
+                                                                        <div class="row">
+                                                                            <div class="col-6">
+                                                                                <a href="{{ asset('storage/app/public/'.$d) }}" target="_blank" class="form-label">{{$d}}</a>
+                                                                            </div>
+                                                                            <div class="col-6">
+                                                                                <a wire:click="removeDocument({{$idx}},'father')" class="form-label">(elimina)</a><br>
+                                                                            </div>
+                                                                        </div>
+                                                                    @endif
+                                                                @endforeach
+                                                            @endif
                                                         </div>
                                                     </div>
                                                     <div class="row g-3 mt-1">
@@ -834,16 +842,20 @@
                                                         <label for="mother_documents" class="form-label">File</label>
                                                         <input class="form-control" type="file" wire:model="mother_documents" multiple><br>
                                                         <label for="mother_documents" class="form-label">Caricati</label>
-                                                        @foreach ($mother_document_files as $idx => $d)
-                                                            <div class="row">
-                                                                <div class="col-6">
-                                                                    <a href="{{ asset('storage/app/public/'.$d) }}" target="_blank" class="form-label">{{$d}}</a>
-                                                                </div>
-                                                                <div class="col-6">
-                                                                    <a wire:click="removeDocument({{$idx}},'mother')" class="form-label">(elimina)</a><br>
-                                                                </div>
-                                                            </div>
-                                                        @endforeach
+                                                        @if ($mother_document_files !== null && count(array_filter($mother_document_files)) > 0)
+                                                            @foreach ($mother_document_files as $idx => $d)
+                                                                @if (!empty($d))
+                                                                    <div class="row">
+                                                                        <div class="col-6">
+                                                                            <a href="{{ asset('storage/app/public/'.$d) }}" target="_blank" class="form-label">{{$d}}</a>
+                                                                        </div>
+                                                                        <div class="col-6">
+                                                                            <a wire:click="removeDocument({{$idx}},'mother')" class="form-label">(elimina)</a><br>
+                                                                        </div>
+                                                                    </div>
+                                                                @endif
+                                                            @endforeach
+                                                        @endif
                                                     </div>
                                                 @endif