<!-- MENU NAVBAR HEADER-->
<?php echo Modules::run('menuadmin/menubyactive',6);?>
<!-- /MENU NAVBAR HEADER -->

<section id="middle">


    <!-- page title -->
    <header id="page-header">
        <h1>Products</h1>
        <ol class="breadcrumb">
            <li><a href="#">Products</a></li>
            <li class="active"><?php echo $item!=NULL?"Edit":"Add"?></li>
        </ol>
    </header>
    <!-- /page title -->


    <div id="content" class="padding-20">

        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading panel-heading-transparent">
                        <strong>Product Infomation</strong>
                        <!-- right options -->
                    </div>

                    <div class="panel-body">

                        <form class="validate" id="productform" action="<?php echo base_url()?>products/add" method="post" enctype="multipart/form-data" data-toastr-url="<?php echo current_url()?>"  data-success="Sent! Thank you!"  data-toastr-position="top-right" >

                            <fieldset>
                                <!-- required [php action request] -->
                                <input type="hidden" name="id" value="<?php echo @$item->id?>" />

                                <div class="row">
                                    <div class="col-md-12 col-sm-12">

                                        <div class=" row">
                                            <div class="form-group">
                                                <div class="col-md-6 col-sm-6">
                                                    <div class="alert alert-bordered-dotted" >
                                                        <label>
                                                            Thumbnail Image 1
                                                        </label>
                                                        <div align="center">
                                                            <figure class="margin-bottom-10 center"><!-- image -->
                                                                <img id="thumbnail1_image" class="img-responsive" src="<?php echo img_check(base_url().IMAGE_PATH.@$item->thumbnail1_image)?>" alt="" />
                                                            </figure><!-- /image -->
                                                        </div>
                                                    </div>

                                                    <!-- custom file upload -->
                                                    <div class="fancy-file-upload fancy-file-primary">
                                                        <i class="fa fa-upload"></i>
                                                        <input type="file" class="form-control" name="thumbnail1_image" onchange="jQuery(this).next('input').val(this.value);preThumbnail1Image(this) " />
                                                        <input type="text" class="form-control" placeholder="no file selected" readonly="" />
                                                        <span class="button">Choose File</span>
                                                    </div>
                                                    <small class="text-muted block">Max file size: 10Mb (jpg/png)</small>

                                                </div>
                                                <div class="col-md-6 col-sm-6">
                                                    <div class="alert alert-bordered-dotted" >
                                                        <label>
                                                            Thumbnail Image 2
                                                        </label>

                                                        <div align="center">
                                                            <figure class="margin-bottom-10"><!-- image -->
                                                                <img id="thumbnail2_image" class="img-responsive" src="<?php echo img_check(base_url().IMAGE_PATH.@$item->thumbnail2_image)?>" alt=""  />
                                                            </figure><!-- /image -->
                                                        </div>

                                                    </div>

                                                    <!-- custom file upload -->
                                                    <div class="fancy-file-upload fancy-file-primary">
                                                        <i class="fa fa-upload"></i>
                                                        <input type="file" class="form-control" name="thumbnail2_image" onchange="jQuery(this).next('input').val(this.value);preThumbnail2Image(this)" />
                                                        <input type="text" class="form-control" placeholder="no file selected" readonly="" />
                                                        <span class="button">Choose File</span>
                                                    </div>
                                                    <small class="text-muted block">Max file size: 10Mb (jpg/png)</small>

                                                </div>
                                            </div>
                                        </div>


                                        <div class="row">
                                            <div class="form-group">
                                                <div class="col-md-12 col-sm-12">
                                                    <label>Product Code *</label>
                                                    <input type="text" name="code" value="<?php echo @$item->code?>" class="form-control required">
                                                </div>
                                            </div>
                                        </div>

                                        <div class="tabs nomargin">

                                            <!-- tabs -->
                                            <ul class="nav nav-tabs">
                                                <?php foreach ($langs as $key => $lang){?>
                                                    <li class="<?php echo $key==0?'active':''?>">
                                                        <a href="#tab<?php echo $key+1?>_title" data-toggle="tab">
                                                            <label>Title <?php echo strtoupper($lang->shorttitle)?> * </label>
                                                        </a>
                                                    </li>
                                                <?php }?>
                                            </ul>

                                            <!-- tabs content -->
                                            <div class="tab-content ">
                                                <?php foreach ($langs as $key => $lang){?>
                                                    <div id="tab<?php echo $key+1?>_title" class="tab-pane <?php echo $key==0?'active':''?>">
                                                        <div class="row">
                                                            <div class="form-group">
                                                                <div class="col-md-12 col-sm-12">
                                                                    <input type="text" name="title_<?php echo $lang->shorttitle?>" value="<?php echo @$item->{"title_".$lang->shorttitle}?>" class="form-control required">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                <?php }?>
                                            </div>
                                        </div>

                                        <hr>


                                        <div class="row">
                                            <div class="form-group">
                                                <div class="col-md-12 col-sm-12">
                                                    <label>Product Category *</label>
                                                    <select name="category" class="form-control pointer required">
                                                        <?php echo dropdown_option(@$category,@$item->category)?>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="form-group">

                                                <div class="col-md-6 col-sm-6">
                                                    <label>Product In Stock *</label>
                                                    <input type="text" name="in_stock" value="<?php echo @$item->in_stock?>" class="form-control required">
                                                </div>

                                                <div class="col-md-6 col-sm-6">
                                                    <label>Product Rate *</label>
                                                    <input type="text" name="rate" value="<?php echo @$item->rate?>" min="0" max="5" class="form-control stepper  required">
                                                </div>
                                            </div>
                                        </div>

                                        <div class="tabs nomargin">

                                            <!-- tabs -->
                                            <ul class="nav nav-tabs">
                                                <?php foreach ($langs as $key => $lang){?>
                                                    <li class="<?php echo $key==0?'active':''?>">
                                                        <a href="#tab<?php echo $key+1?>_desc" data-toggle="tab">
                                                            <label>Product Description <?php echo strtoupper($lang->shorttitle)?> * </label>
                                                        </a>
                                                    </li>
                                                <?php }?>
                                            </ul>

                                            <!-- tabs content -->
                                            <div class="tab-content ">
                                                <?php foreach ($langs as $key => $lang){?>
                                                    <div id="tab<?php echo $key+1?>_desc" class="tab-pane <?php echo $key==0?'active':''?>">
                                                        <div class="row">
                                                            <div class="form-group">
                                                                <div class="col-md-12 col-sm-12">

                                                                    <textarea name="desc_<?php echo $lang->shorttitle?>" rows="4" class="form-control required"><?php echo @$item->{"desc_".$lang->shorttitle}?></textarea>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                <?php }?>
                                            </div>
                                        </div>

                                        <hr>

                                        <div class="row">
                                            <div class="form-group">
                                                <div class=" col-md-12 col-sm-12" align="right">
                                                    <label class="switch switch switch-round">
                                                        <span> Active to public on the web?</span>

                                                        <input name="is_active" type="checkbox" <?php echo @$item->is_active=='Y'?'checked=""':''?> >
                                                        <span class="switch-label" data-on="Yes" data-off="No"></span>
                                                    </label>
                                                </div>

                                            </div>
                                        </div>


                                    </div>
                                </div>

                            </fieldset>

                            <div class="row">
                                    <div class="col-md-12">
                                        <button id="savebtn" type="submit" form="productform" value="Submit" class="progress-button btn btn-3d btn-teal btn-xlg btn-block margin-top-30" >
                                                SAVE
                                        </button>
                                    </div>
                            </div>

                        </form>

                    </div>

                </div>
            </div>
            <div class="col-md-12">
                <?php if($product_id!=''){?>
                <div class="panel panel-default">
                    <div class="panel-heading panel-heading-transparent">
                        <strong>Product Specifications</strong>
                        <!-- right options -->
                    </div>

                    <div class="panel-body">



                        <table id="product_specs"></table>

                        <div id="pager_product_specs"></div>



                    </div>

                </div>
                <?php } ?>
                <div class="panel panel-default">
                    <div class="panel-heading panel-heading-transparent">
                        <strong>Product Images</strong>
                        <!-- right options -->
                    </div>

                    <div class="panel-body">
                        <form action="<?php echo base_url()?>products/dropzone_add/<?php echo @$item->id?>" method="post" class="dropzone" id="my-dropzone"></form>
                    </div>


                </div>
            </div>


        </div>

    </div>
</section>