function pay()
 {
     $id = addslashes($_GET['app_id']);
     $acc = new App2Acc();
     $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
     if (count($apps) < 1) {
         die("hacking attempt");
     } else {
         $app = $apps[0];
     }
     $paket = new Paket();
     $paket->getByID($app->app_paket_id);
     $dibayarkan = $paket->paket_price * 12;
     //veritrans config
     Veritrans_Config::$serverKey = self::$serverKey;
     $transaction_details = array('order_id' => rand(), 'gross_amount' => $dibayarkan);
     $item1_details = array('id' => $app->app_id, 'price' => $dibayarkan, 'quantity' => 1, 'name' => "Payment for " . $app->app_name);
     $item_details = array($item1_details);
     $ac = Account::getAccountObject();
     $exp = explode(" ", Account::getMyName());
     $lastname = array_pop($exp);
     $billing_address = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'address' => "Mangga 20", 'city' => "Jakarta", 'postal_code' => "16602", 'phone' => "081122334455", 'country_code' => 'IDN');
     $customer_details = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'email' => $ac->admin_email, 'phone' => "081122334455", 'billing_address' => $billing_address);
     $transaction = array('transaction_details' => $transaction_details, 'customer_details' => $customer_details, 'item_details' => $item_details);
     try {
         // Redirect to Veritrans VTWeb page
         header('Location: ' . Veritrans_VtWeb::getRedirectionUrl($transaction));
     } catch (Exception $e) {
         echo $e->getMessage();
         if (strpos($e->getMessage(), "Access denied due to unauthorized")) {
             echo "<code>";
             echo "<h4>Please set real server key from sandbox</h4>";
             echo "In file: " . __FILE__;
             echo "<br>";
             echo "<br>";
             echo htmlspecialchars('Veritrans_Config::$serverKey = \'<your server key>\';');
             die;
         }
     }
 }
    function pay()
    {
        $id = addslashes($_GET['app_id']);
        $acc = new App2Acc();
        $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
        if (count($apps) < 1) {
            die("hacking attempt");
        } else {
            $app = $apps[0];
        }
        if ($app->app_active) {
            header("Location:" . _SPPATH . "myapps");
            die;
        }
        AppAccount::checkOwnership($app);
        $activeAcc = Account::getAccountObject();
        ?>
        <style>
            .app_details{
                padding: 20px;

            }
            .app_details_img img{
                width: 120px;
            }
            .app_details_name{
                font-weight: bold;
                padding-top: 10px;

            }
            .app_details_heading{
                display: none;
            }
            .paket_details{

            }
            .free_apply{
                text-align: center;
                background-color: #ffffff;
                padding: 20px;
                margin-top: 20px;
            }
            .free_details{
                font-style: italic;
                padding-bottom: 15px;
            }
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }
                .app_details{
                    padding: 10px;
                }
                .container{
                    padding-right: 0px;
                    padding-left: 0px;
                }

            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }


            }
        </style>
        <div class="container attop" style="text-align: center;" >
        <div class="col-md-6 col-md-offset-3">

        <div class="appear_logo_pages">
            <a href="<?php 
        echo _SPPATH;
        ?>
">
                <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-payment.png" >
            </a>
        </div>

        <div class="app" style="background-color: #ffffff; ">
            <div style=" padding: 5px; text-align: center; font-size: 16px; font-weight: bold;">Payment For</div>
            <div class="app_details" >
                <div class="app_details_heading">App Details</div>
                <div class="app_details_img">
                    <img src="<?php 
        echo $app->app_icon;
        ?>
">
                </div>
                <div class="app_details_name"><?php 
        echo $app->app_name;
        ?>
</div>
            </div>
            <div class="paket_details ">
                <?php 
        AppearPaketManagement::loadPaketForPay($app);
        ?>
            </div>
        </div>




        <div class="free_apply">
            <div class="free_details">
                We support education, social, spiritual and other non-profit organization. <br>If this App is for one of the above purposes.
                </div>

            <a href="<?php 
        echo _SPPATH;
        ?>
apply_free?id=<?php 
        echo $app->app_id;
        ?>
" class="btn btn-default">Apply FREE apps</a>
            <br>
            <small>what you get</small>
        </div>

        <div class="back_to_button">
            <a href="<?php 
        echo _SPPATH;
        ?>
myapps">I will finish the payment later. Go back to My Apps.</a>
        </div>


    <?php 
    }
Пример #3
0
        .account_name{
            font-size: 17px;
        }
        .account_item{
            font-size: 12px;
        }
    </style>
    <nav class="pure-drawer" data-position="left">

                <ul class="nav-primary">
                    <?php 
