2026-01-09 16:54:42 +02:00
|
|
|
<script>
|
|
|
|
|
import ChannelLayout from "../../layouts/ChannelLayout.svelte";
|
|
|
|
|
import { onMount } from "svelte";
|
2026-01-09 19:19:43 +02:00
|
|
|
|
2026-01-09 16:54:42 +02:00
|
|
|
import LocaleChooser from "./LocaleChooser.svelte";
|
2026-01-09 19:19:43 +02:00
|
|
|
import RecordForm from "./RecordForm.svelte";
|
2026-01-09 19:08:00 +02:00
|
|
|
import RecordStatus from "./RecordStatus.svelte";
|
|
|
|
|
import PublishingOptions from "./PublishingOptions.svelte";
|
2026-01-09 16:54:42 +02:00
|
|
|
import { getSelectedLocales } from "./locale.svelte.js";
|
|
|
|
|
let { channel, user, data } = $props();
|
|
|
|
|
let selectedLocales = $state(getSelectedLocales());
|
|
|
|
|
let record = $state(data.record);
|
2026-01-09 19:19:43 +02:00
|
|
|
let showPublished = $state(false);
|
2026-01-09 16:54:42 +02:00
|
|
|
|
|
|
|
|
function handleLocaleChange() {
|
|
|
|
|
selectedLocales = getSelectedLocales();
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<!-- <svelte:window on:beforeunload={beforeUnload} /> -->
|
|
|
|
|
<ChannelLayout {body} {channel} schemas={data.schemas} {user}></ChannelLayout>
|
|
|
|
|
{#snippet body()}
|
2026-01-09 19:08:00 +02:00
|
|
|
<RecordStatus {channel} {record} status={data.recordStatus}></RecordStatus>
|
|
|
|
|
<div style="display:flex;gap:20px;justify-content: space-between;">
|
|
|
|
|
<LocaleChooser {channel} onLocaleChange={handleLocaleChange}
|
|
|
|
|
></LocaleChooser>
|
2026-01-09 19:19:43 +02:00
|
|
|
|
|
|
|
|
<label>
|
|
|
|
|
<input bind:checked={showPublished} type="checkbox" role="switch" />
|
|
|
|
|
Show Live Data
|
|
|
|
|
</label>
|
2026-01-09 19:08:00 +02:00
|
|
|
<PublishingOptions {record} status={data.recordStatus}
|
|
|
|
|
></PublishingOptions>
|
|
|
|
|
</div>
|
2026-01-09 19:19:43 +02:00
|
|
|
{#if !showPublished}
|
|
|
|
|
<fieldset disabled={data.recordStatus === "trashed"}>
|
|
|
|
|
<RecordForm
|
|
|
|
|
{channel}
|
|
|
|
|
fields={data.fields}
|
|
|
|
|
{record}
|
|
|
|
|
{selectedLocales}
|
|
|
|
|
validationErrors={data.validationErrors}
|
|
|
|
|
fieldData={data.draftData}
|
|
|
|
|
></RecordForm>
|
|
|
|
|
</fieldset>
|
|
|
|
|
{:else}
|
|
|
|
|
<fieldset disabled={true}>
|
|
|
|
|
<RecordForm
|
|
|
|
|
{channel}
|
|
|
|
|
fields={data.fields}
|
|
|
|
|
{record}
|
|
|
|
|
{selectedLocales}
|
|
|
|
|
validationErrors={data.validationErrors}
|
|
|
|
|
fieldData={data.liveData}
|
|
|
|
|
></RecordForm>
|
|
|
|
|
</fieldset>
|
|
|
|
|
{/if}
|
2026-01-09 16:54:42 +02:00
|
|
|
{/snippet}
|