Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Oct 8, 2024
1 parent 339a77d commit 73f4eff
Show file tree
Hide file tree
Showing 104 changed files with 120 additions and 125 deletions.
25 changes: 10 additions & 15 deletions app/Concerns/BelongsToNurse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ public static function bootBelongsToNurse(): void
return;
}

if (auth()->user()->isNurse()) {
$builder->forNurse(auth()->user());
}

if (auth()->user()->isCoordinator()) {
$builder->forNurseInCounty(auth()->user()->county_id);
}
return $builder->forUser(auth()->user());
});
}

Expand All @@ -37,15 +31,16 @@ public function nurse(): BelongsTo
return $this->belongsTo(User::class)->onlyNurses();
}

public function scopeForNurse(Builder $query, User $user): Builder
public function scopeForUser(Builder $query, User $user): Builder
{
return $query->where('nurse_id', $user->id);
}
if ($user->isNurse()) {
return $query->where('nurse_id', $user->id);
}

public function scopeForNurseInCounty(Builder $query, int $county_id): Builder
{
return $query->whereHas('nurse', function (Builder $query) use ($county_id) {
$query->activatesInCounty($county_id);
});
if ($user->isCoordinator()) {
return $query->whereRelation('nurse', 'activity_county_id', $user->county_id);
}

return $query;
}
}
2 changes: 1 addition & 1 deletion app/Filament/Forms/Components/ReportContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function tables(): Group
View::make('vendor.tables.components.empty-state.index')
->visible(blank(data_get($table, 'data')))
->viewData([
'icon' => 'icon-clipboard',
'icon' => 'heroicon-o-x',
'heading' => __('report.no-results.title'),
'description' => __('report.no-results.description'),
]),
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Beneficiary.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,6 @@ public function scopeWhereHasVulnerabilities(Builder $query, callable $callback)
})
->leftJoin('cities', 'beneficiaries.city_id', '=', 'cities.id')
->leftJoin('counties', 'beneficiaries.county_id', '=', 'counties.id');
}, 'activity_log');
}, 'beneficiaries');
}
}
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C01.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C02.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
4 changes: 2 additions & 2 deletions app/Reports/Queries/Child/C04.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace App\Reports\Queries\Child;

use App\Filament\Resources\BeneficiaryResource;
use App\Models\Beneficiary;
use App\Reports\Queries\ReportQuery;
use Illuminate\Database\Eloquent\Builder;
use App\Filament\Resources\BeneficiaryResource;

class C04 extends ReportQuery
{
Expand All @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
4 changes: 2 additions & 2 deletions app/Reports/Queries/Child/C05.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace App\Reports\Queries\Child;

use App\Filament\Resources\BeneficiaryResource;
use App\Models\Beneficiary;
use App\Reports\Queries\ReportQuery;
use Illuminate\Database\Eloquent\Builder;
use App\Filament\Resources\BeneficiaryResource;

class C05 extends ReportQuery
{
Expand All @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
4 changes: 2 additions & 2 deletions app/Reports/Queries/Child/C06.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace App\Reports\Queries\Child;

use App\Filament\Resources\BeneficiaryResource;
use App\Models\Beneficiary;
use App\Reports\Queries\ReportQuery;
use Illuminate\Database\Eloquent\Builder;
use App\Filament\Resources\BeneficiaryResource;

class C06 extends ReportQuery
{
Expand All @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C07.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C08.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C09.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C10.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C11.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C12.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C13.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C15.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C16.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C19.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C22.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C23.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C24.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C25.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C26.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C27.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
4 changes: 2 additions & 2 deletions app/Reports/Queries/Child/C28.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace App\Reports\Queries\Child;

use App\Filament\Resources\BeneficiaryResource;
use App\Models\Beneficiary;
use App\Reports\Queries\ReportQuery;
use Illuminate\Database\Eloquent\Builder;
use App\Filament\Resources\BeneficiaryResource;

class C28 extends ReportQuery
{
Expand All @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C29.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/Child/C30.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G01.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G02.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G03.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G04.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G05.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G06.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G07.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/Queries/General/G08.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function query(): Builder

public static function dateColumn(): string
{
return 'activity_log.created_at';
return 'beneficiaries.created_at';
}

public static function columns(): array
Expand Down
Loading

0 comments on commit 73f4eff

Please sign in to comment.