backend-01

ref: master

app/views/bill_edit.php


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<div class="container mx-auto mt-10">
  <h1 class="text-2xl font-bold text-gray-700 mb-6">Editar Gasto</h1>

  <form action="/bills/edit/<?= $bill->getId() ?>" method="POST" enctype="multipart/form-data"  class="bg-white p-6 rounded shadow-md">
    <div class="mb-4">
      <label for="title" class="block text-sm font-medium text-gray-700">Título</label>
      <input type="text" id="title" name="title" value="<?= htmlspecialchars($bill->getTitle()) ?>"
             class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required />
    </div>

    <div class="mb-4">
      <label for="amount" class="block text-sm font-medium text-gray-700">Valor</label>
      <input type="text" id="amount" name="amount" value="<?= htmlspecialchars($bill->getAmount()) ?>"
             class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required />
    </div>

    <div class="mb-4">
      <label for="due_date" class="block text-sm font-medium text-gray-700">Vencimento</label>
      <input type="date" id="due_date" name="due_date" value="<?= htmlspecialchars($bill->getDueDate()) ?>"
             class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required />
    </div>

    <div class="mb-4">
      <label for="tags" class="block text-sm font-medium text-gray-700">Tags</label>
      <div class="space-y-2">
        <?php foreach ($tags as $tag) : ?>
          <label class="inline-flex items-center">
            <input type="checkbox" name="tags[]" value="<?= $tag->getId() ?>" <?= in_array($tag->getId(), $tagIds) ? 'checked' : '' ?> class="form-checkbox text-blue-500">
            <span class="ml-2"><?= htmlspecialchars($tag->getName()) ?></span>
          </label>
        <?php endforeach; ?>
      </div>
    </div>

    <div class="mb-4">
      <label for="pdf" class="block text-sm font-medium text-gray-700">Anexar boleto</label>
      <input type="file" id="pdf" name="pdf" class="mt-1 block w-full text-gray-700">
    </div>

    <div class="mb-4">
      <label class="flex items-center text-sm font-medium text-gray-700">
      <input type="checkbox" name="paid" class="mr-2" <?= ($bill->isPaid()) ? 'checked' : '' ?> />
        Pago?
      </label>
    </div>

    <div class="flex items-center space-x-4">
      <button type="submit" class="bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700">
        Atualizar Gasto
      </button>

      <a href="/dashboard" class="bg-gray-600 text-white py-2 px-4 rounded hover:bg-gray-700">Voltar</a>
    </div>
  </form>
</div>