diff --git a/app/Repositories/PeopleRepository.php b/app/Repositories/PeopleRepository.php index a28cd295..5e374d88 100644 --- a/app/Repositories/PeopleRepository.php +++ b/app/Repositories/PeopleRepository.php @@ -333,6 +333,7 @@ public function getFields() 'Suffix', 'Honorific', 'First Name', + 'Middle Name', 'Last Name', 'Picture', 'Photo Download', @@ -342,6 +343,7 @@ public function getFields() 'name_fields' => [ 'Honorific', 'First Name', + 'Middle Name', 'Last Name', 'Suffix', ], diff --git a/app/Repositories/ProfileRepository.php b/app/Repositories/ProfileRepository.php index 7451cc70..e22ba124 100644 --- a/app/Repositories/ProfileRepository.php +++ b/app/Repositories/ProfileRepository.php @@ -315,6 +315,7 @@ public function getFields() 'Suffix', 'Honorific', 'First Name', + 'Middle name', 'Last Name', 'Picture', 'Photo Download', @@ -324,6 +325,7 @@ public function getFields() 'name_fields' => [ 'Honorific', 'First Name', + 'Middle name', 'Last Name', 'Suffix', ], diff --git a/factories/People.php b/factories/People.php index 9611203b..0b3103dd 100644 --- a/factories/People.php +++ b/factories/People.php @@ -26,6 +26,7 @@ public function create($limit = 1, $flatten = false, $options = []) for ($i = 1; $i <= $limit; $i++) { $accessid = $this->faker->randomLetter().$this->faker->randomLetter().$this->faker->randomNumber(4, true); $first_name = $this->faker->firstName(); + $middle_name = $this->faker->firstName(); $last_name = $this->faker->lastName(); $suffix = $this->faker->suffix(); $email = $this->faker->email(); @@ -46,6 +47,7 @@ public function create($limit = 1, $flatten = false, $options = []) $data[$i] = [ 'id' => $i, 'first_name' => $first_name, + 'middle_name' => $middle_name, 'last_name' => $last_name, 'accessid' => $accessid, 'email' => $email, @@ -64,6 +66,14 @@ public function create($limit = 1, $flatten = false, $options = []) 'global' => 1, ], ], + [ + 'value' => $middle_name, + 'field' => [ + 'name' => 'Middle Name', + 'type' => 'text', + 'global' => 1, + ], + ], [ 'value' => $last_name, 'field' => [ @@ -141,10 +151,11 @@ public function create($limit = 1, $flatten = false, $options = []) $groups->random(), ], 'link' => '/styleguide/profile/aa0000', - 'full_name' => $first_name . ' ' . $last_name, + 'full_name' => $first_name . ' ' . $middle_name . ' ' . $last_name, 'data' => [ 'AccessID' => $accessid, 'First Name' => $first_name, + 'Middle Name' => $middle_name, 'Last Name' => $last_name, 'Email' => $email, 'Title' => $this->faker->sentence(3), diff --git a/resources/views/contact-tables.blade.php b/resources/views/contact-tables.blade.php index 4f3ba810..cc904bba 100644 --- a/resources/views/contact-tables.blade.php +++ b/resources/views/contact-tables.blade.php @@ -36,7 +36,7 @@ @foreach($profile_list as $profile) - @if(isset($profile['data']['Email']))@endif{{$profile['data']['First Name']}} {{$profile['data']['Last Name']}}@if(isset($profile['data']['Email']))@endif + @if(isset($profile['data']['Email']))@endif{{$profile['full_name']}}@if(isset($profile['data']['Email']))@endif @if(isset($profile['data']['Title'])){{$profile['data']['Title']}}@endif @if(isset($profile['data']['Office Location'])){{$profile['data']['Office Location']}}@endif @if(isset($profile['data']['Phone'])){{$profile['data']['Phone']}}@endif diff --git a/tests/Unit/Repositories/PeopleRepositoryTest.php b/tests/Unit/Repositories/PeopleRepositoryTest.php index e1844c95..8b94fb54 100644 --- a/tests/Unit/Repositories/PeopleRepositoryTest.php +++ b/tests/Unit/Repositories/PeopleRepositoryTest.php @@ -52,6 +52,7 @@ public function getting_page_title_should_come_from_name(): void 'name_fields' => [ 'Honorific', 'First Name', + 'Middle Name', 'Last Name', 'Suffix', ], @@ -60,6 +61,7 @@ public function getting_page_title_should_come_from_name(): void $return['profile']['data'] = [ 'Honorific' => 'Dr.', 'First Name' => 'Anthony', + 'Middle Name' => 'M.', 'Last Name' => 'Wayne', 'Suffix' => 'Jr.', ]; @@ -72,7 +74,7 @@ public function getting_page_title_should_come_from_name(): void $pageTitle = $people->getPageTitleFromName($return); // Make sure the page title equals all the name fields - $this->assertEquals('Dr. Anthony Wayne, Jr.', $pageTitle); + $this->assertEquals('Dr. Anthony M. Wayne, Jr.', $pageTitle); } #[Test] diff --git a/tests/Unit/Repositories/ProfileRepositoryTest.php b/tests/Unit/Repositories/ProfileRepositoryTest.php index ef74decd..26c85367 100644 --- a/tests/Unit/Repositories/ProfileRepositoryTest.php +++ b/tests/Unit/Repositories/ProfileRepositoryTest.php @@ -52,6 +52,7 @@ public function getting_page_title_should_come_from_name(): void 'name_fields' => [ 'Honorific', 'First Name', + 'Middle name', 'Last Name', 'Suffix', ], @@ -60,6 +61,7 @@ public function getting_page_title_should_come_from_name(): void $return['profile']['data'] = [ 'Honorific' => 'Dr.', 'First Name' => 'Anthony', + 'Middle name' => 'M.', 'Last Name' => 'Wayne', 'Suffix' => 'Jr.', ]; @@ -72,7 +74,7 @@ public function getting_page_title_should_come_from_name(): void $pageTitle = $profile->getPageTitleFromName($return); // Make sure the page title equals all the name fields - $this->assertEquals('Dr. Anthony Wayne, Jr.', $pageTitle); + $this->assertEquals('Dr. Anthony M. Wayne, Jr.', $pageTitle); } #[Test]