Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
K
Kinetic on Steroids
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kenneth Kaigu
Kinetic on Steroids
Commits
ddaaf559
Commit
ddaaf559
authored
Mar 20, 2019
by
Kenneth Kaigu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding employee validation is done:
parent
509774b0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
949 additions
and
1335 deletions
+949
-1335
workspace.xml
.idea/workspace.xml
+108
-82
EmployeeTest.php
app/EmployeeTest.php
+0
-6
EmployeeController.php
app/Http/Controllers/EmployeeController.php
+103
-82
2019_02_13_070002_employee_tests.php
database/migrations/2019_02_13_070002_employee_tests.php
+12
-8
app.js
public/js/app.js
+546
-121
createEmployee.vue
resources/js/components/Employee/createEmployee.vue
+146
-41
Registration.blade.php
resources/views/Employees/Registration.blade.php
+17
-952
Employeesmaster.blade.php
resources/views/Layout/Employeesmaster.blade.php
+17
-43
No files found.
.idea/workspace.xml
View file @
ddaaf559
This diff is collapsed.
Click to expand it.
app/EmployeeTest.php
View file @
ddaaf559
...
...
@@ -7,12 +7,6 @@ use Illuminate\Support\Facades\DB;
class
EmployeeTest
extends
Model
{
protected
$fillable
=
[
'FirstName'
,
'LastName'
,
'Email'
,
'Gender'
,
'DateofJoining'
,
'YearsofExperience'
];
public
static
function
getEmployees
(){
$records
=
DB
::
table
(
'employee_tests'
)
->
select
(
'FirstName'
,
'LastName'
,
'Email'
,
'Gender'
,
'DateofJoining'
,
'YearsofExperience'
)
->
orderBy
(
'EmployeeId'
,
'desc'
)
->
get
()
->
toArray
();
return
$records
;
}
}
app/Http/Controllers/EmployeeController.php
View file @
ddaaf559
...
...
@@ -37,24 +37,38 @@ class EmployeeController extends Controller
$businessunits
=
DB
::
table
(
'business_units'
)
->
get
();
$emergency
=
DB
::
table
(
'emergency_contacts'
)
->
get
();
$dependants
=
DB
::
table
(
'dependants'
)
->
get
();
return
view
(
'Employees.Registration'
,
compact
([
'departments'
,
'businessunits'
,
'emergency'
,
'dependants'
]));
return
view
(
'Employees.Registration'
,
compact
([
'departments'
,
'businessunits'
,
'emergency'
,
'dependants'
]));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request
$request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @throws \Illuminate\Validation\ValidationException
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
$request
,
EmployeeTest
$employeeTest
)
{
//
$this
->
validate
(
$request
,
[
'prefix'
=>
[
'required'
],
'firstname'
=>
[
'required'
],
'middlename'
=>
[
'required'
],
'lastname'
=>
[
'required'
],
'phonenumber'
=>
[
'required'
],
'krapin'
=>
[
'required'
],
'nhif'
=>
[
'required'
],
'nssf'
=>
[
'required'
],
'employmentdate'
=>
[
'required'
],
'gender'
=>
[
'required'
],
'yearsofexperience'
=>
[
'required'
],
]);
}
/**
* Display the specified resource.
*
* @param int
$id
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
show
(
$id
)
...
...
@@ -65,7 +79,7 @@ class EmployeeController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param int
$id
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
edit
(
$id
)
...
...
@@ -76,8 +90,8 @@ class EmployeeController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request
$request
* @param int
$id
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
update
(
Request
$request
,
$id
)
...
...
@@ -88,115 +102,122 @@ class EmployeeController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int
$id
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
destroy
(
$id
)
{
//
}
public
function
export
()
public
function
export
()
{
try
{
$export
=
Excel
::
download
(
new
Employee_detailsExport
,
'Employees.xls'
);
$export
=
Excel
::
download
(
new
Employee_detailsExport
,
'Employees.xls'
);
return
$export
;
}
catch
(
\Exception
$e
)
{
return
redirect
(
'/employees'
)
->
with
(
'error'
,
'Something wrong happened'
);
return
redirect
(
'/employees'
)
->
with
(
'error'
,
'Something wrong happened'
);
}
}
//importation function
public
function
import
(
Request
$request
)
public
function
import
(
Request
$request
)
{
$import
=
Excel
::
import
(
new
Imports
,
request
()
->
file
(
'file'
));
dd
(
$import
);
return
redirect
(
'/employees'
)
->
with
(
'success'
,
'File has been successfully imported'
);
/* $this->validate($request, array(
'file' => 'required'
));
try {
if ($request -> hasFile('file')) {
$extension = $request ->file ->getClientOriginalExtension();
if ($extension == "xlsx" || $extension == "xls" || $extension == "csv" || $extension == "xlsm" || $extension == "xlsx") {
$name = $request->file->getClientOriginalName();
$import = Excel::import(new Employee_detailsImport, request()->file('file'));
dd($import);
return redirect('/employees')->with('success','File has been successfully imported');
}
else {
return redirect('/employees')->with('error','File is a '.$extension.' file.!! Please upload a valid xls/csv file..!!');
}
}
}
catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
$failures = $e->failures();
// dd($failures);
foreach ($failures as $failure) {
$failure->row(); // row that went wrong
$failure->attribute(); // column index
$failure->errors(); // Actual error messages from Laravel validator
return redirect('/employees')->withErrors($failures);
}
} */
return
redirect
(
'/employees'
)
->
with
(
'success'
,
'File has been successfully imported'
);
/* $this->validate($request, array(
'file' => 'required'
));
try {
if ($request -> hasFile('file')) {
$extension = $request ->file ->getClientOriginalExtension();
if ($extension == "xlsx" || $extension == "xls" || $extension == "csv" || $extension == "xlsm" || $extension == "xlsx") {
$name = $request->file->getClientOriginalName();
$import = Excel::import(new Employee_detailsImport, request()->file('file'));
dd($import);
return redirect('/employees')->with('success','File has been successfully imported');
}
else {
return redirect('/employees')->with('error','File is a '.$extension.' file.!! Please upload a valid xls/csv file..!!');
}
}
}
catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
$failures = $e->failures();
// dd($failures);
foreach ($failures as $failure) {
$failure->row(); // row that went wrong
$failure->attribute(); // column index
$failure->errors(); // Actual error messages from Laravel validator
return redirect('/employees')->withErrors($failures);
}
} */
/* catch(\Exception $e){
return redirect('/employees')->with('error','Something wrong happened');
} */
}
}
public
function
personalinfo
(
Request
$request
)
{
$request
->
validate
([
'name'
=>
'required'
,
'dateofBirth'
=>
'required'
,
'relation'
=>
'required'
,
]);
$dependant
=
new
Dependants
([
'name'
=>
$request
->
get
(
'name'
),
'dateofBirth'
=>
$request
->
get
(
'dateofBirth'
),
'relation'
=>
$request
->
get
(
'relation'
),
]);
$dependant
->
save
();
return
redirect
(
'/employees/create'
)
->
with
(
'success'
,
'Dependant has been added'
);
'name'
=>
'required'
,
'dateofBirth'
=>
'required'
,
'relation'
=>
'required'
,
]);
$dependant
=
new
Dependants
([
'name'
=>
$request
->
get
(
'name'
),
'dateofBirth'
=>
$request
->
get
(
'dateofBirth'
),
'relation'
=>
$request
->
get
(
'relation'
),
]);
$dependant
->
save
();
return
redirect
(
'/employees/create'
)
->
with
(
'success'
,
'Dependant has been added'
);
}
public
function
dependantedit
(
$id
){
public
function
dependantedit
(
$id
)
{
$dependant
=
Dependants
::
find
(
$id
);
return
redirect
(
'/employees/create'
,
compact
(
'dependant'
));
}
public
function
updateDependant
(
Request
$request
,
$id
)
{
$request
->
validate
([
'name'
=>
'required'
,
'dateofBirth'
=>
'required'
,
'relation'
=>
'required'
,
]);
$dependant
=
Dependants
::
find
(
$id
);
$dependant
->
name
=
$request
->
get
(
'name'
);
$dependant
->
dateofBirth
=
$request
->
get
(
'dateofBirth'
);
$dependant
->
relation
=
$request
->
get
(
'relation'
);
$dependant
->
save
();
return
redirect
(
'/employees/create'
)
->
with
(
'success'
,
'Dependant has been updated'
);
'name'
=>
'required'
,
'dateofBirth'
=>
'required'
,
'relation'
=>
'required'
,
]);
$dependant
=
Dependants
::
find
(
$id
);
$dependant
->
name
=
$request
->
get
(
'name'
);
$dependant
->
dateofBirth
=
$request
->
get
(
'dateofBirth'
);
$dependant
->
relation
=
$request
->
get
(
'relation'
);
$dependant
->
save
();
return
redirect
(
'/employees/create'
)
->
with
(
'success'
,
'Dependant has been updated'
);
}
public
function
dependantdestroy
(
$id
)
{
$dependant
=
Dependants
::
find
(
$id
);
dd
(
$dependant
);
$dependant
->
delete
();
return
redirect
(
'/employees/create'
)
->
with
(
'success'
,
'Dependant has been deleted successfully'
);
}
}
database/migrations/2019_02_13_070002_employee_tests.php
View file @
ddaaf559
...
...
@@ -14,14 +14,18 @@ class EmployeeTests extends Migration
public
function
up
()
{
Schema
::
create
(
'employee_tests'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'EmployeeId'
);
$table
->
string
(
'FirstName'
);
$table
->
string
(
'LastName'
);
$table
->
string
(
'Email'
);
$table
->
string
(
'Gender'
);
$table
->
date
(
'DateofJoining'
);
$table
->
integer
(
'YearsofExperience'
);
$table
->
rememberToken
();
$table
->
increments
(
'id'
);
$table
->
string
(
'prefix'
);
$table
->
string
(
'firstname'
);
$table
->
string
(
'middlename'
);
$table
->
string
(
'lastname'
);
$table
->
string
(
'phonenumber'
);
$table
->
string
(
'krapin'
);
$table
->
string
(
'nhif'
);
$table
->
string
(
'gender'
);
$table
->
string
(
'nssf'
);
$table
->
date
(
'employmentdate'
);
$table
->
integer
(
'yearsofexperience'
);
$table
->
timestamps
();
});
}
...
...
public/js/app.js
View file @
ddaaf559
This diff is collapsed.
Click to expand it.
resources/js/components/Employee/createEmployee.vue
View file @
ddaaf559
This diff is collapsed.
Click to expand it.
resources/views/Employees/Registration.blade.php
View file @
ddaaf559
This diff is collapsed.
Click to expand it.
resources/views/Layout/Employeesmaster.blade.php
View file @
ddaaf559
...
...
@@ -3,10 +3,9 @@
<head>
<meta
charset=
"utf-8"
/>
<title>
Kinetic HRM
</title>
<meta
name=
"description"
content=
""
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
/>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
<link
rel=
"shortcut icon"
href=
"
/images/favicon.ico
"
>
<link
rel=
"shortcut icon"
href=
"
{{ asset('images/favicon.ico') }}
"
>
<link
rel=
"stylesheet"
href=
"{{ asset('css/bootstrap.css') }}"
type=
"text/css"
/>
<link
rel=
"stylesheet"
href=
"{{ asset('css/animate.css') }}"
type=
"text/css"
/>
<link
rel=
"stylesheet"
href=
"{{ asset('css/font-awesome.min.css') }}"
type=
"text/css"
/>
...
...
@@ -26,19 +25,12 @@
<a
class=
"btn btn-link visible-xs"
data-toggle=
"class:nav-off-screen,open"
data-target=
"#nav,html"
>
<i
class=
"fa fa-bars"
></i>
</a>
<a
href=
"#"
class=
"navbar-brand"
data-toggle=
"fullscreen"
><img
src=
"/images/kinetic.png"
class=
"m-r-sm"
></a>
<a
href=
"#"
class=
"navbar-brand"
data-toggle=
"fullscreen"
>
<img
src=
"{{ asset('/images/kinetic.png') }}"
class=
"m-r-sm"
alt=
"Logo"
></a>
<a
class=
"btn btn-link visible-xs"
data-toggle=
"dropdown"
data-target=
".nav-user"
>
<i
class=
"fa fa-cog"
></i>
</a>
</div>
<ul
class=
"nav navbar-nav hidden-xs"
>
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle dker"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-reply"
></i>
<span
class=
"font-bold"
>
Shortcut
</span>
</a>
</li>
</ul>
<ul
class=
"nav navbar-nav navbar-right m-n hidden-xs nav-user"
>
<li
class=
"hidden-xs"
>
<a
href=
"#"
class=
"dropdown-toggle dk"
data-toggle=
"dropdown"
>
...
...
@@ -48,24 +40,9 @@
<section
class=
"dropdown-menu aside-xl"
>
<section
class=
"panel bg-white"
>
<header
class=
"panel-heading b-light bg-light"
>
<strong>
You have
<span
class=
"count"
>
2
</span>
notifications
</strong>
<strong>
You have
<span
class=
"count"
>
0
</span>
notifications
</strong>
</header>
<div
class=
"list-group list-group-alt animated fadeInRight"
>
<a
href=
"#"
class=
"media list-group-item"
>
<span
class=
"pull-left thumb-sm"
>
<img
src=
"/images/avatar.jpg"
alt=
"John said"
class=
"img-circle"
>
</span>
<span
class=
"media-body block m-b-none"
>
Use awesome animate.css
<br>
<small
class=
"text-muted"
>
10 minutes ago
</small>
</span>
</a>
<a
href=
"#"
class=
"media list-group-item"
>
<span
class=
"media-body block m-b-none"
>
1.0 initial released
<br>
<small
class=
"text-muted"
>
1 hour ago
</small>
</span>
</a>
</div>
<footer
class=
"panel-footer text-sm"
>
<a
href=
"#"
class=
"pull-right"
><i
class=
"fa fa-cog"
></i></a>
...
...
@@ -83,9 +60,9 @@
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"Search"
>
<span
class=
"input-group-btn"
>
<button
type=
"submit"
class=
"btn btn-info btn-icon"
><i
class=
"fa fa-search"
></i></button>
</span>
<button
type=
"submit"
class=
"btn btn-info btn-icon"
><i
class=
"fa fa-search"
></i></button>
</span>
</div>
</div>
</form>
...
...
@@ -94,10 +71,10 @@
</li>
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<span
class=
"thumb-sm avatar pull-left"
>
<img
src=
"/images/avatar.jpg
"
>
</span>
Michael Jackson
<span
class=
"thumb-sm avatar pull-left"
>
<img
src=
"{{ asset('/images/avatar.jpg') }}"
alt=
"avata
"
>
</span>
User Name
<b
class=
"caret"
></b>
</a>
<ul
class=
"dropdown-menu animated fadeInRight"
>
...
...
@@ -106,7 +83,7 @@
<a
href=
"#"
>
Settings
</a>
</li>
<li>
<a
href=
"
profile.html
"
>
Profile
</a>
<a
href=
"
#
"
>
Profile
</a>
</li>
<li>
<a
href=
"#"
>
...
...
@@ -115,11 +92,11 @@
</a>
</li>
<li>
<a
href=
"
docs.html
"
>
Help
</a>
<a
href=
"
#
"
>
Help
</a>
</li>
<li
class=
"divider"
></li>
<li>
<a
href=
"
modal.lockme.html
"
data-toggle=
"ajaxModal"
>
Logout
</a>
<a
href=
"
#
"
data-toggle=
"ajaxModal"
>
Logout
</a>
</li>
</ul>
</li>
...
...
@@ -150,7 +127,6 @@
<section
class=
"w-f scrollable"
>
<div
class=
"slim-scroll"
data-height=
"auto"
data-disable-fade-out=
"true"
data-distance=
"0"
data-size=
"5px"
data-color=
"#333333"
>
<!-- nav -->
<nav
class=
"nav-primary hidden-xs"
>
<ul
class=
"nav"
>
...
...
@@ -168,9 +144,9 @@
<b
class=
"bg-danger"
></b>
</i>
<span
class=
"pull-right"
>
<i
class=
"fa fa-angle-down text"
></i>
<i
class=
"fa fa-angle-up text-active"
></i>
</span>
<i
class=
"fa fa-angle-down text"
></i>
<i
class=
"fa fa-angle-up text-active"
></i>
</span>
<span>
Employees
</span>
</a>
<ul
class=
"nav lt"
>
...
...
@@ -231,7 +207,6 @@
<span>
Pay Frequency
</span>
</a>
</li>
</ul>
</ul>
</li>
...
...
@@ -240,7 +215,6 @@
<!-- / nav -->
</div>
</section>
<footer
class=
"footer lt hidden-xs b-t b-dark"
>
<div
id=
"chat"
class=
"dropup"
>
<section
class=
"dropdown-menu on aside-md m-l-n"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment