<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المتجر اونلاين</a></li>
            <li><a href="pages.php?do=show">الصفحات</a></li>
            <li class="active">تعديل</li>
        </ol>
        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">تعديل</h3>
            </div>
            <div class="panel-body"> {literal}
                <form class="nameToBeChecked form-horizontal" role="form" action="pages.php?do=update"
                      method="post" enctype="multipart/form-data" id="spform">
                    {/literal}
                    <!-- =================================================   -->

                    <div class="form-group">
                        <label for="productCatName" class="col-lg-2 control-label">العنوان</label>
                        <div class="col-lg-4"> <span id="sprytextfield1">
                                <input type="text" name="title" id="title"
                                       onkeyup="/*checkName(event, 'onlineproductcat', 'title')*/" class="form-control" value="{$showData->title}"/>
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="productCatName" class="col-lg-2 control-label">العنوان بالانجليزى</label>
                        <div class="col-lg-4"> <span id="sprytextfield2">
                                <input type="text" name="titleEn" id="titleEn"
                                       onkeyup="/*checkName(event, 'onlineproductcat', 'titleEn')*/" class="form-control" value="{$showData->titleEn}"/>
                                <span class="textfieldRequiredMsg">*</span></span>
                        </div>
                    </div>
                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="email" class="col-lg-2 control-label">الصورة</label>
                        <div class="col-lg-4"> <img src="../upload/pages/{$showData->image}"
                                                    alt="" width="122" height="75" />
                            <input type="file" name="image" id="image" class="form-control" accept="image/*" />
                            <input type="hidden" name="imageurl" id="imageurl" value="{$showData->image}" />
                        </div>
                    </div>

                    <!-- =================================================   -->
                    <div class="form-group">
                        <label for="productCatName" class="col-lg-2 control-label">اظهار الصفحة</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="isActive" id="isActive0" class="radioR" value="0" {if $showData->isActive == 0}checked{/if}>
                                    نعم </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="isActive" id="isActive1" class="radioR" value="1" {if $showData->isActive == 1}checked{/if}>
                                    لا </label>
                            </div>
                        </div>
                    </div>
                    <!--==============================-->
                    <!--<div class="form-group">-->
                    <!--    <label for="productCatName" class="col-lg-2 control-label">النوع</label>-->
                    <!--    <div class="col-lg-4">-->
                    <!--        <div class="radio-inline">-->
                    <!--            <label>-->
                    <!--                <input type="radio" name="contentOrExternalLink" id="contentOrExternalLink0" class="radioR" value="0" {if $showData->contentOrExternalLink == 0}checked{/if}>-->
                    <!--                محتوى </label>-->
                    <!--        </div>-->
                    <!--        <div class="radio-inline">-->
                    <!--            <label>-->
                    <!--                <input type="radio" name="contentOrExternalLink" id="contentOrExternalLink1" class="radioR" value="1" {if $showData->contentOrExternalLink == 1}checked{/if}>-->
                    <!--                رابط خارجى </label>-->
                    <!--        </div>-->
                    <!--    </div>-->
                    <!--</div>-->
                    <div id="contentDiv">
                        <div class="form-group">
                            <label for="productCatDescription"
                                   class="col-lg-2 control-label">المحتوى</label>
                            <div class="col-lg-10">
                                <textarea class="form-control ckeditor" rows="3" name="content">{$showData->content}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="productCatDescription"
                                   class="col-lg-2 control-label">المحتوى انجليزى</label>
                            <div class="col-lg-10">
                                <textarea class="form-control ckeditor" rows="3" name="contentEn">{$showData->contentEn}</textarea>
                            </div>
                        </div>
                    </div>
                    <div id="externalLinkDiv" style="display: none">
                        <div class="form-group">
                            <label for="externalLink" class="col-lg-2 control-label">اللنك</label>
                            <div class="col-lg-4">
                                <input type="url" name="externalLink" id="externalLink" class="form-control" value="{$showData->externalLink}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="openTarget" class="col-lg-2 control-label">فتح اللنك فى</label>
                            <div class="col-lg-4">
                                <div class="radio-inline">
                                    <label>
                                        <input type="radio" name="openTarget" id="openTarget0" class="radioR" value="0" {if $showData->openTarget == 0}checked{/if}>
                                        صفحة جديدة </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input type="radio" name="openTarget" id="openTarget1" class="radioR" value="1" {if $showData->openTarget == 1}checked{/if}>
                                        نفس الصفحة </label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- =================================================   -->

                    <input name="id" id="id" type="hidden" value="{$showData->id}" />

                    <!-- =================================================   -->
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button" class="btn btn-primary pull-left" id="spbutton">حفظ</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    $('#spbutton').live('click', function (e) {
        if (!$('#spbutton').hasClass("processing")) {
            $('#spbutton').addClass("processing");
            $('#productCatName').trigger('blur');
            setTimeout(function () {
                var myForm = document.getElementById("spform");
                var SS = Spry.Widget.Form.validate(myForm);
                if (SS == true) {
                    myForm.submit();
                } else {
                    $('#spbutton').removeClass("processing");
                }
            }, 500);
        }
    });

    $("input:radio[name='contentOrExternalLink']").on('change', function () {
        if ($('#contentOrExternalLink0').attr('checked') == "checked") {
            $("#contentDiv").show();
            $("#externalLinkDiv").hide();
        } else {
            $("#contentDiv").hide();
            $("#externalLinkDiv").show();
        }
    });
    $('#contentOrExternalLink0').change();
</script>
{/literal}