@extends('layouts.app') @php $action_url = action([\Modules\Essentials\Http\Controllers\PayrollController::class, 'store']); $title = __( 'essentials::lang.add_payroll' ); $subtitle = __( 'essentials::lang.add_payroll' ); $submit_btn_text = __( 'messages.save' ); $group_name = __('essentials::lang.payroll_for_month', ['date' => $month_name . ' ' . $year]); if ($action == 'edit') { $action_url = action([\Modules\Essentials\Http\Controllers\PayrollController::class, 'getUpdatePayrollGroup']); $title = __( 'essentials::lang.edit_payroll' ); $subtitle = __( 'essentials::lang.edit_payroll' ); $submit_btn_text = __( 'messages.update' ); } @endphp @section('title', $title) @section('content') @include('essentials::layouts.nav_hrm')

{{$subtitle}}

{!! Form::open(['url' => $action_url, 'method' => 'post', 'id' => 'add_payroll_form' ]) !!} {!! Form::hidden('transaction_date', $transaction_date); !!} @if($action == 'edit') {!! Form::hidden('payroll_group_id', $payroll_group->id); !!} @endif

{!! $group_name !!}

@lang('business.location') : @if(!empty($location)) {{$location->name}} {!! Form::hidden('location_id', $location->id); !!} @else {{__('report.all_locations')}} {!! Form::hidden('location_id', ''); !!} @endif
{!! Form::label('payroll_group_name', __( 'essentials::lang.payroll_group_name' ) . ':*') !!} {!! Form::text('payroll_group_name', !empty($payroll_group) ? $payroll_group->name : strip_tags($group_name), ['class' => 'form-control', 'placeholder' => __( 'essentials::lang.payroll_group_name' ), 'required']); !!}
{!! Form::label('payroll_group_status', __( 'sale.status' ) . ':*') !!} @show_tooltip(__('essentials::lang.group_status_tooltip')) {!! Form::select('payroll_group_status', ['draft' => __('sale.draft'), 'final' => __('sale.final')], !empty($payroll_group) ? $payroll_group->status : null, ['class' => 'form-control select2', 'required', 'style' => 'width: 100%;', 'placeholder' => __( 'messages.please_select' )]); !!}

@lang('essentials::lang.payroll_cant_be_deleted_if_final')



@foreach($payrolls as $employee => $payroll) @php if ($action != 'edit') { $amount_per_unit_duration = (double)$payroll['essentials_salary']; $total_work_duration = 1; $duration_unit = __('lang_v1.month'); if ($payroll['essentials_pay_period'] == 'week') { $total_work_duration = 4; $duration_unit = __('essentials::lang.week'); } elseif ($payroll['essentials_pay_period'] == 'day') { $total_work_duration = \Carbon::parse($transaction_date)->daysInMonth; $duration_unit = __('lang_v1.day'); } $total = $total_work_duration * $amount_per_unit_duration; } else { $amount_per_unit_duration = $payroll['essentials_amount_per_unit_duration']; $total_work_duration = $payroll['essentials_duration']; $duration_unit = $payroll['essentials_duration_unit']; $total = $total_work_duration * $amount_per_unit_duration; } @endphp @if($action == 'edit') {!! Form::hidden('payrolls['.$employee.'][transaction_id]', $payroll['transaction_id']); !!} @endif @endforeach
@lang('essentials::lang.employee') @lang('essentials::lang.salary') @lang('essentials::lang.allowances') @lang('essentials::lang.deductions') @lang('essentials::lang.gross_amount')
{{$payroll['name']}}

{{__('essentials::lang.leaves')}} : {{ __('essentials::lang.total_leaves_days', ['total_leaves' => $payroll['total_leaves']]) }}

{{__('essentials::lang.work_duration')}} : {{ __('essentials::lang.work_duration_hour', ['duration' => $payroll['total_work_duration']]) }}

