Commit 41b6a554 by hannan

completion of overhead form

parent 5447aded
@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
...@@ -17,7 +17,7 @@ input[type=number] { ...@@ -17,7 +17,7 @@ input[type=number] {
</style> </style>
<div class="ui segment"> <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>
<br> <br>
<form class="ui form"> <form class="ui form">
...@@ -48,7 +48,7 @@ input[type=number] { ...@@ -48,7 +48,7 @@ input[type=number] {
<table class="ui celled structured table"> <table class="ui celled structured table">
<thead> <thead>
<tr> <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 colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th> <th>
<button type="submit" class="fluid center aligned ui blue compact labeled icon button"> <button type="submit" class="fluid center aligned ui blue compact labeled icon button">
...@@ -58,7 +58,8 @@ input[type=number] { ...@@ -58,7 +58,8 @@ input[type=number] {
</th> </th>
</tr> </tr>
<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) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
...@@ -82,6 +83,9 @@ input[type=number] { ...@@ -82,6 +83,9 @@ input[type=number] {
<?php $total = 0; ?> <?php $total = 0; ?>
<tr> <tr>
<td class="single line"> <td class="single line">
{{$project['td_project_code']}}
</td>
<td class="single line">
{{$project['td_project_name']}} {{$project['td_project_name']}}
</td> </td>
@if($phase == 1) @if($phase == 1)
......
@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:2px;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:2px;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: 4px;padding-left: 4px;" 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
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{{csrf_field()}} {{csrf_field()}}
<div class="field"> <div class="field">
<label>Role Description</label> <label>Role Description</label>
<input type="text" name="overheadlookup" placeholder="Enter new role"> <input type="text" name="role" placeholder="Enter new role">
</div> </div>
<div class="field"> <div class="field">
<label>Role Status</label> <label>Role Status</label>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
@section('content') @section('content')
<div class="ui segment"> <div class="ui segment">
<a class="ui blue left ribbon label">Senarai Project</a> <a class="ui blue left ribbon label">Senarai Peranan</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 href="{{ route('timesheet::dashboard.penambahanPeranan')}} " class="ui right floated small primary labeled icon button"><i class="plus icon"></i>Add New Role
</a> </a>
<br> <br>
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
<td>{{$key+1}} </td> <td>{{$key+1}} </td>
<td>{{$role['role']}} </td> <td>{{$role['role']}} </td>
<td>{{$role['status']}} </td> <td>{{$role['status']}} </td>
<td><a href="">Edit</a></td> <td><a href="{{ route('timesheet::dashboard.editPeranan', ['id' => $role['id']]) }}">Edit</a></td>
<!-- <td><a href="{{ route('timesheet::dashboard.', ['id' => $project['id']]) }}">Edit</a></td> -->
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
......
...@@ -25,6 +25,8 @@ Route::group( ...@@ -25,6 +25,8 @@ Route::group(
Route::get('senaraiPeranan',['uses' => 'DashboardController@senaraiPeranan', 'as' => 'dashboard.senaraiPeranan']); Route::get('senaraiPeranan',['uses' => 'DashboardController@senaraiPeranan', 'as' => 'dashboard.senaraiPeranan']);
Route::get('penambahanPeranan',['uses' => 'DashboardController@penambahanPeranan', 'as' => 'dashboard.penambahanPeranan']); Route::get('penambahanPeranan',['uses' => 'DashboardController@penambahanPeranan', 'as' => 'dashboard.penambahanPeranan']);
Route::post('addrole',['uses' => 'DashboardController@addrole', 'as' => 'dashboard.addrole']); 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('chargeableForm',['uses' => 'DashboardController@chargeableForm', 'as' => 'dashboard.chargeableForm']);
Route::get('nonChargeableForm',['uses' => 'DashboardController@nonChargeableForm', 'as' => 'dashboard.nonChargeableForm']); Route::get('nonChargeableForm',['uses' => 'DashboardController@nonChargeableForm', 'as' => 'dashboard.nonChargeableForm']);
...@@ -40,6 +42,7 @@ Route::group( ...@@ -40,6 +42,7 @@ Route::group(
Route::get('timesheet_viewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']); Route::get('timesheet_viewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']);
Route::post('savechargeablehours',['uses' => 'DashboardController@savechargeablehours', 'as' => 'dashboard.savechargeablehours']); Route::post('savechargeablehours',['uses' => 'DashboardController@savechargeablehours', 'as' => 'dashboard.savechargeablehours']);
Route::post('saveoverheadhours',['uses' => 'DashboardController@saveoverheadhours', 'as' => 'dashboard.saveoverheadhours']);
......
...@@ -104,6 +104,10 @@ class ServiceProvider extends BaseServiceProvider ...@@ -104,6 +104,10 @@ class ServiceProvider extends BaseServiceProvider
->data('icon', 'users icon') ->data('icon', 'users icon')
->active('pengurusan/*') ->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 = $this->app['laravolt.menu']->add(__('Kalendar'))->data('icon', 'calendar alternate');
$calendar->add(__('Kalendar'), route('timesheet::dashboard.kalendar')) $calendar->add(__('Kalendar'), route('timesheet::dashboard.kalendar'))
...@@ -132,7 +136,7 @@ class ServiceProvider extends BaseServiceProvider ...@@ -132,7 +136,7 @@ class ServiceProvider extends BaseServiceProvider
->active('nonChargeableForm/*') ->active('nonChargeableForm/*')
->data('permission', Permission::kehadiran); ->data('permission', Permission::kehadiran);
$form->add(__('Overhead'), route('timesheet::dashboard.overheadForm')) $form->add(__('Borang Overhead'), route('timesheet::dashboard.overheadForm'))
->data('icon', 'circle outline') ->data('icon', 'circle outline')
->active('overheadForm/*') ->active('overheadForm/*')
->data('permission', Permission::kehadiran); ->data('permission', Permission::kehadiran);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment