employee crud

This commit is contained in:
2024-04-10 15:15:24 +05:45
parent d92366b1f4
commit b5c603ceec
13 changed files with 420 additions and 194 deletions

View File

@ -45,8 +45,28 @@
<div class="team-cover"> <img src="assets/images/small/img-9.jpg" alt="" class="img-fluid">
</div>
<div class="card-body p-4">
<div class="ribbon-two ribbon-two-success"><span>Active</span></div>
@if ($employee->user)
<div class="ribbon-two ribbon-two-success">
<span>{{ optional($employee->user)->getRoleNames()->first() }}</span>
</div>
@endif
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false" class=""> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end" style="">
<li><a class="dropdown-item remove-item-btn" href="javascript:void(0);"
data-link="{{ route('employee.destroy', $employee->id) }}"
data-id="{{ $employee->id }}"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Delete</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
@ -82,6 +102,7 @@
</li>
<li class="list-inline-item avatar-xs">
<a href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#assignRoleModal"
data-email="{{ $employee->email }}"
class="avatar-title bg-primary-subtle text-primary fs-15 rounded">
<i class="ri-user-add-line"></i>
</a>
@ -124,29 +145,31 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
<div class="row gy-2">
<div class="col-lg-12">
{{ html()->label('Username')->class('form-label') }}
{{ html()->text('username')->class('form-control')->placeholder('Enter Username')->required() }}
</div>
<div class="col-lg-12">
{{ html()->label('Role')->class('form-label') }}
{{ html()->select('role_id', [])->class('form-select')->placeholder('Select Role')->required() }}
</div>
{{ html()->form('POST')->route('employee.assignRole')->class(['needs-validation'])->attributes(['novalidate'])->open() }}
<div class="row gy-2">
<div class="col-lg-12">
{{ html()->label('Email')->class('form-label') }}
{{ html()->email('email')->class('form-control email-field')->placeholder('Enter Email')->isReadonly(true)->required() }}
</div>
<div class="mt-4 text-end">
<button type="submit" class="btn btn-success w-sm">Save</button>
<div class="col-lg-12">
{{ html()->label('Role')->class('form-label') }}
{{ html()->select('role_id', $roleLists)->class('form-select')->placeholder('Select Role')->required() }}
</div>
</form>
</div>
<div class="mt-4 text-end">
<button type="submit" class="btn btn-success w-sm">Save</button>
</div>
{{ html()->form()->close() }}
</div>
</div>
</div>
</div>
<div class="modal fade" id="changePasswordModal" tabindex="-1" aria-labelledby="changePasswordLabel" aria-modal="true">
<div class="modal fade" id="changePasswordModal" tabindex="-1" aria-labelledby="changePasswordLabel"
aria-modal="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header model-primary">
@ -177,3 +200,16 @@
</div>
</div>
@endsection
@push('js')
<script>
$(document).ready(function() {
$('#assignRoleModal').on('shown.bs.modal', function(e) {
// do something...
var email = $(e.relatedTarget).data('email');
$('.email-field').val(email)
console.log(email);
})
})
</script>
@endpush

View File

