Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/member/
Upload File :
Current File : /home2/wtmwscom/public_html/member/index_1.php

<?php
$title= "Dashboard";
include 'header.php';
$uid = $_SESSION['userid'];

$total_give_help = mysqli_fetch_object(mysqli_query($connection,"SELECT SUM(amount) as amount FROM commit WHERE uid='$uid' AND lock_status=0"))->amount;
if(!$total_give_help){$total_give_help=0;}

$confirm_give_help = mysqli_fetch_object(mysqli_query($connection,"SELECT SUM(amount) as amount FROM commit WHERE uid='$uid' AND confirm_status=1"))->amount;
if(!$confirm_give_help){$confirm_give_help=0;}

$total_get_help = mysqli_fetch_object(mysqli_query($connection,"SELECT SUM(amount) as amount FROM help WHERE receive_uid='$uid' AND lock_status=0"))->amount;
if(!$total_get_help){$total_get_help=0;}

$confirm_get_help = mysqli_fetch_object(mysqli_query($connection,"SELECT SUM(amount) as amount FROM help WHERE receive_uid='$uid' AND confirm_status=1"))->amount;
if(!$confirm_get_help){$confirm_get_help=0;}

/*
$total_business_give_help = 0;
$confirm_business_give_help = 0;

$child_ids = get_child_ids_1($uid);
$child_levels = get_child_levels($child_ids);

foreach($child_levels as $key => $value){
    $sum_total_business = mysqli_fetch_object(mysqli_query($connection,"SELECT SUM(amount) as amount FROM commit WHERE uid='$value' AND lock_status=0"))->amount;
    if($sum_total_business){$sum_total_business = $sum_total_business;}else{$sum_total_business = 0;}
    
    $sum_confirm_business = mysqli_fetch_object(mysqli_query($connection,"SELECT SUM(amount) as amount FROM commit WHERE uid='$value' AND confirm_status=1"))->amount;
    if($sum_confirm_business){$sum_confirm_business = $sum_confirm_business;}else{$sum_confirm_business = 0;}
    
    $total_business_give_help = $total_business_give_help+$sum_total_business;
    $confirm_business_give_help = $confirm_business_give_help+$sum_confirm_business;
} */
?>
<link href="../static/backend/css/button.css" rel="stylesheet" type="text/css">

 <div class="container-fluid">
