<style>
    .fixed {
        margin-left: 535px;
    }
</style>
<div class="row">
    <div class="col-sm-12">
        <?php if (isset($component)) { $__componentOriginal18ad2e0d264f9740dc73fff715357c28 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal18ad2e0d264f9740dc73fff715357c28 = $attributes; } ?>
<?php $component = App\View\Components\Form::resolve(['method' => 'PUT'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('form'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Form::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'save-payroll-form']); ?>
            <div class="add-client bg-white rounded">
                <h4 class="mb-0 p-20 f-21 font-weight-normal  border-bottom-grey">
                    <?php echo app('translator')->get('app.edit'); ?> <?php echo app('translator')->get('payroll::modules.payroll.salarySlip'); ?></h4>
                <div class="row p-20">
                    <div class="col-12 mb-4">
                        <h4><?php echo app('translator')->get('payroll::modules.payroll.salarySlipHeading'); ?> <?php echo e(\Carbon\Carbon::parse($salarySlip->year.'-'.$salarySlip->month.'-01')->format('F Y')); ?></h4>
                    </div>
                    <div class="col-6">
                            <?php if (isset($component)) { $__componentOriginalfc012cd47eee5094db538668bc6edefd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfc012cd47eee5094db538668bc6edefd = $attributes; } ?>
<?php $component = App\View\Components\Cards\DataRow::resolve(['label' => __('modules.employees.fullName'),'value' => ucwords($salarySlip->user->name),'html' => 'true'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('cards.data-row'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Cards\DataRow::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $attributes = $__attributesOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__attributesOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $component = $__componentOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__componentOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
                            <?php if (isset($component)) { $__componentOriginalfc012cd47eee5094db538668bc6edefd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfc012cd47eee5094db538668bc6edefd = $attributes; } ?>
<?php $component = App\View\Components\Cards\DataRow::resolve(['label' => __('modules.employees.employeeId'),'value' => $salarySlip->user->employeeDetail->employee_id,'html' => 'true'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('cards.data-row'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Cards\DataRow::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $attributes = $__attributesOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__attributesOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $component = $__componentOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__componentOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
                            <?php if (isset($component)) { $__componentOriginalfc012cd47eee5094db538668bc6edefd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfc012cd47eee5094db538668bc6edefd = $attributes; } ?>
<?php $component = App\View\Components\Cards\DataRow::resolve(['label' => __('app.designation'),'value' => (!is_null($salarySlip->user->employeeDetail->designation)) ? $salarySlip->user->employeeDetail->designation->name : '-','html' => 'true'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('cards.data-row'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Cards\DataRow::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $attributes = $__attributesOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__attributesOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $component = $__componentOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__componentOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
                    </div>
                    <div class="col-6">
                        <?php if (isset($component)) { $__componentOriginalfc012cd47eee5094db538668bc6edefd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfc012cd47eee5094db538668bc6edefd = $attributes; } ?>
<?php $component = App\View\Components\Cards\DataRow::resolve(['label' => __('modules.employees.joiningDate'),'value' => $salarySlip->user->employeeDetail->joining_date->format($company->date_format),'html' => 'true'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('cards.data-row'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Cards\DataRow::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $attributes = $__attributesOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__attributesOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $component = $__componentOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__componentOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
                        <?php if (isset($component)) { $__componentOriginalfc012cd47eee5094db538668bc6edefd = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalfc012cd47eee5094db538668bc6edefd = $attributes; } ?>
<?php $component = App\View\Components\Cards\DataRow::resolve(['label' => __('payroll::modules.payroll.salaryGroup'),'value' => (!is_null($salarySlip->salary_group)) ? $salarySlip->salary_group->group_name : '-','html' => 'true'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('cards.data-row'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Cards\DataRow::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $attributes = $__attributesOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__attributesOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalfc012cd47eee5094db538668bc6edefd)): ?>
<?php $component = $__componentOriginalfc012cd47eee5094db538668bc6edefd; ?>
<?php unset($__componentOriginalfc012cd47eee5094db538668bc6edefd); ?>
<?php endif; ?>
                    </div>
                </div>
                <div class="border-bottom-grey"></div>

                <div class="row p-20">

                    <div class="col-md-3">
                        <?php if (isset($component)) { $__componentOriginalf704f069031d81dfb7cf95f6709a6a66 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf704f069031d81dfb7cf95f6709a6a66 = $attributes; } ?>
<?php $component = App\View\Components\Forms\Datepicker::resolve(['fieldId' => 'paid_on','fieldLabel' => __('modules.payments.paidOn'),'fieldName' => 'paid_on','fieldPlaceholder' => __('placeholders.date'),'fieldValue' => $salarySlip->paid_on ? $salarySlip->paid_on->format($company->date_format) : ''] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('forms.datepicker'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Forms\Datepicker::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf704f069031d81dfb7cf95f6709a6a66)): ?>
<?php $attributes = $__attributesOriginalf704f069031d81dfb7cf95f6709a6a66; ?>
<?php unset($__attributesOriginalf704f069031d81dfb7cf95f6709a6a66); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf704f069031d81dfb7cf95f6709a6a66)): ?>
<?php $component = $__componentOriginalf704f069031d81dfb7cf95f6709a6a66; ?>
<?php unset($__componentOriginalf704f069031d81dfb7cf95f6709a6a66); ?>
<?php endif; ?>
                    </div>

                    <div class="col-md-3">
                        <?php if (isset($component)) { $__componentOriginal67cd5dc9866c6185ad92d933c387fa86 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal67cd5dc9866c6185ad92d933c387fa86 = $attributes; } ?>
<?php $component = App\View\Components\Forms\Select::resolve(['fieldId' => 'salary_payment_method_id','fieldLabel' => __('payroll::modules.payroll.salaryPaymentMethod'),'fieldName' => 'salary_payment_method_id','search' => 'true'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('forms.select'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Forms\Select::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
                            <option value="">--</option>
                            <?php $__currentLoopData = $salaryPaymentMethods; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option
                                    <?php if($item->id == $salarySlip->salary_payment_method_id): ?> selected <?php endif; ?>
                                value="<?php echo e($item->id); ?>"><?php echo e($item->payment_method); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                         <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal67cd5dc9866c6185ad92d933c387fa86)): ?>
<?php $attributes = $__attributesOriginal67cd5dc9866c6185ad92d933c387fa86; ?>
<?php unset($__attributesOriginal67cd5dc9866c6185ad92d933c387fa86); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal67cd5dc9866c6185ad92d933c387fa86)): ?>
<?php $component = $__componentOriginal67cd5dc9866c6185ad92d933c387fa86; ?>
<?php unset($__componentOriginal67cd5dc9866c6185ad92d933c387fa86); ?>
<?php endif; ?>
                    </div>

                    <div class="col-md-3">
                        <?php if (isset($component)) { $__componentOriginal67cd5dc9866c6185ad92d933c387fa86 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal67cd5dc9866c6185ad92d933c387fa86 = $attributes; } ?>
<?php $component = App\View\Components\Forms\Select::resolve(['fieldId' => 'status','fieldLabel' => __('app.status'),'fieldName' => 'status','search' => 'true'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('forms.select'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Forms\Select::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
                            <option <?php if($salarySlip->status == 'generated'): ?> selected <?php endif; ?>
                            value="generated"><?php echo e(__('payroll::modules.payroll.generated')); ?></option>
                            <option <?php if($salarySlip->status == 'review'): ?> selected <?php endif; ?>
                            value="review"><?php echo e(__('payroll::modules.payroll.review')); ?></option>
                            <option <?php if($salarySlip->status == 'locked'): ?> selected <?php endif; ?>
                            value="locked"><?php echo e(__('payroll::modules.payroll.locked')); ?></option>
                            <option <?php if($salarySlip->status == 'paid'): ?> selected <?php endif; ?>
                            value="paid"><?php echo e(__('payroll::modules.payroll.paid')); ?></option>
                         <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal67cd5dc9866c6185ad92d933c387fa86)): ?>
<?php $attributes = $__attributesOriginal67cd5dc9866c6185ad92d933c387fa86; ?>
<?php unset($__attributesOriginal67cd5dc9866c6185ad92d933c387fa86); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal67cd5dc9866c6185ad92d933c387fa86)): ?>
<?php $component = $__componentOriginal67cd5dc9866c6185ad92d933c387fa86; ?>
<?php unset($__componentOriginal67cd5dc9866c6185ad92d933c387fa86); ?>
<?php endif; ?>
                    </div>

                    <div class="col-lg-3 col-md-3">
                        <?php if (isset($component)) { $__componentOriginal4e45e801405ab67097982370a6a83cba = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal4e45e801405ab67097982370a6a83cba = $attributes; } ?>
<?php $component = App\View\Components\Forms\Text::resolve(['fieldLabel' => __('payroll::modules.payroll.expenseClaims'),'fieldName' => 'expense_claims','fieldId' => 'expense_claims','fieldPlaceholder' => __('payroll::modules.payroll.expenseClaims'),'fieldValue' => $salarySlip->expense_claims] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('forms.text'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Forms\Text::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal4e45e801405ab67097982370a6a83cba)): ?>
<?php $attributes = $__attributesOriginal4e45e801405ab67097982370a6a83cba; ?>
<?php unset($__attributesOriginal4e45e801405ab67097982370a6a83cba); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal4e45e801405ab67097982370a6a83cba)): ?>
<?php $component = $__componentOriginal4e45e801405ab67097982370a6a83cba; ?>
<?php unset($__componentOriginal4e45e801405ab67097982370a6a83cba); ?>
<?php endif; ?>
                    </div>
                </div>
                <div class="row p-20">

                    <div class="col-lg-6 col-md-6">
                        <div class="table-responsive py-3" id="earning-table">
                            <table width="100%">
                                <tbody>
                                <tr class="text-dark-grey font-weight-bold f-14">
                                    <th class="pr-2 text-uppercase"><?php echo app('translator')->get('payroll::modules.payroll.earning'); ?></th>
                                    <th class="text-right text-uppercase"><?php echo app('translator')->get('app.amount'); ?></th>
                                    <th class="text-right"></th>
                                </tr>

                                <tr>
                                    <td class="pr-2"><?php echo app('translator')->get('payroll::modules.payroll.basicPay'); ?> </td>
                                    <td class="text-right" >
                                        <input type="number" min="0" step=".01"
                                               class="form-control text-right height-35 f-14 my-2" id="basic-salary"
                                               name="basic_salary" value="<?php echo e($basicSalary); ?>">
                                    </td>
                                    <td>

                                    </td>

                                </tr>

                                <?php $__currentLoopData = $earnings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php if($key != 'Total Hours'): ?>
                                        <tr>
                                            <td class="pr-2"><?php echo e($key); ?></td>
                                            <td class="text-right">
                                                <input type="hidden" class="form-control" name="earnings_name[]"
                                                    value="<?php echo e($key); ?>">
                                                <input type="number" min="0" step=".01"
                                                    class="form-control text-right height-35 f-14 my-2" name="earnings[]"
                                                    value="<?php echo e($item); ?>">
                                            </td>
                                            <td></td>
                                        </tr>
                                    <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                <?php $__currentLoopData = $earningsExtra; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($key != 'Total Hours'): ?>
                                    <tr>
                                        <td class="pr-2"><input type="text" class="form-control height-35 f-14 my-2"
                                                                name="extra_earnings_name[]" value="<?php echo e($key); ?>"></td>
                                        <td class="text-right">
                                            <input type="number" min="0" step=".01" id="extraValue<?php echo e($loop->iteration); ?>"
                                                   class="form-control text-right extraValue height-35 f-14 my-2"
                                                   name="extra_earnings[]" value="<?php echo e($item); ?>">
                                        </td>
                                        <td>
                                            <a href="javascript:;"  data-iteration="extraValue<?php echo e($loop->iteration); ?>"  data-type="extra" id="extraRemove<?php echo e($loop->iteration); ?>"
                                               class="d-flex align-items-center extraRemove 0 remove-item"><i
                                                    class="fa fa-times-circle f-20 text-lightest"></i></a>
                                        </td>
                                    </tr>
                                <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <tr id="fixedAllowanceTr">
                                    <td class="pr-2"><?php echo app('translator')->get('payroll::modules.payroll.fixedAllowance'); ?></td>
                                    <td class="text-right">
                                        <?php
                                            $fixedAllow = ($salarySlip->fixed_allowance > 0) ? $salarySlip->fixed_allowance : $fixedAllowance;
                                        ?>
                                        <input type="hidden" min="0" step=".01" id="fixed_allowance_input"
                                               name="fixed_allowance_input" value="<?php echo e($fixedAllow); ?>">
                                        <input type="number" min="0" step=".01" disabled
                                               class="form-control text-right height-35 f-14 my-2 fixedAllowance"
                                               name="fixed" id="fixed" value="<?php echo e($fixedAllow); ?>">
                                    </td>
                                    <td>

                                    </td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <a class="f-15 f-w-500" href="javascript:;" id="add-earning"><i
                                        class="icons icon-plus font-weight-bold mr-1"></i><?php echo app('translator')->get('app.add'); ?></a>
                            </div>
                        </div>
                        <hr/>
                        <div class="row">
                            <div class="col-md-12 ">
                                <table id="additionalDataBox" width="100%">
                                    <tbody>
                                        <?php $__currentLoopData = $earningsAdditional; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                <td class="pr-2"><input type="text" class="form-control height-35 f-14 my-2"
                                                                        name="additional_name[]" value="<?php echo e($key); ?>"></td>
                                                <td class="text-right">
                                                    <input type="number" min="0" step=".01" id="additionalValue<?php echo e($loop->iteration); ?>"
                                                        class="form-control additionalValue text-right height-35 f-14 my-2"
                                                        name="additional_earnings[]" value="<?php echo e($item); ?>">
                                                </td>
                                                <td>
                                                    <a href="javascript:;" data-iteration="additionalValue<?php echo e($loop->iteration); ?>"  data-type="additional" id="additionalRemove<?php echo e($loop->iteration); ?>"
                                                    class="d-flex align-items-center additionalRemove 0 remove-item"><i
                                                            class="fa fa-times-circle f-20 text-lightest"></i></a>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <a class="f-15 f-w-500" href="javascript:;" id="add-additional-earning"><i
                                        class="icons icon-plus font-weight-bold mr-1"></i><?php echo app('translator')->get('payroll::app.addAdditionalEarning'); ?></a>
                            </div>
                        </div>
                        <hr/>

                    </div>

                    <div class="col-lg-6 col-md-6">
                        <div class="table-responsive py-3" id="deduction-table">
                            <table width="100%">
                                <tbody>
                                <tr class="text-dark-grey font-weight-bold f-14">
                                    <th class="pr-2 text-uppercase"><?php echo app('translator')->get('payroll::modules.payroll.deduction'); ?></th>
                                    <th class="text-right text-uppercase"><?php echo app('translator')->get('app.amount'); ?></th>
                                    <th class="text-right"></th>
                                </tr>
                                <?php $__currentLoopData = $deductions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td class="pr-2"><?php echo e($key); ?></td>
                                        <td class="text-right">
                                            <input type="hidden" class="form-control" name="deductions_name[]"
                                                   value="<?php echo e($key); ?>">
                                            <input type="number" min="0" step=".01"
                                                   class="form-control text-right height-35 f-14 my-2"
                                                   name="deductions[]" value="<?php echo e($item); ?>">
                                        </td>
                                        <td></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php $__currentLoopData = $deductionsExtra; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td class="pr-2"><input type="text" class="form-control height-35 f-14 my-2"
                                                                name="extra_deductions_name[]" value="<?php echo e($key); ?>"></td>
                                        <td class="text-right">
                                            <input type="number" min="0" step=".01"
                                                   class="form-control text-right height-35 f-14 my-2"
                                                   name="extra_deductions[]" value="<?php echo e($item); ?>">
                                        </td>
                                        <td>
                                            <a href="javascript:;"
                                               class="d-flex align-items-center justify-content-end remove-item"><i
                                                    class="fa fa-times-circle f-20 text-lightest"></i></a>
                                        </td>
                                    </tr>

                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <a class="f-15 f-w-500" href="javascript:;" id="add-deduction"><i
                                        class="icons icon-plus font-weight-bold mr-1"></i><?php echo app('translator')->get('app.add'); ?></a>
                            </div>
                        </div>
                    </div>
                    <hr/>
                    <div class="col-lg-12 col-md-12 mt-4">
                        <h3 class="text-center">
                            <input type="hidden" id="grossSalary" name="gross_salary" value="<?php echo e($salarySlip->gross_salary); ?>">

                            <strong class="text-uppercase m-r-20"><?php echo app('translator')->get('payroll::modules.payroll.netSalary'); ?>:</strong>
                            <span id="net-salary" data-value = <?php echo e($salarySlip->net_salary); ?>><?php echo e(currency_format($salarySlip->net_salary, $salarySlip->currency_id)); ?></span>
                        </h3>
                        <h5 class="text-center text-muted"><?php echo app('translator')->get('payroll::modules.payroll.netSalary'); ?> =
                            (<?php echo app('translator')->get('payroll::modules.payroll.grossEarning'); ?>
                            - <?php echo app('translator')->get('payroll::modules.payroll.totalDeductions'); ?>
                            + <?php echo app('translator')->get('payroll::modules.payroll.reimbursement'); ?>)</h5>
                    </div>

                </div>

                <div class="w-100 border-top-grey d-flex justify-content-end px-4 py-3">
                    <?php if (isset($component)) { $__componentOriginalc35c79ed7e812580313ad04118477974 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalc35c79ed7e812580313ad04118477974 = $attributes; } ?>
<?php $component = App\View\Components\Forms\ButtonCancel::resolve(['link' => route('payroll.index')] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('forms.button-cancel'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Forms\ButtonCancel::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'border-0 mr-3']); ?><?php echo app('translator')->get('app.cancel'); ?>
                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalc35c79ed7e812580313ad04118477974)): ?>
<?php $attributes = $__attributesOriginalc35c79ed7e812580313ad04118477974; ?>
<?php unset($__attributesOriginalc35c79ed7e812580313ad04118477974); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc35c79ed7e812580313ad04118477974)): ?>
<?php $component = $__componentOriginalc35c79ed7e812580313ad04118477974; ?>
<?php unset($__componentOriginalc35c79ed7e812580313ad04118477974); ?>
<?php endif; ?>
                    <?php if (isset($component)) { $__componentOriginalcf8d12533ff890e0d6573daf32b7618d = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalcf8d12533ff890e0d6573daf32b7618d = $attributes; } ?>
<?php $component = App\View\Components\Forms\ButtonPrimary::resolve(['icon' => 'check'] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('forms.button-primary'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Forms\ButtonPrimary::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'save-payroll']); ?><?php echo app('translator')->get('app.save'); ?>
                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalcf8d12533ff890e0d6573daf32b7618d)): ?>
<?php $attributes = $__attributesOriginalcf8d12533ff890e0d6573daf32b7618d; ?>
<?php unset($__attributesOriginalcf8d12533ff890e0d6573daf32b7618d); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalcf8d12533ff890e0d6573daf32b7618d)): ?>
<?php $component = $__componentOriginalcf8d12533ff890e0d6573daf32b7618d; ?>
<?php unset($__componentOriginalcf8d12533ff890e0d6573daf32b7618d); ?>
<?php endif; ?>
                </div>

            </div>
         <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal18ad2e0d264f9740dc73fff715357c28)): ?>