if (Auth::isLogged()) {
    ?>
                    <li>
                        <?php 
    $acc = Account::getAccountObject();
    //                        echo $acc->admin_username;
    ?>
                        <div class="account_details" style="cursor: pointer;" onclick="document.location='<?php 
    echo _SPPATH;
    ?>
editAcc';">
                            <div class="account_name"><?php 
    echo $acc->admin_nama_depan;
    ?>
</div>
                            <div class="account_item"><?php 
    echo $acc->admin_username;
    ?>
</div>
                            <div class="account_item"><?php 
    public static function mysales()
    {
        $agent_id = Account::getMyID();
        $agent = "AND komisi_acc_id = '{$agent_id}'";
        $komisiModel = new KomisiModel();
        $mon = isset($_GET['mon']) ? addslashes($_GET['mon']) : date("n");
        $y = isset($_GET['y']) ? addslashes($_GET['y']) : date("Y");
        $date = new DateTime();
        $date->setDate($y, $mon, 1);
        $ymd = $date->format('Y-m-d');
        $thismon = $mon;
        $prev_mon = date('n', strtotime($ymd . " -3 months"));
        $prev_year = date('Y', strtotime($ymd . " -3 months"));
        $monthNum = $mon;
        $dateObj = DateTime::createFromFormat('!m', $monthNum);
        $monthName = $dateObj->format('F');
        // March
        ?>
        <style>
            .heading_earning{
                font-size: 17px;
                font-style: italic;
            }
            .heading_amount{
                font-size: 40px;
            }
            .heading_amount a{
                color: inherit;
                text-decoration: none;
            }
            .heading_amount a:hover{
                text-decoration: underline;
            }

            .inside{
                padding: 20px;
            }
            .selectMonth{
                padding-left: 10px;
            }
            .target_text{
                color: #00733e;
            }
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                .selectMonth{
                    padding-bottom: 20px;
                    border-bottom: 1px solid #CCCCCC;
                }
                .rightborder{
                    border-bottom: 1px solid #CCCCCC;
                }
                .rightborder,.topborder,.bottomborder{
                    background-color: #ffffff;
                    min-height: 115px;
                    text-align: center;
                    padding-top: 10px;
                }
                .endingborder{
                    border-bottom: 1px solid #CCCCCC;
                }
                .heading_amount{
                    font-size: 20px;
                }
                .heading_earning{
                    font-size: 13px;
                    font-style: italic;
                }
                .mobilelb{
                    border-left: 1px solid #CCCCCC;
                }
                .detail_text{
                    font-size: 12px;
                }
                .inside{
                    padding: 10px;
                }
                .container{
                    padding-left: 0px;
                    padding-right: 0px;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }


                .rightborder{
                    border-right: 1px solid #CCCCCC;
                }
                .topborder{
                    border-top: 1px solid #CCCCCC;
                }
                .rightborder,.topborder,.bottomborder{
                    background-color: #ffffff;
                    min-height: 141px;
                }
            }
        </style>
        <div class="container attop"  >
            <div class="col-md-12">
                <div class="appear_logo_pages">
                    <a href="<?php 
        echo _SPPATH;
        ?>
">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-dashboard.png" >
                    </a>
                </div>

                <div id="attratas">

                    <button onclick="$('#selectMonth').toggle();" class="btn btn-success btn-abu" style="margin: 0px;  ">Select Month</button>
                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
invite';" class="btn btn-success btn-abu" style="margin: 0px;  ">Invite</button>

                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
myapps';" class="btn btn-success btn-abu" style="margin: 0px;">Apps</button>


                </div>

                <div class="clearfix"></div>
                <div  class="col-md-12" id="comission" >

                    <div class="selectMonth" id="selectMonth" style="display: none; padding-bottom: 10px;">
                        <div style="float: left;">
                            <div style="float: left; line-height: 34px; padding-right: 10px;">Month</div>
                            <div style="float: left;">
                            <select id="mon" class="form-control">
                                <?php 
        for ($x = 1; $x < 13; $x++) {
            ?>
                                    <option <?php 
            if ($mon == $x) {
                echo "selected";
            }
            ?>
 value="<?php 
            echo $x;
            ?>
"><?php 
            echo $x;
            ?>
</option>
                                <?php 
        }
        ?>
                                </select>
                            </div>
                        </div>
                        <div style="float: left;">
                            <div style="float: left; line-height: 34px; padding-right: 10px; padding-left: 10px;">Year</div>
                            <div style="float: left;">
                                <select id="year" class="form-control">
                                    <?php 
        for ($x = 2016; $x < 2030; $x++) {
            ?>
                                        <option <?php 
            if ($y == $x) {
                echo "selected";
            }
            ?>
  value="<?php 
            echo $x;
            ?>
"><?php 
            echo $x;
            ?>
</option>
                                    <?php 
        }
        ?>
                                </select>
                            </div>
                        </div>
                        <div style="float: left; padding-left: 10px;">
                            <button id="change" type="button" class="btn btn-default">Go</button>
                            </div>

                        <div class="clearfix"></div>




                        <script>
                            $('#change').click(function(){
                                document.location = '<?php 
        echo _SPPATH;
        ?>
mydashboard?mon='+$('#mon').val()+'&y='+$('#year').val();
//                openLw("Comissioning",'<?php 
        //=_SPPATH;
        ?>
//FinanceBE/comissioning?mon='+$('#mon').val()+'&y='+$('#year').val(),'fade');
                            });
                        </script>
                    </div>

                    <?php 
        $sales = AppearSales::calculatePaidSalesCount(Account::getMyID(), $mon, $y);
        //                                        pr($sales);
        $lastmon = getFirstDayOfLastMonth($mon, $y, "n");
        $lastyear = getFirstDayOfLastMonth($mon, $y, "Y");
        $lastmonsales = AppearSales::calculatePaidSalesCount(Account::getMyID(), $lastmon, $lastyear);
        //revenue
        $rev = AppearSales::calculateRevenueCount(Account::getMyID());
        $paid_count = AppearSales::paidCount($agent_id);
        $target = AppearSales::calculateTarget($paid_count);
        $dateObj = DateTime::createFromFormat('!m', $lastmon);
        $monthNameLast = $dateObj->format('F');
        // March
        $free = AppearSales::calculateFree(Account::getMyID(), $mon, $y);
        //                    pr($free);
        ?>
                    <div class="col-md-4  col-sm-6 col-xs-6  rightborder bottomborder">
                        <div class="inside">
                            <div class="heading_earning">Target </div>
                            <div class="heading_amount target_text">+IDR <?php 
        echo idr($target['total']);
        ?>
</div>
                            <div class="detail_text target_text">+<?php 
        echo $target['nr'];
        ?>
 more sales to go</div>
                            <!--                    <div class="detail"><a href="--><?php 
        //=_SPPATH;
        ?>
<!--myearning?mon=--><?php 
        //=$mon;
        ?>
<!--&y=--><?php 
        //=$y;
        ?>
<!--">view details</a></div>-->
                        </div>
                    </div>

                    <div class="col-md-4 col-sm-6 col-xs-6 rightborder bottomborder mobilelb">
                        <div class="inside">
                            <div class="heading_earning">Earning <?php 
        echo $monthName;
        ?>
 <?php 
        echo $y;
        ?>
</div>
                            <div class="heading_amount">IDR <a href="<?php 
        echo _SPPATH;
        ?>
myearning?mon=<?php 
        echo $mon;
        ?>
&y=<?php 
        echo $y;
        ?>
"><?php 
        echo idr($sales->total);
        ?>
</a></div>
                            <div class="detail_text">You have made <a href="<?php 
        echo _SPPATH;
        ?>
myearning?mon=<?php 
        echo $mon;
        ?>
&y=<?php 
        echo $y;
        ?>
"><?php 
        echo $sales->nr;
        ?>
</a> Sales</div>
                            <!--                    <div class="detail">view details</a></div>-->
                        </div>
                    </div>

                    <div class="col-md-4 col-sm-6 col-xs-6 bottomborder endingborder ">
                        <div class="inside">
                            <div class="heading_earning">Last Month </div>
                            <div class="heading_amount">IDR <a href="<?php 
        echo _SPPATH;
        ?>
myearning?mon=<?php 
        echo $lastmon;
        ?>
&y=<?php 
        echo $lastyear;
        ?>
"><?php 
        echo idr($lastmonsales->total);
        ?>
</a></div>
                            <div class="detail_text">Last month you made <a href="<?php 
        echo _SPPATH;
        ?>
myearning?mon=<?php 
        echo $lastmon;
        ?>
&y=<?php 
        echo $lastyear;
        ?>
"><?php 
        echo $lastmonsales->nr;
        ?>
</a> Sales</div>

                        </div>

                    </div>



                    <div class="col-md-4  col-sm-6 col-xs-6 rightborder topborder mobilelb">
                        <div class="inside">
                            <div class="heading_earning">Freebies <?php 
        echo $monthName;
        ?>
 <?php 
        echo $y;
        ?>
</div>
                            <div class="heading_amount">IDR <a href="<?php 
        echo _SPPATH;
        ?>
myfreebies?mon=<?php 
        echo $mon;
        ?>
&y=<?php 
        echo $y;
        ?>
"><?php 
        echo idr($free['total']);
        ?>
</a></div>
                            <div class="detail_text">You have made <a href="<?php 
        echo _SPPATH;
        ?>
myfreebies?mon=<?php 
        echo $mon;
        ?>
&y=<?php 
        echo $y;
        ?>
"><?php 
        echo $free['total_free'];
        ?>
</a> Free Deals</div>
                        </div>
                    </div>

                    <div class="col-md-4 col-sm-6 col-xs-6 rightborder topborder">


                        <div class="inside">
                            <div class="heading_earning">Payout <?php 
        echo $monthName;
        ?>
 <?php 
        echo $y;
        ?>
</div>
                            <div class="heading_amount">IDR <a href="<?php 
        echo _SPPATH;
        ?>
mypayout?mon=<?php 
        echo $mon;
        ?>
&y=<?php 
        echo $y;
        ?>
"><?php 
        echo idr(AppearSales::calculatePayout($agent_id, $mon, $y)['total']);
        ?>
</a></div>
                            <div class="detail"><a href="<?php 
        echo _SPPATH;
        ?>
mypayout?mon=<?php 
        echo $mon;
        ?>
&y=<?php 
        echo $y;
        ?>
">payout details</a></div>
                        </div>
                    </div>

                    <div class="col-md-4 col-sm-6 col-xs-6 topborder mobilelb">
                        <div class="inside">
                            <div class="heading_earning">All Time Revenue</div>
                            <div class="heading_amount">IDR <?php 
        echo idr(AppearSales::calculateRevenue($agent_id));
        ?>
</div>
                            <div class="detail_text">from <?php 
        echo $paid_count;
        ?>
 Sales and <?php 
        echo AppearSales::freeCount($agent_id);
        ?>
 Freebies</div>

                        </div>
                    </div>






                </div>

                <div class="clearfix"></div>
                <?php 
        $acc = Account::getAccountObject();
        //get applied banner
        $bm = new BannerModel();
        $arrBm = $bm->getWhere("banner_interval_begin <= {$paid_count} AND banner_interval_end >= {$paid_count} AND banner_active = 1");
        //        pr($arrBm);
        if (count($arrBm) > 0) {
            $selBanner = $arrBm[0];
        }
        //get applied level
        $lv = new LevelModel();
        $arrLvl = $lv->getWhere("level_start<={$paid_count} AND level_end>={$paid_count} AND level_active = 1");
        if (count($arrLvl) > 0) {
            $selLvl = $arrLvl[0];
        }
        ?>
                <?php 
        if (count($arrBm) > 0) {
            ?>
                    <div  class="col-md-4 col-sm-12 col-xs-12" >
                        <!--                    <div style="background-color:#dedede; text-align:center; line-height: 30px; cursor: pointer; position: absolute; width: 30px; height: 30px;" onclick="$('#agentbanner').hide();">x</div>-->
                        <a href="<?php 
            echo $selBanner->banner_link_url;
            ?>
">
                            <img src="<?php 
            echo _SPPATH . _PHOTOURL . $selBanner->banner_img;
            ?>
" width="100%">
                        </a>
                    </div>
                    <div  class="col-md-4" style="padding-left: 0px; padding-right: 0px;" >
                        <!--                    <div style="background-color:#dedede; text-align:center; line-height: 30px; cursor: pointer; position: absolute; width: 30px; height: 30px;" onclick="$('#agentbanner').hide();">x</div>-->
                        <a href="<?php 
            echo $selBanner->banner_link_url;
            ?>
">
                            <img src="<?php 
            echo _SPPATH . _PHOTOURL . $selBanner->banner_img;
            ?>
" width="100%">
                        </a>
                    </div>
                    <div  class="col-md-4" >
                        <!--                    <div style="background-color:#dedede; text-align:center; line-height: 30px; cursor: pointer; position: absolute; width: 30px; height: 30px;" onclick="$('#agentbanner').hide();">x</div>-->
                        <a href="<?php 
            echo $selBanner->banner_link_url;
            ?>
">
                            <img src="<?php 
            echo _SPPATH . _PHOTOURL . $selBanner->banner_img;
            ?>
" width="100%">
                        </a>
                    </div>
                <?php 
        }
        ?>

                <?php 
        if ($acc->admin_isAgent < 1) {
            ?>
                    <div class="total_commision">
                        <a href="<?php 
            echo _SPPATH;
            ?>
become_agent">Please complete Agent registration, to start earning your share.</a>
                    </div>
                <?php 
        }
        ?>
            </div>
        </div>
    <?php 
    }
Пример #5
0
 function pay()
 {
     $app_id = addslashes($_GET['app_id']);
     $app = new AppAccount();
     $app->getByID($app_id);
     AppAccount::checkOwnership($app);
     $paket_id = addslashes($_GET['paket']);
     $paket = new Paket();
     $paket->getByID($paket_id);
     global $db;
     //create new order
     $vpt = new VpTransaction();
     $vpt->order_id = mt_rand() . $app->app_id . Account::getMyID();
     $vpt->order_acc_id = Account::getMyID();
     $vpt->order_app_id = $app->app_id;
     $vpt->order_date = leap_mysqldate();
     $vpt->order_paket_id = $paket->paket_id;
     $vpt->order_value = $paket->paket_price;
     $vpt->order_status = 0;
     $vpt->order_status_from = 0;
     //hapus yang blom ada action apa2
     $q = "DELETE FROM {$vpt->table_name} WHERE order_app_id = '{$app->app_id}' AND order_status = '0' AND order_status_from = '0'";
     $db->query($q, 0);
     $arrVpt = $vpt->getWhere("order_app_id = '{$app->app_id}' AND order_status = '0' AND order_status_from != '0' ");
     if (count($arrVpt) > 0) {
         die("Please wait for the payment response");
     }
     if ($vpt->save()) {
         //        pr($paket);
         //        pr($app);
         try {
             // Set our server key
             //live
             //            Veritrans_Config::$serverKey = 'VT-server-3UfrS7tn0EDT99S2B18TnUh_';
             //sandbox
             Veritrans_Config::$serverKey = $this->getKeyUsed();
         } catch (Exception $e) {
             echo $e->getMessage();
         }
         if ($this->isProd) {
             // Uncomment for production environment
             Veritrans_Config::$isProduction = true;
             // Uncomment to enable sanitization
             Veritrans_Config::$isSanitized = true;
             // Uncomment to enable 3D-Secure
             Veritrans_Config::$is3ds = true;
         }
         $acc = Account::getAccountObject();
         $exp = explode(" ", $acc->admin_nama_depan);
         $billing_address = array('first_name' => $exp[0], 'last_name' => $exp[1], 'phone' => $acc->admin_phone, 'country_code' => 'IDN');
         $customer_details = array('first_name' => $exp[0], 'last_name' => $exp[1], 'email' => $acc->admin_email, 'phone' => $acc->admin_phone, 'billing_address' => $billing_address);
         $item1_details = array('id' => $app->app_id, 'price' => $paket->paket_price, 'quantity' => 1, 'name' => $app->app_name . " " . $paket->paket_name . " 1 year");
         $item_details = array($item1_details);
         $transaction = array('transaction_details' => array('order_id' => $vpt->order_id, 'gross_amount' => $paket->paket_price), 'customer_details' => $customer_details, 'item_details' => $item_details);
         try {
             // Redirect to Veritrans VTWeb page
             header('Location: ' . Veritrans_VtWeb::getRedirectionUrl($transaction));
         } catch (Exception $e) {
             echo $e->getMessage();
             if (strpos($e->getMessage(), "Access denied due to unauthorized")) {
                 echo "<code>";
                 echo "<h4>Please set real server key from sandbox</h4>";
                 echo "In file: " . __FILE__;
                 echo "<br>";
                 echo "<br>";
                 echo htmlspecialchars('Veritrans_Config::$serverKey = \'<your server key>\';');
                 die;
             }
         }
     } else {
         //if save
         die("Please contact admin");
     }
 }
