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
4f801480
Commit
4f801480
authored
May 31, 2022
by
fezrul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sample array form
parent
9328b545
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
11 deletions
+119
-11
packages/portal/timesheet/resources/views/dashboard/borangBolehCaj.blade.php
+45
-4
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
+74
-7
No files found.
packages/portal/timesheet/resources/views/dashboard/borangBolehCaj.blade.php
View file @
4f801480
...
...
@@ -19,13 +19,18 @@ input[type=number] {
<
div
class
="
ui
segment
">
<a class="
ui
blue
left
ribbon
label
">Chargeable Form</a>
<br><br>
<hr>
Timesheet for
{
{$month}
}
, phase
{
{$phase}
}
<br>
<hr>
<form class="
ui
form
" action="
{{
url
(
'saveHours'
)}}
" method="
POST
">
{
{csrf_field()}
}
<table class="
ui
celled
structured
table
">
<thead>
<tr>
<th colspan="
2
">Chargeable</th>
<th colspan="
15
" class="
center
aligned
">Date</th>
<th colspan="
@
if
(
$phase
==
1
)
15
@
else
{{
$daymonth
-
15
}}
@
endif
" class="
center
aligned
">Date</th>
<th>
<button type="
submit
" class="
center
aligned
ui
blue
compact
labeled
icon
button
">
<i class="
save
icon
"></i>
...
...
@@ -33,12 +38,28 @@ input[type=number] {
</button>
</th>
</tr>
<tr>
<th >Project Code</th>
<th >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>
...
...
@@ -47,22 +68,42 @@ input[type=number] {
</thead>
<tbody>
@foreach(
$samplequery
as
$key
=>
$project
)
<tr>
<td>
{
{$project
code
}
}
{
{$project
['pcode']
}
}
</td>
<td>
{
{$project
name
}
}
{
{$project
['pname']
}
}
</td>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
<td >
<input type="
number
" onkeypress="
onlynumber
(
event
)
" name="
tm_chargeable_hrs
" min="
0
" max="
24
" style="
padding
-
right
:
4
px
;
padding
-
left
:
4
px
;
" onchange="
limiter
(
this
);
">
<input type="
text
" onkeypress="
onlynumber
(
event
)
" name="
hour
[{{
$project
[
'pid'
]}}][{{
$i
+
1
}}]
" min="
0
" max="
24
" style="
padding
:
2
px
;
margin
:
unset
" onchange="
limiter
(
this
);
">
</td>
@endfor
@else
@for(
$i
= 15;
$i
<
$daymonth
;
$i
++)
<td >
<input type="
text
" onkeypress="
onlynumber
(
event
)
" name="
hour
[{{
$project
[
'pid'
]}}][{{
$i
+
1
}}]
" min="
0
" max="
24
" style="
padding
:
2
px
;
margin
:
unset
" onchange="
limiter
(
this
);
">
</td>
@endfor
@endif
<td>
<input type="
number
" onkeypress="
onlynumber
(
event
)
" name="" style="
padding
-
right
:
4
px
;
padding
-
left
:
4
px
;
" onchange="
limiter
(
this
);
" readonly="">
</td>
</tr>
@endforeach
</tbody>
...
...
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
View file @
4f801480
...
...
@@ -75,11 +75,72 @@ class DashboardController extends Controller
return
view
(
'timesheet::dashboard.perkhidmatan'
);
}
public
function
borangBolehCaj
()
public
function
borangBolehCaj
(
Request
$request
)
{
$projectcode
=
'Project Code'
;
$projectname
=
'Project Name'
;
return
view
(
'timesheet::dashboard.borangBolehCaj'
,
compact
(
'projectcode'
,
'projectname'
));
// nanti project code query dari table project:
//
$samplequery
[]
=
[
'pcode'
=>
'LHD2021'
,
'pname'
=>
'APIM'
,
'pid'
=>
'1'
,
];
$samplequery
[]
=
[
'pcode'
=>
'LHD20212'
,
'pname'
=>
'SMART'
,
'pid'
=>
'2'
,
];
//sample dulu
$phase
=
1
;
$month
=
date
(
'n'
);
$year
=
date
(
'Y'
);
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
);
// dd($phase);
//check dlam db, kalau dah ada, kuar form edit, kalau belum, kuar form create
// $check = TimeSheetMaster::where('tm_staff_id',='id yg tgh login',)
//->where('tm_month', = $month)
//->year('dfsdf')
//->whereNotNull('tm_chargeable_hrs')->first();
//if(check)
//dia g ke edit, klu xde g create.php
//kalau ada juga = bawak data details
return
view
(
'timesheet::dashboard.borangBolehCaj'
,
compact
(
'projectcode'
,
'projectname'
,
'month'
,
'phase'
,
'samplequery'
,
'daymonth'
));
}
public
function
kalendarCharge
()
...
...
@@ -99,12 +160,18 @@ class DashboardController extends Controller
public
function
saveHours
(
Request
$request
)
{
// dd($request);
dd
(
$request
);
//first = check dah ade ke belum
//mula2 masuk dalam table master untuk dapat id master.php
//pakai id master untuk update ke detail.
$data
=
new
Ts_master
;
$data
->
tm_chargeable_hrs
=
$request
->
tm_chargeable_hrs
;
$data
->
save
();
return
redirect
(
'home'
);
//
$data = new Ts_master;
//
$data -> tm_chargeable_hrs = $request -> tm_chargeable_hrs;
//
$data -> save();
//
return redirect('home');
}
}
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