<?php $attributes = $__attributesOriginal18ad2e0d264f9740dc73fff715357c28; ?>
<?php unset($__attributesOriginal18ad2e0d264f9740dc73fff715357c28); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal18ad2e0d264f9740dc73fff715357c28)): ?>
<?php $component = $__componentOriginal18ad2e0d264f9740dc73fff715357c28; ?>
<?php unset($__componentOriginal18ad2e0d264f9740dc73fff715357c28); ?>
<?php endif; ?>

    </div>
</div>


<script>

    $(document).ready(function () {

        const dp1 = datepicker('#paid_on', {
            position: 'bl',
            ...datepickerConfig
        });

        $('#save-payroll').click(function () {

            const url = "<?php echo e(route('payroll.update', $salarySlip->id)); ?>";

            $.easyAjax({
                url: url,
                container: '#save-payroll-form',
                type: "POST",
                disableButton: true,
                blockUI: true,
                buttonSelector: "#save-payroll",
                data: $('#save-payroll-form').serialize(),
                success: function (response) {
                    console.log(response);
                    window.location.href = response.url;
                }
            });
        });

        init(RIGHT_MODAL);

        $('#add-earning').click(function () {
            var numItems = $('.extraValue').length + 1;
            var earning = '<tr>' +
                '<td class="pr-2"><input type="text" class="form-control height-35 f-14 my-2" name="extra_earnings_name[]"></td>' +
                '<td><input type="number" min="0" id="extraValue'+numItems+'"  value="0" step=".01" class="form-control text-right height-35 f-14 my-2" name="extra_earnings[]"></td>' +
                '<td><a href="javascript:;"  data-iteration="extraValue'+numItems+'"  data-type="extra" id="extraRemove'+numItems+'" class="d-flex align-items-center justify-content-start extraValue remove-item"><i class="fa fa-times-circle f-20 text-lightest"></i></a></td></tr>';
            $('#earning-table tbody').append(earning);
        });

        $('#add-additional-earning').click(function () {
            var numItems = $('.additionalValue').length + 1;

            var earning = '<tr>' +
                '<td class="pr-2"><input type="text" class="form-control height-35 f-14 my-2" name="additional_name[]"></td>' +
                '<td><input type="number" min="0" value="0" id="additionalValue'+numItems+'" step=".01" class="form-control text-right height-35 f-14 my-2" name="additional_earnings[]"></td>' +
                '<td><a href="javascript:;" data-iteration="additionalValue'+numItems+'" data-type="additional" id="additionalRemove'+numItems+'" class="d-flex align-items-center additionalValue justify-content-start remove-item"><i class="fa fa-times-circle f-20 text-lightest"></i></a></td></tr>';
            $('#additionalDataBox tbody').append(earning);
        });


        $('#add-deduction').click(function () {
            var earning = '<tr>' +
                '<td class="pr-2"><input type="text" class="form-control height-35 f-14 my-2" name="extra_deductions_name[]"></td>' +
                '<td><input type="number" min="0" value="0" step=".01" class="form-control text-right height-35 f-14 my-2" name="extra_deductions[]"></td>' +
                '<td><a href="javascript:;" class="d-flex align-items-center justify-content-end remove-item"><i class="fa fa-times-circle f-20 text-lightest"></i></a></td></tr>';
            $('#deduction-table tbody').append(earning);
        });

        $('body').on('click', '.remove-item', function (e) {

            var value = 0;
            var type = '';

            if(e.target.closest('a').id != undefined && e.target.closest('a').id != "")
            {
                var targetId = e.target.closest('a').id;
                var iteration  = $('#'+targetId).data('iteration');
                type  = $('#'+targetId).data('type');
                value  = $('#'+iteration).val();
            }
            var additionalOldEarning = 0;

            $("input[name='additional_earnings[]']").map(function () {
                let earning = $(this).val();
                if(earning == '' || earning === undefined){
                    earning = 0;
                }
                additionalOldEarning = parseFloat(additionalOldEarning  ) + parseFloat(earning);
            }).get();

            $(this).closest('tr').remove();
            calculateNetSalary(e.target.id, value, type, additionalOldEarning);

        });

        $('body').on('keyup', "input[name='earnings[]'], input[name='deductions[]'], input[name='extra_earnings[]'], input[name='additional_earnings[]'],  input[name='extra_deductions[]'],  #basic-salary, #expense_claims, #fixed" , function (e) {
            calculateNetSalary(e.target.id, 0, 'add', 0);
        });

        var OldAdditionalEarning = <?php echo e($earningsAdditionalTotal); ?>;

        function calculateNetSalary(elementID, targetValue, type, additionalOldEarning) {

            if(targetValue == undefined || targetValue == '')
            {
                targetValue = 0;
            }

            targetValue = parseFloat(targetValue);

            let grossEarning = parseFloat($('#basic-salary').val());
            let inputGrossSalary = parseFloat($('#grossSalary').val());

            let grossSalary = parseFloat(inputGrossSalary);

            if(type == 'additional')
            {
                grossSalary = grossSalary - targetValue;
            }

            if(grossEarning == '' || grossEarning === undefined){
                grossEarning = 0;
            }

            let salary = $('#net-salary').data('value');
            let totalDeductions = 0;
            let totalExtraEarning = 0;
            let reimbursement = $('#expense_claims').val();

            if(reimbursement == '' || reimbursement === undefined){
                reimbursement = 0;
            }

            let fixedAllowence = $('#fixed').text();

            if(fixedAllowence == '' || fixedAllowence === undefined){
                fixedAllowence = 0;
            }

            // Reimbursement
            reimbursement = parseFloat(reimbursement);

            // getting Earnings
            $("input[name='earnings[]']").map(function () {
                let earning = $(this).val();
                if(earning == '' || earning === undefined){
                    earning = 0;
                }
                grossEarning = parseFloat(grossEarning) + parseFloat(earning);
            }).get();

            // getting Deductions
            $("input[name='deductions[]']").map(function () {
                let deductions = $(this).val();
                if(deductions == '' || deductions === undefined){
                    deductions = 0;
                }
                totalDeductions = parseFloat(totalDeductions) + parseFloat(deductions);
            }).get();

            // Getting Extra Earning
            $("input[name='extra_earnings[]']").map(function () {
                let earning = $(this).val();
                if(earning == '' || earning === undefined){
                    earning = 0;
                }

                grossEarning = parseFloat(grossEarning) + parseFloat(earning);
            }).get();

            // Getting Additional Earning Like Bonus
            $("input[name='additional_earnings[]']").map(function () {
                let earning = $(this).val();
                if(earning == '' || earning === undefined){
                    earning = 0;
                }
                totalExtraEarning = parseFloat(totalExtraEarning) + parseFloat(earning);

            }).get();

            grossSalary = parseFloat(inputGrossSalary) - parseFloat(OldAdditionalEarning);
            grossSalary = parseFloat(grossSalary) + parseFloat(totalExtraEarning);

            OldAdditionalEarning = totalExtraEarning;

            $("input[name='extra_deductions[]']").map(function () {
                let deductions = $(this).val();
                if(deductions == '' || deductions === undefined){
                    deductions = 0;
                }
                totalDeductions = parseFloat(totalDeductions) + parseFloat(deductions);
            }).get();

            let fixed = 0;

            if(elementID != 'fixed'){

                grossSalary = parseFloat(grossSalary) - parseFloat(totalExtraEarning);

                fixed = (grossSalary - grossEarning);

                grossSalary = parseFloat(grossSalary) + parseFloat(totalExtraEarning);

            }
            else{
                fixed = (salary - grossEarning + reimbursement );
            }

            let netSalary = (grossEarning - totalDeductions + reimbursement + totalExtraEarning);

            if(fixed < 0){
                fixed = 0;
            }

            let netFixed = (fixed.toFixed(2));
            let netSalaryFixed = (netSalary + fixed);
            let formatedSalary = number_format(netSalaryFixed.toFixed(2));

            targetValue = 0;

            $('#net-salary').html(formatedSalary);
            $('#fixed').val(netFixed);
            $('#fixed_allowance_input').val(fixed);
            $('#grossSalary').val(grossSalary);
        }


        function number_format(number) {
            let decimals = '<?php echo e(currency_format_setting()->no_of_decimal); ?>';
            let thousands_sep = '<?php echo e(currency_format_setting()->thousand_separator); ?>';
            let currency_position = '<?php echo e(currency_format_setting()->currency_position); ?>';
            let dec_point = '<?php echo e(currency_format_setting()->decimal_separator); ?>';
            // Strip all characters but numerical ones.
            number = (number + '').replace(/[^0-9+\-Ee.]/g, '');

            var currency_symbol = '<?php echo e(($currency->currency ? $currency->currency->currency_symbol : company()->currency->currency_symbol )); ?>';


            var n = !isFinite(+number) ? 0 : +number,
                prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
                sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
                dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
                s = '',
                toFixedFix = function (n, prec) {
                    var k = Math.pow(10, prec);
                    return '' + Math.round(n * k) / k;
                };
            // Fix for IE parseFloat(0.55).toFixed(0) = 0;
            s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
            if (s[0].length > 3) {
                s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
            }
            if ((s[1] || '').length < prec) {
                s[1] = s[1] || '';
                s[1] += new Array(prec - s[1].length + 1).join('0');
            }

            // number = dec_point == '' ? s[0] : s.join(dec);

            number = s.join(dec);

            switch (currency_position) {
                case 'left':
                    number = currency_symbol + number;
                    break;
                case 'right':
                    number = number + currency_symbol;
                    break;
                case 'left_with_space':
                    number = currency_symbol + ' ' + number;
                    break;
                case 'right_with_space':
                    number = number + ' ' + currency_symbol;
                    break;
                default:
                    number = currency_symbol + number;
                    break;
            }
            return number;
        }
    });

</script>
<?php /**PATH /home/smartdigitants/public_html/oneops.co.uk/oneops.ai/Modules/Payroll/Providers/../Resources/views/payroll/ajax/edit-modal.blade.php ENDPATH**/ ?>