Пример #6
0
    function mydashboard()
    {
        $acc = Account::getAccountObject();
        ?>
        <style>
            #attratas{
                text-align: right;
            }
        </style>
        <div class="container attop"  >
            <div class="col-md-10 col-md-offset-1">
                <h1>Dashboard</h1>
                <div id="attratas">
                   <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
MyApp/newApp';" class="btn btn-success" style="margin: 0px;">Create New Apps</button>
                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
editAcc';" class="btn btn-info" style=" margin: 0px;">Edit Account</button>
                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
myOrders';" class="btn btn-warning" style=" margin: 0px;">Order History</button>
                </div>

<?php 
        if (in_array("master_admin", Account::getMyRoles())) {
            $acc = new AppAccount();
            $apps = $acc->getAll();
            //
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount"));
        }
        if (count($apps) > 0) {
            ?>

            <div class="table-responsive" style="margin-top: 20px;">
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>
                            No.
                        </th>
                        <th>App Name</th>
                        <th>Package</th>
                        <th>Status</th>
                        <th>Expired Date</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            foreach ($apps as $num => $ap) {
                $paket = new Paket();
                $paket->getByID($ap->app_paket_id);
                ?>
                        <tr>
                            <td><?php 
                echo $num + 1;
                ?>
</td>
                            <td><?php 
                echo $ap->app_name;
                ?>
</td>
                            <td><?php 
                echo $paket->paket_name;
                ?>
</td>
                            <td><?php 
                echo $ap->app_active;
                ?>
</td>
                            <td><?php 
                if ($ap->app_active == 1) {
                    echo indonesian_date($ap->app_contract_end);
                }
                ?>
</td>
                            <td>
<!--                                <a href='--><?php 
                //=_SPPATH;
                ?>
<!--MyApp/appView?id=--><?php 
                //=$ap->app_id;
                ?>
<!--'  class="btn btn-info">Edit</a>-->
                                <?php 
                if ($ap->app_active == 1) {
                    ?>

                                    <a href='<?php 
                    echo _SPPATH;
                    ?>
PushHome/setID?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success">Admin</a>
                                <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
MyApp/appView?id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>


                                <?php 
                    } else {
                        ?>
                                    <button class="btn btn-info">Waiting for Approval</button>
                                <?php 
                    }
                }
                ?>
                            </td>
                        </tr>
                        <?php 
            }
            ?>
                    </tbody>
                </table>
            </div>



    <?php 
        } else {
            ?>
            <h5 class="hype">You do not have any App yet..</h5>
            <button onclick="document.location='<?php 
            echo _SPPATH;
            ?>
MyApp/newApp';" class="btn btn-success"
                    style="width: 100%; margin: 5px;">Create My Own App
            </button>

<?php 
        }
        ?>
            </div>
            <div class="clearfix"></div>

            </div>
        <?php 
    }