<?php echo getMessage();?>
    <div class="row">
        <div class="col-sm-12">
            <div class="page-title-box">
                <h4>Welcome <?php echo $_SESSION['name'] . " (" . $_SESSION['loginid'] . ")"; ?></h4>
                <div class="page-title-box">
                    <h4 class="page-title">Referral Links</h4>
                    <div>
                     <strong><a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/register.php?loginid=<?php echo $_SESSION['loginid']; ?> target="_blank" title="Friends Invite Link">http://<?php echo $_SERVER['SERVER_NAME']; ?>/register.php?loginid=<?php echo $_SESSION['loginid']; ?></a></strong><br>
                    </div>
                </div>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="javascript:void(0);">Home</a></li>
                    <li class="breadcrumb-item"><a href="javascript:void(0);">Index</a></li>
                    <!--                    <li class="breadcrumb-item active">Outbox</li>-->
                </ol>

             
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xl-3 col-md-6">
            <div class="card mini-stat bg-info">
                <div class="card-body mini-stat-img">
                    <div class="mini-stat-icon">
                        <i class="mdi mdi-account-circle float-right"></i>
                    </div>
                    <div class="text-white">
                        <h6 class="text-uppercase mb-3">Total Provide Help</h6>
                        <center><b><p><?php echo $total_give_help."Rs.";?> </p></b></center> 
                        <!--<span class="badge badge-info"> +11% </span> <span class="ml-2"><a href="view_profile.php" class="btn btn-info active pull-right" role="button"  >View Profile</a></span>-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xl-3 col-md-6">
            <div class="card mini-stat bg-danger">
                <div class="card-body mini-stat-img">
                    <div class="mini-stat-icon">
                        <i class="mdi mdi-buffer float-right"></i>
                    </div>
                    <div class="text-white">
                        <h6 class="text-uppercase mb-3">Confirm Provide Help</h6>
                       <center><b><p><?php echo $confirm_give_help."Rs.";?> </p></b></center> 
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xl-3 col-md-8">
            <div class="card mini-stat bg-primary">
                <div class="card-body mini-stat-img">
                    <div class="mini-stat-icon">
                        <i class="mdi mdi-account-multiple float-right"></i>
                    </div>
                    <div class="text-white">
                        <h6 class="text-uppercase mb-3">Total Get Help</h6>
                      <center><b><p><?php echo $total_get_help."Rs.";?> </p></b></center> 
                    </div>
                </div>
            </div>
        </div>
        <div class="col-xl-3 col-md-6">
            <div class="card mini-stat bg-success">
                <div class="card-body mini-stat-img">
                    <div class="mini-stat-icon">
                        <i class="mdi mdi-account-card-details float-right"></i>
                    </div>
                    <div class="text-white">
                        <h6 class="text-uppercase mb-3">Confirm Get Help</h6>
                        <center><b><p><?php echo $confirm_get_help."Rs.";?> </p></b></center> 
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- end row -->
    <div class="row">
        <div class="col-xl-6">
            <div class="card widget-user m-b-20">
                <div class="widget-user-desc p-4 text-center bg-info position-relative">
                    <i class="fas fa-quote-left h3 text-white-50"></i>
                    <p class="text-white mb-0">Activate Pin </div>
                <div class="p-4">
                    <div class="float-left mt-2 mr-3">
                        <!--<img src="assets/images/users/user-2.jpg" alt="" class="rounded-circle thumb-md">-->
                    </div>
                    <!--<h6 class="mb-1">Marie Minnick</h6>-->
<!--                    <p class="text-muted mb-0">Marketing Manager</p>-->
<?php //if (isset($_SESSION['is_paid']) && $_SESSION['is_paid'] == 0) {  ?>
                    <h4>Activate member account</h4>
                    <button class="btn btn-success"  data-toggle="modal" data-target="#myModal">Click here to activate by pin</button>
                    <?php
                    //} 
//else { 
                    ?>
                    <!--        <h4>Upgrade your account</h4>
                            <button class="btn btn-success" onclick="upgrade_user_plan()">Click here to upgrade your account</button>-->
<?php //}    ?>

                </div>


            </div>
            <!--            <div class="card m-b-20">
                            <div class="card-body">
                                <h4 class="mt-0 header-title">Yearly Sales</h4>
                                <div class="row">
                                    <div class="col-md-4">
                                        <div>
                                            <h4>52,345</h4>
                                            <p class="text-muted">The languages only differ grammar</p>
                                            <a href="#" class="text-primary">Learn more <i class="mdi mdi-chevron-double-right"></i></a>
                                        </div>
                                    </div>
                                    <div class="col-md-8 text-right">
                                        <div id="sparkline"></div>
                                    </div>
                                </div>
                            </div>
                        </div>-->

        </div>
    <div class="col-6">
        <div class="card widget-user m-b-5">
             <div class="card widget-user m-b-5">
                <div class="widget-user-desc p-4 text-center bg-danger position-relative">
                    <i class="fas fa-quote-left h6 text-white-50"></i>
                    <p class="text-white mb-0">Search From Date</div>
            <div class="card m-b-10">
                <div class="card-body">
                    <div class="card-body">
                        <form class="form-inline" id="search-form" >
                            <div class="form-group " >
                                <label class="form-control " > From Date: </label>
                                <input type="text"  class="form-control datepicker"  placeholder="From date" name="from_date" autocomplete="off">
                            </div>&nbsp;&nbsp;
                            <div class="form-group">
                                <label class="form-control "> To date: </label>
                                <input type="text" class="form-control datepicker"  placeholder="To date" name="to_date" autocomplete="off" >
                            </div>&nbsp;&nbsp;
                              
                            <button type="submit" class="btn btn-primary">Search</button>
                        </form>
                    </div>
                  
                </div>
            </div>
        </div>
        </div> <!-- end col -->
    </div>
 </div>                                   
 <div class="row">
        <div class="col-xl-6">
            <div class="card widget-user m-b-20">
                <div class="widget-user-desc p-4 text-center bg-primary position-relative">
                    <i class="fas fa-quote-left h3 text-white-50"></i>
                    <p class="text-white mb-0">Provide Help</div>
                <div class="p-4">
                    <center> <a href="provide_help.php" class="button large gradient orange"> &Implies; Provide Help</a></center>
                </div>
            </div>
        </div>
    <div class="col-6">
        <div class="card widget-user m-b-5">
             <div class="card widget-user m-b-5">
                <div class="widget-user-desc p-4 text-center bg-success position-relative">
                    <i class="fas fa-quote-left h6 text-white-50"></i>
                    <p class="text-white mb-0">Get Help</div>
                 <div class="p-4">
                      <center><a href="receive_help.php" class="button large gradient blue"> &Implies; Get Help</a></center>
                 </div>
                
        </div>
        </div> <!-- end col -->
    </div>
 </div>
 </div>
