Skip to content
Merged

Dev #822

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

return (new Config())
->setRiskyAllowed(false)
->setRules([
'@auto' => true
])
// 💡 by default, Fixer looks for `*.php` files excluding `./vendor/` - here, you can groom this config
->setFinder(
(new Finder())
// 💡 root folder to check
->in(__DIR__)
// 💡 additional files, eg bin entry file
// ->append([__DIR__.'/bin-entry-file'])
// 💡 folders to exclude, if any
// ->exclude([/* ... */])
// 💡 path patterns to exclude, if any
// ->notPath([/* ... */])
// 💡 extra configs
// ->ignoreDotFiles(false) // true by default in v3, false in v4 or future mode
// ->ignoreVCS(true) // true by default
)
;
4 changes: 2 additions & 2 deletions app/Console/Commands/ImportGenData.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function handle(): int
// Ask the user which tube should be associated with the generator data
$this->newLine();
foreach ($tubes as $tube) {
$this->line($tube->id.': '.$tube->housing_model.' SN: '.$tube->housing_sn.' '.$tube->notes.' Status:'.$tube->tube_status);
$this->line($tube->id . ': ' . $tube->housing_model . ' SN: ' . $tube->housing_sn . ' ' . $tube->notes . ' Status:' . $tube->tube_status);
$tubeChoice[] = $tube->id;
}
$tubeId = $this->choice(
Expand Down Expand Up @@ -158,7 +158,7 @@ public function handle(): int

$progressBar->finish();
$this->newLine();
$this->info('Generator data for Survey ID: '.$surveyId.' ('.$machine->description.') saved.');
$this->info('Generator data for Survey ID: ' . $surveyId . ' (' . $machine->description . ') saved.');

return 1;
}
Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/ImportN3TO10.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function handle(): int
->getCalculatedValue();

