Diff -- /var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com/TEMPLATES/tf_forms.html
Diff
/var/www/vhosts/3dshawn.com/ptmatrix.3dshawn.com/TEMPLATES/tf_forms.html
added on local at 2026-07-01 12:34:57
Added
+149
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to cb2bb9a672e3
to cb2bb9a672e3
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.| 1 | <div class="page-header"> | |
| 2 | <div><h1>Forms</h1><p class="subtitle">Public intake URLs — turn bug reports, IT tickets, or feature requests into tasks automatically.</p></div> | |
| 3 | </div> | |
| 4 | ||
| 5 | [if:$has_flash]<div class="flash-msg">$flash</div>[/if] | |
| 6 | ||
| 7 | [if:!$has_projects] | |
| 8 | <div class="card mb-3" style="border-left:3px solid var(--col-warn);padding:18px"> | |
| 9 | <strong>No active projects.</strong> <a href="/projects.cgi">Create a project</a> first — forms need somewhere to drop submitted tasks. | |
| 10 | </div> | |
| 11 | [/if] | |
| 12 | ||
| 13 | [if:$has_forms] | |
| 14 | [loop:@forms] | |
| 15 | <form method="POST" action="/forms.cgi" class="card mb-3" style="padding:20px"> | |
| 16 | <input type="hidden" name="act" value="save"> | |
| 17 | <input type="hidden" name="id" value="$loop1.id"> | |
| 18 | ||
| 19 | <div style="display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:14px"> | |
| 20 | <div style="display:flex;align-items:center;gap:12px;flex-wrap:wrap"> | |
| 21 | <h3 style="margin:0">$loop1.name</h3> | |
| 22 | <span class="badge">$loop1.project_display</span> | |
| 23 | [if:!$loop1.is_active]<span class="badge warn">disabled</span>[/if] | |
| 24 | <span class="text-muted" style="font-size:13px">$loop1.submission_count submissions</span> | |
| 25 | </div> | |
| 26 | <button type="submit" class="btn btn-primary btn-sm">Save</button> | |
| 27 | </div> | |
| 28 | ||
| 29 | <div class="card mb-3" style="background:rgba(90,169,255,.05);padding:10px 14px;border-radius:6px"> | |
| 30 | <div style="font-size:12px;color:var(--col-text-muted);margin-bottom:4px">Public URL (share this anywhere)</div> | |
| 31 | <code style="display:block;font-size:13px;word-break:break-all"><a href="$loop1.public_url" target="_blank" style="color:#5aa9ff">$loop1.public_url_disp</a></code> | |
| 32 | </div> | |
| 33 | ||
| 34 | <div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px"> | |
| 35 | <div class="field"><label>Form name</label><input class="input" name="name" value="$loop1.name" required></div> | |
| 36 | <div class="field"><label>URL slug</label><input class="input" name="slug" value="$loop1.slug" placeholder="bug-report"></div> | |
| 37 | <div class="field"><label>Target project</label><select class="input" name="project_id">$loop1.project_options_html</select></div> | |
| 38 | <div class="field"><label>Default priority</label> | |
| 39 | <select class="input" name="default_priority"> | |
| 40 | <option value="low" $loop1.prio_low>Low</option> | |
| 41 | <option value="medium" $loop1.prio_medium>Medium</option> | |
| 42 | <option value="high" $loop1.prio_high>High</option> | |
| 43 | <option value="urgent" $loop1.prio_urgent>Urgent</option> | |
| 44 | <option value="critical" $loop1.prio_critical>Critical</option> | |
| 45 | </select> | |
| 46 | </div> | |
| 47 | <div class="field"><label>Submit button label</label><input class="input" name="submit_label" value="$loop1.submit_label"></div> | |
| 48 | </div> | |
| 49 | ||
| 50 | <div class="field" style="margin-top:14px"><label>Short description (shown above the form)</label><input class="input" name="description" value="$loop1.description"></div> | |
| 51 | <div class="field" style="margin-top:8px"><label>Success message (shown after submit)</label><input class="input" name="success_message" value="$loop1.success_message"></div> | |
| 52 | ||
| 53 | <h4 style="margin:18px 0 8px">Custom fields</h4> | |
| 54 | <p class="text-muted" style="font-size:12px;margin:0 0 10px">The form always asks for <strong>Subject</strong> and <strong>Email</strong> (Subject becomes the task title, Email is saved with the submission). Anything below is extra and gets appended to the task description.</p> | |
| 55 | <div style="display:grid;grid-template-columns:1fr 130px 90px 1.4fr 1fr;gap:8px;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--col-text-muted);padding:0 8px;margin-bottom:4px"> | |
| 56 | <div>Label</div><div>Type</div><div style="text-align:center">Required</div><div>Options (for "select", one per line)</div><div>Map to custom field</div> | |
| 57 | </div> | |
| 58 | [loop:@loop1.slots] | |
| 59 | <div style="display:grid;grid-template-columns:1fr 130px 90px 1.4fr 1fr;gap:8px;margin-bottom:6px"> | |
| 60 | <input class="input" name="f[$loop2.slot]_label" value="$loop2.label_h" placeholder="(blank = unused)"> | |
| 61 | <select class="input" name="f[$loop2.slot]_type"> | |
| 62 | <option value="text" $loop2.sel_text>Text</option> | |
| 63 | <option value="textarea" $loop2.sel_textarea>Textarea</option> | |
| 64 | <option value="email" $loop2.sel_email>Email</option> | |
| 65 | <option value="number" $loop2.sel_number>Number</option> | |
| 66 | <option value="date" $loop2.sel_date>Date</option> | |
| 67 | <option value="select" $loop2.sel_select>Select</option> | |
| 68 | <option value="checkbox" $loop2.sel_checkbox>Checkbox</option> | |
| 69 | </select> | |
| 70 | <div style="display:flex;align-items:center;justify-content:center"><input type="checkbox" name="f[$loop2.slot]_required" value="1" $loop2.required_attr></div> | |
| 71 | <textarea class="input" name="f[$loop2.slot]_options" rows="1" style="font-size:12px">$loop2.options_h</textarea> | |
| 72 | <select class="input" name="f[$loop2.slot]_cf_id" title="When set, the submitted answer is written into this PTMatrix custom field on the new ticket.">$loop2.cf_options_html</select> | |
| 73 | </div> | |
| 74 | [/loop] | |
| 75 | ||
| 76 | <div style="display:flex;gap:18px;align-items:center;margin-top:14px;flex-wrap:wrap"> | |
| 77 | <label class="checkbox"><input type="checkbox" name="is_active" value="1" $loop1.active_attr> Active (accepting submissions)</label> | |
| 78 | </div> | |
| 79 | </form> | |
| 80 | <div style="display:flex;gap:8px;justify-content:flex-end;margin:-8px 0 18px"> | |
| 81 | <form method="POST" action="/forms.cgi" style="display:inline"> | |
| 82 | <input type="hidden" name="act" value="toggle_active"> | |
| 83 | <input type="hidden" name="id" value="$loop1.id"> | |
| 84 | <button type="submit" class="btn btn-ghost btn-sm">$loop1.toggle_label</button> | |
| 85 | </form> | |
| 86 | <form method="POST" action="/forms.cgi" style="display:inline" onsubmit="return confirm('Delete form "$loop1.name"? All submissions stay but the form goes away.')"> | |
| 87 | <input type="hidden" name="act" value="delete"> | |
| 88 | <input type="hidden" name="id" value="$loop1.id"> | |
| 89 | <button type="submit" class="btn btn-ghost btn-sm" style="color:#ff6b6b;border-color:#ff6b6b">Delete</button> | |
| 90 | </form> | |
| 91 | </div> | |
| 92 | [/loop] | |
| 93 | [/if] | |
| 94 | ||
| 95 | [if:$has_projects] | |
| 96 | <form method="POST" action="/forms.cgi" class="card" style="padding:20px;border-style:dashed"> | |
| 97 | <input type="hidden" name="act" value="save"> | |
| 98 | <input type="hidden" name="id" value="0"> | |
| 99 | <h3 style="margin-top:0">Create a new form</h3> | |
| 100 | ||
| 101 | <div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px"> | |
| 102 | <div class="field"><label>Form name <span style="color:#ff6b6b">*</span></label><input class="input" name="name" required placeholder="Bug Report"></div> | |
| 103 | <div class="field"><label>URL slug (blank = auto)</label><input class="input" name="slug" placeholder="bug-report"></div> | |
| 104 | <div class="field"><label>Target project <span style="color:#ff6b6b">*</span></label><select class="input" name="project_id" required>$new_project_options_html</select></div> | |
| 105 | <div class="field"><label>Default priority</label> | |
| 106 | <select class="input" name="default_priority"> | |
| 107 | <option value="low">Low</option> | |
| 108 | <option value="medium" selected>Medium</option> | |
| 109 | <option value="high">High</option> | |
| 110 | <option value="urgent">Urgent</option> | |
| 111 | <option value="critical">Critical</option> | |
| 112 | </select> | |
| 113 | </div> | |
| 114 | <div class="field"><label>Submit button label</label><input class="input" name="submit_label" value="Submit"></div> | |
| 115 | </div> | |
| 116 | ||
| 117 | <div class="field" style="margin-top:14px"><label>Short description</label><input class="input" name="description" placeholder="Tell us what went wrong."></div> | |
| 118 | <div class="field" style="margin-top:8px"><label>Success message</label><input class="input" name="success_message" value="Thanks! We received your submission."></div> | |
| 119 | ||
| 120 | <h4 style="margin:18px 0 8px">Custom fields</h4> | |
| 121 | <p class="text-muted" style="font-size:12px;margin:0 0 10px">Subject + Email are always shown. Add up to 12 extra fields below.</p> | |
| 122 | <div style="display:grid;grid-template-columns:1fr 130px 90px 1.4fr 1fr;gap:8px;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--col-text-muted);padding:0 8px;margin-bottom:4px"> | |
| 123 | <div>Label</div><div>Type</div><div style="text-align:center">Required</div><div>Options (for "select", one per line)</div><div>Map to custom field</div> | |
| 124 | </div> | |
| 125 | [loop:@new_slots] | |
| 126 | <div style="display:grid;grid-template-columns:1fr 130px 90px 1.4fr 1fr;gap:8px;margin-bottom:6px"> | |
| 127 | <input class="input" name="f[$loop1.slot]_label" placeholder="(blank = unused)"> | |
| 128 | <select class="input" name="f[$loop1.slot]_type"> | |
| 129 | <option value="text" selected>Text</option> | |
| 130 | <option value="textarea">Textarea</option> | |
| 131 | <option value="email">Email</option> | |
| 132 | <option value="number">Number</option> | |
| 133 | <option value="date">Date</option> | |
| 134 | <option value="select">Select</option> | |
| 135 | <option value="checkbox">Checkbox</option> | |
| 136 | </select> | |
| 137 | <div style="display:flex;align-items:center;justify-content:center"><input type="checkbox" name="f[$loop1.slot]_required" value="1"></div> | |
| 138 | <textarea class="input" name="f[$loop1.slot]_options" rows="1" style="font-size:12px"></textarea> | |
| 139 | <select class="input" name="f[$loop1.slot]_cf_id" title="When set, the submitted answer is written into this PTMatrix custom field on the new ticket.">$loop1.cf_options_html</select> | |
| 140 | </div> | |
| 141 | [/loop] | |
| 142 | ||
| 143 | <div style="display:flex;gap:18px;align-items:center;margin-top:14px;flex-wrap:wrap"> | |
| 144 | <label class="checkbox"><input type="checkbox" name="is_active" value="1" checked> Active</label> | |
| 145 | <div style="flex:1"></div> | |
| 146 | <button type="submit" class="btn btn-primary">Create form</button> | |
| 147 | </div> | |
| 148 | </form> | |
| 149 | [/if] |