StocksNew/Modules/Leave/resources/views/leave/partials/action.blade.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

100 lines
3.7 KiB
PHP

<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<div class="row g-2">
<div class="col-md-6">
{{ html()->label('Employee')->class('form-label') }}
{{ html()->select('employee_id', $employeeList)->class('form-select select2')->placeholder('Select Employee')->required() }}
{{ html()->div('Please Select Employee')->class('invalid-feedback') }}
</div>
<div class="col-md-6">
{{ html()->label('Leave Type')->class('form-label') }}
{{ html()->select('leave_type_id', $leaveTypeList)->class('form-select select2')->placeholder('Select Leave Type')->required() }}
{{ html()->div('Please Select Leave Type')->class('invalid-feedback') }}
</div>
<div class="col-md-12">
{{ html()->label('Selet Duration')->class('form-label') }}
<div>
@foreach ($duration as $durationKey => $durationItem)
<div class="form-check form-check-inline">
{{ html()->radio('duration')->class('form-check-input duration')->checked(old('duration', isset($leave) && $leave->duration === $durationKey))->attributes(['id' => $durationKey])->value($durationKey)->required() }}
{{ html()->label($durationItem)->class('form-check-label')->for($durationKey) }}
</div>
@endforeach
</div>
</div>
<div class="col-md-6">
{{ html()->label('Start Date')->class('form-label') }}
{{ html()->date('start_date')->class('form-control')->placeholder('Select Start Date')->required() }}
{{ html()->div('Please Select Start Date')->class('invalid-feedback') }}
</div>
<div class="col-md-6 end-date d-none">
{{ html()->label('End Date')->class('form-label') }}
{{ html()->date('end_date')->class('form-control')->placeholder('Select End Date') }}
{{ html()->div('Please Select End Date')->class('invalid-feedback') }}
</div>
<div class="col-md-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->textarea('description')->class('form-control')->placeholder('Write Reason for Leave') }}
</div>
</div>
</div>
</div>
<div class="mb-3 text-end">
<a href="{{ route('leave.index') }}" class="btn btn-danger w-sm">Cancel</a>
{{ html()->button($editable ? 'Update' : 'Add Leave', 'submit')->class('btn btn-success') }}
</div>
</div>
<div class="col-lg-4">
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Leave Status</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
{{ html()->label('Status')->class('form-label') }}
{{ html()->select('status', $status)->class('form-control select2')->required() }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
</div>
</div>
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
<script>
$('input[name=duration]').on('click', function() {
if ($(this).is(":checked")) {
var checked = $(this).prop("checked", true).val();
if (checked == 3) {
$('.end-date').removeClass('d-none')
} else {
$('.end-date').addClass('d-none')
$('input[name=end_date]').val('');
}
}
})
</script>
@isset($editable)
<script>
$(document).ready(function() {
$("input[name=duration]:checked").trigger("click");
})
</script>
@endisset
@endpush