Пример #7
0
    public static function become_agent()
    {
        $rand = time() . rand(0, 100);
        $_SESSION['rand'] = $rand;
        $acc = Account::getAccountObject();
        if ($acc->admin_isAgent == 1) {
            die('Already Agent');
        }
        //        pr($acc);
        ?>
        <style>
            .foto100{
                width: 100px;
                height: 100px;
                overflow: hidden;
                cursor: pointer;
            }
            .foto100 img{
                /*width: 100%;*/
            }
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }
                .fotowadah{
                    text-align: center;
                }
                .foto100{
                    margin: 0 auto;
                }

                input[type="file"]{
                    text-align: center;
                    margin: 0 auto;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }


            }
        </style>
        <div class="container attop"  >
            <div class="col-md-8 col-md-offset-2">

                <div class="appear_logo_pages">
                    <a href="<?php 
        echo _SPPATH;
        ?>
">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-agent.png" >
                    </a>
                </div>

                <div id="waitingApproval" <?php 
        if ($acc->admin_isAgent != -1) {
            ?>
style="display: none;"<?php 
        }
        ?>
>
                    <h3 style="text-align: center;">Your request is being processed. Please wait for our updates.</h3>
                    <div class="back_to_button" style="text-align: center;" >
                        <a href="<?php 
        echo _SPPATH;
        ?>
