@extends('layouts.app') @section('content')
@include('shared.messages')

{{__('texte.promotions_arr.history.show_promotion_history')}}

@foreach($promotionHistory as $history) @if($history->key == 'created_at' && !$history->old_value) @elseif($history->key == 'deleted_at' && !$history->old_value) @else @endif @endforeach
{{ __('texte.promotions_arr.history.promotion_created')}} {{__('texte.promotions_arr.history.by')}} {{$history->userResponsible()->name }} {{__('texte.promotions_arr.history.on')}} {{ date("d.m.Y",strtotime($history->created_at)) }} {{__('texte.promotions_arr.history.at')}} {{ date("H:i",strtotime($history->created_at)) }}
{{ __('texte.promotions_arr.history.promotion_deleted')}} {{ __('texte.promotions_arr.history.by')}} {{ $history->userResponsible()->name }} {{ __('texte.promotions_arr.history.on')}} {{ date("d.m.Y",strtotime($history->created_at)) }} {{ __('texte.promotions_arr.history.at')}} {{ date("H:i",strtotime($history->created_at)) }}
{{ $history->userResponsible()->name }} {{__('texte.promotions_arr.history.changed_field')}} @switch($history->fieldName()) @case('active') {{__('texte.promotions_arr.history.active')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==null ? '" "' : __('texte.replies_arr')[$history->oldValue()]}} {{__('texte.promotions_arr.history.to')}} {{ __('texte.replies_arr')[$history->newValue()] }} @break @case('promotion_visibility') {{__('texte.promotions_arr.history.promotion_visibility')}} {{__('texte.promotions_arr.history.from')}} @if ($history->oldValue()!=null) @foreach(explode(',',$history->oldValue()) as $index=>$item) @switch($item) @case('repr') {{__('texte.promotions_arr.history.repr')}}{{$indexoldValue()))-1 ? ',': ''}} @break @case('ext_repr') {{__('texte.promotions_arr.history.ext_repr')}}{{$indexoldValue()))-1 ? ',': ''}} @break @case('clients') {{__('texte.promotions_arr.history.clients')}}{{$indexoldValue()))-1 ? ',': ''}} @break @default {{$storages[$item]->name}}{{$indexoldValue()))-1 ? ',': ''}} @break @endswitch @endforeach @endif {{__('texte.promotions_arr.history.to')}} @if ($history->newValue()!=null) @foreach(explode(',',$history->newValue()) as $index=>$item) @switch($item) @case('repr') {{__('texte.promotions_arr.history.repr')}}{{$indexnewValue()))-1 ? ',': ''}} @break @case('ext_repr') {{__('texte.promotions_arr.history.ext_repr')}}{{$indexnewValue()))-1 ? ',': ''}} @break @case('clients') {{__('texte.promotions_arr.history.clients')}}{{$indexnewValue()))-1 ? ',': ''}} @break @default {{$storages[$item]->name}} {{$indexnewValue()))-1 ? ',': ''}} @break @endswitch @endforeach @endif @break @case('promotion_validity') {{__('texte.promotions_arr.history.promotion_validity')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==null ? '" "' : $history->oldValue()==1 ? __('texte.promotions_arr.history.period') : __('texte.promotions_arr.history.exhaust')}} {{__('texte.promotions_arr.history.to')}} {{ $history->newValue()==1 ? __('texte.promotions_arr.history.period') : __('texte.promotions_arr.history.exhaust') }} @break @case('date_from') {{__('texte.promotions_arr.history.date_from')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==null ? '" "' : date_format(new DateTime($history->oldValue()), 'd.m.Y H:i')}} {{__('texte.promotions_arr.history.to')}} {{ $history->newValue()==null ? '" "' : date_format(new DateTime($history->newValue()), 'd.m.Y H:i') }} @break @case('date_to') {{__('texte.promotions_arr.history.date_to')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==null ? '" "' : date_format(new DateTime($history->oldValue()), 'd.m.Y H:i')}} {{__('texte.promotions_arr.history.to')}} {{ $history->newValue()==null ? '" "' : date_format(new DateTime($history->newValue()), 'd.m.Y H:i') }} @break @case('repeatability') {{__('texte.promotions_arr.history.repeatability')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : ($history->oldValue()==1 ? __('texte.promotions_arr.history.daily') : __('texte.promotions_arr.history.weekly'))}} {{__('texte.promotions_arr.history.to')}} {{ $history->newValue()==0 ? '" "' : ($history->newValue()==1 ? __('texte.promotions_arr.history.daily') : __('texte.promotions_arr.history.weekly')) }} @break @case('condition_type') {{__('texte.promotions_arr.history.condition_type')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==null ? '" "' : ($history->oldValue()==1 ? __('texte.promotions_arr.history.sum') : __('texte.promotions_arr.history.number'))}} {{__('texte.promotions_arr.history.to')}} {{ $history->newValue()==null ? '" "' : ($history->newValue()==1 ? __('texte.promotions_arr.history.sum') : __('texte.promotions_arr.history.number')) }} @break @case('condition_package') {{__('texte.promotions_arr.history.condition_package')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==null ? '" "' : __('texte.replies_arr')[$history->oldValue()]}} {{__('texte.promotions_arr.history.to')}} {{ __('texte.replies_arr')[$history->newValue()] }} @break @case('bonus_type') {{__('texte.promotions_arr.history.bonus_type')}} {{__('texte.promotions_arr.history.from')}} @if ($history->oldValue()!=null) @switch($history->oldValue()) @case(1) {{__('texte.promotions_arr.history.total_disc_percent')}} @break @case(2) {{__('texte.promotions_arr.history.total_discount_bgn')}} @break @case(3) {{__('texte.promotions_arr.history.fixed_price')}} @break @case(4) {{__('texte.promotions_arr.history.number')}} @break @default {{__('texte.promotions_arr.history.percent_discount')}} @break @endswitch @endif {{__('texte.promotions_arr.history.to')}} @if ($history->newValue()!=null) @switch($history->newValue()) @case(1) {{__('texte.promotions_arr.history.total_disc_percent')}} @break @case(2) {{__('texte.promotions_arr.history.total_discount_bgn')}} @break @case(3) {{__('texte.promotions_arr.history.fixed_price')}} @break @case(4) {{__('texte.promotions_arr.history.number')}} @break @default {{__('texte.promotions_arr.history.percent_discount')}} @break @endswitch @endif @break @case('weekdays') {{__('texte.promotions_arr.history.weekdays')}} {{__('texte.promotions_arr.history.from')}} @if ($history->oldValue()!=null) @foreach(explode(',',$history->oldValue()) as $index=>$item) {{__('texte.weekdays_arr')[$item]}}{{$indexoldValue()))-1 ? ',': ''}} @endforeach @endif {{__('texte.promotions_arr.history.to')}} @if ($history->newValue()!=null) @foreach(explode(',',$history->newValue()) as $index=>$item) {{__('texte.weekdays_arr')[$item]}} {{$indexnewValue()))-1 ? ',': ''}} @endforeach @endif @break @case('category') {{__('texte.promotions_arr.history.category')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : $categories[$history->oldValue()]->name}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : $categories[$history->newValue()]->name }} @break @case('producer') {{__('texte.promotions_arr.history.producer')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : $producers[$history->oldValue()]->name}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : $producers[$history->newValue()]->name }} @break @case('mark') {{__('texte.promotions_arr.history.mark')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : $marks[$history->oldValue()]->name}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : $marks[$history->newValue()]->name }} @break @case('package') {{__('texte.promotions_arr.history.package')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : $packages[$history->oldValue()]->name}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : $packages[$history->newValue()]->name }} @break @case('product') {{__('texte.promotions_arr.history.product')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : $products[$history->oldValue()]->name}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : $products[$history->newValue()]->name }} @break @case('material') {{__('texte.promotions_arr.history.material')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : $materials[$history->oldValue()]->name}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : $materials[$history->newValue()]->name }} @break @case('price_product') {{__('texte.promotions_arr.history.price_product')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : $products[$history->oldValue()]->name}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : $products[$history->newValue()]->name }} @break @case('price') {{__('texte.promotions_arr.history.price')}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==0 ? '" "' : __('texte.full_price_arr')[$history->oldValue()]}} {{__('texte.promotions_arr.history.to')}} {{$history->newValue()==0 ? '" "' : __('texte.full_price_arr')[$history->newValue()] }} @break @default {{__('texte.promotions_arr.history.'.$history->fieldName())}} {{__('texte.promotions_arr.history.from')}} {{ $history->oldValue()==null ? '" "' : $history->oldValue()}} {{__('texte.promotions_arr.history.to')}} {{ $history->newValue()==null ? '" "' :$history->newValue() }} @break @endswitch {{__('texte.promotions_arr.history.on')}} {{ date("d.m.Y",strtotime($history->created_at)) }} {{__('texte.promotions_arr.history.at')}} {{ date("H:i",strtotime($history->created_at)) }}
@endsection