Commit 5447aded by hannan

add role column and changes in blade

parent c1653d49
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRoleColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('project_team', function (Blueprint $table) {
$table->integer('role_id')->after('pt_project_description')->unsigned()->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('project_team', function (Blueprint $table) {
$table->dropColumn('role_id');
});
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRoleTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('project_role', function (Blueprint $table) {
$table->increments('id');
$table->string('role', 50)->nullable();
$table->integer('status')->unsigned()->nullable();
$table->timestamps();
$table->integer('updated_by')->nullable();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('project_role');
}
}
......@@ -22,26 +22,18 @@ input[type=number] {
<br>
<form class="ui form">
<div class="field">
<div class="four fields">
<div class="two wide field">
<label>Day</label>
<input type="text" placeholder="Day" value="{{$day}} ">
<div class="three fields">
<div class="one wide field">
<label>Phase</label>
<input type="text" placeholder="Year" value="{{$phase}}" readonly="readonly">
</div>
<div class="two wide field">
<div class="one wide field">
<label>Month</label>
<input type="text" placeholder="Month" value="{{$month}} ">
<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}} ">
</div>
<div class="two wide field">
<label>Phase</label>
<select class="ui fluid dropdown">
<option value="">{{$phase}}</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="text" placeholder="Year" value="{{$year}}" readonly="readonly">
</div>
</div>
</div>
......@@ -135,7 +127,7 @@ input[type=number] {
->where('tm_phase',$phase)
->first();
$total += $valuehour->td_hours;
$total += data_get($valuehour,'td_hours');
}
?>
......@@ -154,12 +146,12 @@ input[type=number] {
</form>
<br>
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" onclick="phase2($phase);" id="phase2">
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::dashboard.chargeableForm', ['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" onclick="phase1($phase);" id="phase1">
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::dashboard.chargeableForm', ['phase' => 1], ['month' => $month], ['year' => $year]) }}';">
<i class="angle double left icon"></i>
Phase 1
</button>
......@@ -171,23 +163,6 @@ input[type=number] {
@push('script')
<script>
var phase = 0;
function phase2(p)
{
phase = p;
phase = phase+1;
document.getElementById('phase2') = phase;
}
function phase1(p)
{
phase = p;
phase = phase-1;
document.getElementById('phase1') = phase;
}
</script>
<script>
function onlynumber(evt)
{
var theEvent = evt || window.event;
......
......@@ -11,7 +11,17 @@
<input type="hidden" name="pid" value="{{$team->fk_project_id}} ">
<div class="field">
<label for="projectteam">Project Team</label>
<input onselect="myDepartment()" type="text" name="projectteam" value="{{$team->pt_team}}">
<input onselect="myDepartment()" type="text" name="projectteam" value="{{$team->pt_team}}" readonly="readonly">
</div>
<div class="field">
<label>Role</label>
<select name="role" class="ui fluid dropdown">
<option value="">Role</option>
<option value="1">Program Executive</option>
<option value="2">Developer</option>
<option value="3">System Analyst</option>
<option value="4">Tester</option>
</select>
</div>
<div class="field">
<label>Project Status</label>
......
......@@ -19,13 +19,26 @@ input[type=number] {
<div class="ui segment">
<a class="ui blue left ribbon label">Non Chargeable Form</a>
<br>
<hr>
Day = {{$day}} <br>
Timesheet for month = {{$month}} <br>
Year = {{$year}} <br>
Phase = {{$phase}}
<br>
<hr>
<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.savechargeablehours' )}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="userId" value="{{$userId}}">
......@@ -35,7 +48,7 @@ input[type=number] {
<table class="ui celled structured table">
<thead>
<tr>
<th colspan="2">Non-Chargeable</th>
<th>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">
......@@ -45,8 +58,7 @@ input[type=number] {
</th>
</tr>
<tr>
<th class="single line">Project Code</th>
<th class="single line">Project Name</th>
<th class="single line">Task</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
......@@ -70,9 +82,6 @@ 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)
......@@ -88,7 +97,6 @@ input[type=number] {
$valuehour = $hour->where('td_date','=',$date)
->where('td_project',$project['td_project'])
->where('tm_phase',$phase)
// ->where('td_project_type',$nonchargeable)
->first();
$total += $valuehour->td_hours;
......@@ -115,7 +123,7 @@ input[type=number] {
->where('tm_phase',$phase)
->first();
$total += $valuehour->td_hours;
$total += data_get($valuehour,'td_hours');
}
?>
......@@ -134,12 +142,12 @@ input[type=number] {
</form>
<br>
@if($phase == 1)
<button class="center aligned ui green compact right labeled icon button" onclick="phase2($phase);" id="phase2">
<button class="center aligned ui green compact right labeled icon button" id="phase2" onclick="window.location.href='{{ route('timesheet::dashboard.nonChargeableForm', ['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" onclick="phase1($phase);" id="phase1">
<button class="center aligned ui green compact labeled icon button" id="phase1" onclick="window.location.href='{{ route('timesheet::dashboard.nonChargeableForm', ['phase' => 1], ['month' => $month], ['year' => $year]) }}';">
<i class="angle double left icon"></i>
Phase 1
</button>
......@@ -151,23 +159,6 @@ input[type=number] {
@push('script')
<script>
var phase = 0;
function phase2(p)
{
phase = p;
phase = phase+1;
document.getElementById('phase2') = phase;
}
function phase1(p)
{
phase = p;
phase = phase-1;
document.getElementById('phase1') = phase;
}
</script>
<script>
function onlynumber(evt)
{
var theEvent = evt || window.event;
......@@ -225,6 +216,19 @@ input[type=number] {
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>
......
@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.addrole' )}}" method="POST">
{{csrf_field()}}
<div class="field">
<label>Role Description</label>
<input type="text" name="overheadlookup" placeholder="Enter new role">
</div>
<div class="field">
<label>Role Status</label>
<select name="status" class="ui fluid dropdown">
<option value="">Role Status</option>
<option value="1">Active</option>
<option value="2">Inactive</option>
</select>
</div>
<button class="ui button" type="submit">Submit</button>
</form>
</div>
@endsection
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Senarai Project</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>
<table class="ui celled padded table">
<thead>
<tr>
<th>No</th>
<th>Role Description</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($roles as $key => $role)
<tr>
<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> -->
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
......@@ -14,6 +14,7 @@
<th>Project Code</th>
<th>Project Name</th>
<th>Project Team</th>
<th>Role</th>
<th>Status</th>
<th>Action</th>
</tr>
......@@ -25,6 +26,7 @@
<td>{{$project['projectcode']}} </td>
<td>{{$project['projectname']}} </td>
<td>{{$project['projectteam']}} </td>
<td>{{$project['role']}}</td>
<td>{{$project['status']}} </td>
<td><a href="{{ route('timesheet::dashboard.editprojectteam', ['id' => $project['id']])}} ">Edit</a></td>
</tr>
......@@ -33,7 +35,7 @@
<tfoot>
<tr>
<th colspan="6">
<th colspan="7">
<div class="ui right floated pagination menu">
<a class="icon item">
<i class="left chevron icon"></i>
......
......@@ -22,6 +22,9 @@ Route::group(
Route::get('senaraiOverhead',['uses' => 'DashboardController@senaraiOverhead', 'as' => 'dashboard.senaraiOverhead']);
Route::get('penambahanOverhead',['uses' => 'DashboardController@penambahanOverhead', 'as' => 'dashboard.penambahanOverhead']);
Route::post('addoverheadlookup',['uses' => 'DashboardController@addoverheadlookup', 'as' => 'dashboard.addoverheadlookup']);
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('chargeableForm',['uses' => 'DashboardController@chargeableForm', 'as' => 'dashboard.chargeableForm']);
Route::get('nonChargeableForm',['uses' => 'DashboardController@nonChargeableForm', 'as' => 'dashboard.nonChargeableForm']);
......
......@@ -13,6 +13,7 @@ use Portal\Timesheet\Model\Department;
use Portal\Timesheet\Model\Pteam;
use Portal\Timesheet\Model\Staff_info;
use Portal\Timesheet\Model\Overhead;
use Portal\Timesheet\Model\Role;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use File;
......@@ -137,6 +138,7 @@ class DashboardController extends Controller
'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,
];
......@@ -210,6 +212,8 @@ class DashboardController extends Controller
$team = Pteam::where('id', $request->id)->first();
$team->pt_project_task_sts = $request->status;
// letak query utk update role
// $team->pt_role = $request->role;
$team->update();
$project = Pteam::where('fk_project_id',$request->pid)->get();
......@@ -229,6 +233,37 @@ class DashboardController extends Controller
return view('timesheet::dashboard.senaraiProjectTeam', compact('projectlist', 'project', 'pid'));
}
public function senaraiPeranan()
{
$peranan = Role::all();
$roles = [];
foreach ($peranan as $key => $value) {
$roles[] = [
'id' => $value->id,
'role' => $value->role,
'status' => $value->status
];
}
return view('timesheet::dashboard.senaraiPeranan', compact('roles'));
}
public function penambahanPeranan()
{
return view('timesheet::dashboard.penambahanPeranan');
}
public function addrole(Request $request)
{
dd($request);
return redirect()->route('timesheet::dashboard.senaraiPeranan');
}
public function perkhidmatan()
{
return view('timesheet::dashboard.perkhidmatan');
......@@ -239,6 +274,7 @@ class DashboardController extends Controller
$userId = Auth::id();
$user = users::where('id', Auth::id())->first();
$project = Pteam::where('pt_staff_id',$user->u_staffID)->get();
// dd($project);
// dd($project);
$projectlist = [];
......@@ -280,12 +316,10 @@ class DashboardController extends Controller
}
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
// dd($phase);
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
$user = users::where('id', Auth::id())->first();
// dd($user);
// check timesheet master
......@@ -303,25 +337,22 @@ class DashboardController extends Controller
$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.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour'));
}
public function nonchargeableForm()
public function nonChargeableForm(Request $request)
{
$userId = Auth::id();
$user = users::where('id', Auth::id())->first();
$project = Pteam::where('pt_staff_id',$user->u_staffID)->get();
$nonchargeable = 2;
// dd($project);
$projectlist = [];
// nanti project code query dari table project:
......@@ -338,9 +369,7 @@ class DashboardController extends Controller
}
//sample dulu
$phase = 1;
$phase = 2;
$month = date('n');
$year = date('Y');
$day = date('j');
......@@ -361,12 +390,10 @@ class DashboardController extends Controller
}
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
// dd($phase);
//check dlam db, kalau dah ada detail hours, kuar form edit, kalau belum, kuar form create
$user = users::where('id', Auth::id())->first();
// dd($user);
// check timesheet master
......@@ -381,8 +408,7 @@ class DashboardController extends Controller
//kalau ada, dia gi ke edit
if($check)
{
$hour = Ts_detail::where('fk_tm_id', $check->id)
// ->where('td_project_type', $nonchargeable)
$hour = Ts_detail::where('fk_tm_id',$check->id)
// ->with('project:p_project_code')
->get();
// dd($hour);
......@@ -392,8 +418,7 @@ class DashboardController extends Controller
{
$hour = null;
}
return view('timesheet::dashboard.nonchargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour', 'nonchargeable'));
return view('timesheet::dashboard.nonChargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour'));
}
......
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'project_role';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
......@@ -100,6 +100,10 @@ class ServiceProvider extends BaseServiceProvider
->data('icon', 'users icon')
->active('pengurusan/*')
->data('permission', Permission::pengurusan);
$pengurusanProject->add(__('Senarai Peranan'), route('timesheet::dashboard.senaraiPeranan'))
->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'))
......
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