<?php $__env->startSection('content'); ?>
<?php
use App\Models\IncomManufacturingModel;
use App\Models\OutcomManufacturingModel;
?>
  <title><?php echo e(trans('admin.ManufacturingModelSechdule')); ?></title>

    <main id="js-page-content" role="main" class="page-content">

                    <ol class="breadcrumb page-breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0);"> <?php echo e(trans('admin.Manufacturing')); ?></a></li>
                        <li class="breadcrumb-item active"><?php echo e(trans('admin.ManufacturingModelSechdule')); ?></li>
                        <li class="position-absolute pos-top pos-right d-none d-sm-block"><span
                                class="js-get-date"></span></li>
                    </ol>

                    <div class="row">
                        <div class="col-xl-12">
                            <div id="panel-1" class="panel">
                                <div class="panel-hdr">
                                    <h2>
                                         <span class="fw-300"><i><?php echo e(trans('admin.ManufacturingModelSechdule')); ?></i></span>
                                    </h2>

                                    <div class="panel-toolbar">


                     <button class="btn btn-primary btn-sm mx-3" data-toggle="dropdown">Table Style</button>

                                        <?php echo $__env->make('admin.layouts.toolbar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                    </div>

                                </div>
                                <div class="panel-container show">
                                   <span id="ex"> <?php echo $__env->make('admin.layouts.messages', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?></span>
                                    <div class="panel-content">
                                        <!-- datatable start -->
                                        <div style="overflow:auto;">
                                        <table id="dt-basic-example"
                                            class="table table-bordered table-hover table-striped " >
                                            <thead class="bg-highlight">
                                                <tr>
                                                    <th><?php echo e(trans('admin.Code')); ?></th>
                                                    <th><?php echo e(trans('admin.Date')); ?></th>
                                                    <th><?php echo e(trans('admin.Arabic_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.English_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.Time')); ?></th>
                                                    <th><?php echo e(trans('admin.Draw')); ?></th>
                                                    <th><?php echo e(trans('admin.Notes')); ?></th>
                                                    <th><?php echo e(trans('admin.Hall')); ?></th>
                                                    <th><?php echo e(trans('admin.Coin')); ?></th>
                                                    <th><?php echo e(trans('admin.Cost_Center')); ?></th>
                                                    <th><?php echo e(trans('admin.User')); ?></th>
                                                    <th><?php echo e(trans('admin.Income')); ?></th>
                                                    <th><?php echo e(trans('admin.Outcome')); ?></th>
                                                    <th><?php echo e(trans('admin.Actions')); ?></th>

                                                </tr>
                                            </thead>
                                            <tbody>

                                            <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <tr>
                                                    <td><?php echo e($item->Code); ?></td>
                                                    <td><?php echo e($item->Date); ?></td>
                                                    <td><?php echo e($item->Name); ?></td>
                                                    <td><?php echo e($item->NameEn); ?></td>
                                                    <td><?php echo e($item->Time); ?></td>
                                                    <td><?php echo e($item->Draw); ?></td>
                                                    <td><?php echo e($item->Note); ?></td>

                                                    <td>
                                                    <?php if(!empty($item->Hall()->first()->Arabic_Name)): ?>

                                                 <?php echo e(app()->getLocale() == 'ar' ?$item->Hall()->first()->Arabic_Name :$item->Hall()->first()->English_Name); ?>

                                                    <?php endif; ?>
                                                    </td>
                                                    <td>
                                                        <?php if(!empty($item->Coin()->first()->Arabic_Name)): ?>
                                        <?php echo e(app()->getLocale() == 'ar' ?$item->Coin()->first()->Arabic_Name :$item->Coin()->first()->English_Name); ?>

                                                        <?php endif; ?>
                                                    </td>
                                                    <td>
                                                       <?php if(!empty($item->Cost_Center()->first()->Arabic_Name)): ?>


                                         <?php echo e(app()->getLocale() == 'ar' ?$item->Cost_Center()->first()->Arabic_Name :$item->Cost_Center()->first()->English_Name); ?>

                                                    <?php endif; ?>
                                                    </td>


                                                    <td>
                                                        <?php if(!empty($item->User()->first()->name)): ?>
                                        <?php echo e(app()->getLocale() == 'ar' ?$item->User()->first()->name :$item->User()->first()->nameEn); ?>

                                                        <?php endif; ?>
                                                    </td>

                                                    <td>
                                   <button type="button" class="btn btn-default" data-toggle="modal" data-target="#incom<?php echo e($item->id); ?>"> <?php echo e(trans('admin.Income')); ?></button>
                                                    </td>

                                                    <td>
                                   <button type="button" class="btn btn-default" data-toggle="modal" data-target="#outcom<?php echo e($item->id); ?>"> <?php echo e(trans('admin.Outcome')); ?></button>
                                                    </td>

                                                    <td class="text-center">

                                   <a href="<?php echo e(url('PrintManufacturingModel/'.$item->id)); ?>" class="btn btn-default" ><i class="fal fa-print"></i></a>
                                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('حذف نموذج تصنيع')): ?>
             <button type="button" class="btn btn-default" data-toggle="modal" data-target="#default-example-modal-center<?php echo e($item->id); ?>"><i class="fal fa-trash"></i></button>
                                                        <?php endif; ?>



                                  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('تعديل نموذج تصنيع')): ?>

                                        <?php if($item->Type == 1): ?>
       <a href="<?php echo e(url('EditManufacturingModel/'.$item->id)); ?>" class="btn btn-default" ><i class="fal fa-edit"></i></a>
                                        <?php else: ?>
             <a href="<?php echo e(url('EditManufacturingModelPrecent/'.$item->id)); ?>" class="btn btn-default" ><i class="fal fa-edit"></i></a>

                                        <?php endif; ?>
                                                        <?php endif; ?>
                                                    </td>
                                                </tr>
                                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                                            </tbody>
                                            <tfoot>
                                                <tr>
                                                    <th><?php echo e(trans('admin.Code')); ?></th>
                                                    <th><?php echo e(trans('admin.Date')); ?></th>
                                                    <th><?php echo e(trans('admin.Arabic_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.English_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.Time')); ?></th>
                                                    <th><?php echo e(trans('admin.Draw')); ?></th>
                                                    <th><?php echo e(trans('admin.Notes')); ?></th>
                                                    <th><?php echo e(trans('admin.Hall')); ?></th>
                                                    <th><?php echo e(trans('admin.Coin')); ?></th>
                                                    <th><?php echo e(trans('admin.Cost_Center')); ?></th>
                                                    <th><?php echo e(trans('admin.User')); ?></th>
                                                    <th><?php echo e(trans('admin.Income')); ?></th>
                                                    <th><?php echo e(trans('admin.Outcome')); ?></th>
                                                    <th><?php echo e(trans('admin.Actions')); ?></th>
                                                </tr>
                                            </tfoot>
                                        </table>
                                        </div>
                                        <?php echo e($items->Links()); ?>

                                        <!-- datatable end -->
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>


         <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>



                                <!-- Modal Incom -->
    <div class="modal fade" id="incom<?php echo e($item->id); ?>" tabindex="-1" role="dialog"
                aria-hidden="true">
                <div class="modal-dialog modal-dialog-centered modal-xl" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="modal-title">
                               <?php echo e(trans('admin.Details')); ?>

                            </h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true"><i class="fal fa-times"></i></span>
                            </button>
                        </div>
                        <div class="modal-body">


                <?php
                $details=IncomManufacturingModel::where('Model',$item->id)->get();
                ?>
                        <div class="mt-3">
                            <table id=""
                            class="table table-bordered table-hover table-striped">
                            <thead>
                                <tr>
                                     <th><?php echo e(trans('admin.Name')); ?></th>
                                                            <th><?php echo e(trans('admin.Unit')); ?></th>
                                                            <th><?php echo e(trans('admin.Code')); ?></th>
                                                            <th><?php echo e(trans('admin.Qty')); ?></th>
                                                            <?php if($item->Type == 2): ?>
                                                        <th><?php echo e(trans('admin.Precent')); ?></th>
                                                            <?php endif; ?>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سعر التكلفة في التصنيع')): ?>
                                    <th><?php echo e(trans('admin.Price')); ?></th>
                                                            <th><?php echo e(trans('admin.Discount')); ?></th>
                                                            <th><?php echo e(trans('admin.Total_Bf_Taxes')); ?></th>
                                                            <th><?php echo e(trans('admin.Tax')); ?></th>
                                                            <th><?php echo e(trans('admin.Total')); ?></th>
                                   <?php endif; ?>
                                                            <th><?php echo e(trans('admin.Store')); ?></th>
                                                            <th><?php echo e(trans('admin.Depreciation_Precent')); ?>%</th>
                                                            <th><?php echo e(trans('admin.Depreciation')); ?></th>
                                </tr>
                            </thead>
                            <tbody id="">
                                <?php $__currentLoopData = $details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $detail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                     <td><?php echo e(app()->getLocale() == 'ar' ?$detail->P_Ar_Name :$detail->P_En_Name); ?></td>
                                    <td><?php echo e(app()->getLocale() == 'ar' ?$detail->Unit()->first()->Name :$detail->Unit()->first()->NameEn); ?></td>
                                    <td><?php echo e($detail->Product_Code); ?></td>
                                    <td><?php echo e($detail->Qty); ?></td>
                                              <?php if($item->Type == 2): ?>
                                    <td><?php echo e($detail->Precent); ?></td>
                                    <?php endif; ?>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سعر التكلفة في التصنيع')): ?>
                                    <td><?php echo e($detail->Cost); ?></td>
                                    <td><?php echo e($detail->Discount); ?></td>
                                    <td> <?php echo e(round($detail->Total_Bf_Tax)); ?></td>
                                    <td><?php echo e(app()->getLocale() == 'ar' ?$detail->Tax()->first()->Name :$detail->Tax()->first()->NameEn); ?></td>
                                    <td> <?php echo e(round($detail->Total)); ?></td>
                                    <?php endif; ?>
                                    <td>
                        <?php echo e(app()->getLocale() == 'ar' ?$detail->Store()->first()->Name :$detail->Store()->first()->NameEn); ?>

                                    </td>
                                    <td><?php echo e(round($detail->Depreciation)); ?></td>
                                    <td><?php echo e(round($detail->Depreciation_Qty)); ?></td>

                                </tr>
                                 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                            <tfoot>
                                <tr>
                                             <th><?php echo e(trans('admin.Name')); ?></th>
                                                            <th><?php echo e(trans('admin.Unit')); ?></th>
                                                            <th><?php echo e(trans('admin.Code')); ?></th>
                                                            <th><?php echo e(trans('admin.Qty')); ?></th>
                                                            <?php if($item->Type == 2): ?>
                                                        <th><?php echo e(trans('admin.Precent')); ?></th>
                                                            <?php endif; ?>

                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سعر التكلفة في التصنيع')): ?>
                                    <th><?php echo e(trans('admin.Price')); ?></th>
                                                            <th><?php echo e(trans('admin.Discount')); ?></th>
                                                            <th><?php echo e(trans('admin.Total_Bf_Taxes')); ?></th>
                                                            <th><?php echo e(trans('admin.Tax')); ?></th>
                                                            <th><?php echo e(trans('admin.Total')); ?></th>
                                    <?php endif; ?>
                                                            <th><?php echo e(trans('admin.Store')); ?></th>
                                                            <th><?php echo e(trans('admin.Depreciation_Precent')); ?>%</th>
                                                            <th><?php echo e(trans('admin.Depreciation')); ?></th>
                                </tr>
                            </tfoot>
                        </table>
                        <table class="table table-bordered table-hover table-striped w-100 mt-4">
                            <tbody>
                                <tr>
                                    <td><?php echo e(trans('admin.Product_Numbers')); ?></td>
                                    <td><?php echo e($item->Product_Numbers); ?></td>

                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سعر التكلفة في التصنيع')): ?>
                                    <td><?php echo e(trans('admin.Total_Discount')); ?></td>
                                    <td><?php echo e($item->Total_Discount); ?></td>

                                     <td><?php echo e(trans('admin.Total_Bf_Taxes')); ?></td>
                                    <td><?php echo e(ROUND($item->Total_BF_Taxes)); ?></td>

                                    <td><?php echo e(trans('admin.Total_Taxes')); ?></td>
                                    <td><?php echo e($item->Total_Taxes); ?></td>

                                    <td><?php echo e(trans('admin.Total_Price')); ?></td>
                                    <td><?php echo e(round($item->Total_Price)); ?></td>
                                        <?php endif; ?>

                                </tr>
                            </tbody>
                        </table>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(trans('admin.Close')); ?></button>
                        </div>
                    </div>
                </div>
            </div>

            </div>

                 <!-- Modal Outcom -->
            <div class="modal fade" id="outcom<?php echo e($item->id); ?>" tabindex="-1" role="dialog"
                aria-hidden="true">
                <div class="modal-dialog modal-dialog-centered modal-xl" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="modal-title">
                               <?php echo e(trans('admin.Details')); ?>

                            </h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true"><i class="fal fa-times"></i></span>
                            </button>
                        </div>
                        <div class="modal-body">


                <?php
                $details=OutcomManufacturingModel::where('Model',$item->id)->get();
                ?>
                        <div class="mt-3">
                            <table id=""
                            class="table table-bordered table-hover table-striped">
                            <thead>
                                <tr>
                                                            <th><?php echo e(trans('admin.Name')); ?></th>
                                                            <th><?php echo e(trans('admin.Unit')); ?></th>
                                                            <th><?php echo e(trans('admin.Code')); ?></th>
                                                            <th><?php echo e(trans('admin.Qty')); ?></th>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سعر التكلفة في التصنيع')): ?>
                                    <th><?php echo e(trans('admin.Cost')); ?></th>
                                    <?php endif; ?>
                                                            <th><?php echo e(trans('admin.Store')); ?></th>
                                </tr>
                            </thead>
                            <tbody id="">
                                <?php $__currentLoopData = $details; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $detail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                     <td><?php echo e(app()->getLocale() == 'ar' ?$detail->P_Ar_Name :$detail->P_En_Name); ?></td>
                                    <td><?php echo e(app()->getLocale() == 'ar' ?$detail->Unit()->first()->Name :$detail->Unit()->first()->NameEn); ?></td>
                                    <td><?php echo e($detail->Product_Code); ?></td>
                                    <td><?php echo e($detail->Qty); ?></td>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('سعر التكلفة في التصنيع')): ?>
                                    <td><?php echo e($detail->Cost); ?></td>
                                    <?php endif; ?>
                                    <td>     <?php echo e(app()->getLocale() == 'ar' ?$detail->Store()->first()->Name :$detail->Store()->first()->NameEn); ?>     </td>

                                </tr>
                                 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>

                        </table>

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(trans('admin.Close')); ?></button>
                        </div>
                    </div>
                </div>
            </div>

            </div>

                      <!-- Modal Delete -->
     <div class="modal fade" id="default-example-modal-center<?php echo e($item->id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title">
                                          <?php echo e(trans('admin.RUSWDT')); ?> <strong><?php echo e($item->Code); ?></strong>
                                    </h4>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                    </button>
                                </div>

                                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-dismiss="modal"> <?php echo e(trans('admin.No')); ?></button>
                   <a href="<?php echo e(url('DeleteManufacturingModel/'.$item->id)); ?>"  class="btn btn-primary"> <?php echo e(trans('admin.Yes')); ?></a>
                                </div>
                            </div>
                        </div>
                    </div>

        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </main>

