<?php $__env->startSection('title', 'Ledger Mappings'); ?>


<?php $__env->startSection('internal-js'); ?>
    <script>
        $(document).ready(function () {
            /**Download Section**/
            $('#example').DataTable( {
                dom: 'lBfrtip',
                buttons: [
                    { extend: 'excel', className: 'download-buttons'},
                ]
            } );
            $('#example1').dataTable();
        });

        function mapLedger(type, name){
            var route_link = '/map-ledger-account/'+type;

            $('#edit_dialog_content').html('<div style="text-align: center; margin: 20px 0 20px 0;"><img src="<?php echo e(asset('images/loads/loader.gif')); ?>" border=0></div>')
            .load(encodeURI(route_link))
            .dialog({
                modal: true,
                width: 500,
                title: "Map a Ledger Account to "+name,
                buttons: [
                    {
                        text: "Continue to Map",
                        icon: "ui-icon-check",
                        click: function(e) {
                            e.preventDefault();
                            var datas = $('#map-ledger-account').serializeArray();

                            $.ajax({
                                method: "POST",
                                url: route_link,
                                data: datas,
                                success: function (res){
                                    if(res == 'empty account'){
                                        alert('Please select an Account to map this Ledger');
                                    }else if(res == 'empty mappable ledger'){
                                        alert('Selected Ledger does\'t have an Identifier. Please contact System Admin');
                                    }else if(res == 'error'){
                                        alert('System is unable to perform the Requested action. Please Try Again!');
                                        location.reload();
                                    }else if(res == 'success'){
                                        window.location = '/mapped-ledgers?mapLedger=true';
                                    }else{
                                        alert('System Encountered an Error. Please Contact System Admin for Help');
                                        location.reload();
                                    }
                                }
                            });
                            return false;
                        }
                    }
                ],
                open: function() {
                    $(this).parent().css({'top': 50});
                }
            });
        }
    </script>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('internal-css'); ?>
    <style>

        #example th, td {
            text-align: left;
            padding: 5px;
        }
        #example tr:hover {background-color: #a3aef6;}

        #example1 th, td {
            text-align: left;
            padding: 5px;
        }
        #example1 tr:hover {background-color: #a3aef6;}
        table tbody,thead, tfoot {
            display: table;
            width: 100%;
        }

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


