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
fd575cf8
Commit
fd575cf8
authored
Sep 13, 2022
by
hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
project man-days page, auto calculate.
parent
77549493
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
202 additions
and
6 deletions
+202
-6
database/migrations/2022_09_13_114608_create_project_mandays_table.php
+38
-0
packages/portal/timesheet/resources/views/maintenance/mandays.blade.php
+134
-0
packages/portal/timesheet/resources/views/maintenance/senaraiProject.blade.php
+13
-6
packages/portal/timesheet/routes/web.php
+1
-0
packages/portal/timesheet/src/Http/Controllers/MaintenanceController.php
+16
-0
No files found.
database/migrations/2022_09_13_114608_create_project_mandays_table.php
0 → 100644
View file @
fd575cf8
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateProjectMandaysTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'project_mandays'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
integer
(
'fk_project_team'
)
->
unsigned
()
->
nullable
();
$table
->
integer
(
'pm_roles'
)
->
unsigned
()
->
nullable
();
$table
->
double
(
'pm_days'
,
10
,
2
)
->
unsigned
()
->
nullable
();
$table
->
double
(
'pm_hours'
,
10
,
2
)
->
unsigned
()
->
nullable
();
$table
->
timestamps
();
$table
->
integer
(
'updated_by'
)
->
nullable
();
$table
->
softDeletes
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'project_mandays'
);
}
}
packages/portal/timesheet/resources/views/maintenance/mandays.blade.php
0 → 100644
View file @
fd575cf8
@extends('ui::layouts.app')
@section('content')
<div
class=
"ui segment"
>
<a
class=
"ui blue left ribbon label"
>
Project Man-Days
</a>
<hr>
<select
name=
"tot_pin_requested"
onchange=
"calculateAmount(this.value)"
required
>
<option
value=
""
disabled
selected
>
Choose your option
</option>
<option
value=
"1"
>
1
</option>
<option
value=
"2"
>
2
</option>
</select>
<input
class=
"w3-input w3-border"
name=
"tot_amount"
id=
"tot_amount"
type=
"text"
readonly
>
<script>
function
calculateAmount
(
val
)
{
var
tot_price
=
val
*
100
;
/*display the result*/
var
divobj
=
document
.
getElementById
(
'tot_amount'
);
divobj
.
value
=
tot_price
;
}
</script>
<br>
<hr>
<br>
<form
class=
"ui form"
action=
""
method=
"POST"
>
{{csrf_field()}}
<table
class=
"ui celled table"
>
<thead>
<tr>
<th
style=
"width: 5%"
>
No
</th>
<th
style=
"width: 45%"
>
Roles
</th>
<th
style=
"width: 25%"
class=
"text-center"
>
Day
</th>
<th
style=
"width: 25%"
class=
"text-center"
>
Hours
</th>
</tr>
</thead>
<tbody>
<?php
$limit
=
count
(
$role
);
?>
@foreach($role as $key => $value)
<tr>
<td>
{{$key+1}}
</td>
<td
data-label=
"role"
>
{{data_get($value,'role')}}
</td>
<td
data-label=
"day"
>
<input
type=
"text"
onkeypress=
"onlynumber(event)"
id=
"days[{{$value->id}}]"
onchange=
"calcHours(this.value,{{$limit}},{{$value->id}})"
>
</td>
<td
data-label=
"hour"
>
<input
type=
"text"
onkeypress=
"onlynumber(event)"
name=
"hours[{{$value->id}}]"
id=
"hours[{{$value->id}}]"
readonly=
"readonly"
>
</td>
</tr>
@endforeach
<tr>
<td></td>
<td>
Total
</td>
<td>
<input
type=
"text"
onkeypress=
"onlynumber(event)"
name=
"totaldays"
id=
"totaldays"
readonly=
"readonly"
>
</td>
<td>
<input
type=
"text"
onkeypress=
"onlynumber(event)"
name=
"totalhours"
id=
"totalhours"
readonly=
"readonly"
>
</td>
</tr>
</tbody>
</table>
<button
class=
"ui blue button"
type=
"submit"
>
Save
</button>
<button
class=
"ui green button"
type=
"button"
onclick=
"window.location.href='{{ route('timesheet::maintenance.senaraiProject') }} ';"
>
Back
</button>
</form>
</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>
function
calcHours
(
days
,
limit
,
rid
)
{
days
=
parseFloat
(
parseFloat
(
days
).
toFixed
(
1
));
var
totdays
=
0
;
var
tothours
=
0
;
var
totaldays
=
0
;
var
totalhours
=
0
;
for
(
var
i
=
1
;
i
<
limit
+
1
;
i
++
)
{
var
day
=
document
.
getElementById
(
'days['
+
i
+
']'
);
var
hours
=
days
*
8
;
/*display the result*/
var
calchours
=
document
.
getElementById
(
'hours['
+
rid
+
']'
);
calchours
.
value
=
hours
;
if
(
day
.
value
)
{
totaldays
+=
parseFloat
(
parseFloat
(
day
.
value
).
toFixed
(
1
));
}
}
totdays
=
document
.
getElementById
(
'totaldays'
);
totdays
.
value
=
totaldays
;
tothours
=
document
.
getElementById
(
'totalhours'
);
tothours
.
value
=
totaldays
*
8
;
}
</script>
@endpush
\ No newline at end of file
packages/portal/timesheet/resources/views/maintenance/senaraiProject.blade.php
View file @
fd575cf8
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
<th>Project Code</th>
<th>Project Code</th>
<th>Project Name</th>
<th>Project Name</th>
<th>Project Manager</th>
<th>Project Manager</th>
<th>Status</th>
<th
class="
text
-
center
"
>Status</th>
<th>Action</th>
<th
class="
text
-
center
"
>Action</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
...
@@ -25,10 +25,17 @@
...
@@ -25,10 +25,17 @@
<td>{{ data_get(
$project
,'projectcode') }} </td>
<td>{{ data_get(
$project
,'projectcode') }} </td>
<td>{{ data_get(
$project
,'projectname') }} </td>
<td>{{ data_get(
$project
,'projectname') }} </td>
<td>{{ data_get(
$project
,'projectmanager') }} </td>
<td>{{ data_get(
$project
,'projectmanager') }} </td>
<td>{{ data_get(
$project
,'status') }} </td>
<td class="
text
-
center
">{{ data_get(
$project
,'status') }} </td>
<td>
<td class="
text
-
center
">
<button class="
compact
ui
button
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
maintenance
.
senaraiProjectTeam
', ['
id
' => $project['
id
']]) }}'
;
">Team</button>
<button class="
compact
ui
button
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
maintenance
.
senaraiProjectTeam
', ['
id
' => $project['
id
']]) }}'
;
">
<button class="
compact
ui
button
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
maintenance
.
updateProject
', ['
id
' => $project['
id
']]) }}'
;
">Edit</button>
Team
</button>
<button class="
compact
ui
button
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
maintenance
.
updateProject
', ['
id
' => $project['
id
']]) }}'
;
">
Edit
</button>
<button class="
compact
ui
button
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
maintenance
.
mandays
', ['
id
' => $project['
id
']]) }}'
;
">
Mandays
</button>
</td>
</td>
</tr>
</tr>
@endforeach
@endforeach
...
...
packages/portal/timesheet/routes/web.php
View file @
fd575cf8
...
@@ -49,6 +49,7 @@ Route::group(
...
@@ -49,6 +49,7 @@ Route::group(
Route
::
post
(
'addnewproject'
,[
'uses'
=>
'MaintenanceController@addnewproject'
,
'as'
=>
'maintenance.addnewproject'
]);
Route
::
post
(
'addnewproject'
,[
'uses'
=>
'MaintenanceController@addnewproject'
,
'as'
=>
'maintenance.addnewproject'
]);
Route
::
get
(
'updateProject'
,[
'uses'
=>
'MaintenanceController@updateProject'
,
'as'
=>
'maintenance.updateProject'
]);
Route
::
get
(
'updateProject'
,[
'uses'
=>
'MaintenanceController@updateProject'
,
'as'
=>
'maintenance.updateProject'
]);
Route
::
post
(
'editproject'
,[
'uses'
=>
'MaintenanceController@editproject'
,
'as'
=>
'maintenance.editproject'
]);
Route
::
post
(
'editproject'
,[
'uses'
=>
'MaintenanceController@editproject'
,
'as'
=>
'maintenance.editproject'
]);
Route
::
get
(
'mandays'
,[
'uses'
=>
'MaintenanceController@mandays'
,
'as'
=>
'maintenance.mandays'
]);
Route
::
get
(
'senaraiProjectTeam'
,[
'uses'
=>
'MaintenanceController@senaraiProjectTeam'
,
'as'
=>
'maintenance.senaraiProjectTeam'
]);
Route
::
get
(
'senaraiProjectTeam'
,[
'uses'
=>
'MaintenanceController@senaraiProjectTeam'
,
'as'
=>
'maintenance.senaraiProjectTeam'
]);
Route
::
get
(
'penambahanProjectTeam'
,[
'uses'
=>
'MaintenanceController@penambahanProjectTeam'
,
'as'
=>
'maintenance.penambahanProjectTeam'
]);
Route
::
get
(
'penambahanProjectTeam'
,[
'uses'
=>
'MaintenanceController@penambahanProjectTeam'
,
'as'
=>
'maintenance.penambahanProjectTeam'
]);
...
...
packages/portal/timesheet/src/Http/Controllers/MaintenanceController.php
View file @
fd575cf8
...
@@ -178,6 +178,22 @@ class MaintenanceController extends Controller
...
@@ -178,6 +178,22 @@ class MaintenanceController extends Controller
return
redirect
()
->
route
(
'timesheet::maintenance.senaraiProject'
)
->
withSuccess
(
'Project updated!'
);
return
redirect
()
->
route
(
'timesheet::maintenance.senaraiProject'
)
->
withSuccess
(
'Project updated!'
);
}
}
public
function
mandays
(
Request
$request
){
$staffid
=
Users
::
find
(
Auth
::
id
())
->
u_staffID
;
$project
=
Project
::
where
(
'id'
,
$request
->
id
)
->
first
();
// dd($project);
$role
=
Role
::
where
(
'status'
,
1
)
->
get
();
$pid
=
$request
->
id
;
// dd($pid);
return
view
(
'timesheet::maintenance.mandays'
,
compact
(
'project'
,
'staffid'
,
'pid'
,
'role'
));
}
public
function
senaraiProjectTeam
(
Request
$request
)
public
function
senaraiProjectTeam
(
Request
$request
)
{
{
// dd($request);
// dd($request);
...
...
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