<!DOCTYPE html>
<html>

<head>
    <meta name='robots' content='noindex, nofollow' />
    <meta charset="UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="HandheldFriendly" content="true">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Referral Thank You | Niagara Dental Implant & Oral Surgery</title>
    <meta property="og:title" content="Referral Thank You">
    <link rel="icon" href="/lp-asset/lp-images/favicon-1icon.png">
    <link rel="stylesheet preload" as="style" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.css">
    <link rel="stylesheet preload" as="style" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/lp-asset/referral-thank-you.css">
    <!-- Google Tag Manager -->
		<script>(function (w, d, s, l, i) {
				w[l] = w[l] || []; w[l].push({
					'gtm.start':
						new Date().getTime(), event: 'gtm.js'
				}); var f = d.getElementsByTagName(s)[0],
					j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
						'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
			})(window, document, 'script', 'dataLayer', 'GTM-MMTZMMF');</script>
		<!-- End Google Tag Manager -->
</head>

<body>
		<!-- Google Tag Manager (noscript) -->
		<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MMTZMMF" height="0" width="0"
				style="display:none;visibility:hidden"></iframe></noscript>
		<!-- End Google Tag Manager (noscript) -->
    <?php 
        include('code/db.php');
        $referral_id = isset($_REQUEST['referral_id']) ? $_REQUEST['referral_id'] : '';
        $query = $db->query("select * from wp_referral_form where id = '".base64_decode($referral_id)."' ");
	    $data = $query->fetch();
    ?>
    <section class="referral-thankyou-main">
        <div class="referral-thankyou-section">
            <div class="banner-contant">
                <div class="container">
                    <div class="row">
                        <div class="col-12">
                            <div class="thank-you-logo">
                                <img src="/lp-asset/lp-images/logo-new.svg" alt="header-logo">
                            </div>
                            <div class="wording-text"></div>
                            <div class="thank-you-content">
                                <h1>Thank you for your referral.</h1>
                                <span>We will get in contact with the patient shortly</span>
                                <form method="POST" action="" class="upload-x-ray-form" enctype="multipart/form-data" <?php echo (!empty($data['attachment']) ? 'style="display:none"' : '') ?>>
                                    <div class="form-group upload-x-ray">
                                        <!-- <label class="" style="color: #3b598a">Upload X-ray</label> -->
                                        <label for="file" class="input-file" style="padding: 12px 24px; vertical-align: middle; border: 1px solid #3b598a; border-radius: 6px; margin-bottom: 0; cursor:pointer;">
                                            <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" x="0" y="0" viewBox="0 0 512.056 512.056" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M426.635 188.224C402.969 93.946 307.358 36.704 213.08 60.37 139.404 78.865 85.907 142.542 80.395 218.303 28.082 226.93-7.333 276.331 1.294 328.644c7.669 46.507 47.967 80.566 95.101 80.379h80v-32h-80c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64 8.837 0 16-7.163 16-16-.08-79.529 64.327-144.065 143.856-144.144 68.844-.069 128.107 48.601 141.424 116.144a16 16 0 0 0 13.6 12.8c43.742 6.229 74.151 46.738 67.923 90.479-5.593 39.278-39.129 68.523-78.803 68.721h-64v32h64c61.856-.187 111.848-50.483 111.66-112.339-.156-51.49-35.4-96.241-85.42-108.46z" fill="#3b598a" opacity="1" data-original="#3b598a" class=""></path><path d="m245.035 253.664-64 64 22.56 22.56 36.8-36.64v153.44h32v-153.44l36.64 36.64 22.56-22.56-64-64c-6.241-6.204-16.319-6.204-22.56 0z" fill="#3b598a" opacity="1" data-original="#3b598a" class=""></path></g></svg>
                                            <div class="label-content" style="margin-top: 10px;">
                                                <p style="margin-bottom: 0; font-size: 18px; color: #3b598a;">Upload X-Ray</p>
                                            </div>
                                        </label>
                                        <input type="file" name="xray" class="form-control" id="file" multiple style="display: none;">
                                        <div class="error-x-ray-div" style="display:none; margin-bottom: 10px; color: #b60000c9; ">
                                            Invalid file type! Allowed: Images (jpg, jpeg, png, webp, svg, heic, heif), PDF, DOC/DOCX.
                                        </div>
                                        <span style="padding: 12px 10px;">Allowed: Images (jpg, jpeg, png, webp, svg, heic, heif), PDF, DOC/DOCX</span>
                                    </div>
                                </form>
                                <div class="uploaded-x-ray-div" style="display:none; margin-bottom: 10px; color: #00b600; ">
                                    Your X-ray uploaded successfully
                                </div>
                            </div>
                            <div class="banner-btn">
                                <p><a href="https://www.niagaraoms.com/">GO TO HOME <i class="fa fa-home" aria-hidden="true"></i> </a></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.1.62/jquery.inputmask.bundle.js"></script>
    <script>
        function getUrlVars() {
            var vars = [],
                hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
        var referral_id = '<?php echo $referral_id ?>';
        if (referral_id) {
            jQuery(".wording-text").append('<a href="/referral_page_pdf.php?referral_id=' + referral_id + '" target="_blank" >Click Here To Download And Print The Referral Form</a>');
        }

        jQuery("#file").change(function(){
            jQuery('.error-x-ray-div').hide();
        var file = jQuery(this)[0].files[0];
        if (!file) return;
    
        // Allowed extensions
        var allowedExt = [
            "jpg","jpeg","png","webp","svg","heic","heif",
            "pdf","doc","docx"
        ];
    
        var ext = file.name.split('.').pop().toLowerCase();
    
        if (allowedExt.indexOf(ext) === -1) {
            jQuery(this).val(""); // reset file input
            jQuery('.error-x-ray-div').show();
            return;
        }
        
            var formData = new FormData();
          formData.append('upload', jQuery(this)[0].files[0]);
            jQuery.ajax({
                url: "code/add_attachment.php?referral_id="+referral_id,
                type: "POST",
                // THIS MUST BE DONE FOR FILE UPLOADING
                contentType: false,
                processData: false,
                data: formData,                         
                beforeSend: function() {
                    jQuery('#file').prop('disabled', 'true');
                    jQuery('.upload-x-ray').html('processing<i class="fa fa-spinner fa-spin" style="font-size:24px;margin-left: 10px;"></i>');
                },
                success: function(data) {
                    jQuery('.upload-x-ray-form').css('display','none');
                    jQuery('.uploaded-x-ray-div').css('display','block');
                }
            });
        });
    </script>
</body>

</html>