Skip to content

Commit

Permalink
Merge pull request #554 from canyongbs/feature/advapp-357-complete-ad…
Browse files Browse the repository at this point in the history
…dress-model-for-prospects

[ADVAPP-357]: Complete address model for prospects
  • Loading branch information
Orrison authored Feb 20, 2024
2 parents 3fb8a46 + 3fbafd7 commit 9ed7c31
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 24 deletions.
33 changes: 19 additions & 14 deletions app-modules/prospect/database/factories/ProspectFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,32 @@ class ProspectFactory extends Factory
{
public function definition(): array
{
$firstName = $this->faker->firstName();
$lastName = $this->faker->lastName();
$firstName = fake()->firstName();
$lastName = fake()->lastName();
$address3 = fake()->optional()->words(asText: true);

return [
'status_id' => ProspectStatus::inRandomOrder()->first() ?? ProspectStatus::factory(),
'source_id' => ProspectSource::inRandomOrder()->first() ?? ProspectSource::factory(),
'first_name' => $firstName,
'last_name' => $lastName,
'full_name' => "{$firstName} {$lastName}",
'preferred' => $this->faker->firstName(),
'description' => $this->faker->paragraph(),
'email' => $this->faker->email(),
'email_2' => $this->faker->email(),
'mobile' => $this->faker->phoneNumber(),
'sms_opt_out' => $this->faker->boolean(),
'email_bounce' => $this->faker->boolean(),
'phone' => $this->faker->phoneNumber(),
'address' => $this->faker->address(),
'address_2' => $this->faker->address(),
'birthdate' => $this->faker->date(),
'hsgrad' => $this->faker->year(),
'preferred' => fake()->firstName(),
'description' => fake()->paragraph(),
'email' => fake()->unique()->email(),
'email_2' => fake()->email(),
'mobile' => fake()->phoneNumber(),
'sms_opt_out' => fake()->boolean(),
'email_bounce' => fake()->boolean(),
'phone' => fake()->phoneNumber(),
'address' => fake()->streetAddress(),
'address_2' => fake()->secondaryAddress(),
'address_3' => $address3 ? str($address3)->headline()->toString() : null,
'city' => fake()->city(),
'state' => fake()->stateAbbr(),
'postal' => str(fake()->postcode())->before('-')->toString(),
'birthdate' => fake()->date(),
'hsgrad' => fake()->year(),
'assigned_to_id' => User::factory(),
'created_by_id' => User::factory(),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public function up(): void
$table->string('phone')->nullable();
$table->string('address')->nullable();
$table->string('address_2')->nullable();
$table->string('address_3')->nullable();
$table->string('city')->nullable();
$table->string('state')->nullable();
$table->string('postal')->nullable();
$table->date('birthdate')->nullable();
$table->string('hsgrad')->nullable();
// TODO Determine if there can be more than one assignment to a prospect
Expand Down
48 changes: 48 additions & 0 deletions app-modules/prospect/graphql/prospect.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ type Prospect @model(class: "AdvisingApp\\Prospect\\Models\\Prospect") {
"The address 2 of the prospect."
address_2: String

"The address 3 of the prospect."
address_3: String

"The city of the prospect."
city: String

"The state of the prospect."
state: String

"The postal code of the prospect."
postal: String

"The birthdate of the prospect."
birthdate: Date

Expand Down Expand Up @@ -129,6 +141,18 @@ input ProspectsQuery {
"The address 2 of the prospect."
address_2: String

"The address 3 of the prospect."
address_3: String

"The city of the prospect."
city: String

"The state of the prospect."
state: String

"The postal code of the prospect."
postal: String

"The birthdate of the prospect."
birthdate: Date

Expand Down Expand Up @@ -217,6 +241,18 @@ input CreateProspectInput {
"The address 2 of the prospect."
address_2: String @rules(apply: ["string", "max:255"])

"The address 3 of the prospect."
address_3: String @rules(apply: ["string", "max:255"])

"The city of the prospect."
city: String @rules(apply: ["string", "max:255"])

"The state of the prospect."
state: String @rules(apply: ["string", "max:255"])

"The postal code of the prospect."
postal: String @rules(apply: ["string", "max:255"])

"The birthdate of the prospect."
birthdate: Date @rules(apply: ["date_format:Y-m-d"])

Expand Down Expand Up @@ -276,6 +312,18 @@ input UpdateProspectInput {
"The address 2 of the prospect."
address_2: String @rules(apply: ["string", "max:255"])

"The address 3 of the prospect."
address_3: String @rules(apply: ["string", "max:255"])

"The city of the prospect."
city: String @rules(apply: ["string", "max:255"])

"The state of the prospect."
state: String @rules(apply: ["string", "max:255"])

"The postal code of the prospect."
postal: String @rules(apply: ["string", "max:255"])

"The birthdate of the prospect."
birthdate: Date @rules(apply: ["date_format:Y-m-d"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,22 @@ public function form(Form $form): Form
TextInput::make('first_name')
->label('First Name')
->required()
->string(),
->string()
->maxLength(255),
TextInput::make('last_name')
->label('Last Name')
->required()
->string(),
->string()
->maxLength(255),
TextInput::make(Prospect::displayNameKey())
->label('Full Name')
->required()
->string(),
->string()
->maxLength(255),
TextInput::make('preferred')
->label('Preferred Name')
->string(),
->string()
->maxLength(255),
// TODO: Display this based on system configurable data format
DatePicker::make('birthdate')
->label('Birthdate')
Expand All @@ -102,22 +106,44 @@ public function form(Form $form): Form
->schema([
TextInput::make('email')
->label('Primary Email')
->email(),
->email()
->maxLength(255),
TextInput::make('email_2')
->label('Other Email')
->email(),
->email()
->maxLength(255),
TextInput::make('mobile')
->label('Mobile')
->string(),
->string()
->maxLength(255),
TextInput::make('phone')
->label('Other Phone')
->string(),
->string()
->maxLength(255),
TextInput::make('address')
->label('Address')
->string(),
->string()
->maxLength(255),
TextInput::make('address_2')
->label('Address 2')
->string(),
->string()
->maxLength(255),
TextInput::make('address_3')
->label('Address 3')
->string()
->maxLength(255),
TextInput::make('city')
->label('City')
->string()
->maxLength(255),
TextInput::make('state')
->label('State')
->string()
->maxLength(255),
TextInput::make('postal')
->label('Postal')
->string()
->maxLength(255),
])
->columns(2),
Section::make('Classification')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ public function infolist(Infolist $infolist): Infolist
TextEntry::make('address_2')
->label('Address 2')
->translateLabel(),
TextEntry::make('address_3')
->label('Address 3'),
TextEntry::make('city')
->label('City'),
TextEntry::make('state')
->label('State'),
TextEntry::make('postal')
->label('Postal'),
])
->columns(2),
Section::make('Classification')
Expand Down
4 changes: 4 additions & 0 deletions app-modules/prospect/src/Models/Prospect.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class Prospect extends BaseModel implements Auditable, Subscribable, Educatable,
'phone',
'address',
'address_2',
'address_3',
'city',
'state',
'postal',
'birthdate',
'hsgrad',
'assigned_to_id',
Expand Down

0 comments on commit 9ed7c31

Please sign in to comment.