<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="/public/css/site.css?time=<?= time() ?>">

    <script src="/public/js/jquery/jquery.min.js"></script>
    <script src="/public/js/bootstrap/bootstrap.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>
    <script src="/public/js/sweetalert/sweetalert.min.js"></script>
    <script src="/public/js/weborder.js?time=1669702736"></script>

    <title><?= $title ?></title>

    <style>
        .arrow {
            border: solid #337ab7;
            border-width: 0 3px 3px 0;
            display: inline-block;
            padding: 3px;
        }

        .left {
            transform: rotate(135deg);
            -webkit-transform: rotate(135deg);
        }
    </style>
</head>

<body>
    <div class="container index-container">
        <?php if ($error != '') : ?>
            <div class="alert alert-danger" style="margin-top: 30px; margin-left: -20%">
                <strong><?= $error ?></strong>
            </div>
        <?php endif; ?>

        <img src="/public/img/resourcemanager/loading.gif" id="loading_gif" />

        <a href="https://www.archlinexp.com/buy/update" style="text-decoration: underline;"><i class="arrow left"></i>Back to update</a>
        <h2 style="text-align: center;"><?= $header ?></h2>
        <br>

        <form id="update-form" method="post" action="/update/order_update" enctype="multipart/form-data">
            <input type="hidden" name="productId" value="<?= $product->id ?>">
            <input type="hidden" id="normalPrice" value="<?= $normalPrice ?>">
            <input type="hidden" id="brutPrice" value="<?= $brut_normal ?>">

            <div class="row">
                <div class="col-md-8">
                    <h3>End User Details</h3> <label>(Please specify name and email belonging to end user precisely)</label>
                    <hr>

                    <div class="form-group col-md-6">
                        <label for="name">Name *</label>
                        <input type="text" name="name" class="form-control" id="name" value="<?= $update_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" value="<?= $update_email ?>" required>
                        <div id="usr_email-error"></div>
                    </div>

                    <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" value="<?= $update_info ?>" tabindex="14"></textarea>
                    </div>

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

                    <div class="form-group col-md-12" style="margin-bottom: 30px !important;">
                        <label for="old_hl_number">Enter your current Serial Number (16 digits) <?= $star ?></label>
                        <input type="text" name="old_hl_number" class="form-control" id="old_hl_number" value="<?= $update_old_hl_number ?>" required>
                        <div id="old_hl_number-error"></div>
                        <div id="wrong_hl_num-error"></div>
                    </div>

                    <?php if ($product->cont_id == 0) : ?>
                        <div class="col-md-2">
                            <label for="years">Fix price for: </label>
                        </div>

                        <div class="col-md-10">
                            <select name="years-select" id="years-select" class="form-control col-md-6" required>
                                <option value="2" <?= $update_years == 2 ? 'selected' : '' ?>>2 years</option>
                                <option value="3" <?= $update_years == 3 ? 'selected' : '' ?>>3 years</option>
                            </select>
                        </div>

                        <div class="form-group col-md-12">
                            <div id="years-select-error"></div>
                            <div id="years-select-error"></div>
                        </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>
                </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 ?> <?= $product->cont_id == 0 ? 'Fix price for <span id="update-year">' . $update_year . '</span> years' : '' ?></label>
                    </div>
                    <div class="form-group col-md-4 right-div upper-div">
                        <label for="item-price"><span id="normal_price">€ <?= $product->price ?></span></label>
                    </div>

                    <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>
                        <br>

                        <p>Price exclude VAT</p>
                    </div>
                    <div class="form-group col-md-4 right-div upper-div">
                        <label for="item-price"><span id="total_price">€ <?= $brut ?></span></label>
                    </div>

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

                    <div class="form-group col-md-12">
                        <h4><?= $purchase ?></h4>
                    </div>

                    <div class="form-group col-md-12">
                        <label class="pointer"><input type="checkbox" class="pointer" name="informed" required> <?= $informed ?></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 me or 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;">
                        <input type="submit" name="update_btn" class="btn btn-primary btn-lg" value="<?= $btn ?>">
                    </div>
                </div>
            </div>
        </form>
    </div>
</body>

</html>