{{__('essentials::lang.attendance')}}: {{$payroll['total_days_worked']}} @lang('lang_v1.days')
{!! Form::label('essentials_duration_'.$employee, __( 'essentials::lang.total_work_duration' ) . ':*') !!} {!! Form::text('payrolls['.$employee.'][essentials_duration]', $total_work_duration, ['class' => 'form-control input_number essentials_duration', 'placeholder' => __( 'essentials::lang.total_work_duration' ), 'required', 'data-id' => $employee, 'id' => 'essentials_duration_'.$employee]); !!}
{!! Form::label('essentials_duration_unit_'.$employee, __( 'essentials::lang.duration_unit' ) . ':') !!} {!! Form::text('payrolls['.$employee.'][essentials_duration_unit]', $duration_unit, ['class' => 'form-control', 'placeholder' => __( 'essentials::lang.duration_unit' ), 'data-id' => $employee, 'id' => 'essentials_duration_unit_'.$employee]); !!}
{!! Form::label('essentials_amount_per_unit_duration_'.$employee, __( 'essentials::lang.amount_per_unit_duartion' ) . ':*') !!} {!! Form::text('payrolls['.$employee.'][essentials_amount_per_unit_duration]', $amount_per_unit_duration, ['class' => 'form-control input_number essentials_amount_per_unit_duration', 'placeholder' => __( 'essentials::lang.amount_per_unit_duartion' ), 'required', 'data-id' => $employee, 'id' => 'essentials_amount_per_unit_duration_'.$employee]); !!}
{!! Form::label('total_'.$employee, __( 'sale.total' ) . ':') !!} {!! Form::text('payrolls['.$employee.'][total]', $total, ['class' => 'form-control input_number total', 'placeholder' => __( 'sale.total' ), 'data-id' => $employee, 'id' => 'total_'.$employee]); !!}
@component('components.widget') @php $total_allowances = 0; @endphp @if(!empty($payroll['allowances'])) @foreach($payroll['allowances']['allowance_names'] as $key => $value) @include('essentials::payroll.allowance_and_deduction_row', ['add_button' => $loop->index == 0 ? true : false, 'type' => 'allowance', 'name' => $value, 'value' => $payroll['allowances']['allowance_amounts'][$key], 'amount_type' => $payroll['allowances']['allowance_types'][$key], 'percent' => $payroll['allowances']['allowance_percents'][$key] ]) @php $total_allowances += $payroll['allowances']['allowance_amounts'][$key]; @endphp @endforeach @else @include('essentials::payroll.allowance_and_deduction_row', ['add_button' => true, 'type' => 'allowance']) @include('essentials::payroll.allowance_and_deduction_row', ['type' => 'allowance']) @include('essentials::payroll.allowance_and_deduction_row', ['type' => 'allowance']) @endif
@lang('essentials::lang.description') @lang('essentials::lang.amount_type') @lang('sale.amount')  
@lang('sale.total') {{$total_allowances}}  
@endcomponent
@component('components.widget') @php $total_deductions = 0; @endphp @if(!empty($payroll['deductions'])) @foreach($payroll['deductions']['deduction_names'] as $key => $value) @include('essentials::payroll.allowance_and_deduction_row', ['add_button' => $loop->index == 0 ? true : false, 'type' => 'deduction', 'name' => $value, 'value' => $payroll['deductions']['deduction_amounts'][$key], 'amount_type' => $payroll['deductions']['deduction_types'][$key], 'percent' => $payroll['deductions']['deduction_percents'][$key]]) @php $total_deductions += $payroll['deductions']['deduction_amounts'][$key]; @endphp @endforeach @else @include('essentials::payroll.allowance_and_deduction_row', ['add_button' => true, 'type' => 'deduction']) @include('essentials::payroll.allowance_and_deduction_row', ['type' => 'deduction']) @include('essentials::payroll.allowance_and_deduction_row', ['type' => 'deduction']) @endif
@lang('essentials::lang.description') @lang('essentials::lang.amount_type') @lang('sale.amount')  
@lang('sale.total') {{$total_deductions}}  
@endcomponent
0
{!! Form::hidden('payrolls['.$employee.'][final_total]', 0, ['id' => 'gross_amount_'.$employee, 'class' => 'gross_amount']); !!}
{!! Form::label('note_'.$employee, __( 'brand.note' ) . ':') !!} {!! Form::textarea('payrolls['.$employee.'][staff_note]', $payroll['staff_note'] ?? null, ['class' => 'form-control', 'placeholder' => __( 'sale.total' ), 'id' => 'note_'.$employee, 'rows' => 3]); !!}
{!! Form::hidden('total_gross_amount', 0, ['id' => 'total_gross_amount']); !!}
{!! Form::close() !!} @stop @section('javascript') @includeIf('essentials::payroll.form_script') @endsection