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
f0636ed1
Commit
f0636ed1
authored
Jun 02, 2022
by
hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update migration, add tm_years column in timesheet master.
changes in dashboard controller, query to update and save hours.
parent
2e58f616
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
15 deletions
+97
-15
database/migrations/2022_06_02_141911_alter_timesheet_master_table.php
+33
-0
packages/portal/timesheet/resources/views/dashboard/borangBolehCaj.blade.php
+6
-6
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
+54
-9
packages/portal/timesheet/src/Model/ts_master.php
+4
-0
No files found.
database/migrations/2022_06_02_141911_alter_timesheet_master_table.php
0 → 100644
View file @
f0636ed1
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
AlterTimesheetMasterTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'timesheet_master'
,
function
(
Blueprint
$table
)
{
$table
->
integer
(
'tm_year'
)
->
after
(
'tm_month'
)
->
unsigned
()
->
nullable
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'timesheet_master'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
(
'tm_year'
);
});
}
}
packages/portal/timesheet/resources/views/dashboard/borangBolehCaj.blade.php
View file @
f0636ed1
...
@@ -18,13 +18,9 @@ input[type=number] {
...
@@ -18,13 +18,9 @@ input[type=number] {
<
div
class
="
ui
segment
">
<
div
class
="
ui
segment
">
<a class="
ui
blue
left
ribbon
label
">Chargeable Form</a>
<a class="
ui
blue
left
ribbon
label
">Chargeable Form</a>
<br><br>
<br>
User Id =
{
{$userId}
}
<hr>
<hr>
Day =
{
{$day}
}
Day =
{
{$day}
}
@if(
$day
==2)
naisu
@endif
{
{$sampleTimesheet_dtl[0]['td_date']}
}
{
{$sampleTimesheet_dtl[0]['td_date']}
}
<br>
<br>
Timesheet for month =
{
{$month}
}
<br>
Timesheet for month =
{
{$month}
}
<br>
...
@@ -34,6 +30,10 @@ input[type=number] {
...
@@ -34,6 +30,10 @@ input[type=number] {
<hr>
<hr>
<form class="
ui
form
" action="
{{
url
(
'saveHours'
)}}
" method="
POST
">
<form class="
ui
form
" action="
{{
url
(
'saveHours'
)}}
" method="
POST
">
{
{csrf_field()}
}
{
{csrf_field()}
}
<input type="
hidden
" value="
{{
$userId
}}
">
<input type="
hidden
" value="
{{
$year
}}
">
<input type="
hidden
" value="
{{
$month
}}
">
<input type="
hidden
" value="
{{
$phase
}}
">
<table class="
ui
celled
structured
table
">
<table class="
ui
celled
structured
table
">
<thead>
<thead>
<tr>
<tr>
...
@@ -97,7 +97,7 @@ input[type=number] {
...
@@ -97,7 +97,7 @@ input[type=number] {
@
endfor
@
endfor
@
endif
@
endif
<
td
>
<
td
>
<
input
type
=
"
number
"
onkeypress
=
"onlynumber(event)"
name
=
"total-
{
{$project['td_project']}
}
"
id
=
"total-
{
{$project['td_project']}
}
"
style
=
"padding-right: 4px;padding-left: 4px;"
onchange
=
"limiter(this,'
{
{$project['td_project']}
}
');"
readonly
=
""
>
<
input
type
=
"
text
"
onkeypress
=
"onlynumber(event)"
name
=
"total-
{
{$project['td_project']}
}
"
id
=
"total-
{
{$project['td_project']}
}
"
style
=
"padding-right: 4px;padding-left: 4px;"
onchange
=
"limiter(this,'
{
{$project['td_project']}
}
');"
readonly
=
""
>
</
td
>
</
td
>
</
tr
>
</
tr
>
@
endforeach
@
endforeach
...
...
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
View file @
f0636ed1
...
@@ -109,9 +109,10 @@ class DashboardController extends Controller
...
@@ -109,9 +109,10 @@ class DashboardController extends Controller
'tm_staff_id'
=>
'1000'
,
'tm_staff_id'
=>
'1000'
,
'project_type'
=>
'1'
,
'project_type'
=>
'1'
,
'fk_o_id'
=>
''
,
'fk_o_id'
=>
''
,
'tm_year'
=>
'2022'
,
'tm_month'
=>
'6'
,
'tm_month'
=>
'6'
,
'tm_phase'
=>
'1'
,
'tm_phase'
=>
'1'
,
'td_project_code'
=>
'LHD202
1
2'
,
'td_project_code'
=>
'LHD2022'
,
'td_project_name'
=>
'SMART'
,
'td_project_name'
=>
'SMART'
,
'td_hours'
=>
'5'
'td_hours'
=>
'5'
...
@@ -126,6 +127,7 @@ class DashboardController extends Controller
...
@@ -126,6 +127,7 @@ class DashboardController extends Controller
'tm_staff_id'
=>
'1000'
,
'tm_staff_id'
=>
'1000'
,
'project_type'
=>
'1'
,
'project_type'
=>
'1'
,
'fk_o_id'
=>
''
,
'fk_o_id'
=>
''
,
'tm_year'
=>
'2022'
,
'tm_month'
=>
'6'
,
'tm_month'
=>
'6'
,
'tm_phase'
=>
'1'
,
'tm_phase'
=>
'1'
,
'td_project_code'
=>
'LHD2021'
,
'td_project_code'
=>
'LHD2021'
,
...
@@ -167,18 +169,30 @@ class DashboardController extends Controller
...
@@ -167,18 +169,30 @@ class DashboardController extends Controller
$daymonth
=
cal_days_in_month
(
CAL_GREGORIAN
,
$month
,
$year
);
$daymonth
=
cal_days_in_month
(
CAL_GREGORIAN
,
$month
,
$year
);
// dd($phase);
// dd($phase);
//check dlam db, kalau dah ada, kuar form edit, kalau belum, kuar form create
//check dlam db, kalau dah ada
detail hours
, kuar form edit, kalau belum, kuar form create
// $check = TimeSheetMaster::where('tm_staff_id',='id yg tgh login',)
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
//->where('tm_month', = $month)
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
u_staffID
)
//->year('dfsdf')
->
where
(
'tm_year'
,
$year
)
//->whereNotNull('tm_chargeable_hrs')->first();
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
whereNotNull
(
'tm_chargeable_hrs'
)
->
first
();
//kalau ada, dia gi ke edit
if
(
$check
)
{
$data
=
Ts_master
::
where
(
'id'
,
$request
->
id
)
->
first
();
}
//klu xde g create.php
else
{
$data
=
[];
}
//if(check)
//dia g ke edit, klu xde g create.php
//kalau ada juga = bawak data details
//kalau ada juga = bawak data details
return
view
(
'timesheet::dashboard.borangBolehCaj'
,
compact
(
'userId'
,
'projectcode'
,
'projectname'
,
'month'
,
'phase'
,
'samplequery'
,
'daymonth'
,
'year'
,
'sampleTimesheet_dtl'
,
'day'
));
return
view
(
'timesheet::dashboard.borangBolehCaj'
,
compact
(
'userId'
,
'projectcode'
,
'projectname'
,
'month'
,
'phase'
,
'samplequery'
,
'daymonth'
,
'year'
,
'sampleTimesheet_dtl'
,
'day'
,
'data'
));
}
}
public
function
kalendarCharge
()
public
function
kalendarCharge
()
...
@@ -199,6 +213,37 @@ class DashboardController extends Controller
...
@@ -199,6 +213,37 @@ class DashboardController extends Controller
public
function
saveHours
(
Request
$request
)
public
function
saveHours
(
Request
$request
)
{
{
dd
(
$request
);
dd
(
$request
);
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
$user
=
users
::
where
(
'id'
,
Auth
::
id
())
->
first
();
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
u_staffID
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
whereNotNull
(
'tm_chargeable_hrs'
)
->
first
();
//kalau ada, dia gi ke edit
if
(
check
)
{
$data
=
Ts_master
::
where
(
'id'
,
$request
->
id
)
->
first
();
$data
->
tm_chargeable_hrs
=
10
;
$data
->
update
();
}
//klu xde g create.php
else
{
$data
=
Ts_master
::
where
(
'id'
,
$request
->
id
)
->
first
();
$data
->
tm_month
=
$request
->
month
;
$data
->
tm_year
=
$request
->
year
;
$data
->
tm_phase
=
$request
->
phase
;
$data
->
tm_chargeable_hrs
=
8
;
$data
->
save
();
}
//kalau ada juga = bawak data details
// tm_master = Ts_master::where('tm_staff_id','=',Auth::id())
// tm_master = Ts_master::where('tm_staff_id','=',Auth::id())
// ->where('tm_month','=',$tm_month)
// ->where('tm_month','=',$tm_month)
// ->get();
// ->get();
...
...
packages/portal/timesheet/src/Model/ts_master.php
View file @
f0636ed1
...
@@ -13,6 +13,10 @@ class Ts_master extends Model
...
@@ -13,6 +13,10 @@ class Ts_master extends Model
*/
*/
protected
$table
=
'timesheet_master'
;
protected
$table
=
'timesheet_master'
;
public
function
Details
()
{
return
$this
->
hasMany
(
'App\Models\Ts_detail'
,
'tm_id'
,
'id'
);
}
/**
/**
* undocumented function
* undocumented function
...
...
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