Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions app/Enums/PartnershipEntityType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Enums;

enum PartnershipEntityType: string
{
case PublicInstitution = 'public_institution';
case Ngo = 'ngo';
case PrivateCompany = 'private_company';

public function label(): string
{
return __('enums.partnership_entity_type.'.$this->value);
}

/**
* @return array<string, string>
*/
public static function options(): array
{
return collect(self::cases())
->mapWithKeys(fn (self $type): array => [$type->value => $type->label()])
->all();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Filament\Resources\PartnershipIntents\Pages;

use App\Filament\Resources\PartnershipIntents\PartnershipIntentResource;
use Filament\Resources\Pages\CreateRecord;

class CreatePartnershipIntent extends CreateRecord
{
protected static string $resource = PartnershipIntentResource::class;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Filament\Resources\PartnershipIntents\Pages;

use App\Filament\Resources\PartnershipIntents\PartnershipIntentResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;

class EditPartnershipIntent extends EditRecord
{
protected static string $resource = PartnershipIntentResource::class;

protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Filament\Resources\PartnershipIntents\Pages;

use App\Filament\Resources\PartnershipIntents\PartnershipIntentResource;
use Filament\Resources\Pages\ListRecords;

class ListPartnershipIntents extends ListRecords
{
protected static string $resource = PartnershipIntentResource::class;

protected function getHeaderActions(): array
{
return [];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\Filament\Resources\PartnershipIntents;

use App\Filament\Concerns\HasTranslatedLabels;
use App\Filament\Resources\PartnershipIntents\Pages\ListPartnershipIntents;
use App\Filament\Resources\PartnershipIntents\Schemas\PartnershipIntentForm;
use App\Filament\Resources\PartnershipIntents\Tables\PartnershipIntentsTable;
use App\Models\PartnershipIntent;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;

class PartnershipIntentResource extends Resource
{
use HasTranslatedLabels;

protected static ?string $model = PartnershipIntent::class;

protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;

protected static string|UnitEnum|null $navigationGroup = 'Moderation';

public static function form(Schema $schema): Schema
{
return PartnershipIntentForm::configure($schema);
}

public static function table(Table $table): Table
{
return PartnershipIntentsTable::configure($table);
}

public static function getRelations(): array
{
return [];
}

public static function getPages(): array
{
return [
'index' => ListPartnershipIntents::route('/'),
];
}

protected static function translationKey(): string
{
return 'partnership_intents';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Filament\Resources\PartnershipIntents\Schemas;

use App\Enums\PartnershipEntityType;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;

class PartnershipIntentForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('entity_name')->disabled(),
Select::make('entity_type')
->options(PartnershipEntityType::options())
->disabled(),
TextInput::make('activity_domain')->disabled(),
TextInput::make('contact_name')->disabled(),
TextInput::make('contact_role')->disabled(),
TextInput::make('phone')->disabled(),
TextInput::make('email')->disabled(),
Textarea::make('intent')->disabled()->columnSpanFull(),
Toggle::make('personal_data_consent')->disabled(),
]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Filament\Resources\PartnershipIntents\Tables;

use App\Enums\PartnershipEntityType;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class PartnershipIntentsTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('entity_name')->searchable(),
TextColumn::make('entity_type')
->formatStateUsing(fn (PartnershipEntityType $state): string => $state->label()),
TextColumn::make('contact_name')->searchable(),
TextColumn::make('email')->searchable(),
TextColumn::make('intent')->limit(80)->wrap(),
TextColumn::make('created_at')->dateTime()->sortable(),
])
->defaultSort('created_at', 'desc');
}
}
38 changes: 38 additions & 0 deletions app/Models/PartnershipIntent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Models;

use App\Enums\PartnershipEntityType;
use Database\Factories\PartnershipIntentFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[Fillable([
'entity_name',
'entity_type',
'activity_domain',
'contact_name',
'contact_role',
'phone',
'email',
'intent',
'personal_data_consent',
'locale',
])]
class PartnershipIntent extends Model
{
/** @use HasFactory<PartnershipIntentFactory> */
use HasFactory;

/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'entity_type' => PartnershipEntityType::class,
'personal_data_consent' => 'boolean',
];
}
}
32 changes: 32 additions & 0 deletions database/factories/PartnershipIntentFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Database\Factories;

use App\Enums\PartnershipEntityType;
use App\Models\PartnershipIntent;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends Factory<PartnershipIntent>
*/
class PartnershipIntentFactory extends Factory
{
/**
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'entity_name' => fake()->company(),
'entity_type' => fake()->randomElement(PartnershipEntityType::cases()),
'activity_domain' => fake()->words(3, true),
'contact_name' => fake()->name(),
'contact_role' => fake()->jobTitle(),
'phone' => fake()->phoneNumber(),
'email' => fake()->safeEmail(),
'intent' => fake()->paragraph(),
'personal_data_consent' => true,
'locale' => 'ro',
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('partnership_intents', function (Blueprint $table) {
$table->id();
$table->string('entity_name');
$table->string('entity_type');
$table->string('activity_domain');
$table->string('contact_name');
$table->string('contact_role');
$table->string('phone');
$table->string('email');
$table->text('intent');
$table->boolean('personal_data_consent');
$table->string('locale', 5);
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('partnership_intents');
}
};
5 changes: 5 additions & 0 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
'label' => 'Professional Resource',
'plural' => 'Professional Resources',
],
'partnership_intents' => [
'navigation' => 'Partnership intents',
'label' => 'Partnership intent',
'plural' => 'Partnership intents',
],
'resource_submissions' => [
'navigation' => 'Resource Submissions',
'label' => 'Resource Submission',
Expand Down
5 changes: 5 additions & 0 deletions lang/en/enums.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
'curriculum' => 'Curricula and training materials',
],
'resource_status' => ['draft' => 'Draft', 'published' => 'Published'],
'partnership_entity_type' => [
'public_institution' => 'Public institution',
'ngo' => 'NGO',
'private_company' => 'Private company',
],
'organization_type' => [
'public_institution' => 'Public institutions',
'ngo' => 'Non-governmental organizations',
Expand Down
27 changes: 27 additions & 0 deletions lang/en/partnership.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

return [
'title' => 'Partnership intent form',
'intro' => [
'ZEROTRAFIC is a collaboration space dedicated to preventing and combating human trafficking. To respond effectively to needs in the field, we want to develop partnerships with public institutions, non-governmental organizations, and private companies that can contribute expertise, resources, or concrete initiatives.',
'If your organization wants to get involved, please complete the form below. This helps us understand availability and directions for collaboration, so we can build relevant and sustainable projects together.',
'The data you send will be used exclusively by the National Agency Against Trafficking in Persons (ANITP) to review partnership opportunities and to contact interested people.',
'Thank you for your interest and for wanting to contribute to the prevention of human trafficking.',
],
'entity_name' => 'Entity name',
'entity_type' => 'Entity type',
'entity_type_placeholder' => 'Select a type',
'activity_domain' => 'Field of activity',
'contact_name' => 'Contact person',
'contact_role' => 'Role / position',
'phone' => 'Phone number',
'email' => 'Email address',
'intent' => 'Collaboration intent',
'intent_placeholder' => 'Briefly describe how you would like to contribute',
'consent' => 'I agree to the processing of my personal data by ANITP for the purpose of reviewing the partnership intent and contacting me.',
'submit' => 'Submit the form',
'success' => 'Thank you. The partnership intent has been recorded.',
'cta_title' => 'Become a partner',
'cta_body' => 'Public institutions, non-governmental organizations, and private companies can propose a collaboration with ANITP.',
'cta_button' => 'Complete the form',
];
5 changes: 5 additions & 0 deletions lang/ro/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
'label' => 'Resursă profesională',
'plural' => 'Resurse profesionale',
],
'partnership_intents' => [
'navigation' => 'Intenții de parteneriat',
'label' => 'Intenție de parteneriat',
'plural' => 'Intenții de parteneriat',
],
'resource_submissions' => [
'navigation' => 'Trimiteri resurse',
'label' => 'Trimitere resursă',
Expand Down
5 changes: 5 additions & 0 deletions lang/ro/enums.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
'curriculum' => 'Curricule și materiale formări',
],
'resource_status' => ['draft' => 'Schiță', 'published' => 'Publicat'],
'partnership_entity_type' => [
'public_institution' => 'Instituție publică',
'ngo' => 'ONG',
'private_company' => 'Companie privată',
],
'organization_type' => [
'public_institution' => 'Instituții publice',
'ngo' => 'Organizații nonguvernamentale',
Expand Down
Loading
Loading