mydashboard">back to dashboard</a>
                    </div>
                </div>
                <?php 
        if ($acc->admin_isAgent != -1) {
            ?>
                <div id="uploadKTP">
                <div style="text-align: center; padding: 15px;">
                    <p>Please upload your KTP and NPWP, and do not forget to fill your bank credentials to receive payment.</p>
                </div>
                <div class="berpadding" style="text-align: center; margin-bottom: 100px;">
                    <form id="form_agent" class="form-horizontal" role="form" >
                        <input type="hidden" name="token" value="<?php 
            echo $rand;
            ?>
">
                        <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="ktp">KTP : </label>
                            <div class="col-sm-10 fotowadah">
                                <?php 
            $file = new \Leap\View\InputFoto("ktp", "ktp", "");
            $file->p();
            ?>
                                <div id="ktp_err" class="err"></div>
                            </div>
                        </div>
                        </div>
                        <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="npwp">NPWP : </label>
                            <div class="col-sm-10 fotowadah">
                                <?php 
            $file = new \Leap\View\InputFoto("npwp", "npwp", "");
            $file->p();
            ?>
                                <div id="npwp_err" class="err"></div>
                            </div>
                        </div>
                            </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="bank_name">Bank Name : </label>
                            <div class="col-sm-10">
                                <input name="bank_name" type="text" class="form-control" id="bank_name" placeholder="Bank Name">
                                <div id="bank_name_err" class="err"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="account_nr">Account Number : </label>
                            <div class="col-sm-10">
                                <input name="account_nr" type="text" class="form-control" id="account_nr" placeholder="Account Number">
                                <div id="account_nr_err" class="err"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="account_name">Account Name : </label>
                            <div class="col-sm-10">
                                <input name="account_name" type="text" class="form-control" id="account_name" placeholder="Account Name">
                                <div id="account_name_err" class="err"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="branch_name">Branch Name (KCU) : </label>
                            <div class="col-sm-10">
                                <input name="branch_name" type="text" class="form-control" id="branch_name" placeholder="Branch Name">
                                <div id="branch_name_err" class="err"></div>
                            </div>
                        </div>
                        <hr>
                        <div class="form-group">
                            <label class="control-label col-sm-2" for="tos">Terms and Conditions: </label>
                            <div class="col-sm-10" style="text-align: left;  ">
                                <input type="checkbox" name="tos" id="tos" value="1"  > I accept the terms and conditions.
                                <div class="read"> <a target="_blank" href="<?php 
            echo _SPPATH;
            ?>
tos/agent">read terms and conditions</a></div>
                                <div id="tos_err" class="err"></div>
                            </div>
                        </div>

                        <hr>

                        <div id="resultajax" style="display: none; text-align: center;" class="alert alert-danger"></div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button style="width: 100%;" type="submit" class="btn btn-primary btn-appeargreen">Verify</button>

                                <div class="back_to_button" >
                                    <a href="<?php 
            echo _SPPATH;
            ?>
mydashboard">back to dashboard</a>
                                </div>
                            </div>
                        </div>
                    </form>


                </div>
                </div>
                <?php 
        }
        ?>
            </div>
        </div>

        <script>
            $( "#form_agent" ).submit(function( event ) {
                if(allowed) {
                    if (validateFormOnSubmit(this)) {
//                        alert("benar semua1");
                        var $form = $(this);
                        var url = "<?php 
        echo _SPPATH;
        ?>
processAgent";

                        $(".err").hide();

                        // Send the data using post
                        var posting = $.post(url, $form.serialize(), function (data) {
                            console.log(data);
                            if (data.bool) {
                                $('#waitingApproval').show();
                                $('#uploadKTP').hide();
                                //kalau success masuk ke check your email....
//                                document.location = "<?php 
        //=_SPPATH;
        ?>
//check_your_email?type=<?php 
        //=$type;
        ?>
//";
                            }
                            else {
                                $("#resultajax").show();
                                $("#resultajax").html(data.err);
                            }
                        }, 'json');

                    } else {

                    }
                }else{
                    alert("Please complete registration");
                }


                event.preventDefault();
            });

            var allowed = 1;

        </script>
        <script>
            function validateFormOnSubmit(theForm) {
                var reason = "";


                reason += validateEmpty(theForm.tos);

                reason += validateEmpty(theForm.ktp);
                reason += validateEmpty(theForm.npwp);

                reason += validateEmpty(theForm.account_nr);
                reason += validateEmpty(theForm.account_name);
                reason += validateEmpty(theForm.bank_name);
                reason += validateEmpty(theForm.branch_name);

                if(!document.getElementById("tos").checked){
                    var texterr = "Please Accept Agreement";
                    reason += texterr;
                    $('#tos_err').css( "color", "red").show().html(texterr);
//                    $('#tos_err').html(texterr);
                }else{
                    $('#tos_err').hide();
                }

                if (reason != "") {
//                        alert("Some fields need correction:\n" + reason);
                    return false;
                }

                return true;
            }

            function validateEmpty(fld) {
                var error = "";

                if (fld.value.length == 0) {
                    error = "The required field has not been filled in.\n"
                    fld.style.background = '#CCCCCC';
                    $( fld ).next().css( "color", "red").show().html(error);

                } else {
                    fld.style.background = 'White';
                    $( fld ).next().hide();
                }
                return error;
            }


            function trim(s)
            {
                return s.replace(/^\s+|\s+$/, '');
            }


        </script>
    <?php 
    }
