Skip to content

Commit

Permalink
Merge branch 'main' into 371-ngo-admin-specialist-cazuri-plan-de-inte…
Browse files Browse the repository at this point in the history
…rventie-implement-extra-variable-in-the-beneficii-sociale-section-of-the-intervention-plan
  • Loading branch information
alexPopaCode4 authored Jan 8, 2025
2 parents 9239cac + 44318c2 commit 7e6d62e
Show file tree
Hide file tree
Showing 89 changed files with 500 additions and 346 deletions.
7 changes: 6 additions & 1 deletion app/Concerns/HasPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Enums\AdminPermission;
use App\Enums\CasePermission;
use App\Models\Beneficiary;
use App\Models\User;
use Filament\Facades\Filament;

trait HasPermissions
Expand Down Expand Up @@ -53,7 +54,7 @@ public function hasAccessToBeneficiary(Beneficiary $beneficiary): bool
return false;
}

public function hasAccessToStaff(): bool
public function hasAccessToStaff(?User $model = null): bool
{
if ($this->isAdmin()) {
return true;
Expand All @@ -63,6 +64,10 @@ public function hasAccessToStaff(): bool
return true;
}

if ($model && $model->isNgoAdmin()) {
return false;
}

return (bool) $this->permissions?->admin_permissions->contains(AdminPermission::CAN_CHANGE_STAFF);
}

Expand Down
24 changes: 24 additions & 0 deletions app/Enums/AllowancePerson.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Concerns\Enums;
use Filament\Support\Contracts\HasLabel;

enum AllowancePerson: string implements HasLabel
{
use Enums\HasLabel;
use Enums\Arrayable;
use Enums\Comparable;

case BENEFICIARY = 'beneficiary';
case OTHER = 'other';
case UNKNOWN = 'unknown';

public function labelKeyPrefix(): ?string
{
return 'enum.allowance_person';
}
}
2 changes: 2 additions & 0 deletions app/Enums/FileDocumentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ enum FileDocumentType: string implements HasLabel
case RENTAL_AGREEMENT = 'rental_agreement';
case SALE_PURCHASE_AGREEMENT = 'sale_purchase_agreement';
case IML_CERTIFICATE = 'iml_certificate';

case COURT_SENTENCES = 'court_sentences';
case OTHER = 'other';

protected function labelKeyPrefix(): ?string
Expand Down
2 changes: 0 additions & 2 deletions app/Enums/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ enum PaymentMethod: string implements HasLabel
use Enums\HasLabel;
use Enums\Arrayable;
use Enums\Comparable;

case REPRESENTATIVE = 'representative';
case POSTAL_OFFICE = 'postal_office';
case BANK_ACCOUNT = 'bank_account';
case OTHER = 'other';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Admin\Resources\BenefitResource\Pages;

use App\Actions\BackAction;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Actions\ChangeNomenclatureStatusAction;
use App\Filament\Admin\Resources\BenefitResource;
use Filament\Actions;
Expand All @@ -13,6 +14,8 @@

class EditBenefit extends EditRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = BenefitResource::class;

