@extends('backEnd.master') @push('css') @endpush @section('title') @lang('leave.apply_leave') @endsection @section('mainContent')

@lang('leave.my_remaining_leaves')

@foreach ($my_leaves as $my_leave) @php $approved_leaves = App\SmLeaveRequest::approvedLeave($my_leave->id); $remaining_days = $my_leave->days - $approved_leaves; $extra_days = $remaining_days < 0 ? $approved_leaves - $my_leave->days : 0; @endphp @endforeach
@lang('common.type') @lang('leave.remaining_days') @lang('leave.extra_taken') @lang('leave.leave_taken') @lang('leave.leave_days')
{{ $my_leave->leaveType != '' ? $my_leave->leaveType->type : '' }} {{ $remaining_days >= 0 ? $remaining_days : 0 }} {{ $remaining_days < 0 ? $approved_leaves - $my_leave->days : 0 }} {{ $approved_leaves }} {{ $my_leave->days }}
@if (userPermission('apply-leave-store') || Auth::user()->role_id == 2) @if (isset($apply_leave)) @endif @endif
@if (isset($apply_leave)) {{ Form::open(['class' => 'form-horizontal', 'files' => true, 'route' => ['apply-leave-update', $apply_leave->id], 'method' => 'PUT', 'enctype' => 'multipart/form-data']) }} @else @if (userPermission('apply-leave-store') || Auth::user()->role_id == 2) {{ Form::open([ 'class' => 'form-horizontal', 'files' => true, 'route' => 'apply-leave-store', 'method' => 'POST', 'enctype' => 'multipart/form-data', ]) }} @endif @endif

@if (isset($apply_leave)) @lang('common.edit') @else @lang('common.add') @endif @lang('leave.apply_leave')

@if ($errors->has('apply_date')) {{ $errors->first('apply_date') }} @endif
@if ($errors->has('leave_define_id')) {{ $errors->first('leave_define_id') }} @endif
@if ($errors->has('leave_from')) {{ $errors->first('leave_from') }} @endif
@if ($errors->has('leave_to')) {{ $errors->first('leave_to') }} @endif
@if ($errors->has('attach_file')) {{ @$errors->first('attach_file') }} @endif
@php $tooltip = ''; if (userPermission('apply-leave-store') || Auth::user()->role_id == 2) { $tooltip = ''; } else { $tooltip = 'You have no permission to add'; } if (Auth::user()->role_id == 1) { $tooltip = "Super Admin Can't Leave Appy."; } @endphp
{{ Form::close() }}

@lang('leave.leave_list')

@foreach ($apply_leaves as $apply_leave) @endforeach
@lang('common.type') @lang('leave.from') @lang('leave.to') @lang('leave.apply_date') @lang('common.status') @lang('common.action')
@if ($apply_leave->leaveDefine != '' && $apply_leave->leaveDefine->leaveType != '') {{ $apply_leave->leaveDefine->leaveType->type }} @endif {{ $apply_leave->leave_from != '' ? dateConvert($apply_leave->leave_from) : '' }} {{ $apply_leave->leave_to != '' ? dateConvert($apply_leave->leave_to) : '' }} {{ $apply_leave->apply_date != '' ? dateConvert($apply_leave->apply_date) : '' }} @if ($apply_leave->approve_status == 'P') @endif @if ($apply_leave->approve_status == 'A') @endif @if ($apply_leave->approve_status == 'C') @endif
@endsection @include('backEnd.partials.data_table_js') @include('backEnd.partials.date_picker_css_js')