<section style="width: 17%; float: right;">
    <?php 
    $rs = mysqli_query($connection,"SELECT commit_id, amount, amount_2, confirm_status, datetime FROM commit WHERE uid='$uid'");
    while($give = mysqli_fetch_object($rs)){
    ?>
    <div class="trequest">
        <div class="getrequest">
            <h3>Provide help <img style="height:10px;width:10px;" src="images/arrow_up.png" /></h3>
            <p>
                <small>Total Amount: <b><?php echo $give->amount;?>/-</b></small>
                <br>
                <small>Amount provided: <b><?php echo $give->amount-$give->amount_2;?>/-</b></small>
                <br>
                <small>Request No. <?php echo $give->commit_id?></small><br/>
            <small>Status: <?php echo $give->confirm_status == 1?"Order processed":"Order Queued"?></small>
                <br/>
                 <small>Date: <?php echo date("d M,Y H:i A", strtotime($give->datetime));?></small><br/>
                 <?php if($give->amount==$give->amount_2) {?>
                 <small><a href="javascript:void;" onclick="if(confirm('Are you sure you want to cancel provide help?')){window.location='./provide_help_cancel.php?commit_id=<?php echo $give->commit_id;?>';}">Cancel provide help</a></small>
                 <?php }?>
            </p>
        </div>
    </div>
    <?php }?>
    <?php 
    $rs2 = mysqli_query($connection,"SELECT uid, amount, balance, datetime FROM request_amount WHERE uid='$uid' ORDER BY datetime DESC");
    while($receive = mysqli_fetch_object($rs2)){
    ?>
    <div class="trequest">
        <div class="giverequest">
            <h3>Get help <img style="height:10px;width:10px;" src="../static/backend/member/images/arrow_down.png" /></h3>
            <p>
                <small>Amount: <b><?php echo $receive->amount;?>/-</b></small>
                <br>
                Date: <small><?php echo date("d M,Y H:i A", strtotime($receive->datetime));?></small>
            </p>
        </div>
    </div>
    <?php }?>
