@extends('layouts.app') @section('title', __('manufacturing::lang.production')) @section('content') @include('manufacturing::layouts.nav')

@lang('manufacturing::lang.production')

{!! Form::open(['url' => action([\Modules\Manufacturing\Http\Controllers\ProductionController::class, 'update'], [$production_purchase->id]), 'method' => 'put', 'id' => 'production_form', 'files' => true ]) !!} @component('components.widget', ['class' => 'box-solid'])
{!! Form::label('ref_no', __('purchase.ref_no').':') !!} {!! Form::text('ref_no', $production_purchase->ref_no, ['class' => 'form-control']); !!}
{!! Form::label('transaction_date', __('manufacturing::lang.mfg_date') . ':*') !!}
{!! Form::text('transaction_date', @format_datetime($production_purchase->transaction_date), ['class' => 'form-control', 'readonly', 'required']); !!}
{!! Form::label('location_id', __('purchase.business_location').':*') !!} @show_tooltip(__('tooltip.purchase_location')) {!! Form::select('location_id', $business_locations, $production_purchase->location_id, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select'), 'required']); !!}
@php $purchase_line = $production_purchase->purchase_lines[0]; @endphp
{!! Form::label('variation_id_shown', __('sale.product').':*') !!} {!! Form::select('variation_id_shown', $recipe_dropdown, $purchase_line->variation_id, ['class' => 'form-control', 'placeholder' => __('messages.please_select'), 'required', 'disabled']); !!} {!! Form::hidden('variation_id', $purchase_line->variation_id, ['id' => 'variation_id']); !!}
{!! Form::label('recipe_quantity', __('lang_v1.quantity').':*') !!}
{!! Form::text('quantity', @format_quantity($quantity), ['class' => 'form-control input_number', 'id' => 'recipe_quantity', 'required', 'data-rule-notEmpty' => 'true', 'data-rule-notEqualToWastedQuantity' => 'true']); !!} @if(!empty($sub_units)) @else {{ $unit_name }} @endif
{!! Form::label('upload_document', __('purchase.attach_document') . ':') !!} {!! Form::file('documents[]', ['id' => 'upload_document', 'multiple', 'accept' => implode(',', array_keys(config('constants.document_upload_mimes_types')))]); !!}

@lang('purchase.max_file_size', ['size' => (config('constants.document_size_limit') / 1000000)]) @includeIf('components.document_help_text')

@include('sell.partials.media_table', ['medias' => $production_purchase->media, 'delete' => true])
@endcomponent @component('components.widget', ['class' => 'box-solid', 'title' => __('manufacturing::lang.ingredients')])
@include('manufacturing::recipe.ingredients_for_production')
@if(request()->session()->get('business.enable_lot_number') == 1)
{!! Form::label('lot_number', __('lang_v1.lot_number').':') !!} {!! Form::text('lot_number', $purchase_line->lot_number, ['class' => 'form-control']); !!}
@endif @if(session('business.enable_product_expiry'))
{!! Form::label('exp_date', __('product.exp_date').':*') !!}
{!! Form::text('exp_date', !empty($purchase_line->exp_date) ? @format_date($purchase_line->exp_date) : null, ['class' => 'form-control', 'readonly']); !!}
@endif
{!! Form::label('mfg_wasted_units', __('manufacturing::lang.waste_units').':') !!} @show_tooltip(__('manufacturing::lang.wastage_tooltip'))
{!! Form::text('mfg_wasted_units', @num_format($production_purchase->mfg_wasted_units), ['class' => 'form-control input_number']); !!} {{$unit_name}}
{!! Form::label('production_cost', __('manufacturing::lang.production_cost').':') !!} @show_tooltip(__('manufacturing::lang.production_cost_tooltip'))
{!! Form::text('production_cost', @num_format($production_purchase->mfg_production_cost), ['class' => 'form-control input_number']); !!} {!! Form::select('mfg_production_cost_type',['fixed' => __('lang_v1.fixed'), 'percentage' => __('lang_v1.percentage'), 'per_unit' => __('manufacturing::lang.per_unit')], $production_purchase->mfg_production_cost_type, ['class' => 'form-control', 'id' => 'mfg_production_cost_type']); !!}

{{__('manufacturing::lang.total_production_cost')}}: {{$total_production_cost}}

{!! Form::hidden('final_total', @num_format($production_purchase->final_total), ['id' => 'final_total']); !!} {{__('manufacturing::lang.total_cost')}}: {{ $production_purchase->final_total }}

@show_tooltip(__('manufacturing::lang.finalize_tooltip'))
@endcomponent {!! Form::close() !!}
@endsection @section('javascript') @include('manufacturing::production.production_script') @endsection