-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from canyongbs/feature/ASSIST-289-interactions
[ASSIST-289] Add ability to log interactions
- Loading branch information
Showing
136 changed files
with
3,867 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...l/src/Filament/Resources/StudentResource/RelationManagers/InteractionsRelationManager.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Assist\AssistDataModel\Filament\Resources\StudentResource\RelationManagers; | ||
|
||
use Filament\Forms\Form; | ||
use Filament\Tables\Table; | ||
use Filament\Infolists\Infolist; | ||
use Filament\Forms\Components\Hidden; | ||
use Filament\Forms\Components\Component; | ||
use Assist\AssistDataModel\Models\Student; | ||
use Filament\Forms\Components\MorphToSelect; | ||
use App\Filament\Resources\RelationManagers\RelationManager; | ||
use Assist\Interaction\Filament\Resources\InteractionResource\Pages\CreateInteraction; | ||
use Assist\Interaction\Filament\Resources\InteractionResource\RelationManagers\HasManyMorphedInteractionsRelationManager; | ||
|
||
class InteractionsRelationManager extends RelationManager | ||
{ | ||
protected static string $relationship = 'interactions'; | ||
|
||
public function form(Form $form): Form | ||
{ | ||
$createInteractionForm = (resolve(CreateInteraction::class))->form($form); | ||
|
||
$formComponents = collect($createInteractionForm->getComponents())->filter(function (Component $component) { | ||
if (! $component instanceof MorphToSelect) { | ||
return true; | ||
} | ||
})->toArray(); | ||
|
||
return parent::form($createInteractionForm) | ||
->schema([ | ||
Hidden::make('interactable_id') | ||
->default($this->ownerRecord->identifier()), | ||
Hidden::make('interactable_type') | ||
->default(resolve(Student::class)->getMorphClass()), | ||
...$formComponents, | ||
]); | ||
} | ||
|
||
public function infolist(Infolist $infolist): Infolist | ||
{ | ||
return (resolve(HasManyMorphedInteractionsRelationManager::class))->infolist($infolist); | ||
} | ||
|
||
public function table(Table $table): Table | ||
{ | ||
return (resolve(HasManyMorphedInteractionsRelationManager::class))->table($table); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "canyon-gbs/interaction", | ||
"description": "", | ||
"type": "library", | ||
"version": "1.0", | ||
"license": "proprietary", | ||
"require": { | ||
"filament/filament": "^3.0.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Assist\\Interaction\\": "src/", | ||
"Assist\\Interaction\\Tests\\": "tests/", | ||
"Assist\\Interaction\\Database\\Factories\\": "database/factories/", | ||
"Assist\\Interaction\\Database\\Seeders\\": "database/seeders/" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Assist\\Interaction\\Providers\\InteractionServiceProvider" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
return []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
return []; |
3 changes: 3 additions & 0 deletions
3
app-modules/interaction/config/roles/api/interaction_roles.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
return []; |
3 changes: 3 additions & 0 deletions
3
app-modules/interaction/config/roles/web/interaction_manager.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
return []; |
18 changes: 18 additions & 0 deletions
18
app-modules/interaction/database/factories/InteractionCampaignFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\InteractionCampaign> | ||
*/ | ||
class InteractionCampaignFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake()->word(), | ||
]; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app-modules/interaction/database/factories/InteractionDriverFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\InteractionDriver> | ||
*/ | ||
class InteractionDriverFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake()->word(), | ||
]; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
app-modules/interaction/database/factories/InteractionFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use App\Models\User; | ||
use Assist\Prospect\Models\Prospect; | ||
use Assist\AssistDataModel\Models\Student; | ||
use Assist\Interaction\Models\InteractionType; | ||
use Assist\Interaction\Models\InteractionDriver; | ||
use Assist\Interaction\Models\InteractionStatus; | ||
use Assist\Interaction\Models\InteractionOutcome; | ||
use Assist\Interaction\Models\InteractionCampaign; | ||
use Assist\Interaction\Models\InteractionRelation; | ||
use Assist\ServiceManagement\Models\ServiceRequest; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Assist\Interaction\Models\InteractionInstitution; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\Interaction> | ||
*/ | ||
class InteractionFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
$interactable = fake()->randomElement([ | ||
Student::class, | ||
Prospect::class, | ||
ServiceRequest::class, | ||
]); | ||
|
||
$interactable = $interactable::factory()->create(); | ||
|
||
return [ | ||
'user_id' => User::factory(), | ||
'interactable_id' => $interactable->identifier(), | ||
'interactable_type' => $interactable->getMorphClass(), | ||
'interaction_type_id' => InteractionType::factory(), | ||
'interaction_relation_id' => InteractionRelation::factory(), | ||
'interaction_campaign_id' => InteractionCampaign::factory(), | ||
'interaction_driver_id' => InteractionDriver::factory(), | ||
'interaction_status_id' => InteractionStatus::factory(), | ||
'interaction_outcome_id' => InteractionOutcome::factory(), | ||
'interaction_institution_id' => InteractionInstitution::factory(), | ||
'start_datetime' => now(), | ||
'end_datetime' => now()->addMinutes(5), | ||
'subject' => fake()->sentence(), | ||
'description' => fake()->paragraph(), | ||
]; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app-modules/interaction/database/factories/InteractionInstitutionFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\InteractionInstitution> | ||
*/ | ||
class InteractionInstitutionFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake()->word(), | ||
]; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app-modules/interaction/database/factories/InteractionOutcomeFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\InteractionOutcome> | ||
*/ | ||
class InteractionOutcomeFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake()->word(), | ||
]; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app-modules/interaction/database/factories/InteractionRelationFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\InteractionRelation> | ||
*/ | ||
class InteractionRelationFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake()->word(), | ||
]; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app-modules/interaction/database/factories/InteractionStatusFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Assist\ServiceManagement\Enums\ColumnColorOptions; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\InteractionStatus> | ||
*/ | ||
class InteractionStatusFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake()->word(), | ||
'color' => $this->faker->randomElement(ColumnColorOptions::cases())->value, | ||
]; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app-modules/interaction/database/factories/InteractionTypeFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Assist\Interaction\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Assist\Interaction\Models\InteractionType> | ||
*/ | ||
class InteractionTypeFactory extends Factory | ||
{ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake()->word(), | ||
]; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...ules/interaction/database/migrations/2023_09_07_163958_create_interaction_types_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class () extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::create('interaction_types', function (Blueprint $table) { | ||
$table->uuid('id')->primary(); | ||
$table->string('name'); | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
}); | ||
} | ||
}; |
Oops, something went wrong.