</section>
<section style="float: left; width: 82%;">
    <?php
    $result = mysqli_query($connection,"SELECT help_id, commit_id, give_uid, r_commit_id, receive_uid, amount, datetime, confirm_status, lock_status, extend, status FROM help WHERE give_uid='".$uid."' OR receive_uid='".$uid."'");
    if(mysqli_num_rows($result)){
        $i=1;
        while ($row = mysqli_fetch_object($result)){
            $donar = mysqli_fetch_object(mysqli_query($connection,"SELECT * FROM user WHERE uid='".$row->give_uid."'"));
            $donar_sponsor = mysqli_fetch_object(mysqli_query($connection,"SELECT uid, login_id, name, email, mobile FROM user WHERE uid='".$donar->refer_id."'"));
            
            $receiver = mysqli_fetch_object(mysqli_query($connection,"SELECT * FROM user WHERE uid='".$row->receive_uid."'"));
            $receiver_sponsor = mysqli_fetch_object(mysqli_query($connection,"SELECT uid, login_id, name, email, mobile FROM user WHERE uid='".$receiver->refer_id."'"));
            
            //$hours = 120+$row->extend;
            $hours = 48+$row->extend; //modified by jay
            $date = new DateTime($row->datetime);
            $date->modify("+".$hours." hours");
            $timeIn = $date->format('Y-m-d H:i:s');

            $hourdiff = round((strtotime($timeIn) -time())/3600, 1);
            //$hourdiff = $hourdiff<0?0:$hourdiff;
            $message_count = mysqli_fetch_object(mysqli_query($connection,"SELECT COUNT(help_id) as count FROM bank_receipt WHERE help_id='$row->help_id'"))->count;
            if($message_count){$message_count = $message_count;}else{$message_count = 0;}
    ?>
    <script>
        $(function() {
        $( "#dialog<?php echo $i?>" ).dialog({ autoOpen: false });
        $( "#opener<?php echo $i?>" ).click(function() {
        $( "#dialog<?php echo $i?>" ).dialog( "open" );
        });
        $( "#dialog<?php echo $i?>" ).dialog({ minWidth: 650 });
        // getter
        var minWidth = $( ".selector" ).dialog( "option", "minWidth" );
        // setter
        $( ".selector" ).dialog( "option", "minWidth", 650 );
        });
    </script>
    <div class="torder">
        <div class="firstsection">
            <span title="Click To Accept" id="opener<?php echo $i?>" onclick="viewMyModal(<?php echo $i?>)">
                <?php if($row->confirm_status==1){?>
                <img style="height:70px; width:60px;" src="../static/backend/member/images/light_1.png">
                <?php }
                elseif($row->lock_status==1){?>
                <img style="height:70px; width:60px;" src="../static/backend/member/images/light_0.png">
                <?php }
                elseif($row->lock_status==0 && $row->status==0 && $row->confirm_status==0){?>
                <img style="height:70px; width:60px;" src="../static/backend/member/images/light_2.png"><?php }
                elseif($row->lock_status==0 && $row->status==1 && $row->confirm_status==0){?>
                <img style="height:70px; width:60px;" src="../static/backend/member/images/light_3.png">
                <?php }?>
            </span><br />
            <strong><span><?php echo $row->help_id;?></span></strong>
        </div>
        <div class="secondsection">
            <img src="../static/backend/member/images/light_1.png" class="clock">
            <?php 
            if($row->confirm_status!=1){
                if($row->lock_status!=1){?>
            <span class="timer">
                <strong>Remaining Hours: <?php echo $hourdiff;?></strong>
                <?php if($row->receive_uid==$uid){?>
                (<a href="#" title="Click To Extend Time" onclick="processExtend(<?php echo $row->help_id;?>);"><b>Extend Time</b></a>)
                <?php }?>
            </span>
            <?php }
            }?>
            <a class="tmessage openDialog" href="messages.php?help_id=<?php echo $row->help_id;?>">Messages: <?php echo $message_count;?></a>
        </div>
        <div class="secondsection">
            <div>
                <small>Date of creating</small>
                <br>
                <b><span>
                    <?php echo date("d M,Y", strtotime($row->datetime));?>
                        <br />
                    <?php echo date("H:i A", strtotime($row->datetime));?>
                    </span>
                </b>
            </div>
            <div class="from">
                <b><?php echo $donar->name;?></b>
                <br>
                <small><?php echo $donar->login_id;?></small><br>
                <small><?php echo $donar->bank_name;?></small>
                <br>
                <small><?php echo $donar->mobile;?></small>
            </div>
            <div class="from">
                <h2>
                   
                    <span><?php echo $row->amount;?></span>
                    <span>/-</span>
                </h2>
            </div>
            <div>
                <b><?php echo $receiver->name;?></b>
                <br>
                <small><?php echo $receiver->login_id;?></small><br>
                <small><?php echo $receiver->bank_name;?></small>
                <br>
                <small><?php echo $receiver->mobile;?></small>
            </div>
        </div>

        <div id="dialog<?php echo $i?>" title="Information">
            
            
            <div>
                <table>
                    <thead>
                        <tr>
                            <th colspan="2"></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="light">
                            <td>Donor Info</td>
                            <td><?php echo $donar->name." (".$donar->mobile.")";?></td>
                        </tr>
                        <tr class="dark">
                            <td>Donor Contact Info</td>
                            <td><?php echo $donar->address. ' '. $donar->city.' , '. $donar->country.", Mo: $donar->mobile";?></td>
                        </tr>
                        <tr class="light">
                            <td>Donor Sponsor Info</td>
                            <td><?php echo $donar_sponsor->name." (".$donar_sponsor->mobile.")";?></td>
                        </tr>
                    </tbody>
                    <thead>
                        <tr>
                            <th colspan="2"></th>
                        </tr>
                    </thead>
                    <tbody>                                
                        <tr class="light">
                            <td>Accepter Info</td>
                            <td><?php echo $receiver->name." (".$receiver->mobile.") ";?></td>
                        </tr>
                        <tr class="dark">
                            <td>Receiver Contact Info</td>
                            <td><?php echo $receiver->address. ' '. $receiver->city.' , '. $receiver->country.", Mo: $receiver->mobile";?></td>
                        </tr>
                        <tr class="light">
                            <td>Accepter Sponsor Info</td>
                            <td><?php echo $receiver_sponsor->name." (".$receiver_sponsor->mobile.")";?></td>
                        </tr>
                    </tbody>
                    <thead>
                        <tr>
                            <th colspan="2"></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="light">
                            <td>Requested Date</td>
                            <td><?php echo date("d M,Y H:i A", strtotime($row->datetime));?></td>
                        </tr>
                        <tr class="dark">
                            <td>Expiry date</td>
                            <td><?php echo date("d M,Y H:i A", strtotime($timeIn));?></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="top">
                <table>
                    <thead>
                        <tr>
                            <th colspan="2" style="text-align: left;">Bank Details</th>
                        </tr>
                    </thead>
                    <tbody>
<!--                        <tr class="dark">
                            <td>Bitcoin</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->bitcoin;}elseif($row->give_uid==$uid){echo $receiver->bitcoin;}?></td>
                        </tr>-->
                        <tr class="light">
                            <td>Paytm</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->paytm;}elseif($row->give_uid==$uid){echo $receiver->paytm;}?></td>
                        </tr>
                        <tr class="dark">
                            <td>G Pay</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->g_pay;}elseif($row->give_uid==$uid){echo $receiver->g_pay;}?></td>
                        </tr>
                        <tr class="light">
                            <td>Phone Pay</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->phone_pay;}elseif($row->give_uid==$uid){echo $receiver->phone_pay;}?></td>
                        </tr>
                        <tr class="dark">
                            <td>Account Holder Name</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->account_holder_name;}elseif($row->give_uid==$uid){echo $receiver->account_holder_name;}?></td>
                        </tr>
                        <tr class="dark">
                            <td>Bank Name</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->bank_name;}elseif($row->give_uid==$uid){echo $receiver->bank_name;}?></td>
                        </tr>
                        <tr class="light">
                            <td>Branch Name</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->branch_name;}elseif($row->give_uid==$uid){echo $receiver->branch_name;}?></td>
                        </tr>
                        <tr class="dark">
                            <td>Account Number</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->account_number;}elseif($row->give_uid==$uid){echo $receiver->account_number;}?></td>
                        </tr>
                        <tr class="light">
                            <td>Account Type</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->account_type;}elseif($row->give_uid==$uid){echo $receiver->account_type;}?></td>
                        </tr>
                        <tr class="dark">
                            <td>IFSC Code</td>
                            <td><?php if($row->receive_uid==$uid){echo $donar->ifsc;}elseif($row->give_uid==$uid){echo $receiver->ifsc;}?></td>
                        </tr>
                        <?php /*
                        <tr class="light">
                            <td>Account Holder Name</td>
                            <td><?php echo $receiver->account_holder_name;?></td>
                        </tr>
                        <tr class="dark">
                            <td>Bank Name</td>
                            <td><?php echo $receiver->bank_name;?></td>
                        </tr>
                        <tr class="light">
                            <td>Branch Name</td>
                            <td><?php echo $receiver->branch_name;?></td>
                        </tr>
                        <tr class="dark">
                            <td>Account Number</td>
                            <td><?php echo $receiver->account_number;?></td>
                        </tr>
                        <tr class="light">
                            <td>Account Type</td>
                            <td><?php echo $receiver->account_type;?></td>
                        </tr>
                        <tr class="dark">
                            <td>IFSC Code</td>
                            <td><?php echo $receiver->ifsc;?></td>
                        </tr>*/?>
                    </tbody>
                </table>
            </div>
            <?php  if(($row->give_uid==$uid) || ($row->receive_uid==$uid && $row->lock_status==0 && $row->confirm_status==0)){?>
            <div id="comments">
                <form action="<?php if($row->receive_uid==$uid){echo 'receiver_model.php';}elseif($row->give_uid==$uid){echo 'donor.php?help_id='.$row->help_id;}?>" onsubmit="return confirm('Are you sure for this request');" name="form" id="form" method="post">
                    <p>
                        <input type="hidden" name="help_id" value="<?php echo $row->help_id;?>" />
                        <input type="submit" class="btn btn-success" id="confirm" name="confirm" value="Confirm Fund Request" OnClick="" style="background: #51A351; color: #FFFFFF;" />
                        &nbsp;&nbsp;
                        <?php if($row->receive_uid==$uid){?>
                        <input type="submit" class="btn btn-danger" id="reject" name="reject" value="Reject Fund Request" OnClick="" style="background: #BD362F; color: #FFFFFF;" />
                        <?php }?>
                    </p>
                </form>
            </div>
            <?php }?>
        </div>
    </div>
    <!-- Modal -->
  <div id="myModal-<?php echo $i;?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div>
                <table>
                    <thead>
                        <tr>
                            <th>Request Number:</th>
                            <th><?php echo $row->help_id;?></th>
                            <th>Request Amount:</th>
                            <!--<th><?php echo "INR ".$row->amount." | $ ".$amount_in_usd." | BTC ".  round($priceOfYourItemBTC,4) ;?></td>-->
                          <th><?php echo "INR ".$row->amount ;?></td>
                       
                        </tr>
                    </thead>
                </table>
            </div>
