<!-- Start right content -->
<div class="content-page">
    <!-- ============================================================== -->
    <!-- Start Content here -->
    <!-- ============================================================== -->
    <div class="content">
        <!-- Page Heading Start -->
        <?php /*<div class="page-heading">
            <h1><i class='fa fa-file'></i> <?php echo $viewTitle;?></h1>
            <h3><?php echo $viewTitle;?></h3>
        </div>*/?>
        <!-- Page Heading End-->

        <div class="row">

            <div class="col-sm-12 portlets">

                <div class="widget">
                    <div class="data-table-toolbar">
                        <div class="row">
                            <div class="col-md-4">
                                <h4><strong> <?php echo $urun->baslik_tr;?> </strong> ürününe döküman ekliyorsunuz...</h4>
                            </div>
                            <div class="col-md-8">
                                <div class="toolbar-btn-action">
                                    <a href="<?php echo base_url("backend/products");?>" class="btn btn-red-1"><i class="fa fa-list"></i> Ürün Listesi</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="widget-content padding">
                        <div id="basic-form">

                            <?php
                            if (isset($form_hatasi))
                            {
                            ?>
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                    <?php 
                                        /*$titleError         = form_error("title");
                                        $aciklamaError      = form_error("aciklama");
                                        $pageTitleerror     = form_error("pagetitle");
                                        $metadescError      = form_error("metadesc");
                                        $metakeyError       = form_error("metakey");

                                        if ($titleError <> "")      {echo form_error("title")."<br />";}
                                        if ($aciklamaError <> "")   {echo form_error("aciklama")."<br />";}
                                        if ($pageTitleerror <> "")  {echo form_error("pagetitle")."<br />";}
                                        if ($metadescError <> "")   {echo form_error("metadesc")."<br />";}
                                        if ($metakeyError <> "")    {echo form_error("metakey")."<br />";}*/
                                    ?>
                                </div>
                            <?php
                            }
                            ?>

                            <form role="form" action="<?php echo base_url("backend/products/dokumanFormKaydet/$urun->id");?>" method="post" enctype="multipart/form-data">

                                <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script> 
                                <script type="text/javascript">
                                $(document).ready(function(){
                                 
                                   var cnt = 2;
                                   $(".addCF").click(function(){
                                      $("#westarz").append('<br /><input type="file" name="files[]" class="form-control" placeholder=""><input type="text" name="adi[]" class="form-control" placeholder="BAŞLIK"><BR/><BR/>');
                                      cnt++;
                                   }); 
                                });
                                </script>


                                <div class="form-group" id="westarz" align="center">
                                    <button href="javascript:void(0);" class="btn btn-primary btn-lg btn-block addCF" type="button">Yeni Döküman Ekle</button>
                                </div>

                                <div class="form-group pull-right">
                                    <button type="submit" class="btn btn-info">Kaydet</button>
                                </div>
                            </form>
                        </div>
                    </div>


                    <br /><br /><br />
                    <div style="height: 40px; background-color: #eb5055; color: yellow; padding-top: 1px;" align="center"><h4 style="color: white;"><strong>Daha Önce Eklenenler</strong></h4></div>

                    <div class="table-responsive">
                            <table data-sortable class="table table-hover table-striped">
                                <thead>
                                <tr>
                                    <th><i class="fa fa-sort"></i></th>
                                    <th>ID</th>
                                    <th>Başlık</th>
                                    <th>Döküman</th>
                                    <th>İşlem</th>
                                </tr>
                                </thead>

                                <tbody>
                                <?php
                                foreach ($documents as $item)
                                {
                                    ?>
                                    <tr id="ord-<?php echo $item->id;?>" style="cursor: move;">
                                        <td><i class="fa fa-sort-amount-asc"></i></td>
                                        <td><?php echo $item->id;?></td>
                                        <td><?php echo $item->baslik;?></td>
                                        <td align="center">
                                            <button onclick="location.href='<?php echo base_url("uploads/documents/$item->dosya");?>'" class="btn btn-success btn-xs" type="button">Aç</button>
                                        <td>
                                            <div class="btn-group btn-group-xs">
                                                <button data-url="<?php echo base_url("backend/products/dokumanSil/$item->id/$urunid")?>"
                                                        class="btn btn-danger btn-xs remove-btn">
                                                    <i class="fa fa-trash-o"></i> Sil
                                                </button>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php
                                }
                                ?>
                                </tbody>
                            </table>
                        </div>

                </div>

            </div>

        </div>
        <?php $this->load->view("includes/footer");?>
    </div>
    <!-- ============================================================== -->
    <!-- End content here -->
    <!-- ============================================================== -->

</div>
<!-- End right content -->