Пример #8
0
    static function getMyApps()
    {
        $acc = Account::getAccountObject();
        ?>
        <style>
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
                    padding-left: 0px;
                    padding-right: 0px;

                }
                .container {
                    padding-right: 0px;
                    padding-left: 0px;
                }
                .attop{
                    /*padding-top: 50px;*/
                }
                #session{
                    margin-left: 15px; margin-right: 15px;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }
                #attratas{
                    margin-top: 30px;
                }
                #agentbanner{
                    padding-right: 0px;
                }
                .stats{
                    /*min-height: 250px;*/
                }
                .stats_text{
                    /*padding-top: 30px;*/
                }
                .stats_number_big{
                    /*font-size: 40px;*/
                }
                .stats_money{
                    font-weight: bold;
                    /*font-size: 30px;*/
                }
                .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
                    padding-left: 0px;
                    padding-right: 0px;

                }
            }
        </style>
        <div class="container attop"  >
        <div class="col-md-12">
        <div class="appear_logo_pages">
            <a href="<?php 
        echo _SPPATH;
        ?>
">
                <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-apps.png" >
            </a>
        </div>

        <div id="attratas">
            <button id="list" onclick="$('#list').hide();$('#icons').show();$('#app_icons').hide();$('#app_lists').show();" class="btn btn-success btn-abu" style="margin: 0px;display: none;"><i class="glyphicon glyphicon-th-list"></i></button>
            <button id="icons" onclick="$('#list').show();$('#icons').hide();$('#app_icons').show();$('#app_lists').hide();" class="btn btn-success btn-abu" style="margin: 0px;"><i class="glyphicon glyphicon-th"></i></button>
            <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
mydashboard';" class="btn btn-success btn-abu" style="margin: 0px;">Dashboard</button>
            <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
apps/makenew';" class="btn btn-success btn-abu" style="margin: 0px;">Create New Apps</button>
        </div>
        <?php 
        if (ZAppFeature::checkRemainingSession()) {
            $link = _SPPATH . "apps/make";
            if ($_SESSION['ZAppFeature']['app_id'] > 0) {
                $link = _SPPATH . "apps/make?id=" . $_SESSION['ZAppFeature']['app_id'];
            }
            ?>

    <div id="session" class="alert alert-warning" role="alert" >
        You have unsaved edit Sessions. Click <a href="<?php 
            echo $link;
            ?>
">here</a> to continue work on your app
        </div>



        <?php 
        }
        ?>
        <?php 
        if (in_array("master_admin", Account::getMyRoles())) {
            $acc = new AppAccount();
            $apps = $acc->getAll();
            //http://localhost:8888/appear/PushHome/home?st=Balance
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount"));
        }
        if (count($apps) > 0) {
            ?>
<div id="app_icons" style="display: none;">
            <?php 
            foreach ($apps as $num => $ap) {
                ?>
                <div class="col-md-3 col-sm-12 col-xs-12 myapp">
                    <div id="detail_<?php 
                echo $num;
                ?>
" class="app_detail" style="display: none;" onclick="openDetails('<?php 
                echo $num;
                ?>
');">
                        <div style="padding: 20px;">
                            <h3><?php 
                echo $ap->app_name;
                ?>
</h3>
                            <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo '<div class="app_paket">' . $paket->paket_name . '</div>';
                }
                ?>
                            <?php 
                $status = $ap->app_active;
                echo '<div class="app_status">';
                if ($status == 0) {
                    echo "Not active";
                }
                if ($status == 1) {
                    if ($ap->app_type == 1) {
                        echo "pending approval";
                    } else {
                        echo "App is being created";
                    }
                }
                if ($status == 2) {
                    echo "Up and running";
                }
                echo "</div>";
                ?>
                            <?php 
                if ($ap->app_active > 0 && $ap->app_type == 0) {
                    echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                        <br>
                                        <a  href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                                    <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
<br>
                                            <a  href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                        <?php 
                            }
                        }
                    }
                    echo '</div>';
                }
                ?>

                            <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                                <?php 
                    }
                    ?>

                                <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success btn-abu">Push Notifications</a>
                                <br>
                            <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                                <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                                <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-success btn-abu">Delete</a>

                            <?php 
                    }
                }
                ?>

                            <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Edit</a>
                            <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Preview</a>
                            <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-success btn-abu">JSON</a>

                        </div>
                    </div>
                    <div id="app_<?php 
                echo $num;
                ?>
