A company's office: its GPS position and a photo
The company form has a field for the office's GPS position (migration 0004, column companies.office_gps). It takes what people have at hand: the numbers Google Maps copies, a link to the place on Google Maps or OpenStreetMap, a geo: URI, or degrees, minutes and seconds. It keeps decimal degrees with six decimals and refuses a position outside Thailand, which catches a swapped pair; a short maps.app.goo.gl link is refused with a hint, as it holds no position (src/gps.rs, with unit tests). The company's page has an Office card: the position with links that open it on OpenStreetMap and Google Maps, the newest photo of the office, and a strip that uploads a photo (kind "Photo of the office") and returns to the card. The photos are documents like any other: encrypted on the server and audited. A refused photo shows its errors on the card only; office photos that are PDFs are counted under Company documents. The demo company has a position. Tests: the position read from a link, from degrees, minutes and seconds, the three refusals, the audit entry and its removal; a photo uploaded from the card, shown, and its errors placed.
This commit is contained in:
1 parent
e88bb74e1e
commit
2a6e972b68
14 files changed
+642
-8
No files matched your search
@@ -67,6 +67,47 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
<section class="card span2" id="office">
|
||||
<header><h2>Office</h2><a class="btn sm ghost" href="/companies/{{ c.id }}/edit#f-office_gps">{% if c.gps %}Change the position{% else %}Add the GPS position{% endif %}</a></header>
|
||||
<div class="office">
|
||||
<div class="office-pic">
|
||||
{%- if office.photo %}
|
||||
<a href="{{ office.photo.href }}" target="_blank" rel="noopener"><img src="{{ office.photo.href }}" alt="Photo of the office of {{ c.name }}"></a>
|
||||
<p class="muted small">{% if office.photo.dated_on %}Taken {{ office.photo.dated_on }}{% else %}Added {{ office.photo.uploaded }}{% endif %}{% if office.more %} · {{ office.more }} more under <a href="#documents">Company documents</a>{% endif %}</p>
|
||||
{%- else %}
|
||||
<div class="office-none">No photo of the office yet</div>
|
||||
{%- if office.more %}
|
||||
<p class="muted small">{{ office.more }} as PDF under <a href="#documents">Company documents</a></p>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
</div>
|
||||
<div class="office-info">
|
||||
<dl class="kv">
|
||||
<dt>GPS position</dt>
|
||||
<dd>{% if c.gps %}<span class="mono">{{ c.gps }}</span>{% if c.osm %}<span class="maplinks"><a href="{{ c.osm }}" target="_blank" rel="noopener noreferrer">OpenStreetMap</a><a href="{{ c.gmaps }}" target="_blank" rel="noopener noreferrer">Google Maps</a></span>{% endif %}{% else %}<span class="muted">not recorded</span>{% endif %}</dd>
|
||||
</dl>
|
||||
<p class="hint">The position and the photo help the officers who visit the workplace, and go into the extension packs of the people employed here.</p>
|
||||
{%- if office.files_on %}
|
||||
<form method="post" action="/companies/{{ c.id }}/documents" enctype="multipart/form-data" class="upload office-up" id="office-upload">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<input type="hidden" name="kind" value="office-photo">
|
||||
<input type="hidden" name="back" value="office">
|
||||
{%- if office.errors %}
|
||||
<div class="notice warn">Nothing was uploaded. {{ office.errors.file or office.errors.kind or office.errors.note or "Choose the photo again." }}</div>
|
||||
{%- endif %}
|
||||
<div class="drop{% if office.errors.file %} has-err{% endif %}" data-max="{{ office.file_limit }}">
|
||||
<input type="file" id="f-office-file" name="file" required accept="image/jpeg,image/png,image/webp" aria-describedby="h-office-file">
|
||||
<span class="drop-icon" aria-hidden="true">+</span>
|
||||
<label for="f-office-file"><b>{% if office.photo %}Add a newer photo{% else %}Add a photo of the office{% endif %}</b> or drop it here</label>
|
||||
<span class="drop-names" data-drop-names></span>
|
||||
<span class="hint" id="h-office-file">JPEG, PNG or WebP, up to {{ office.file_limit_mb }} MB</span>
|
||||
</div>
|
||||
<button type="submit" class="btn pri">Upload</button>
|
||||
</form>
|
||||
{%- endif %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="card span2" id="documents">
|
||||
<header><h2>Company documents</h2><span class="muted small">for the extension packs of the people employed here</span></header>
|
||||
{{ dm.upload(upload, csrf, person=false) }}
|
||||
|
||||
Reference in new issue
Block a user