Explorar el Código

tarikh mahkamah

master
Siti Rahayu hace 4 años
padre
commit
012261b79b

+ 440
- 453
app/Http/Controllers/Main/TaskController.php Ver fichero

@@ -1,453 +1,440 @@
<?php
namespace App\Http\Controllers\Main;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use LynX39\LaraPdfMerger\Facades\PdfMerger;
use File;
use Carbon\Carbon;
use PDF;
use App\SiteSetting;
use App\Model\Staff;
use App\Model\StaffDetail;
use App\Model\User;
use App\Model\UserDetail;
use App\Model\Module\Roles;
use App\Model\Module\Department;
use App\Model\Module\DeedLaw;
use App\Model\Module\Faulty;
use App\Model\Module\Compound;
use App\Model\Module\CompoundInvestigation;
use App\Model\Module\ConfidentialFile;
use App\Model\Module\Investigation;
use App\Model\Module\ItemInventory;
use App\Model\Module\History;
use App\Model\Module\SubHistory;
use App\Model\Module\Memo;
use App\Model\Module\Attachment;
use App\Model\Module\CodeMukim;
use App\Jobs\UpdateCompoundPrice;
class TaskController extends Controller
{
/**
* Create Task list controller.
*
* @return json
*/
public function requestUpdateTask(Request $request){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first();
$file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
$jbkod = $compound->jbkod;
$now = Carbon::now();
$gDate = $now->format('F Y');
if($request->dashboard == "true"){
$roles = Roles::where('kod', $request->kategori_modul)->first();
if($compound->modul == $request->kategori_modul){
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Kompaun ini sudah berada di dalam kategori modul '.$roles->name);
}else{
// if($request->categori_modul == '03' && $compound->modul == '02')
// {
// $this->dispatch(new StoreCompoundEPBT($request->all(), $compound->kpd, $user->StaffDetail->full_name, $user->StaffDetail->no_badan, $compound->seksyen_kesalahan));
// }
$reg_id = array();
if(!empty($roles->staff_detail_ids)){
foreach($roles->staff_detail_ids as $s){
$staff = Staff::with(['StaffDetail' => function($q) use($jbkod){
$q->where('jbkod', $jbkod);
}])->where('_id', $s)->first();
if(!empty($staff->StaffDetail)){
if($staff->token_firebase != ''){
$reg_id[] = $staff->token_firebase;
}
}
}
}
if(count($reg_id) > 0) {
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', url('api/push/notification'), [
'verify' => false,
'form_params' => [
'title' => $roles->name.' '.$compound->kpd,
'msg' => 'Kompaun ini telah di pindahkan ke modul '.$roles->name,
'register_id' => $reg_id,
]
]);
}
$compound->modul = $request->kategori_modul;
$compound->save();
$historyData = [
'tarikh_kumpulan' => $gDate,
];
$subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'tajuk' => "Serahan Modul",
'huraian' => $compound->kpd. " / Fail Kulit (".$compound->ConfidentialFile->no_siri.") telah diserahkan ke modul ".$roles->name,
];
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
}else{
$history = History::create($historyData);
$history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
}
return redirect()->back()->with('success_msg', '<strong>Berjaya Kemaskini!</strong> Kompaun ini berjaya diserahkan ke kategori modul '.$roles->name);
}
}else if($request->dashboard == "false"){
if($compound->penguatkuasa == $request->penguatkuasa){
$staff = StaffDetail::where('_id',$request->penguatkuasa)->first();
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Kompaun ini sudah diserahkan kepada penguatkuasa ['.$staff->no_badan.'] '.$staff->full_name);
}else{
$staff = Staff::with('StaffDetail')->where('_id',$request->penguatkuasa)->where(function($q){
$q->where('roles_access','PenguatKuasa')->orWhere('roles_access','PPenguatKuasa');
})->first();
$role = Roles::where('kod', $compound->modul)->first();
if(!empty($staff)){
if($staff->token_firebase != '') {
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', url('api/push/notification'), [
'verify' => false,
'form_params' => [
'title' => $role->name.' '.$compound->kpd,
'msg' => 'Kompaun ini berada di ruangan '.$role->name,
'register_id[]' => $staff->token_firebase,
]
]);
}
$compound->penguatkuasa = $request->penguatkuasa;
$compound->save();
$historyData = [
'tarikh_kumpulan' => $gDate,
];
$subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'tajuk' => "Menugaskan Penguatkuasa ".$staff->StaffDetail->full_name,
'huraian' => $compound->kpd. " / Fail Kulit (".$compound->ConfidentialFile->no_siri.") telah ditugaskan kepada penguatkuasa <a href='".url('/main/staff')."/".$staff->_id."/profile'>".$staff->StaffDetail->full_name."</a>.",
];
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
}else{
$history = History::create($historyData);
$history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
}
return redirect()->back()->with('success_msg', '<strong>Berjaya Kemaskini!</strong> Kompaun ini berjaya ditugaskan kepada penguatkuasa ['.$staff->no_badan.'] '.$staff->StaffDetail->full_name);
}else{
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Data penguatkuasa tidak ditemui');
}
}
}
}
public function requestUpdateToCourt(Request $request)
{
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first();
$file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
$jbkod = $compound->jbkod;
$now = Carbon::now();
$gDate = $now->format('F Y');
if($request->dashboard == "true"){
if(!isset($compound->tarikh_mahkamah) )
{
$reg_id = array();
if(!empty($roles->staff_detail_ids)){
foreach($roles->staff_detail_ids as $s){
$staff = Staff::with(['StaffDetail' => function($q) use($jbkod){
$q->where('jbkod', $jbkod);
}])->where('_id', $s)->first();
if(!empty($staff->StaffDetail)){
if($staff->token_firebase != ''){
$reg_id[] = $staff->token_firebase;
}
}
}
}
$compound->tarikh_mahkamah = $request->start_date;
$compound->save();
$historyData = [
'tarikh_kumpulan' => $gDate,
];
$subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'tajuk' => "Serahan Tarikh Mahkamah",
'huraian' => $compound->kpd. " diserahkan ke mahkamah pada ".$request->start_date,
];
$groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
}else{
$history = History::create($historyData);
$history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
}
return redirect()->back()->with('success_msg', 'Berjaya kemaskini tarikh serahan ke mahkamah untuk kompaun ' . $compound->kpd);
}
else{
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Pindahan tarikh ke mahkamah telah dilakukan untuk kompaun ini!');
}
}
}
public function requestViewAllPdf($kpd) {
$ready_view_pdf = false;
$availablePDF = array();
$now = Carbon::now()->format('d/m/Y h:i:s A');
$site = SiteSetting::first();
$compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd', $kpd)->first();
if(empty($compound))
{
$kpd = (int)$kpd;
$compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd', $kpd)->first();
}
$file = ConfidentialFile::with(['Memo' => function($q){
$q->orderBy('updated_at','ASC');
}],['Investigation' => function($q){
$q->with(['Attachment' => function($w){
$w->first();
}])->orderBy('updated_at','ASC');
}],['ItemInventory' => function($w){
$w->with('Barcode');
}])->where('_id',$compound->ConfidentialFile->_id)->first();
/**
** Compound
**/
$tawaran = '';
if($compound->jumlah_kemaskini_kompaun == ''){
$tawaran = $compound->jumlah_asal_kompaun;
}else{
$tawaran = $compound->jumlah_kemaskini_kompaun;
}
$staff = Staff::with('StaffDetail')->where('_id', $compound->dikeluarkan)->first();
$faulty = Faulty::with('DeedLaw')->where('_id',$compound->seksyen_kesalahan)->first();
$department = Department::where('_id', $compound->jbkod)->first();
$upload [] = [ 'name' => 'compound', 'contents' => $compound ];
$upload [] = [ 'name' => 'faulty', 'contents' => $faulty ];
$upload [] = [ 'name' => 'staff', 'contents' => $staff ];
$upload [] = [ 'name' => 'department', 'contents' => $department ];
$upload [] = [ 'name' => 'tawaran', 'contents' => $tawaran ];
$upload [] = [ 'name' => 'site', 'contents' => $site ];
$upload [] = [ 'name' => 'type', 'contents' => 'mbip' ];
$upload [] = [ 'name' => 'file', 'contents' => $file ];
$upload [] = [ 'name' => 'now', 'contents' => $now ];
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', 'https://files.sipadu.my/api/compound/pdf', [
'multipart' => $upload
]);
$response = json_decode($result->getBody()->getContents());
if($response->success == true){
$compound->pdf_path = $response->data;
$compound->save();
}
/**
** Investigation
**/
$upload [] = [ 'name' => 'file', 'contents' => $file ]; $temp = [];
if(!empty($file->Investigation)){
foreach($file->Investigation as $i => $in){
$attach = Investigation::with('Attachment')->where('_id',$in->_id)->first();
foreach ($attach->Attachment as $key => $p) {
$temp[] = $p->path;
}
}
$upload [] = [ 'name' => 'fileInvest', 'contents' => json_encode($temp)];
}
/**
** All Memo in file
**/
if(!empty($file->Memo)){
$memoData = array();
foreach($file->Memo as $i => $m){
$memo = Memo::with('Attachment')->where('_id',$m->_id)->first();
$staffD = Staff::with('StaffDetail')->where('_id',$memo->dikeluarkan)->first();
$staffS = Staff::with('StaffDetail')->where('_id',$memo->disahkan)->first();
$kesalahan = Faulty::where('itkod', $memo->itkod)->first();
$dikeluarkan = ''; $disahkan = ''; $faulty = ''; $modul = '';
if(!empty($staffD)){
$dikeluarkan = $staffD->StaffDetail->full_name;
}
if(!empty($staffS)){
$disahkan = $staffD->StaffDetail->full_name;
}
if(!empty($kesalahan)){
$faulty ='['.$kesalahan->skter.'] '.$kesalahan->nama;
}
if($memo->modul != '-'){
$r = Roles::where('kod',$memo->modul)->first();
if(!empty($r)){
$modul = $r->name;
}
}
$update = Carbon::parse($memo->updated)->toDateTimeString();
$mula = date('d/m/Y h:i a', strtotime($memo->tarikh_mula));
$akhir = date('d/m/Y', strtotime($memo->tarikh_akhir));
if($memo->jenis_data == "manual"){
$dataM = [
'memo' => $memo,
'dikeluarkan' => $dikeluarkan,
'disahkan' => $disahkan,
'update' => $update,
'mula' => $mula,
'akhir' => $akhir,
'faulty' => $faulty,
'modul' => $modul,
'attachment' => [],
];
$memoData[] = $dataM;
}else if($memo->jenis_data == "pdf"){
foreach($m->Attachment as $key => $a){
$pdf[] = $a->path;
}
$dataM = [
'memo' => $memo,
'dikeluarkan' => $dikeluarkan,
'disahkan' => $disahkan,
'update' => $update,
'mula' => $mula,
'akhir' => $akhir,
'faulty' => $faulty,
'modul' => $modul,
'attachment' => $pdf,
];
$memoData[] = $dataM;
}
}
$upload [] = [ 'name' => 'memo', 'contents' => json_encode($memoData)];
}
/**
** Inventory
**/
if(count($file->ItemInventory) > 0){
$dataItem = array();
foreach ($file->ItemInventory as $key => $b) {
$barcode = '';
foreach ($b->Barcode as $key => $br) {
$barcode .= ', '.$br->barcode_id;
$data = [
'item' => $b,
'barcode' => $barcode,
];
}
$dataItem[] = $data;
}
$upload [] = [ 'name' => 'inventori', 'contents' => json_encode($dataItem)];
}
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', 'https://files.sipadu.my/api/store/compound/pdf', [
'multipart' => $upload
]);
$response = json_decode($result->getBody()->getContents());
if($response->success == true){
return redirect($response->data);
}else if($response->success == false){
return response()->json($response->message);
}
}
public function insertdata()
{
$roads = CodeMukim::all()->toArray();
$response = json_decode(file_get_contents(public_path(). '/mukim_kawasan_jalan_mbip.json'));
$temp = [];
if($response->success == true){
foreach ($response->data as $key => $r)
{
// search value in db COde Mukim, if none, add to array
if(!in_array($r->_id, array_column($roads, '_id')))
{
$com = new CodeMukim();
$com->_id = new \MongoDB\BSON\ObjectID($r->_id);
$com->JLN_MKKOD = $r->JLN_MKKOD;
$com->MKM_MNAMA = $r->MKM_MNAMA;
$com->JLN_KWKOD = $r->JLN_KWKOD;
$com->KWS_KNAMA = $r->KWS_KNAMA;
$com->JLN_JNAMA = $r->JLN_JNAMA;
$com->save();
if(!$com)
{
$temp[] = $r;
}
}
}
return 'data not inserted : ' . json_encode($temp);
}
}
}
<?php

