Skip to content

Commit

Permalink
refactor: show records when adding a new record
Browse files Browse the repository at this point in the history
  • Loading branch information
im-machakata committed Mar 27, 2024
1 parent 074cdb4 commit 1f479ad
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 18 deletions.
89 changes: 72 additions & 17 deletions app/Views/forms/advanced-salary.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,82 @@
extract($this->data);
$this->setVar('title', 'Advanced Salary');
echo $this->include('_templates/head'); ?>
<main class="d-flex flex-column justify-content-center align-items-center bg-primary" style="min-height: 100vh">
<div class="row justify-content-center shadow rounded-2 p-3 bg-white" style="width: 500px;">
<?= $this->include('_templates/header'); ?>
<?= $this->include('_templates/alerts'); ?>
<form action="/requests/advanced-salaries" method="post" class="col-12 row mt-2">
<div class="col-lg-12">
<div class="mb-4">
<label for="Amount" class="form-label">Amount</label>
<input type="number" min="1" name="Amount" id="Amount" class="form-control" value="<?= $old('Amount') ?>" placeholder="50.00" autocomplete="off" required>
<main class="bg-primary">
<div class="container-fluid" style="min-width: 100%">
<div class="row" style="min-height: 100vh; ">
<div class="col-lg-6 bg-white">
<div class="container-fluid">
<div class="row mt-5 mb-4">
<nav class="mb-0" style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Advanced Salary</li>
</ol>
</nav>
<h1 class="text-body h2 fw-bold">New Advanced Salary Requisition</h1>
<div class="text-body mb-4">
Submit a new advanced salary requisition
</div>
<form action="/requests/advanced-salaries" method="post" class="col-12 row mt-2">
<?= $this->include('_templates/alerts'); ?>
<div class="col-lg-12">
<div class="mb-4">
<label for="Amount" class="form-label">Amount</label>
<input type="number" min="1" name="Amount" id="Amount" class="form-control" placeholder="50.00" required>
</div>
</div>
<div class="col-lg-12">
<div class="mb-4">
<label for="Reason" class="form-label">Reason</label>
<textarea type="text" name="Reason" id="Reason" class="form-control" placeholder="I want to buy a new phone..." rows="5" required></textarea>
</div>
</div>
<div class="mb-2 col-12">
<button class="btn btn-primary btn-lg w-100" type="submit">Submit Requisition</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="mb-4">
<label for="Reason" class="form-label">Reason</label>
<textarea type="text" name="Reason" id="Reason" class="form-control" placeholder="I want to buy a new phone..." required><?= $old('Reason') ?></textarea>
<div class="col-lg-6">
<div class="container-fluid">
<div class="mt-5 mb-4 pt-lg-4">
<h2 class="text-white h2 fw-bold">My Advanced Requisitions</h2>
<div class="text-white">
<?php if ($requisitions) : ?>
You have <?= count($requisitions) ?> advanced salary submittions
<?php elseif (!$requisitions) : ?>
You have not made any advanced salary requisitions.
<?php endif; ?>
</div>
<?php foreach ($requisitions as $requisition) : ?>
<div class="card border-0 my-3">
<div class="card-header bg-dark border-dark text-white">
<div class="d-flex">
<div class="flex-fill">
Amount: $<?= number_format($requisition->Amount, 2) ?> USD
</div>
<div class="float-end">
<span class="badge bg-primary"><?= str_replace('_', ' ', $requisition->Status) ?></span>
<!-- <span class="badge bg-primary">Delete</span> -->
</div>
</div>
</div>
<div class="card-body">
<p class="card-text mb-0">
<?= $requisition->Reason ?>
</p>
<p class="card-text">
<small class="text-body-secondary">Last Updated: <?= $requisition->UpdatedAt->humanize() ?></small>
</p>
</div>
</div>
<?php endforeach; ?>
<?= $pager ? $pager->links() : '' ?>
</div>
</div>
</div>
<div class="mb-2 col-12">
<button class="btn btn-primary btn-lg w-100" type="submit">Submit Requisition</button>
</div>
</form>
</div>
</div>
</main>
<?php echo $this->include('_templates/footer'); ?>
2 changes: 1 addition & 1 deletion app/Views/forms/travel-and-subsistency.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</div>
</div>
<div class="mb-2 col-12">
<button class="btn btn-primary btn-lg w-100" type="submit">Submit Requisition</button>
<button class="btn btn-primary btn-lg w-100" id="Submit" type="submit" disabled>Submit Requisition</button>
</div>
</form>
</div>
Expand Down

0 comments on commit 1f479ad

Please sign in to comment.