@extends('layouts.seller') @section('content') @include('layouts.partials.messages')
{!! Form::open(['route' => $routes, 'method' => 'POST', 'id' => 'ajaxSave']) !!}
{{ Form::label('request_no', __('stock_request.request_no'), ['class' => 'col-form-label']) }} {{ Form::text('request_id', isset($requestId) ? $requestId : $data->id, ['placeholder' => __('stock_request.request_no'), 'class' => 'form-control', 'readonly' => true]) }}
{!! Form::label('request_date', __('stock_request.request_date'), ['class' => 'col-form-label']) !!} @php $requestDate = $data->request_date ? dateFormat($data->request_date, 'd-m-Y') : date('d-m-Y'); @endphp {{ Form::text('request_date', $requestDate, ['placeholder' => __('stock_request.request_date'), 'class' => 'form-control', 'readonly' => true]) }}
{!! Form::label('remarks', __('stock_request.remarks'), ['class' => 'col-sm-4 col-form-label']) !!} {{ Form::textarea('remarks', $data->remarks, ['placeholder' => __('stock_request.remarks'), 'class' => 'form-control', 'id' => 'remark', 'cols' => 2, 'rows' => 1]) }}
{{-- Show Departments in Edit section --}} @if ($data->id) {!! Form::label('stock_notice', __('stock_request.notice'), ['class' => 'col-sm-4 col-form-label']) !!}
@endif
{{-- Edit section start --}} @if ($data->id)
@if ($data->id)
@endif
@php $sumOfPrice = 0; @endphp @if (isset($requestItems)) @foreach ($requestItems as $k => $rItem) @php $sumOfPrice += $rItem->total_price; @endphp
{{ Form::select('department_id['.$k.']', $inventoryDepartments, $rItem->department_id, array('class' => 'form-control item-department select2', 'data-live-search' => 'true','data-item_id'=>$k,'onChange'=>'itemsFilter(this)')) }}
{!! Form::hidden("request_item_id[$k]", $rItem->id) !!} {!! Form::hidden("item_count[$k]", 1) !!}
{!! Form::text("base_price[$k]", $rItem->price, [ 'class' => 'form-control base_price type_number', 'readonly' => true, ]) !!} {!! Form::hidden("base_netto_price[$k]", $rItem->netto_price, ['class' => 'base_netto_price']) !!}
{!! Form::text("quantity[$k]", $rItem->quantity, ['class' => 'form-control quantity type_number']) !!}
{!! Form::text("total_price[$k]", $rItem->total_price, [ 'class' => 'form-control total_price type_number', 'readonly' => true, ]) !!}
{!! Form::text("actual_stock[$k]", (int) $rItem->actual_stock, [ 'class' => 'form-control col-3 mr-1 type_number __actual_stock', ]) !!} {!! Form::text("stock_in[$k]", (int) $rItem->stock_in, [ 'class' => 'form-control col-3 mr-1 __stock_in', 'readonly' => true, ]) !!} {!! Form::text("diff[$k]", (int) ($rItem->actual_stock - $rItem->stock_in), [ 'class' => 'form-control col-3 __diff', 'readonly' => true, ]) !!}
@endforeach @endif {!! Form::hidden('delete_items', null, ['class' => '__delete_item']) !!}
@if (!isset($requestItems))
{{ __('stock_request.grand_total') }}:
@else
{{ __('stock_request.grand_total') }}: {{ numberFormat($sumOfPrice) }}
@endif
@else {{-- Add section --}}

{{--
{!! __('stock_request.request_comment') !!}
--}}
{{ Form::select('department', $departments, $data->department_id, array('class' => 'form-control departments select2', 'id'=>'department', 'data-live-search' => 'true')) }}
@php $inventoryTypes = inventoryType(); @endphp @if (isset($inventoryTypes) && count($inventoryTypes) > 0) @foreach ($inventoryTypes as $id => $inventoryType) @endforeach @endif
{{--
--}}


@endif
    @if ($data->id)
  • @endif
@if ($data->id) @method('PUT') @endif {!! Form::close() !!}
@if($data->id)
{{ Form::select('department_id', $inventoryDepartments, '', array('class' => 'item-department','onChange'=>'itemsFilter(this)','data-item_id'=>0)) }}
@endif
{!! Form::hidden('item_count[]', 1, ['class' => 'item_count']) !!}
{!! Form::text('base_price[]', '', ['class' => 'form-control base_price type_number', 'readonly' => true]) !!} {!! Form::hidden('base_netto_price[]', '', ['class' => 'base_netto_price']) !!}
{!! Form::text('quantity[]', '', ['readonly' => true, 'class' => 'form-control quantity type_number']) !!}
{!! Form::text('total_price[]', '', ['readonly' => true, 'class' => 'form-control total_price type_number']) !!}
{!! Form::text('actual_stock[]', null, ['class' => 'form-control col-3 mr-1 type_number __actual_stock']) !!} {!! Form::text('stock_in[]', null, ['class' => 'form-control col-3 mr-1 __stock_in', 'readonly' => true]) !!} {!! Form::text('diff[]', null, ['class' => 'form-control col-3 __diff', 'readonly' => true]) !!}
@endsection @section('script') @if(!$data->id) @include('layouts.add-stock-script' , ['route' => $ajaxRoute ?? '' , 'forStockRequest' => true]) @endif @endsection