Updated Accounts Listing to use take adavantage of the new account_type_parent

This commit is contained in:
johnnyq
2023-10-20 16:10:45 -04:00
parent 762dafab7e
commit 8257fc3193
3 changed files with 22 additions and 23 deletions

View File

@@ -19,6 +19,7 @@
<input type="text" class="form-control" name="name" value="<?php echo $account_name; ?>" placeholder="Account name" required>
</div>
</div>
<div class="form-group">
<label>Account Type <strong class="text-danger">*</strong></label>
<div class="input-group">
@@ -26,28 +27,25 @@
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
</div>
<select class="form-control select" name="type" required>
<option value="">- Select -</option>
<?php
$sql_account_type = mysqli_query($mysqli, "SELECT * FROM account_types WHERE account_type_id = $account_type_id");
$row = mysqli_fetch_array($sql_account_type);
$account_type_name = nullable_htmlentities($row['account_type_name']);
echo "<option value='$account_type_id' selected>$account_type_name</option>";
$sql_account_types_select = mysqli_query($mysqli, "SELECT * FROM account_types ORDER BY account_type_name ASC");
while ($row = mysqli_fetch_array($sql_account_types_select)) {
$account_type_id_select = intval($row['account_type_id']);
$account_type_name_select = nullable_htmlentities($row['account_type_name']);
?>
<option value="<?php echo $account_type_id_select; ?>" <?php if($account_type == $account_type_id_select){ echo "selected"; } ?>><?php echo $account_type_name_select; ?></option>
<?php
}
?>
<option value="">----------------</option>
<?php
$sql_account_types = mysqli_query($mysqli, "SELECT * FROM account_types ORDER BY account_type_name ASC");
while ($row = mysqli_fetch_array($sql_account_types)) {
$account_type_id = intval($row['account_type_id']);
$account_type_name = nullable_htmlentities($row['account_type_name']);
if($account_type_id % 10 != 0) {
echo "<option value='$account_type_id'>$account_type_name</option>";}}?>
</select>
</div>
</div>
<div class="form-group">
<label>Notes</label>
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
</div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="edit_account" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>