@php if(isset($update_action)) { $url = $update_action; $customer_groups = []; $opening_balance = 0; $lead_users = $contact->leadUsers->pluck('id'); } else { $url = action('ContactController@update', [$contact->id]); $sources = []; $life_stages = []; $users = []; $lead_users = []; } @endphp {!! Form::open(['url' => $url, 'method' => 'PUT', 'id' => 'contact_edit_form']) !!}

@lang('contact.edit_contact')

{!! Form::label('type', __('contact.contact_type') . ':*' ) !!}
{!! Form::select('type', $types, $contact->type, ['class' => 'form-control', 'id' => 'contact_type','placeholder' => __('messages.please_select'), 'required']); !!}
{!! Form::label('contact_id', __('lang_v1.contact_id') . ':') !!}
{!! Form::text('contact_id', $contact->contact_id, ['class' => 'form-control','placeholder' => __('lang_v1.contact_id')]); !!}
{!! Form::label('customer_group_id', __('lang_v1.customer_group') . ':') !!}
{!! Form::select('customer_group_id', $customer_groups, $contact->customer_group_id, ['class' => 'form-control']); !!}
{!! Form::label('supplier_business_name', __('business.business_name') . ':*') !!}
{!! Form::text('supplier_business_name', $contact->supplier_business_name, ['class' => 'form-control', 'required', 'placeholder' => __('business.business_name')]); !!}
{!! Form::label('prefix', __( 'business.prefix' ) . ':') !!} {!! Form::text('prefix', $contact->prefix, ['class' => 'form-control', 'placeholder' => __( 'business.prefix_placeholder' ) ]); !!}
{!! Form::label('first_name', __( 'business.first_name' ) . ':*') !!} {!! Form::text('first_name', $contact->first_name, ['class' => 'form-control', 'required', 'placeholder' => __( 'business.first_name' ) ]); !!}
{!! Form::label('middle_name', __( 'lang_v1.middle_name' ) . ':') !!} {!! Form::text('middle_name', $contact->middle_name, ['class' => 'form-control', 'placeholder' => __( 'lang_v1.middle_name' ) ]); !!}
{!! Form::label('last_name', __( 'business.last_name' ) . ':') !!} {!! Form::text('last_name', $contact->last_name, ['class' => 'form-control', 'placeholder' => __( 'business.last_name' ) ]); !!}
{!! Form::label('mobile', __('contact.mobile') . ':*') !!}
{!! Form::text('mobile', $contact->mobile, ['class' => 'form-control', 'required', 'placeholder' => __('contact.mobile')]); !!}
{!! Form::label('alternate_number', __('contact.alternate_contact_number') . ':') !!}
{!! Form::text('alternate_number', $contact->alternate_number, ['class' => 'form-control', 'placeholder' => __('contact.alternate_contact_number')]); !!}
{!! Form::label('landline', __('contact.landline') . ':') !!}
{!! Form::text('landline', $contact->landline, ['class' => 'form-control', 'placeholder' => __('contact.landline')]); !!}
{!! Form::label('email', __('business.email') . ':') !!}
{!! Form::email('email', $contact->email, ['class' => 'form-control','placeholder' => __('business.email')]); !!}
{!! Form::label('dob', __('lang_v1.dob') . ':') !!}
{!! Form::text('dob', !empty($contact->dob) ? @format_date($contact->dob) : null, ['class' => 'form-control dob-date-picker','placeholder' => __('lang_v1.dob'), 'readonly']); !!}
{!! Form::label('crm_source', __('lang_v1.source') . ':' ) !!}
{!! Form::select('crm_source', $sources, $contact->crm_source , ['class' => 'form-control', 'id' => 'crm_source','placeholder' => __('messages.please_select')]); !!}
{!! Form::label('crm_life_stage', __('lang_v1.life_stage') . ':' ) !!}
{!! Form::select('crm_life_stage', $life_stages, $contact->crm_life_stage , ['class' => 'form-control', 'id' => 'crm_life_stage','placeholder' => __('messages.please_select')]); !!}
{!! Form::label('user_id', __('lang_v1.assigned_to') . ':*' ) !!}
{!! Form::select('user_id[]', $users, $lead_users , ['class' => 'form-control select2', 'id' => 'user_id', 'multiple', 'required', 'style' => 'width: 100%;']); !!}

