deploy / deploy (push) Successful in 10s
- Home page is now just the print server overview, no more unrelated network links (3D printers, Cockpit) left over from when this was a general landing page. - Navbar shows which section is active; Brother's per-printer buttons now live under a dedicated Brother nav item instead of always-visible. - Shipping labels: paste raw ZPL directly (no need to save to a file first), with a Labelary preview link alongside it. - Receipts: paste already-formatted ESC/POS text directly, printed as-is. - Both can save what they just printed into a shared label repository (lib/label_repository.rb, one JSON file per label under data/labels/) for reprinting later -- saving happens independently of whether the print itself succeeds, so a failed/offline printer doesn't lose the content.
56 lines
2.5 KiB
ERB
56 lines
2.5 KiB
ERB
<h5>Formatted receipt</h5>
|
|
<form action="/epson/print" method="POST">
|
|
<div class="mb-3">
|
|
<label for="title" class="form-label">Title (bold, centered)</label>
|
|
<input name="title" class="form-control" type="text" id="title" />
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="body" class="form-label">Body text</label>
|
|
<textarea name="body" class="form-control" id="body" rows="8"></textarea>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="qr" class="form-label">QR code content (optional)</label>
|
|
<input name="qr" class="form-control" type="text" id="qr" />
|
|
</div>
|
|
<button class="btn btn-secondary" type="submit">Print</button>
|
|
</form>
|
|
|
|
<hr class="mt-4">
|
|
|
|
<h5>Free text (already-formatted ESC/POS)</h5>
|
|
<p>Sent as-is (just reset + code page prefix and a trailing cut), no title/body template applied.</p>
|
|
<form action="/epson/raw" method="POST">
|
|
<div class="mb-3">
|
|
<textarea name="content" class="form-control" rows="8" style="font-family: monospace;"></textarea>
|
|
</div>
|
|
<div class="row g-2 align-items-end">
|
|
<div class="col-auto">
|
|
<label for="save_as_escpos" class="form-label">Save as (optional)</label>
|
|
<input name="save_as" class="form-control" type="text" id="save_as_escpos" placeholder="receipt name" />
|
|
</div>
|
|
<div class="col-auto">
|
|
<button class="btn btn-secondary" type="submit">Print</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<% if @labels && !@labels.empty? %>
|
|
<hr class="mt-4">
|
|
<h5>Saved receipts</h5>
|
|
<div class="list-group">
|
|
<% @labels.each do |label| %>
|
|
<div class="list-group-item d-flex justify-content-between align-items-center">
|
|
<%= label['name'] %>
|
|
<div class="d-flex gap-2">
|
|
<form action="/labels/<%= label['id'] %>/print" method="POST">
|
|
<button class="btn btn-sm btn-secondary" type="submit">Print</button>
|
|
</form>
|
|
<form action="/labels/<%= label['id'] %>/delete" method="POST">
|
|
<button class="btn btn-sm btn-outline-danger" type="submit">Delete</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|