public function getBreadcrumbs(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Admin\Resources\InstitutionResource\Pages;

use App\Actions\BackAction;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\InstitutionResource;
use App\Forms\Components\Repeater;
use App\Models\Organization;
Expand All @@ -16,6 +17,8 @@

class EditInstitutionCenters extends EditRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = InstitutionResource::class;

protected function getRedirectUrl(): ?string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Admin\Resources\InstitutionResource\Pages;

use App\Actions\BackAction;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Enums\AreaType;
use App\Enums\OrganizationType;
use App\Filament\Admin\Resources\InstitutionResource;
Expand All @@ -20,6 +21,8 @@

class EditInstitutionDetails extends EditRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = InstitutionResource::class;

protected function getRedirectUrl(): ?string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use App\Filament\Admin\Resources\InstitutionResource;
use App\Filament\Admin\Resources\InstitutionResource\Actions\ActivateInstitution;
use App\Filament\Admin\Resources\InstitutionResource\Actions\InactivateInstitution;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DocumentPreview;
use App\Infolists\Components\Location;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
Expand Down Expand Up @@ -51,10 +51,7 @@ public function infolist(Infolist $infolist): Infolist
return $infolist->schema([
Section::make(__('institution.headings.institution_details'))
->headerActions([
Action::make('edit')
->label(__('general.action.edit'))
->icon('heroicon-o-pencil')
->link()
EditAction::make()
->url(self::$resource::getUrl('edit_institution_details', ['record' => $this->getRecord()])),
])
->maxWidth('3xl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Filament\Admin\Resources\InstitutionResource\RelationManagers;

use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\InstitutionResource;
use App\Filament\Admin\Resources\UserInstitutionResource\Pages\EditUserInstitution;
use App\Tables\Columns\DateTimeColumn;
Expand All @@ -19,6 +20,8 @@

class AdminsRelationManager extends RelationManager
{
use PreventSubmitFormOnEnter;

protected static string $relationship = 'admins';

public function isReadOnly(): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

namespace App\Filament\Admin\Resources\InstitutionResource\RelationManagers;

use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\InstitutionResource;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DocumentPreview;
use App\Infolists\Components\SectionHeader;
use App\Models\Institution;
use Filament\Facades\Filament;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\RepeatableEntry;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
Expand All @@ -19,6 +20,8 @@

class OrganizationsRelationManager extends RelationManager
{
use PreventSubmitFormOnEnter;

protected static string $relationship = 'organizations';

protected static string $view = 'infolists.infolist-relation-manager';
Expand All @@ -37,10 +40,7 @@ public function infolist(Infolist $infolist): Infolist
SectionHeader::make('center_details')
->state(__('institution.headings.center_details'))
->action(
Action::make('edit_centers')
->label(__('general.action.edit'))
->icon('heroicon-o-pencil')
->link()
EditAction::make('edit_centers')
->url(InstitutionResource::getUrl('edit_institution_centers', ['record' => $this->getOwnerRecord()]))
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Filament\Admin\Resources\OrganizationResource\RelationManagers;

use App\Tables\Actions\EditAction;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down Expand Up @@ -52,7 +53,7 @@ public function table(Table $table): Table
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Expand Down
5 changes: 2 additions & 3 deletions app/Filament/Admin/Resources/ResultResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use App\Enums\GeneralStatus;
use App\Filament\Admin\Resources\ResultResource\Pages;
use App\Models\Result;
use App\Tables\Actions\EditAction;
use App\Tables\Filters\SelectFilter;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\CreateAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
Expand Down Expand Up @@ -66,8 +66,7 @@ public static function table(Table $table): Table
->options(GeneralStatus::options()),
])
->actions([
Tables\Actions\EditAction::make()
->label(__('general.action.change')),
EditAction::make(),
])
->emptyStateHeading(__('nomenclature.headings.empty_state_results_table'))
->emptyStateDescription(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Admin\Resources\ResultResource\Pages;

use App\Actions\BackAction;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Actions\ChangeNomenclatureStatusAction;
use App\Filament\Admin\Resources\ResultResource;
use Filament\Actions;
Expand All @@ -13,6 +14,8 @@

class EditResult extends EditRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = ResultResource::class;

public function getBreadcrumbs(): array
Expand Down
5 changes: 2 additions & 3 deletions app/Filament/Admin/Resources/RoleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
use App\Filament\Admin\Resources\RoleResource\Pages;
use App\Forms\Components\Spacer;
use App\Models\Role;
use App\Tables\Actions\EditAction;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\CreateAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
Expand Down Expand Up @@ -106,8 +106,7 @@ public static function table(Table $table): Table
->options(GeneralStatus::options()),
])
->actions([
Tables\Actions\EditAction::make()
->label(__('nomenclature.actions.edit')),
EditAction::make(),
])
->emptyStateHeading(__('nomenclature.labels.empty_state_role_table'))
->emptyStateDescription(null)
Expand Down
3 changes: 3 additions & 0 deletions app/Filament/Admin/Resources/RoleResource/Pages/EditRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Admin\Resources\RoleResource\Pages;

use App\Actions\BackAction;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Actions\ChangeNomenclatureStatusAction;
use App\Filament\Admin\Resources\RoleResource;
use Filament\Actions\DeleteAction;
Expand All @@ -13,6 +14,8 @@

class EditRole extends EditRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = RoleResource::class;

public function getTitle(): string|Htmlable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Admin\Resources\ServiceResource\Pages;

use App\Actions\BackAction;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Actions\ChangeNomenclatureStatusAction;
use App\Filament\Admin\Resources\ServiceResource;
use Filament\Actions\DeleteAction;
Expand All @@ -13,6 +14,8 @@

class EditService extends EditRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = ServiceResource::class;

public function getBreadcrumbs(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use App\Filament\Admin\Resources\UserInstitutionResource\Actions\ActivateUserAction;
use App\Filament\Admin\Resources\UserInstitutionResource\Actions\DeactivateUserAction;
use App\Filament\Admin\Resources\UserInstitutionResource\Actions\ResendInvitationAction;
use App\Infolists\Components\Actions\EditAction;
use App\Infolists\Components\DateTimeEntry;
use App\Infolists\Components\SectionHeader;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
Expand Down Expand Up @@ -85,9 +85,7 @@ public function infolist(Infolist $infolist): Infolist
SectionHeader::make('edit_user')
->state(__('user.heading.specialist_details'))
->action(
Action::make('edit')
->label(__('general.action.edit'))
->link()
EditAction::make()
->url(self::getParentResource()::getUrl('user.edit', [
'parent' => $this->parent,
'record' => $this->getRecord(),
Expand Down
3 changes: 2 additions & 1 deletion app/Filament/Admin/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Filament\Admin\Resources\UserResource\Pages;
use App\Forms\Components\Select;
use App\Models\User;
use App\Tables\Actions\EditAction;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
Expand Down Expand Up @@ -126,7 +127,7 @@ public static function table(Table $table): Table
->multiple(),
])
->actions([
Tables\Actions\EditAction::make(),
EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Expand Down
3 changes: 3 additions & 0 deletions app/Filament/Admin/Resources/UserResource/Pages/EditUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

namespace App\Filament\Admin\Resources\UserResource\Pages;

use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditUser extends EditRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = UserResource::class;

protected function getHeaderActions(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Organizations/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Dashboard extends BaseDashboard
public function getHeading(): string | Htmlable
{
return __('dashboard.welcome', [
'name' => auth()->user()->first_name,
'name' => auth()->user()->last_name,
]);
}

Expand Down
Loading

0 comments on commit 7e6d62e

Please sign in to comment.