<?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)); ?>
                                <div class="form-group">
                                    <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->getSelect("노출위치", "target", array("메인 상단 탭" => "mainTab", "메인 홈 내의 상품" => "mainHome")); ?>
                                <? // $form->getInput("명칭", "name"); ?>
                                <?= $form->getInput("노출순서", "descId", "", "숫자가 작을수록 우선 노출 됩니다"); ?>
                                <?= $form->getInput("제목", "title"); ?>
                                <?= $form->getFile("이미지", "imageUrl", 0, " onchange='checkUpload(this, 1);'", "모든 파일 첨부는 최대 " . ini_get("post_max_size") . " 까지 가능합니다"); ?>
                                <?= $form->getInput("노출할 상품의 주 카테고리", "selectCategory"); ?>
                                <?= $form->getInput("노출할 상품의 부 카테고리", "selectCategory2"); ?>
                                <?= $form->getTextEdit("노출할 상품의 일련번호", "selectSerial", "", "일련번호를 엔터 혹은 , 로 구분해 주세요"); ?>
                                <?= $form->getSelect("lowerPrice", "selectLowerPrice", array("ON" => "1", "OFF" => "0")); ?>
                                <?= $form->getSelect("freeDelivery", "selectFreeDelivery", array("ON" => "1", "OFF" => "0")); ?>
                                <?= $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>
                    <? if ($this->request->functionName == "edit") { ?>
                    <div class="box box-info">
                        <div class="box-header with-border">
                            <h3 class="box-title">상품 푸시 보내기</h3>
                        </div>
                        <div class="box-body">
                            <div class='col-md-12'>
                                <?= ptypushItemModel::buildItem()->getEditForm("shopSpecialItemId", $item->id, [
                                    "title" => $item->title, "content" => $item->titleDesc, "imageUrl" => $item->imageUrl
                                ]); ?>
                            </div>
                        </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>
                    </div>
                    <? } ?>

                </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>