<?php
namespace platyFramework;

/** @var ptyFormModel $form */
/** @var ptyItemModel $item */
/** @var string $postUrl */
/** @var string $title */
/** @var string $title_desc */
?>
<script src="<?= $this->request->moduleUrl ?>/ptyadmin/resources/AdminLTE-2.4.5/bower_components/ckeditor/ckeditor.js"></script>
<!--<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.32/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyCtrl">
    <section class="content-header">
        <h1>
            <?= $title ?>
            <small><?= $title_desc ?></small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="<?= $this->request->appUrl ?>"><i class="fa fa-dashboard"></i> Home</a>
            </li>
        </ol>
    </section>
    <?php // ptyDebug($item);
    ?>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <form class="form-horizontal" method="post" action="<?= $postUrl ?>" enctype="multipart/form-data">
                        <input type="hidden" name="id" value="<?= $item->id ?>">
                        <div class="box-body">
                            <div class='col-md-12'>
                                <? if ($this->request->functionName == "edit") { ?>
                                    <?= $form->getDateTime("등록일", "regDateTime", "required placeholder='2018-01-01 00:00:00'"); ?>
                                <? } ?>
                                <?= $form->getSelect("노출여부", "enabled", array("활성화" => "1", "비활성화" => 0)); ?>
                                <?= $form->getSelect("배너 종류", "type", ptybannerItemModel::$_goodsShareType, "ng-model='ptybannerType' ng-dropdown placeholder='배너 종류를 선택하세요'") ?>
                                <div class="form-group" ng-if="ptybannerType == 'appQuitPopupBanner' || ptybannerType == 'shopHomePopupBanner'">
                                    <label class="col-sm-2 control-label"></label>
                                    <div class="col-sm-10">
                                        <p class=""><b>팝업 배너 예시</b><br>
                                        <img width=150 src="/modules/ptybanner/resources/sample_appQuitPopupBanner.jpeg">
                                        이미지 크기 : 4:6 의 비율, 400x600, 800x1200 (권장)
                                        </p>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="ptybannerType == 'shopHomeTopBanner' ">
                                    <label class="col-sm-2 control-label"></label>
                                    <div class="col-sm-10">
                                        <p class=""><b>배너 예시</b><br>
                                        <img width=150 src="/modules/ptybanner/resources/sample_1080x432.jpg">
                                        이미지 크기 : 6:2.4 의 비율, 540x216, 1080x432 (권장)
                                        </p>
                                    </div>
                                </div>
                                <?= $form->getInput("제목", "title"); ?>
                                <?= $form->getFile("이미지", "imageUrl", 0, " onchange='checkUpload(this, 1);'", "모든 파일 첨부는 최대 " . ini_get("post_max_size") . " 까지 가능합니다"); ?>
                                <?= $form->getInput("동작설정", "action", "", "https:// 또는 shopItemId://1234 shopProductId://1234 "); ?>
                                <?= $form->getTextEdit("메모", "note"); ?>
                            </div>
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">저장</button>
                                <button type="button" class="btn btn-default ptyGoBack pull-right">취소</button>
                            </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    var myApp = angular.module('myApp', []);

    function MyCtrl($scope) {
        $scope.ptybannerType = '<?=$form->items->type?>';
        // console.log($scope.ptybannerType);

        $scope.changeme = function () {
            alert('here');
        }
    }
</script>