@extends('layouts.app') @section('title', 'Price Book') @section('content')

{{ $book->name }} Version {{ $book->version }} - {{ ucfirst($book->status) }}

@component('components.widget', ['title' => 'Price-book details']) @if($book->status === 'draft') {!! Form::open(['route' => ['central-price-books.update', $book->id], 'method' => 'put']) !!}
{!! Form::label('name', 'Name:*') !!}{!! Form::text('name', $book->name, ['class' => 'form-control', 'required']) !!}
{!! Form::label('description', 'Description:') !!}{!! Form::textarea('description', $book->description, ['class' => 'form-control', 'rows' => 2]) !!}
{!! Form::label('priority', 'Priority:*') !!}{!! Form::number('priority', $book->priority, ['class' => 'form-control', 'required']) !!}
{!! Form::label('location_ids', 'Branches:*') !!}{!! Form::select('location_ids[]', $locations, $book->locations->pluck('id')->all(), ['class' => 'form-control select2', 'multiple', 'required']) !!}
{!! Form::label('starts_at', 'Effective from:') !!}
{!! Form::label('ends_at', 'Effective until:') !!}
{!! Form::close() !!}
{!! Form::open(['route' => ['central-price-books.publish', $book->id], 'method' => 'post', 'onsubmit' => "return confirm('Publish this version to the selected branches?')"]) !!}
{!! Form::text('notes', null, ['class' => 'form-control', 'placeholder' => 'Publication note (optional)']) !!}
{!! Form::close() !!} @else
Priority
{{ $book->priority }}
Branches
{{ $book->locations->pluck('name')->implode(', ') }}
Effective
{{ optional($book->starts_at)->format('M d, Y h:i A') ?: 'Immediately' }}
Ends
{{ optional($book->ends_at)->format('M d, Y h:i A') ?: 'No end date' }}
Published
{{ optional($book->published_at)->format('M d, Y h:i A') }}
{!! Form::open(['route' => ['central-price-books.revise', $book->id], 'method' => 'post', 'style' => 'display:inline']) !!} {!! Form::close() !!} @if($book->status === 'published') {!! Form::open(['route' => ['central-price-books.archive', $book->id], 'method' => 'post', 'style' => 'display:inline', 'onsubmit' => "return confirm('Archive this published price book?')"]) !!} {!! Form::close() !!} @endif @endif Back @endcomponent @component('components.widget', ['title' => 'Publication history'])
    @forelse($publications as $publication)
  • v{{ $publication->version }} {{ ucfirst($publication->action) }}
    {{ $publication->published_at->format('M d, Y h:i A') }} {{ $publication->notes }}
  • @empty
  • Not published yet.
  • @endforelse
@endcomponent
@if($book->status === 'draft') @component('components.widget', ['title' => 'Add or update a product price']) {!! Form::open(['route' => ['central-price-books.items.store', $book->id], 'method' => 'post']) !!}
{!! Form::label('variation_id', 'Product variation:*') !!} {!! Form::select('variation_id', $variations, null, ['class' => 'form-control select2', 'required', 'placeholder' => 'Select product']) !!}
{!! Form::label('price_inc_tax', 'Price including tax:*') !!} {!! Form::number('price_inc_tax', null, ['class' => 'form-control', 'required', 'min' => 0, 'step' => '0.01']) !!}
{!! Form::close() !!} @endcomponent @endif @component('components.widget', ['title' => 'Published price entries'])
@if($book->status === 'draft')@endif @forelse($items as $item) @if($book->status === 'draft') @endif @empty @endforelse
ProductSKUPrice including tax
{{ $item->product_name }} @if($item->variation_name !== 'DUMMY') - {{ $item->variation_name }} @endif {{ $item->sub_sku }} @format_currency($item->price_inc_tax) {!! Form::open(['route' => ['central-price-books.items.destroy', $book->id, $item->id], 'method' => 'delete', 'onsubmit' => "return confirm('Remove this price?')"]) !!} {!! Form::close() !!}
No prices in this version.
{{ $items->links() }} @endcomponent
@endsection