diff --git a/app/Concerns/PreventSubmitFormOnEnter.php b/app/Concerns/PreventSubmitFormOnEnter.php new file mode 100644 index 00000000..02f04cc2 --- /dev/null +++ b/app/Concerns/PreventSubmitFormOnEnter.php @@ -0,0 +1,20 @@ +extraAttributes(['type' => 'button', 'wire:click' => 'create']); + } + + protected function getSaveFormAction(): Action + { + return parent::getSaveFormAction()->extraAttributes(['type' => 'button', 'wire:click' => 'save']); + } +} diff --git a/app/Filament/Admin/Resources/BenefitResource/Pages/CreateBenefit.php b/app/Filament/Admin/Resources/BenefitResource/Pages/CreateBenefit.php index 0a5bf179..3dd2014b 100644 --- a/app/Filament/Admin/Resources/BenefitResource/Pages/CreateBenefit.php +++ b/app/Filament/Admin/Resources/BenefitResource/Pages/CreateBenefit.php @@ -5,6 +5,7 @@ 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; @@ -12,6 +13,7 @@ class CreateBenefit extends CreateRecord { use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = BenefitResource::class; diff --git a/app/Filament/Admin/Resources/InstitutionResource/Pages/CreateInstitution.php b/app/Filament/Admin/Resources/InstitutionResource/Pages/CreateInstitution.php index 680b8b23..e5fc4be0 100644 --- a/app/Filament/Admin/Resources/InstitutionResource/Pages/CreateInstitution.php +++ b/app/Filament/Admin/Resources/InstitutionResource/Pages/CreateInstitution.php @@ -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; @@ -19,6 +20,7 @@ class CreateInstitution extends CreateRecord { use HasWizard; use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = InstitutionResource::class; diff --git a/app/Filament/Admin/Resources/OrganizationResource/Pages/CreateOrganization.php b/app/Filament/Admin/Resources/OrganizationResource/Pages/CreateOrganization.php index e3a9aec3..7588af23 100644 --- a/app/Filament/Admin/Resources/OrganizationResource/Pages/CreateOrganization.php +++ b/app/Filament/Admin/Resources/OrganizationResource/Pages/CreateOrganization.php @@ -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; diff --git a/app/Filament/Admin/Resources/ResultResource/Pages/CreateResult.php b/app/Filament/Admin/Resources/ResultResource/Pages/CreateResult.php index 35f8cf2e..c4ff6e0f 100644 --- a/app/Filament/Admin/Resources/ResultResource/Pages/CreateResult.php +++ b/app/Filament/Admin/Resources/ResultResource/Pages/CreateResult.php @@ -5,6 +5,7 @@ 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; @@ -12,6 +13,7 @@ class CreateResult extends CreateRecord { use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = ResultResource::class; diff --git a/app/Filament/Admin/Resources/RoleResource/Pages/CreateRole.php b/app/Filament/Admin/Resources/RoleResource/Pages/CreateRole.php index bb0b48af..9f790f76 100644 --- a/app/Filament/Admin/Resources/RoleResource/Pages/CreateRole.php +++ b/app/Filament/Admin/Resources/RoleResource/Pages/CreateRole.php @@ -5,6 +5,7 @@ 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; @@ -12,6 +13,7 @@ class CreateRole extends CreateRecord { use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = RoleResource::class; diff --git a/app/Filament/Admin/Resources/ServiceResource/Pages/CreateService.php b/app/Filament/Admin/Resources/ServiceResource/Pages/CreateService.php index a9eb84ec..666c425b 100644 --- a/app/Filament/Admin/Resources/ServiceResource/Pages/CreateService.php +++ b/app/Filament/Admin/Resources/ServiceResource/Pages/CreateService.php @@ -5,6 +5,7 @@ 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; @@ -12,6 +13,7 @@ class CreateService extends CreateRecord { use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = ServiceResource::class; diff --git a/app/Filament/Admin/Resources/UserInstitutionResource/Pages/EditUserInstitution.php b/app/Filament/Admin/Resources/UserInstitutionResource/Pages/EditUserInstitution.php index 61b4ccee..acc3e617 100644 --- a/app/Filament/Admin/Resources/UserInstitutionResource/Pages/EditUserInstitution.php +++ b/app/Filament/Admin/Resources/UserInstitutionResource/Pages/EditUserInstitution.php @@ -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; @@ -16,6 +17,7 @@ class EditUserInstitution extends EditRecord { use HasParentResource; + use PreventSubmitFormOnEnter; protected static string $resource = UserInstitutionResource::class; diff --git a/app/Filament/Admin/Resources/UserResource/Pages/CreateUser.php b/app/Filament/Admin/Resources/UserResource/Pages/CreateUser.php index 4f3016ee..d0ed0297 100644 --- a/app/Filament/Admin/Resources/UserResource/Pages/CreateUser.php +++ b/app/Filament/Admin/Resources/UserResource/Pages/CreateUser.php @@ -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; diff --git a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/CreateBeneficiaryIntervention.php b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/CreateBeneficiaryIntervention.php index 2a620f6f..4afeb71e 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/CreateBeneficiaryIntervention.php +++ b/app/Filament/Organizations/Resources/BeneficiaryInterventionResource/Pages/CreateBeneficiaryIntervention.php @@ -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; } diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/CreateCloseFile.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/CreateCloseFile.php index 6bdfc8c0..035a35ed 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/CreateCloseFile.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CloseFile/CreateCloseFile.php @@ -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; @@ -20,6 +21,7 @@ class CreateCloseFile extends EditRecord { use HasWizard; use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = BeneficiaryResource::class; diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php index 09fdceff..c4d4f420 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php @@ -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; @@ -37,6 +38,7 @@ class CreateBeneficiary extends CreateRecord { use HasWizard; use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = BeneficiaryResource::class; diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/CreateDetailedEvaluation.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/CreateDetailedEvaluation.php index 0416760f..05756211 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/CreateDetailedEvaluation.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/DetailedEvaluation/CreateDetailedEvaluation.php @@ -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; @@ -17,6 +18,7 @@ class CreateDetailedEvaluation extends EditRecord { use HasWizard; use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = BeneficiaryResource::class; diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/CreateInitialEvaluation.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/CreateInitialEvaluation.php index 7f5a9c4d..155b6265 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/CreateInitialEvaluation.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/InitialEvaluation/CreateInitialEvaluation.php @@ -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; @@ -16,6 +17,7 @@ class CreateInitialEvaluation extends EditRecord { use HasWizard; use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = BeneficiaryResource::class; diff --git a/app/Filament/Organizations/Resources/InterventionPlanResource/Pages/CreateInterventionPlan.php b/app/Filament/Organizations/Resources/InterventionPlanResource/Pages/CreateInterventionPlan.php index 1545c861..f38909d5 100644 --- a/app/Filament/Organizations/Resources/InterventionPlanResource/Pages/CreateInterventionPlan.php +++ b/app/Filament/Organizations/Resources/InterventionPlanResource/Pages/CreateInterventionPlan.php @@ -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; } diff --git a/app/Filament/Organizations/Resources/MonitoringResource/Pages/CreateMonitoring.php b/app/Filament/Organizations/Resources/MonitoringResource/Pages/CreateMonitoring.php index 082f7829..08846b76 100644 --- a/app/Filament/Organizations/Resources/MonitoringResource/Pages/CreateMonitoring.php +++ b/app/Filament/Organizations/Resources/MonitoringResource/Pages/CreateMonitoring.php @@ -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; @@ -24,6 +25,7 @@ class CreateMonitoring extends CreateRecord use HasWizard; use HasParentResource; use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = MonitoringResource::class; diff --git a/app/Filament/Organizations/Resources/ServiceResource/Pages/CreateService.php b/app/Filament/Organizations/Resources/ServiceResource/Pages/CreateService.php index 15b57afc..357e7d10 100644 --- a/app/Filament/Organizations/Resources/ServiceResource/Pages/CreateService.php +++ b/app/Filament/Organizations/Resources/ServiceResource/Pages/CreateService.php @@ -5,6 +5,7 @@ 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; @@ -12,6 +13,7 @@ class CreateService extends CreateRecord { use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = ServiceResource::class; diff --git a/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php b/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php index 5359bb30..366ce957 100644 --- a/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php +++ b/app/Filament/Organizations/Resources/UserResource/Pages/CreateUser.php @@ -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; @@ -15,6 +16,7 @@ class CreateUser extends CreateRecord { use PreventMultipleSubmit; + use PreventSubmitFormOnEnter; protected static string $resource = UserResource::class;