<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
    <div class="page-content">
        <!-- BEGIN PAGE HEADER-->
        <h3 class="page-title">
            {$shcontrollname}
        </h3>
        <div class="page-bar">
            <ul class="page-breadcrumb">
                {$breadcrumbs}
            </ul>
        </div>
        <!-- END PAGE HEADER-->
        <!-- BEGIN PAGE CONTENT-->
        <input type="hidden" name="controller" id="controller" value="{$controllname}">

        <div class="row">
            <div class="col-md-12">
                <div class="portlet light bg-inverse">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="icon-equalizer font-red-sunglo"></i>
                            <span class="caption-subject font-red-sunglo bold uppercase">اضافه جديد فى   {$shcontrollname}</span>
                        </div>
                        <div class="actions">
                            <a class="btn default btn-xs blue tooltips" href="{$hosturl}/{$controllname}/show" data-container="body" data-placement="top" data-original-title="Show">
                                <i class="icon-list"></i>
                                عرض البيانات
                            </a>
                        </div>
                    </div>
                    <div class="portlet-body form">
                        <!-- BEGIN FORM-->
                        <form action="{$hosturl}/{$controllname}/updateit" method="post" class="form-horizontal" enctype="multipart/form-data"  id="myform">
                            <div class="form-body">
                                <div class="alert alert-danger display-hide">
                                    <button class="close" data-close="alert"></button>
                                    لديك خطا فى ادخال البيانات , حاول مره اخرى
                                </div>
                                <div class="alert alert-success display-hide">
                                    <button class="close" data-close="alert"></button>
                                    لقد ادخلت بيانات صحيح
                                </div>
                                <div class="alert alert-warning display-hide" id="showerrorname">
                                    <button class="close" data-close="alert"></button>
                                    اختر اسم اخر لان هذا مستخدم من قبل
                                </div>

                                <div class="form-group form-md-line-input has-info">
                                    <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-info"></i>
                                        </span>
                                        <input type="text" class="form-control"  placeholder="اسم المنتج" id="data" data-link="{$controllname}" value="{$products->productname_ar}"  name="name_ar" required="" maxlength="75" minlength="2">
                                        <label for="form_control_1">اسم المنتج باللغة العربية </label>
                                    </div>
                                </div>
                                <div class="form-group form-md-line-input has-info">
                                    <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-info"></i>
                                        </span>
                                        <input type="text" class="form-control"  placeholder="product name" id="data_en" data-link="{$controllname}" value="{$products->productname_en}"  name="name_en" required=""  maxlength="65" minlength="2">
                                        <label for="form_control_1">اسم المنتج باللغة الانجليزية </label>
                                    </div>
                                </div>

                                <div class="form-group form-md-line-input has-info">
                                    <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-users"></i>
                                        </span>
                                        <select class="form-control input-xlarge select2me input-sm select2-offscreen noborder" data-placeholder="اختر واحد" name="category" required="">
                                            <option value=""></option>
                                            {foreach $productscategory as $single}
                                            <option value="{$single->id}" {if {$products->category_id} eq {$single->id}} selected {/if}>{$single->productname_ar}</option>
                                            {/foreach}
                                        </select>
                                        <label for="form_control_1">التصنيف </label>
                                    </div>
                                </div>
                                <div class="form-group form-md-line-input has-info">
                                    <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-info"></i>
                                        </span>
                                        <textarea class="form-control " rows="2"  name='details' placeholder="تفاصيل المنتج" required>{$products->details}</textarea>
                                        <label for="form_control_1">تفاصيل    </label>
                                    </div>
                                </div>
                                <div class="form-group form-md-line-input has-info">
                                    <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-info"></i>
                                        </span>
                                        <textarea class="form-control " rows="2"  name='details_en' placeholder="Product details" required>{$products->details_en}</textarea>
                                        <label for="form_control_1">Details </label>
                                    </div>
                                </div>
                                <input type="hidden" name="id" value="{$products->id}">

                                <input type="hidden" name="itr" id="itr" value="{$count_imgs}">

                                <!--                                <div class="form-group">
                                                                    <div class="col-md-2">
                                                                        <button type="button" id="add_new_image_1" data-itra="1" class="btn red add_new_image"><span style="font-size: 12px;">+ </span>اضافة صورة جديده </button>
                                                                    </div>
                                                                </div>-->
                                <div class="form-group " id="img_group">

                                    <div class="row">
                                        <label class="col-md-2 control-label" style="text-align: right"> صورة </label>
                                    </div>
                                    {assign var=itr value=1}
                                    {foreach $images as $image}

                                    <div class="col-md-3" style="margin-top: 20px;" id="img_cont_{$itr}">
                                        <div class="clearfix"></div>
                                        <div class="fileinput fileinput-new" data-provides="fileinput">
                                            <div class="fileinput-preview thumbnail" data-trigger="fileinput_1" style="width: 150px; height: 145px;">

                                                {if {$image.name} eq "no image" OR {$image.name} eq ""}
                                                <input type="hidden" id="imageurl_{$itr}" name="imageurl_{$itr}" value="no image"/>{else}
                                                <div class="thumb" style="height: 100%;">
                                                    <img src="{$hosturl}/../upload/productsgallery/{$image.name}" style="height: 100%; width: 100%; ">
                                                </div>
                                                <input type="hidden" id="imageurl_{$itr}" name="imageurl_{$itr}" value="{$image.name}" />{/if}

                                            </div>
                                            <button type="button" style="margin-bottom: 118px;" data-itra="{$itr}" class="btn red remove_image">-</button>
                                            <div>
                                                <span class="btn default btn-file">
                                                    <span class="fileinput-new">استعراض</span>
                                                    <span class="fileinput-exists">صوره</span>
                                                    <input type="file" name="cls_img_{$itr}"  accept="image/jpg, image/jpeg, image/png" class="img_cls fatmaclass"   {if {$image.name} eq "no image" OR {$image.name} eq ""} required  {/if}>
                                                </span>
                                                <a href="#" class="btn red fileinput-exists" data-dismiss="fileinput">
                                                    حذف </a>
                                            </div>
                                            <div class="clearfix margin-top-10 margin-bottom-10">
                                                <span class="label label-danger">ملاحظه!</span> يمكنك فقط رفع صور
                                            </div>
                                        </div>

                                    </div>
                                    {capture assign=itr}{$itr+1}{/capture}
                                    {/foreach}
                                </div>


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

                            <!--</div>-->
                            <div class="form-actions">
                                <div class="row">
                                    <div class="col-md-offset-3 col-md-4">
                                        <button type="submit" id="submit" class="btn green" >حفظ</button>
                                        <button type="button" class="btn default rtnshow" data-controll="{$controllname}">الغاء</button>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <!-- END FORM-->
                    </div>
                </div>
            </div>
        </div>
        <!-- END PAGE CONTENT-->
    </div>
</div>

<!-- END CONTENT -->