mivita/resources/views/admin/product/index.blade.php
2021-08-20 18:22:21 +02:00

101 lines
4.8 KiB
PHP
Executable file

@extends('layouts.layout-2')
@section('content')
<div class="card">
<h6 class="card-header">
{{__('Produkte')}}
<label class="custom-control custom-checkbox float-right mb-0">
<input type="checkbox" class="custom-control-input show-active-products" name="show_active_products" @if(get_user_attr('show_active_products') === "true") checked @endif>
<span class="custom-control-label font-style-normal font-weight-normal">nur aktive anzeigen</span>
</label>
</h6>
<div class="card-datatable table-responsive">
<table class="datatables-product table table-striped table-bordered">
<thead>
<tr>
<th style="max-width: 60px;">&nbsp;</th>
<th>{{__('Pos')}}</th>
<th>{{__('Bild')}}</th>
<th>{{__('Name')}}</th>
<th>{{__('Artikelnummer')}}</th>
<th>{{__('Kategorie')}}</th>
<th>{{__('Preis')}}</th>
<th>{{__('Points')}}</th>
<th>{{__('Inhalt')}}</th>
<th>{{__('Einheit')}}</th>
<th>{{__('Grundpreis')}}</th>
<th>{{__('Gewicht')}}</th>
<th>{{__('sichbar')}}</th>
<th>{{__('KP')}}</th>
<th>{{__('NoP.')}}</th>
<th>{{__('Status')}}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($values as $value)
<tr>
<td>
<a href="{{route('admin_product_edit', [$value->id])}}" class="btn icon-btn btn-sm btn-primary">
<span class="far fa-edit"></span>
</a>
</td>
<td>{{ $value->pos }}</td>
<td>
@if(count($value->images))
<img class="img-fluid" alt="" style="max-height: 80px" src="{{ route('product_image', [$value->images->first()->slug]) }}">
@endif
</td>
<td>{{ $value->name }}</td>
<td>{{ $value->number }}</td>
<td>
@foreach($value->categories as $category)
<div style="white-space: nowrap">{{ $category->category->name }}</div>
@endforeach
</td>
<td>{{ $value->getFormattedPrice() }}</td>
<td>{{ $value->points }}</td>
<td>{{ $value->contents_total }}</td>
<td>{{ $value->getUnitType() }}</td>
<td>{{ $value->getBasePriceFormatted() }}</td>
<td>{{ $value->weight }}</td>
<td>{!! implode($value->getShowOnTypes(), '<br>') !!}</td>
<td data-sort="{{ $value->shipping_addon }}">{!! get_active_badge($value->shipping_addon) !!}</td>
<td data-sort="{{ $value->no_commission }}">{!! get_active_badge($value->no_commission) !!}</td>
<td data-sort="{{ $value->active }}">{!! get_active_badge($value->active) !!}</td>
<td><a class="text-info" href="{{ route('admin_product_copy', [$value->id]) }}" onclick="return confirm('{{__('Eintrag kopieren?')}}');"><i class="far fa-copy"></i></a> &nbsp;
<a class="text-danger" href="{{ route('admin_product_delete', [$value->id]) }}" onclick="return confirm('{{__('Really delete entry?')}}');"><i class="far fa-trash-alt"></i></a></td>
</tr>
@endforeach
</tbody>
</table>
<div class="mt-4 ml-4">
<a href="{{route('admin_product_edit', ['new'])}}" class="btn btn-sm btn-primary">
{{__('Neues Produkt erstellen')}}
</a>
</div>
</div>
</div>
<script>
$( document ).ready(function() {
$('.datatables-product').dataTable({
"bLengthChange": false,
"iDisplayLength": 50,
"language": {
"url": "/js/German.json"
}
});
$('.show-active-products').on('change', function () {
console.log($(this));
console.log($(this).prop('checked'));
document.location.search = $(this).attr('name')+"="+$(this).prop('checked');
// window.location.reload(true);
})
});
</script>
@endsection