@extends('layouts.app')
@section('title', __('purchase.edit_purchase'))
@section('content')
@php
$custom_labels = json_decode(session('business.custom_labels'), true);
@endphp
@include('layouts.partials.error')
{!! Form::open(['url' => action([\App\Http\Controllers\PurchaseController::class, 'update'] , [$purchase->id] ), 'method' => 'PUT', 'id' => 'add_purchase_form', 'files' => true ]) !!}
@php
$currency_precision = session('business.currency_precision', 2);
@endphp
@component('components.widget', ['class' => 'box-primary'])
@lang('business.address'):
{!! $purchase->contact->contact_address !!}
{!! Form::label('ref_no', __('purchase.ref_no') . '*') !!}
@show_tooltip(__('lang_v1.leave_empty_to_autogenerate'))
{!! Form::text('ref_no', $purchase->ref_no, ['class' => 'form-control', 'required']); !!}
{!! Form::label('status', __('purchase.purchase_status') . ':*') !!}
@show_tooltip(__('tooltip.order_status'))
{!! Form::select('status', $statusList, $purchase->status, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select') , 'required']); !!}
{!! Form::label('location_id', __('purchase.business_location').':*') !!}
@show_tooltip(__('tooltip.purchase_location'))
{!! Form::select('location_id', $business_locations, $purchase->location_id, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select'), 'disabled']); !!}
@php
$custom_field_1_label = !empty($custom_labels['purchase']['custom_field_1']) ? $custom_labels['purchase']['custom_field_1'] : '';
$is_custom_field_1_required = !empty($custom_labels['purchase']['is_custom_field_1_required']) && $custom_labels['purchase']['is_custom_field_1_required'] == 1 ? true : false;
$custom_field_2_label = !empty($custom_labels['purchase']['custom_field_2']) ? $custom_labels['purchase']['custom_field_2'] : '';
$is_custom_field_2_required = !empty($custom_labels['purchase']['is_custom_field_2_required']) && $custom_labels['purchase']['is_custom_field_2_required'] == 1 ? true : false;
$custom_field_3_label = !empty($custom_labels['purchase']['custom_field_3']) ? $custom_labels['purchase']['custom_field_3'] : '';
$is_custom_field_3_required = !empty($custom_labels['purchase']['is_custom_field_3_required']) && $custom_labels['purchase']['is_custom_field_3_required'] == 1 ? true : false;
$custom_field_4_label = !empty($custom_labels['purchase']['custom_field_4']) ? $custom_labels['purchase']['custom_field_4'] : '';
$is_custom_field_4_required = !empty($custom_labels['purchase']['is_custom_field_4_required']) && $custom_labels['purchase']['is_custom_field_4_required'] == 1 ? true : false;
@endphp
@if(!empty($custom_field_1_label))
@php
$label_1 = $custom_field_1_label . ':';
if($is_custom_field_1_required) {
$label_1 .= '*';
}
@endphp
{!! Form::label('custom_field_1', $label_1 ) !!}
{!! Form::text('custom_field_1', $purchase->custom_field_1, ['class' => 'form-control','placeholder' => $custom_field_1_label, 'required' => $is_custom_field_1_required]); !!}
@endif
@if(!empty($custom_field_2_label))
@php
$label_2 = $custom_field_2_label . ':';
if($is_custom_field_2_required) {
$label_2 .= '*';
}
@endphp
{!! Form::label('custom_field_2', $label_2 ) !!}
{!! Form::text('custom_field_2', $purchase->custom_field_2, ['class' => 'form-control','placeholder' => $custom_field_2_label, 'required' => $is_custom_field_2_required]); !!}
@endif
@if(!empty($custom_field_3_label))
@php
$label_3 = $custom_field_3_label . ':';
if($is_custom_field_3_required) {
$label_3 .= '*';
}
@endphp
{!! Form::label('custom_field_3', $label_3 ) !!}
{!! Form::text('custom_field_3', $purchase->custom_field_3, ['class' => 'form-control','placeholder' => $custom_field_3_label, 'required' => $is_custom_field_3_required]); !!}
@endif
@if(!empty($custom_field_4_label))
@php
$label_4 = $custom_field_4_label . ':';
if($is_custom_field_4_required) {
$label_4 .= '*';
}
@endphp
{!! Form::label('custom_field_4', $label_4 ) !!}
{!! Form::text('custom_field_4', $purchase->custom_field_4, ['class' => 'form-control','placeholder' => $custom_field_4_label, 'required' => $is_custom_field_4_required]); !!}
@endif
@if(!empty($common_settings['enable_purchase_order']))
{!! Form::label('purchase_order_ids', __('lang_v1.purchase_order').':') !!}
{!! Form::select('purchase_order_ids[]', $purchase_orders, $purchase->purchase_order_ids, ['class' => 'form-control select2', 'multiple', 'id' => 'purchase_order_ids']); !!}
@endif
@endcomponent
@component('components.widget', ['class' => 'box-primary'])
@include('purchase.partials.edit_purchase_entry_row')
@lang( 'lang_v1.total_items' ): |
|
@lang( 'purchase.total_before_tax' ): |
|
@lang( 'purchase.net_total_amount' ): |
{{$purchase->total_before_tax/$purchase->exchange_rate}}
|
@endcomponent
@component('components.widget', ['class' => 'box-primary'])
{!! Form::label('discount_type', __( 'purchase.discount_type' ) . ':') !!}
{!! Form::select('discount_type', [ '' => __('lang_v1.none'), 'fixed' => __( 'lang_v1.fixed' ), 'percentage' => __( 'lang_v1.percentage' )], $purchase->discount_type, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select')]); !!}
|
{!! Form::label('discount_amount', __( 'purchase.discount_amount' ) . ':') !!}
{!! Form::text('discount_amount',
($purchase->discount_type == 'fixed' ?
number_format($purchase->discount_amount/$purchase->exchange_rate, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator)
:
number_format($purchase->discount_amount, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator)
)
, ['class' => 'form-control input_number']); !!}
|
|
Discount:(-)
0
|
{!! Form::label('tax_id', __( 'purchase.purchase_tax' ) . ':') !!}
{!! Form::hidden('tax_amount', $purchase->tax_amount, ['id' => 'tax_amount']); !!}
|
|
|
@lang( 'purchase.purchase_tax' ):(+)
0
|
{!! Form::label('additional_notes',__('purchase.additional_notes')) !!}
{!! Form::textarea('additional_notes', $purchase->additional_notes, ['class' => 'form-control', 'rows' => 3]); !!}
|
@endcomponent
@component('components.widget', ['class' => 'box-primary'])
{!! Form::label('shipping_details', __( 'purchase.shipping_details' ) . ':') !!}
{!! Form::text('shipping_details', $purchase->shipping_details, ['class' => 'form-control']); !!}
{!! Form::label('shipping_charges','(+) ' . __( 'purchase.additional_shipping_charges') . ':') !!}
{!! Form::text('shipping_charges', number_format($purchase->shipping_charges/$purchase->exchange_rate, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input_number']); !!}
@php
$shipping_custom_label_1 = !empty($custom_labels['purchase_shipping']['custom_field_1']) ? $custom_labels['purchase_shipping']['custom_field_1'] : '';
$is_shipping_custom_field_1_required = !empty($custom_labels['purchase_shipping']['is_custom_field_1_required']) && $custom_labels['purchase_shipping']['is_custom_field_1_required'] == 1 ? true : false;
$shipping_custom_label_2 = !empty($custom_labels['purchase_shipping']['custom_field_2']) ? $custom_labels['purchase_shipping']['custom_field_2'] : '';
$is_shipping_custom_field_2_required = !empty($custom_labels['purchase_shipping']['is_custom_field_2_required']) && $custom_labels['purchase_shipping']['is_custom_field_2_required'] == 1 ? true : false;
$shipping_custom_label_3 = !empty($custom_labels['purchase_shipping']['custom_field_3']) ? $custom_labels['purchase_shipping']['custom_field_3'] : '';
$is_shipping_custom_field_3_required = !empty($custom_labels['purchase_shipping']['is_custom_field_3_required']) && $custom_labels['purchase_shipping']['is_custom_field_3_required'] == 1 ? true : false;
$shipping_custom_label_4 = !empty($custom_labels['purchase_shipping']['custom_field_4']) ? $custom_labels['purchase_shipping']['custom_field_4'] : '';
$is_shipping_custom_field_4_required = !empty($custom_labels['purchase_shipping']['is_custom_field_4_required']) && $custom_labels['purchase_shipping']['is_custom_field_4_required'] == 1 ? true : false;
$shipping_custom_label_5 = !empty($custom_labels['purchase_shipping']['custom_field_5']) ? $custom_labels['purchase_shipping']['custom_field_5'] : '';
$is_shipping_custom_field_5_required = !empty($custom_labels['purchase_shipping']['is_custom_field_5_required']) && $custom_labels['purchase_shipping']['is_custom_field_5_required'] == 1 ? true : false;
@endphp
@if(!empty($shipping_custom_label_1))
@php
$label_1 = $shipping_custom_label_1 . ':';
if($is_shipping_custom_field_1_required) {
$label_1 .= '*';
}
@endphp
{!! Form::label('shipping_custom_field_1', $label_1 ) !!}
{!! Form::text('shipping_custom_field_1', $purchase->shipping_custom_field_1 ?? null, ['class' => 'form-control','placeholder' => $shipping_custom_label_1, 'required' => $is_shipping_custom_field_1_required]); !!}
@endif
@if(!empty($shipping_custom_label_2))
@php
$label_2 = $shipping_custom_label_2 . ':';
if($is_shipping_custom_field_2_required) {
$label_2 .= '*';
}
@endphp
{!! Form::label('shipping_custom_field_2', $label_2 ) !!}
{!! Form::text('shipping_custom_field_2', $purchase->shipping_custom_field_2 ?? null, ['class' => 'form-control','placeholder' => $shipping_custom_label_2, 'required' => $is_shipping_custom_field_2_required]); !!}
@endif
@if(!empty($shipping_custom_label_3))
@php
$label_3 = $shipping_custom_label_3 . ':';
if($is_shipping_custom_field_3_required) {
$label_3 .= '*';
}
@endphp
{!! Form::label('shipping_custom_field_3', $label_3 ) !!}
{!! Form::text('shipping_custom_field_3', $purchase->shipping_custom_field_3 ?? null, ['class' => 'form-control','placeholder' => $shipping_custom_label_3, 'required' => $is_shipping_custom_field_3_required]); !!}
@endif
@if(!empty($shipping_custom_label_4))
@php
$label_4 = $shipping_custom_label_4 . ':';
if($is_shipping_custom_field_4_required) {
$label_4 .= '*';
}
@endphp
{!! Form::label('shipping_custom_field_4', $label_4 ) !!}
{!! Form::text('shipping_custom_field_4', $purchase->shipping_custom_field_4 ?? null, ['class' => 'form-control','placeholder' => $shipping_custom_label_4, 'required' => $is_shipping_custom_field_4_required]); !!}
@endif
@if(!empty($shipping_custom_label_5))
@php
$label_5 = $shipping_custom_label_5 . ':';
if($is_shipping_custom_field_5_required) {
$label_5 .= '*';
}
@endphp
{!! Form::label('shipping_custom_field_5', $label_5 ) !!}
{!! Form::text('shipping_custom_field_5', $purchase->shipping_custom_field_5 ?? null, ['class' => 'form-control','placeholder' => $shipping_custom_label_5, 'required' => $is_shipping_custom_field_5_required]); !!}
@endif
@lang('lang_v1.additional_expense_name') |
@lang('sale.amount') |
{!! Form::text('additional_expense_key_1', $purchase->additional_expense_key_1, ['class' => 'form-control', 'id' => 'additional_expense_key_1']); !!}
|
{!! Form::text('additional_expense_value_1', number_format($purchase->additional_expense_value_1/$purchase->exchange_rate, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input_number', 'id' => 'additional_expense_value_1']); !!}
|
{!! Form::text('additional_expense_key_2', $purchase->additional_expense_key_2, ['class' => 'form-control', 'id' => 'additional_expense_key_2']); !!}
|
{!! Form::text('additional_expense_value_2', number_format($purchase->additional_expense_value_2/$purchase->exchange_rate, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input_number', 'id' => 'additional_expense_value_2']); !!}
|
{!! Form::text('additional_expense_key_3', $purchase->additional_expense_key_3, ['class' => 'form-control', 'id' => 'additional_expense_key_3']); !!}
|
{!! Form::text('additional_expense_value_3', number_format($purchase->additional_expense_value_3/$purchase->exchange_rate, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input_number', 'id' => 'additional_expense_value_3']); !!}
|
{!! Form::text('additional_expense_key_4', $purchase->additional_expense_key_4, ['class' => 'form-control', 'id' => 'additional_expense_key_4']); !!}
|
{!! Form::text('additional_expense_value_4', number_format($purchase->additional_expense_value_4/$purchase->exchange_rate, $currency_precision, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-control input_number', 'id' => 'additional_expense_value_4']); !!}
|
{!! Form::hidden('final_total', $purchase->final_total , ['id' => 'grand_total_hidden']); !!}
@lang('purchase.purchase_total'): {{$purchase->final_total}}
@endcomponent
{!! Form::close() !!}
@include('contact.create', ['quick_add' => true])
@include('purchase.partials.import_purchase_products_modal')
@endsection
@section('javascript')
@include('purchase.partials.keyboard_shortcuts')
@endsection