namespace App\Http\Controllers\Main;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use LynX39\LaraPdfMerger\Facades\PdfMerger;

use File;
use Carbon\Carbon;
use PDF;

use App\SiteSetting;
use App\Model\Staff;
use App\Model\StaffDetail;
use App\Model\User;
use App\Model\UserDetail;
use App\Model\Module\Roles;
use App\Model\Module\Department;
use App\Model\Module\DeedLaw;
use App\Model\Module\Faulty;
use App\Model\Module\Compound;
use App\Model\Module\CompoundInvestigation;
use App\Model\Module\ConfidentialFile;
use App\Model\Module\Investigation;
use App\Model\Module\ItemInventory;
use App\Model\Module\History;
use App\Model\Module\SubHistory;
use App\Model\Module\Memo;
use App\Model\Module\Attachment;
use App\Model\Module\CodeMukim;

use App\Jobs\StoreCompoundEPBT;
use App\Jobs\UpdateCompoundPrice;

class TaskController extends Controller
{
/**
* Create Task list controller.
*
* @return json
*/
public function requestUpdateTask(Request $request){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);

$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first();
$file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
$jbkod = $compound->jbkod;

$now = Carbon::now();
$gDate = $now->format('F Y');

if($request->dashboard == "true"){
$roles = Roles::where('kod', $request->kategori_modul)->first();
if($compound->modul == $request->kategori_modul){
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Kompaun ini sudah berada di dalam kategori modul '.$roles->name);
}else{

if($request->categori_modul == '03' && $compound->modul == '02')
{
$this->dispatch(new StoreCompoundEPBT($request->all(), $compound->kpd, $user->StaffDetail->full_name, $user->StaffDetail->no_badan, $compound->seksyen_kesalahan));
}

$reg_id = array();
if(!empty($roles->staff_detail_ids)){
foreach($roles->staff_detail_ids as $s){
$staff = Staff::with(['StaffDetail' => function($q) use($jbkod){
$q->where('jbkod', $jbkod);
}])->where('_id', $s)->first();
if(!empty($staff->StaffDetail)){
if($staff->token_firebase != ''){
$reg_id[] = $staff->token_firebase;
}
}
}
}

if(count($reg_id) > 0) {
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', url('api/push/notification'), [
'verify' => false,
'form_params' => [
'title' => $roles->name.' '.$compound->kpd,
'msg' => 'Kompaun ini telah di pindahkan ke modul '.$roles->name,
'register_id' => $reg_id,
]
]);
}

$compound->modul = $request->kategori_modul;
$compound->save();

$historyData = [
'tarikh_kumpulan' => $gDate,
];
$subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'tajuk' => "Serahan Modul",
'huraian' => $compound->kpd. " / Fail Kulit (".$compound->ConfidentialFile->no_siri.") telah diserahkan ke modul ".$roles->name,
];

$groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
}else{
$history = History::create($historyData);
$history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
}

return redirect()->back()->with('success_msg', '<strong>Berjaya Kemaskini!</strong> Kompaun ini berjaya diserahkan ke kategori modul '.$roles->name);
}
}else if($request->dashboard == "false"){
if($compound->penguatkuasa == $request->penguatkuasa){
$staff = StaffDetail::where('_id',$request->penguatkuasa)->first();
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Kompaun ini sudah diserahkan kepada penguatkuasa ['.$staff->no_badan.'] '.$staff->full_name);
}else{

$staff = Staff::with('StaffDetail')->where('_id',$request->penguatkuasa)->where(function($q){
$q->where('roles_access','PenguatKuasa')->orWhere('roles_access','PPenguatKuasa');
})->first();
$role = Roles::where('kod', $compound->modul)->first();

if(!empty($staff)){
if($staff->token_firebase != '') {
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', url('api/push/notification'), [
'verify' => false,
'form_params' => [
'title' => $role->name.' '.$compound->kpd,
'msg' => 'Kompaun ini berada di ruangan '.$role->name,
'register_id[]' => $staff->token_firebase,
]
]);
}


$compound->penguatkuasa = $request->penguatkuasa;
$compound->save();

$historyData = [
'tarikh_kumpulan' => $gDate,
];
$subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'tajuk' => "Menugaskan Penguatkuasa ".$staff->StaffDetail->full_name,
'huraian' => $compound->kpd. " / Fail Kulit (".$compound->ConfidentialFile->no_siri.") telah ditugaskan kepada penguatkuasa <a href='".url('/main/staff')."/".$staff->_id."/profile'>".$staff->StaffDetail->full_name."</a>.",
];

$groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
}else{
$history = History::create($historyData);
$history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
}

return redirect()->back()->with('success_msg', '<strong>Berjaya Kemaskini!</strong> Kompaun ini berjaya ditugaskan kepada penguatkuasa ['.$staff->no_badan.'] '.$staff->StaffDetail->full_name);
}else{
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Data penguatkuasa tidak ditemui');
}
}
}
}

public function requestUpdateToCourt(Request $request)
{
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);

$compound = Compound::with('ConfidentialFile')->where('kpd',$request->kpd)->first();
$file = ConfidentialFile::where('no_siri',$compound->ConfidentialFile->no_siri)->first();
$jbkod = $compound->jbkod;

$now = Carbon::now();
$gDate = $now->format('F Y');

if($request->dashboard == "true"){

if(!isset($compound->tarikh_mahkamah) )
{
$compound->tarikh_mahkamah = $request->start_date;
$compound->save();

$historyData = [
'tarikh_kumpulan' => $gDate,
];
$subHistory = [
'no_siri' => $compound->ConfidentialFile->no_siri,
'tajuk' => "Serahan Tarikh Mahkamah",
'huraian' => $compound->kpd. " diserahkan ke mahkamah pada ".$request->start_date,
];

$groupByDate = History::where('tarikh_kumpulan', $gDate)->first();
if(!empty($groupByDate)){
$groupByDate->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($groupByDate);
}else{
$history = History::create($historyData);
$history->subhistory()->create($subHistory);
$compound->ConfidentialFile->history()->attach($history);
}

return redirect()->back()->with('success_msg', 'Berjaya kemaskini tarikh serahan ke mahkamah untuk kompaun ' . $compound->kpd);
}
else{
return redirect()->back()->withInput()->with('error_msg','<strong>Tidak Berjaya!</strong> Pindahan tarikh ke mahkamah telah dilakukan untuk kompaun ini!');
}
}
}

