wip content index

This commit is contained in:
2024-10-01 22:31:07 +03:00
parent 39e7a3aed4
commit fa388ea302
21 changed files with 356 additions and 22 deletions
+2 -2
View File
@@ -28,7 +28,7 @@
return strtoupper($segs[0][0]).strtoupper($segs[0][1]);
};
$name = $user["name"];
$name = (string)data_get($user,"name");
$charIndex = ord($name[1]) + strlen($name);
$colorIndex = $charIndex % 19;
$bgColor = $colors[$colorIndex];
@@ -39,5 +39,5 @@
title="{{$name}}"
style="background-color:{{$bgColor}};height: {{$side}}px;width: {{$side}}px; font-size:{{$side / 2}}px"
>
<div class="avatar__letters">{{$initials($user["name"])}}</div>
<div class="avatar__letters">{{$initials($name)}}</div>
</div>
@@ -0,0 +1,3 @@
<div class="checkbox-wrapper">
<input id="c1-13" type="checkbox" value="{{$value}}" {{$indeterminate ?? false ? "indeterminate" : ""}} {{$checked ?? false ? "checked" : ""}} />
</div>
@@ -0,0 +1,42 @@
<dialog id="dialog-{{$schema->name}}">
@if($schema)
<div class="dialog-header">
<button
type="button"
class="button"
disabled
>
Insert
</button>
<button
type="button"
class="button"
disabled
>
Replace
</button>
<div class="hide">
<span class="number-of-records-selected"></span> records selected
</div>
<button
type="button"
class="button close"
aria-label="Close"
>
<x-lucent::icon icon="close">
</x-lucent::icon>
</button>
</div>
<div class="dialog-body">
@include("lucent::records.index")
</div>
@endif
</dialog>
@@ -18,5 +18,6 @@
@include("lucent::records-editor.fields", ["field" => $field])
@endforeach
</div>
@endsection
@@ -1,16 +1,31 @@
@php
$references = $graph->edges
->filter(fn($edge) => $edge->field === $field->name && $edge->source === $record->id)
->map(fn($edge) => $graph->records->firstWhere("id", $edge->target));
$references = $graph->edges
->filter(fn($edge) => $edge->field === $field->name && $edge->source === $record->id)
->map(fn($edge) => $graph->records->firstWhere("id", $edge->target));
$collectionSchemas = $schemas->whereIn("name",$field->collections);
@endphp
@if ($references->isNotEmpty())
{{--<Sortable sortableClass="mt-3" on:update={reorder}>--}}
@foreach($references as $reference)
<!--This div helps the sorting thing-->
<div>
@include("lucent::records-editor.fields.file.preview")
</div>
@endforeach
<!--</Sortable>-->
@if(count($field->collections) === 1)
<button class="button" data-open-modal="{{$field->collections[0]}}">Browse</button>
@else
<x-lucent::dropdown>
Browse
<x-slot:items>
@foreach($collectionSchemas as $collectionSchema)
<a class="dropdown-item" data-open-modal="{{$collectionSchema->name}}" href="/">{{$collectionSchema->label}}</a>
@endforeach
</x-slot:items>
</x-lucent::dropdown>
@endif
@if ($references->isNotEmpty())
<div class="sortable-container mt-3">
@foreach($references as $reference)
<!--This div helps the sorting thing-->
<div>
@include("lucent::records-editor.fields.file.preview", ["record" => $reference])
</div>
@endforeach
</div>
@endif
@@ -1,16 +1,17 @@
@php
$schema = $channel->schemas->firstWhere("name",$reference->schema);
$reference = $record;
$schema = $channel->schemas->firstWhere("name",$record->schema);
@endphp
<div class="preview-file">
<div style="display: flex;align-items: center;gap: 10px;">
<div class="image">
@include("lucent::records-editor.fields.file.thumb", ["size" => "small", "record" => $reference])
@include("lucent::records-editor.fields.file.thumb", ["size" => "small"])
</div>
<div class="title">
<div>
<a class="record-title" href="{{lucent_url("records")}}/{{$record->id}}">
{{$viewModel->getRecordName($reference)}}
{{$viewModel->getRecordName($record)}}
</a>
<small class="d-block">
from {{$schema->label}}
+36
View File
@@ -0,0 +1,36 @@
<div class="">
<div class="{{$inModal ? 'mt-0' : 'mt-5'}}">
<h3 class="header-normal mb-5 ">
{{$schema->label}}
</h3>
{{-- {#if selected.length > 0 && !inModal && isWritable}--}}
{{-- <ActionsOnSelected {schema} {selected} {filter}/>--}}
{{-- {:else}--}}
{{-- <Tools--}}
{{-- bind:schema--}}
{{-- bind:records--}}
{{-- {systemFields}--}}
{{-- {sortParam}--}}
{{-- {sortField}--}}
{{-- {operators}--}}
{{-- {filter}--}}
{{-- {graph}--}}
{{-- {inModal}--}}
{{-- {modalUrl}--}}
{{-- {isWritable}--}}
{{-- on:refresh={refresh}--}}
{{-- />--}}
{{-- {/if}--}}
@include("lucent::records.table")
</div>
{{-- <Pagination--}}
{{-- {limit}--}}
{{-- {skip}--}}
{{-- {total}--}}
{{-- on:refresh={refresh}--}}
{{-- {inModal}--}}
{{-- {modalUrl}--}}
{{-- />--}}
</div>
+7
View File
@@ -0,0 +1,7 @@
@extends("lucent::layouts.channel")
@section("content")
@include("lucent::records.index")
@endsection
+14
View File
@@ -0,0 +1,14 @@
@foreach($schema->visible as $visibleColumn)
@php
$schemaField = $schema->fields->firstWhere("name", $visibleColumn);
@endphp
<td class="field-ui-{{$schemaField->info->name ?? $visibleColumn}} {{$visibleColumn === $sortField->name ? "is-sort" : ""}}">
@if(in_array($visibleColumn ,["_sys.createdBy","_sys.updatedBy"]))
<x-lucent::avatar side="24" :user="$users->firstWhere('id',$record->_sys->createdBy)"></x-lucent::avatar>
@elseif($visibleColumn === "_sys.status")
@include("lucent::records-editor.status",[ "status" => $record->status])
@else
{!! $viewModel->renderRow($record,$schemaField)!!}
@endif
</td>
@endforeach
+91
View File
@@ -0,0 +1,91 @@
@php
@endphp
<div class="table mt-5 ">
<table>
<thead>
<tr>
@if($isWritable)
<th>
<x-lucent::checkbox value=""></x-lucent::checkbox>
</th>
@endif
@foreach($schema->visible as $visibleColumn)
@php
$schemaField = $schema->fields->firstWhere("name", $visibleColumn);
if(empty($schemaField)){
$schemaField = collect($systemFields)->firstWhere("name", str_replace("_sys.", "",$visibleColumn) );
}
@endphp
<th
class="field-ui-{{$schemaField->info->name ?? $schemaField->ui}} {{$schemaField->name === $sortField->name ? "is-sort" : ""}}"
scope="col"
title={{$schemaField->help ?? ""}}
>{{$schemaField->label}}</th
>
@endforeach
<th></th>
</tr>
</thead>
<tbody>
@foreach($records as $record)
<tr>
<td class="title-td">
<div
class="title-td-contents"
>
@if($isWritable)
<x-lucent::checkbox :value="$record->id"></x-lucent::checkbox>
@endif
@if($record->_file?->path)
<div class="file-table-row">
@include("lucent::records-editor.fields.file.thumb", ["size" => "small"])
<div>
@if($record->status === "draft")
<span style="text-transform: uppercase;font-size:10px">{{$record->status}}</span>
@endif
<a
href="{{lucent_url("records")}}/{{$record->id}}"
target={{$inModal ? "_blank" : "_self"}}
>
{{ $viewModel->getRecordName($record)}}
</a>
<span>{{ (int)($record->_file->size / 1024) }}kB</span>
@if($record->_file->width > 0)
<span>{{$record->_file->width . "x" . $record->_file->height}}</span>
@endif
<a
href="{{lucent_file($record)}}"
target="_blank"
>
Download
</a>
</div>
</div>
@else
<a
href="{{lucent_url("records")}}/{{$record->id}}"
target={{$inModal ? "_blank" : "_self"}}
>
@if($record->status === "draft")
<span style="text-transform: uppercase;font-size:10px">{{$record->status}}</span>
@endif
{{$viewModel->getRecordName($record)}}
</a>
@endif
</div>
</td>
@include("lucent::records.row")
<td>
<x-lucent::avatar side="24"
:user="$users->firstWhere('id',$record->_sys->createdBy)"></x-lucent::avatar>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>