<?php $__env->startSection('headers'); ?>
    <?php echo $__env->make('headers.finance-header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php $__env->stopSection(); ?>



<?php $__env->startSection('heading', 'Manage Ledger Mappings'); ?>
<?php $__env->startSection('searches', ''); ?>
<?php $__env->startSection('done-by', ''); ?>


<?php $__env->startSection('content'); ?>
    <div class="tab">
        <button class="tablinks" onclick="openCity(event, 'leeds')" id="defaultOpen">Active Ledgers</button>
        <?php if(app('UserReads')->log == 1): ?>
            <button class="tablinks" onclick="openCity(event, 'log')">LOG </button>
        <?php endif; ?>
    </div>

    <div class="tabcontent" id="leeds">
        <div class="topright">
            <span onclick="this.parentElement.style.display='none'" class="topright" style="margin-left: 20px">&times</span>
        </div>
        <h3 class="error">Available Ledger Mappings</h3>
        <table id="example" class="table-overflow display" style="width:100%; border-collapse: collapse">
            <thead>
            <tr style="background-color: #a1b5d3">
                <th>No</th>
                <th>Ledger Name</th>
                <th>Details</th>
                <th>Mapped To</th>
                <th>Date Mapped</th>
                <th>User</th>
                <th>Status</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">TRADE DEBTORS(clients)</span></a></td>
                <td>TRADE DEBTORS(clients) - Premium Control - Asset</td>
                <td><?php echo e($data['Tdebtors']['mappedName']); ?></td>
                <td><?php echo e($data['Tdebtors']['mappedAt']); ?></td>
                <td><?php echo e($data['Tdebtors']['mappedBy']); ?></td>
                <?php if($data['Tdebtors']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('Tdebtors','TRADE DEBTORS(clients)' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('Tdebtors', 'TRADE DEBTORS(clients)')" class="inner"><span class="error">Map this Ledger </span> </a></td>
                <?php endif; ?>

            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">RETAINED EARNINGS</span></a></td>
                <td>RETAINED EARNINGS - EQUITY</td>
                <td><?php echo e($data['retainedEarnings']['mappedName']); ?></td>
                <td><?php echo e($data['retainedEarnings']['mappedAt']); ?></td>
                <td><?php echo e($data['retainedEarnings']['mappedBy']); ?></td>
                <?php if($data['retainedEarnings']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('retainedEarnings','RETAINED EARNINGS' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('retainedEarnings', 'RETAINED EARNINGS')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">SALARY CONTROL - LIABILITY</span></a></td>
                <td>All Salary Related Dues to the Company - Liability</td>
                <td><?php echo e($data['SalaryControl']['mappedName']); ?></td>
                <td><?php echo e($data['SalaryControl']['mappedAt']); ?></td>
                <td><?php echo e($data['SalaryControl']['mappedBy']); ?></td>
                <?php if($data['SalaryControl']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('SalaryControl','SALARY CONTROL - LIABILITY' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('SalaryControl', 'SALARY CONTROL - LIABILITY')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">STAFF CURRENT ACCOUNT</span></a></td>
                <td>Current Staff Dues to the Company - Current Asset</td>
                <td><?php echo e($data['staffAccount']['mappedName']); ?></td>
                <td><?php echo e($data['staffAccount']['mappedAt']); ?></td>
                <td><?php echo e($data['staffAccount']['mappedBy']); ?></td>
                <?php if($data['staffAccount']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('staffAccount','STAFF CURRENT ACCOUNT' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('staffAccount', 'STAFF CURRENT ACCOUNT')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">SALARIES AND WAGES</span></a></td>
                <td>Paid Salaries and Wages - Expense to Company</td>
                <td><?php echo e($data['SalaryExpense']['mappedName']); ?></td>
                <td><?php echo e($data['SalaryExpense']['mappedAt']); ?></td>
                <td><?php echo e($data['SalaryExpense']['mappedBy']); ?></td>
                <?php if($data['SalaryExpense']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('SalaryExpense','SALARIES AND WAGES' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('SalaryExpense', 'SALARIES AND WAGES')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">LEAVE DAYS PROVISION</span></a></td>
                <td>Leave Days Provision for Employees - Liability</td>
                <td><?php echo e($data['LeaveDays']['mappedName']); ?></td>
                <td><?php echo e($data['LeaveDays']['mappedAt']); ?></td>
                <td><?php echo e($data['LeaveDays']['mappedBy']); ?></td>
                <?php if($data['LeaveDays']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('LeaveDays','LEAVE DAYS PROVISION' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('LeaveDays', 'LEAVE DAYS PROVISION')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">P.A.Y.E</span></a></td>
                <td>PAYE for Employees - Expense</td>
                <td><?php echo e($data['PAYE']['mappedName']); ?></td>
                <td><?php echo e($data['PAYE']['mappedAt']); ?></td>
                <td><?php echo e($data['PAYE']['mappedBy']); ?></td>
                <?php if($data['PAYE']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('PAYE','PAYE' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('PAYE', 'PAYE')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">NSSF</span></a></td>
                <td>NSSF - Company Expenses</td>
                <td><?php echo e($data['NSSFExpense']['mappedName']); ?></td>
                <td><?php echo e($data['NSSFExpense']['mappedAt']); ?></td>
                <td><?php echo e($data['NSSFExpense']['mappedBy']); ?></td>
                <?php if($data['NSSFExpense']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('NSSFExpense','NSSF' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('NSSFExpense', 'NSSF')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">NHIF</span></a></td>
                <td>NHIF - Company Expenses</td>
                <td><?php echo e($data['NHIFExpense']['mappedName']); ?></td>
                <td><?php echo e($data['NHIFExpense']['mappedAt']); ?></td>
                <td><?php echo e($data['NHIFExpense']['mappedBy']); ?></td>
                <?php if($data['NHIFExpense']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('NHIFExpense','NHIF' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('NHIFExpense', 'NHIF')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">PENSION</span></a></td>
                <td>Pension - Company Expense</td>
                <td><?php echo e($data['PensionExpense']['mappedName']); ?></td>
                <td><?php echo e($data['PensionExpense']['mappedAt']); ?></td>
                <td><?php echo e($data['PensionExpense']['mappedBy']); ?></td>
                <?php if($data['PensionExpense']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('PensionExpense','PENSION' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('PensionExpense', 'PENSION')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>

            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">WITHHOLDING TAX PROFESSIONAL</span></a></td>
                <td>Withholding Tax Professional</td>
                <td><?php echo e($data['WTaxProfessional']['mappedName']); ?></td>
                <td><?php echo e($data['WTaxProfessional']['mappedAt']); ?></td>
                <td><?php echo e($data['WTaxProfessional']['mappedBy']); ?></td>
                <?php if($data['WTaxProfessional']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('WTaxProfessional','WITHHOLDING TAX PROFESSIONAL' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('WTaxProfessional', 'WITHHOLDING TAX PROFESSIONAL')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">WITHHOLDING TAX RENTAL</span></a></td>
                <td>Withholding Tax Rental</td>
                <td><?php echo e($data['WTaxRental']['mappedName']); ?></td>
                <td><?php echo e($data['WTaxRental']['mappedAt']); ?></td>
                <td><?php echo e($data['WTaxRental']['mappedBy']); ?></td>
                <?php if($data['WTaxRental']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('WTaxRental','WITHHOLDING TAX RENTAL' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('WTaxRental', 'WITHHOLDING TAX RENTAL')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">SUNDRY CREDITORS(suppliers)</span></a></td>
                <td>SUNDRY CREDITORS(suppliers) - Company Liability</td>
                <td><?php echo e($data['SundryCreditors']['mappedName']); ?></td>
                <td><?php echo e($data['SundryCreditors']['mappedAt']); ?></td>
                <td><?php echo e($data['SundryCreditors']['mappedBy']); ?></td>
                <?php if($data['SundryCreditors']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('SundryCreditors','SUNDRY CREDITORS(suppliers)' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('SundryCreditors', 'SUNDRY CREDITORS(suppliers)')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>

            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">OFFICE STATIONARY</span></a></td>
                <td>OFFICE STATIONARY - Company Expense</td>
                <td><?php echo e($data['OfficeStationary']['mappedName']); ?></td>
                <td><?php echo e($data['OfficeStationary']['mappedAt']); ?></td>
                <td><?php echo e($data['OfficeStationary']['mappedBy']); ?></td>
                <?php if($data['OfficeStationary']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('OfficeStationary','OFFICE STATIONARY' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('OfficeStationary', 'OFFICE STATIONARY')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>

            
            <tr>
                <td class="ar"></td>
                <td><a href="<?php echo e(url('#')); ?>" class="inner"><span class="error">OFFICE CONSUMABLES</span></a></td>
                <td>OFFICE CONSUMABLES - Company Expense</td>
                <td><?php echo e($data['OfficeConsumables']['mappedName']); ?></td>
                <td><?php echo e($data['OfficeConsumables']['mappedAt']); ?></td>
                <td><?php echo e($data['OfficeConsumables']['mappedBy']); ?></td>
                <?php if($data['OfficeConsumables']['mapped'] == 1): ?>
                    <td><i class="success">Mapped</i></td>
                    <td><a href="javascript: editMapping('OfficeConsumables','OFFICE CONSUMABLES' );"><b class="error"><i class="fa fa-pencil fa-md"></i></b></a></td>
                <?php else: ?>
                    <td><i class="error">--Pending--</i></td>
                    <td><a href="javascript: void(0);" onclick="mapLedger('OfficeConsumables', 'OFFICE CONSUMABLES')" class="inner"><span class="error">Map this Ledger</span></a></td>
                <?php endif; ?>
            </tr>
            </tbody>
            <tfoot>
            <tr style="background-color: #a1b5d3">
                <th>No</th>
                <th>Ledger Name</th>
                <th>Details</th>
                <th>Mapped To</th>
                <th>Date Mapped</th>
                <th>User</th>
                <th>Status</th>
                <th></th>
            </tr>
            </tfoot>
        </table>
    </div>
<?php $__env->stopSection(); ?>



<?php $__env->startSection('modal_heading'); ?>
    <h1>Ledger Mappings</h1>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('modal_title'); ?>
    <h3><u>Management Ledger Mappings</u></h3>
    <b>
        <ol>
            <li>View All Ledger Mappings</li>
        </ol>
    </b>

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





<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/zedarroot/public_html/edwulp/resources/views/mapped-ledgers.blade.php ENDPATH**/ ?>