Skip to content

Commit

Permalink
adding kode kegiatan, updating kegiatan
Browse files Browse the repository at this point in the history
  • Loading branch information
t0n1zz committed Jul 27, 2022
1 parent f9cedcf commit 5bc9e3f
Show file tree
Hide file tree
Showing 172 changed files with 569,778 additions and 4,237 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/node_modules
/public/hot
/public/js/components
/public/storage
/storage/*.key
/vendor
Expand Down
Binary file modified app/.DS_Store
Binary file not shown.
Binary file modified app/Http/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion app/Http/Controllers/ArtikelKategoriController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public function store(Request $request)

$name = $request->name;


$kelas = ArtikelKategori::create($request->all());

return response()
Expand Down
36 changes: 24 additions & 12 deletions app/Http/Controllers/KegiatanBKCUController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use App\KegiatanKeputusan;
use App\KegiatanPertanyaan;
use App\KegiatanPilih;
use App\KodeKegiatan;
use App\Sertifikat;
use App\SertifikatGenerate;
use Illuminate\Http\Request;
Expand All @@ -34,7 +35,7 @@ class KegiatanBKCUController extends Controller{

public function index($kegiatan_tipe)
{
$table_data = Kegiatan::with('tempat','sasaran','Regencies','Provinces')->withCount('hasPeserta')->where('tipe',$kegiatan_tipe)->advancedFilter();
$table_data = Kegiatan::with('tempat','sasaran','Regencies','Provinces','kode')->withCount('hasPeserta')->where('tipe',$kegiatan_tipe)->advancedFilter();

return response()
->json([
Expand All @@ -44,7 +45,7 @@ public function index($kegiatan_tipe)

public function indexPeriode($kegiatan_tipe, $periode)
{
$table_data = Kegiatan::with('tempat','sasaran','Regencies','Provinces')->withCount('hasPeserta')->where('tipe',$kegiatan_tipe)->where('periode',$periode)->advancedFilter();
$table_data = Kegiatan::with('tempat','sasaran','Regencies','Provinces','kode')->withCount('hasPeserta')->where('tipe',$kegiatan_tipe)->where('periode',$periode)->advancedFilter();

return response()
->json([
Expand Down Expand Up @@ -332,7 +333,7 @@ public function indexKegiatan()
{
$periode = date("Y");

$table_data = Kegiatan::where('periode',$periode)->select('id','name','mulai','periode')->get();
$table_data = Kegiatan::where('periode',$periode)->select('id','name','mulai','periode','kode')->get();

return response()
->json([
Expand Down Expand Up @@ -426,7 +427,12 @@ public function store(Request $request, $kegiatan_tipe)
{
$this->validate($request,Kegiatan::$rules);

$name = $request->name;
if($kegiatan_tipe == 'diklat_bkcu'){
$name = KodeKegiatan::where('id', $request->id_kode)->first();
$name = $name->name;
}else{
$name = $request->name;
}

// processing single image upload
if(!empty($request->gambar)){
Expand All @@ -440,10 +446,11 @@ public function store(Request $request, $kegiatan_tipe)
$fileName = '';
}

$kelas = Kegiatan::create($request->except('tipe','status','gambar') + [
$kelas = Kegiatan::create($request->except('tipe','status','gambar','name') + [
'tipe' => $kegiatan_tipe,
'status' => '1',
'gambar' => $fileName
'gambar' => $fileName,
'name' => $name
]);

$sasaran_ar = array();
Expand Down Expand Up @@ -785,7 +792,7 @@ public function storeTugasJawaban(Request $request, $kegiatan_tipe)

public function edit($id)
{
$kelas = Kegiatan::with('tempat','sasaran','panitia_dalam.pekerjaan_aktif.cu','panitia_luar','panitia_luar_lembaga','pilih')->findOrFail($id);
$kelas = Kegiatan::with('tempat','sasaran','panitia_dalam.pekerjaan_aktif.cu','panitia_luar','panitia_luar_lembaga','pilih','kode')->findOrFail($id);
$kelas2 = Sertifikat::where('id', $kelas->id_sertifikat)->get();

return response()
Expand All @@ -811,11 +818,15 @@ public function editTugasJawaban($id)
public function update(Request $request, $id)
{
// $this->validate($request, Kegiatan::$rules);

$name = $request->name;

$kelas = Kegiatan::with('pilih')->findOrFail($id);

if($kelas->tipe == 'diklat_bkcu'){
$name = KodeKegiatan::where('id', $request->id_kode)->first();
$name = $name->name;
}else{
$name = $kelas->name;
}

// processing single image upload
if(!empty($request->gambar)){
if($kelas->tipe == 'diklat_bkcu'){
Expand All @@ -828,8 +839,9 @@ public function update(Request $request, $id)
$fileName = '';
}

$kelas->update($request->except('gambar') + [
'gambar' => $fileName
$kelas->update($request->except('gambar','name') + [
'gambar' => $fileName,
'name' => $name,
]);

$sasaran_ar = array();
Expand Down
93 changes: 93 additions & 0 deletions app/Http/Controllers/KodeKegiatanController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

namespace App\Http\Controllers;

use App\KodeKegiatan;
use Illuminate\Http\Request;

class KodeKegiatanController extends Controller
{
protected $message = "Kode Kegiatan";
public function index()
{
$table_data = KodeKegiatan::advancedFilter();

return response()
->json([
'model' => $table_data
]);
}

public function create()
{
return response()
->json([
'form' => KodeKegiatan::initialize(),
'rules' => KodeKegiatan::$rules,
'option' => []
]);
}

public function store(Request $request)
{
$data = [
'kode' => $request->kode,
'nama' => $request->nama
];
// $this->validate($data, KodeKegiatan::$rules);

$nama = $request->nama;

$kelas = KodeKegiatan::create($data);

return response()
->json([
'saved' => true,
'message' => $this->message . ' ' . $nama . ' berhasil ditambah',
'id' => $kelas->id
]);
}

public function edit($id)
{
$kelas = KodeKegiatan::findOrFail($id);

return response()
->json([
'form' => $kelas,
'option' => []
]);
}

public function update(Request $request, $id)
{
$data = [
'kode' => $request->kode,
'nama' => $request->nama
];

$nama = $request->nama;
$kelas = KodeKegiatan::findOrFail($id);


$kelas->update($data);
return response()
->json([
'saved' => true,
'message' => $this->message . ' ' . $nama . ' berhasil diubah'
]);
}

public function destroy($id)
{
$kelas = KodeKegiatan::findOrFail($id);
$nama = $kelas->nama;
$kelas->delete();

return response()
->json([
'deleted' => true,
'message' => $this->message . ' ' . $nama . ' berhasil dihapus'
]);
}
}
10 changes: 9 additions & 1 deletion app/Http/Controllers/SertifikatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Barryvdh\DomPDF\Facade as PDF;
use DateTime;
use App\KegiatanListMateri;
use App\KegiatanMateriNilai;
use App\Aktivis;


Expand Down Expand Up @@ -135,11 +136,18 @@ public function generateSertifikat(Request $formData)
$nomorData = SertifikatGenerate::where('id_aktivis', $formData->aktivis_id)->where('id_kegiatan', $formData->kegiatan_id)->first();
$sertifikat = Sertifikat::where('id', $kegiatanData->id_sertifikat)->select('gambar_depan', 'gambar_belakang', 'kode_sertifikat')->first();

$listMateri = KegiatanListMateri::select("kegiatan_list_materi.waktu", "kegiatan_list_materi.nama", "kegiatan_materi_nilai.nilai")
$cekNilai = KegiatanMateriNilai::where('kegiatan_id', $formData->kegiatan_id)->first();

if($cekNilai){
$listMateri = KegiatanListMateri::select("kegiatan_list_materi.waktu", "kegiatan_list_materi.nama", "kegiatan_materi_nilai.nilai")
->join("kegiatan_materi_nilai", "kegiatan_materi_nilai.materi_id", "=", "kegiatan_list_materi.id")
->where('kegiatan_materi_nilai.kegiatan_id', $formData->kegiatan_id)
->where('kegiatan_materi_nilai.aktivis_id', $formData->aktivis_id)
->get();
}else{
$listMateri = KegiatanListMateri::select("kegiatan_list_materi.waktu", "kegiatan_list_materi.nama")->where('kegiatan_id', $formData->kegiatan_id)
->get();
}

$sumWaktu = KegiatanListMateri::where('kegiatan_id', $formData->kegiatan_id)->sum('waktu');
$sumNilai = KegiatanListMateri::join("kegiatan_materi_nilai", "kegiatan_materi_nilai.materi_id", "=", "kegiatan_list_materi.id")
Expand Down
11 changes: 8 additions & 3 deletions app/Kegiatan.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Kegiatan extends Model {
protected $dates = ['deleted_at'];

public static $rules = [
'name' => 'required'
// 'name' => 'required'
];

public function sluggable()
Expand All @@ -31,11 +31,11 @@ public function sluggable()
}

protected $fillable = [
'id_regencies','id_districts','id_regencies','id_provinces','id_tempat','id_sertifikat','kode_diklat','name','periode','durasi','mulai','selesai','jadwal','keterangan','keteranganBatal','status','tipe','peserta_max','peserta_max_cu','peserta_min','created_at','updated_at','deleted_at','gambar','tipe_tempat','keputusan_cu','keputusan_user','pertanyaan_cu','pertanyaan_user'
'id_regencies','id_districts','id_regencies','id_provinces','id_tempat','id_sertifikat','id_kode','kode_diklat','name','periode','durasi','mulai','selesai','jadwal','keterangan','keteranganBatal','status','tipe','peserta_max','peserta_max_cu','peserta_min','created_at','updated_at','deleted_at','gambar','tipe_tempat','keputusan_cu','keputusan_user','pertanyaan_cu','pertanyaan_user'
];

protected $allowedFilters = [
'id','id_tempat','kode_diklat','name','periode','durasi','mulai','selesai','status','peserta_max','peserta_max_cu','peserta_min','created_at','updated_at','deleted_at','tipe_tempat',
'id','id_tempat','id_kode','kode_diklat','name','periode','durasi','mulai','selesai','status','peserta_max','peserta_max_cu','peserta_min','created_at','updated_at','deleted_at','tipe_tempat',

'villages.name', 'districts.name', 'regencies.name', 'provinces.name','tempat.name'
];
Expand Down Expand Up @@ -111,4 +111,9 @@ public function hasKeputusan(){
public function hasMateri(){
return $this->hasMany('App\KegiatanMateri','kegiatan_id','id');
}

public function kode()
{
return $this->belongsTo('App\KodeKegiatan', 'id_kode', 'id')->select('id', 'kode');
}
}
23 changes: 23 additions & 0 deletions app/KegiatanMateriNilai.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace App;

use illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\SoftDeletes;

class KegiatanMateriNilai extends Model {

use LogsActivity, SoftDeletes;

protected $table = 'kegiatan_materi_nilai';
protected $dates = ['deleted_at'];
protected static $logFillable = true;
protected static $logOnlyDirty = true;

public static $rules = [
'name' => 'required'
];

protected $fillable = ['aktivis_id','kegiatan_id','materi_id','nilai'];

}
39 changes: 39 additions & 0 deletions app/KodeKegiatan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Support\Dataviewer;
use Spatie\Activitylog\Traits\LogsActivity;

class KodeKegiatan extends Model
{
use Dataviewer, LogsActivity;
protected $table = 'kegiatan_kode';
protected static $logFillable = true;

protected $fillable = [
'kode', 'name', 'created_at', 'updated_at'
];

protected $allowedFilters = [
'id', 'kode', 'name'
];

protected $orderable = [
'id', 'kode', 'name'
];

public static function initialize()
{
return [
'kode' => '', 'name' => ''
];
}

public static $rules = [
'kode' => 'required',
'name' => 'required'
];

}
8 changes: 4 additions & 4 deletions app/Support/NotificationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ public static function self_assesment($request, $message)
public static function monitoring($request, $message)
{
if(Auth::user()->id_cu == 0){
$users = User::permission(['index_assesment_access'])->where('id_cu', $request->id_cu)->where('status',1)->where('login', '>=', \Carbon\Carbon::now()->subMonth(3))->get();
$users = User::permission(['index_monitoring'])->where('id_cu', $request->id_cu)->where('status',1)->where('login', '>=', \Carbon\Carbon::now()->subMonth(3))->get();
$cu_name = ' (PUSKOPCUINA) ';
}else{
$users = User::permission(['index_assesment_access'])->where('id_cu', 0)->where('status',1)->get();
$users = User::permission(['index_monitoring'])->where('id_cu', 0)->where('status',1)->get();
$cu = Cu::where('id', Auth::user()->id_cu)->select('id', 'name')->first();
$cu_name = ' (CU ' .$cu->name. ') ';
}
Expand All @@ -195,10 +195,10 @@ public static function monitoring($request, $message)
public static function monitoring_pencapaian($request, $message)
{
if(Auth::user()->id_cu == 0){
$users = User::permission(['index_assesment_access'])->where('id_cu', $request->id_cu)->where('status',1)->where('login', '>=', \Carbon\Carbon::now()->subMonth(3))->get();
$users = User::permission(['index_monitoring'])->where('id_cu', $request->id_cu)->where('status',1)->where('login', '>=', \Carbon\Carbon::now()->subMonth(3))->get();
$cu_name = ' (PUSKOPCUINA) ';
}else{
$users = User::permission(['index_assesment_access'])->where('id_cu', 0)->where('status',1)->get();
$users = User::permission(['index_monitoring'])->where('id_cu', 0)->where('status',1)->get();
$cu = Cu::where('id', Auth::user()->id_cu)->select('id', 'name')->first();
$cu_name = ' (CU ' .$cu->name. ') ';
}
Expand Down
File renamed without changes.
Binary file modified public/.DS_Store
Binary file not shown.
Binary file modified public/css/.DS_Store
Binary file not shown.
2,427 changes: 2,425 additions & 2 deletions public/css/admin/libs.css

Large diffs are not rendered by default.

8,473 changes: 8,472 additions & 1 deletion public/css/public/indexlibs.css

Large diffs are not rendered by default.

28,230 changes: 28,226 additions & 4 deletions public/css/public/libs.css

Large diffs are not rendered by default.

Binary file modified public/js/.DS_Store
Binary file not shown.
Binary file modified public/js/admin/.DS_Store
Binary file not shown.
611 changes: 610 additions & 1 deletion public/js/admin/libs.js

Large diffs are not rendered by default.

146,516 changes: 146,514 additions & 2 deletions public/js/app.js

Large diffs are not rendered by default.

936 changes: 934 additions & 2 deletions public/js/components/0.js

Large diffs are not rendered by default.

17,217 changes: 17,216 additions & 1 deletion public/js/components/1.js

Large diffs are not rendered by default.

13,384 changes: 13,382 additions & 2 deletions public/js/components/10.js

Large diffs are not rendered by default.

1,832 changes: 1,831 additions & 1 deletion public/js/components/100.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5bc9e3f

Please sign in to comment.