{!! Form::label('tax_number', __('contact.tax_no') . ':') !!}
{!! Form::text('tax_number', $contact->tax_number, ['class' => 'form-control', 'placeholder' => __('contact.tax_no')]); !!}
{!! Form::label('opening_balance', __('lang_v1.opening_balance') . ':') !!}
{!! Form::text('opening_balance', $opening_balance, ['class' => 'form-control input_number']); !!}
{!! Form::label('pay_term_number', __('contact.pay_term') . ':') !!} @show_tooltip(__('tooltip.pay_term'))
{!! Form::number('pay_term_number', $contact->pay_term_number, ['class' => 'form-control width-40 pull-left', 'placeholder' => __('contact.pay_term')]); !!} {!! Form::select('pay_term_type', ['months' => __('lang_v1.months'), 'days' => __('lang_v1.days')], $contact->pay_term_type, ['class' => 'form-control width-60 pull-left','placeholder' => __('messages.please_select')]); !!}
{!! Form::label('credit_limit', __('lang_v1.credit_limit') . ':') !!}
{!! Form::text('credit_limit', @num_format($contact->credit_limit), ['class' => 'form-control input_number']); !!}

@lang('lang_v1.credit_limit_help')


{!! Form::label('address_line_1', __('lang_v1.address_line_1') . ':') !!} {!! Form::text('address_line_1', $contact->address_line_1, ['class' => 'form-control', 'placeholder' => __('lang_v1.address_line_1'), 'rows' => 3]); !!}
{!! Form::label('address_line_2', __('lang_v1.address_line_2') . ':') !!} {!! Form::text('address_line_2', $contact->address_line_2, ['class' => 'form-control', 'placeholder' => __('lang_v1.address_line_2'), 'rows' => 3]); !!}
{!! Form::label('city', __('business.city') . ':') !!}
{!! Form::text('city', $contact->city, ['class' => 'form-control', 'placeholder' => __('business.city')]); !!}
{!! Form::label('state', __('business.state') . ':') !!}
{!! Form::text('state', $contact->state, ['class' => 'form-control', 'placeholder' => __('business.state')]); !!}
{!! Form::label('country', __('business.country') . ':') !!}
{!! Form::text('country', $contact->country, ['class' => 'form-control', 'placeholder' => __('business.country')]); !!}
{!! Form::label('zip_code', __('business.zip_code') . ':') !!}
{!! Form::text('zip_code', $contact->zip_code, ['class' => 'form-control', 'placeholder' => __('business.zip_code_placeholder')]); !!}

@php $custom_labels = json_decode(session('business.custom_labels'), true); $contact_custom_field1 = !empty($custom_labels['contact']['custom_field_1']) ? $custom_labels['contact']['custom_field_1'] : __('lang_v1.contact_custom_field1'); $contact_custom_field2 = !empty($custom_labels['contact']['custom_field_2']) ? $custom_labels['contact']['custom_field_2'] : __('lang_v1.contact_custom_field2'); $contact_custom_field3 = !empty($custom_labels['contact']['custom_field_3']) ? $custom_labels['contact']['custom_field_3'] : __('lang_v1.contact_custom_field3'); $contact_custom_field4 = !empty($custom_labels['contact']['custom_field_4']) ? $custom_labels['contact']['custom_field_4'] : __('lang_v1.contact_custom_field4'); @endphp
{!! Form::label('custom_field1', $contact_custom_field1 . ':') !!} {!! Form::text('custom_field1', $contact->custom_field1, ['class' => 'form-control', 'placeholder' => $contact_custom_field1]); !!}
{!! Form::label('custom_field2', $contact_custom_field2 . ':') !!} {!! Form::text('custom_field2', $contact->custom_field2, ['class' => 'form-control', 'placeholder' => $contact_custom_field2]); !!}
{!! Form::label('custom_field3', $contact_custom_field3 . ':') !!} {!! Form::text('custom_field3', $contact->custom_field3, ['class' => 'form-control', 'placeholder' => $contact_custom_field3]); !!}
{!! Form::label('custom_field4', $contact_custom_field4 . ':') !!} {!! Form::text('custom_field4', $contact->custom_field4, ['class' => 'form-control', 'placeholder' => $contact_custom_field4]); !!}

{{__('lang_v1.shipping_address')}}
{!! Form::text('shipping_address', $contact->shipping_address, ['class' => 'form-control', 'placeholder' => __('lang_v1.search_address'), 'id' => 'shipping_address']); !!}
{!! Form::hidden('position', $contact->position, ['id' => 'position']); !!}
{!! Form::close() !!}