visible fields for fileschema
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
@php
|
||||
|
||||
@endphp
|
||||
|
||||
<div class="table mt-5 ">
|
||||
<table>
|
||||
<thead>
|
||||
@@ -11,6 +7,7 @@
|
||||
<x-lucent::checkbox value=""></x-lucent::checkbox>
|
||||
</th>
|
||||
@endif
|
||||
|
||||
@foreach($schema->visible as $visibleColumn)
|
||||
@php
|
||||
$schemaField = $schema->fields->firstWhere("name", $visibleColumn);
|
||||
|
||||
@@ -20,6 +20,7 @@ class GenerateFileSchema extends Command
|
||||
$schema = new FilesSchema(
|
||||
name: $name,
|
||||
label: $name,
|
||||
visible: [],
|
||||
fields: Collection::make(),
|
||||
disk: "lucent",
|
||||
path: $name,
|
||||
|
||||
@@ -16,6 +16,7 @@ use Lucent\Record\Manager;
|
||||
use Lucent\Record\QueryRecord;
|
||||
use Lucent\Record\RecordService;
|
||||
use Lucent\Record\Status;
|
||||
use Lucent\Schema\SchemaService;
|
||||
use Lucent\Schema\System;
|
||||
use Lucent\Schema\Validator\ValidatorException;
|
||||
use Lucent\Svelte\Svelte;
|
||||
@@ -26,6 +27,7 @@ class RecordController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly RecordService $recordService,
|
||||
private readonly SchemaService $schemaService,
|
||||
private readonly AccountService $accountService,
|
||||
private readonly ChannelService $channelService,
|
||||
private readonly Svelte $svelte,
|
||||
@@ -79,15 +81,13 @@ class RecordController extends Controller
|
||||
->runWithCount();
|
||||
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
"schemas" => $this->channelService->channel->schemas,
|
||||
"schema" => $schema,
|
||||
"users" => $users,
|
||||
"records" => $graph->tree(),
|
||||
"graph" => toArray($graph),
|
||||
"visibleFields" => array_values(System::list()),
|
||||
"visibleFields" => $this->schemaService->getVisibleFields($schema),
|
||||
"systemFields" => array_values(System::list()),
|
||||
"operators" => $this->operatorRegistry->all(),
|
||||
"sortParam" => $sort,
|
||||
|
||||
@@ -30,4 +30,6 @@ class CollectionSchema implements Schema
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class FilesSchema implements Schema
|
||||
function __construct(
|
||||
public string $name,
|
||||
public string $label,
|
||||
public array $visible,
|
||||
public Collection $fields,
|
||||
public string $disk,
|
||||
public string $path,
|
||||
|
||||
@@ -35,6 +35,7 @@ class SchemaService
|
||||
"files" => new FilesSchema(
|
||||
name: $schemaArr["name"],
|
||||
label: $schemaArr["label"],
|
||||
visible: $schemaArr["visible"] ?? [],
|
||||
fields: (new Collection($schemaArr["fields"]))->map([$this, 'mapFields']),
|
||||
disk: $schemaArr["disk"] ?? "lucent",
|
||||
path: $schemaArr["path"] ?? $schemaArr["name"],
|
||||
@@ -82,4 +83,8 @@ class SchemaService
|
||||
return new $ui(...$field);
|
||||
}
|
||||
|
||||
|
||||
public function getVisibleFields(Schema $schema):array{
|
||||
return $schema->fields->whereIn("name",$schema->visible)->filter()->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user