" class="app_icon" onclick="openDetails('<?php 
                echo $num;
                ?>
');">
                        <img width="100%" src="<?php 
                echo $ap->app_icon;
                ?>
">
                        <div style="display:none;position: absolute; background-color: rgba(0,0,0,0.5); border-radius: 0px; text-align: center; font-size: 18px; padding: 10px; margin-top: -53px; margin-left:10px; z-index:1; color: #ffffff;">
                            <?php 
                echo $ap->app_name;
                ?>
                        </div>
                    </div>
                </div>
            <?php 
            }
            ?>
            <script>
                function openDetails(n){
                    $('#detail_'+n).fadeToggle( "slow", "linear" );
                    console.log($('#app_'+n).width());
                    $('#detail_'+n).css("width",$('#app_'+n).width()+'px');
                    $('#detail_'+n).css("height",$('#app_'+n).height()+'px');
                }
            </script>
            <style>
                .app_detail{
                    position: absolute;
                    background-color: rgba(0,0,0,0.8);
                    width: 100px;
                    height: 200px;
                    color: #ffffff;
                    text-align: center;
                    z-index: 10;
                }
                .myapp{
                    cursor: pointer;
                }
                .app_contract{
                    font-style: italic;
                    font-size: 12px;
                }
                .myapp a{
                    color: #B2DFDB;
                    text-decoration: underline;
                }
                .myapp a.btn{
                    text-decoration: none;
                    margin: 5px;
                    color: #ffffff;
                }
                .entry{
                    padding: 5px;
                    background-color: #F7F7F7;
                    margin: 5px;
                }
                .entry a.btn{
                    text-decoration: none;
                    margin: 2px;
                    color: #ffffff;
                }
            </style>
            </div>
            <div class="clearfix"></div>
            <div id="app_lists" >
            <?php 
            foreach ($apps as $num => $ap) {
                //                        $paket = new Paket();
                //                        $paket->getByID($ap->app_paket_id);
                ?>

                <div class=" col-md-6 col-sm-12 col-xs-12">
                <div class="entry">
                <div class="col-md-6 col-sm-6 col-xs-6">
                    <img width="100%" src="<?php 
                echo $ap->app_icon;
                ?>
">

                </div>
                <div class="col-md-6 col-sm-6 col-xs-6" style="text-align: center;">
                    <h3><?php 
                echo $ap->app_name;
                ?>
</h3>
                    <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo '<div class="app_paket">' . $paket->paket_name . '</div>';
                }
                ?>
                    <?php 
                $status = $ap->app_active;
                echo '<div class="app_status">';
                if ($status == 0) {
                    echo "Not active";
                }
                if ($status == 1) {
                    if ($ap->app_type == 1) {
                        echo "pending approval";
                    } else {
                        echo "App is being created";
                    }
                }
                if ($status == 2) {
                    echo "Up and running";
                }
                echo "</div>";
                ?>
                    <?php 
                if ($ap->app_active > 0 && $ap->app_type == 0) {
                    echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                <br>
                                <a  href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                            <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
                                    <br>
                                    <a  href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                <?php 
                            }
                        }
                    }
                    echo '</div>';
                }
                ?>

                    <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                            <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                        <?php 
                    }
                    ?>

                        <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success btn-abu">Push Notifications</a>
                        <br>
                    <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                        <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                        <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                        <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-success btn-abu">Delete</a>

                    <?php 
                    }
                }
                ?>

                    <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Edit</a>
                    <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Preview</a>
                    <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-success btn-abu">JSON</a>

                </div>

                    <div class="clearfix"></div>
                </div>
                </div>

            <?php 
            }
            ?>
            </div>
            <style>
                .table{
                    background-color: white;
                }
            </style>
            <div id="app_table" class="table-responsive" style="margin-top: 20px; display: none;">
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>
                            No.
                        </th>
                        <th>App</th>
                        <th>Action</th>
                        <th>Paket</th>
                        <th>Expired Date</th>
                        <th>Status</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            foreach ($apps as $num => $ap) {
                //                        $paket = new Paket();
                //                        $paket->getByID($ap->app_paket_id);
                ?>
                        <tr>
                            <td><?php 
                echo $num + 1;
                ?>
</td>
                            <td style="text-align: center;">
                                <div class="foto100">
                                    <img width="100px" src="<?php 
                echo $ap->app_icon;
                ?>
">
                                </div>

                                <?php 
                echo $ap->app_name;
                ?>
                            </td>
                            <td>
                                <!--                                <a href='--><?php 
                //=_SPPATH;
                ?>
<!--MyApp/appView?id=--><?php 
                //=$ap->app_id;
                ?>
<!--'  class="btn btn-info">Edit</a>-->
                                <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                                        <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                                    <?php 
                    }
                    ?>

                                    <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success">Push Notifications</a>
                                    <br>
                                <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                    <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-danger">Delete</a>

                                <?php 
                    }
                }
                ?>

                                <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-danger">Edit</a>
                                <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-danger">Preview</a>
                                <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-danger">JSON</a>
                            </td>
                            <td>
                                <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo $paket->paket_name;
                }
                ?>
                            </td>
                            <td>
                                <?php 
                if ($ap->app_active > 0) {
                    echo date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                            <br>
                                            <a class="btn btn-default" href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                                        <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
                                                <br>
                                                <a class="btn btn-default" href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                            <?php 
                            }
                        }
                    }
                }
                ?>
                            </td>

                            <td><?php 
                $status = $ap->app_active;
                if ($status == 0) {
                    echo "Your App is not active";
                }
                if ($status == 1) {
                    echo "Your App is being created.<br>For Android App, it will take up to 2 working days.<br>For iOS, it will take up to 3 weeks.";
                }
                if ($status == 2) {
                    echo "Your App is up and running";
                }
                ?>
</td>

                        </tr>
                    <?php 
            }
            ?>
                    </tbody>
                </table>
            </div>
            </div>
            <div class="clearfix" style="margin-bottom: 100px;"></div>

            </div>
        <?php 
        } else {
            header("Location:" . _SPPATH . "apps/make");
            exit;
        }
    }