Skip to content

Commit

Permalink
approval dokumen kelengkapan
Browse files Browse the repository at this point in the history
  • Loading branch information
wijaya committed Apr 12, 2017
1 parent a012a47 commit 2c62bda
Show file tree
Hide file tree
Showing 23 changed files with 1,594 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/cssxfire.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 72 additions & 1 deletion app/controllers/acaraRKS.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,25 @@ public function detailBeritaTenderRKS(Req $req, Res $res, $args){
$rks = [
'file' => $filename,
'time' => date ("Y-m-d H:i:s"),
'who' => $this->session->id_user
'who' => $this->session->id_user,
'approval'=>[
'direktur'=>[
'status'=>'',
'waktu'=>''
],
'manajer'=>[
'status'=>'',
'waktu'=>''
],
]
];
if($this->tenderModels->setRKSBeritaTender($args['id_tender'], json_encode($rks))){
$this->notifikasiModels->addNotification ([
"id_user" => $req->getAttribute ('active_user_data')[ 'id_user' ],
"tentang" => 'Telah Menambahkan Dokumen RKS ke "' . $this->tenderModels->getBeritaTender($args['id_tender'])[ 'judul_tender' ] . '"',
"waktu" => date ("Y-m-d H:i:s"),
"meta" => $this->router->pathFor ('detailBeritaTenderRKS', ['id_tender'=>$args['id_tender']])
]);
$this->flash->addMessage ('file_saved', true);
return $res->withStatus (302)->withHeader ('Location', $this->router->pathFor ('detailBeritaTenderRKS', ['id_tender'=>$args['id_tender']]));
}
Expand All @@ -79,4 +95,59 @@ public function detailBeritaTenderRKS(Req $req, Res $res, $args){
}
}
}

public function beritaTenderAcara(Req $req, Res $res, $args){
if($req->isGet()){
$this->view->registerFunction('getNamaPenyelenggara', function($id_penyelenggara){
$penyelenggara = $this->penyelenggaraModels->getPenyelenggara($id_penyelenggara);
return $penyelenggara['nama_penyelenggara'];
});
$beritaTender = $this->tenderModels->getBeritaTender();
$req = $req->withAttribute('beritaTender', $beritaTender);
return $this->view->render ("rks-acara/acara/daftar-berita", $req->getAttributes ());
}
}

public function detailBeritaTenderAcara(Req $req, Res $res, $args){
if($req->isGet()){
$this->view->registerFunction('getNamaPenyelenggara', function($id_penyelenggara){
$penyelenggara = $this->penyelenggaraModels->getPenyelenggara($id_penyelenggara);
return $penyelenggara['nama_penyelenggara'];
});
$this->view->registerFunction('getUserUpload', function($id_user){
$user = $this->userModels->getUserDetail($id_user);
return $user;
});
$beritaTender = $this->tenderModels->getBeritaTender($args['id_tender']);
$req = $req->withAttribute('tender', $beritaTender);
$req = $req->withAttribute ('no_file', $this->flash->getMessage ('no_file'));
$req = $req->withAttribute ('file_saved', $this->flash->getMessage ('file_saved'));
return $this->view->render ("rks-acara/acara/detail-berita", $req->getAttributes ());
}else{
$files = $req->getUploadedFiles();
if($files['berita_acara']->getClientFilename() != null){
$fileinfo = pathinfo($files['berita_acara']->getClientFilename());
$filename = $fileinfo['filename'].'_'.time().'.'.$fileinfo['extension'];
$files['berita_acara']->moveTo("public/content/berita-acara/".$filename);
$acara = [
'file' => $filename,
'time' => date ("Y-m-d H:i:s"),
'who' => $this->session->id_user,
];
if($this->tenderModels->setAcaraBeritaTender($args['id_tender'], json_encode($acara))){
$this->notifikasiModels->addNotification ([
"id_user" => $req->getAttribute ('active_user_data')[ 'id_user' ],
"tentang" => 'Telah Menambahkan Dokumen Berita Acara ke "' . $this->tenderModels->getBeritaTender($args['id_tender'])[ 'judul_tender' ] . '"',
"waktu" => date ("Y-m-d H:i:s"),
"meta" => $this->router->pathFor ('detailBeritaTenderAcara', ['id_tender'=>$args['id_tender']])
]);
$this->flash->addMessage ('file_saved', true);
return $res->withStatus (302)->withHeader ('Location', $this->router->pathFor ('detailBeritaTenderAcara', ['id_tender'=>$args['id_tender']]));
}
}else{
$this->flash->addMessage ('no_file', true);
return $res->withStatus (302)->withHeader ('Location', $this->router->pathFor ('detailBeritaTenderAcara', ['id_tender'=>$args['id_tender']]));
}
}
}
}
39 changes: 38 additions & 1 deletion app/controllers/approval.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,44 @@ public function beritaTenderRKS(Req $req, Res $res, $args){
});
$beritaTender = $this->tenderModels->getBeritaTender();
$req = $req->withAttribute('beritaTender', $beritaTender);
return $this->view->render ("approval/berita-tender/daftar-berita", $req->getAttributes ());
return $this->view->render ("approval/rks-acara/daftar-berita", $req->getAttributes ());
}
}

