<?php /* Smarty version Smarty-3.1.11, created on 2024-07-15 17:47:05
         compiled from "..\views\default\policyview\show.html" */ ?>
<?php /*%%SmartyHeaderCode:2197266954479e14438-86135966%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '9b6f5c1dce285b61ffbb6f8303f70b3488c904fc' => 
    array (
      0 => '..\\views\\default\\policyview\\show.html',
      1 => 1695607144,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '2197266954479e14438-86135966',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'message' => 0,
    'youtubes' => 0,
    'outputString' => 0,
    'shippercompaniesData' => 0,
    'shippercompanies' => 0,
    'policyData' => 0,
    'policy' => 0,
    'i' => 0,
    'allSave' => 0,
    'data' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_66954479ed5073_00450630',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_66954479ed5073_00450630')) {function content_66954479ed5073_00450630($_smarty_tpl) {?>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">خصائص عامة</a></li>
            <li><a href="policyController.php?do=show">بوليصة الشحن</a></li>
            <li class="active">عرض بواليص الشحن</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading" style="padding:5px 15px 15px">
                <h3 class="panel-title" style="display: inline-block;">عرض بواليص الشحن <br />
                    <?php if ($_smarty_tpl->tpl_vars['message']->value!=''){?>
                    <?php echo $_smarty_tpl->tpl_vars['message']->value;?>

                    <?php }?></h3>
                <a href="<?php echo $_smarty_tpl->tpl_vars['youtubes']->value[4]->url;?>
" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
                <a href="policyController.php" class="hidden-print"><input type="button" style="margin-left: 12px" id="submit"  class="btn btn-primary pull-left " value="إضافة جديد"/></a>
            </div>

            <div class="panel-body">
                <div id="outputString" class="alert alert-block alert-success fade in hidden-print" style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p id="outputStringValue"><?php echo $_smarty_tpl->tpl_vars['outputString']->value;?>
</p>
                    <div class="clearfix"></div>
                </div>
                <form class="form-inline hidden-print" action="policyController.php?do=show" method="post">
                    <div class="form-group">
                        <label class="sr-only">شركة الشحن</label>
                        <select class="select2 wdt100"  name="companyId" id="companyId">
                            <option value="-1">اختر شركة</option>


                            <?php  $_smarty_tpl->tpl_vars['shippercompanies'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['shippercompanies']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['shippercompaniesData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['shippercompanies']->key => $_smarty_tpl->tpl_vars['shippercompanies']->value){
$_smarty_tpl->tpl_vars['shippercompanies']->_loop = true;
?>


                            <option value="<?php echo $_smarty_tpl->tpl_vars['shippercompanies']->value->companyId;?>
"><?php echo $_smarty_tpl->tpl_vars['shippercompanies']->value->companyName;?>
</option>


                            <?php } ?>


                        </select>
                    </div>

                    <div class="form-group">
                        <label for="type" class="col-lg-2 control-label">النوع</label>
                        <div class="col-lg-10">
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="type"  value="1">
                                    عملاء
                                </label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input type="radio" name="type"  value="2">
                                    موردين
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <input type="submit" class="btn btn-primary" value="عرض"/>
                    </div>
                </form>
            </div>
            <hr/>

            <!-- Table -->
            
            <form method="post" action="policyController.php?do=executeOperation" onsubmit="if (Spry.Widget.Form.validate(this)) {
                        return countChoosenProducts('policyController');
                    } else {
                        return false;
                    }">
                
                <table class="table table-black dataTableClass">
                    <thead>
                        <tr>
                            <th class="hidden-print">
                                <input type="checkbox" name="checkAll" id="checkAll"/>
                            </th>
                            <th>رقم الفاتوره  </th>
                            <th>عدد الطرود </th>
                            <th>رقم البوليصة</th>
                            <th>السعر</th>
                            <th>شركة الشحن</th>
                            <th>التاريخ</th>
                            <th>نوع البوليصة</th>
                            <th>النوع</th>
                            <th>اسم العميل/ المورد</th>
                            <th>تحصيل/ دفعة</th>
                            <th class="hidden-print">تعديل</th>
                            <th class="hidden-print">حذف</th>
                        </tr>
                    </thead>
                    <tbody>

                        <?php  $_smarty_tpl->tpl_vars['policy'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['policy']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['policyData']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['policy']->key => $_smarty_tpl->tpl_vars['policy']->value){
$_smarty_tpl->tpl_vars['policy']->_loop = true;
?>
                        <?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['policy']->value->tempdele;?>
<?php $_tmp1=ob_get_clean();?><?php if ($_tmp1==1){?>
                        <tr class="danger"> <?php }else{?><?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['policy']->value->tempdele;?>
<?php $_tmp2=ob_get_clean();?><?php if ($_tmp2==0){?>

                        <tr> <?php }}?>
                            <td class="hidden-print">
                                <input type="checkbox" name="choosedItem[]" id="checked<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" class="choosenItem" value="<?php echo $_smarty_tpl->tpl_vars['policy']->value->policyId;?>
" />
                            </td>
                            <td><?php echo $_smarty_tpl->tpl_vars['policy']->value->invoicenumber;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['policy']->value->policyName;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['policy']->value->policyNum;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['policy']->value->policyCost;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['policy']->value->companyName;?>
</td>
                            <td><?php echo $_smarty_tpl->tpl_vars['policy']->value->policyDate;?>
</td>
                            <?php if ($_smarty_tpl->tpl_vars['policy']->value->policyType==1){?>
                            <td>ذهاب</td>
                            <?php }else{ ?>
                            <td>عودة</td>
                            <?php }?>
                            <td><?php if ($_smarty_tpl->tpl_vars['policy']->value->senderType==1){?>عملاء<?php }else{ ?>موردين<?php }?></td>
                            <td><?php echo $_smarty_tpl->tpl_vars['policy']->value->senderName;?>
</td>
                            <td>
                                <?php if ($_smarty_tpl->tpl_vars['policy']->value->affectSave==1){?>
                                <select class="select2 policySave" data-id="<?php echo $_smarty_tpl->tpl_vars['policy']->value->policyId;?>
" data-itr="<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
" id="save<?php echo $_smarty_tpl->tpl_vars['i']->value;?>
">
                                    <option></option>
                                    <?php  $_smarty_tpl->tpl_vars['data'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['data']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['allSave']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['data']->key => $_smarty_tpl->tpl_vars['data']->value){
$_smarty_tpl->tpl_vars['data']->_loop = true;
?>
                                    <option value="<?php echo $_smarty_tpl->tpl_vars['data']->value->saveid;?>
"><?php echo $_smarty_tpl->tpl_vars['data']->value->savename;?>
</option>
                                    <?php } ?>
                                </select>
                                <?php }?>
                            </td>
                            <td class="hidden-print"> <a href="policyController.php?do=edit&policyId=<?php echo $_smarty_tpl->tpl_vars['policy']->value->policyId;?>
" type="button" class="btn btn-default btn-lg editicon"></a> </td>
                            <td class="hidden-print"> <a href="#" name="dd" type="button" class="btn btn-default btn-lg deleteicon conformdel1" data-position="policyController.php?do=delete&policyId=<?php echo $_smarty_tpl->tpl_vars['policy']->value->policyId;?>
" ></a> </td>
                        </tr>
                        <?php } ?>

                    </tbody>

                </table>
                <div class="clearfix"></div>
                <hr />
                <div  class="hidden-print">
                    <div class="col-lg-12">
                        <div class="well well-sm">
                            <div class="form-group">
                                <div class="col-lg-4">
                                    <label for="operation"></label>
                                    <span id="spryselect1">
                                        <select name="operation" id="operation"  data-placeholder="اختر العملية" class="select2 wdt100">
                                            <option value="-1">اختر عملية</option>
                                            <option value="3">حذف</option>
                                        </select>
                                        <span class="selectInvalidMsg">*</span></span></div>
                            </div>
                            <div class="form-group">
                                <div class="col-lg-4">
                                    <input name=""  class="hidden-print btn btn-primary" type="submit" value="تنفيذ"/>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                            <div id="noElementsError" class="alert alert-danger fade in" style="display:none;">
                                <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">×</button>
                                <p>يجب اختيار العناصر أولاً</p>
                                <div class="clearfix"></div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </form>

            <div class="clearfix"></div>
        </div>
        <div  class="hidden-print">
            <div class="col-lg-12">
                <div class="form-group">
                    <div class="col-lg-4">
                        <button type="button" onclick="print_Custom('mycustomheader');" class="btn btn-success pull-right">طباعة</button>
                    </div>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
        <!-- Modal -->
        <div class="modal fade hidden-print" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close pull-left" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">تأكيد حذف البوليصة</h4>
                    </div>
                    <div class="modal-body"> هل تريد حذف هذه البوليصة؟ </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">لا</button>
                        <button type="button" class="btn btn-primary savemodel1">نعم</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->

    </div>
</div>

<script type="text/javascript">
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {isRequired: false, invalidValue: "-1"});

    $('.policySave').live('change', function () {
        if (!$(this).hasClass('processing...')) {
            $(this).addClass('processing...');
            var thisIs = $(this);

            $.ajax({
                type: "POST",
                url: 'policyAjaxController.php?do=dopay',
                data: {policy: thisIs.data('id'), save: thisIs.val()},
                async: false,
                success: function (data) {
                    console.log(data);
                    data = Number(data);
                    console.log(data);
                    if (data > 0) {
                        thisIs.parent().html('تمت العملية بنجاح')
                    } else {
                        thisIs.removeClass('processing...');
                    }
                }
            });


        }

    });
</script>
<?php }} ?>