@@ -6,12 +6,6 @@ APP_URL=https://mbip.sipadu.my/ | |||
LOG_CHANNEL=stack | |||
DB_CONNECTION=oracle | |||
DB_HOST=210.186.146.195 | |||
DB_PORT=1091 | |||
DB_DATABASE=XE | |||
DB_USERNAME=mkpy | |||
DB_PASSWORD=mkpy | |||
BROADCAST_DRIVER=log | |||
CACHE_DRIVER=file |
@@ -1,160 +1,160 @@ | |||
<?php | |||
namespace App\Http\Controllers\api; | |||
use Illuminate\Http\Request; | |||
use App\Http\Requests\RegisterRequest; | |||
use App\Http\Controllers\Api\BaseController; | |||
use Illuminate\Support\Facades\Auth; | |||
use Hash; | |||
use Carbon\Carbon; | |||
use Crypt; | |||
use File; | |||
use Mail; | |||
use App\Model\Staff; | |||
use App\Model\StaffDetail; | |||
use App\Model\Module\Department; | |||
use App\Model\User; | |||
use App\Model\UserDetail; | |||
use App\Model\Module\Compound; | |||
use App\Jobs\StoreCompound; | |||
use App\Jobs\StoreNotice; | |||
class LoginController extends BaseController | |||
{ | |||
/** | |||
* Create a login list controller. | |||
* | |||
* @return json | |||
*/ | |||
public function requestStaffLogin(Request $request) { | |||
$user = ''; $data = array(); | |||
$rememberMe = false; | |||
$user = Staff::with(['StaffDetail' => function($q){ | |||
$q->select('_id','full_name','identity','mobile','address','gred','no_badan','roles_access','profile_img'); | |||
}])->where('no_badan',$request->no_badan)->where(function($q){ | |||
$q->where('roles_access','PenguatKuasa')->orWhere('roles_access','PPenguatKuasa'); | |||
})->first(); | |||
if (!empty($user)) { | |||
if(Hash::check($request->password, $user->password)){ | |||
// Check authorized | |||
do { | |||
$user->last_login_at = Carbon::now(new \DateTimeZone('Asia/Kuala_Lumpur'))->toDateTimeString(); | |||
$user->last_login_ip = $request->getClientIp(); | |||
$user->api_token = ''; | |||
$user->authorized = false; | |||
$user->save(); | |||
}while($user->authorized); | |||
$token_id = ''; | |||
do { | |||
$token_id = str_random(32); | |||
} while (Staff::where("token_id", "=", $token_id)->first() instanceof Staff); | |||
$user->api_token = $token_id; | |||
$user->last_login_at = Carbon::now(new \DateTimeZone('Asia/Kuala_Lumpur'))->toDateTimeString(); | |||
$user->last_login_ip = $request->getClientIp(); | |||
$user->authorized = true; | |||
$user->token_firebase = ''; | |||
$user->save(); | |||
$staff = StaffDetail::with('Department')->where('_id', $user->_id)->first(); | |||
if(!empty($staff->Department)){ | |||
foreach ($staff->Department as $key => $d) { | |||
$tempJ[] = $d->_id; | |||
} | |||
$jabatan = implode( ", ", $tempJ ); | |||
} | |||
array_push($data, array( | |||
'User' => $user->StaffDetail, | |||
'token' => $user->api_token, | |||
'jawatan' => $user->StaffDetail->gred, | |||
'token_firebase' => $user->token_firebase, | |||
'jbkod' => $jabatan | |||
)); | |||
return $this->sendResponse($data, 'Berjaya log masuk'); | |||
}else { | |||
return $this->sendError('Gagal', 'Emel atau kata-laluan tidak tepat'); | |||
} | |||
}else { | |||
return $this->sendError('Gagal', 'Rekod tidak dijumpai'); | |||
} | |||
} | |||
public function requestStaffLogout(Request $request){ | |||
$loginUser = Staff::where('api_token', $request->api_token)->first(); | |||
if(!empty($loginUser)){ | |||
$loginUser->last_login_at = Carbon::now(new \DateTimeZone('Asia/Kuala_Lumpur'))->toDateTimeString(); | |||
$loginUser->last_login_ip = $request->getClientIp(); | |||
$loginUser->api_token = ''; | |||
$loginUser->authorized = false; | |||
$loginUser->save(); | |||
return $this->sendResponse('Berjaya', 'Berjaya log keluar'); | |||
}else { | |||
return $this->sendError('Gagal', 'Maaf, penguatkuasa tidak dapat log keluar'); | |||
} | |||
} | |||
public function checkDeviceToken(Request $request){ | |||
$loginUser = Staff::where('api_token', $request->api_token)->first(); | |||
if(!empty($loginUser)){ | |||
return $this->sendResponse($loginUser->api_token, 'Successfully get detail'); | |||
}else { | |||
return $this->sendError('Failed', 'User Not Found'); | |||
} | |||
} | |||
// public function resetPassword(Request $request) | |||
// { | |||
// $data = array(); | |||
// $staff = Staff::where('api_token', $request->api_token)->first(); | |||
// if(!empty($staff)) | |||
// { | |||
// $ic_num = StaffDetail::with('Staff')->where('identity', $request->ic_number)->first(); | |||
// $id = $ic_num->_id; | |||
// if(!empty($id)) | |||
// { | |||
// $staffID = Staff::where('_id', $id)->first(); | |||
// $staffID->password = $request->new_password; | |||
// } | |||
// else | |||
// { | |||
// return $this->sendError('Gagal', 'Identiti tidak dijumpai'); | |||
// } | |||
// } | |||
// else | |||
// { | |||
// return $this->sendError('Gagal', 'penguatkuasa tidak wujud'); | |||
// } | |||
// } | |||
public function testing(Request $request) | |||
{ | |||
$test = '02399'; //filter_var('000099', FILTER_SANITIZE_NUMBER_INT); | |||
(int)$test += 1; | |||
dd($test); | |||
} | |||
} | |||
<?php | |||
namespace App\Http\Controllers\api; | |||
use Illuminate\Http\Request; | |||
use App\Http\Requests\RegisterRequest; | |||
use App\Http\Controllers\Api\BaseController; | |||
use Illuminate\Support\Facades\Auth; | |||
use Hash; | |||
use Carbon\Carbon; | |||
use Crypt; | |||
use File; | |||
use Mail; | |||
use App\Model\Staff; | |||
use App\Model\StaffDetail; | |||
use App\Model\Module\Department; | |||
use App\Model\User; | |||
use App\Model\UserDetail; | |||
use App\Model\Module\Compound; | |||
use App\Jobs\StoreCompound; | |||
use App\Jobs\StoreNotice; | |||
class LoginController extends BaseController | |||
{ | |||
/** | |||
* Create a login list controller. | |||
* | |||
* @return json | |||
*/ | |||
public function requestStaffLogin(Request $request) { | |||
$user = ''; $data = array(); | |||
$rememberMe = false; | |||
$user = Staff::with(['StaffDetail' => function($q){ | |||
$q->select('_id','full_name','identity','mobile','address','gred','no_badan','roles_access','profile_img'); | |||
}])->where('no_badan',$request->no_badan)->where(function($q){ | |||
$q->where('roles_access','PenguatKuasa')->orWhere('roles_access','PPenguatKuasa'); | |||
})->first(); | |||
if (!empty($user)) { | |||
if(Hash::check($request->password, $user->password)){ | |||
// Check authorized | |||
do { | |||
$user->last_login_at = Carbon::now(new \DateTimeZone('Asia/Kuala_Lumpur'))->toDateTimeString(); | |||
$user->last_login_ip = $request->getClientIp(); | |||
$user->api_token = ''; | |||
$user->authorized = false; | |||
$user->save(); | |||
}while($user->authorized); | |||
$token_id = ''; | |||
do { | |||
$token_id = str_random(32); | |||
} while (Staff::where("token_id", "=", $token_id)->first() instanceof Staff); | |||
$user->api_token = $token_id; | |||
$user->last_login_at = Carbon::now(new \DateTimeZone('Asia/Kuala_Lumpur'))->toDateTimeString(); | |||
$user->last_login_ip = $request->getClientIp(); | |||
$user->authorized = true; | |||
$user->token_firebase = ''; | |||
$user->save(); | |||
$staff = StaffDetail::with('Department')->where('_id', $user->_id)->first(); | |||
if(!empty($staff->Department)){ | |||
foreach ($staff->Department as $key => $d) { | |||
$tempJ[] = $d->_id; | |||
} | |||
$jabatan = implode( ", ", $tempJ ); | |||
} | |||
array_push($data, array( | |||
'User' => $user->StaffDetail, | |||
'token' => $user->api_token, | |||
'jawatan' => $user->StaffDetail->gred, | |||
'token_firebase' => $user->token_firebase, | |||
'jbkod' => $jabatan | |||
)); | |||
return $this->sendResponse($data, 'Berjaya log masuk'); | |||
}else { | |||
return $this->sendError('Gagal', 'Emel atau kata-laluan tidak tepat'); | |||
} | |||
}else { | |||
return $this->sendError('Gagal', 'Rekod tidak dijumpai'); | |||
} | |||
} | |||
public function requestStaffLogout(Request $request){ | |||
$loginUser = Staff::where('api_token', $request->api_token)->first(); | |||
if(!empty($loginUser)){ | |||
$loginUser->last_login_at = Carbon::now(new \DateTimeZone('Asia/Kuala_Lumpur'))->toDateTimeString(); | |||
$loginUser->last_login_ip = $request->getClientIp(); | |||
$loginUser->api_token = ''; | |||
$loginUser->authorized = false; | |||
$loginUser->save(); | |||
return $this->sendResponse('Berjaya', 'Berjaya log keluar'); | |||
}else { | |||
return $this->sendError('Gagal', 'Maaf, penguatkuasa tidak dapat log keluar'); | |||
} | |||
} | |||
public function checkDeviceToken(Request $request){ | |||
$loginUser = Staff::where('api_token', $request->api_token)->first(); | |||
if(!empty($loginUser)){ | |||
return $this->sendResponse($loginUser->api_token, 'Successfully get detail'); | |||
}else { | |||
return $this->sendError('Failed', 'User Not Found'); | |||
} | |||
} | |||
// public function resetPassword(Request $request) | |||
// { | |||
// $data = array(); | |||
// $staff = Staff::where('api_token', $request->api_token)->first(); | |||
// if(!empty($staff)) | |||
// { | |||
// $ic_num = StaffDetail::with('Staff')->where('identity', $request->ic_number)->first(); | |||
// $id = $ic_num->_id; | |||
// if(!empty($id)) | |||
// { | |||
// $staffID = Staff::where('_id', $id)->first(); | |||
// $staffID->password = $request->new_password; | |||
// } | |||
// else | |||
// { | |||
// return $this->sendError('Gagal', 'Identiti tidak dijumpai'); | |||
// } | |||
// } | |||
// else | |||
// { | |||
// return $this->sendError('Gagal', 'penguatkuasa tidak wujud'); | |||
// } | |||
// } | |||
public function testing(Request $request) | |||
{ | |||
$test = '02399'; //filter_var('000099', FILTER_SANITIZE_NUMBER_INT); | |||
(int)$test += 1; | |||
dd($test); | |||
} | |||
} |
@@ -366,7 +366,7 @@ class CompoundController extends Controller | |||
if(empty($compound)) | |||
{ | |||
$kpd = (int)$kpd; | |||
$compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); | |||
$compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->orWhere('non',$kpd)->first(); | |||
} | |||
$file = ConfidentialFile::with('History','History.SubHistory')->where('no_siri',$compound->ConfidentialFile->no_siri)->first(); | |||
$role = Roles::where('kod',$file->modul)->first(); |
@@ -71,6 +71,7 @@ class ExportReport extends Controller | |||
} | |||
} | |||
$filename = 'Statistik_Pengeluaran_kompaun_bulanan'; | |||
return Excel::download(new EnforcerStatisticExport($keping,$jumlah,$year), $filename.'.xlsx'); | |||
} |
@@ -1,17 +0,0 @@ | |||
<?php | |||
namespace App\Model\Database; | |||
use Illuminate\Notifications\Notifiable; | |||
use Yajra\Oci8\Eloquent\OracleEloquent as Eloquent; | |||
use App\Model\Database\Kelantanpay; | |||
class EPBT extends Eloquent | |||
{ | |||
// | |||
use Notifiable; | |||
protected $connection = 'oracle'; | |||
protected $table = 'KELANTANPAY'; | |||
} |
@@ -1,60 +1,64 @@ | |||
<?php | |||
namespace App\Model\Module; | |||
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; | |||
use Jenssegers\Mongodb\Eloquent\SoftDeletes; | |||
class Compound extends Eloquent | |||
{ | |||
// | |||
use SoftDeletes; | |||
protected $connection = 'mongodb'; | |||
protected $collection = 'compound'; | |||
protected $guarded = ['_id']; | |||
public function attachment(){ | |||
return $this->hasMany('App\Model\Module\Attachment'); | |||
} | |||
public function staff() | |||
{ | |||
return $this->belongsTo('App\Model\Staff','no_badan','dikeluarkan'); | |||
} | |||
public function staffdetail() | |||
{ | |||
return $this->belongsTo('App\Model\StaffDetail','dikeluarkan','_id'); | |||
} | |||
public function updateby(){ | |||
return $this->belongsTo('App\Model\StaffDetail','update_by','_id'); | |||
} | |||
public function confidentialfile() | |||
{ | |||
return $this->belongsTo('App\Model\Module\ConfidentialFile', 'confidential_file_id', '_id'); | |||
} | |||
public function compoundinvestigation(){ | |||
return $this->hasOne('App\Model\Module\CompoundInvestigation'); | |||
} | |||
public function letternotice(){ | |||
return $this->hasMany('App\Model\Module\LetterNotice'); | |||
} | |||
public function faulty(){ | |||
return $this->belongsTo('App\Model\Module\Faulty', 'seksyen_kesalahan', '_id'); | |||
} | |||
public function department(){ | |||
return $this->belongsTo('App\Model\Module\Department', 'jbkod', '_id'); | |||
} | |||
public function deedlaw(){ | |||
return $this->belongsTo('App\Model\Module\DeedLaw', 'akta', '_id'); | |||
} | |||
} | |||
<?php | |||
namespace App\Model\Module; | |||
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; | |||
use Jenssegers\Mongodb\Eloquent\SoftDeletes; | |||
class Compound extends Eloquent | |||
{ | |||
// | |||
use SoftDeletes; | |||
protected $connection = 'mongodb'; | |||
protected $collection = 'compound'; | |||
protected $guarded = ['_id']; | |||
public function notice(){ | |||
return $this->belongsTo('App\Model\Module\Notice', '_id', '_id'); | |||
} | |||
public function attachment(){ | |||
return $this->hasMany('App\Model\Module\Attachment'); | |||
} | |||
public function staff() | |||
{ | |||
return $this->belongsTo('App\Model\Staff','no_badan','dikeluarkan'); | |||
} | |||
public function staffdetail() | |||
{ | |||
return $this->belongsTo('App\Model\StaffDetail','dikeluarkan','_id'); | |||
} | |||
public function updateby(){ | |||
return $this->belongsTo('App\Model\StaffDetail','update_by','_id'); | |||
} | |||
public function confidentialfile() | |||
{ | |||
return $this->belongsTo('App\Model\Module\ConfidentialFile', 'confidential_file_id', '_id'); | |||
} | |||
public function compoundinvestigation(){ | |||
return $this->hasOne('App\Model\Module\CompoundInvestigation'); | |||
} | |||
public function letternotice(){ | |||
return $this->hasMany('App\Model\Module\LetterNotice'); | |||
} | |||
public function faulty(){ | |||
return $this->belongsTo('App\Model\Module\Faulty', 'seksyen_kesalahan', '_id'); | |||
} | |||
public function department(){ | |||
return $this->belongsTo('App\Model\Module\Department', 'jbkod', '_id'); | |||
} | |||
public function deedlaw(){ | |||
return $this->belongsTo('App\Model\Module\DeedLaw', 'akta', '_id'); | |||
} | |||
} |
@@ -0,0 +1,51 @@ | |||
<?php | |||
namespace App\Model\Module; | |||
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; | |||
use Jenssegers\Mongodb\Eloquent\SoftDeletes; | |||
class Notice extends Eloquent | |||
{ | |||
// | |||
use SoftDeletes; | |||
protected $connection = 'mongodb'; | |||
protected $collection = 'notice'; | |||
protected $guarded = ['_id']; | |||
public function compound(){ | |||
return $this->hasOne('App\Model\Module\Compound', '_id', '_id'); | |||
} | |||
public function attachment(){ | |||
return $this->hasMany('App\Model\Module\Attachment'); | |||
} | |||
public function staff() | |||
{ | |||
return $this->belongsTo('App\Model\Staff','no_badan','dikeluarkan'); | |||
} | |||
public function staffdetail() | |||
{ | |||
return $this->belongsTo('App\Model\StaffDetail','dikeluarkan','_id'); | |||
} | |||
public function updateby(){ | |||
return $this->belongsTo('App\Model\StaffDetail','update_by','_id'); | |||
} | |||
public function faulty(){ | |||
return $this->belongsTo('App\Model\Module\Faulty', 'seksyen_kesalahan', '_id'); | |||
} | |||
public function department(){ | |||
return $this->belongsTo('App\Model\Module\Department', 'jbkod', '_id'); | |||
} | |||
public function deedlaw(){ | |||
return $this->belongsTo('App\Model\Module\DeedLaw', 'akta', '_id'); | |||
} | |||
} |
@@ -182,43 +182,7 @@ | |||
</div> | |||
</div> | |||
</form> | |||
@if(!isset($compound->tarikh_mahkamah)){ | |||
<form method="POST" action="{{ url('/main/compound/update/court') }}" enctype="multipart/form-data"> | |||
<div class="row"> | |||
<div class="col-lg-12 col-md-12"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<h5>Serahan Kompaun Kepada Mahkamah</h5> | |||
</div> | |||
<div class="card-block"> | |||
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"> | |||
<input type="hidden" name="kpd" value="{{ $compound->kpd }}"> | |||
<input type="hidden" name="dashboard" value="true"> | |||
<div class="row"> | |||
<div class="col-lg-12 col-md-12"> | |||
<div class="form-group form-primary"> | |||
<label class="float-label"><b>Serahan Ke Mahkamah<code>('dashboard')</code></b></label> | |||
<div class="col-lg-3"> | |||
<input type="date" class=" form-control form-control-sm" name="start_date" id="start_date" required/> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<hr> | |||
<div class="md-group-add-on"></div> | |||
<div class="f-right"> | |||
<button type="submit" class="btn btn-sm btn-outline-danger waves-effect waves-light">Sahkan Tarikh</button> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</form> | |||
} | |||
@endif | |||
@if($compound->modul != '02' && $compound->modul != '03' && $compound->modul != '04') | |||
@if($compound->modul != '02' && $compound->modul != '04') | |||
<form method="POST" action="{{ url('/main/compound/update/action') }}"> | |||
<div class="row"> | |||
<div class="col-lg-12 col-md-12"> | |||
@@ -274,6 +238,40 @@ | |||
</div> | |||
</form> | |||
@endif | |||
@if(!isset($compound->tarikh_mahkamah)){ | |||
<form method="POST" action="{{ url('/main/compound/update/court') }}" enctype="multipart/form-data"> | |||
<div class="row"> | |||
<div class="col-lg-12 col-md-12"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<h5>Serahan Kompaun Kepada Mahkamah</h5> | |||
</div> | |||
<div class="card-block"> | |||
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"> | |||
<input type="hidden" name="kpd" value="{{ $compound->kpd }}"> | |||
<input type="hidden" name="dashboard" value="true"> | |||
<div class="row"> | |||
<div class="col-lg-12 col-md-12"> | |||
<div class="form-group form-primary"> | |||
<label class="float-label"><b>Serahan Ke Mahkamah<code>('dashboard')</code></b></label> | |||
<div class="col-lg-3"> | |||
<input type="date" class=" form-control form-control-sm" name="start_date" id="start_date" required/> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<hr> | |||
<div class="md-group-add-on"></div> | |||
<div class="f-right"> | |||
<button type="submit" class="btn btn-sm btn-outline-danger waves-effect waves-light">Sahkan Tarikh</button> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</form> | |||
} | |||
@endif | |||
</div> | |||
</div> | |||
</div> |
@@ -433,6 +433,7 @@ | |||
if($('#tahun').val() == 'null' || $('#jabatan').val() == 'null'){ | |||
alert('Sila pilih tahun dan jabatan'); | |||
}else { | |||
console.log("jabatan " + $('#jabatan').val()); | |||
table1.ajax.reload(); | |||
table2.ajax.reload(); | |||
} |