Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-mills authored and github-actions[bot] committed Nov 20, 2023
1 parent ae896c7 commit aa1d365
Show file tree
Hide file tree
Showing 50 changed files with 487 additions and 622 deletions.
4 changes: 1 addition & 3 deletions config/odk-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
* - 'https://kobo.humanitarianresponse.info'
*
* If you use a custom installation of ODK Central or Kobotoolbox, it will be the base url to your service.
*
*
*/
'url' => env('ODK_URL', ''),
'base_endpoint' => env('ODK_ENDPOINT', env('ODK_URL')."/v1"),
'base_endpoint' => env('ODK_ENDPOINT', env('ODK_URL') . '/v1'),

/**
* Username and password for the main platform account
Expand Down
20 changes: 9 additions & 11 deletions src/Filament/Resources/DatasetResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources;

use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\Pages;
use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\RelationManagers;
use Stats4sd\FilamentOdkLink\Models\OdkLink\Dataset;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\Pages;
use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\RelationManagers;
use Stats4sd\FilamentOdkLink\Models\OdkLink\Dataset;

class DatasetResource extends Resource
{
Expand Down Expand Up @@ -74,11 +72,11 @@ public static function infolist(Infolist $infolist): Infolist
TextEntry::make('primary_key'),
TextEntry::make('description'),
])
->columns([
'lg' => 3,
'md' => 2,
'sm' => 1,
])
->columns([
'lg' => 3,
'md' => 2,
'sm' => 1,
]),
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;

class CreateDataset extends CreateRecord
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;

class EditDataset extends EditRecord
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;

class ListDatasets extends ListRecords
{
Expand Down
5 changes: 2 additions & 3 deletions src/Filament/Resources/DatasetResource/Pages/ViewDataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Contracts\Support\Htmlable;
use Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource;

class ViewDataset extends ViewRecord
{
protected static string $resource = DatasetResource::class;

public function getTitle(): string|Htmlable
public function getTitle(): string | Htmlable
{
return 'Dataset: ' . $this->getRecord()->name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\DatasetResource\RelationManagers;

use Stats4sd\FilamentOdkLink\Filament\Resources\XlsformTemplateResource;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Stats4sd\FilamentOdkLink\Filament\Resources\XlsformTemplateResource;

class XlsformTemplateSourcesRelationManager extends RelationManager
{
Expand All @@ -37,10 +35,10 @@ public function table(Table $table): Table
->recordTitleAttribute('title')
->columns([
Tables\Columns\TextColumn::make('title')
->label('Xlsform Template')
->url(fn (Model $record) => XlsformTemplateResource::getUrl('view', ['record' => $record])),
->label('Xlsform Template')
->url(fn (Model $record) => XlsformTemplateResource::getUrl('view', ['record' => $record])),
Tables\Columns\TextColumn::make('active_xlsforms_count')->counts('xlsforms')
->label('# of Active XLsforms')
->label('# of Active XLsforms'),
])
->filters([
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class XlsformTemplatesRelationManager extends RelationManager
{
Expand Down
14 changes: 5 additions & 9 deletions src/Filament/Resources/TeamResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources;

use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource\Pages;
use Stats4sd\FilamentOdkLink\Models\TeamManagement\Team;
use Filament\Actions\ViewAction;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Infolists\Components\ImageEntry;
Expand All @@ -15,10 +12,9 @@
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\HtmlString;
use PHPUnit\Event\Telemetry\Info;
use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource\Pages;
use Stats4sd\FilamentOdkLink\Models\TeamManagement\Team;

class TeamResource extends Resource
{
Expand Down Expand Up @@ -73,13 +69,13 @@ public static function infolist(Infolist $infolist): Infolist
->columns(6)
->schema([
ImageEntry::make('avatar')
->label('')
->columnSpan(2),
->label('')
->columnSpan(2),
TextEntry::make('description')
->getStateUsing(fn ($record) => new HtmlString(preg_replace('/\n/', '<br/>', $record->description)))
->columnSpan(4),
ViewEntry::make('qr_code')
->view('filament.infolists.components.team-qr-code')
->view('filament.infolists.components.team-qr-code'),

]),
]);
Expand Down
3 changes: 1 addition & 2 deletions src/Filament/Resources/TeamResource/Pages/CreateTeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;

class CreateTeam extends CreateRecord
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Resources/TeamResource/Pages/EditTeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;

class EditTeam extends EditRecord
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Resources/TeamResource/Pages/ListTeams.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;

class ListTeams extends ListRecords
{
Expand Down
4 changes: 2 additions & 2 deletions src/Filament/Resources/TeamResource/Pages/ViewTeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource\Pages;

use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Contracts\Support\Htmlable;
use Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource;

class ViewTeam extends ViewRecord
{
protected static string $resource = TeamResource::class;

public function getTitle(): string|Htmlable
public function getTitle(): string | Htmlable
{
return $this->getRecord()->name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
namespace Stats4sd\FilamentOdkLink\Filament\Resources\TeamResource\RelationManagers;

use Filament\Forms;
use Filament\Tables;
use Filament\Forms\Components\ViewField;
use Filament\Forms\Form;
use Filament\Tables\Table;
use Stats4sd\FilamentOdkLink\Models\OdkLink\Xlsform;
use Stats4sd\FilamentOdkLink\Services\OdkLinkService;
use Filament\Actions\ViewAction;
use Filament\Infolists\Infolist;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Stats4sd\FilamentOdkLink\Jobs\UpdateXlsformTitleInFile;
use Stats4sd\FilamentOdkLink\Models\OdkLink\Xlsform;
use Stats4sd\FilamentOdkLink\Models\OdkLink\XlsformTemplate;
use Filament\Forms\Components\ViewField;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Resources\RelationManagers\RelationManager;
use Stats4sd\FilamentOdkLink\Services\OdkLinkService;

class XlsformsRelationManager extends RelationManager
{
Expand All @@ -35,10 +33,10 @@ public function form(Form $form): Form
->relationship(
name: 'xlsformTemplate',
titleAttribute: 'title',
modifyQueryUsing: fn(Builder $query) => $query->where('available', true)
modifyQueryUsing: fn (Builder $query) => $query->where('available', true)
)
->live()
->afterStateUpdated(fn(Forms\Set $set, $state) => $set('title', $state ? XlsformTemplate::find($state)->title : '')),
->afterStateUpdated(fn (Forms\Set $set, $state) => $set('title', $state ? XlsformTemplate::find($state)->title : '')),

Forms\Components\TextInput::make('title')
->helperText('By default, this is the title of the Template you select. If you want multiple instances of the same form template, you should give each a unique title.')
Expand All @@ -54,7 +52,7 @@ public function form(Form $form): Form
// show Enteko link as a clickable link
ViewField::make('enketo_draft_url')
->label('Click below link to view ODK form in browser')
->view('filament.forms.components.clickable-link')
->view('filament.forms.components.clickable-link'),
]);
}

Expand All @@ -69,7 +67,7 @@ public function table(Table $table): Table
Tables\Columns\ViewColumn::make('team_datasets_required')
->view('filament.tables.columns.team-datasets-required'),
Tables\Columns\TextColumn::make('submissions_count')->counts('submissions')
->label('No. of Submissions'),
->label('No. of Submissions'),
])
->filters([
//
Expand All @@ -81,7 +79,7 @@ public function table(Table $table): Table

$odkLinkService = app()->make(OdkLinkService::class);

if (!$record->xlsfile) {
if (! $record->xlsfile) {
$record->updateXlsfileFromTemplate();
}

Expand Down Expand Up @@ -111,7 +109,7 @@ public function infoList(Infolist $infoList): Infolist
Tables\Columns\TextColumn::make('title'),
Tables\Columns\TextColumn::make('status'),
Tables\Columns\TextColumn::make('submissions_count')->counts('submissions')
->label('No. of Submissions'),
->label('No. of Submissions'),
]);
}
}
Loading

0 comments on commit aa1d365

Please sign in to comment.