<?php
session_start();
require_once realpath(dirname(__DIR__, 3) . '/services/Model.php');
$obj = new Model();

$acc_id = isset($_GET['acc_id']) ? (int)$_GET['acc_id'] : 0;
if($acc_id <= 0){
    echo '<div class="alert alert-danger">Invalid Payment ID</div>';
    exit;
}

$row = $obj->details_by_cond('re_tbl_account',"acc_id='$acc_id'");
if(!$row){
    echo '<div class="alert alert-danger">Payment not found</div>';
    exit;
}
?>
<form id="editPaymentForm">
  <input type="hidden" name="acc_id" value="<?php echo (int)$acc_id; ?>">

  <div class="form-group">
    <label>Amount</label>
    <input type="text" name="acc_amount" class="form-control"
           value="<?php echo htmlspecialchars($row['acc_amount'] ?? ''); ?>" required>
  </div>

  <div class="form-group">
    <label>Description</label>
    <textarea name="acc_description" class="form-control" rows="3"><?php
      echo htmlspecialchars($row['acc_description'] ?? '');
    ?></textarea>
  </div>

  <div class="text-right mt-4">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    <button type="submit" class="btn btn-primary">Update</button>
  </div>
</form>
