Sfoglia il codice sorgente

added images to maf, maf orders, order card

Alexander Musikhin 7 mesi fa
parent
commit
ce4b4f0020

+ 1 - 0
app/Http/Controllers/MafOrderController.php

@@ -13,6 +13,7 @@ class MafOrderController extends Controller
         'title'     => 'Заказы МАФ',
         'id'        => 'maf_order',
         'header'    => [
+            'product-image'                     => 'Картинка',
             'id'                                => 'ID',
             'order_number'                      => '№ заказа',
             'status'                            => 'Статус',

+ 1 - 0
app/Http/Controllers/ProductSKUController.php

@@ -16,6 +16,7 @@ class ProductSKUController extends Controller
         'title'     => 'МАФ',
         'id'        => 'product_sku',
         'header'    => [
+            'product-image'                     => 'Картинка',
             'id'                                => 'ID',
 
             'order-district_id'                 => 'Округ',

+ 5 - 0
resources/sass/app.scss

@@ -72,4 +72,9 @@
   position: absolute;
   margin-left: -18px;
   margin-top: 1px;
+}
+
+.maf-img {
+  max-height: 100px;
+  max-width: 100px;
 }

+ 8 - 0
resources/views/orders/show.blade.php

@@ -130,6 +130,7 @@
                             <thead>
                             <tr>
                                 <th><input type="checkbox" class="form-check" id="check-all-maf"></th>
+                                <th>Картинка</th>
                                 <th>МАФ</th>
                                 <th>Тип</th>
                                 <th>Статус</th>
@@ -150,6 +151,13 @@
                                     <td>
                                         <input type="checkbox" class="form-check check-maf" data-maf-id="{{ $p->id }}">
                                     </td>
+                                    <td>
+                                        @if($p->product->image)
+                                            <a href="{{ $p->product->image }}" data-toggle="lightbox" data-gallery="photos" data-size="fullscreen">
+                                                <img src="{{ $p->product->image }}" alt="" class="img-thumbnail maf-img">
+                                            </a>
+                                        @endif
+                                    </td>
                                     <td>
                                         <a href="{{ route('product_sku.show', $p) }}">
                                             {!! $p->product->article !!}

+ 9 - 3
resources/views/partials/table.blade.php

@@ -49,7 +49,7 @@
             <tr>
                 @foreach($header as $headerName => $headerTitle)
                     <td class="column_{{$headerName}}"
-                        @if(isset($routeName) && !in_array($headerName, ['image'])) onclick="location.href='{{ route($routeName, $string->id) }}'" @endif>
+                        @if(isset($routeName) && !str_contains($headerName, 'image')) onclick="location.href='{{ route($routeName, $string->id) }}'" @endif>
                         @if(str_contains($headerName, '-'))
                             @php
                                 list($rel, $field) = explode('-', $headerName);
@@ -61,7 +61,13 @@
                                 @endphp
                                     {!! $string->$rel->$relation?->name; !!}
                                 @else
+                                    @if(str_contains($field, 'image') && $string->$rel->$field)
+                                    <a href="{{ $string->$rel->$field }}" data-toggle="lightbox" data-gallery="photos" data-size="fullscreen">
+                                        <img src="{{ $string->$rel->$field }}" alt="" class="img-thumbnail maf-img">
+                                    </a>
+                                    @else
                                     {!! $string->$rel->$field !!}
+                                    @endif
                                 @endif
                             @else
 
@@ -80,9 +86,9 @@
                             {!! $string->$relation?->name; !!}
                         @elseif(str_ends_with($headerName, '_date') && ($string->$headerName))
                             {{ \App\Helpers\DateHelper::getHumanDate($string->$headerName, true) }}
-                        @elseif($headerName == 'image' && $string->$headerName)
+                        @elseif(str_contains($headerName, 'image') && $string->$headerName)
                             <a href="{{ $string->$headerName }}" data-toggle="lightbox" data-gallery="photos" data-size="fullscreen">
-                                <img src="{{ $string->$headerName }}" alt="" class="img-thumbnail" style="max-height: 150px" >
+                                <img src="{{ $string->$headerName }}" alt="" class="img-thumbnail maf-img">
                             </a>
                         @else
                             {!! $string->$headerName !!}