Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
3
3f-timesheet
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dockers
3f-timesheet
Commits
41b6a554
Commit
41b6a554
authored
Jun 22, 2022
by
hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completion of overhead form
parent
5447aded
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
613 additions
and
98 deletions
+613
-98
packages/portal/timesheet/resources/views/dashboard/editPeranan.blade.php
+26
-0
packages/portal/timesheet/resources/views/dashboard/nonChargeableForm.blade.php
+7
-3
packages/portal/timesheet/resources/views/dashboard/overheadForm.blade.php
+236
-0
packages/portal/timesheet/resources/views/dashboard/penambahanPeranan.blade.php
+1
-1
packages/portal/timesheet/resources/views/dashboard/senaraiPeranan.blade.php
+2
-3
packages/portal/timesheet/routes/web.php
+3
-0
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
+332
-89
packages/portal/timesheet/src/ServiceProvider.php
+6
-2
No files found.
packages/portal/timesheet/resources/views/dashboard/editPeranan.blade.php
0 → 100644
View file @
41b6a554
@
extends
(
'ui::layouts.app'
)
@
section
(
'content'
)
<
div
class
="
ui
segment
">
<a class="
ui
blue
left
ribbon
label
">Add New Role</a>
<br><br>
<form class="
ui
form
" action="
{{
route
(
'timesheet::dashboard.updaterole'
)}}
" method="
POST
">
{
{csrf_field()}
}
<input type="
hidden
" name="
id
" value="
{{
$role
->
id
}}
">
<div class="
field
">
<label>Role Description</label>
<input type="
text
" name="
role
" value="
{{
$role
->
role
}}
">
</div>
<div class="
field
">
<label>Role Status</label>
<select name="
status
" class="
ui
fluid
dropdown
">
<option value="">
{
{$status}
}
</option>
<option value="
1
">Active</option>
<option value="
2
">Inactive</option>
</select>
</div>
<button class="
ui
button
" type="
submit
">Update</button>
</form>
</div>
@endsection
\ No newline at end of file
packages/portal/timesheet/resources/views/dashboard/nonChargeableForm.blade.php
View file @
41b6a554
...
...
@@ -17,7 +17,7 @@ input[type=number] {
</
style
>
<
div
class
="
ui
segment
">
<a class="
ui
blue
left
ribbon
label
">Non
Chargeable Form</a>
<a class="
ui
blue
left
ribbon
label
">Non
-
Chargeable Form</a>
<br>
<br>
<form class="
ui
form
">
...
...
@@ -48,7 +48,7 @@ input[type=number] {
<table class="
ui
celled
structured
table
">
<thead>
<tr>
<th>Chargeable</th>
<th
colspan="
2
"
>Chargeable</th>
<th colspan="
@
if
(
$phase
==
1
)
15
@
else
{{
$daymonth
-
15
}}
@
endif
" class="
center
aligned
">Date</th>
<th>
<button type="
submit
" class="
fluid
center
aligned
ui
blue
compact
labeled
icon
button
">
...
...
@@ -58,7 +58,8 @@ input[type=number] {
</th>
</tr>
<tr>
<th class="
single
line
">Task</th>
<th class="
single
line
">Project Code</th>
<th class="
single
line
">Project Name</th>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
...
...
@@ -82,6 +83,9 @@ input[type=number] {
<?php
$total
= 0; ?>
<tr>
<td class="
single
line
">
{
{$project['td_project_code']}
}
</td>
<td class="
single
line
">
{
{$project['td_project_name']}
}
</td>
@if(
$phase
== 1)
...
...
packages/portal/timesheet/resources/views/dashboard/overheadForm.blade.php
0 → 100644
View file @
41b6a554
@
extends
(
'ui::layouts.app'
)
@
section
(
'content'
)
<
style
>
/* Chrome, Safari, Edge, Opera */
input
::-
webkit
-
outer
-
spin
-
button
,
input
::-
webkit
-
inner
-
spin
-
button
{
-
webkit
-
appearance
:
none
;
margin
:
0
;
}
/* Firefox */
input
[
type
=
number
]
{
-
moz
-
appearance
:
textfield
;
}
</
style
>
<
div
class
="
ui
segment
">
<a class="
ui
blue
left
ribbon
label
">Overhead Form</a>
<br>
<br>
<form class="
ui
form
">
<div class="
field
">
<div class="
three
fields
">
<div class="
one
wide
field
">
<label>Phase</label>
<input type="
text
" placeholder="
Year
" value="
{{
$phase
}}
" readonly="
readonly
">
</div>
<div class="
one
wide
field
">
<label>Month</label>
<input type="
text
" placeholder="
Month
" value="
{{
$month
}}
" readonly="
readonly
">
</div>
<div class="
two
wide
field
">
<label>Year</label>
<input type="
text
" placeholder="
Year
" value="
{{
$year
}}
" readonly="
readonly
">
</div>
</div>
</div>
</form>
<br>
<form class="
ui
form
" action="
{{
route
(
'timesheet::dashboard.saveoverheadhours'
)}}
" method="
POST
">
{
{csrf_field()}
}
<input type="
hidden
" name="
userId
" value="
{{
$userId
}}
">
<input type="
hidden
" name="
year
" value="
{{
$year
}}
">
<input type="
hidden
" name="
month
" value="
{{
$month
}}
">
<input type="
hidden
" name="
phase
" value="
{{
$phase
}}
">
<table class="
ui
celled
structured
table
">
<thead>
<tr>
<th>Overhead</th>
<th colspan="
@
if
(
$phase
==
1
)
15
@
else
{{
$daymonth
-
15
}}
@
endif
" class="
center
aligned
">Date</th>
<th>
<button type="
submit
" class="
fluid
center
aligned
ui
blue
compact
labeled
icon
button
">
<i class="
save
icon
"></i>
Save
</button>
</th>
</tr>
<tr>
<th class="
single
line
">Project Name</th>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
<th>
{
{$i+1}
}
</th>
@endfor
@else
@for(
$i
= 15;
$i
<
$daymonth
;
$i
++)
<th>
{
{$i+1}
}
</th>
@endfor
@endif
<th>Total Hours</th>
</tr>
<tr>
</tr>
</thead>
<tbody>
@foreach(
$projectlist
as
$key
=>
$project
)
<?php
$total
= 0; ?>
<tr>
<td class="
single
line
">
{
{$project['td_project_name']}
}
</td>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
<?php
$valuehour
= '';
$date
=
$year
.'-'.sprintf('%02d',
$month
).'-'.sprintf('%02d',
$i
+1);
if(
$hour
)
{
$valuehour
=
$hour->where
('td_date','=',
$date
)
->where('fk_o_id',
$project['td_project']
)
->where('tm_phase',
$phase
)
->first();
$total
+= data_get(
$valuehour
,'td_hours');
}
?>
<td >
<input type="
text
" onkeypress="
onlynumber
(
event
)
" id="
hour
[{{
$project
[
'td_project'
]}}][{{
$i
+
1
}}]
" name="
hour
[{{
$project
[
'td_project'
]}}][{{
$i
+
1
}}]
" value="
@
if
(
$valuehour
){{
$valuehour
->
td_hours
}}
@
else
@
endif
" min="
0
" max="
24
" style="
padding
:
2
px
;
margin
:
unset
" onchange="
limiter
(
this
,
'{{$project['
td_project
']}}'
);
">
</td>
@endfor
@else
@for(
$i
= 15;
$i
<
$daymonth
;
$i
++)
<?php
$valuehour
= '';
$date
=
$year
.'-'.sprintf('%02d',
$month
).'-'.sprintf('%02d',
$i
+1);
if(
$hour
)
{
$valuehour
=
$hour->where
('td_date','=',
$date
)
->where('fk_o_id',
$project['td_project']
)
->where('tm_phase',
$phase
)
->first();
$total
+= data_get(
$valuehour
,'td_hours');
}
?>
<td >
<input type="
text
" onkeypress="
onlynumber
(
event
)
" id="
hour
[{{
$project
[
'td_project'
]}}][{{
$i
+
1
}}]
" name="
hour
[{{
$project
[
'td_project'
]}}][{{
$i
+
1
}}]
" value="
@
if
(
$valuehour
){{
$valuehour
->
td_hours
}}
@
else
@
endif
" min="
0
" max="
24
" style="
padding
:
2
px
;
margin
:
unset
" onchange="
limiter
(
this
,
'{{$project['
td_project
']}}'
);
">
</td>
@endfor
@endif
<td>
<input type="
text
" onkeypress="
onlynumber
(
event
)
" name="
total
-
{{
$project
[
'td_project'
]}}
" id="
total
-
{{
$project
[
'td_project'
]}}
" style="
padding
-
right
:
4
px
;
padding
-
left
:
4
px
;
" onchange="
limiter
(
this
,
'{{$project['
td_project
']}}'
);
" readonly="" value=
{
{$total}
}
>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
<br>
@if(
$phase
== 1)
<button class="
center
aligned
ui
green
compact
right
labeled
icon
button
" id="
phase2
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
dashboard
.
overheadForm
', ['
phase
' => 2], ['
month
' => $month], ['
year
' => $year]) }}'
;
">
<i class="
angle
double
right
icon
"></i>
Phase 2
</button>
@else
<button class="
center
aligned
ui
green
compact
labeled
icon
button
" id="
phase1
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
dashboard
.
overheadForm
', ['
phase
' => 1], ['
month
' => $month], ['
year
' => $year]) }}'
;
">
<i class="
angle
double
left
icon
"></i>
Phase 1
</button>
@endif
</div>
@endsection
@push('script')
<script>
function onlynumber(evt)
{
var theEvent = evt || window.event;
var key = theEvent.keyCode || theEvent.which;
key = String.fromCharCode(key);
var regex = /[0-9]|\./;
if( !regex.test(key) )
{
theEvent.returnValue = false;
if(theEvent.preventDefault) theEvent.preventDefault();
}
}
</script>
<script>
$().ready(function() {
});
function limiter(input,pid) {
var currenttotal = 0;
if (input.value < 0) input.value = 0;
if (input.value > 24) input.value = 24;
input.value = parseFloat(parseFloat(input.value).toFixed(1));
for(var i = 0; i < 32; i++){
var value = 0;
var hourValue = document.getElementById('hour['+pid+']['+i+']');
if(hourValue){
hourValue = hourValue.value;
value = parseFloat(parseFloat(hourValue).toFixed(1));
console.log(isNaN(value));
if(isNaN(value)){
value = 0;
}
if(typeof value === 'number'){
// console.log(value);
currenttotal += value;
}
}
}
console.log("
currenttotal
-->
" + currenttotal);
// var currentTtotal = document.getElementById('total-'+pid).value;
// var total = document.getElementById('total-'+pid).value;
// if(total == null || total == 0){
// total = 0;
// }else{
// total = document.getElementById('total-'+pid).value;
// }
// if (input.value < 0) input.value = 0;
// if (input.value > 24) input.value = 24
// else total = Number(input.value)+Number(currentTtotal);
document.getElementById('total-'+pid).value = currenttotal;
}
</script>
@endpush
\ No newline at end of file
packages/portal/timesheet/resources/views/dashboard/penambahanPeranan.blade.php
View file @
41b6a554
...
...
@@ -8,7 +8,7 @@
{
{csrf_field()}
}
<div class="
field
">
<label>Role Description</label>
<input type="
text
" name="
overheadlookup
" placeholder="
Enter
new
role
">
<input type="
text
" name="
role
" placeholder="
Enter
new
role
">
</div>
<div class="
field
">
<label>Role Status</label>
...
...
packages/portal/timesheet/resources/views/dashboard/senaraiPeranan.blade.php
View file @
41b6a554
...
...
@@ -3,7 +3,7 @@
@
section
(
'content'
)
<
div
class
="
ui
segment
">
<a class="
ui
blue
left
ribbon
label
">Senarai P
roject
</a>
<a class="
ui
blue
left
ribbon
label
">Senarai P
eranan
</a>
<a href="
{{
route
(
'timesheet::dashboard.penambahanPeranan'
)}}
" class="
ui
right
floated
small
primary
labeled
icon
button
"><i class="
plus
icon
"></i>Add New Role
</a>
<br>
...
...
@@ -22,8 +22,7 @@
<td>
{
{$key+1}
}
</td>
<td>
{
{$role['role']}
}
</td>
<td>
{
{$role['status']}
}
</td>
<td><a href="">Edit</a></td>
<!-- <td><a href="
{{
route
(
'timesheet::dashboard.'
,
[
'id'
=>
$project
[
'id'
]])
}}
">Edit</a></td> -->
<td><a href="
{{
route
(
'timesheet::dashboard.editPeranan'
,
[
'id'
=>
$role
[
'id'
]])
}}
">Edit</a></td>
</tr>
@endforeach
</tbody>
...
...
packages/portal/timesheet/routes/web.php
View file @
41b6a554
...
...
@@ -25,6 +25,8 @@ Route::group(
Route
::
get
(
'senaraiPeranan'
,[
'uses'
=>
'DashboardController@senaraiPeranan'
,
'as'
=>
'dashboard.senaraiPeranan'
]);
Route
::
get
(
'penambahanPeranan'
,[
'uses'
=>
'DashboardController@penambahanPeranan'
,
'as'
=>
'dashboard.penambahanPeranan'
]);
Route
::
post
(
'addrole'
,[
'uses'
=>
'DashboardController@addrole'
,
'as'
=>
'dashboard.addrole'
]);
Route
::
get
(
'editPeranan'
,[
'uses'
=>
'DashboardController@editPeranan'
,
'as'
=>
'dashboard.editPeranan'
]);
Route
::
post
(
'updaterole'
,[
'uses'
=>
'DashboardController@updaterole'
,
'as'
=>
'dashboard.updaterole'
]);
Route
::
get
(
'chargeableForm'
,[
'uses'
=>
'DashboardController@chargeableForm'
,
'as'
=>
'dashboard.chargeableForm'
]);
Route
::
get
(
'nonChargeableForm'
,[
'uses'
=>
'DashboardController@nonChargeableForm'
,
'as'
=>
'dashboard.nonChargeableForm'
]);
...
...
@@ -40,6 +42,7 @@ Route::group(
Route
::
get
(
'timesheet_viewer'
,[
'uses'
=>
'DashboardController@timesheetViewer'
,
'as'
=>
'dashboard.timesheetViewer'
]);
Route
::
post
(
'savechargeablehours'
,[
'uses'
=>
'DashboardController@savechargeablehours'
,
'as'
=>
'dashboard.savechargeablehours'
]);
Route
::
post
(
'saveoverheadhours'
,[
'uses'
=>
'DashboardController@saveoverheadhours'
,
'as'
=>
'dashboard.saveoverheadhours'
]);
...
...
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
View file @
41b6a554
...
...
@@ -88,11 +88,11 @@ class DashboardController extends Controller
$projectlist
[]
=
[
'id'
=>
$value
->
id
,
'projectcode'
=>
$value
->
p_project_code
,
'projectname'
=>
$value
->
p_project_description
,
'id'
=>
$value
->
id
,
'projectcode'
=>
$value
->
p_project_code
,
'projectname'
=>
$value
->
p_project_description
,
'projectmanager'
=>
$value
->
projectManager
->
fullname
,
'status'
=>
$value
->
p_project_sts
,
'status'
=>
$value
->
p_project_sts
,
];
}
...
...
@@ -108,17 +108,19 @@ class DashboardController extends Controller
public
function
addnewproject
(
Request
$request
)
{
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$project
=
new
Project
;
$project
->
p_project_code
=
$request
->
projectcode
;
$project
->
p_project_code
=
$request
->
projectcode
;
$project
->
p_project_description
=
$request
->
projectname
;
$project
->
p_project_task_team
=
$request
->
projectmanager
;
$project
->
p_project_sts
=
$request
->
status
;
$project
->
updated_by
=
$user
->
u_staffID
;
$project
->
p_project_task_team
=
$request
->
projectmanager
;
$project
->
p_project_sts
=
$request
->
status
;
$project
->
updated_by
=
$userId
;
$project
->
save
();
return
redirect
()
->
route
(
'timesheet::dashboard.penambahanProject'
);
return
redirect
()
->
route
(
'timesheet::dashboard.penambahanProject'
)
->
with
(
'success'
,
'New Project Added'
);
}
public
function
senaraiProjectTeam
(
Request
$request
)
...
...
@@ -134,13 +136,13 @@ class DashboardController extends Controller
$projectlist
[]
=
[
'id'
=>
$value
->
id
,
'id'
=>
$value
->
id
,
'projectcode'
=>
$value
->
toProject
->
p_project_code
,
'projectname'
=>
$value
->
pt_project_description
,
'projectteam'
=>
$value
->
pt_team
,
'role'
=>
'Developer'
,
'status'
=>
$value
->
pt_project_task_sts
,
'pid'
=>
$value
->
fk_project_id
,
'role'
=>
'Developer'
,
'status'
=>
$value
->
pt_project_task_sts
,
'pid'
=>
$value
->
fk_project_id
,
];
}
...
...
@@ -168,8 +170,8 @@ class DashboardController extends Controller
public
function
addprojectteam
(
Request
$request
)
{
$user
=
Users
::
where
(
'id'
,
Auth
::
id
())
->
first
()
;
$user
Id
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$project
=
Project
::
where
(
'p_project_code'
,
'='
,
$request
->
projectcode
)
->
first
();
...
...
@@ -187,18 +189,20 @@ class DashboardController extends Controller
$pt
->
pt_team
=
$staff
->
fullname
;
$pt
->
pt_staff_id
=
$value
;
$pt
->
pt_project_task_sts
=
$request
->
status
;
$pt
->
updated_by
=
$user
->
i
d
;
$pt
->
updated_by
=
$user
I
d
;
$pt
->
save
();
}
return
redirect
()
->
route
(
'timesheet::dashboard.penambahanProjectTeam'
);
return
redirect
()
->
route
(
'timesheet::dashboard.penambahanProjectTeam'
)
->
with
(
'success'
,
'Project Team Added Successfully'
);
}
public
function
editprojectteam
(
Request
$request
)
{
$team
=
Pteam
::
where
(
'id'
,
$request
->
id
)
->
first
();
$pid
=
$team
->
fk_project_id
;
return
view
(
'timesheet::dashboard.editprojectteam'
,
compact
(
'team'
,
'pid'
));
...
...
@@ -207,26 +211,29 @@ class DashboardController extends Controller
public
function
updateprojectteam
(
Request
$request
)
{
$pid
=
$request
->
pid
;
$user
=
Users
::
where
(
'id'
,
Auth
::
id
())
->
first
()
;
$user
Id
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$team
=
Pteam
::
where
(
'id'
,
$request
->
id
)
->
first
();
$team
->
pt_project_task_sts
=
$request
->
status
;
$team
->
updated_by
=
$userId
;
// letak query utk update role
// $team->pt_role = $request->role;
$team
->
update
();
$project
=
Pteam
::
where
(
'fk_project_id'
,
$request
->
pid
)
->
get
();
$project
=
Pteam
::
where
(
'fk_project_id'
,
$request
->
pid
)
->
get
();
$projectlist
=
[];
foreach
(
$project
as
$key
=>
$value
)
{
$projectlist
[]
=
[
'id'
=>
$value
->
id
,
'id'
=>
$value
->
id
,
'projectcode'
=>
$value
->
toProject
->
p_project_code
,
'projectname'
=>
$value
->
pt_project_description
,
'projectteam'
=>
$value
->
pt_team
,
'status'
=>
$value
->
pt_project_task_sts
,
'status'
=>
$value
->
pt_project_task_sts
,
];
}
...
...
@@ -242,8 +249,8 @@ class DashboardController extends Controller
foreach
(
$peranan
as
$key
=>
$value
)
{
$roles
[]
=
[
'id'
=>
$value
->
id
,
'role'
=>
$value
->
role
,
'id'
=>
$value
->
id
,
'role'
=>
$value
->
role
,
'status'
=>
$value
->
status
];
...
...
@@ -259,10 +266,52 @@ class DashboardController extends Controller
public
function
addrole
(
Request
$request
)
{
dd
(
$request
);
return
redirect
()
->
route
(
'timesheet::dashboard.senaraiPeranan'
);
find
(
$id
)
->
column_name
;
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$data
=
new
Role
;
$data
->
role
=
$request
->
role
;
$data
->
status
=
$request
->
status
;
$data
->
updated_by
=
$userId
;
$data
->
save
();
return
redirect
()
->
route
(
'timesheet::dashboard.senaraiPeranan'
)
->
with
(
'success'
,
'Role Added Successfully'
);
}
public
function
editPeranan
(
Request
$request
)
{
$role
=
Role
::
where
(
'id'
,
$request
->
id
)
->
first
();
if
(
$role
->
status
==
1
)
{
$status
=
'Active'
;
}
else
{
$status
=
'Inactive'
;
}
return
view
(
'timesheet::dashboard.editPeranan'
,
compact
(
'role'
,
'status'
));
}
public
function
updaterole
(
Request
$request
)
{
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$data
=
Role
::
where
(
'id'
,
$request
->
id
)
->
first
();
$data
->
role
=
$request
->
role
;
$data
->
status
=
$request
->
status
;
$data
->
updated_by
=
$userId
;
$data
->
update
();
return
redirect
()
->
route
(
'timesheet::dashboard.senaraiPeranan'
)
->
with
(
'success'
,
'Role Updated Successfully'
);
}
public
function
perkhidmatan
()
{
...
...
@@ -271,12 +320,12 @@ class DashboardController extends Controller
public
function
chargeableForm
(
Request
$request
)
{
$userId
=
Auth
::
id
();
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
$project
=
Pteam
::
where
(
'pt_staff_id'
,
$user
->
u_staffID
)
->
get
();
// dd($project);
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$project
=
Pteam
::
where
(
'pt_staff_id'
,
$userId
)
->
get
();
// dd($project);
$projectlist
=
[];
// nanti project code query dari table project:
...
...
@@ -319,24 +368,20 @@ class DashboardController extends Controller
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
// check timesheet master
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
u_staffID
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
first
();
// dd($check);
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$userId
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
first
();
//kalau ada, dia gi ke edit
if
(
$check
)
{
$hour
=
Ts_detail
::
where
(
'fk_tm_id'
,
$check
->
id
)
// ->with('project:p_project_code')
->
get
();
->
get
();
// dd($hour);
}
//klu xde g create.php
...
...
@@ -347,11 +392,13 @@ class DashboardController extends Controller
return
view
(
'timesheet::dashboard.chargeableForm'
,
compact
(
'projectlist'
,
'userId'
,
'month'
,
'phase'
,
'daymonth'
,
'year'
,
'day'
,
'hour'
));
}
public
function
non
ChargeableForm
(
Request
$request
)
public
function
non
chargeableForm
(
Request
$request
)
{
$userId
=
Auth
::
id
();
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
$project
=
Pteam
::
where
(
'pt_staff_id'
,
$user
->
u_staffID
)
->
get
();
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$project
=
Pteam
::
where
(
'pt_staff_id'
,
$userId
)
->
get
();
$projectlist
=
[];
...
...
@@ -369,7 +416,9 @@ class DashboardController extends Controller
}
$phase
=
2
;
//sample dulu
$phase
=
1
;
$month
=
date
(
'n'
);
$year
=
date
(
'Y'
);
$day
=
date
(
'j'
);
...
...
@@ -393,24 +442,92 @@ class DashboardController extends Controller
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
// check timesheet master
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
u_staffID
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
first
();
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$userId
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
first
();
//kalau ada, dia gi ke edit
if
(
$check
)
{
$hour
=
Ts_detail
::
where
(
'fk_tm_id'
,
$check
->
id
)
// ->with('project:p_project_code')
->
get
();
// dd($hour);
}
//klu xde g create.php
else
{
$hour
=
null
;
}
return
view
(
'timesheet::dashboard.nonchargeableForm'
,
compact
(
'projectlist'
,
'userId'
,
'month'
,
'phase'
,
'daymonth'
,
'year'
,
'day'
,
'hour'
));
}
// dd($check);
public
function
overheadForm
(
Request
$request
)
{
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$project
=
Overhead
::
where
(
'o_overhead_sts'
,
1
)
->
get
();
$projectlist
=
[];
// nanti project code query dari table project:
foreach
(
$project
as
$key
=>
$value
)
{
$projectlist
[]
=
[
'td_project'
=>
$value
->
id
,
'td_project_name'
=>
$value
->
o_overhead_desc
,
];
}
//sample dulu
$phase
=
1
;
$month
=
date
(
'n'
);
$year
=
date
(
'Y'
);
$day
=
date
(
'j'
);
if
(
isset
(
$request
->
phase
))
{
$phase
=
$request
->
phase
;
}
if
(
isset
(
$request
->
month
))
{
$month
=
$request
->
month
;
}
if
(
isset
(
$request
->
year
))
{
$year
=
$request
->
year
;
}
$daymonth
=
cal_days_in_month
(
CAL_GREGORIAN
,
$month
,
$year
);
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
// check timesheet master
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$userId
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
first
();
//kalau ada, dia gi ke edit
if
(
$check
)
{
$hour
=
Ts_detail
::
where
(
'fk_tm_id'
,
$check
->
id
)
// ->with('project:p_project_code')
->
get
();
->
get
();
// dd($hour);
}
//klu xde g create.php
...
...
@@ -418,10 +535,11 @@ class DashboardController extends Controller
{
$hour
=
null
;
}
return
view
(
'timesheet::dashboard.
nonChargeable
Form'
,
compact
(
'projectlist'
,
'userId'
,
'month'
,
'phase'
,
'daymonth'
,
'year'
,
'day'
,
'hour'
));
return
view
(
'timesheet::dashboard.
overhead
Form'
,
compact
(
'projectlist'
,
'userId'
,
'month'
,
'phase'
,
'daymonth'
,
'year'
,
'day'
,
'hour'
));
}
public
function
kalendarCharge
()
{
return
view
(
'timesheet::dashboard.kalendarCharge'
);
...
...
@@ -441,18 +559,17 @@ class DashboardController extends Controller
{
// chargeable, project type 1.
$chargeable
=
1
;
$nonchargeable
=
2
;
$overhead
=
3
;
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
// check table master. untuk total chargeable hours.
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
u_staffID
)
->
where
(
'tm_year'
,
$request
->
year
)
->
where
(
'tm_month'
,
$request
->
month
)
->
where
(
'tm_phase'
,
$request
->
phase
)
->
whereNotNull
(
'tm_chargeable_hrs'
)
->
first
();
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
Id
)
->
where
(
'tm_year'
,
$request
->
year
)
->
where
(
'tm_month'
,
$request
->
month
)
->
where
(
'tm_phase'
,
$request
->
phase
)
->
whereNotNull
(
'tm_chargeable_hrs'
)
->
first
();
//kalau ada, update().
//staff kena edit bila timesheet kena reject.
...
...
@@ -465,10 +582,10 @@ class DashboardController extends Controller
else
{
$check
=
new
Ts_master
;
$check
->
tm_staff_id
=
$user
->
u_staffID
;
$check
->
tm_year
=
$request
->
year
;
$check
->
tm_month
=
$request
->
month
;
$check
->
tm_phase
=
$request
->
phase
;
$check
->
tm_staff_id
=
$user
Id
;
$check
->
tm_year
=
$request
->
year
;
$check
->
tm_month
=
$request
->
month
;
$check
->
tm_phase
=
$request
->
phase
;
// $check ->tm_chargeable_hrs = ;
$check
->
save
();
}
...
...
@@ -505,27 +622,30 @@ class DashboardController extends Controller
{
//update hours to null
$checkTimesheetDetail
->
td_hours
=
$valuehour
;
$checkTimesheetDetail
->
td_hours
=
$valuehour
;
$checkTimesheetDetail
->
updated_by
=
$userI
;
$checkTimesheetDetail
->
update
();
}
//kalau takde, isi semua.
}
//kalau takde, isi semua.
else
{
//isi semua
$tmdetail
=
new
Ts_detail
;
$tmdetail
->
td_date
=
$date
;
$tmdetail
->
td_project
=
$projectid
;
$tmdetail
->
fk_tm_id
=
$tmasterid
;
$tmdetail
->
tm_staff_id
=
$user
->
u_staffID
;
$tmdetail
->
tm_month
=
$check
->
tm_month
;
$tmdetail
->
tm_year
=
$check
->
tm_year
;
$tmdetail
->
tm_phase
=
$check
->
tm_phase
;
$tmdetail
->
td_date
=
$date
;
$tmdetail
->
td_project
=
$projectid
;
$tmdetail
->
fk_tm_id
=
$tmasterid
;
$tmdetail
->
tm_staff_id
=
$userI
;
$tmdetail
->
tm_month
=
$check
->
tm_month
;
$tmdetail
->
tm_year
=
$check
->
tm_year
;
$tmdetail
->
tm_phase
=
$check
->
tm_phase
;
$tmdetail
->
td_project_type
=
$chargeable
;
$project
=
Project
::
where
(
'id'
,
$projectid
)
->
first
();
$tmdetail
->
td_project_name
=
$project
->
p_project_description
;
$project
=
Project
::
where
(
'id'
,
$projectid
)
->
first
()
;
$tmdetail
->
td_hours
=
$valuehour
;
$tmdetail
->
td_project_name
=
$project
->
p_project_description
;
$tmdetail
->
td_hours
=
$valuehour
;
$tmdetail
->
updated_by
=
$userI
;
$tmdetail
->
save
();
//$tmdetail -> kjhdiwhdf;
...
...
@@ -548,12 +668,134 @@ class DashboardController extends Controller
$checktotalhours
=
Ts_master
::
where
(
'id'
,
$tmasterid
)
->
first
();
$checktotalhours
->
tm_chargeable_hrs
=
$sumdetailhour
;
$checktotalhours
->
tm_chargeable_days
=
$sumdetailhour
/
8.0
;
$checktotalhours
->
update
();
// return redirect::to('mobile/profile');
return
redirect
()
->
route
(
'timesheet::dashboard.chargeableForm'
,
[
'phase'
=>
$request
->
phase
,
'month'
=>
$request
->
month
,
'year'
,
$request
->
year
])
->
with
(
'success'
,
'Timesheet Updated'
);
}
public
function
saveoverheadhours
(
Request
$request
)
{
// overhead, project type 3.
$overhead
=
3
;
$userId
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
// check table master. untuk total chargeable hours.
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$userI
)
->
where
(
'tm_year'
,
$request
->
year
)
->
where
(
'tm_month'
,
$request
->
month
)
->
where
(
'tm_phase'
,
$request
->
phase
)
->
first
();
//kalau ada, update().
//staff kena edit bila timesheet kena reject.
//kalau ada, biar dlu.
if
(
$check
)
{
}
// kalau takda, save() baru.
else
{
$check
=
new
Ts_master
;
$check
->
tm_staff_id
=
$userI
;
$check
->
tm_year
=
$request
->
year
;
$check
->
tm_month
=
$request
->
month
;
$check
->
tm_phase
=
$request
->
phase
;
$check
->
updated_by
=
$userI
;
// $check ->tm_chargeable_hrs = ;
$check
->
save
();
}
$tmasterid
=
$check
->
id
;
// semak detail dari form
// untuk project type : 1 = chargeable, 2 = nonchargeable, 3 = overhead;
// . . .
$detail
=
$request
->
hour
;
foreach
(
$detail
as
$key
=>
$value
)
{
foreach
(
$value
as
$keyday
=>
$day
)
{
$projectid
=
$key
;
$date
=
$request
->
year
.
'-'
.
$request
->
month
.
'-'
.
sprintf
(
'%02d'
,
$keyday
);
$checkTimesheetDetail
=
Ts_detail
::
where
(
'fk_o_id'
,
$projectid
)
// ->where('td_project_type', $project_type)
->
where
(
'td_date'
,
$date
)
->
where
(
'tm_phase'
,
$request
->
phase
)
->
first
();
$valuehour
=
$day
;
if
(
$valuehour
==
null
)
{
$valuehour
=
0
;
}
if
(
$checkTimesheetDetail
)
{
//update hours to null
$checkTimesheetDetail
->
td_hours
=
$valuehour
;
$checkTimesheetDetail
->
updated_by
=
$userI
;
$checkTimesheetDetail
->
update
();
}
//kalau takde, isi semua.
else
{
//isi semua
$tmdetail
=
new
Ts_detail
;
$tmdetail
->
td_date
=
$date
;
$tmdetail
->
fk_o_id
=
$projectid
;
$tmdetail
->
fk_tm_id
=
$tmasterid
;
$tmdetail
->
tm_staff_id
=
$userI
;
$tmdetail
->
tm_month
=
$check
->
tm_month
;
$tmdetail
->
tm_year
=
$check
->
tm_year
;
$tmdetail
->
tm_phase
=
$check
->
tm_phase
;
$tmdetail
->
td_project_type
=
$overhead
;
$tmdetail
->
updated_by
=
$userI
;
$project
=
Overhead
::
where
(
'id'
,
$projectid
)
->
first
();
$tmdetail
->
td_overhead_desc
=
$project
->
o_overhead_desc
;
$tmdetail
->
td_hours
=
$valuehour
;
$tmdetail
->
save
();
//error kat sini -> done : typo nama column td_overhead_description
//$tmdetail -> kjhdiwhdf;
//project = Project::where('id','project')->first();
//
// /lepas save ();
}
}
}
//update total ke master;
//buat query sum td_hours where condition :
$sumdetailhour
=
Ts_detail
::
where
(
'td_project_type'
,
$overhead
)
->
where
(
'tm_phase'
,
$request
->
phase
)
->
sum
(
'td_hours'
);
// checktotalhours
$checktotalhours
=
Ts_master
::
where
(
'id'
,
$tmasterid
)
->
first
();
$checktotalhours
->
tm_overhead_hrs
=
$sumdetailhour
;
$checktotalhours
->
tm_overhead_days
=
$sumdetailhour
/
8.0
;
$checktotalhours
->
update
();
// return redirect::to('mobile/profile');
return
redirect
()
->
route
(
'timesheet::dashboard.overheadForm'
,
[
'phase'
=>
$request
->
phase
,
'month'
=>
$request
->
month
,
'year'
,
$request
->
year
])
->
with
(
'success'
,
'Timesheet Updated'
);
}
public
function
senaraiOverhead
()
...
...
@@ -566,9 +808,9 @@ class DashboardController extends Controller
$overheads
[]
=
[
'id'
=>
$value
->
id
,
'id'
=>
$value
->
id
,
'lkp_overhead'
=>
$value
->
o_overhead_desc
,
'status'
=>
$value
->
o_overhead_sts
,
'status'
=>
$value
->
o_overhead_sts
,
];
}
...
...
@@ -582,16 +824,17 @@ class DashboardController extends Controller
public
function
addoverheadlookup
(
Request
$request
)
{
$user
=
Users
::
where
(
'id'
,
Auth
::
id
())
->
first
()
;
$user
Id
=
users
::
find
(
Auth
::
id
())
->
u_staffID
;
$data
=
new
Overhead
;
$data
->
o_overhead_desc
=
$request
->
overheadlookup
;
$data
->
o_overhead_sts
=
$request
->
status
;
$data
->
updated_by
=
$user
->
u_staffID
;
$data
->
o_overhead_sts
=
$request
->
status
;
$data
->
updated_by
=
$userI
;
$data
->
save
();
return
redirect
()
->
route
(
'timesheet::dashboard.senaraiOverhead'
);
return
redirect
()
->
route
(
'timesheet::dashboard.senaraiOverhead'
)
->
with
(
'success'
,
'Role Updated'
);
}
public
function
timesheetApproval
()
...
...
packages/portal/timesheet/src/ServiceProvider.php
View file @
41b6a554
...
...
@@ -103,7 +103,11 @@ class ServiceProvider extends BaseServiceProvider
$pengurusanProject
->
add
(
__
(
'Senarai Peranan'
),
route
(
'timesheet::dashboard.senaraiPeranan'
))
->
data
(
'icon'
,
'users icon'
)
->
active
(
'pengurusan/*'
)
->
data
(
'permission'
,
Permission
::
pengurusan
);
->
data
(
'permission'
,
Permission
::
pengurusan
);
$pengurusanProject
->
add
(
__
(
'Penambahan Peranan'
),
route
(
'timesheet::dashboard.penambahanPeranan'
))
->
data
(
'icon'
,
'users icon'
)
->
active
(
'pengurusan/*'
)
->
data
(
'permission'
,
Permission
::
pengurusan
);
$calendar
=
$this
->
app
[
'laravolt.menu'
]
->
add
(
__
(
'Kalendar'
))
->
data
(
'icon'
,
'calendar alternate'
);
$calendar
->
add
(
__
(
'Kalendar'
),
route
(
'timesheet::dashboard.kalendar'
))
...
...
@@ -132,7 +136,7 @@ class ServiceProvider extends BaseServiceProvider
->
active
(
'nonChargeableForm/*'
)
->
data
(
'permission'
,
Permission
::
kehadiran
);
$form
->
add
(
__
(
'Overhead'
),
route
(
'timesheet::dashboard.overheadForm'
))
$form
->
add
(
__
(
'
Borang
Overhead'
),
route
(
'timesheet::dashboard.overheadForm'
))
->
data
(
'icon'
,
'circle outline'
)
->
active
(
'overheadForm/*'
)
->
data
(
'permission'
,
Permission
::
kehadiran
);
...
...
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