edit.twig 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {% extends 'layout.twig' %}
  2. {% block title %}{{ consumer.name }} — Consumer — IRDB{% endblock %}
  3. {% block content %}
  4. <div class="mx-auto max-w-3xl">
  5. <a href="/app/consumers" class="text-sm text-slate-500 hover:underline dark:text-slate-400">← Back to consumers</a>
  6. <h1 class="mt-3 text-2xl font-semibold tracking-tight font-mono">{{ consumer.name }}</h1>
  7. <form method="post" action="/app/consumers/{{ consumer.id }}" class="mt-6 rounded-2xl border border-slate-200 bg-white p-5 shadow-sm dark:border-slate-800 dark:bg-slate-900">
  8. <input type="hidden" name="csrf_token" value="{{ csrf_token }}">
  9. <div class="grid grid-cols-1 gap-3 md:grid-cols-2 text-sm">
  10. <div>
  11. <label for="c-name" class="block text-xs font-medium text-slate-600 dark:text-slate-400">Name</label>
  12. <input type="text" id="c-name" name="name" value="{{ consumer.name }}" {% if not can_write %}readonly{% endif %}
  13. class="mt-1 w-full rounded-md border border-slate-300 bg-white px-2 py-1.5 font-mono dark:border-slate-700 dark:bg-slate-950">
  14. </div>
  15. <div>
  16. <label for="c-policy" class="block text-xs font-medium text-slate-600 dark:text-slate-400">Policy</label>
  17. <select id="c-policy" name="policy_id" {% if not can_write %}disabled{% endif %}
  18. class="mt-1 w-full rounded-md border border-slate-300 bg-white px-2 py-1.5 dark:border-slate-700 dark:bg-slate-950">
  19. {% for p in policies %}
  20. <option value="{{ p.id }}" {% if consumer.policy_id == p.id %}selected{% endif %}>{{ p.name }}</option>
  21. {% endfor %}
  22. </select>
  23. </div>
  24. <div class="md:col-span-2">
  25. <label for="c-desc" class="block text-xs font-medium text-slate-600 dark:text-slate-400">Description</label>
  26. <input type="text" id="c-desc" name="description" value="{{ consumer.description|default('') }}" {% if not can_write %}readonly{% endif %}
  27. class="mt-1 w-full rounded-md border border-slate-300 bg-white px-2 py-1.5 dark:border-slate-700 dark:bg-slate-950">
  28. </div>
  29. <div class="md:col-span-2">
  30. <label class="flex items-center gap-2 text-xs text-slate-600 dark:text-slate-400">
  31. <input type="checkbox" name="is_active" value="1" {% if consumer.is_active %}checked{% endif %} {% if not can_write %}disabled{% endif %}>
  32. active
  33. </label>
  34. </div>
  35. </div>
  36. {% if can_write %}
  37. <div class="mt-4 flex justify-end">
  38. <button type="submit" class="rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-indigo-500">Save</button>
  39. </div>
  40. {% endif %}
  41. </form>
  42. </div>
  43. {% endblock %}