added border setting to project and changed plotting strategy in Rmd

This commit is contained in:
Martin Folkerts 2024-08-28 14:34:47 +02:00
parent 2598306643
commit f6c05a89fe
5 changed files with 51 additions and 1 deletions

View file

@ -48,6 +48,7 @@ public function handle()
sprintf('--report_date=%s', $this->projectReport->getReportDate()),
sprintf('--mail_day=%s', $this->isTestReport? Carbon::yesterday()->dayName: $this->projectReport->project->mail_day),
sprintf('--data_dir=%s', $this->projectReport->project->download_path),
sprintf('--borders=%s', $this->projectReport->project->borders ? 'True' : 'False'),
];
logger('command:'. print_r($command, true));

View file

@ -176,11 +176,13 @@ private function resetFormData()
{
$this->formData = [
'name' => '',
'borders' => false,
'mail_subject' => '',
'mail_template' => '',
'mail_frequency' => '',
'mail_day' => '',
'mail_recipients' => [],
];
$this->pivotFiles = [];
$this->spanFiles = [];
@ -197,6 +199,7 @@ private function validateForm()
'pivot_file' => $this->formData['pivot_file'],
'span_file' => $this->formData['span_file'],
'harvest_file' => $this->formData['harvest_file'],
'borders' => $this->formData['borders'],
], [
'name' => [
'required',
@ -215,6 +218,7 @@ private function validateForm()
}
}],
'harvest_file' => ['sometimes', new HarvestFile],
'borders' => ['required', 'boolean'],
])->validate();
}
@ -226,6 +230,7 @@ private function validateEmailSettingsForm()
'mail_frequency' => $this->formData['mail_frequency'],
'mail_day' => $this->formData['mail_day'],
'mail_recipients' => $this->formData['mail_recipients'],
'borders' => $this->formData['borders'],
], [
'mail_template' => ['required', 'string',],
'mail_subject' => ['required', 'string',],
@ -234,6 +239,7 @@ private function validateEmailSettingsForm()
'mail_recipients' => ['required', 'array', 'min:1'],
'mail_recipients.*.name' => ['required', 'string', 'max:255'],
'mail_recipients.*.email' => ['required', 'email'],
'borders' => ['required', 'boolean'],
])->validateWithBag('saveEmailSettingsForm');
}

View file

@ -37,7 +37,8 @@ class Project extends Model
'pivot_json_path',
'span_json_path',
'harvest_json_path',
'min_harvest_date'
'min_harvest_date',
'borders',
];
public static function saveWithFormData(mixed $formData)
@ -46,6 +47,7 @@ public static function saveWithFormData(mixed $formData)
/**
* @var Project $project
*/
logger($formData);
$project = Project::updateOrCreate($uniqueIdentifier, $formData);
$baseFrom = 'livewire-tmp/';
$baseTo = $project->download_path.'/Data/';

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('projects', function (Blueprint $table) {
$table->addColumn('boolean', 'borders')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('projects', function (Blueprint $table) {
$table->dropColumn('borders');
});
}
};

View file

@ -165,6 +165,19 @@
<span class="bg-red-100 text-red-400 p-1 rounded">{{ $message }}</span>
@enderror
</div>
<div class="flex justify-between my-4">
<div class="inline-flex items-center gap-2">
<div class=" text-md font-bold">
{{ __('Show borders in report') }}
</div>
</div>
<label class="inline-flex items-center cursor-pointer gap-4" x-data="{showBorders: $wire.entangle('formData.borders')}">
<input type="checkbox" class="sr-only peer" x-init="$el.checked = @js($formData['borders'])"
@click="showBorders = $el.checked">
<div
class="relative w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 dark:peer-focus:ring-indigo-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-indigo-600"></div>
</label>
</div>
</form>
</div>
</div>