You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

294 lines
13KB

  1. {{define "build_new"}}
  2. <!doctype html>
  3. <html lang="en">
  4. <head>
  5. <title>{{.Title}}</title>
  6. {{template "head" .}}
  7. </head>
  8. <body>
  9. {{template "nav" .}}
  10. {{if .Msg}}<div class="flash flash-ok">{{.Msg}}</div>{{end}}
  11. {{if .Err}}<div class="flash flash-err">{{.Err}}</div>{{end}}
  12. <h1>New Build</h1>
  13. <form method="get" action="/builds/new">
  14. {{if .ShowDebug}}<input type="hidden" name="debug" value="1">{{end}}
  15. <label for="draft_id">Draft laden</label>
  16. <select id="draft_id" name="draft_id">
  17. <option value="">Kein Draft</option>
  18. {{range .Drafts}}
  19. <option value="{{.ID}}" {{if eq $.SelectedDraftID .ID}}selected{{end}}>{{.RequestName}} | {{.Status}} | {{.Source}} ({{.TemplateID}})</option>
  20. {{end}}
  21. </select>
  22. <button type="submit">Draft laden</button>
  23. </form>
  24. <form method="get" action="/builds/new">
  25. {{if .ShowDebug}}<input type="hidden" name="debug" value="1">{{end}}
  26. {{if .SelectedDraftID}}<input type="hidden" name="draft_id" value="{{.SelectedDraftID}}">{{end}}
  27. <label for="template_id">Template</label>
  28. <select id="template_id" name="template_id">
  29. <option value="">Select template</option>
  30. {{range .Templates}}
  31. <option value="{{.ID}}" {{if eq $.SelectedTemplateID .ID}}selected{{end}}>{{.Name}} ({{.ID}})</option>
  32. {{end}}
  33. </select>
  34. <button type="submit">Load Fields</button>
  35. </form>
  36. {{if gt .SelectedTemplateID 0}}
  37. <form method="post" action="/builds">
  38. <input type="hidden" name="draft_id" value="{{.Form.DraftID}}">
  39. <input type="hidden" name="template_id" value="{{.SelectedTemplateID}}">
  40. <input type="hidden" name="manifest_id" value="{{.SelectedManifestID}}">
  41. <input type="hidden" name="field_count" value="{{len .EditableFields}}">
  42. <input type="hidden" name="suggestion_state_json" value="{{.SuggestionStateJSON}}">
  43. <h2>Global Data</h2>
  44. <div class="grid2">
  45. <div><label>Draft Source<input type="text" name="draft_source" value="{{.Form.DraftSource}}" placeholder="ui"></label></div>
  46. <div>
  47. <label>Draft Status
  48. <select name="draft_status">
  49. <option value="draft" {{if eq .Form.DraftStatus "draft"}}selected{{end}}>draft</option>
  50. <option value="reviewed" {{if eq .Form.DraftStatus "reviewed"}}selected{{end}}>reviewed</option>
  51. <option value="submitted" {{if eq .Form.DraftStatus "submitted"}}selected{{end}}>submitted</option>
  52. </select>
  53. </label>
  54. </div>
  55. </div>
  56. <div><label>Request Name<input type="text" name="request_name" value="{{.Form.RequestName}}"></label></div>
  57. <div><label>Draft Notes<textarea name="draft_notes">{{.Form.DraftNotes}}</textarea></label></div>
  58. <h3>Basis / Firma</h3>
  59. <div class="grid2">
  60. <div><label>Firmenname*<input type="text" name="company_name" value="{{.Form.CompanyName}}" required></label></div>
  61. <div><label>Benutzername*<input type="text" name="username" value="{{.Form.Username}}" required></label></div>
  62. <div><label>Branche / Business Type<input type="text" name="business_type" value="{{.Form.BusinessType}}"></label></div>
  63. <div><label>Website-Sprache<input type="text" name="site_language" value="{{.Form.SiteLanguage}}"></label></div>
  64. </div>
  65. <h3>Intake / Website-Kontext</h3>
  66. <div class="grid2">
  67. <div><label>Website URL<input type="url" name="website_url" value="{{.Form.WebsiteURL}}" placeholder="https://example.com"></label></div>
  68. <div>
  69. <label>Locale Style
  70. <select name="locale_style">
  71. <option value="">Bitte waehlen</option>
  72. <option value="de-CH" {{if eq .Form.LocaleStyle "de-CH"}}selected{{end}}>de-CH</option>
  73. <option value="de-DE" {{if eq .Form.LocaleStyle "de-DE"}}selected{{end}}>de-DE</option>
  74. <option value="de-AT" {{if eq .Form.LocaleStyle "de-AT"}}selected{{end}}>de-AT</option>
  75. </select>
  76. </label>
  77. </div>
  78. <div>
  79. <label>Market Style
  80. <select name="market_style">
  81. <option value="">Bitte waehlen</option>
  82. <option value="DACH" {{if eq .Form.MarketStyle "DACH"}}selected{{end}}>DACH</option>
  83. <option value="Schweiz" {{if eq .Form.MarketStyle "Schweiz"}}selected{{end}}>Schweiz</option>
  84. <option value="Deutschland" {{if eq .Form.MarketStyle "Deutschland"}}selected{{end}}>Deutschland</option>
  85. <option value="Oesterreich" {{if eq .Form.MarketStyle "Oesterreich"}}selected{{end}}>Oesterreich</option>
  86. </select>
  87. </label>
  88. </div>
  89. <div>
  90. <label>Address Mode
  91. <select name="address_mode">
  92. <option value="">Bitte waehlen</option>
  93. <option value="du" {{if eq .Form.AddressMode "du"}}selected{{end}}>du</option>
  94. <option value="sie" {{if eq .Form.AddressMode "sie"}}selected{{end}}>sie</option>
  95. </select>
  96. </label>
  97. </div>
  98. <div>
  99. <label>Content Tone
  100. <select name="content_tone">
  101. <option value="">Bitte waehlen</option>
  102. <option value="sachlich" {{if eq .Form.ContentTone "sachlich"}}selected{{end}}>sachlich</option>
  103. <option value="freundlich" {{if eq .Form.ContentTone "freundlich"}}selected{{end}}>freundlich</option>
  104. <option value="modern" {{if eq .Form.ContentTone "modern"}}selected{{end}}>modern</option>
  105. <option value="professionell" {{if eq .Form.ContentTone "professionell"}}selected{{end}}>professionell</option>
  106. <option value="locker" {{if eq .Form.ContentTone "locker"}}selected{{end}}>locker</option>
  107. <option value="premium" {{if eq .Form.ContentTone "premium"}}selected{{end}}>premium</option>
  108. </select>
  109. </label>
  110. </div>
  111. </div>
  112. <div><label>Website Summary<textarea name="website_summary">{{.Form.WebsiteSummary}}</textarea></label></div>
  113. <p><small>Prompt-/Systemsteuerung wird global unter <a href="/settings">Settings</a> gepflegt.</small></p>
  114. <h3>Kontakt</h3>
  115. <div class="grid2">
  116. <div><label>E-Mail*<input type="email" name="email" value="{{.Form.Email}}" required></label></div>
  117. <div><label>Telefon<input type="text" name="phone" value="{{.Form.Phone}}"></label></div>
  118. </div>
  119. <h3>Firmeninformation</h3>
  120. <div class="grid2">
  121. <div><label>Organisationsnummer<input type="text" name="org_number" value="{{.Form.OrgNumber}}"></label></div>
  122. <div><label>Startdatum<input type="text" name="start_date" value="{{.Form.StartDate}}" placeholder="YYYY-MM-DD"></label></div>
  123. <div><label>Mission<textarea name="mission">{{.Form.Mission}}</textarea></label></div>
  124. <div><label>Kurzbeschreibung<textarea name="description_short">{{.Form.DescriptionShort}}</textarea></label></div>
  125. </div>
  126. <div><label>Langbeschreibung<textarea name="description_long">{{.Form.DescriptionLong}}</textarea></label></div>
  127. <h3>Adresse</h3>
  128. <div class="grid2">
  129. <div><label>Adresszeile 1<input type="text" name="address_line1" value="{{.Form.AddressLine1}}"></label></div>
  130. <div><label>Adresszeile 2<input type="text" name="address_line2" value="{{.Form.AddressLine2}}"></label></div>
  131. <div><label>Stadt<input type="text" name="address_city" value="{{.Form.AddressCity}}"></label></div>
  132. <div><label>Region / Bundesland<input type="text" name="address_region" value="{{.Form.AddressRegion}}"></label></div>
  133. <div><label>PLZ<input type="text" name="address_zip" value="{{.Form.AddressZIP}}"></label></div>
  134. <div><label>Land<input type="text" name="address_country" value="{{.Form.AddressCountry}}"></label></div>
  135. </div>
  136. <h2>Template-Felder</h2>
  137. <div>
  138. <label><input type="checkbox" name="debug" value="1" {{if .ShowDebug}}checked{{end}}> Debug: technische Felddetails anzeigen</label>
  139. </div>
  140. <div>
  141. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="generate_all">Generate all suggestions</button>
  142. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="regenerate_all">Regenerate all suggestions</button>
  143. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="apply_all">Apply all suggestions</button>
  144. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="apply_all_empty">Apply all suggestions to empty fields (safe)</button>
  145. </div>
  146. {{if and .ShowDebug .SemanticSlots}}
  147. <details>
  148. <summary>Technik-Preview: Semantische Zielslots (intern)</summary>
  149. <table>
  150. <thead>
  151. <tr><th>Slot</th><th>Zuordnungen</th><th>Beispiele</th></tr>
  152. </thead>
  153. <tbody>
  154. {{range .SemanticSlots}}
  155. <tr>
  156. <td class="mono">{{.Slot}}</td>
  157. <td>{{.Count}}</td>
  158. <td class="mono">{{.Examples}}</td>
  159. </tr>
  160. {{end}}
  161. </tbody>
  162. </table>
  163. </details>
  164. {{end}}
  165. {{range .FieldSections}}
  166. <h3>{{.Title}}</h3>
  167. {{if .Description}}<p>{{.Description}}</p>{{end}}
  168. {{range .EditableGroups}}
  169. <h4>{{.Title}}</h4>
  170. <table>
  171. <thead>
  172. <tr><th>Field</th><th>Value</th><th>Sample</th></tr>
  173. </thead>
  174. <tbody>
  175. {{range .Fields}}
  176. <tr id="{{.AnchorID}}">
  177. <td>
  178. <input type="hidden" name="field_path_{{.Index}}" value="{{.Path}}">
  179. {{.DisplayLabel}}
  180. {{if $.ShowDebug}}<br><span class="mono">{{.Path}}</span>{{end}}
  181. </td>
  182. <td>
  183. <textarea name="field_value_{{.Index}}">{{.Value}}</textarea>
  184. {{if .SuggestedValue}}
  185. <div><small>Vorschlag: {{.SuggestedValue}}</small></div>
  186. {{if and $.ShowDebug .SuggestionReason}}<div><small>Grund: {{.SuggestionReason}}</small></div>{{end}}
  187. {{if and $.ShowDebug .SuggestionStatus}}<div><small>Status: {{.SuggestionStatus}}</small></div>{{end}}
  188. {{if and $.ShowDebug .SuggestionSource}}<div><small>Quelle: {{.SuggestionSource}}</small></div>{{end}}
  189. <div>
  190. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="apply_field::{{.Path}}">Apply</button>
  191. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="regenerate_field::{{.Path}}">Regenerate</button>
  192. </div>
  193. {{else}}
  194. <div>
  195. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="regenerate_field::{{.Path}}">Regenerate</button>
  196. </div>
  197. {{end}}
  198. </td>
  199. <td class="mono">{{.SampleValue}}</td>
  200. </tr>
  201. {{end}}
  202. </tbody>
  203. </table>
  204. {{end}}
  205. {{if .EditableFields}}
  206. <table>
  207. <thead>
  208. <tr><th>Field</th><th>Value</th><th>Sample</th></tr>
  209. </thead>
  210. <tbody>
  211. {{range .EditableFields}}
  212. <tr id="{{.AnchorID}}">
  213. <td>
  214. <input type="hidden" name="field_path_{{.Index}}" value="{{.Path}}">
  215. {{.DisplayLabel}}
  216. {{if $.ShowDebug}}<br><span class="mono">{{.Path}}</span>{{end}}
  217. </td>
  218. <td>
  219. <textarea name="field_value_{{.Index}}">{{.Value}}</textarea>
  220. {{if .SuggestedValue}}
  221. <div><small>Vorschlag: {{.SuggestedValue}}</small></div>
  222. {{if and $.ShowDebug .SuggestionReason}}<div><small>Grund: {{.SuggestionReason}}</small></div>{{end}}
  223. {{if and $.ShowDebug .SuggestionStatus}}<div><small>Status: {{.SuggestionStatus}}</small></div>{{end}}
  224. {{if and $.ShowDebug .SuggestionSource}}<div><small>Quelle: {{.SuggestionSource}}</small></div>{{end}}
  225. <div>
  226. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="apply_field::{{.Path}}">Apply</button>
  227. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="regenerate_field::{{.Path}}">Regenerate</button>
  228. </div>
  229. {{else}}
  230. <div>
  231. <button type="submit" formaction="/builds/drafts/autofill" name="autofill_action" value="regenerate_field::{{.Path}}">Regenerate</button>
  232. </div>
  233. {{end}}
  234. </td>
  235. <td class="mono">{{.SampleValue}}</td>
  236. </tr>
  237. {{end}}
  238. </tbody>
  239. </table>
  240. {{end}}
  241. {{if .DisabledFields}}
  242. <table>
  243. <thead>
  244. <tr><th>Field</th><th>Status</th><th>Sample</th></tr>
  245. </thead>
  246. <tbody>
  247. {{range .DisabledFields}}
  248. <tr>
  249. <td>{{.DisplayLabel}}{{if $.ShowDebug}}<br><span class="mono">{{.Path}}</span>{{end}}</td>
  250. <td>Erkannt, deaktiviert (MVP ohne Bildlogik)</td>
  251. <td class="mono">{{.SampleValue}}</td>
  252. </tr>
  253. {{end}}
  254. </tbody>
  255. </table>
  256. {{end}}
  257. {{end}}
  258. {{if eq (len .EditableFields) 0}}
  259. <p>No enabled text fields found for this template.</p>
  260. {{end}}
  261. <button type="submit" formaction="/builds/drafts">Save Draft</button>
  262. <button type="submit">Start Build</button>
  263. </form>
  264. {{if .AutofillFocusID}}
  265. <script>
  266. window.addEventListener("load", function () {
  267. var target = document.getElementById("{{.AutofillFocusID}}");
  268. if (target) {
  269. target.scrollIntoView({ block: "center" });
  270. }
  271. });
  272. </script>
  273. {{end}}
  274. {{end}}
  275. </body>
  276. </html>
  277. {{end}}