@extends('admin.layout') @section('main')

{{ $title_description??'' }}

{{ trans('product.type') }}: {{ $kinds[$product->kind]??'' }}
{{-- Descriptions --}} @php $descriptions = $product->descriptions->keyBy('lang')->toArray(); @endphp @foreach ($languages as $code => $language)
{{ $language->name }} {!! sc_image_render($language->icon,'20px','20px') !!}
@if ($errors->has('descriptions.'.$code.'.name')) {{ $errors->first('descriptions.'.$code.'.name') }} @endif
@if ($errors->has('descriptions.'.$code.'.keyword')) {{ $errors->first('descriptions.'.$code.'.keyword') }} @endif
@if ($errors->has('descriptions.'.$code.'.description')) {{ $errors->first('descriptions.'.$code.'.description') }} @endif
@if ($product->kind == SC_PRODUCT_SINGLE)
@if ($errors->has('descriptions.'.$code.'.content')) {{ $errors->first('descriptions.'.$code.'.content') }} @endif
@endif @endforeach {{-- //Descriptions --}} {{-- Category --}} @if ($product->kind == SC_PRODUCT_SINGLE || $product->kind == SC_PRODUCT_BUILD)
@php $listCate = []; $category = old('category',$product->categories->pluck('id')->toArray()); if(is_array($category)){ foreach($category as $value){ $listCate[] = (int)$value; } } @endphp
@if ($errors->has('category')) {{ $errors->first('category') }} @endif
@endif {{-- //Category --}} {{-- Images --}}
@if ($errors->has('image')) {{ $errors->first('image') }} @endif
@php $listsubImages = old('sub_image',$product->images->pluck('image')->all()); @endphp @if (!empty($listsubImages)) @foreach ($listsubImages as $key => $sub_image) @if ($sub_image) @endif @endforeach @endif
{{-- //Images --}} {{-- Sku --}}
@if ($errors->has('sku')) {{ $errors->first('sku') }} @else {{ trans('product.sku_validate') }} @endif
{{-- //Sku --}} {{-- Brand --}}
@if ($errors->has('brand_id')) {{ $errors->first('brand_id') }} @endif
{{-- //Brand --}} {{-- Vendor --}}
@if ($errors->has('vendor_id')) {{ $errors->first('vendor_id') }} @endif
{{-- //Vendor --}} {{-- Cost --}} @if ($product->kind == SC_PRODUCT_SINGLE)
@if ($errors->has('cost')) {{ $errors->first('cost') }} @endif
@endif {{-- //Cost --}} @if ($product->kind == SC_PRODUCT_SINGLE || $product->kind == SC_PRODUCT_BUILD) {{-- Price --}}
@if ($errors->has('price')) {{ $errors->first('price') }} @endif
{{-- //Price --}} {{-- price promotion --}}
@if (old('price_promotion') || $product->promotionPrice)
{{ trans('product.price_promotion_start') }}
{{ trans('product.price_promotion_end') }}
@else @endif
{{-- //price promotion --}} @endif {{-- Stock --}} @if ($product->kind == SC_PRODUCT_SINGLE || $product->kind == SC_PRODUCT_BUILD)
@if ($errors->has('stock')) {{ $errors->first('stock') }} @endif
@endif {{-- //Stock --}} {{-- Type --}} @if ($product->kind == SC_PRODUCT_SINGLE || $product->kind == SC_PRODUCT_BUILD)
@foreach ( $types as $key => $type) @endforeach @if ($errors->has('type')) {{ $errors->first('type') }} @endif
@endif {{-- //Type --}} {{-- Virtual --}} @if ($product->kind == SC_PRODUCT_SINGLE || $product->kind == SC_PRODUCT_BUILD)
@foreach ( $virtuals as $key => $virtual) @endforeach @if ($errors->has('virtual')) {{ $errors->first('virtual') }} @endif
@endif {{-- //Virtual --}} {{-- Date vailalable --}} @if ($product->kind == SC_PRODUCT_SINGLE || $product->kind == SC_PRODUCT_BUILD)
@if ($errors->has('date_available')) {{ $errors->first('date_available') }} @endif
@endif {{-- //Date vailalable --}} {{-- Sort --}}
@if ($errors->has('sort')) {{ $errors->first('sort') }} @endif
{{-- //Sort --}} {{-- Status --}}
@if (old()) @else @endif
{{-- //Virtual --}} @if ($product->kind == SC_PRODUCT_GROUP) {{-- List product in groups --}}
@php $listgroups= []; $groups = old('productInGroup',$product->groups->pluck('product_id')->toArray()); if(is_array($groups)){ foreach($groups as $value){ $listgroups[] = (int)$value; } } @endphp @if ($listgroups) @foreach ($listgroups as $pID) @if ((int)$pID) @php $newHtml = str_replace('value="'.(int)$pID.'"', 'value="'.(int)$pID.'" selected', $htmlSelectGroup); @endphp {!! $newHtml !!} @endif @endforeach @endif
@if ($errors->has('productInGroup')) {{ $errors->first('productInGroup') }} @endif @if ($errors->has('productInGroup')) {{ $errors->first('productInGroup') }} @endif
{{-- //end List product in groups --}} @endif @if ($product->kind == SC_PRODUCT_BUILD)
{{-- List product build --}}
@php $listBuilds= []; $groups = old('productBuild',$product->builds->pluck('product_id')->toArray()); $groupsQty = old('productBuildQty',$product->builds->pluck('quantity')->toArray()); if(is_array($groups)){ foreach($groups as $key => $value){ $listBuilds[] = (int)$value; $listBuildsQty[] = (int)$groupsQty[$key]; } } @endphp @if ($listBuilds) @foreach ($listBuilds as $key => $pID) @if ((int)$pID && $listBuildsQty[$key]) @php $newHtml = str_replace('value="'.(int)$pID.'"', 'value="'.(int)$pID.'" selected', $htmlSelectBuild); $newHtml = str_replace('name="productBuildQty[]" value="1" min=1', 'name="productBuildQty[]" value="'.$listBuildsQty[$key].'"', $newHtml); @endphp {!! $newHtml !!} @endif @endforeach @endif
@if ($errors->has('productBuild')) {{ $errors->first('productBuild') }} @endif @if ($errors->has('productBuild') || $errors->has('productBuildQty')) {{ $errors->first('productBuild') }} @endif
{{-- //end List product build --}} @endif @if ($product->kind == SC_PRODUCT_SINGLE) {{-- List product attributes --}}
@if (!empty($attributeGroup))
@php $dataAtt = []; if(old('attribute')){ $dataAtt = old('attribute'); }else{ $getDataAtt = $product->attributes->groupBy('attribute_group_id')->toArray(); if(count($getDataAtt)){ foreach ($getDataAtt as $groupKey => $row) { $dataAtt[$groupKey] = array_column($row, 'name'); } } } @endphp @foreach ($attributeGroup as $attGroupId => $attName) @if (!empty($dataAtt[$attGroupId])) @foreach ($dataAtt[$attGroupId] as $attValue) @if ($attValue) @php $newHtml = str_replace('attribute_group', $attGroupId, $htmlProductAtrribute); $newHtml = str_replace('attribute_value', $attValue, $newHtml); @endphp {!! $newHtml !!} @endif @endforeach @endif
{{ $attName }}:


@endforeach
@endif {{-- //end List product attributes --}} @endif
@endsection @push('styles') {{-- switch --}} {{-- input image --}} {{-- --}} @endpush @push('scripts') {{-- input image --}} {{-- --}} {{-- switch --}} @endpush