Skip to content

Commit

Permalink
Glitch in the UI while create migrations #19
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Jul 8, 2024
1 parent b7b660b commit 2223e75
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 78 deletions.
55 changes: 0 additions & 55 deletions lang/en/messages.php

This file was deleted.

4 changes: 4 additions & 0 deletions resources/lang/ar/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
'docs' => 'عن الاضافة',
],
'notifications' => [
'exists' => [
'title' => 'خطأ',
'body' => 'الاضافة موجودة بالفعل'
],
'autoload' => [
'title' => 'خطأ',
'body' => 'عفواً لا يمكن تفعيل هذه الاضافة قبل تشغيل الامر composer dump-autoload في الطرفية'
Expand Down
5 changes: 5 additions & 0 deletions resources/lang/en/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
'docs' => 'Docs',
],
'notifications' => [
'exists' => [
'title' => 'Error',
'body' => 'The plugin already exists.'
],
'autoload' => [
'title' => 'Error',
'body' => 'The plugin could not be activated because the class could not be found. please run composer dump-autoload on your terminal'
Expand Down Expand Up @@ -52,6 +56,7 @@
],
'tables' => [
'title' => 'Tables',
'single' => 'Table',
'create' => 'Create Table',
'edit' => 'Edit Table',
'columns' => 'Table Columns',
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/nl/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
'docs' => 'Docs',
],
'notifications' => [
'exists' => [
'title' => 'Error',
'body' => 'The plugin already exists.'
],
'autoload' => [
'title' => 'Error',
'body' => 'The plugin could not be activated because the class could not be found. please run composer dump-autoload on your terminal'
Expand Down
29 changes: 15 additions & 14 deletions src/Pages/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function disableAction(): Action
$module?->disable();

Notification::make()
->title(trans('filament-plugins::messages.plugins.notifications.disabled.title'))
->body(trans('filament-plugins::messages.plugins.notifications.disabled.body'))
->title(trans('filament-plugins::messages.plugins.notificationss.disabled.title'))
->body(trans('filament-plugins::messages.plugins.notificationss.disabled.body'))
->success()
->send();

Expand All @@ -98,8 +98,8 @@ public function deleteAction(): Action
$module?->delete();

Notification::make()
->title(trans('filament-plugins::messages.plugins.notifications.deleted.title'))
->body(trans('filament-plugins::messages.plugins.notifications.deleted.body'))
->title(trans('filament-plugins::messages.plugins.notificationss.deleted.title'))
->body(trans('filament-plugins::messages.plugins.notificationss.deleted.body'))
->success()
->send();

Expand All @@ -119,8 +119,8 @@ public function activeAction(): Action
->action(function (array $arguments) {
if(!class_exists(json_decode($arguments['item']['providers'])[0])){
Notification::make()
->title(trans('filament-plugins::messages.plugins.notifications.autoload.title'))
->body(trans('filament-plugins::messages.plugins.notifications.autoload.body'))
->title(trans('filament-plugins::messages.plugins.notificationss.autoload.title'))
->body(trans('filament-plugins::messages.plugins.notificationss.autoload.body'))
->danger()
->send();
return;
Expand All @@ -129,8 +129,8 @@ public function activeAction(): Action
$module?->enable();

Notification::make()
->title(trans('filament-plugins::messages.plugins.notifications.enabled.title'))
->body(trans('filament-plugins::messages.plugins.notifications.enabled.body'))
->title(trans('filament-plugins::messages.plugins.notificationss.enabled.title'))
->body(trans('filament-plugins::messages.plugins.notificationss.enabled.body'))
->success()
->send();

Expand Down Expand Up @@ -195,8 +195,8 @@ public function importPlugin(array $data)
$zip->close();

Notification::make()
->title(trans('filament-plugins::messages.plugins.notifications.import.title'))
->body(trans('filament-plugins::messages.plugins.notifications.import.body'))
->title(trans('filament-plugins::messages.plugins.notificationss.import.title'))
->body(trans('filament-plugins::messages.plugins.notificationss.import.body'))
->success()
->send();

Expand All @@ -210,10 +210,11 @@ public function createPlugin(array $data)
$checkIfPluginExists = Module::find(Str::of($data['name'])->camel()->ucfirst()->toString());
if($checkIfPluginExists){
Notification::make()
->title(trans('filament-plugins::messages.plugins.notification.exists.title'))
->body(trans('filament-plugins::messages.plugins.notification.exists.body'))
->title(trans('filament-plugins::messages.plugins.notifications.exists.title'))
->body(trans('filament-plugins::messages.plugins.notifications.exists.body'))
->danger()
->send();
return;
}

$generator = new PluginGenerator(
Expand All @@ -225,8 +226,8 @@ public function createPlugin(array $data)
$generator->generate();

Notification::make()
->title(trans('filament-plugins::messages.plugins.notification.created.title'))
->body(trans('filament-plugins::messages.plugins.notification.created.body'))
->title(trans('filament-plugins::messages.plugins.notifications.created.title'))
->body(trans('filament-plugins::messages.plugins.notifications.created.body'))
->success()
->send();
}
Expand Down
23 changes: 18 additions & 5 deletions src/Resources/TableResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ class TableResource extends Resource

protected static bool $shouldRegisterNavigation = false;

public static function getNavigationLabel(): string
{
return trans('filament-plugins::messages.tables.title'); // TODO: Change the autogenerated stub
}

public function getTitle(): string
{
return trans('filament-plugins::messages.tables.title');
}

public static function getPluralLabel(): ?string
{
return trans('filament-plugins::messages.tables.title') . ' ['.session()->get('current_module').']'; // TODO: Change the autogenerated stub
}

public static function form(Form $form): Form
{
return $form
Expand All @@ -51,12 +66,10 @@ public static function form(Form $form): Form

public static function table(Table $table): Table
{
$query = $table->getQuery();
if(request()->has('module')){
$query->where('module', request()->get('module'));
}
return $table
->query($query)
->modifyQueryUsing(function ($query) {
$query->where('module', session()->get('current_module'));
})
->columns([
Tables\Columns\TextColumn::make('name')
->label(trans('filament-plugins::messages.tables.form.name'))
Expand Down
12 changes: 8 additions & 4 deletions src/Resources/TableResource/Pages/ListTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace TomatoPHP\FilamentPlugins\Resources\TableResource\Pages;

use Filament\Tables\Table;
use TomatoPHP\FilamentPlugins\Resources\TableResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
Expand All @@ -10,18 +11,21 @@ class ListTables extends ListRecords
{
protected static string $resource = TableResource::class;

public function getTitle(): string
{
return trans('filament-plugins::messages.tables.title');
}

public function mount(): void
{
if(!request()->has('module')){
$this->redirect(route('filament.'.filament()->getCurrentPanel()->getId().'.pages.plugins'));
}

if(session()->has('current_module')){
session()->forget('current_module');
}

session()->put('current_module', request()->get('module'));
}


protected function getHeaderActions(): array
{
return [
Expand Down

0 comments on commit 2223e75

Please sign in to comment.