<!--                <form class="form-horizontal" id="activate_pin_form" method="post">
                    <div class="modal-header">
                        <h5 class="modal-title mt-0" id="myModalLabel">Activate account by Pin</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    </div>
                    <div class="modal-body">
                                                                                        <h5>Activate account by Pin</h5>

                        <div class="form-group">
                            <label class="control-label col-sm-2" for="login_id">Login Id:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="login_id" onblur="get_user_detail(this.value);" id="login_id" placeholder="Enter login id">
                            </div>
                            <div class="col-sm-10" id="loginInfo">
                            </div>
                             <div class="col-sm-10" id="is_paid">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="pwd">Pin No:</label>
                            <div class="col-sm-10"> 
                                <input type="password" name="pin_no" class="form-control" id="pwd" placeholder="Enter password">
                            </div>
                        </div>



                    </div>
                    <div class="modal-footer">
                        <button type="submit"  class="btn btn-primary waves-effect waves-light">Activate NOw</button>
                        <button name="submit" id="submit" type="button" class="btn btn-secondary waves-effect" data-dismiss="modal">Close</button>
                    </div>
                </form>-->
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <?php
    $i++;
        }
    }
    ?>
</section>
     <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <form class="form-horizontal" id="activate_pin_form" method="post">
                    <div class="modal-header">
                        <h5 class="modal-title mt-0" id="myModalLabel">Activate account by Pin</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    </div>
                    <div class="modal-body">
                        <!--                                                                <h5>Activate account by Pin</h5>-->

                        <div class="form-group">
                            <label class="control-label col-sm-2" for="login_id">Login Id:</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="login_id" onblur="get_user_detail(this.value);" id="login_id" placeholder="Enter login id">
                            </div>
                            <div class="col-sm-10" id="loginInfo">
                            </div>
                             <div class="col-sm-10" id="is_paid">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="pwd">Pin No:</label>
                            <div class="col-sm-10"> 
                                <input type="password" name="pin_no" class="form-control" id="pwd" placeholder="Enter password">
                            </div>
                        </div>



                    </div>
                    <div class="modal-footer">
                        <button type="submit"  class="btn btn-primary waves-effect waves-light">Activate NOw</button>
                        <button name="submit" id="submit" type="button" class="btn btn-secondary waves-effect" data-dismiss="modal">Close</button>
                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