public function approvalBeritaTenderRKS(Req $req, Res $res, $args){
if(!isset($args['status'])){
$this->view->registerFunction('getNamaPenyelenggara', function($id_penyelenggara){
$penyelenggara = $this->penyelenggaraModels->getPenyelenggara($id_penyelenggara);
return $penyelenggara['nama_penyelenggara'];
});
$this->view->registerFunction('getUserUpload', function($id_user){
$user = $this->userModels->getUserDetail($id_user);
return $user;
});
$beritaTender = $this->tenderModels->getBeritaTender($args['id_tender']);
$req = $req->withAttribute('tender', $beritaTender);
return $this->view->render ("approval/rks-acara/detail-berita", $req->getAttributes ());
}elseif(isset($args['status'])){
if($this->tenderModels->setApprovalRKSBeritaTender($args['id_tender'], $this->session->previledge, $args['status'])){
if($args['status'] == 'diterima'){
$this->notifikasiModels->addNotification ([
"id_user" => $req->getAttribute ('active_user_data')[ 'id_user' ],
"tentang" => 'Telah Melakukan Approve Dokumen RKS dari Berita Tender "' . $this->tenderModels->getBeritaTender($args['id_tender'])[ 'judul_tender' ] . '"',
"waktu" => date ("Y-m-d H:i:s"),
"meta" => $this->router->pathFor ('detailBeritaTender', ['id_tender'=>$args['id_tender']])
]);
}elseif($args['status'] == 'ditolak'){
$this->notifikasiModels->addNotification ([
"id_user" => $req->getAttribute ('active_user_data')[ 'id_user' ],
"tentang" => 'Telah Menolak Dokumen RKS dari Berita Tender "' . $this->tenderModels->getBeritaTender($args['id_tender'])[ 'judul_tender' ] . '"',
"waktu" => date ("Y-m-d H:i:s"),
"meta" => $this->router->pathFor ('detailBeritaTender', ['id_tender'=>$args['id_tender']])
]);
}
return $res->withStatus (302)->withHeader ('Location', $this->router->pathFor ('approvalRKSTender', ['id_tender'=>$args['id_tender']]));
}
}else{
return $res->write($args['status']);
}
}
}
45 changes: 45 additions & 0 deletions app/controllers/dokumenTender.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Created by PhpStorm.
* User: wijaya
* Date: 12/04/2017
* Time: 13.46
*/

namespace ryan\controllers;


use Slim\Http\Request;
use Slim\Http\Response;

class dokumenTender extends \ryan\main {
protected $container;
protected $penyelenggaraModels;
protected $tenderModels;
protected $userModels;
protected $notifikasiModels;

public function __construct(Container $container) {
parent::__construct($container);
$this->container = $container;
$this->userModels = new \ryan\models\users($container);
$this->penyelenggaraModels = new \ryan\models\penyelenggara($container);
$this->tenderModels = new \ryan\models\tender($container);
$this->notifikasiModels = new \ryan\models\notifikasi($container);
}

public function daftarBeritaTender(Request $req, Response $res, $args){
if ($req->isGet ()) {
$this->view->registerFunction ('getNamaPenyelenggara', function ($id_penyelenggara) {
$penyelenggara = $this->penyelenggaraModels->getPenyelenggara ($id_penyelenggara);

return $penyelenggara[ 'nama_penyelenggara' ];
});
$beritaTender = $this->tenderModels->getBeritaTender ();
$req = $req->withAttribute ('beritaTender', $beritaTender);

return $this->view->render ("dokumen/daftar-berita", $req->getAttributes ());
}
}

}
20 changes: 20 additions & 0 deletions app/models/dokumenTender.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Created by PhpStorm.
* User: wijaya
* Date: 12/04/2017
* Time: 13.46
*/

namespace ryan\models;


class dokumenTender extends \ryan\main {

protected $container;

public function __construct($container) {
parent::__construct($container);
$this->container = $container;
}
}
27 changes: 27 additions & 0 deletions app/models/tender.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,31 @@ public function setRKSBeritaTender($id_tender, $rks){
return $update->execute();
}

public function setApprovalRKSBeritaTender($id_tender, $who, $status){
$tender = $this->getBeritaTender($id_tender);
$rks = json_decode($tender['rks'], true);
if($who == '2'){
$rks['approval']['direktur'] = [
'status' => $status,
'waktur' => date ("Y-m-d H:i:s")
];
}elseif($who == '3'){
$rks['approval']['manajer'] = [
'status' => $status,
'waktur' => date ("Y-m-d H:i:s")
];
}
$rks = json_encode($rks);
$update = $this->db->prepare('update tender set rks=:rks where id_tender=:id_tender');
$update->bindParam(':rks', $rks);
$update->bindParam(':id_tender', $id_tender);
return $update->execute();
}

public function setAcaraBeritaTender($id_tender, $acara){
$update = $this->db->prepare('update tender set berita_acara=:acara where ID_TENDER=:id_tender');
$update->bindParam(':acara', $acara);
$update->bindParam(':id_tender', $id_tender);
return $update->execute();
}
}
119 changes: 91 additions & 28 deletions app/route.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,102 @@
<?php
/**
* Copyright (c) 2017.
*/

// Group Login -> untuk authentifikasi
$app->group('/auth', function () {

// Halaman Login
$this->get('-login', \ryan\controllers\login::class . ':loginPage')->setName('loginPage');

// Proses Login
$this->post('-dologin', \ryan\controllers\login::class . ':doLogin')->setName('doLogin');

// Proses Logout
$this->get('-logout', \ryan\controllers\login::class . ':doLogout')->setName('doLogout');

});

// Group Root
$app->group('', function () {

// Halaman Dashboard
$this->get('/dashboard', \ryan\controllers\dashboard::class . ':dashboardPage')->setName('DashboardPage');

// Group Menu Berita Tender
$this->group('/berita-tender', function () {

// Halaman Daftar Semua Berita Tender
$this->any('', \ryan\controllers\beritaTender::class . ':daftarBeritaTender')->setName('daftarBeritaTender');

// Halaman Untuk Menambah Berita Tender
$this->any('/tambah', \ryan\controllers\beritaTender::class . ':tambahBeritaTender')->setName('tambahBeritaTender');

// Halaman untuk menampilkan detail berita tender
$this->any('/detail/{id_tender}', \ryan\controllers\beritaTender::class . ':detailBeritaTender')->setName('detailBeritaTender');

$app->group ('/auth', function () {
$this->get ('-login', \ryan\controllers\login::class . ':loginPage')->setName ('loginPage');
$this->post ('-dologin', \ryan\controllers\login::class . ':doLogin')->setName ('doLogin');
$this->get ('-logout', \ryan\controllers\login::class . ':doLogout')->setName ('doLogout');
});

$app->group ('', function () {
$this->get ('/dashboard', \ryan\controllers\dashboard::class . ':dashboardPage')->setName ('DashboardPage');
$this->group('/berita-tender', function(){
$this->map(['GET', 'POST'], '', \ryan\controllers\beritaTender::class . ':daftarBeritaTender')->setName ('daftarBeritaTender');
$this->map(['GET', 'POST'], '/tambah', \ryan\controllers\beritaTender::class . ':tambahBeritaTender')->setName ('tambahBeritaTender');
$this->map(['GET', 'POST'], '/detail/{id_tender}', \ryan\controllers\beritaTender::class . ':detailBeritaTender')->setName ('detailBeritaTender');
//group menu RKS dan Berita Acara
$this->group('/acara-rks', function () {

// group rks
$this->group('/rks', function () {

// halaman daftar berita yang dapat di input rks
$this->any('', \ryan\controllers\acaraRKS::class . ':beritaTenderRKS')->setName('daftarBeritaTenderRKS');

// halaman detail berita dan upload rks
$this->any('/detail/{id_tender}', \ryan\controllers\acaraRKS::class . ':detailBeritaTenderRKS')->setName('detailBeritaTenderRKS');

});

$this->group('/approval', function(){
$this->group('/tender', function(){
$this->map(['GET', 'POST'], '/berita', \ryan\controllers\approval::class . ':beritaTender')->setName ('daftarApprovalBeritaTender');
$this->map(['GET', 'POST'], '/detail/{id_tender}[/{status}]', \ryan\controllers\approval::class . ':approvalBeritaTender')->setName ('approvalBeritaTender');
});
//group berita acara
$this->group('/acara', function () {

//halaman daftar berita yang dapat di input berita acara
$this->any('', \ryan\controllers\acaraRKS::class . ':beritaTenderAcara')->setName('daftarBeritaTenderAcara');
// halaman detail berita dan upload berita acara
$this->any('/detail/{id_tender}', \ryan\controllers\acaraRKS::class . ':detailBeritaTenderAcara')->setName('detailBeritaTenderAcara');

});

$this->group('/acara-RKS', function(){
$this->group('/RKS', function(){
$this->map(['GET', 'POST'], '', \ryan\controllers\acaraRKS::class . ':beritaTenderRKS')->setName ('daftarBeritaTenderRKS');
$this->map(['GET', 'POST'], '/detail/{id_tender}', \ryan\controllers\acaraRKS::class . ':detailBeritaTenderRKS')->setName ('detailBeritaTenderRKS');
});
});

//group approval
$this->group('/approval', function () {

$this->group('/tender', function () {

$this->any('/berita', \ryan\controllers\approval::class . ':beritaTender')->setName('daftarApprovalBeritaTender');

$this->any('/detail/{id_tender}[/{status}]', \ryan\controllers\approval::class . ':approvalBeritaTender')->setName('approvalBeritaTender');

});

$this->group('/acara-rks', function () {

$this->any('/berita', \ryan\controllers\approval::class . ':beritaTenderRKS')->setName('daftarApprovalRKSTender');

$this->any('/detail/{id_tender}[/{status}]', \ryan\controllers\approval::class . ':approvalBeritaTenderRKS')->setName('approvalRKSTender');

});
})->add( new \ryan\controllers\login($container));

$app->group('/api', function(){
$this->post ('/tambah-penyelenggara', \ryan\controllers\api::class . ':addPenyelenggara')->setName ('apiAddPenyelenggara');
$this->get ('/penyelenggara[/{id}]', \ryan\controllers\api::class . ':getPenyelenggara')->setName ('apiGetPenyelenggara');
$this->get ('/dokumen-master[/{id}]', \ryan\controllers\api::class . ':getDokumenMaster')->setName ('apiGetDokumenMaster');
$this->get ('/syarat-dokumen-tender[/{id}]', \ryan\controllers\api::class . ':getDokumenList')->setName ('apiGetDokumenTender');
$this->get ('/detail-berita-tender[/{id}]', \ryan\controllers\api::class . ':getDetailTender')->setName ('apiGetDetailBeritaTender');

});

})->add(new \ryan\controllers\login($container));

$app->group('/api', function () {

$this->post('/tambah-penyelenggara', \ryan\controllers\api::class . ':addPenyelenggara')->setName('apiAddPenyelenggara');

$this->get('/penyelenggara[/{id}]', \ryan\controllers\api::class . ':getPenyelenggara')->setName('apiGetPenyelenggara');

$this->get('/dokumen-master[/{id}]', \ryan\controllers\api::class . ':getDokumenMaster')->setName('apiGetDokumenMaster');

$this->get('/syarat-dokumen-tender[/{id}]', \ryan\controllers\api::class . ':getDokumenList')->setName('apiGetDokumenTender');

$this->get('/detail-berita-tender[/{id}]', \ryan\controllers\api::class . ':getDetailTender')->setName('apiGetDetailBeritaTender');

});

Loading

0 comments on commit 2c62bda

Please sign in to comment.