Files
2026-09-21 10:14:57 +01:00

148 lines
7.5 KiB
PHP
Executable File

@csrf
@if ($document->exists)
@method('PUT')
@endif
<div class="doc-form-grid">
<div class="doc-field">
<label class="doc-label" for="title">Title</label>
<input class="doc-input" id="title" name="title" value="{{ old('title', $document->title) }}" required
maxlength="220">
@error('title')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field">
<label class="doc-label" for="slug">Slug</label>
<input class="doc-input" id="slug" name="slug" value="{{ old('slug', $document->slug) }}"
maxlength="240" placeholder="Auto-generated when blank">
@error('slug')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field">
<label class="doc-label" for="documentation_category_id">Category</label>
<select class="doc-select" id="documentation_category_id" name="documentation_category_id">
<option value="">No category</option>
@foreach ($categories as $category)
<option value="{{ $category->id }}" @selected((string) old('documentation_category_id', $document->documentation_category_id) === (string) $category->id)>{{ $category->name }}</option>
@endforeach
</select>
@error('documentation_category_id')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field">
<label class="doc-label" for="status">Status</label>
<select class="doc-select" id="status" name="status" required>
@foreach ($statuses as $value => $label)
<option value="{{ $value }}" @selected(old('status', $document->status) === $value)>{{ $label }}</option>
@endforeach
</select>
@error('status')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field">
<label class="doc-label" for="version">Version</label>
<input class="doc-input" id="version" name="version"
value="{{ old('version', $document->version ?: '1.0.0') }}" required maxlength="50">
@error('version')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field">
<label class="doc-label" for="reference">Reference</label>
<input class="doc-input" id="reference" name="reference" value="{{ old('reference', $document->reference) }}"
maxlength="100" placeholder="SOP-001, POL-002, etc.">
@error('reference')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field full">
<label class="doc-label" for="summary">Summary</label>
<input class="doc-input" id="summary" name="summary" value="{{ old('summary', $document->summary) }}"
maxlength="500">
@error('summary')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field full">
<label class="doc-label" for="body">Document body</label>
<div class="doc-editor" data-documentation-editor>
<div class="doc-editor-toolbar" aria-label="Markdown editor controls">
<button type="button" data-md-before="## " data-md-after="" title="Heading">H2</button>
<button type="button" data-md-before="**" data-md-after="**" title="Bold"><strong>B</strong></button>
<button type="button" data-md-before="_" data-md-after="_" title="Italic"><em>I</em></button>
<button type="button" data-md-before="> " data-md-after="" title="Quote">Quote</button>
<button type="button" data-md-before="- " data-md-after="" title="Bullet list">List</button>
<button type="button" data-md-before="1. " data-md-after="" title="Numbered list">1.</button>
<button type="button" data-md-before="[" data-md-after="](https://)" title="Link">Link</button>
<button type="button" data-md-before="`" data-md-after="`" title="Inline code">Code</button>
<button type="button" data-md-before="```php&#10;" data-md-after="&#10;```" title="Code block">Code
block</button>
<button type="button" data-md-before="| Column | Column |&#10;| --- | --- |&#10;| Value | Value |"
data-md-after="" title="Table">Table</button>
</div>
<textarea class="doc-textarea" id="body" name="body" data-markdown-textarea>{{ old('body', $document->body) }}</textarea>
<p class="doc-muted editor-help">Markdown is supported, including fenced code blocks such as
<code>```php</code>, tables, lists, links, and headings.
</p>
</div>
@error('body')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field full">
<label class="doc-label" for="attachment">Primary attachment</label>
<input class="doc-input" id="attachment" name="attachment" type="file">
<p class="doc-muted">Primary Markdown files can be imported into the document body when the body is blank.</p>
@if ($document->attachment_name)
<p class="doc-muted">Current primary file: <a class="doc-link"
href="{{ route('documentation.documents.download', $document) }}">{{ $document->attachment_name }}</a>
</p>
<label><input type="checkbox" name="remove_attachment" value="1"> Remove current primary
attachment</label>
@endif
@error('attachment')
<div class="doc-error">{{ $message }}</div>
@enderror
</div>
<div class="doc-field full">
<label class="doc-label" for="attachments">Additional attachments</label>
<input class="doc-input" id="attachments" name="attachments[]" type="file" multiple>
<p class="doc-muted">Attach supporting files such as PDFs, screenshots, spreadsheets, Word documents, Markdown,
CSV, and images.</p>
@error('attachments')
<div class="doc-error">{{ $message }}</div>
@enderror
@error('attachments.*')
<div class="doc-error">{{ $message }}</div>
@enderror
@if ($document->exists && $document->attachments->isNotEmpty())
<div class="doc-attachment-list" style="margin-top: 14px;">
@foreach ($document->attachments as $attachment)
<div class="doc-attachment-item">
<div>
<a class="doc-link"
href="{{ route('documentation.documents.attachments.download', [$document, $attachment]) }}">{{ $attachment->original_name }}</a>
<span class="doc-muted">{{ $attachment->size_label }}</span>
</div>
<button class="doc-button danger" type="submit"
form="delete-attachment-{{ $attachment->id }}">Remove</button>
</div>
@endforeach
</div>
@endif
</div>
<div class="doc-field full">
<label><input type="checkbox" name="is_featured" value="1" @checked(old('is_featured', $document->is_featured))> Feature this
document on the dashboard</label>
</div>
</div>
<div class="doc-actions" style="margin-top:22px;">
<button class="doc-button success" type="submit">Save document</button>
<a class="doc-button warning" href="{{ route('documentation.documents.index') }}">Cancel</a>
</div>