Skip to content
Prev Previous commit
Next Next commit
wip
  • Loading branch information
djaiss committed Feb 3, 2018
commit 6cd9926f04df7387cc08f606e66f4bc26e0f4acf
5 changes: 3 additions & 2 deletions app/Http/Controllers/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ public function show(Contact $contact)
public function edit(Contact $contact)
{
return view('people.edit')
->withContact($contact);
->withContact($contact)
->withGenders(auth()->user()->account->genders);
}

/**
Expand All @@ -225,7 +226,7 @@ public function update(Request $request, Contact $contact)
->withErrors($validator);
}

$contact->gender = $request->input('gender');
$contact->gender_id = $request->input('gender');
$contact->first_name = $request->input('firstname');
$contact->last_name = $request->input('lastname');

Expand Down
138 changes: 78 additions & 60 deletions resources/views/people/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,93 @@

@section('content')

<div class="mt4 mw7 center mb3">
<h3 class="f3 fw5">{{ trans('people.people_add_title') }}</h3>
<section class="ph3 ph0-ns">
<div class="mt4 mw7 center mb3">
<h3 class="f3 fw5">{{ trans('people.people_add_title') }}</h3>

@if (! auth()->user()->account->hasLimitations())
<p class="import">{!! trans('people.people_add_import') !!}</p>
@endif
</div>
@if (! auth()->user()->account->hasLimitations())
<p class="import">{!! trans('people.people_add_import') !!}</p>
@endif
</div>

<div class="mw7 center pa4 br3 ba b--gray-monica bg-white mb6">
<div class="mw7 center br3 ba b--gray-monica bg-white mb6">

@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif

@include('partials.errors')
@include('partials.errors')

<form action="/people" method="POST">
{{ csrf_field() }}
{{-- This check is for the cultures that are used to say the last name first --}}
@if (auth()->user()->name_order == 'firstname_first')
<form action="/people" method="POST">
{{ csrf_field() }}

<div class="mb4">
<form-input
v-bind:id="'first_name'"
v-bind:required="true"
v-bind:title="'{{ trans('people.people_add_firstname') }}'">
</form-input>
</div>
<div class="mb4">
<form-input
v-bind:id="'last_name'"
v-bind:required="false"
v-bind:title="'{{ trans('people.people_add_lastname') }}'">
</form-input>
</div>
<div class="pa4-ns ph3 pv2 bb b--gray-monica">
{{-- This check is for the cultures that are used to say the last name first --}}
@if (auth()->user()->name_order == 'firstname_first')

@else
<div class="mb3">
<form-input
v-bind:id="'first_name'"
v-bind:required="true"
v-bind:title="'{{ trans('people.people_add_firstname') }}'">
</form-input>
</div>

<div class="mb4">
<form-input
v-bind:id="'last_name'"
v-bind:required="false"
v-bind:title="'{{ trans('people.people_add_lastname') }}'">
</form-input>
</div>
<div class="mb4">
<form-input
v-bind:id="'first_name'"
v-bind:required="true"
v-bind:title="'{{ trans('people.people_add_firstname') }}'">
</form-input>
</div>
<div class="mb3 mb0-ns">
<form-input
v-bind:id="'last_name'"
v-bind:required="false"
v-bind:title="'{{ trans('people.people_add_lastname') }}'">
</form-input>
</div>

@endif
@else

<div class="mb4">
<form-select
:options="{{ $genders }}"
v-bind:required="true"
v-bind:title="'{{ trans('people.people_add_gender') }}'"
v-bind:id="'gender'">
</form-select>
</div>
<button class="btn btn-primary" name="save" type="submit">{{ trans('people.people_add_cta') }}</button>
<button class="btn btn-secondary" name="save_and_add_another" type="submit">{{ trans('people.people_save_and_add_another_cta') }}</button>
<a href="/people" class="btn btn-secondary">{{ trans('app.cancel') }}</a>
</form>
</div>
<div class="mb3">
<form-input
v-bind:id="'last_name'"
v-bind:required="false"
v-bind:title="'{{ trans('people.people_add_lastname') }}'">
</form-input>
</div>

<div class="mb3 mb0-ns">
<form-input
v-bind:id="'first_name'"
v-bind:required="true"
v-bind:title="'{{ trans('people.people_add_firstname') }}'">
</form-input>
</div>

@endif
</div>

<div class="pa4-ns ph3 pv2 mb3 mb0-ns bb b--gray-monica">
<form-select
:options="{{ $genders }}"
v-bind:required="true"
v-bind:title="'{{ trans('people.people_add_gender') }}'"
v-bind:id="'gender'">
</form-select>
</div>

{{-- Form actions --}}
<div class="ph4-ns ph3 pv3 bb b--gray-monica">
<div class="flex-ns justify-between">
<div class="">
<a href="/people" class="btn btn-secondary w-auto-ns w-100 mb2 pb0-ns">{{ trans('app.cancel') }}</a>
</div>
<div class="">
<button class="btn btn-secondary w-auto-ns w-100 mb2 pb0-ns" name="save_and_add_another" type="submit">{{ trans('people.people_save_and_add_another_cta') }}</button>
<button class="btn btn-primary w-auto-ns w-100 mb2 pb0-ns" name="save" type="submit">{{ trans('people.people_add_cta') }}</button>
</div>
</div>
</div>

</form>
</div>
</section>

@endsection
Loading