<?php
require_once "../config/auth.php";
require_once "../config/db.php";
require_once "../config/helpers.php";

require_once "../includes/header.php";
require_once "../includes/sidebar.php";
require_once "../includes/topbar.php";
?>
<div class="main-content">
<div class="col-lg-12">

<div class="topbar">
    <h5>Add Expense</h5>
</div>

<div class="p-4">

<form method="POST" action="../actions/save_expense.php">

<div class="mb-3">
<label>Title *</label>
<input type="text" name="title" class="form-control" required>
</div>

<div class="mb-3">
<label>Amount *</label>
<input type="number" name="amount" class="form-control" required>
</div>

<div class="mb-3">
<label>Date *</label>
<input type="date" name="expense_date" class="form-control" required value="<?= date('Y-m-d') ?>">
</div>

<button class="btn btn-primary">Save Expense</button>

</form>

</div>
</div>
</div>

<?php if(isset($_GET['success'])){ ?>
<div id="successToast" class="toast align-items-center text-bg-success border-0 position-fixed top-0 end-0 m-3" role="alert">
  <div class="d-flex">
    <div class="toast-body">
      Expenses added successfully!
    </div>
    <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
  </div>
</div>
<?php } ?>


<?php require_once "../includes/footer.php"; ?>
