2024-08-22 10:13:16 +02:00
|
|
|
{{ define "page:content" }}
|
|
|
|
|
|
|
|
{{ $fields_present := false }}
|
|
|
|
{{ if (gt (len (index .item.FieldsSection "fields")) 0) }}
|
|
|
|
{{ $fields_present = true }}
|
|
|
|
{{ end }}
|
|
|
|
|
2024-10-20 20:25:59 +02:00
|
|
|
<form method="POST" hx-post="{{.formAction}}" hx-target="{{.formTarget}}">
|
|
|
|
<div class="page-container">
|
|
|
|
<div class="tab-bar">
|
|
|
|
<a class="active tab-button" onclick="bm_open_tab(this, 'tab-button', 'tab', 'general')">General</a>
|
2024-08-22 10:13:16 +02:00
|
|
|
{{ if $fields_present }}
|
2024-10-20 20:25:59 +02:00
|
|
|
<a class="tab-button" onclick="bm_open_tab(this, 'tab-button', 'tab', 'fields')">Fields</a>
|
2024-08-22 10:13:16 +02:00
|
|
|
{{ end }}
|
2024-10-20 20:25:59 +02:00
|
|
|
<a class="tab-button" onclick="bm_open_tab(this, 'tab-button', 'tab', 'relationsSection')">Relations</a>
|
2024-08-22 10:13:16 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="general" class="tab" style="display: block">
|
|
|
|
<div class="w3-row">
|
|
|
|
<div class="w3-half">
|
|
|
|
<p>
|
|
|
|
<label for="item-title">Title</label>
|
2024-10-20 20:25:59 +02:00
|
|
|
<input name="Title" id="item-title" type="text" value="{{.item.Title}}" />
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
<p>
|
2024-10-17 18:53:03 +02:00
|
|
|
{{ widget_select "Type_id" "Type" .item.Type_id .types `style="width: 100%"` }}
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="w3-half">
|
|
|
|
<p>
|
2024-10-17 18:53:03 +02:00
|
|
|
{{ widget_checkboxes "Notebooks" "Notebooks" .item.Notebooks .notebooks `` }}
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="fields-general">
|
|
|
|
{{ template "items:fields" (map "FieldsSection" .item.FieldsSection "FieldsValues" .item.FieldsValues "uisection" "general")}}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{ if eq .item.Type_show_summary 1}}
|
|
|
|
<p>
|
|
|
|
<label for="item-summary">Summary</label>
|
2024-10-17 18:53:03 +02:00
|
|
|
<textarea name="Summary" id="item-summary" type="text" rows="5">{{.item.Summary}}</textarea>
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ if eq .item.Type_show_description 1}}
|
|
|
|
<p>
|
|
|
|
<label for="item-description">Description</label>
|
2024-10-20 20:25:59 +02:00
|
|
|
<textarea name="Description" class="w3-input w3-border" id="item-description" rows="10">{{.item.Description}}</textarea>
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
{{ end }}
|
|
|
|
<div class="w3-row">
|
|
|
|
<div class="w3-half">
|
|
|
|
<p>
|
|
|
|
<label for="item-tags">Tags</label>
|
2024-10-20 20:25:59 +02:00
|
|
|
<input name="Tags" id="item-tags" type="text" value="{{.item.Tags}}" />
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="w3-half">
|
|
|
|
<p>
|
2024-10-17 18:53:03 +02:00
|
|
|
{{ widget_slim_select "Categories" "Categories" .item.Categories .categories `multiple="true"` }}
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p>
|
2024-10-20 20:25:59 +02:00
|
|
|
<label class="switch">
|
2024-10-17 18:53:03 +02:00
|
|
|
<input id="on_dashboard" name="On_dashboard" type="checkbox" value="1" {{if eq .item.On_dashboard 1}} checked="checked" {{end}} />
|
2024-10-20 20:25:59 +02:00
|
|
|
<span class="slider round"></span>
|
2024-10-17 18:53:03 +02:00
|
|
|
</label>
|
2024-10-20 20:25:59 +02:00
|
|
|
<label for="on_dashboard" class="label-checkbox">On dashboard</label>
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{ if $fields_present }}
|
2024-10-25 18:08:01 +02:00
|
|
|
<div class="tab" id="fields" style="display: none">
|
2024-08-22 10:13:16 +02:00
|
|
|
<div id="fields-fields">
|
|
|
|
{{ template "items:fields" (map "FieldsSection" .item.FieldsSection "FieldsValues" .item.FieldsValues "uisection" "fields")}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
|
2024-10-25 18:08:01 +02:00
|
|
|
<div class="tab" id="relationsSection" style="display: none">
|
2024-08-22 10:13:16 +02:00
|
|
|
<fieldset class="w3-round-medium" style="margin-top: 10px;">
|
|
|
|
<legend>Related items</legend>
|
|
|
|
<div id="relations" style="margin-top: 8px;">
|
|
|
|
{{ template "item:relations" . }}
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
<fieldset class="w3-round-medium" style="margin-top: 8px;">
|
|
|
|
<legend>Add items</legend>
|
|
|
|
<div class="w3-row">
|
|
|
|
<div class="w3-col l6 m9 s10">
|
2024-10-20 20:25:59 +02:00
|
|
|
<input id="search-item-relation" name="SearchText" type="text" value="" placeholder="Search" hx-get="/items/search-for-relations/{{.item.Id}}" hx-trigger="search-item-relation, keyup changed delay:1s" hx-vals="js:{SearchText: document.getElementById('search-item-relation').value}" hx-target="#items-list-for-relations"
|
2024-08-22 10:13:16 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="w3-col l6 m3 s1" style="padding-left: 10px;">
|
2024-11-10 20:52:32 +01:00
|
|
|
<a class="button w3-metro-blue" hx-vals="js:{SearchText: document.getElementById('search-item-relation').value}" hx-target="#items-list-for-relations" hx-get="/items/search-for-relations/{{.item.Id}}"><i class="bi bi-search"></i><span class="hide-small"> Find</span></a>
|
2024-08-22 10:13:16 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="items-list-for-relations" style="margin-top:10px">
|
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-11-10 20:52:32 +01:00
|
|
|
<p class="hide-small w3-container">
|
2024-10-20 20:25:59 +02:00
|
|
|
<button class="w3-metro-dark-blue">
|
2024-08-22 10:13:16 +02:00
|
|
|
<i class="bi bi-floppy"></i> Save
|
|
|
|
</button>
|
|
|
|
{{ if not (eq .item.Id 0) }}
|
2024-10-20 20:25:59 +02:00
|
|
|
<a class="button w3-metro-blue" href="/item/read/{{.item.Id}}" hx-get="/item/read/{{.item.Id}}" hx-push-url="true" hx-target="#page-content"><i class="bi bi-binoculars"></i> View</a>
|
|
|
|
<a class="button w3-metro-blue w3-delete" hx-delete="/item/delete/{{.item.Id}}" hx-target="#page-content" hx-trigger="confirmed" onClick="bm_show_confirm(this, 'Items', 'Delete this item ?')"><i class="bi bi-trash"></i> Delete</a>
|
|
|
|
<a class="button w3-metro-blue" href="#" hx-target="#modal-container" hx-get="/item/share/{{.item.Id}}" title="Share"><i class="bi bi-share-fill"></i> Share</a>
|
2024-08-22 10:13:16 +02:00
|
|
|
{{ end }}
|
2024-10-20 20:25:59 +02:00
|
|
|
<a class="button w3-metro-blue" hx-target="#page-content" hx-push-url="true" hx-get="/items/type/{{.item.Type_id}}"><i class="bi bi-arrow-left-circle"></i> Back</a>
|
2024-08-22 10:13:16 +02:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="footerNavbar-container">
|
2024-11-10 20:52:32 +01:00
|
|
|
<div class="w3-bar footerNavbar hide-medium hide-large">
|
2024-08-22 10:13:16 +02:00
|
|
|
<div class="w3-bar-item">
|
2024-10-20 20:25:59 +02:00
|
|
|
<button type="submit" class="w3-metro-dark-blue" title="Save">
|
2024-08-22 10:13:16 +02:00
|
|
|
<i class="bi bi-floppy"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{{ if not (eq .item.Id 0) }}
|
|
|
|
<div class="w3-bar-item">
|
2024-10-20 20:25:59 +02:00
|
|
|
<a class="button w3-metro-dark-blue w3-delete" hx-delete="/item/delete/{{.item.Id}}" hx-target="#page-content" hx-trigger="confirmed" onClick="bm_show_confirm(this, 'Items', 'Delete this item ?')" title="Delete"><i class="bi bi-trash"></i>
|
2024-08-22 10:13:16 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="w3-bar-item">
|
2024-10-20 20:25:59 +02:00
|
|
|
<a class="button w3-metro-dark-blue" href="#" hx-target="#modal-container" hx-get="/item/share/{{.item.Id}}" title="Share"><i class="bi bi-share-fill"></i></a>
|
2024-08-22 10:13:16 +02:00
|
|
|
</div>
|
|
|
|
<div class="w3-bar-item">
|
2024-10-20 20:25:59 +02:00
|
|
|
<a class="button w3-metro-dark-blue" href="/item/read/{{.item.Id}}" hx-get="/item/read/{{.item.Id}}" hx-push-url="true" hx-target="#page-content" title="View"><i class="bi bi-binoculars"></i>
|
2024-08-22 10:13:16 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
{{ end }}
|