<div class="container index-container">
    <img src="/public/img/resourcemanager/loading.gif" id="loading_gif" />

    <label for="col-md-12 col-form-label"> <?= $prodInfo ?></label>

    <form method="post" action="" id="order-form" enctype="multipart/form-data">
        <input type="hidden" name="product_id" id="product_id" value="<?= $product->id ?>">
        <input type="hidden" id="price" value="<?= $product->price ?>">
        <input type="hidden" id="price_inclLive" value="<?= $livePrice ?>">
        <input type="hidden" id="price_credit" value="<?= $product->credit ?>">
        <input type="hidden" id="price_hl_prot" value="<?= $hl_price ?>">
        <input type="hidden" id="price_prev_softwares" value="<?= $prev_sw_price ?>">
        <input type="hidden" id="sub_comment" value="<?= $sub_comment ?>">
        <input type="hidden" id="price_floating_lic" value="<?= $floatingPrice ?>">
        <input type="hidden" id="lanPrice" name="lanPrice" value="<?= $lanPrice ?>">
        <input type="hidden" id="prod_category" name="prod_category" value="<?= $product->kategoria ?>">

        <?php if (!empty($modules)) : ?>
            <input type="hidden" id="price_module" value="<?= $modules->price ?>">
        <?php endif; ?>

        <div class="row">
            <?php if ($product->credit != '' && $product->credit != null && $product->credit > 0) : ?>
                <div class="col-md-12 credit-div">
                    <div class="form-group row">
                        <label class="col-md-12 col-form-label">
                            <span id="credit_name" class="bordered">Order Compensation Credit:</span><span class="bordered"><?= $currency ?> <span id="credit_price"><?= $product->credit ?></span></span>
                        </label>
                    </div>
                </div>
            <?php endif; ?>

            <div class="col-md-8">
                <h3>End User Details</h3> <label>(Please fill out all required fields)</label>
                <hr>

                <div class="form-group col-md-6">
                    <label for="name">Name *</label>
                    <input type="text" name="name" class="form-control" id="name" required>
                    <div id="name-error"></div>
                </div>
                <div class="form-group col-md-6">
                    <label for="usr_email">E-mail *</label>
                    <input type="email" name="email" class="form-control" id="usr_email" required>
                    <div id="usr_email-error"></div>
                </div>

                <?php if ($product->kategoria == 'nonp'): ?>
                    <div class="form-group col-md-12">
                        <label for="info">End User Type *</label>

                        <div class="row col-md-12">
                            <label class="radio-inline"><input id="student" type="radio" name="user_type" onclick="handleClick(this);" value="student">Student</label>
                            <label class="radio-inline"><input id="pot_client" type="radio" name="user_type" onclick="handleClick(this);" value="pot_client">Potencial Client</label>
                        </div>

                        <div class="row col-md-12">
                            <div id="radio-error"></div>
                        </div>
                    </div>

                    <div id="info-div-student">
                        <div class="form-group col-md-6">
                            <label for="school_name">Name of School *</label>
                            <input type="text" name="school_name" class="form-control" id="school_name" autocomplete="school_name">
                            <div id="school_name-error"></div>
                        </div>
                        <div class="form-group col-md-6">
                            <label for="course_name">Name of Course *</label>
                            <input type="text" name="course_name" class="form-control" id="course_name" autocomplete="course_name">
                            <div id="course_name-error"></div>
                        </div>
                    </div>

                    <div id="info-div-pot">
                        <div class="form-group col-md-6">
                            <label for="pot_phone">Phone Number *</label>
                            <input type="text" name="pot_phone" class="form-control" id="pot_phone" autocomplete="pot_phone">
                            <div id="pot_phone-error"></div>
                        </div>
                        <div class="form-group col-md-6">
                            <label for="pot_address">Postal Code *</label>
                            <input type="text" name="pot_address" class="form-control" id="pot_address" autocomplete="pot_address">
                            <div id="pot_address-error"></div>
                        </div>

                        <div class="form-group col-md-6">
                            <label for="pot_company">Company *</label>
                            <input type="text" name="pot_company" class="form-control" id="pot_company" autocomplete="pot_company">
                            <div id="pot_company-error"></div>
                        </div>
                        <div class="form-group col-md-6">
                            <label for="pot_company_address">Address (City, street, no.) *</label>
                            <input type="text" name="pot_company_address" class="form-control" id="pot_company_address" autocomplete="pot_company_address">
                            <div id="pot_company_address-error"></div>
                        </div>
                    </div>
                <?php endif; ?>

                <?php if ($product->kategoria == 'comp') : ?>
                    <div class="form-group col-md-12" id="info-label">
                        <label for="info">Competing product name *</label>
                        <textarea id="info" name="info" cols="100%" name="notes" class="form-control" tabindex="14"></textarea>
                        <div id="info-error"></div>
                    </div>
                <?php else : ?>
                    <div class="form-group col-md-12" id="info-label">
                        <label for="info">Information</label> (optional)
                        <textarea id="info" name="info" cols="100%" name="notes" class="form-control" tabindex="14"></textarea>
                    </div>
                <?php endif; ?>

                <h3>Software details</h3>
                <hr>

                <?php if (file_exists(APPPATH . "views/weborder/categories/{$product->kategoria}" . EXT)) : ?>
                    <?= $this->load->view("weborder/categories/{$product->kategoria}.php"); ?>
                <?php endif; ?>

                <?php if ($cert_info) : ?>
                    <div class="form-group col-md-12 file-div">
                        <?php if ($product->kategoria == 'nonp'): ?>
                            <div id="stud-div">
                                <label>Upload the student ID card proving eligibility (jpg, png, jpeg, pdf, bmp)</label>
                                <div class="col-md-12 input-group">
                                    <input class="form-control" type="text" id="file_name" readonly />
                                    <div class="input-group-btn">
                                        <label for="file" class="btn btn-default">browse</label>
                                        <input id="file" type="file" name="file" class="btn btn-default" accept="image/png, image/jpeg, image/jpg, image/bmp, application/pdf" style="visibility:hidden;" />
                                    </div>
                                </div>
                                <div id="file-error"></div>
                            </div>
                        <?php else: ?>
                            <label>Upload Enrollment Certification (jpg, png, jpeg, pdf, bmp)</label>
                            <div class="col-md-12 input-group">
                                <input class="form-control" type="text" id="file_name" readonly />
                                <div class="input-group-btn">
                                    <label for="file" class="btn btn-default">browse</label>
                                    <input id="file" type="file" name="file" class="btn btn-default" accept="image/png, image/jpeg, image/jpg, image/bmp, application/pdf" style="visibility:hidden;" />
                                </div>
                            </div>
                            <div id="file-error"></div>
                        <?php endif; ?>
                    </div>
                <?php endif; ?>

                <?php if ($needLive && $product->id != 2117 && $product->id != 2118) : ?>
                    <div class="col-md-12 live-div">
                        <label class="pointer" for="inclLive">
                            <input type="checkbox" name="inclLive" id="inclLive" class="pointer price-select"> <span id="inclLive_name">Including LIVE</span>
                        </label>
                    </div>
                <?php endif; ?>

                <?php if ($modules && !empty($modules) && ($params->number_of_programs == '' || $params->number_of_programs < 2)) : ?>
                    <div class="col-md-12 live-div">
                        <label class="pointer" for="module">
                            <input type="checkbox" name="module" id="module" class="pointer price-select"> <span id="module_name">Including MEP module</span>
                        </label>
                    </div>
                <?php endif; ?>

                <div class="form-group col-md-12">
                    <label for="security">Prove you are human, solve this, please *</label>
                    <input type="text" id="security" name="security" class="form-control" placeholder="" required />
                    <div id="security-error"></div>
                    <div id="wrong-security-error"></div>
                </div>

                <?php if ($country == 99) : ?>
                    <div class="form-group col-md-12">
                        <label for="customPriceTxt">Custom price</label>
                        <input type="text" id="customPriceTxt" name="customPriceTxt" class="form-control" placeholder="" required />
                        <input type="hidden" id="customPrice" name="customPrice" class="form-control" placeholder="" required />
                    </div>

                    <div class="form-group col-md-4">
                        <button type="button" id="updatePriceBtn" class="btn btn-primary">Update Price</button>
                    </div>
                <?php endif; ?>
            </div>

            <div class="col-md-4 frame">
                <div class="form-group col-md-12">
                    <label for="postcode">
                        <h3>Order</h3>
                    </label>
                </div>
                <br />

                <div class="form-group col-md-8">
                    <label for="postcode">Product</label>
                </div>
                <div class="form-group col-md-4 right-div">
                    <label for="postcode">Price</label>
                </div>

                <div class="form-group col-md-12 hr-div">
                    <hr>
                </div>

                <div class="form-group col-md-8 upper-div">
                    <label for="item-name"><?= $product->termek ?></label>

                    <?php if ($product->kategoria == 'lan') : ?>
                        <br>
                        (Quantity: <span class="prod-quantity">1</span>)
                    <?php endif; ?>
                </div>
                <div class="form-group col-md-4 right-div upper-div">
                    <label for="item-price"><span class="curr"><?= $currency ?></span>
                        <?php if ($product->incl_live == 1) : ?>
                            <?= $bundleProfPrice ?>
                        <?php else : ?>
                            <span class="item-price-amount"><?= $sub_comment ? $sub_price : $product->price ?></span>
                        <?php endif; ?>
                    </label>
                </div>

                <?php if ($product->incl_live == 1) : ?>
                    <div class="form-group col-md-12 hr-div">
                        <hr>
                    </div>

                    <div class="form-group col-md-8 upper-div">
                        <label for="item-name"><?= $bundleLiveName ?></label>
                    </div>
                    <div class="form-group col-md-4 right-div upper-div">
                        <label for="item-price"><span class="curr"><?= $currency ?></span> <?= $bundleLivePrice ?></label>
                    </div>
                <?php endif; ?>

                <?php if ($sub_comment) : ?>
                    <div class="form-group col-md-8 upper-div">
                        Quantity: 3 months
                    </div>
                    <div class="form-group col-md-4 right-div upper-div">
                        <?= $currency ?> <?= $sub_price ?> each
                    </div>
                <?php endif; ?>

                <div class="form-group col-md-12 hr-div">
                    <hr>
                </div>

                <div id="optional_products"></div>

                <div class="form-group col-md-8 upper-div">
                    <label for="item-name">Total Amount</label>
                </div>
                <div class="form-group col-md-4 right-div upper-div">
                    <label for="item-price"><span class="curr"><?= $currency ?></span> <span id="total_price"><?= $product->price ?></span></label>
                </div>

                <div class="form-group col-md-12 hr-div">
                    <hr>
                </div>

                <div class="form-group col-md-12">
                    <h4>Purchase confirmations</h4>
                </div>

                <div id="inst">

                </div>

                <?php if ($product->credit != '' && $product->credit != null && $product->credit > 0) : ?>
                    <div class="form-group col-md-12">
                        <label class="pointer"><input type="checkbox" id="credit" name="credit" class="pointer price-select"> I want to deduct my order compensation credit</label>
                    </div>
                <?php endif; ?>

                <div class="form-group col-md-12">
                    <label class="pointer"><input type="checkbox" class="pointer" name="informed" required> I confirm I'm informed on the products</label>
                    <div id="informed-error"></div>
                </div>

                <div class="form-group col-md-12">
                    <label class="pointer"><input type="checkbox" class="pointer" name="privacy" required>
                        I confirm that my client, whose personal details I am submitting above, has understood and accepted the
                        <a href="https://www.archlinexp.com/legal/privacy-policy" target="_blank">CadLine Privacy Policy</a>
                    </label>
                    <div id="privacy-error"></div>
                </div>

                <div class="form-group col-md-12" style="text-align: center;">
                    <button type="button" id="pay_btn" name="pay_btn" class="btn btn-primary btn-lg">Send Order</button>
                </div>
            </div>
        </div>
    </form>
</div>