From 3fbafd7b03a5849f07ffc5147765a3b531f07bb1 Mon Sep 17 00:00:00 2001 From: Matthew Myers Date: Tue, 20 Feb 2024 14:58:20 -0500 Subject: [PATCH] Complete addresses for prospects. --- .../database/factories/ProspectFactory.php | 33 +++++++------ ...23_07_26_000003_create_prospects_table.php | 4 ++ app-modules/prospect/graphql/prospect.graphql | 48 +++++++++++++++++++ .../ProspectResource/Pages/EditProspect.php | 46 ++++++++++++++---- .../ProspectResource/Pages/ViewProspect.php | 8 ++++ app-modules/prospect/src/Models/Prospect.php | 4 ++ 6 files changed, 119 insertions(+), 24 deletions(-) diff --git a/app-modules/prospect/database/factories/ProspectFactory.php b/app-modules/prospect/database/factories/ProspectFactory.php index f3f020674c..bfb867caa6 100644 --- a/app-modules/prospect/database/factories/ProspectFactory.php +++ b/app-modules/prospect/database/factories/ProspectFactory.php @@ -49,8 +49,9 @@ 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(), @@ -58,18 +59,22 @@ public function definition(): array '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(), ]; diff --git a/app-modules/prospect/database/migrations/2023_07_26_000003_create_prospects_table.php b/app-modules/prospect/database/migrations/2023_07_26_000003_create_prospects_table.php index 5ca37672f9..9a097ffe32 100644 --- a/app-modules/prospect/database/migrations/2023_07_26_000003_create_prospects_table.php +++ b/app-modules/prospect/database/migrations/2023_07_26_000003_create_prospects_table.php @@ -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 diff --git a/app-modules/prospect/graphql/prospect.graphql b/app-modules/prospect/graphql/prospect.graphql index 01cf1d8248..cae091b300 100644 --- a/app-modules/prospect/graphql/prospect.graphql +++ b/app-modules/prospect/graphql/prospect.graphql @@ -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 @@ -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 @@ -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"]) @@ -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"]) diff --git a/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/EditProspect.php b/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/EditProspect.php index 52a7731682..a39f84cb29 100644 --- a/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/EditProspect.php +++ b/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/EditProspect.php @@ -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') @@ -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') diff --git a/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/ViewProspect.php b/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/ViewProspect.php index fd803280ec..73bc7f8d49 100644 --- a/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/ViewProspect.php +++ b/app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/ViewProspect.php @@ -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') diff --git a/app-modules/prospect/src/Models/Prospect.php b/app-modules/prospect/src/Models/Prospect.php index a47f6f7c6c..4f00149bcb 100644 --- a/app-modules/prospect/src/Models/Prospect.php +++ b/app-modules/prospect/src/Models/Prospect.php @@ -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',