Commit 1b125b1e by hannan

filter pm selection, changes in overhead description modal, validation and check null error

parent 8f784e21
@foreach($staffs as $key => $staff) @if($staffs)
<div class="item" data-value="{{$staff->id}}" data-text="{{$staff->fullname}}"> @foreach($staffs as $key => $staff)
<div class="item" data-value="{{$staff->id}}" data-text="{{$staff->fullname}}">
{{$staff->fullname}} {{$staff->fullname}}
</div> </div>
@endforeach @endforeach
\ No newline at end of file @else
@endif
\ No newline at end of file
...@@ -45,7 +45,7 @@ input[type=number] { ...@@ -45,7 +45,7 @@ input[type=number] {
<input type="hidden" name="year" value="{{$year}}"> <input type="hidden" name="year" value="{{$year}}">
<input type="hidden" name="month" value="{{$month}}"> <input type="hidden" name="month" value="{{$month}}">
<input type="hidden" name="phase" value="{{$phase}}"> <input type="hidden" name="phase" value="{{$phase}}">
<table class="ui celled structured table"> <table class="ui celled structured table unstackable">
<thead> <thead>
<tr> <tr>
<th colspan="2">Chargeable</th> <th colspan="2">Chargeable</th>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<div class="field"> <div class="field">
<label>Role</label> <label>Role</label>
<select name="role" class="ui fluid dropdown"> <select name="role" class="ui fluid dropdown">
<option value="">Role</option> <option value="{{$team->role_id}}">{{$teamRole->role}}</option>
@foreach($role as $key => $value) @foreach($role as $key => $value)
<option value="{{$value->id}} ">{{$value->role}}</option> <option value="{{$value->id}} ">{{$value->role}}</option>
@endforeach @endforeach
......
...@@ -31,7 +31,7 @@ input[type=number] { ...@@ -31,7 +31,7 @@ input[type=number] {
<div class="default text">Task</div> <div class="default text">Task</div>
<div class="menu"> <div class="menu">
@foreach($nonchargeables as $key => $nonchargeable) @foreach($nonchargeables as $key => $nonchargeable)
<div class="item" data-value="{{ $nonchargeable->id }}">{{$nonchargeable->p_project_description}}</div> <div class="item" data-value="{{ $nonchargeable->id }}">{{ data_get($nonchargeable, 'p_project_description')}}</div>
@endforeach @endforeach
</div> </div>
</div> </div>
...@@ -98,7 +98,7 @@ input[type=number] { ...@@ -98,7 +98,7 @@ input[type=number] {
<input type="hidden" name="year" value="{{$year}}"> <input type="hidden" name="year" value="{{$year}}">
<input type="hidden" name="month" value="{{$month}}"> <input type="hidden" name="month" value="{{$month}}">
<input type="hidden" name="phase" value="{{$phase}}"> <input type="hidden" name="phase" value="{{$phase}}">
<table class="ui celled structured table"> <table class="ui celled structured table unstackable">
<thead> <thead>
<tr> <tr>
<th class="single line">Non-Chargeable</th> <th class="single line">Non-Chargeable</th>
......
...@@ -45,7 +45,8 @@ input[type=number] { ...@@ -45,7 +45,8 @@ input[type=number] {
<input type="hidden" name="year" value="{{$year}}"> <input type="hidden" name="year" value="{{$year}}">
<input type="hidden" name="month" value="{{$month}}"> <input type="hidden" name="month" value="{{$month}}">
<input type="hidden" name="phase" value="{{$phase}}"> <input type="hidden" name="phase" value="{{$phase}}">
<table class="ui celled structured table">
<table class="ui celled structured unstackable table" >
<thead> <thead>
<tr> <tr>
<th>Overhead</th> <th>Overhead</th>
...@@ -101,7 +102,7 @@ input[type=number] { ...@@ -101,7 +102,7 @@ input[type=number] {
} }
?> ?>
<td > <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']}}');"> <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" size="2" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td> </td>
@endfor @endfor
@else @else
...@@ -122,7 +123,6 @@ input[type=number] { ...@@ -122,7 +123,6 @@ input[type=number] {
$total += data_get($valuehour,'td_hours'); $total += data_get($valuehour,'td_hours');
} }
?> ?>
<td > <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']}}');"> <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']}}');">
...@@ -130,9 +130,7 @@ input[type=number] { ...@@ -130,9 +130,7 @@ input[type=number] {
@endfor @endfor
@endif @endif
<td> <td>
<button class="ui center blue button"> <input type="text" name="desc" value="icon">
<i class="ui center edit white icon"></i>
</button>
</td> </td>
<td> <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}}> <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}}>
...@@ -154,6 +152,7 @@ input[type=number] { ...@@ -154,6 +152,7 @@ input[type=number] {
Phase 1 Phase 1
</button> </button>
@endif @endif
</div> </div>
@endsection @endsection
......
...@@ -18,19 +18,21 @@ ...@@ -18,19 +18,21 @@
<label>Project Manager</label> <label>Project Manager</label>
<select name="projectmanager" class="ui fluid dropdown"> <select name="projectmanager" class="ui fluid dropdown">
<option value="">Project Manager</option> <option value="">Project Manager</option>
<option value="842">Rashdan</option> @foreach($pm as $key => $value)
<option value="920">Maimunah</option> <option value="{{$value->staff_id}}">{{$value->fullname}}</option>
@endforeach
</select> </select>
</div> </div>
<div class="field"> <div class="field">
<label>Project Status</label> <label>Project Status</label>
<select name="status" class="ui fluid dropdown"> <select name="status" class="ui fluid dropdown">
<option value="">Project Status</option> <!-- <option value="">Project Status</option> -->
<option value="1">Active</option> <option value="1">Active</option>
<option value="0">Inactive</option> <option value="0">Inactive</option>
</select> </select>
</div> </div>
<button class="ui button" type="submit">Submit</button> <button class="ui blue button" type="submit">Submit</button>
<button class="ui green button" type="button" onclick="window.location.href='{{ route('timesheet::dashboard.senaraiProject') }} ';">Back</button>
</form> </form>
</div> </div>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<div class="field"> <div class="field">
<label>Project Status</label> <label>Project Status</label>
<select name="status" class="ui fluid dropdown"> <select name="status" class="ui fluid dropdown">
<option value="">Project Team Status</option> <!-- <option value="">Project Team Status</option> -->
<option value="1">Active</option> <option value="1">Active</option>
<option value="0">Inactive</option> <option value="0">Inactive</option>
</select> </select>
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
@foreach($projectlist as $key => $project) @foreach($projectlist as $key => $project)
<tr> <tr>
<td>{{$key+1}} </td> <td>{{$key+1}} </td>
<td>{{$project['projectcode']}} </td> <td>{{ data_get($project,'projectcode') }} </td>
<td>{{$project['projectname']}} </td> <td>{{ data_get($project,'projectname') }} </td>
<td>{{$project['projectmanager']}} </td> <td>{{ data_get($project,'projectmanager') }} </td>
<td>{{$project['status']}} </td> <td>{{ data_get($project,'status') }} </td>
<td><a href="{{ route('timesheet::dashboard.senaraiProjectTeam', ['id' => $project['id']]) }}">Project Team</a></td> <td><a href="{{ route('timesheet::dashboard.senaraiProjectTeam', ['id' => $project['id']]) }}">Project Team</a></td>
</tr> </tr>
@endforeach @endforeach
......
...@@ -9,8 +9,10 @@ Route::group( ...@@ -9,8 +9,10 @@ Route::group(
], ],
function () { function () {
//dashboard
Route::get('home',['uses' => 'DashboardController@index', 'as' => 'dashboard.index']); Route::get('home',['uses' => 'DashboardController@index', 'as' => 'dashboard.index']);
//maintenance
Route::get('senaraiProject',['uses' => 'DashboardController@senaraiProject', 'as' => 'dashboard.senaraiProject']); Route::get('senaraiProject',['uses' => 'DashboardController@senaraiProject', 'as' => 'dashboard.senaraiProject']);
Route::get('penambahanProject',['uses' => 'DashboardController@penambahanProject', 'as' => 'dashboard.penambahanProject']); Route::get('penambahanProject',['uses' => 'DashboardController@penambahanProject', 'as' => 'dashboard.penambahanProject']);
Route::get('senaraiProjectTeam',['uses' => 'DashboardController@senaraiProjectTeam', 'as' => 'dashboard.senaraiProjectTeam']); Route::get('senaraiProjectTeam',['uses' => 'DashboardController@senaraiProjectTeam', 'as' => 'dashboard.senaraiProjectTeam']);
...@@ -31,12 +33,12 @@ Route::group( ...@@ -31,12 +33,12 @@ Route::group(
// nonChargeableForm // nonChargeableForm
Route::post('addnonchargeabletask',['uses' => 'DashboardController@addnonchargeabletask', 'as' => 'dashboard.addnonchargeabletask']); Route::post('addnonchargeabletask',['uses' => 'DashboardController@addnonchargeabletask', 'as' => 'dashboard.addnonchargeabletask']);
// route to form // route to form
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']);
Route::get('overheadForm',['uses' => 'DashboardController@overheadForm', 'as' => 'dashboard.overheadForm']); Route::get('overheadForm',['uses' => 'DashboardController@overheadForm', 'as' => 'dashboard.overheadForm']);
//calendar
Route::get('kalendarCharge',['uses' => 'DashboardController@kalendarCharge', 'as' => 'dashboard.kalendarCharge']); Route::get('kalendarCharge',['uses' => 'DashboardController@kalendarCharge', 'as' => 'dashboard.kalendarCharge']);
Route::get('kalendarNonCharge',['uses' => 'DashboardController@kalendarNonCharge', 'as' => 'dashboard.kalendarNonCharge']); Route::get('kalendarNonCharge',['uses' => 'DashboardController@kalendarNonCharge', 'as' => 'dashboard.kalendarNonCharge']);
Route::get('kalendar',['uses' => 'DashboardController@kalendar', 'as' => 'dashboard.kalendar']); Route::get('kalendar',['uses' => 'DashboardController@kalendar', 'as' => 'dashboard.kalendar']);
......
...@@ -78,51 +78,73 @@ class DashboardController extends Controller ...@@ -78,51 +78,73 @@ class DashboardController extends Controller
public function senaraiProject() public function senaraiProject()
{ {
$project = Project::all(); $chargeable = 1;
$project = Project::where('p_project_type', $chargeable)
->get();
$projectlist = []; $projectlist = [];
// nanti project code query dari table project: // nanti project code query dari table project:
if(count($project) > 0) if(count($project) > 0) {
{ foreach ($project as $key => $value){
$pm = Pteam::where('fk_project_id', $value->id)
->where('role_id', 1)
->where('pt_project_task_sts', 1)
->first();
foreach ($project as $key => $value) { // dd($pm->pt_team);
$projectlist[] = [ $projectlist[] = [
'id' => $value->id, 'id' => $value->id,
'projectcode' => $value->p_project_code, 'projectcode' => $value->p_project_code,
'projectname' => $value->p_project_description, 'projectname' => $value->p_project_description,
'projectmanager' => $value->projectManager->fullname, 'projectmanager' => $pm->pt_team,
'status' => $value->p_project_sts, 'status' => $value->p_project_sts,
]; ];
} }
} }
else else
{ {
$projectlist = null;
}
// dd($projectlist); $projectlist = [];
}
return view('timesheet::dashboard.senaraiProject',compact('projectlist')); return view('timesheet::dashboard.senaraiProject',compact('projectlist'));
} }
public function penambahanProject() public function penambahanProject()
{ {
$pms = 4;
$pm = DB::table('staff_info')
// ->where('fk_lkp_department', $pms)
->where('flag_pm', 1)
->where('status', 1)
// ->join('users', 'u_staffID', '=', 'staff_id')
->get();
return view('timesheet::dashboard.penambahanProject'); // dd($pm);
return view('timesheet::dashboard.penambahanProject', compact('pm'));
} }
public function addnewproject(Request $request) public function addnewproject(Request $request)
{ {
$chargeable = 1; $chargeable = 1;
$nonchargeable = 2;
$userId = users::find(Auth::id()) $userId = users::find(Auth::id())
->u_staffID; ->u_staffID;
if ($request->projectcode == null || $request->projectname == null || $request->projectmanager == null) {
return redirect()->route('timesheet::dashboard.penambahanProject')
->withErrors('The information is not complete. Please re-enter!');
} else {
// dd($request);
$project = new Project; $project = new Project;
$project->p_project_code = $request->projectcode; $project->p_project_code = $request->projectcode;
$project->p_project_description = $request->projectname; $project->p_project_description = $request->projectname;
...@@ -132,14 +154,47 @@ class DashboardController extends Controller ...@@ -132,14 +154,47 @@ class DashboardController extends Controller
$project->updated_by = $userId; $project->updated_by = $userId;
$project->save(); $project->save();
return redirect()->route('timesheet::dashboard.penambahanProject') $noncharge = new Project;
$noncharge->p_project_description = $request->projectname;
$noncharge->p_project_type = $nonchargeable;
$noncharge->p_project_sts = $request->status;
$noncharge->updated_by = $userId;
$noncharge->save();
$projectId = Project::select('id')
->where('p_project_code', $request->projectcode)
->value('id');
$sname = Staff_info::select('fullname')
->where('staff_id', $request->projectmanager)
->value('fullname');
// dd($projectId);
$team = new Pteam;
$team->role_id = 1;
$team->pt_project_description = $request->projectname;
$team->fk_project_id = $projectId;
$team->pt_staff_id = $request->projectmanager;
$team->pt_team = $sname;
$team->pt_project_type = $chargeable;
$team->pt_project_task_sts = 1;
$team->updated_by = $userId;
$team->save();
}
return redirect()->route('timesheet::dashboard.senaraiProject')
->with('success', 'New Project Added'); ->with('success', 'New Project Added');
} }
public function senaraiProjectTeam(Request $request) public function senaraiProjectTeam(Request $request)
{ {
$chargeable = 1;
$pid = $request->id; $pid = $request->id;
$project = Pteam::where('fk_project_id',$request->id) $project = Pteam::where('fk_project_id',$request->id)
->where('pt_project_type', $chargeable)
// ->where('pt_project_task_sts', 1)
->orderBy('pt_project_task_sts', 'DESC')
->orderBy('role_id') ->orderBy('role_id')
->get(); ->get();
$projectlist = []; $projectlist = [];
...@@ -172,7 +227,7 @@ class DashboardController extends Controller ...@@ -172,7 +227,7 @@ class DashboardController extends Controller
->first(); //find($request->id); ->first(); //find($request->id);
$departments = Department::all() $departments = Department::all()
->except([7,8]); ->except([7]);
// ->except($departments->code,['']); // ->except($departments->code,['']);
foreach ($departments as $key => $value) foreach ($departments as $key => $value)
...@@ -198,6 +253,12 @@ class DashboardController extends Controller ...@@ -198,6 +253,12 @@ class DashboardController extends Controller
$expstaff = explode(',', $request->staffId); $expstaff = explode(',', $request->staffId);
if ($request->staffId == null || $request->role == null) {
dd($request);
return redirect()->route('timesheet::dashboard.penambahanProjectTeam', ['pcode'=>$request->pcode, 'pname'=>$request->pname, $request->id]);
} else {
foreach ($expstaff as $key => $value) foreach ($expstaff as $key => $value)
{ {
$staff = Staff_info::where('fk_users', $value) $staff = Staff_info::where('fk_users', $value)
...@@ -218,6 +279,8 @@ class DashboardController extends Controller ...@@ -218,6 +279,8 @@ class DashboardController extends Controller
$pt->save(); $pt->save();
} }
}
return redirect()->route('timesheet::dashboard.senaraiProject') return redirect()->route('timesheet::dashboard.senaraiProject')
->with('success', 'Project Team Added Successfully'); ->with('success', 'Project Team Added Successfully');
...@@ -228,11 +291,15 @@ class DashboardController extends Controller ...@@ -228,11 +291,15 @@ class DashboardController extends Controller
$team = Pteam::where('id', $request->id) $team = Pteam::where('id', $request->id)
->first(); ->first();
$teamRole = Role::where('id', $team->role_id)
->first();
// dd($team);
$role = Role::all(); $role = Role::all();
// dd($role); // dd($role);
$pid = $team->fk_project_id; $pid = $team->fk_project_id;
return view('timesheet::dashboard.editprojectteam', compact('team', 'pid', 'role')); return view('timesheet::dashboard.editprojectteam', compact('team', 'pid', 'role', 'teamRole'));
} }
public function updateprojectteam(Request $request) public function updateprojectteam(Request $request)
...@@ -419,19 +486,22 @@ class DashboardController extends Controller ...@@ -419,19 +486,22 @@ class DashboardController extends Controller
{ {
$hour = null; $hour = null;
} }
return view('timesheet::dashboard.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour')); return view('timesheet::dashboard.chargeableForm', compact('projectlist','userId','month','phase','daymonth','year','day','hour'));
} }
public function nonChargeableForm(Request $request) public function nonChargeableForm(Request $request)
{ {
$nonchargeable = 2; $nonchargeable = 2;
$userId = users::find(Auth::id()) $userId = users::find(Auth::id())
->u_staffID; ->u_staffID;
$nonchargeables = Project::all(); $nonchargeables = Project::where('p_project_type', $nonchargeable)
->get();
$project = Pteam::where('pt_staff_id',$userId) $project = Pteam::where('pt_staff_id',$userId)
->where('pt_project_type', 2) ->where('pt_project_type', $nonchargeable)
->get(); ->get();
$projectlist = []; $projectlist = [];
...@@ -738,7 +808,7 @@ class DashboardController extends Controller ...@@ -738,7 +808,7 @@ class DashboardController extends Controller
$date = $request->year.'-'.$request->month.'-'.sprintf('%02d', $keyday); $date = $request->year.'-'.$request->month.'-'.sprintf('%02d', $keyday);
$checkTimesheetDetail = Ts_detail::where('td_project', $projectid) $checkTimesheetDetail = Ts_detail::where('td_project', $projectid)
->where('td_project_type', $nonchargeable) ->where('td_project_type', $chargeable)
->where('td_date', $date) ->where('td_date', $date)
->where('tm_phase', $request->phase) ->where('tm_phase', $request->phase)
->first(); ->first();
......
...@@ -18,6 +18,11 @@ class Project extends Model ...@@ -18,6 +18,11 @@ class Project extends Model
return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','p_project_task_team'); return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','p_project_task_team');
} }
public function projectTeam()
{
return $this->hasOne('Portal\Timesheet\Model\Pteam','fk_project_id','id');
}
/** /**
* undocumented function * undocumented function
* *
......
...@@ -18,6 +18,11 @@ class Staff_info extends Model ...@@ -18,6 +18,11 @@ class Staff_info extends Model
return $this->hasMany('Portal\Timesheet\Model\Department','id','fk_lkp_department'); return $this->hasMany('Portal\Timesheet\Model\Department','id','fk_lkp_department');
} }
public function toUser()
{
return $this->hasOne('Portal\Timesheet\Model\Users', 'u_staffID', 'staff_id');
}
// public function project_code() // public function project_code()
// { // {
// return $this->hasMany('Portal\Timesheet\Model\Ts_detail','td_project','id'); // return $this->hasMany('Portal\Timesheet\Model\Ts_detail','td_project','id');
......
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