{#- Documents: the upload with what the files are, and the list. A person's Documents tab and a company's page use them. -#} {% import "_fields.html" as fm %} {#- The record a person's document belongs to, by kind of record. -#} {% macro belongs(value, groups, err="") -%}
{%- if err %} {%- endif %}
{%- endmacro %} {#- The upload: a one-line strip that takes dropped files (the file input covers it) and the fields that say what they are. The form token comes first: the server checks it before it reads any file. -#} {% macro upload(u, csrf, person=true) -%} {%- if u.files_on %}
{%- if u.errors %}
Nothing was uploaded. Correct what is marked and choose the files again.
{%- endif %}
PDF, JPEG, PNG or WebP, up to {{ u.file_limit_mb }} MB each, {{ u.max_files }} at once. A card's front and back chosen together print on one page.
{%- if u.errors.file %}

{{ u.errors.file }}

{%- endif %}
{{ fm.select("kind", "What it is", u.values.kind, u.kinds, err=u.errors.kind, blank="Choose", req=true) }} {%- if person %} {{ belongs(u.values.link, u.groups, err=u.errors.link) }} {%- endif %} {{ fm.text("dated_on", "Date on the document", u.values.dated_on, err=u.errors.dated_on, type="date") }} {{ fm.text("note", "Note", u.values.note, err=u.errors.note, ph="page 2, certified copy") }}
{%- else %}
Documents are switched off on this server: it has no files directory and file key (VISA_FILES_DIR and VISA_FILES_KEY_FILE).
{%- endif %} {%- endmacro %} {#- The list. On phones the date, type and size move under the name. -#} {% macro table(docs, person=true) -%}
{% if person %}{% endif %} {%- for d in docs %} {%- if person %} {%- endif %} {%- endfor %}
DocumentBelongs toDatedFileAddedActions
{{ d.kind_label }}{% if d.side == "front" %} front{% elif d.side == "back" %} back{% endif %} {%- if d.note %}
{{ d.note }}
{% endif %}
{% if d.dated_on %}{{ d.dated_on }} ยท {% endif %}{{ d.type_label }}, {{ d.size }}
{% if d.link_label %}{{ d.link_label }}{% else %}the person{% endif %}{{ d.dated_on }} {{ d.type_label }} {{ d.size }}
{{ d.file_name }}
{{ d.uploaded }}
{{ d.uploaded_by }}
ViewDownload{% if d.side == "front" %}Print both sides{% endif %}Edit
{%- endmacro %}