public function requestViewAllPdf($kpd) {

$ready_view_pdf = false;
$availablePDF = array();
$now = Carbon::now()->format('d/m/Y h:i:s A');

$site = SiteSetting::first();
$compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd', $kpd)->first();
if(empty($compound))
{
$kpd = (int)$kpd;
$compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd', $kpd)->first();
}
$file = ConfidentialFile::with(['Memo' => function($q){
$q->orderBy('updated_at','ASC');
}],['Investigation' => function($q){
$q->with(['Attachment' => function($w){
$w->first();
}])->orderBy('updated_at','ASC');
}],['ItemInventory' => function($w){
$w->with('Barcode');
}])->where('_id',$compound->ConfidentialFile->_id)->first();

/**
** Compound
**/
$tawaran = '';
if($compound->jumlah_kemaskini_kompaun == ''){
$tawaran = $compound->jumlah_asal_kompaun;
}else{
$tawaran = $compound->jumlah_kemaskini_kompaun;
}

$staff = Staff::with('StaffDetail')->where('_id', $compound->dikeluarkan)->first();
$faulty = Faulty::with('DeedLaw')->where('_id',$compound->seksyen_kesalahan)->first();
$department = Department::where('_id', $compound->jbkod)->first();

$upload [] = [ 'name' => 'compound', 'contents' => $compound ];
$upload [] = [ 'name' => 'faulty', 'contents' => $faulty ];
$upload [] = [ 'name' => 'staff', 'contents' => $staff ];
$upload [] = [ 'name' => 'department', 'contents' => $department ];
$upload [] = [ 'name' => 'tawaran', 'contents' => $tawaran ];
$upload [] = [ 'name' => 'site', 'contents' => $site ];
$upload [] = [ 'name' => 'type', 'contents' => 'mbip' ];
$upload [] = [ 'name' => 'file', 'contents' => $file ];
$upload [] = [ 'name' => 'now', 'contents' => $now ];


$client = new \GuzzleHttp\Client();
$result = $client->request('POST', 'https://files.sipadu.my/api/compound/pdf', [
'multipart' => $upload
]);

$response = json_decode($result->getBody()->getContents());
if($response->success == true){
$compound->pdf_path = $response->data;
$compound->save();
}

/**
** Investigation
**/
$upload [] = [ 'name' => 'file', 'contents' => $file ]; $temp = [];
if(!empty($file->Investigation)){
foreach($file->Investigation as $i => $in){
$attach = Investigation::with('Attachment')->where('_id',$in->_id)->first();
foreach ($attach->Attachment as $key => $p) {
$temp[] = $p->path;
}
}
$upload [] = [ 'name' => 'fileInvest', 'contents' => json_encode($temp)];
}

/**
** All Memo in file
**/
if(!empty($file->Memo)){

$memoData = array();

foreach($file->Memo as $i => $m){
$memo = Memo::with('Attachment')->where('_id',$m->_id)->first();

$staffD = Staff::with('StaffDetail')->where('_id',$memo->dikeluarkan)->first();
$staffS = Staff::with('StaffDetail')->where('_id',$memo->disahkan)->first();
$kesalahan = Faulty::where('itkod', $memo->itkod)->first();

$dikeluarkan = ''; $disahkan = ''; $faulty = ''; $modul = '';
if(!empty($staffD)){
$dikeluarkan = $staffD->StaffDetail->full_name;
}

if(!empty($staffS)){
$disahkan = $staffD->StaffDetail->full_name;
}

if(!empty($kesalahan)){
$faulty ='['.$kesalahan->skter.'] '.$kesalahan->nama;
}

if($memo->modul != '-'){
$r = Roles::where('kod',$memo->modul)->first();
if(!empty($r)){
$modul = $r->name;
}
}

$update = Carbon::parse($memo->updated)->toDateTimeString();
$mula = date('d/m/Y h:i a', strtotime($memo->tarikh_mula));
$akhir = date('d/m/Y', strtotime($memo->tarikh_akhir));

if($memo->jenis_data == "manual"){
$dataM = [
'memo' => $memo,
'dikeluarkan' => $dikeluarkan,
'disahkan' => $disahkan,
'update' => $update,
'mula' => $mula,
'akhir' => $akhir,
'faulty' => $faulty,
'modul' => $modul,
'attachment' => [],
];

$memoData[] = $dataM;
}else if($memo->jenis_data == "pdf"){
foreach($m->Attachment as $key => $a){
$pdf[] = $a->path;
}

$dataM = [
'memo' => $memo,
'dikeluarkan' => $dikeluarkan,
'disahkan' => $disahkan,
'update' => $update,
'mula' => $mula,
'akhir' => $akhir,
'faulty' => $faulty,
'modul' => $modul,
'attachment' => $pdf,
];

$memoData[] = $dataM;
}
}

$upload [] = [ 'name' => 'memo', 'contents' => json_encode($memoData)];
}

/**
** Inventory
**/
if(count($file->ItemInventory) > 0){

$dataItem = array();

foreach ($file->ItemInventory as $key => $b) {
$barcode = '';
foreach ($b->Barcode as $key => $br) {
$barcode .= ', '.$br->barcode_id;

$data = [
'item' => $b,
'barcode' => $barcode,
];
}

$dataItem[] = $data;
}

$upload [] = [ 'name' => 'inventori', 'contents' => json_encode($dataItem)];
}

$client = new \GuzzleHttp\Client();
$result = $client->request('POST', 'https://files.sipadu.my/api/store/compound/pdf', [
'multipart' => $upload
]);

$response = json_decode($result->getBody()->getContents());
if($response->success == true){
return redirect($response->data);
}else if($response->success == false){
return response()->json($response->message);
}
}


public function insertdata()
{

$roads = CodeMukim::all()->toArray();

$response = json_decode(file_get_contents(public_path(). '/mukim_kawasan_jalan_mbip.json'));
$temp = [];
if($response->success == true){

foreach ($response->data as $key => $r)
{
// search value in db COde Mukim, if none, add to array
if(!in_array($r->_id, array_column($roads, '_id')))
{

$com = new CodeMukim();
$com->_id = new \MongoDB\BSON\ObjectID($r->_id);
$com->JLN_MKKOD = $r->JLN_MKKOD;
$com->MKM_MNAMA = $r->MKM_MNAMA;
$com->JLN_KWKOD = $r->JLN_KWKOD;
$com->KWS_KNAMA = $r->KWS_KNAMA;
$com->JLN_JNAMA = $r->JLN_JNAMA;
$com->save();

if(!$com)
{
$temp[] = $r;
}
}

}

return 'data not inserted : ' . json_encode($temp);

}
}
}

+ 329
- 329
resources/views/main-dashboard/compound_detail/compound_job.blade.php Ver fichero

