@extends('admin.layouts.master') @section('content')

{{ trans('app.add_variants') }}

{!! Form::open(['route' => ['admin.stock.inventory.saveVariant', $inventory], 'files' => true, 'id' => 'form', 'data-toggle' => 'validator']) !!}
{!! Form::label('sku', trans('app.form.sku') . '*', ['class' => 'with-help']) !!} {!! Form::text('sku', isset($variant) ? $variant->sku : $inventory->sku . '-', ['class' => 'form-control', 'placeholder' => trans('app.placeholder.sku'), 'required']) !!}
{!! Form::label('stock_quantity', trans('app.form.stock_quantity') . '*', ['class' => 'with-help']) !!} {!! Form::number('stock_quantity', isset($variant) ? $variant->stock_quantity : $inventory->stock_quantity, ['min' => 0, 'class' => 'form-control', 'placeholder' => trans('app.placeholder.stock_quantity'), 'required']) !!}
{!! Form::label('sale_price', trans('app.form.sale_price') . '*', ['class' => 'with-help']) !!}
{{ config('system_settings.currency_symbol') ?? '$' }}
{{ trans('app.image') }} @if (isset($variant) && $variant->image) {{ trans('app.variant_image') }} @endif
{{ trans('app.form.upload') }}
{{ trans('app.attributes') }}
@foreach ($attributes as $attribute) @if ($productAttributeIds->contains($attribute->id))
{!! Form::label($attribute->name, $attribute->name . '*', ['class' => 'with-help']) !!} {!! Form::select('attributes[' . $attribute->id . ']', $attribute->attributeValues->pluck('value', 'id'), null, ['class' => 'form-control select2-normal', 'placeholder' => trans('app.placeholder.attribute_values'), 'required']) !!} {{-- --}}
@endif @endforeach

* {{ trans('app.form.required_fields') }}

{{ trans('app.back') }}
{!! Form::submit(isset($product) ? trans('app.form.update') : trans('app.form.save'), ['class' => 'btn btn-flat btn-lg btn-primary']) !!}
{!! Form::close() !!}

{{ trans('app.product') }}

@include('admin.partials._product_widget', ['product' => $product])
{{ trans('app.variants') }} @foreach ($product->inventories->whereNotNull('parent_id') as $variant) @endforeach
@if ($variant->image) {{ $variant->title }} @else {{ $variant->title }} @endif @foreach ($variant->attributeValues as $attrVal) {{ $attrVal->value }} @unless ($loop->last) @endunless @endforeach
@endsection