@extends('admins.layouts.index') @section('content') {!! Form::model($model, ['method'=>'post','class'=>'form-horizontal']) !!}

{{__('Basic Information')}}

{!! Form::label('document_no', __('Document No'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::text('document_no', null, ['id'=>'document_no','class'=>'form-control '.($errors->first('document_no') ? 'is-invalid' : ''),'placeholder'=>__('Document No'),'readonly']) !!} {!!$errors->first('document_no', ':message')!!}
{!! Form::label('document_date', __('Document Date'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::text('document_date', null, ['id'=>'document_date','class'=>'form-control datepicker '.($errors->first('document_date') ? 'is-invalid' : ''),'placeholder'=>__('Document Date'),'autocomplete'=>'off']) !!} {!!$errors->first('document_date', ':message')!!}
{!! Form::label('payment_method_id', __('Payment Method'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::select('payment_method_id', App\PaymentMethod::combobox(), null, ['id'=>'payment_method_id','class'=>'form-control '.($errors->first('payment_method_id') ? 'is-invalid' : '')]) !!} {!!$errors->first('payment_method_id', ':message')!!}
{!! Form::label('status', __('Status'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::text('status', null, ['id'=>'status','class'=>'form-control '.($errors->first('status') ? 'is-invalid' : ''),'placeholder'=>__('Status'),'readonly']) !!} {!!$errors->first('status', ':message')!!}
{!! Form::label('tour_id', __('Tour'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::select('tour_id', App\Tour::combobox(), null, ['id'=>'tour_id','class'=>'form-control '.($errors->first('tour_id') ? 'is-invalid' : ''),'onchange'=>'initTourInfo(this)']) !!} {!!$errors->first('tour_id', ':message')!!}
{!! Form::label('tour_date', __('Tour Date'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::text('tour_date', null, ['id'=>'tour_date','class'=>'form-control datepicker '.($errors->first('tour_date') ? 'is-invalid' : ''),'placeholder'=>__('Tour Date'),'autocomplete'=>'off']) !!} {!!$errors->first('tour_date', ':message')!!}
{!! Form::label('description', __('Description'), ['class'=>'col-sm-2 col-form-label text-right']) !!}
{!! Form::text('description', null, ['id'=>'description','class'=>'form-control '.($errors->first('description') ? 'is-invalid' : ''),'placeholder'=>__('Description')]) !!} {!!$errors->first('description', ':message')!!}
@if($model->id)

{{__('Comment & Rating Information')}}

{{__('Follow Up Information')}}

@endif

{{__('Customer Information')}}

{!! Form::label('buyer_id', __('Buyer'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::select('buyer_id', App\User::combobox(), null, ['id'=>'buyer_id','class'=>'form-control '.($errors->first('buyer_id') ? 'is-invalid' : ''),'onchange'=>'initBuyerInfo(this)']) !!} {!!$errors->first('buyer_id', ':message')!!}
{!! Form::label('name', __('Name'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::text('name', null, ['id'=>'name','class'=>'form-control '.($errors->first('name') ? 'is-invalid' : ''),'placeholder'=>__('Name')]) !!} {!!$errors->first('name', ':message')!!}
{!! Form::label('email', __('Email'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::email('email', null, ['id'=>'email','class'=>'form-control '.($errors->first('email') ? 'is-invalid' : ''),'placeholder'=>__('Email')]) !!} {!!$errors->first('email', ':message')!!}
{!! Form::label('mobile_no', __('Mobile'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::text('mobile_no', null, ['id'=>'mobile_no','class'=>'form-control '.($errors->first('mobile_no') ? 'is-invalid' : ''),'placeholder'=>__('Mobile')]) !!} {!!$errors->first('mobile_no', ':message')!!}
{!! Form::label('address', __('Address'), ['class'=>'col-sm-2 col-form-label text-right']) !!}
{!! Form::text('address', null, ['id'=>'address','class'=>'form-control '.($errors->first('address') ? 'is-invalid' : ''),'placeholder'=>__('Address')]) !!} {!!$errors->first('address', ':message')!!}

{{__('Order Information')}}

{!! Form::label('adult_pack', __('Adult Pack'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::number('adult_pack', null, ['min'=>'0','id'=>'adult_pack','class'=>'form-control '.($errors->first('adult_pack') ? 'is-invalid' : ''),'placeholder'=>__('Adult Pack'),'onchange'=>'reCalculate()']) !!} {!!$errors->first('adult_pack', ':message')!!}
{!! Form::label('child_pack', __('child Pack'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::number('child_pack', null, ['min'=>'0','id'=>'child_pack','class'=>'form-control '.($errors->first('child_pack') ? 'is-invalid' : ''),'placeholder'=>__('child Pack'),'onchange'=>'reCalculate()']) !!} {!!$errors->first('child_pack', ':message')!!}
{{ __('Adult Price') }} {{ __('Adult Discount Price') }} {{ __('Child Price') }} {{ __('Child Discount Price') }}
{!! Form::text('adult_price', $model->adult_price, ['class'=>'form-control '.($errors->first('adult_price') ? 'is-invalid' : ''),'onchange'=>'init_double(this),reCalculate()']) !!} {!!$errors->first('adult_price', ':message')!!} {!! Form::text('adult_discounted_price', $model->adult_discounted_price, ['class'=>'form-control '.($errors->first('adult_discounted_price') ? 'is-invalid' : ''),'onchange'=>'init_double(this),reCalculate()']) !!} {!!$errors->first('adult_discounted_price', ':message')!!} {!! Form::text('child_price', $model->child_price, ['class'=>'form-control '.($errors->first('child_price') ? 'is-invalid' : ''),'onchange'=>'init_double(this),reCalculate()']) !!} {!!$errors->first('child_price', ':message')!!} {!! Form::text('child_discounted_price', $model->child_discounted_price, ['class'=>'form-control '.($errors->first('child_discounted_price') ? 'is-invalid' : ''),'onchange'=>'init_double(this),reCalculate()']) !!} {!!$errors->first('child_discounted_price', ':message')!!}
{!! Form::label('total_amount', __('Total Amount'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::number('total_amount', null, ['min'=>'0','id'=>'total_amount','class'=>'form-control '.($errors->first('total_amount') ? 'is-invalid' : ''),'placeholder'=>__('Total Amount'),'readonly']) !!} {!!$errors->first('total_amount', ':message')!!}
{!! Form::label('total_paid', __('Total Paid'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::number('total_paid', null, ['min'=>'0','id'=>'total_paid','class'=>'form-control '.($errors->first('total_paid') ? 'is-invalid' : ''),'placeholder'=>__('Total Paid'),'onchange'=>'init_double(this), reCalculate()']) !!} {!!$errors->first('total_paid', ':message')!!}
{!! Form::label('total_due', __('Total Due'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::number('total_due', null, ['min'=>'0','id'=>'total_due','class'=>'form-control '.($errors->first('total_due') ? 'is-invalid' : ''),'placeholder'=>__('Total Due'),'readonly']) !!} {!!$errors->first('total_due', ':message')!!}
{!! Form::close() !!} @endsection @section('script') function initBuyerInfo(me) { $.get("{{ action('Admin\CustomerController@getInfo') }}", {buyer_id:$(me).val()}, function(data){ $("input[name=name]").val(data.name); $("input[name=email]").val(data.email); $("input[name=mobile_no]").val(data.mobile_no); $("input[name=address]").val(data.address); },"json"); } function initTourInfo(me) { $.get("{{ action('Admin\TourController@getInfo') }}", {tour_id:$(me).val()}, function(data){ $("input[name=adult_price]").val(data.adult_price); $("input[name=adult_discounted_price]").val(data.adult_discounted_price); $("input[name=child_price]").val(data.child_price); $("input[name=child_discounted_price]").val(data.child_discounted_price); reCalculate(); },"json"); } function reCalculate() { var adultPack = ($("input[name=adult_pack]").val() || 0); var childPack = ($("input[name=child_pack]").val() || 0); var adultPrice = ($("input[name=adult_price]").val() || 0); var adultDiscountedPrice = ($("input[name=adult_discounted_price]").val() || 0); var childPrice = ($("input[name=child_price]").val() || 0); var childDiscountedPrice = ($("input[name=child_discounted_price]").val() || 0); var actualAdultPrice = (parseFloat(adultDiscountedPrice) || parseFloat(adultPrice)); var actualChildPrice = (parseFloat(childDiscountedPrice) || parseFloat(childPrice)); actualAdultPrice = parseFloat(adultPack) * parseFloat(actualAdultPrice); actualChildPrice = parseFloat(childPack) * parseFloat(actualChildPrice); var totalAmount = (parseFloat(actualAdultPrice) + parseFloat(actualChildPrice)) .toFixed(decimalPoint); var totalPaid = ($("input[name=total_paid]").val() || 0); var totalDue = (parseFloat(totalAmount) - parseFloat(totalPaid)) .toFixed(decimalPoint); $("input[name=total_amount]").val(totalAmount); $("input[name=total_due]").val(totalDue); } @endsection