public function formCustom()
    {
        $sel = ZAppFeature::selectedFeature();
        $valuesNya = FeatureSessionLayer::load($this->feat_id);
        $info_slogan = isset($valuesNya['info_slogan']) ? $valuesNya['info_slogan'] : "slogan";
        $info_banner = isset($valuesNya['info_banner']) ? $valuesNya['info_banner'] : $this->feat_noimage;
        ?>
        <h1 class="header_besar" style="padding: 0; margin: 0; text-align: center; margin-top: 10px; margin-bottom: 10px;">Info</h1>
        <p style="color: #666666; font-size: 12px;">Please complete one or more fields below. <em>All fields are optional.</em></p>

        <div class="form-group">
            <label for="info_slogan">What is your slogan? </label>
            <?php 
        TextLimiter::inputText("text", "info_slogan", "info_slogan", "slogan", $info_slogan, 30, 1, "mslogantext");
        ?>
<!--            <input type="text" class="form-control" id="info_slogan" placeholder="Slogan" value="--><?php 
        //=$info_slogan;
        ?>
<!--">-->
        </div>

        <div class="form-group">

            <?php 
        global $modalReg;
        $modalReg->regCropper("bannID", "Banner", "info_banner", $info_banner, "542:400", array("mbannerImg", "bannID_prev"));
        ?>

            <?php 
        $bannerModalID = "bannID";
        ?>

                <label for="info_banner" >Main Banner </label>
                <div class="previewImg">
                    <img style="cursor:pointer;" data-toggle="modal" data-target="#<?php 
        echo $bannerModalID;
        ?>
" id="<?php 
        echo $bannerModalID;
        ?>
_prev" src="<?php 
        echo $info_banner;
        ?>
">
                </div>


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

            <input type="hidden"  id="info_banner" name="info_banner" value="<?php 
        echo $info_banner;
        ?>
" >

        </div>






            <?php 
        //load from fields
        foreach ($this->fields as $field_name => $details) {
            $field[$field_name] = isset($valuesNya[$field_name]) ? $valuesNya[$field_name] : $details['default_value'];
            ?>
                <div class="form-group">
                <label for="<?php 
            echo $this->feat_id;
            ?>
_<?php 
            echo $field_name;
            ?>
"><?php 
            echo $details['form_question'];
            ?>
 <?php 
            if ($details['optional']) {
                ?>
<span class="optional">Optional</span><?php 
            }
            ?>
</label>
                <?php 
            if ($details['type'] == "text") {
                TextLimiter::inputText("text", $this->feat_id . "_" . $field_name, $this->feat_id . "_" . $field_name, $details['placeholder'], $field[$field_name], $details['limit_max'], $details['limit_min'], "sim_" . $this->feat_id . "_" . $field_name . "_text");
            } elseif ($details['type'] == "rte") {
                TextLimiter::inputTextArea("text", $this->feat_id . "_" . $field_name, $this->feat_id . "_" . $field_name, $details['placeholder'], $field[$field_name], $details['limit_max'], $details['limit_min'], "sim_" . $this->feat_id . "_" . $field_name . "_text");
            } else {
                TextLimiter::inputTextAreaBiasa("text", $this->feat_id . "_" . $field_name, $this->feat_id . "_" . $field_name, $details['placeholder'], $field[$field_name], $details['limit_max'], $details['limit_min'], "sim_" . $this->feat_id . "_" . $field_name . "_text");
            }
            ?>
                <script>
                    $("#<?php 
            echo $this->feat_id;
            ?>
_<?php 
            echo $field_name;
            ?>
").keyup(function(){


                        var name = "sim_<?php 
            echo $this->feat_id . "_" . $field_name;
            ?>
";
                        <?php 
            if ($details['type'] == "rte") {
                ?>
                        var slc = $("#<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
").html();
                        <?php 
            } else {
                ?>
                        var slc = $("#<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
").val();
                        <?php 
            }
            ?>

                        autoUpdateOnKeyup(name,slc);
                    });
                </script>
                </div>
                <?php 
        }
        ?>



        <script>
            function info_save_<?php 
        echo $this->feat_id;
        ?>
(){
                //get all data from inputs
                var info_slogan = $('#info_slogan').val();
                var info_banner = $('#info_banner').val();



        <?php 
        //load from fields
        foreach ($this->fields as $field_name => $details) {
            $field[$field_name] = isset($valuesNya[$field_name]) ? $valuesNya[$field_name] : $details['default_value'];
            if ($details['type'] == "text") {
                ?>
                var vr_<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
 = $('#<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
').val();
                <?php 
            } elseif ($details['type'] == "rte") {
                ?>
                var vr_<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
 = $('#<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
').html();
                <?php 
            } else {
                ?>
                 var vr_<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
 = $('#<?php 
                echo $this->feat_id;
                ?>
_<?php 
                echo $field_name;
                ?>
').val();
                <?php 
            }
            $imp[] = $field_name . ": vr_" . $this->feat_id . "_" . $field_name;
        }
        ?>

        var label_name = $('#<?php 
        echo $this->feat_id;
        ?>
_labelname').val();

        //harus selalu ada ini..
        var contact_pname = $('#<?php 
        echo $this->feat_id;
        ?>
_pname').val();



                //save the data to sessions
                $.post('<?php 
        echo _SPPATH;
        ?>
FeatureSessionLayer/save?id=<?php 
        echo $this->feat_id;
        ?>
',{
                    <?php 
        echo $this->feat_id;
        ?>
_labelname : label_name,
                    <?php 
        echo $this->feat_id;
        ?>
_pname : contact_pname,
                    info_slogan : info_slogan,
                    info_banner : info_banner
                    <?php 
        if (count($imp) > 0) {
            echo ",";
            echo implode(",", $imp);
        }
        ?>
                },function(data){
                    console.log(data);
                    if(data){
                        $(".hiddenform").hide();
                        //update Selected App dan Layout di Simulator
                        updateSelectedAppAndSimulator();

                    }
                });

            }


        </script>

        <script>


            function autoUpdateOnKeyup(name,slc){
                if(slc.length == 0){
                    $("#" + name).hide();
                }
                else {
                    $("#" + name).show();
                    $("#"+name+"_text").html(slc);
                }
            }

        </script>
        <style>
            .optional{
                font-size: 12px;
                color: #666666;
            }
            .mlist-item .clearfix{
                padding: 0;
                margin: 0;
            }
            .mlist-text{
                white-space: pre-wrap;
            }
            .previewImg{

                height: 80px;
                overflow: hidden;
            }
            .previewImg img{
                height: 100%;

            }
        </style>


    <?php 
    }
    public static function page()
    {
        $zp = new ZAppFeature();
        $details = ZAppFeature::loadDetails();
        ?>
        <section id="details">
            <h2 class="header_besar">Insert the details of your App <abbr class="required" title="required">*</abbr></h2>
            <hr class="garisbatas">
            <div class="form-group">
                <label for="contact_pname">App Name</label>
                <?php 
        TextLimiter::inputText("text", "app_name", "app_name", "App Name", $details['app_name'], 15, 7, "my_app_icon_text");
        ?>
            </div>

            <div class="form-group">
                <label for="app_icon_img">App Icon</label>

                <?php 
        $bannerModalID = "app_icon_img_cropper";
        ?>

                <div class="previewImg">
                    <img style="cursor:pointer;"  data-toggle="modal" data-target="#<?php 
        echo $bannerModalID;
        ?>
" id="<?php 
        echo $bannerModalID;
        ?>
_prev" src="<?php 
        echo $details['app_icon'];
        ?>
">
                </div>


                <?php 
        global $modalReg;
        $modalReg->regCropper($bannerModalID, "App Icon", "app_icon", $details['app_icon'], "1300:1300", array($bannerModalID . "_prev", 'my_app_icon_img_src'));
        ?>
                <input type="hidden" id="app_icon" value="<?php 
        echo $details['app_icon'];
        ?>
">
            </div>

            <div class="form-group">
                <label for="app_des_short">App Short Description</label>
                <?php 
        TextLimiter::inputTextAreaBiasa("text", "app_des_short", "app_des_short", "App Short Description", $details['app_des_short'], 100, 10);
        ?>
            </div>

            <div class="form-group">
                <label for="contact_pname">App Long Description</label>
                <?php 
        TextLimiter::inputTextAreaBiasa("text", "app_des_long", "app_des_long", "App Long Description", $details['app_des_long'], 2000, 10);
        ?>
            </div>

            <div class="form-group">
                <label for="contact_pname">App Feature Graphics</label>
                <?php 
        $bannerModalID = "app_feat_cropper";
        ?>

                <div class="previewImg">
                    <img style="cursor:pointer;"  data-toggle="modal" data-target="#<?php 
        echo $bannerModalID;
        ?>
" id="<?php 
        echo $bannerModalID;
        ?>
_prev" src="<?php 
        echo $details['app_feature_img'];
        ?>
">
                </div>


                <?php 
        global $modalReg;
        $modalReg->regCropper($bannerModalID, "App Feature Graphics", "app_feature_img", $details['app_feature_img'], "3000:1300", array($bannerModalID . "_prev"));
        ?>
                <input type="hidden" id="app_feature_img" value="<?php 
        echo $details['app_feature_img'];
        ?>
">
            </div>

            <div style="text-align: center; margin-top: 20px;">
                <button id="savedetails" style="width: 50%;" class="btn btn-danger btn-lg">Next</button>
            </div>

            <script>
                $('#savedetails').click(function(){
                    saveAppDetails(1);

                });

                function saveAppDetails(mode){
                    var app_name = $('#app_name').val();
                    var app_icon = $('#app_icon').val();
                    var app_des_short = $('#app_des_short').val();
                    var app_des_long = $('#app_des_long').val();
                    var app_feature_img = $('#app_feature_img').val();
                    //save the data to sessions
                    $.post('<?php 
        echo _SPPATH;
        ?>
FeatureSessionLayer/saveDetails',{
                        app_name : app_name,
                        app_icon : app_icon,
                        app_des_short : app_des_short,
                        app_des_long : app_des_long,
                        app_feature_img : app_feature_img
                    },function(data){
                        console.log(data);
                        if(data){
//                            console.log('success');
                            //save JSON
                            $.get('<?php 
        echo _SPPATH;
        ?>
FeatureSessionLayer/createJSON?id=<?php 
        echo $_GET['id'];
        ?>
',function(data){
                               console.log(data);
                                if(mode == 1){
                                    $.get('<?php 
        echo _SPPATH;
        ?>
FeatureSessionLayer/saveIntoApp?id=<?php 
        echo $_GET['id'];
        ?>
',function(data){
                                        document.location = '<?php 
        echo _SPPATH;
        ?>
PaymentWeb/pay?app_id='+data.id;
                                    },'json');

                                }
                            });
                        }
                    });
                }
            </script>
        </section>

        <?php 
    }