<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/datagrid/datatables/datatables.bundle.css')); ?>">
   <script src="<?php echo e(asset('Admin/js/datagrid/datatables/datatables.export.js')); ?>"></script>
    <script src="<?php echo e(asset('Admin/js/datagrid/datatables/datatables.bundle.js')); ?>"></script>
    <script>
        //_fnFeatureHtmlLength();
        $(document).ready(function () {
            // Setup - add a text input to each footer cell
            $('#dt-basic-example thead tr').clone(true).appendTo('#dt-basic-example thead');
            $('#dt-basic-example thead tr:eq(1) th').each(function (i) {
                var title = $(this).text();
                $(this).html('<input type="text" class="form-control form-control-sm" placeholder="Search ' + title + '" />');

                $('input', this).on('keyup change', function () {
                    if (table.column(i).search() !== this.value) {
                        table
                            .column(i)
                            .search(this.value)
                            .draw();
                    }
                });
            });
            var table = $('#dt-basic-example').DataTable(
                {
                    // responsive: true,
                    orderCellsTop: true,
                    fixedHeader: true,
                    lengthChange: true,

                    dom: "<'row mb-3'<'col-sm-12 col-md-3 d-flex align-items-center justify-content-start'f><'col-sm-12 col-md-9 d-flex align-items-center justify-content-end'B>>" +
                        "<'row'<'col-sm-12'tr>>" +
                        "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",

                    buttons: [
                        {
                            extend: 'pageLength',
                            className: 'btn-outline-default'
                        },
                        {
                            extend: 'colvis',
                            text: 'Column Visibility',
                            titleAttr: 'Col visibility',
                            className: 'btn-outline-default'
                        },
                        {
                            extend: 'pdfHtml5',
                            text: 'PDF',
                            titleAttr: 'Generate PDF',
                            className: 'btn-outline-danger btn-sm mr-1'
                        },
                        {
                            extend: 'excelHtml5',
                            text: 'Excel',
                            titleAttr: 'Generate Excel',
                            className: 'btn-outline-success btn-sm mr-1'
                        },
                        {
                            extend: 'csvHtml5',
                            text: 'CSV',
                            titleAttr: 'Generate CSV',
                            className: 'btn-outline-primary btn-sm mr-1'
                        },
                        {
                            extend: 'copyHtml5',
                            text: 'Copy',
                            titleAttr: 'Copy to clipboard',
                            className: 'btn-outline-primary btn-sm mr-1'
                        },
                        {
                            extend: 'print',
                            text: 'Print',
                            titleAttr: 'Print Table',
                            className: 'btn-outline-primary btn-sm'
                        }
                    ],
                });
            $('.js-thead-colors a').on('click', function () {
                var theadColor = $(this).attr("data-bg");
                console.log(theadColor);
                $('#dt-basic-example thead').removeClassPrefix('bg-').addClass(theadColor);
            });

            $('.js-tbody-colors a').on('click', function () {
                var theadColor = $(this).attr("data-bg");
                console.log(theadColor);
                $('#dt-basic-example').removeClassPrefix('bg-').addClass(theadColor);
            });

        });

    </script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('admin.index', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/klarapps/public_html/test.klarapps.com/resources/views/admin/Manufacturing/ManufacturingModelSechdule.blade.php ENDPATH**/ ?>