<?php 
$charges1 = $controller->getConfigValue($data, "CACcharge1"); 
$charges2 = $controller->getConfigValue($data, "CACcharge2"); 
?>
<div class="page-content header-clear-medium">
    <div class="card card-style">
        <div class="content text-center">
            <img src="../../assets/images/cac.png" style="width:100px; height:100px;" />
            <p class="mb-0 font-600 color-highlight">Register Your Business With CAC </p>
            <h1>CAC Registration</h1>
            <div class="mt-5">
                <form method="post" enctype="multipart/form-data" class="contactForm the-submit-form" id="registrationForm"> 
                    <fieldset>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="certType" class="color-theme opacity-80 font-700 font-12">Certificate Type</label>
                            <select id="certType" name="certType">
                                <option value="" disabled selected>Certificate Type</option>
                                <option value="biz" charge="<?php echo $charges1; ?>">Business Name (<?php echo "N" . number_format($charges1); ?>)</option>
                                <option value="limited" charge="<?php echo $charges2; ?>">Limited Liability (<?php echo "N" . number_format($charges2); ?>)</option>
                            </select>
                            <span><i class="fa fa-chevron-down"></i></span>
                            <i class="fa fa-check disabled valid color-green-dark"></i>
                            <i class="fa fa-check disabled invalid color-red-dark"></i>
                            <em></em>
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="comp_name" class="color-theme opacity-80 font-700 font-12">Business name 1</label>
                            <input type="text" name="comp_name" placeholder="Business name 1" class="round-small" required />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="alt_comp_name" class="color-theme opacity-80 font-700 font-12">Business name 2</label>
                            <input type="text" name="alt_comp_name" placeholder="Business name 2" class="round-small" required />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="comp_addr" class="color-theme opacity-80 font-700 font-12">Company address</label>
                            <input type="text" name="comp_addr" placeholder="Company address" class="round-small" required />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="res_addr" class="color-theme opacity-80 font-700 font-12">Residential address</label>
                            <input type="text" name="res_addr" placeholder="Residential address" class="round-small" required />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="bus_nature" class="color-theme opacity-80 font-700 font-12">Nature of business</label>
                            <input type="text" name="bus_nature" placeholder="Nature of business" class="round-small" required />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="share_cap" class="color-theme opacity-80 font-700 font-12">Share Capital</label>
                            <input type="text" name="share_cap" placeholder="Share Capital" class="round-small" value="" />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="dir_id_card" class="color-theme opacity-80 font-700 font-12">ID Card of Directors</label>
                            <input type="file" name="dir_id_card" class="round-small form-control" required />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="passport_photo" class="color-theme opacity-80 font-700 font-12">Passport photograph</label>
                            <input type="file" name="passport_photo" class="round-small form-control" required />
                        </div>
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="phone_num" class="color-theme opacity-80 font-700 font-12">Phone Number</label>
                            <input type="number" name="phone_num" placeholder="Phone Number" class="round-small" required />
                        </div>
                        
                        <div class="input-style input-style-always-active has-borders validate-field">
                            <label for="email" class="color-theme opacity-80 font-700 font-12">Email Address</label>
                            <input type="email" name="email" placeholder="Email Address" class="round-small" required />
                        </div>
                        
                        <div class="form-button">
                            <button type="submit" name="register-business" style="width: 100%;" class="the-form-btn btn btn-full btn-l font-600 font-15 gradient-highlight mt-4 rounded-s">
                                Submit Details
                            </button>
                        </div>
                    </fieldset>
                </form>
            </div>
        </div>

<div class="container m-3">
    <div class="btn btn-success mb-5">Submitted Business</div>
    <?php 
    if (!empty($data2)) {
        foreach ($data2 as $list) { 
            // Determine the certificate type
            $type = $list->certType == "biz" ? "Business Name Registration" : "Limited Liability Registration";
            $statusClass = '';
            switch (strtolower($list->status)) {
                case 'Pending':
                    $statusClass = 'text-primary';
                    break;
                case 'Rejected':
                    $statusClass = 'text-danger';
                    break;
                case 'Approved':
                    $statusClass = 'text-success';
                    break;
                default:
                    $statusClass = 'color-theme';
            }
    ?>
    
        <div class="d-flex">
            <div class="align-self-center">
                <span class="icon icon-s gradient-green color-white rounded-sm shadow-xxl">
                    <img src="../../assets/images/cac.png" style="width:50px; height:50px;" /> 
                </span>
            </div>
            <div class="align-self-center">
                <h6 class="ps-3 font-12 mt-3 color-theme opacity-70">
                    <b><?php echo $type; ?></b><br>
                    <?php echo $list->comp_name; ?>, <?php echo $list->alt_comp_name; ?>
                </h6>
            </div>
            <div class="ms-auto text-end align-self-center">
                <h5 class="font-15 font-700 d-block mb-n1 <?php echo $statusClass; ?>">
                    <?php echo $list->status; ?>
                </h5>
                <span class="color-green-dark font-10">
                    <?php echo $controller->formatDate2($list->submit_date); ?> 
                    <i class="fa fa-check-circle"></i>
                </span>
            </div>
        </div> 
        <p class="text-danger"><b>PROCESS: Your CAC is <?php echo $list->status; ?>: </b> <?php echo $list->note;?>.</p>
    
        <div class="divider my-3"></div>
    <?php 
        } 
    } else {
        echo "<p>No submitted business found.</p>";
    }
    ?>
</div>

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