51 lines
1.4 KiB
Svelte
51 lines
1.4 KiB
Svelte
<script lang="ts">
|
|
import { enhance } from '$app/forms';
|
|
import { resolve } from '$app/paths';
|
|
import ActionStatus from '#lib/components/ActionStatus.svelte';
|
|
import ProjectFields from '#lib/components/ProjectFields.svelte';
|
|
import StableText from '#lib/components/StableText.svelte';
|
|
import type { PageProps } from './$types';
|
|
|
|
let { form }: PageProps = $props();
|
|
let saving = $state(false);
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<title>Add project | SharePoint to ACC sync</title>
|
|
</svelte:head>
|
|
|
|
<div class="page">
|
|
<div class="section">
|
|
<a class="small" href={resolve('/admin')}>Back to projects</a>
|
|
<h1>Add project</h1>
|
|
<p class="muted">
|
|
Pick the SharePoint folder to copy from and the ACC folder to copy into. The first sync starts
|
|
within a few minutes, or right away with Run now.
|
|
</p>
|
|
</div>
|
|
|
|
<form
|
|
method="POST"
|
|
class="form"
|
|
use:enhance={() => {
|
|
saving = true;
|
|
return async ({ update }) => {
|
|
await update({ reset: false });
|
|
saving = false;
|
|
};
|
|
}}
|
|
>
|
|
<ProjectFields values={form?.values ?? {}} />
|
|
<div class="actions">
|
|
<button class="button primary" disabled={saving}>
|
|
<StableText
|
|
text={saving ? 'Checking folders…' : 'Add project'}
|
|
options={['Checking folders…', 'Add project']}
|
|
/>
|
|
</button>
|
|
<a class="button" href={resolve('/admin')}>Cancel</a>
|
|
<ActionStatus status={form?.error ? { tone: 'danger', text: form.error } : null} />
|
|
</div>
|
|
</form>
|
|
</div>
|