prepare physical sample component

This commit is contained in:
isUnknown 2024-12-11 14:37:06 +01:00
parent d7e2a58448
commit 30876abff3
24 changed files with 180 additions and 37 deletions

View file

@ -17,7 +17,7 @@ class ProjectPage extends Page {
$files = [];
$uri = null;
if (str_contains($child->stepName()->value(), 'Brief')) {
if (str_contains($child->stepName()->value(), 'Brief') || $child->stepName()->value() === "industrialIdeation") {
$this->handleBriefStep($child, $files, $uri);
}
@ -28,6 +28,10 @@ class ProjectPage extends Page {
if ($child->stepName() == 'virtualSample') {
$this->handleVirtualSampleStep($child, $files, $uri);
}
if ($child->stepName() == 'physicalSample') {
$this->handlePhysicalSampleStep($child, $files, $uri);
}
return [
'label' => $child->title()->value(),
@ -36,6 +40,8 @@ class ProjectPage extends Page {
'index' => intval($child->stepIndex()->value()),
'modified' => $child->modified('Y-MM-dd'),
'isValidated' => $child->isValidated() == 'true' ? true : false,
'description' => $child->description()->isNotempty() ? $child->description()->value() : null,
'cover' => $child->cover()->isNotempty() ? $child->cover()->toFile()->url() : null,
'uri' => $uri,
'files' => $files,
];
@ -98,6 +104,16 @@ class ProjectPage extends Page {
$files['static']['finishedGlass'] = getFileData($child->finishedGlass()->toFile());
}
}
private function handlePhysicalSampleStep($child, &$files, &$uri) {
$uri = $child->parent()->uri() . '?dialog=' . $child->slug();
if ($child->media()->isNotEmpty()) {
foreach ($child->media()->toFiles() as $file) {
$files[] = getFileData($file);
}
}
}
public function getStepLabel() {
$stepsLabel = [