@ -1,144 +1,121 @@
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header card-primary">
{{-- <div class="card-header card-primary">
<h4 class="card-title mb-0">Personal Details</h4>
</div>
</div> --}}
<div class="card-body row gy-4">
<div class="card-body">
<div class="row gy-1">
<p class="text-primary">Personal Details</p>
<hr>
<div class="col-md-4">
{{ html()->label('First name')->class('form-label') }}
{{ html()->text('first_name')->class('form-control')->placeholder('Enter First Name')->required() }}
</div>
<div class="col-md-4">
{{ html()->label('First name')->class('form-label') }}
{{ html()->text('first_name')->class('form-control')->placeholder('Enter First Name')->required() }}
</div>
<div class="col-md-4">
{{ html()->label('Middle name')->class('form-label') }}
{{ html()->text('middle_name')->class('form-control')->placeholder('Enter Middle Name') }}
</div>
<div class="col-md-4">
{{ html()->label('Middle name')->class('form-label') }}
{{ html()->text('middle_name')->class('form-control')->placeholder('Enter Middle Name') }}
</div>
<div class="col-md-4">
{{ html()->label('Last name')->class('form-label') }}
{{ html()->text('last_name')->class('form-control')->placeholder('Enter Last Name')->required() }}
{{ html()->div('Please enter last name')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Last name')->class('form-label') }}
{{ html()->text('last_name')->class('form-control')->placeholder('Enter Last Name')->required() }}
{{ html()->div('Please enter last name')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Gender')->class('form-label') }}
{{ html()->select('genders_id', [1 => 'male', 2 => 'female'])->class('form-select')->placeholder('Select Gender') }}
</div>
<div class="col-md-4">
{{ html()->label('Gender')->class('form-label') }}
{{ html()->select('gender', ['male', 'female'])->class('form-select')->placeholder('Select Gender') }}
</div>
<div class="col-md-4">
{{ html()->label('Date of Birth')->class('form-label') }}
{{ html()->date('dob')->class('form-control')->placeholder('Choose Date of Birth')->required() }}
{{ html()->div('Please choose dob')->class('invalid-feedback') }}
<div class="col-md-4">
{{ html()->label('Date of Birth')->class('form-label') }}
{{ html()->date('dob')->class('form-control')->placeholder('Choose Date of Birth')->required() }}
{{ html()->div('Please choose dob')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Nationality')->class('form-label') }}
{{ html()->select('nationalities_id', [1 => 'Nepal', 2 => 'Other'])->class('form-control')->placeholder('Select Nationality') }}
</div>
<div class="col-md-4">
{{ html()->label('Email')->class('form-label') }}
{{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
{{ html()->div('Please enter email')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Phone Number')->class('form-label') }}
{{ html()->text('contact')->class('form-control')->placeholder('Enter Phone Number') }}
</div>
<div class="col-md-4">
{{ html()->label('Upload Profile Pic')->class('form-label') }}
{{ html()->file('profile_pic')->class('form-control') }}
</div>
</div>
<div class="col-md-4">
{{ html()->label('Nationality')->class('form-label') }}
{{ html()->select('nationality', ['Nepal', 'Other'])->class('form-control')->placeholder('Select Nationality') }}
<div class="row gy-1 mt-1">
<p class="text-primary">Address Details</p>
<hr>
{{-- <div class="col-md-4">
{{ html()->label('Municipality')->class('form-label') }}
{{ html()->select('municipality_id', [])->class('form-select')->placeholder('Select Municipality') }}
</div>
<div class="col-md-4">
{{ html()->label('Ward')->class('form-label') }}
{{ html()->text('ward')->class('form-control')->placeholder('Enter Ward no') }}
</div> --}}
<div class="col-md-4">
{{ html()->label('Permanent Address')->class('form-label') }}
{{ html()->text('permanent_address')->class('form-control')->placeholder('Enter Permanent Address') }}
</div>
<div class="col-md-4">
{{ html()->label('Temporary Address')->class('form-label') }}
{{ html()->text('temporary_address')->class('form-control')->placeholder('Enter Temporary Address') }}
</div>
</div>
<div class="col-md-4">
{{ html()->label('Email')->class('form-label') }}
{{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
{{ html()->div('Please enter email')->class('invalid-feedback') }}
<div class="row gy-1 mt-1">
<p class="text-primary">Organization Details</p>
<hr>
<div class="col-md-4">
{{ html()->label('Department')->class('form-label') }}
{{ html()->select('department_id', ['Nepal'])->class('form-select')->placeholder('Select Department') }}
</div>
<div class="col-md-4">
{{ html()->label('Designation')->class('form-label') }}
{{ html()->select('designation_id', ['Nepal'])->class('form-select')->placeholder('Select Designation') }}
</div>
{{-- <div class="col-md-4">
{{ html()->label('Join Date')->class('form-label') }}
{{ html()->date('join_date')->class('form-control')->placeholder('Choose Join Date') }}
</div> --}}
<div class="col-md-8">
{{ html()->label('Remarks')->class('form-label') }}
{{ html()->textarea('remarks')->class('form-control')->placeholder('Enter Remarks') }}
</div>
</div>
<div class="col-md-4">
{{ html()->label('Phone Number')->class('form-label') }}
{{ html()->text('phone')->class('form-control')->placeholder('Enter Phone Number') }}
</div>
<div class="col-md-4">
{{ html()->label('Upload Profile Pic')->class('form-label') }}
{{ html()->file('profile_pic')->class('form-control') }}
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
<div class="card">
<div class="card-header card-primary">
<h5 class="card-title mb-0">Address Detail</h5>
</div>
<div class="card-body row gy-2">
{{-- <div class="col-md-4">
{{ html()->label('Country')->class('form-label') }}
{{ html()->select('country_id', ['Nepal'])->class('form-select')->placeholder('Select Country') }}
</div> --}}
<div class="col-md-4">
{{ html()->label('State')->class('form-label') }}
{{ html()->select('state_id', ['Nepal'])->class('form-select')->placeholder('Select State') }}
</div>
<div class="col-md-4">
{{ html()->label('District name')->class('form-label') }}
{{ html()->select('district_id', [])->class('form-select')->placeholder('Select District') }}
</div>
<div class="col-md-4">
{{ html()->label('City')->class('form-label') }}
{{ html()->text('last_name')->class('form-control')->placeholder('Enter City Name') }}
</div>
<div class="col-md-4">
{{ html()->label('municipality')->class('form-label') }}
{{ html()->select('municipality_id', [])->class('form-select')->placeholder('Select Municipality') }}
</div>
<div class="col-md-4">
{{ html()->label('Ward')->class('form-label') }}
{{ html()->text('ward')->class('form-control')->placeholder('Enter Ward no') }}
</div>
<div class="col-md-4">
{{ html()->label('Permanent Address')->class('form-label') }}
{{ html()->text('perm_address')->class('form-control')->placeholder('Enter Permanent Address') }}
</div>
<div class="col-md-4">
{{ html()->label('Temporary Address')->class('form-label') }}
{{ html()->text('temp_address')->class('form-control')->placeholder('Enter Temporary Address') }}
</div>
</div>
</div>
<div class="card">
<div class="card-header card-primary">
<h5 class="card-title mb-0">Organization Detail</h5>
</div>
<div class="card-body row gy-2">
<div class="col-md-4">
{{ html()->label('Department')->class('form-label') }}
{{ html()->select('department_id', ['Nepal'])->class('form-select')->placeholder('Select Department') }}
</div>
<div class="col-md-4">
{{ html()->label('Designation')->class('form-label') }}
{{ html()->select('designation_id', ['Nepal'])->class('form-select')->placeholder('Select Designation') }}
</div>
<div class="col-md-4">
{{ html()->label('Join Date')->class('form-label') }}
{{ html()->date('join_date')->class('form-control')->placeholder('Choose Join Date') }}
</div>
<div class="col-md-8">
{{ html()->label('Remarks')->class('form-label') }}
{{ html()->textarea('remark')->class('form-control')->placeholder('Enter Remarks') }}
</div>
</div>
</div>
<!-- end card -->
<div class="mb-4 text-end">
<button type="submit" class="btn btn-success w-sm">Save</button>
</div>

View File

@ -0,0 +1,128 @@
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header card-primary">
<h4 class="card-title mb-0">Personal Details</h4>
</div>
<div class="card-body row gy-4">
<div class="col-md-4">
{{ html()->label('First name')->class('form-label') }}
{{ html()->text('first_name')->class('form-control')->placeholder('Enter First Name')->required() }}
</div>
<div class="col-md-4">
{{ html()->label('Middle name')->class('form-label') }}
{{ html()->text('middle_name')->class('form-control')->placeholder('Enter Middle Name') }}
</div>
<div class="col-md-4">
{{ html()->label('Last name')->class('form-label') }}
{{ html()->text('last_name')->class('form-control')->placeholder('Enter Last Name')->required() }}
{{ html()->div('Please enter last name')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Gender')->class('form-label') }}
{{ html()->select('gender', ['male', 'female'])->class('form-select')->placeholder('Select Gender') }}
</div>
<div class="col-md-4">
{{ html()->label('Date of Birth')->class('form-label') }}
{{ html()->date('dob')->class('form-control')->placeholder('Choose Date of Birth')->required() }}
{{ html()->div('Please choose dob')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Nationality')->class('form-label') }}
{{ html()->select('nationality', ['Nepal', 'Other'])->class('form-control')->placeholder('Select Nationality') }}
</div>
<div class="col-md-4">
{{ html()->label('Email')->class('form-label') }}
{{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
{{ html()->div('Please enter email')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Phone Number')->class('form-label') }}
{{ html()->text('phone')->class('form-control')->placeholder('Enter Phone Number') }}
</div>
<div class="col-md-4">
{{ html()->label('Upload Profile Pic')->class('form-label') }}
{{ html()->file('profile_pic')->class('form-control') }}
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
<div class="card">
<div class="card-header card-primary">
<h5 class="card-title mb-0">Address Detail</h5>
</div>
<div class="card-body row gy-2">
<div class="col-md-4">
{{ html()->label('Municipality')->class('form-label') }}
{{ html()->select('municipality_id', [])->class('form-select')->placeholder('Select Municipality') }}
</div>
<div class="col-md-4">
{{ html()->label('Ward')->class('form-label') }}
{{ html()->text('ward')->class('form-control')->placeholder('Enter Ward no') }}
</div>
<div class="col-md-4">
{{ html()->label('Permanent Address')->class('form-label') }}
{{ html()->text('perm_address')->class('form-control')->placeholder('Enter Permanent Address') }}
</div>
<div class="col-md-4">
{{ html()->label('Temporary Address')->class('form-label') }}
{{ html()->text('temp_address')->class('form-control')->placeholder('Enter Temporary Address') }}
</div>
</div>
</div>
<div class="card">
<div class="card-header card-primary">
<h5 class="card-title mb-0">Organization Detail</h5>
</div>
<div class="card-body row gy-2">
<div class="col-md-4">
{{ html()->label('Department')->class('form-label') }}
{{ html()->select('department_id', ['Nepal'])->class('form-select')->placeholder('Select Department') }}
</div>
<div class="col-md-4">
{{ html()->label('Designation')->class('form-label') }}
{{ html()->select('designation_id', ['Nepal'])->class('form-select')->placeholder('Select Designation') }}
</div>
<div class="col-md-4">
{{ html()->label('Join Date')->class('form-label') }}
{{ html()->date('join_date')->class('form-control')->placeholder('Choose Join Date') }}
</div>
<div class="col-md-8">
{{ html()->label('Remarks')->class('form-label') }}
{{ html()->textarea('remark')->class('form-control')->placeholder('Enter Remarks') }}
</div>
</div>
</div>
<!-- end card -->
<div class="mb-4 text-end">
<button type="submit" class="btn btn-success w-sm">Save</button>
</div>
</div>
</div>