</div> <!-- container-fluid -->


<script>
    $(document).ready(function () {
        $("#activate_pin_form").submit(function (e) {
            //alert("Submitted");
            $.ajax({
                url: "pin_check.php",
                type: 'post',
                data: $('#activate_pin_form').serialize(),
                dataType: 'json',
                async: false,
                success: function (data) {
                    if (data.invalid) {
                        $("#submit").attr("disabled", "true");
                        alert("Invalid user login id and/or pin");
                        $("#myModal").modal('hide');
                    } else {
                        alert("Account activated successfully");
                        location.reload();
                    }
                }});
            e.preventDefault();
        });
    });
    /* function pin_check() {
     var pin = prompt('Enter pin here', 'xxxxxxxxxx');
     if (pin) {
     $.post("pin_check.php", {'pin_no': pin}, function(data) {
     if (data.invalid) {
     $("#submit").attr("disabled", "true");
     alert("Invalid pin");
     } else {
     alert("Account activated successfully");
     location.reload();
     }
     }, "json");
     }
     }*/
    function upgrade_user_plan() {
        var pin = prompt('Enter pin here to upgrade your account', 'xxxxxxxxxx');
        if (pin) {
            $.post("upgrade_user_plan.php", {'pin_no': pin}, function (data) {
                if (data.invalid) {
                    $("#submit").attr("disabled", "true");
                    alert("Invalid pin");
                } else {
                    alert("Account upgraded successfully");
                    location.reload();
                }
            }, "json");
        }
    }

    function get_user_detail(loginId) {
//        alert(loginId);
        $.ajax({
            url: "./report/get_user_detail_json.php?login_id=" + loginId,
            type: 'get',
            dataType: 'json',
            async: false,
            success: function (data) {

                var html = '<h6>' + data.data.name + ' </h6>';
                 var html1 = '<h6>'+data.data.is_paid+' </h6>';

                $('#loginInfo').html(html);
                var status = '<h6>' + data.is_paid + ' </h6>';

                  $('#is_paid').html(html1);


            },
            error: function (ext, exception) {
                alert(exception);
            }
        });

    }
    
    function viewMyModal(index){
            $("#myModal-"+index).modal();
    }
//    $(document).ready(function(){
//     $( "#dialog" ).dialog({
//         width: 700,
//         position: 'top',
//     });
//     
//});

</script>

<script type="text/javascript">
    function processExtend(helpid){
        var r=confirm("Do you want extend time for Request Number: "+helpid);
        if(r){
            $.get("process_extend.php",{'helpid':helpid},function(data){
            alert(data);
            location.reload();
            });
        }
    }
</script>

<div style="clear: both;"></div>
<?php include 'footer.php';?>