gruene-seele/resources/views/admin/attribute/index.blade.php
2025-04-01 10:39:21 +02:00

275 lines
14 KiB
PHP
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@extends('layouts.layout-2')
@section('content')
<div class="card mb-5">
<h6 class="card-header">
{{__('Attribute')}}
</h6>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th style="max-width: 60px;">&nbsp;</th>
<th>{{__('Pos')}}</th>
<th>{{__('Description')}}</th>
<th>{{__('Wert') }}</th>
<th>{{__('Type') }}</th>
<th>{{__('Status')}}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($attributes as $value)
<tr>
<td>
<button type="button" class="btn icon-btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-attribute"
data-id="{{ $value->id }}"
data-pos="{{ $value->pos }}"
data-name="{{ $value->name }}"
data-value="{{ $value->value }}"
data-attribute_type_id="{{ $value->attribute_type_id }}"
data-active="{{ $value->active }}">
<span class="far fa-edit"></span>
</button>
</td>
<td>{{ $value->pos }}</td>
<td>{{ $value->name }}</td>
<td>{{ $value->value }}</td>
<td>{{ $value->attribute_type->name }}</td>
<td data-sort="{{ $value->active }}">@if($value->active) <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>@else<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>@endif</td>
<td><a class="text-danger" href="{{ route('admin_product_attribute_delete', ['attr', $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">
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-attribute"
data-id="new"
data-pos=""
data-name=""
data-value=""
data-attribute_type_id=""
data-parent_id=""
data-active="1">
{{__('Neues Attribute erstellen')}}</button>
</div>
</div>
</div>
<div class="card">
<h6 class="card-header">
{{__('Attribute')}} {{__('Types')}} <br>
<span class="text-muted font-weight-normal">
Neue Attribute Typen müssen müssen je nach Funktion und Anforderungen einprogrammiert werden
</span>
</h6>
<div class="card-subtitle "> <p><em></em></p></div>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th style="max-width: 60px;">&nbsp;</th>
<th>{{__('Pos')}}</th>
<th>{{__('Description')}}</th>
<th>{{__('Beschreibung')}}</th>
<th>{{__('Status')}}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($attribute_types as $value)
<tr>
<td>
<button type="button" class="btn icon-btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-attribute-type"
data-id="{{ $value->id }}"
data-pos="{{ $value->pos }}"
data-name="{{ $value->name }}"
data-description="{{ $value->description }}"
data-active="{{ $value->active }}">
<span class="far fa-edit"></span>
</button>
</td>
<td>{{ $value->pos }}</td>
<td>{{ $value->name }}</td>
<td>{{ $value->description }}</td>
<td data-sort="{{ $value->active }}">@if($value->active) <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>@else<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>@endif</td>
<td><a class="text-danger" href="{{ route('admin_product_attribute_delete', ['type', $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">
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-attribute-type"
data-id="new"
data-pos=""
data-name=""
data-description=""
data-parent_id=""
data-active="1"
>{{__('Neuen Attribute Type erstellen')}}</button>
</div>
</div>
</div>
<!-- Modal template -->
<div class="modal fade" id="modals-attribute">
<div class="modal-dialog">
<form class="modal-content" action="{{ route('admin_product_attribute_store') }}" method="post">
@csrf
<input type="hidden" name="id">
<input type="hidden" name="action" value="attribute">
<div class="modal-header">
<h5 class="modal-title"> {{__('Attribute')}} <span class="font-weight-light">{{__('create/edit')}}</span></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="form-group col-12">
<label for="name" class="form-label">{{__('Name')}}</label>
<input type="text" class="form-control" name="name" placeholder="{{__('Bezeichnung')}}">
</div>
<div class="form-group col-12">
<label for="value" class="form-label">{{__('Wert')}} (für die technische Verarbeitung)</label>
<input type="text" class="form-control" name="value" placeholder="werden mit # getrennt">
</div>
<div class="form-group col-12">
<label for="attribute_type_id" class="form-label">{{__('Attribute Type')}}</label>
<select class="selectpicker" name="attribute_type_id" id="attribute_type_id" data-style="btn-light" data-live-search="true" required>
{!! HTMLHelper::getAttributeTypes() !!}
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-6">
<label class="custom-control custom-checkbox m-2">
<input type="checkbox" class="custom-control-input" name="active" checked>
<span class="custom-control-label">{{__('active')}}</span>
</label>
</div>
<div class="form-group col-6">
<input type="text" class="form-control" name="pos" placeholder="{{__('Number to move the position if necessary')}}">
</div>
</div>
<hr>
@foreach($trans as $tran)
@if($tran != 'de')
<div class="form-row">
<div class="form-group col">
<label for="name" class="form-label">{{__('Translate')}} <strong style="text-transform: uppercase">{{$tran}}</strong></label>
<input type="text" class="form-control" name="trans[{{$tran}}]" id="trans_{{$tran}}" placeholder="">
</div>
</div>
@endif
@endforeach
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
<button type="submit" class="btn btn-primary">{{__('save')}}</button>
</div>
</form>
</div>
</div>
<!-- Modal template -->
<div class="modal fade" id="modals-attribute-type">
<div class="modal-dialog">
<form class="modal-content" action="{{ route('admin_product_attribute_store') }}" method="post">
@csrf
<input type="hidden" name="id">
<input type="hidden" name="action" value="attribute-type">
<div class="modal-header">
<h5 class="modal-title"> {{__('Attribute')}} {{__('Type')}} <span class="font-weight-light">{{__('create/edit')}}</span></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="form-group col-12">
<label for="name" class="form-label">{{__('Name')}}</label>
<input type="text" class="form-control" name="name" placeholder="{{__('Bezeichnung')}}">
</div>
<div class="form-group col-12">
<label for="description" class="form-label">{{__('Beschreibung')}}</label>
<input type="text" class="form-control" name="description" placeholder="">
</div>
</div>
<div class="form-row">
<div class="form-group col-6">
<label class="custom-control custom-checkbox m-2">
<input type="checkbox" class="custom-control-input" name="active" checked>
<span class="custom-control-label">{{__('active')}}</span>
</label>
</div>
<div class="form-group col-6">
<input type="text" class="form-control" name="pos" placeholder="{{__('Number to move the position if necessary')}}">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
<button type="submit" class="btn btn-primary">{{__('save')}}</button>
</div>
</form>
</div>
</div>
<script>
$(document).ready(function() {
$('#modals-attribute').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
$(this).find(".modal-content input[name='id']").val(button.data('id'));
$(this).find(".modal-body input[name='name']").val(button.data('name'));
$(this).find(".modal-body input[name='value']").val(button.data('value'));
$(this).find(".modal-body input[name='pos']").val(button.data('pos'));
if(button.data('attribute_type_id')){
$(this).find(".modal-body select[name='attribute_type_id']").val(button.data('attribute_type_id'));
$('.selectpicker').selectpicker('refresh');
}
$(this).find(".modal-body input[name='active']").prop( "checked", button.data('active'));
});
$('#modals-attribute-type').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
$(this).find(".modal-content input[name='id']").val(button.data('id'));
$(this).find(".modal-body input[name='name']").val(button.data('name'));
$(this).find(".modal-body input[name='description']").val(button.data('description'));
$(this).find(".modal-body input[name='pos']").val(button.data('pos'));
// $(this).find(".modal-body select[name='parent_id']").val(button.data('parent_id'));
// $('.selectpicker').selectpicker('refresh');
$(this).find(".modal-body input[name='active']").prop( "checked", button.data('active'));
/*$.each(button.data('trans_name'), function (i, item) {
var name = '#trans_'+i;
$(name).val(item);
});*/
});
$('.datatables-style').dataTable({
"bLengthChange": false,
"iDisplayLength": 50,
"order": [[ 1, "asc" ]],
"language": {
"url": "/js/German.json"
}
});
});
</script>
@endsection