Skip to content

Commit

Permalink
Merge branch 'main' into 425-ngo-admin-specialist-cazuri-plan-de-inte…
Browse files Browse the repository at this point in the history
…rventie-implement-new-sectiontab-called-planuri-lunare
  • Loading branch information
alexPopaCode4 authored Dec 19, 2024
2 parents 2bdd2f1 + 43ca6d0 commit cfca3a4
Show file tree
Hide file tree
Showing 35 changed files with 324 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/Concerns/HasPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function hasAccessToNomenclature(): bool
return (bool) $this->permissions?->admin_permissions->contains(AdminPermission::CAN_CHANGE_NOMENCLATURE);
}

public function hasAccessToCommunity(): bool
public function canChangeOrganizationProfile(): bool
{
if ($this->isAdmin()) {
return true;
Expand Down
20 changes: 20 additions & 0 deletions app/Concerns/PreventSubmitFormOnEnter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace App\Concerns;

use Filament\Actions\Action;

trait PreventSubmitFormOnEnter
{
protected function getCreateFormAction(): Action
{
return parent::getCreateFormAction()->extraAttributes(['type' => 'button', 'wire:click' => 'create']);
}

protected function getSaveFormAction(): Action
{
return parent::getSaveFormAction()->extraAttributes(['type' => 'button', 'wire:click' => 'save']);
}
}
24 changes: 24 additions & 0 deletions app/Enums/DashboardIntervalFilter.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 DashboardIntervalFilter: string implements HasLabel
{
use Enums\HasLabel;
use Enums\Comparable;
use Enums\Arrayable;

case TODAY = 'today';
case TOMORROW = 'tomorrow';
case ONE_WEEK = 'one_week';

protected function labelKeyPrefix(): ?string
{
return 'enum.dashboard_interval_filter';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace App\Filament\Admin\Resources\BenefitResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\BenefitResource;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Contracts\Support\Htmlable;

class CreateBenefit extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = BenefitResource::class;

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\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\InstitutionResource;
use App\Filament\Admin\Resources\UserInstitutionResource\Pages\EditUserInstitution;
use App\Forms\Components\Repeater;
Expand All @@ -19,6 +20,7 @@ class CreateInstitution extends CreateRecord
{
use HasWizard;
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = InstitutionResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace App\Filament\Admin\Resources\OrganizationResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\OrganizationResource;
use Filament\Resources\Pages\CreateRecord;

class CreateOrganization extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = OrganizationResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace App\Filament\Admin\Resources\ResultResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\ResultResource;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Contracts\Support\Htmlable;

class CreateResult extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = ResultResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace App\Filament\Admin\Resources\RoleResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\RoleResource;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Contracts\Support\Htmlable;

class CreateRole extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = RoleResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace App\Filament\Admin\Resources\ServiceResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\ServiceResource;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Contracts\Support\Htmlable;

class CreateService extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = ServiceResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Admin\Resources\UserInstitutionResource\Pages;

use App\Concerns\HasParentResource;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\InstitutionResource;
use App\Filament\Admin\Resources\UserInstitutionResource;
use Filament\Forms\Components\Section;
Expand All @@ -16,6 +17,7 @@
class EditUserInstitution extends EditRecord
{
use HasParentResource;
use PreventSubmitFormOnEnter;

protected static string $resource = UserInstitutionResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace App\Filament\Admin\Resources\UserResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Admin\Resources\UserResource;
use Filament\Resources\Pages\CreateRecord;

class CreateUser extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = UserResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace App\Filament\Organizations\Resources\BeneficiaryInterventionResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\BeneficiaryInterventionResource;
use Filament\Resources\Pages\CreateRecord;

class CreateBeneficiaryIntervention extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = BeneficiaryInterventionResource::class;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages\CloseFile;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Models\Specialist;
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
Expand All @@ -20,6 +21,7 @@ class CreateCloseFile extends EditRecord
{
use HasWizard;
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = BeneficiaryResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Enums\AddressType;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Forms\Components\Notice;
Expand Down Expand Up @@ -37,6 +38,7 @@ class CreateBeneficiary extends CreateRecord
{
use HasWizard;
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = BeneficiaryResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages\DetailedEvaluation;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Models\BeneficiaryPartner;
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
Expand All @@ -17,6 +18,7 @@ class CreateDetailedEvaluation extends EditRecord
{
use HasWizard;
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = BeneficiaryResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Organizations\Resources\BeneficiaryResource\Pages\InitialEvaluation;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Services\Breadcrumb\BeneficiaryBreadcrumb;
use Filament\Forms\Components\Wizard\Step;
Expand All @@ -16,6 +17,7 @@ class CreateInitialEvaluation extends EditRecord
{
use HasWizard;
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = BeneficiaryResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ class CommunityProfileResource extends Resource

protected static ?int $navigationSort = 21;

public static function canAccess(): bool
{
return auth()->user()->canChangeOrganizationProfile();
}

public static function getNavigationGroup(): ?string
{
return __('navigation.community._group');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

namespace App\Filament\Organizations\Resources\InterventionPlanResource\Pages;

use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\InterventionPlanResource;
use Filament\Resources\Pages\CreateRecord;

class CreateInterventionPlan extends CreateRecord
{
use PreventSubmitFormOnEnter;

protected static string $resource = InterventionPlanResource::class;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Concerns\HasParentResource;
use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\MonitoringResource;
use App\Models\Monitoring;
use App\Models\Specialist;
Expand All @@ -24,6 +25,7 @@ class CreateMonitoring extends CreateRecord
use HasWizard;
use HasParentResource;
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = MonitoringResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace App\Filament\Organizations\Resources\ServiceResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\ServiceResource;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Contracts\Support\Htmlable;

class CreateService extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = ServiceResource::class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Filament\Organizations\Resources\UserResource\Pages;

use App\Concerns\PreventMultipleSubmit;
use App\Concerns\PreventSubmitFormOnEnter;
use App\Filament\Organizations\Resources\UserResource;
use App\Models\User;
use Filament\Facades\Filament;
Expand All @@ -15,6 +16,7 @@
class CreateUser extends CreateRecord
{
use PreventMultipleSubmit;
use PreventSubmitFormOnEnter;

protected static string $resource = UserResource::class;

Expand Down
Loading

0 comments on commit cfca3a4

Please sign in to comment.