@@ -1,329 +1,329 @@
@extends('layout.master', ['uid' => $user->_id, 'token' => $user->token_firebase])
@section('page_title', 'Kompaun')
@section('sub_page_title', '')
@section('name', $user->StaffDetail->full_name)
@section('img_profile', $user->StaffDetail->profile_img)
@section('content')
<style type="text/css">
select.form-control, select.form-control:focus, select.form-control:hover {
border: 1px solid #ccc !important;
height: auto !important;
}
.panel-group .panel {
margin-bottom: 0;
overflow: hidden;
border-radius: 4px;
}
.panel-default {
border-color: #ddd;
}
.panel-default>.panel-heading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit;
}
.panel-body .table>thead>tr>th, .panel-body .table>tbody>tr>th, .panel-body .table>tfoot>tr>th, .panel-body .table>thead>tr>td, .panel-body .table>tbody>tr>td, .panel-body .table>tfoot>tr>td , .panel-body div{
padding: 8px 15px;
line-height: 1.428571429;
vertical-align: top;
border-top: 1px solid #ddd;
}
.panel-body { padding:0px; }
.panel-body table tr td { padding-left: 15px }
.panel-body table tr td a:hover , .panel-body div a:hover{ color: #d84315 !important; }
.panel-body .table, .panel-body div {margin-bottom: 0px; }
.glyphicon { margin-right:10px; }
.active { color: #d84315; }
.active:hover { color: #d84315; }
#custom table {
table-layout:fixed !important;
border-collapse: collapse !important;
width: 100%;
word-wrap:break-word !important;
}
#custom td, #custom th {
border-top: 1px solid #dee2e6;
border-bottom: 1px solid #dee2e6;
}
.longtext{
word-wrap: break-word !important;
word-break: break-word !important;
padding: 0.6rem 2rem;
}
</style>
<div class="inner-page">
<div class="row">
<div class="col-md-12">
<div class="fluid">
@if(count($errors) > 0)
<div class="alert alert-danger icons-alert">
@foreach($errors->all() as $error)
<p>{{$error}}</p>
@endforeach
</div>
@endif
@if(Session::get('error_msg'))
<div class="alert alert-danger icons-alert">
{!! Session::get('error_msg') !!}
</div>
@elseif(Session::get('success_msg'))
<div class="alert alert-success icons-alert">
{!! Session::get('success_msg') !!}
</div>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-xl-2 col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"> Maklumat Terperinci </h4>
</div>
<div class="panel-body">
@if($compound->status == 'Belum Bayar')
<div><a href="{{ url('main/compound') }}/{{ $compound->kpd }}/index" class="{{ Request::is('main/compound/*/index') ? 'active' : '' }}">Garis Masa/Sejarah</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}">Kompaun</a></div>
@if($compound->modul == '04')
<!-- <div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/investigation" class="{{ Request::is('main/compound/*/investigation') ? 'active' : '' }}">Pengesahan Kompaun</a></div> -->
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@elseif($compound->modul == '05')
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/notice" class="{{ Request::is('main/compound/*/notice') ? 'active' : '' }}">Notis Amaran</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@elseif($compound->modul == '06')
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/inventory" class="{{ Request::is('main/compound/*/inventory') ? 'active' : '' }}">Inventori</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@elseif($compound->modul == '07')
<div><a href="{{ url('main/compound') }}/{{$compound->kpd}}/inventory/auction" class="{{ Request::is('main/compound/*/inventory/auction') ? 'active' : '' }}">Jualan Lelong</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@endif
<div><a target="_blank" href="{{ url('/main/compound') }}/{{$compound->kpd}}/pdf">Cetak/Papar PDF</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/task" class="{{ Request::is('main/compound/*/task') ? 'active' : '' }}">Serahan Modul/PenguatKuasa</a></div>
@elseif($compound->status == 'Berbayar')
<div><a href="{{ url('main/compound') }}/{{ $compound->kpd }}/index" class="{{ Request::is('main/compound/*/index') ? 'active' : '' }}">Garis Masa/Sejarah</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}" class="{{ Request::is('main/compound/*') ? 'active' : '' }}">Kompaun</a></div>
<div><a target="_blank" href="{{ url('/main/compound') }}/{{$compound->kpd}}/pdf">Cetak/Papar PDF</a></div>
@endif
</div>
</div>
</div>
<div class="col-xl-10 col-md-12">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
@if(empty($role))
<h5 class="card-header-text">
Serahan Modul / Tugasan [ No.Kompaun : <code>{{ $compound->kpd }}</code> | No.Siri : <code>{{ $file->no_siri }}</code> | Modul: <code>-</code>]
</h5>
@else
<h5 class="card-header-text">
Serahan Modul / Tugasan [ No.Kompaun : <code>{{ $compound->kpd }}</code> | No.Siri : <code>{{ $file->no_siri }}</code> | Modul: <code>{{ $role->name }}</code>]
</h5>
@endif
<span><code>Perhatian!!</code> Untuk langkah seterusnya, sila tetapkan <code>kategori modul</code> untuk 'dashboard' dan memilih penguatkuasa di <code>kategori penguatkuasa</code> untuk memberi tugasan melalui 'mobile apps'</span>
</div>
</div>
</div>
</div>
<form method="POST" action="{{ url('/main/compound/update/action') }}" 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 Pegawai</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>Kategori Modul <code>('dashboard')</code></b></label>
<select id="kategori_modul" name="kategori_modul" class="form-control" required>
<option value="">Pilih Kategori Modul</option>
@foreach($roles as $r)
@if($r->kod != $compound->modul)
<option value="{{ $r->kod }}">{{ $r->name }}</option>
@endif
@endforeach
</select>
<span class="form-bar"></span>
<code>Sila pilih modul untuk meneruskan tugasan seterusnya!</code>
</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">Serahan Tugas Kepada Pegawai</button>
</div>
</div>
</div>
</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 Pegawai</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')
<form method="POST" action="{{ url('/main/compound/update/action') }}">
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="card">
<div class="card-header">
<h5>Serahan Kompaun kepada Penguatkuasa</h5>
@if($currentS == '')
<span>Kompaun ini <code>belum ditugasan</code> kepada penguatkuasa</span>
@else
<span>Kompaun ini <code>dibawah</code> tugasan penguatkuasa <code>{{ $currentS }}</code></span>
@endif
</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="false">
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="form-group form-primary">
<label class="float-label"><b>Jabatan <code>*</code></b></label>
<select id="department" name="department" class="form-control" required>
<option value="">Pilih Jabatan</option>
@foreach($department as $d)
<option value="{{ $d->_id }}">[{{ $d->jbkod }}] {{ $d->jnama }}</option>
@endforeach
</select>
<span class="form-bar"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="form-group form-primary">
<label class="float-label"><b>Kategori PenguatKuasa <code>('mobile apps')</code></b></label>
<select id="penguatkuasa" name="penguatkuasa" class="form-control" required>
<option value="">Pilih PenguatKuasa</option>
</select>
<span class="form-bar"></span>
<code>Sila pilih penguatkuasa untuk meneruskan tugasan seterusnya!</code>
</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">Serahan Tugas Kepada Penguatkuasa</button>
</div>
</div>
</div>
</div>
</div>
</form>
@endif
</div>
</div>
</div>
@endsection
@section('external_js')
<script type="text/javascript">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$(document).ready(function() {
var origin = window.location.origin;
$(".theme-loader").animate({
opacity: "0"
},1000);
setTimeout(function() {
$(".theme-loader").remove();
}, 800);
$('[data-toggle="tooltip"]').tooltip();
$('#department').change(function(){
if( $(this).val()==""){
$('#penguatkuasa').empty();
$('#penguatkuasa').append('<option value="">Pilih PenguatKuasa</option>');
}
else {
$('#penguatkuasa').empty();
$('#penguatkuasa').append('<option value="">Pilih PenguatKuasa</option>');
$.ajax({
type: "GET",
url: "{{ url('api/officer') }}"+"/"+$(this).val()+"/staff/list/{{ $user->roles_access }}",
success: function(result){
if(result.data.length > 0){
$.each(result.data, function(i, d) {
$('#penguatkuasa').append('<option value="' + d.tindakan + '">['+ d.no_badan +'] '+ d.nama + '</option>');
});
}else{
$('#penguatkuasa').append('<option value="">Tiada penguatkuasa dibawah jabatan ini</option>');
}
}
});
}
});
});
</script>
@endsection
@extends('layout.master', ['uid' => $user->_id, 'token' => $user->token_firebase])
@section('page_title', 'Kompaun')
@section('sub_page_title', '')
@section('name', $user->StaffDetail->full_name)
@section('img_profile', $user->StaffDetail->profile_img)
@section('content')
<style type="text/css">
select.form-control, select.form-control:focus, select.form-control:hover {
border: 1px solid #ccc !important;
height: auto !important;
}
.panel-group .panel {
margin-bottom: 0;
overflow: hidden;
border-radius: 4px;
}
.panel-default {
border-color: #ddd;
}
.panel-default>.panel-heading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit;
}
.panel-body .table>thead>tr>th, .panel-body .table>tbody>tr>th, .panel-body .table>tfoot>tr>th, .panel-body .table>thead>tr>td, .panel-body .table>tbody>tr>td, .panel-body .table>tfoot>tr>td , .panel-body div{
padding: 8px 15px;
line-height: 1.428571429;
vertical-align: top;
border-top: 1px solid #ddd;
}
.panel-body { padding:0px; }
.panel-body table tr td { padding-left: 15px }
.panel-body table tr td a:hover , .panel-body div a:hover{ color: #d84315 !important; }
.panel-body .table, .panel-body div {margin-bottom: 0px; }
.glyphicon { margin-right:10px; }
.active { color: #d84315; }
.active:hover { color: #d84315; }
#custom table {
table-layout:fixed !important;
border-collapse: collapse !important;
width: 100%;
word-wrap:break-word !important;
}
#custom td, #custom th {
border-top: 1px solid #dee2e6;
border-bottom: 1px solid #dee2e6;
}
.longtext{
word-wrap: break-word !important;
word-break: break-word !important;
padding: 0.6rem 2rem;
}
</style>
<div class="inner-page">
<div class="row">
<div class="col-md-12">
<div class="fluid">
@if(count($errors) > 0)
<div class="alert alert-danger icons-alert">
@foreach($errors->all() as $error)
<p>{{$error}}</p>
@endforeach
</div>
@endif
@if(Session::get('error_msg'))
<div class="alert alert-danger icons-alert">
{!! Session::get('error_msg') !!}
</div>
@elseif(Session::get('success_msg'))
<div class="alert alert-success icons-alert">
{!! Session::get('success_msg') !!}
</div>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-xl-2 col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"> Maklumat Terperinci </h4>
</div>
<div class="panel-body">
@if($compound->status == 'Belum Bayar')
<div><a href="{{ url('main/compound') }}/{{ $compound->kpd }}/index" class="{{ Request::is('main/compound/*/index') ? 'active' : '' }}">Garis Masa/Sejarah</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}">Kompaun</a></div>
@if($compound->modul == '04')
<!-- <div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/investigation" class="{{ Request::is('main/compound/*/investigation') ? 'active' : '' }}">Pengesahan Kompaun</a></div> -->
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@elseif($compound->modul == '05')
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/notice" class="{{ Request::is('main/compound/*/notice') ? 'active' : '' }}">Notis Amaran</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@elseif($compound->modul == '06')
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/inventory" class="{{ Request::is('main/compound/*/inventory') ? 'active' : '' }}">Inventori</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@elseif($compound->modul == '07')
<div><a href="{{ url('main/compound') }}/{{$compound->kpd}}/inventory/auction" class="{{ Request::is('main/compound/*/inventory/auction') ? 'active' : '' }}">Jualan Lelong</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/memo" class="{{ Request::is('main/compound/*/memo') ? 'active' : '' }}">Memo/Nota</a></div>
@endif
<div><a target="_blank" href="{{ url('/main/compound') }}/{{$compound->kpd}}/pdf">Cetak/Papar PDF</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}/task" class="{{ Request::is('main/compound/*/task') ? 'active' : '' }}">Serahan Modul/PenguatKuasa</a></div>
@elseif($compound->status == 'Berbayar')
<div><a href="{{ url('main/compound') }}/{{ $compound->kpd }}/index" class="{{ Request::is('main/compound/*/index') ? 'active' : '' }}">Garis Masa/Sejarah</a></div>
<div><a href="{{ url('/main/compound') }}/{{$compound->kpd}}" class="{{ Request::is('main/compound/*') ? 'active' : '' }}">Kompaun</a></div>
<div><a target="_blank" href="{{ url('/main/compound') }}/{{$compound->kpd}}/pdf">Cetak/Papar PDF</a></div>
@endif
</div>
</div>
</div>
<div class="col-xl-10 col-md-12">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
@if(empty($role))
<h5 class="card-header-text">
Serahan Modul / Tugasan [ No.Kompaun : <code>{{ $compound->kpd }}</code> | No.Siri : <code>{{ $file->no_siri }}</code> | Modul: <code>-</code>]
</h5>
@else
<h5 class="card-header-text">
Serahan Modul / Tugasan [ No.Kompaun : <code>{{ $compound->kpd }}</code> | No.Siri : <code>{{ $file->no_siri }}</code> | Modul: <code>{{ $role->name }}</code>]
</h5>
@endif
<span><code>Perhatian!!</code> Untuk langkah seterusnya, sila tetapkan <code>kategori modul</code> untuk 'dashboard' dan memilih penguatkuasa di <code>kategori penguatkuasa</code> untuk memberi tugasan melalui 'mobile apps'</span>
</div>
</div>
</div>
</div>
<form method="POST" action="{{ url('/main/compound/update/action') }}" 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 Pegawai</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>Kategori Modul <code>('dashboard')</code></b></label>
<select id="kategori_modul" name="kategori_modul" class="form-control" required>
<option value="">Pilih Kategori Modul</option>
@foreach($roles as $r)
@if($r->kod != $compound->modul)
<option value="{{ $r->kod }}">{{ $r->name }}</option>
@endif
@endforeach
</select>
<span class="form-bar"></span>
<code>Sila pilih modul untuk meneruskan tugasan seterusnya!</code>
</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">Serahan Tugas Kepada Pegawai</button>
</div>
</div>
</div>
</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')
<form method="POST" action="{{ url('/main/compound/update/action') }}">
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="card">
<div class="card-header">
<h5>Serahan Kompaun kepada Penguatkuasa</h5>
@if($currentS == '')
<span>Kompaun ini <code>belum ditugasan</code> kepada penguatkuasa</span>
@else
<span>Kompaun ini <code>dibawah</code> tugasan penguatkuasa <code>{{ $currentS }}</code></span>
@endif
</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="false">
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="form-group form-primary">
<label class="float-label"><b>Jabatan <code>*</code></b></label>
<select id="department" name="department" class="form-control" required>
<option value="">Pilih Jabatan</option>
@foreach($department as $d)
<option value="{{ $d->_id }}">[{{ $d->jbkod }}] {{ $d->jnama }}</option>
@endforeach
</select>
<span class="form-bar"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="form-group form-primary">
<label class="float-label"><b>Kategori PenguatKuasa <code>('mobile apps')</code></b></label>
<select id="penguatkuasa" name="penguatkuasa" class="form-control" required>
<option value="">Pilih PenguatKuasa</option>
</select>
<span class="form-bar"></span>
<code>Sila pilih penguatkuasa untuk meneruskan tugasan seterusnya!</code>
</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">Serahan Tugas Kepada Penguatkuasa</button>
</div>
</div>
</div>
</div>
</div>
</form>
@endif
</div>
</div>
</div>
@endsection
@section('external_js')
<script type="text/javascript">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$(document).ready(function() {
var origin = window.location.origin;
$(".theme-loader").animate({
opacity: "0"
},1000);
setTimeout(function() {
$(".theme-loader").remove();
}, 800);
$('[data-toggle="tooltip"]').tooltip();
$('#department').change(function(){
if( $(this).val()==""){
$('#penguatkuasa').empty();
$('#penguatkuasa').append('<option value="">Pilih PenguatKuasa</option>');
}
else {
$('#penguatkuasa').empty();
$('#penguatkuasa').append('<option value="">Pilih PenguatKuasa</option>');
$.ajax({
type: "GET",
url: "{{ url('api/officer') }}"+"/"+$(this).val()+"/staff/list/{{ $user->roles_access }}",
success: function(result){
if(result.data.length > 0){
$.each(result.data, function(i, d) {
$('#penguatkuasa').append('<option value="' + d.tindakan + '">['+ d.no_badan +'] '+ d.nama + '</option>');
});
}else{
$('#penguatkuasa').append('<option value="">Tiada penguatkuasa dibawah jabatan ini</option>');
}
}
});
}
});
});
</script>
@endsection

Cargando…
Cancelar
Guardar