Commit 3d0c9b61 by hannan

update migration and model. screen for changeable form.

parent 4f801480
......@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTimesheetTblTable extends Migration
class CreateTimesheetDtlTable extends Migration
{
/**
* Run the migrations.
......@@ -13,20 +13,25 @@ class CreateTimesheetTblTable extends Migration
*/
public function up()
{
Schema::create('timesheet_tbl', function (Blueprint $table) {
Schema::create('timesheet_dtl', function (Blueprint $table) {
$table->increments('id');
$table->date('td_date')->nullable();
$table->string('td_project',10)->nullable();
$table->integer('fk_tm_id')->nullable1()->unsigned();
$table->integer('fk_tm_staff_id')->nullable()->unsigned();
$table->integer('fk_tm_month')->nullable()->unsigned();
$table->integer('fk_tm_phase')->nullable()->unsigned();
$table->string('fk_p_project_code',10)->nullable();
$table->integer('tm_id')->nullable1()->unsigned();
$table->integer('tm_staff_id')->nullable()->unsigned();
$table->integer('tm_month')->nullable()->unsigned();
$table->integer('tm_phase')->nullable()->unsigned();
$table->string('td_project_name',50)->nullable();
$table->integer('td_hours')->nullable()->unsigned();
$table->integer('td_timesheet_sts')->nullable()->unsigned();
$table->string('td_approval_remark',100)->nullable();
$table->string('td_review_remark',100)->nullable();
$table->integer('td_project_type')->nullable()->unsigned();
$table->integer('fk_o_id')->nullable()->unsigned();
$table->string('td_overhead_desc',50)->nullable();
$table->string('td_overhead_note',100)->nullable();
$table->string('td_non_chargeable_desc',100)->nullable();
$table->timestamps();
$table->integer('updated_by')->nullable();
......@@ -41,6 +46,6 @@ class CreateTimesheetTblTable extends Migration
*/
public function down()
{
Schema::dropIfExists('timesheet_tbl');
Schema::dropIfExists('timesheet_dtl');
}
}
......@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeDatatypePProjectCodeInProjectTbl extends Migration
class ChangeDatatypePtProjectTaskTeamInProjectTask extends Migration
{
/**
* Run the migrations.
......@@ -13,8 +13,8 @@ class ChangeDatatypePProjectCodeInProjectTbl extends Migration
*/
public function up()
{
Schema::table('project', function (Blueprint $table) {
$table->string('p_project_code', 50)->nullable()->change();
Schema::table('project_task', function (Blueprint $table) {
$table->integer('pt_project_task_team')->unsigned()->nullable()->change();
});
}
......@@ -25,7 +25,7 @@ class ChangeDatatypePProjectCodeInProjectTbl extends Migration
*/
public function down()
{
Schema::table('project', function (Blueprint $table) {
Schema::table('project_task', function (Blueprint $table) {
//
});
}
......
......@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTdProjectTypeToTimesheetDtlTable extends Migration
class ChangeDatatypeDDepartmentCodeInDepartment extends Migration
{
/**
* Run the migrations.
......@@ -13,12 +13,9 @@ class AddTdProjectTypeToTimesheetDtlTable extends Migration
*/
public function up()
{
Schema::rename('timesheet_tbl', 'timesheet_dtl');
Schema::table('timesheet_dtl', function (Blueprint $table) {
$table->integer('td_project_type')->after('td_review_remark')->unsigned()->nullable();
$table->integer('fk_overhead')->after('td_project_type')->unsigned()->nullable();
$table->string('td_overhead_note',100)->after('fk_overhead')->nullable();
$table->string('td_non_chargeable_desc',100)->after('td_overhead_note')->nullable();
Schema::table('department', function (Blueprint $table) {
$table->string('d_department_code',10)->nullable()->change();
});
}
......@@ -29,7 +26,7 @@ class AddTdProjectTypeToTimesheetDtlTable extends Migration
*/
public function down()
{
Schema::table('timesheet_dtl', function (Blueprint $table) {
Schema::table('department', function (Blueprint $table) {
//
});
}
......
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->integer('u_staffID')->after('name')->unsigned()->nullable();
$table->string('fk_d_department_code',10)->after('u_staffID')->nullable();
$table->integer('updated_by')->after('updated_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('u_staffID');
$table->dropColumn('fk_d_department_code');
});
}
}
......@@ -19,9 +19,17 @@ input[type=number] {
<div class="ui segment">
<a class="ui blue left ribbon label">Chargeable Form</a>
<br><br>
User Id = {{$userId}}
<hr>
Timesheet for {{$month}} , phase {{$phase}}
Day = {{$day}}
@if($day==1)
naisu
@endif
{{$sampleTimesheet_dtl[0]['td_date']}}
<br>
Timesheet for month = {{$month}} <br>
Year = {{$year}} <br>
Phase = {{$phase}}
<br>
<hr>
<form class="ui form" action="{{ url('saveHours' )}}" method="POST">
......@@ -38,23 +46,15 @@ input[type=number] {
</button>
</th>
</tr>
<tr>
<th >Project Code</th>
<th >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
......@@ -67,46 +67,33 @@ input[type=number] {
</tr>
</thead>
<tbody>
@foreach($samplequery as $key => $project)
@foreach($sampleTimesheet_dtl as $key => $project)
<tr>
<td>
{{$project['pcode']}}
{{$project['td_project_code']}}
</td>
<td>
{{$project['pname']}}
{{$project['td_project_name']}}
</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<td >
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['pid']}}][{{$i+1}}]" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this);">
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($project['td_date'] == $i+1) {{$project['td_hours']}} @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this);">
</td>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<td >
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['pid']}}][{{$i+1}}]" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this);">
<input type="text" onkeypress="onlynumber(event)" name="hour[{{$project['td_project']}}][{{$i+1}}]" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this);">
</td>
@endfor
@endif
<td>
<input type="number" onkeypress="onlynumber(event)" name="" style="padding-right: 4px;padding-left: 4px;" onchange="limiter(this);" readonly="">
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
......
......@@ -15,6 +15,7 @@ use App\Mail\StatusAccept;
use App\Mail\StatusReject;
use Mail;
use Curl;
use Auth;
class DashboardController extends Controller
{
......@@ -59,7 +60,6 @@ class DashboardController extends Controller
}
if ($roleid == '4') {
return view('timesheet::dashboard.approval');
}
......@@ -77,11 +77,13 @@ class DashboardController extends Controller
public function borangBolehCaj(Request $request)
{
$userId = Auth::id();
$projectcode = 'Project Code';
$projectname = 'Project Name';
// nanti project code query dari table project:
//
$samplequery[] = [
'pcode' => 'LHD2021',
......@@ -98,17 +100,54 @@ class DashboardController extends Controller
];
$sampleTimesheet_dtl[] = [
'td_id' => '1',
'td_date' => date('j-n-Y',strtotime('6/5/2022')),
'td_project' => '1',
'tm_id' => '1',
'tm_staff_id' => '1000',
'project_type' => '1',
'fk_o_id' => '',
'tm_month' => '6',
'tm_phase' => '1',
'td_project_code' => 'LHD20212',
'td_project_name' => 'SMART',
'td_hours' => '5'
];
$sampleTimesheet_dtl[] = [
'td_id' => '2',
'td_date' => date('j-n-Y',strtotime('6/5/2022')),
'td_project' => '2',
'tm_id' => '1',
'tm_staff_id' => '1000',
'project_type' => '1',
'fk_o_id' => '',
'tm_month' => '6',
'tm_phase' => '1',
'td_project_code' => 'LHD2021',
'td_project_name' => 'APIM',
'td_hours' => '3',
];
//sample dulu
// dd($sampleTimesheet_dtl[0]['td_date']);
// if (day == $i+1)
// $check if (td_hours != null) {{td_hours}}
//sample dulu
$phase = 1;
$month = date('n');
$year = date('Y');
$day = date('j');
if(isset($request->phase))
{
......@@ -125,7 +164,6 @@ class DashboardController extends Controller
$year = $request->year;
}
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
// dd($phase);
......@@ -140,7 +178,7 @@ class DashboardController extends Controller
//dia g ke edit, klu xde g create.php
//kalau ada juga = bawak data details
return view('timesheet::dashboard.borangBolehCaj', compact('projectcode', 'projectname','month','phase','samplequery','daymonth'));
return view('timesheet::dashboard.borangBolehCaj', compact('userId','projectcode', 'projectname','month','phase','samplequery','daymonth','year','sampleTimesheet_dtl','day'));
}
public function kalendarCharge()
......@@ -161,6 +199,13 @@ class DashboardController extends Controller
public function saveHours(Request $request)
{
dd($request);
// tm_master = Ts_master::where('tm_staff_id','=',Auth::id())
// ->where('tm_month','=',$tm_month)
// ->get();
// if(isset(tm_master))
// {
// }
//first = check dah ade ke belum
......
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
class Department extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'department';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
class Overhead extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'overhead';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
class P_task extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'project_task';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
class Ts_detail extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'timesheet_dtl';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
class ULevel extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'access_level';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
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