// Check to see if data for this survey ID already exists.
if ((LeedsN3::where('survey_id', $surveyId)->get()->count() > 0) &&
(LeedsTO10::where('survey_id', $surveyId)->get()->count() > 0)) {
if ((LeedsN3::where('survey_id', $surveyId)->get()->count() > 0)
&& (LeedsTO10::where('survey_id', $surveyId)->get()->count() > 0)) {
// There's already data for this $surveyId present. Exit
$progressBar->finish();
$this->newLine();
Expand All @@ -83,7 +83,7 @@ public function handle(): int
// Ask the user which tube should be associated with the generator data
$this->newLine();
foreach ($tubes as $tube) {
$this->line($tube->id.': '.$tube->housing_model.' SN: '.$tube->housing_sn.' '.$tube->notes.' Status:'.$tube->tube_status);
$this->line($tube->id . ': ' . $tube->housing_model . ' SN: ' . $tube->housing_sn . ' ' . $tube->notes . ' Status:' . $tube->tube_status);
$tubeChoice[] = $tube->id;
}
$tubeId = $this->choice(
Expand Down Expand Up @@ -135,7 +135,7 @@ public function handle(): int
$progressBar->advance();
}

$this->info(' Leeds N3 data for Survey ID: '.$surveyId.' ('.$machine->description.') saved.');
$this->info(' Leeds N3 data for Survey ID: ' . $surveyId . ' (' . $machine->description . ') saved.');

/*
* Get Leeds TO10 data (C414:M426)
Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/ImportSurveyReports.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ public function handle(): void
foreach ($surveys as $s) {
// See if the report_file_path starts with 'public/SurveyReports'
if (substr($s->report_file_path, 0, 20) == 'public/SurveyReports') {
$file = '/opt/www/raddb/public/storage/oldSurveyReports/'.substr($s->report_file_path, 21);
$file = '/opt/www/raddb/public/storage/oldSurveyReports/' . substr($s->report_file_path, 21);
}
if (substr($s->report_file_path, 0, 13) == 'SurveyReports') {
$file = '/opt/www/raddb/public/storage/oldSurveyreports/'.substr($s->report_file_path, 14);
$file = '/opt/www/raddb/public/storage/oldSurveyreports/' . substr($s->report_file_path, 14);
}
if (substr($s->report_file_path, 0, 4) == '2018') {
$file = '/opt/www/raddb/public/storage/oldSurveyReports/'.$s->report_file_path;
$file = '/opt/www/raddb/public/storage/oldSurveyReports/' . $s->report_file_path;
}
if (file_exists($file)) {
$s->addMedia($file)
->preservingOriginal()
->toMediaCollection('survey_report', 'SurveyReports');
$this->info($file.'added to medialibrary');
$this->info($file . 'added to medialibrary');
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions app/Console/Commands/LutAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function handle(): void
$lut->location = text(
label: 'Enter a new location',
required: true,
validate: fn (string $value) => match (true) {
validate: fn(string $value) => match (true) {
Str::length($value) > 100 => 'The location must be less than 100 characters',
default => null
}
Expand All @@ -66,7 +66,7 @@ public function handle(): void
$lut->manufacturer = text(
label: 'Enter a new manufacturer',
required: true,
validate: fn (string $value) => match (true) {
validate: fn(string $value) => match (true) {
Str::length($value) > 50 => 'The manufacturer must be less than 50 characters',
default => null
}
Expand All @@ -77,7 +77,7 @@ public function handle(): void
$lut->modality = text(
label: 'Enter a new modality',
required: true,
validate: fn (string $value) => match (true) {
validate: fn(string $value) => match (true) {
Str::length($value) > 25 => 'The modality must be less than 25 characters',
default => null
}
Expand All @@ -88,15 +88,15 @@ public function handle(): void
$lut->name = text(
label: 'Enter a new tester\'s name',
required: true,
validate: fn (string $value) => match (true) {
validate: fn(string $value) => match (true) {
Str::length($value) > 25 => 'The name must be less than 25 characters',
default => null
}
);
$lut->initials = text(
label: 'Enter tester\'s initials',
required: true,
validate: fn (string $value) => match (true) {
validate: fn(string $value) => match (true) {
Str::length($value) > 4 => 'The initials must be less than 4 characters',
default => null
}
Expand All @@ -107,7 +107,7 @@ public function handle(): void
$lut->test_type = text(
label: 'Enter a new test type',
required: true,
validate: fn (string $value) => match (true) {
validate: fn(string $value) => match (true) {
Str::length($value) > 30 => 'The test type must be less than 30 characters',
default => null
}
Expand All @@ -121,7 +121,7 @@ public function handle(): void

if (is_object($lut)) {
$lut->save();
info('New '.$table.' entry saved.');
info('New ' . $table . ' entry saved.');
}
}
}
4 changes: 2 additions & 2 deletions app/Console/Commands/LutDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public function handle(): void
$lut = $model::find(text(label: 'Enter the ID to remove', required: true));

// Ask for confirmation
if (confirm(label: 'Deleting from '.$table.' ID:'.$lut->id.' Value: '.$lut->$field, default: false)) {
if (confirm(label: 'Deleting from ' . $table . ' ID:' . $lut->id . ' Value: ' . $lut->$field, default: false)) {
$lut->delete();
info($table.' ID:'.$lut->id.' deleted.');
info($table . ' ID:' . $lut->id . ' deleted.');

// Show the updated lookup table
$this->showTable($table);
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/LutEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function handle(): void

// Show the selected lookup table
$id = select(
label: 'Select the '.$field.' to edit',
label: 'Select the ' . $field . ' to edit',
options: $model::pluck($field, 'id'),
scroll: 10
);
Expand All @@ -93,12 +93,12 @@ public function handle(): void

$value = text(label: 'What should the new value be?', required: true);

if (confirm('Changing '.$lut->$field.' to '.$value.'.', default: false)) {
if (confirm('Changing ' . $lut->$field . ' to ' . $value . '.', default: false)) {
$lut->$field = $value; // Need to validate this before saving
$lut->save();
// Show the updated lookup table
$this->showTable($table);
info($table.' table ID: '.$id.' edited.');
info($table . ' table ID: ' . $id . ' edited.');
} else {
info('No changes made.');
}
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/MachineAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function handle(): int
$machine->install_date = text('Enter the installation date for this machine (YYYY-MM-DD)');
$machine->room = text(label: 'Enter the room number for this machine', required: true);
$machine->vend_site_id = text('Enter the vendor site ID for this machine');
$machine->pacs_station = text('Enter the PACS station ID for this machine');
$machine->notes = text('Enter any special notes for this machine');
$machine->machine_status = 'Active';

Expand All @@ -81,6 +82,7 @@ public function handle(): int
'install_date' => 'required|date',
'room' => 'required|string|max:20',
'vend_site_id' => 'string|nullable',
'pacs_station' => 'string|nullable',
'notes' => 'string|nullable',
]);

Expand Down
8 changes: 7 additions & 1 deletion app/Console/Commands/MachineEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function handle(): int
$machine = Machine::find(
search(
'Search for the machine description to edit',
fn (string $value) => strlen($value) > 0
fn(string $value) => strlen($value) > 0
? Machine::active()->where('description', 'like', "%{$value}%")->orderBy('description')->pluck('description', 'id')->all()
: []
)
Expand Down Expand Up @@ -131,6 +131,11 @@ public function handle(): int
default: $machine->vend_site_id ?? ''
);

$machine->pacs_station = text(
label: 'Enter the PACS station ID for this machine (enter to leave unchanged)',
default: $machine->pacs_station ?? ''
);

$machine->notes = text(
label: 'Enter any special notes for this machine (enter to leave unchanged)',
default: $machine->notes ?? ''
Expand All @@ -151,6 +156,7 @@ public function handle(): int
'room' => 'required|string|max:20',
'software_version' => 'string|nullable',
'vend_site_id' => 'string|nullable',
'pacs_station' => 'string|nullable',
'notes' => 'string|nullable',
]);

Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/SurveyAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle(): int
// No machine ID was provided. Prompt the user to select a machine
$testdate->machine_id = search(
'Search for the machine description to add a survey for',
fn (string $value) => strlen($value) > 0
fn(string $value) => strlen($value) > 0
? Machine::active()->where('description', 'like', "%{$value}%")->orderBy('description')->pluck('description', 'id')->all()
: []
);
Expand Down Expand Up @@ -98,7 +98,7 @@ public function handle(): int
// Save the survey
$testdate->save();

info('Survey ID '.$testdate->id.' has been added for '.$testdate->machine->description.'.');
info('Survey ID ' . $testdate->id . ' has been added for ' . $testdate->machine->description . '.');

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/SurveyCancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function handle(): int
$survey = TestDate::find($survey_id);
$survey->delete();

info('Survey ID '.$survey_id.' has been deleted');
info('Survey ID ' . $survey_id . ' has been deleted');

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/TubeAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle(): int
// No machine ID was provided. Display a list of all the machines and ask for a machine ID to add the new tube to.
$tube->machine_id = search(
'Search for the machine description to add a tube to',
fn (string $value) => strlen($value) > 0
fn(string $value) => strlen($value) > 0
? Machine::active()->where('description', 'like', "%{$value}%")->orderBy('description')->pluck('description', 'id')->all()
: []
);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/TubeEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function handle(): int
$machine = Machine::find(
search(
'Search for the machine description to edit',
fn (string $value) => strlen($value) > 0
fn(string $value) => strlen($value) > 0
? Machine::active()->where('description', 'like', "%{$value}%")->orderBy('description')->pluck('description', 'id')->all()
: []
)
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__ . '/Commands');

require base_path('routes/console.php');
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/AnnReportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ public function annrep(int $year): View

// Get a list of new installations during the specified year
$newInstalls = Machine::with('modality', 'location')
->whereBetween('install_date', [$year.'-01-01', $year.'-12-31'])
->whereBetween('install_date', [$year . '-01-01', $year . '-12-31'])
->get();

// Get a list of machines removed during the specified year

$removed = Machine::onlyTrashed()
->with('modality', 'location')
->whereBetween('deleted_at', [$year.'-01-01', $year.'-12-31'])
->whereBetween('deleted_at', [$year . '-01-01', $year . '-12-31'])
->get();

return view('ar.annrep', [
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/DashboardSurveyCalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public function index(): View

// Create a column chart
\Lava::CalendarChart(
'Daily survey count - '.$y->years,
'Daily survey count - ' . $y->years,
$surveyCalendar,
[
'title' => 'Daily survey counts - '.$y->years,
'title' => 'Daily survey counts - ' . $y->years,
'titleTextStyle' => [
'fontSize' => 14,
'color' => 'black', ],
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/DashboardSurveyCategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public function index(): View

// Create a pie chart
\Lava::PieChart(
'Yearly survey counts by test type - '.$y->years,
'Yearly survey counts by test type - ' . $y->years,
$surveyCategories,
[
'is3D' => true,
'title' => 'Survey counts - '.$y->years.' ('.$chartData->sum().')',
'title' => 'Survey counts - ' . $y->years . ' (' . $chartData->sum() . ')',
'titleTextStyle' => [
'fontSize' => 14,
'color' => 'black', ],
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/DashboardSurveyCountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function index(): View

// Create a column chart
\Lava::ColumnChart(
'Survey count - '.$y->years,
'Survey count - ' . $y->years,
$surveyCounts,
[
'title' => 'Survey counts - '.$y->years,
'title' => 'Survey counts - ' . $y->years,
'titleTextStyle' => [
'fontSize' => 14, ],
'legend' => [
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/MachineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function store(UpdateMachineRequest $request, Machine $machine): Redirect

if ($machine->save()) {
$status = 'success';
$message = 'New machine created: Machine ID '.$machine->id.'.';
$message = 'New machine created: Machine ID ' . $machine->id . '.';
Log::info($message);
} else {
$status = 'fail';
Expand Down Expand Up @@ -202,7 +202,7 @@ public function update(UpdateMachineRequest $request, $id): RedirectResponse

if ($machine->save()) {
$status = 'success';
$message = 'Machine ID '.$machine->id.' updated.';
$message = 'Machine ID ' . $machine->id . ' updated.';
Log::info($message);
} else {
$status = 'fail';
Expand Down Expand Up @@ -248,19 +248,19 @@ public function destroy($id): RedirectResponse
$tube->remove_date = date('Y-m-d');
$tube->save();
if ($tube->delete()) {
$message .= 'Tube ID '.$tube->id.' deleted.';
$message .= 'Tube ID ' . $tube->id . ' deleted.';
} else {
$message .= 'Error deleting tube ID '.$tube->id.'.';
$message .= 'Error deleting tube ID ' . $tube->id . '.';
}
}

if ($machine->delete()) {
$status = 'success';
$message .= 'Machine ID '.$machine->id.' deleted.';
$message .= 'Machine ID ' . $machine->id . ' deleted.';
Log::info($message);
} else {
$status = 'fail';
$message .= 'Error deleting machine ID '.$machine->id.'.';
$message .= 'Error deleting machine ID ' . $machine->id . '.';
Log::error($message);
}

Expand Down
Loading