peneliti asing, publikasi artikel

parent 042daf6a
......@@ -52,6 +52,8 @@ class PenelitiAsingController extends Controller
Validator::make($data, PenelitiAsing::RULES, PenelitiAsing::ERROR_MESSAGES)->validate();
$data['bidang_id'] = decrypt($data['bidang_id']);
$data['negara_id'] = decrypt($data['negara_id']);
$data['userid_created'] = Auth::user()->id;
$data['userid_updated'] = Auth::user()->id;
try{
PenelitiAsing::query()->create($data);
......@@ -105,6 +107,7 @@ class PenelitiAsingController extends Controller
$data['bidang_id'] = decrypt($data['bidang_id']);
$data['negara_id'] = decrypt($data['negara_id']);
$data['userid_updated'] = Auth::user()->id;
try{
PenelitiAsing::query()->find(decrypt($id))->update($data);
......
......@@ -3,7 +3,11 @@
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\User\PublikasiArtikel;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Validator;
class PublikasiArtikelController extends Controller
{
......@@ -12,10 +16,11 @@ class PublikasiArtikelController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function index()
public function index(Request $request)
{
//
return view('user.publikasiartikel.index');
$data['tingkat'] = $request->tingkat;
$data['rs'] = PublikasiArtikel::query()->with('biodata')->where('jenis', strtoupper(substr($request->tingkat, 0, 1)))->orderBy('updated_at', 'desc')->get();
return view('user.publikasiartikel.index', $data);
}
/**
......@@ -23,10 +28,11 @@ class PublikasiArtikelController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function create()
public function create(Request $request)
{
//
return view('user.publikasiartikel.create');
$data['tingkat'] = $request->tingkat;
$data['edit'] = false;
return view('user.publikasiartikel.create', $data);
}
/**
......@@ -37,7 +43,21 @@ class PublikasiArtikelController extends Controller
*/
public function store(Request $request)
{
//
$data = $request->except('_token');
Validator::make($data, PublikasiArtikel::RULES, PublikasiArtikel::ERROR_MESSAGES)->validate();
$jenis = $data['jenis'];
$data['userid_created'] = Auth::user()->id;
$data['userid_updated'] = Auth::user()->id;
$data['jenis'] = strtoupper(substr($data['jenis'], 0, 1));
try{
PublikasiArtikel::query()->create($data);
return redirect()->intended('publikasiartikel?tingkat='.$jenis);
}
catch(Exception $ex){
dd($ex);
return redirect()->back()->withInput();
}
}
/**
......@@ -59,7 +79,10 @@ class PublikasiArtikelController extends Controller
*/
public function edit($id)
{
//
$data['data'] = PublikasiArtikel::query()->find(decrypt($id));
$data['tingkat'] = $data['data']->jenis == 'R' ? 'Regional' : ($data['data']->jenis == 'N' ? 'Nasional' : ($data['data']->jenis == 'I' ? 'Internasional' : ''));
$data['edit'] = true;
return view('user.publikasiartikel.create', $data);
}
/**
......@@ -71,7 +94,20 @@ class PublikasiArtikelController extends Controller
*/
public function update(Request $request, $id)
{
//
$data = $request->except('_token');
Validator::make($data, PublikasiArtikel::RULES, PublikasiArtikel::ERROR_MESSAGES)->validate();
$jenis = $data['jenis'];
$data['userid_created'] = Auth::user()->id;
$data['userid_updated'] = Auth::user()->id;
$data['jenis'] = strtoupper(substr($data['jenis'], 0, 1));
try{
PublikasiArtikel::query()->find(decrypt($id))->update($data);
return redirect()->intended('publikasiartikel?tingkat='.$jenis);
}
catch(Exception $ex){
return redirect()->back()->withInput();
}
}
/**
......@@ -82,6 +118,12 @@ class PublikasiArtikelController extends Controller
*/
public function destroy($id)
{
//
try{
PublikasiArtikel::query()->find(decrypt($id))->delete();
return redirect()->back();
}
catch(Exception $ex){
return redirect()->back();
}
}
}
......@@ -14,7 +14,7 @@ class KekayaanIntelektual extends Model
protected $table = 'kekayaanintelektual';
protected $keyType = 'string';
protected $fillable = ['judul_hki', 'jenis', 'status', 'nopendaftaran', 'nidn'];
protected $fillable = ['judul_hki', 'jenis', 'status', 'nopendaftaran', 'nidn', 'userid_created', 'user_id_updated'];
public const RULES = [
'judul_hki' => 'required',
......
<?php
namespace App\Models\User;
use App\Models\Biodata;
use App\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PublikasiArtikel extends Model
{
use HasFactory;
use UuidTrait;
public $incrementing = false;
protected $table = 'publikasiartikel';
protected $keyType = 'string';
protected $fillable = ['nidn', 'judul', 'status', 'nama_forum', 'institusi', 'waktu_pelaksanaan_awal', 'waktu_pelaksanaan_akhir', 'tempat', 'jenis', 'userid_created', 'user_id_updated'];
public const RULES = [
'nidn' => 'required',
'judul' => 'required',
'status' => 'required',
'nama_forum' => 'required',
'waktu_pelaksanaan_awal' => 'required',
'waktu_pelaksanaan_akhir' => 'required',
'tempat' => 'required',
'jenis' => 'required',
'institusi' => 'required'
];
public const ERROR_MESSAGES = [
'nidn.required' => 'nidn tidak boleh kosong',
'judul.required' => 'judul tidak boleh kosong',
'status.required' => 'status tidak boleh kosong',
'nama_forum.required' => 'nama forum tidak boleh kosong',
'waktu_pelaksanaan_awal.required' => 'waktu pelaksanaan awal tidak boleh kosong',
'waktu_pelaksanaan_akhir.required' => 'waktu pelaksanaan akhir tidak boleh kosong',
'tempat.required' => 'tempat tidak boleh kosong',
'jenis.required' => 'jenis tidak boleh kosong',
'institusi.required' => 'institusi tidak boleh kosong'
];
public function biodata()
{
return $this->belongsTo(Biodata::class, 'nidn', 'nidn');
}
}
......@@ -85,13 +85,13 @@
<a href="#datatable" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle"> Publikasi Artikel Dalam Prosiding <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg> </a>
<ul class="collapse list-unstyled sub-submenu" id="datatable" data-parent="#datatable">
<li>
<a href="{{ url('publikasiartikel') }}"> Publikasi Artikel Dalam Prosiding Regional </a>
<a href="{{ url('publikasiartikel?tingkat=regional') }}"> Publikasi Artikel Dalam Prosiding Regional </a>
</li>
<li>
<a href="{{ url('publikasiartikel') }}"> Publikasi Artikel Dalam Prosiding Tingkat Nasional</a>
<a href="{{ url('publikasiartikel?tingkat=nasional') }}"> Publikasi Artikel Dalam Prosiding Tingkat Nasional</a>
</li>
<li>
<a href="{{ url('publikasiartikel') }}"> Publikasi Artikel Dalam Prosiding Tingkat International</a>
<a href="{{ url('publikasiartikel?tingkat=internasional') }}"> Publikasi Artikel Dalam Prosiding Tingkat International</a>
</li>
</ul>
</li>
......
......@@ -18,130 +18,46 @@
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-6">
<div class="table-responsive mb-4 mt-4">
<a href="{{ url('publikasiartikel/create?tingkat='.$tingkat) }}" class="btn btn-primary mb-2"><i data-feather="file-plus"></i> Tambah</a>
<table id="zero-config" class="table table-hover" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>Dosen</th>
<th>Judul</th>
<th>Nama Forum</th>
<th>Institusi</th>
<th>Waktu Pelaksanaan</th>
<th>Tempat</th>
<th>Status</th>
<th>Jenis</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>63</td>
<td>2011/07/25</td>
<td>$170,750</td>
</tr>
<tr>
<td>Ashton Cox</td>
<td>Junior Technical Author</td>
<td>San Francisco</td>
<td>66</td>
<td>2009/01/12</td>
<td>$86,000</td>
</tr>
<tr>
<td>Cedric Kelly</td>
<td>Senior Javascript Developer</td>
<td>Edinburgh</td>
<td>22</td>
<td>2012/03/29</td>
<td>$433,060</td>
</tr>
<tr>
<td>Airi Satou</td>
<td>Accountant</td>
<td>Tokyo</td>
<td>33</td>
<td>2008/11/28</td>
<td>$162,700</td>
</tr>
<tr>
<td>Brielle Williamson</td>
<td>Integration Specialist</td>
<td>New York</td>
<td>61</td>
<td>2012/12/02</td>
<td>$372,000</td>
</tr>
<tr>
<td>Herrod Chandler</td>
<td>Sales Assistant</td>
<td>San Francisco</td>
<td>59</td>
<td>2012/08/06</td>
<td>$137,500</td>
</tr>
<tr>
<td>Rhona Davidson</td>
<td>Integration Specialist</td>
<td>Tokyo</td>
<td>55</td>
<td>2010/10/14</td>
<td>$327,900</td>
</tr>
<tr>
<td>Colleen Hurst</td>
<td>Javascript Developer</td>
<td>San Francisco</td>
<td>39</td>
<td>2009/09/15</td>
<td>$205,500</td>
</tr>
<tr>
<td>Sonya Frost</td>
<td>Software Engineer</td>
<td>Edinburgh</td>
<td>23</td>
<td>2008/12/13</td>
<td>$103,600</td>
</tr>
<tr>
<td>Jena Gaines</td>
<td>Office Manager</td>
<td>London</td>
<td>30</td>
<td>2008/12/19</td>
<td>$90,560</td>
</tr>
<tr>
<td>Quinn Flynn</td>
<td>Support Lead</td>
<td>Edinburgh</td>
<td>22</td>
<td>2013/03/03</td>
<td>$342,000</td>
</tr>
<tr>
<td>Charde Marshall</td>
<td>Regional Director</td>
<td>San Francisco</td>
<td>36</td>
<td>2008/10/16</td>
<td>$470,600</td>
</tr>
<tr>
<td>Haley Kennedy</td>
<td>Senior Marketing Designer</td>
<td>London</td>
<td>43</td>
<td>2012/12/18</td>
<td>$313,500</td>
</tr>
@foreach ($rs as $item)
<tr>
<td>
{{ $item->biodata->name }} <br>
{{ $item->nidn }}
</td>
<td>{{ $item->judul }}</td>
<td>{{ $item->nama_forum }}</td>
<td>{{ $item->institusi }}</td>
<td>{{ $item->waktu_pelaksanaan_awal.' - '.$item->waktu_pelaksanaan_awal }}</td>
<td>{{ $item->tempat }}</td>
<td>{{ $item->status == '1' ? 'Pemakalah Biasa' : 'Invited/Keynote Speaker' }}</td>
<td>{{ $item->jenis == 'R' ? 'Regional' : ($item->jenis == 'N' ? 'Nasional' : ($item->jenis == 'I' ? 'Internasional' : ''))}}</td>
<td>
<a class="btn btn-warning" href="{{ route('publikasiartikel.edit', ['publikasiartikel' => encrypt($item->id)]) }}">Edit</a>
<button class="btn btn-danger delete" type="button" data-target="form_artikel_{{ $loop->iteration }}">Hapus</button>
<form id="form_artikel_{{ $loop->iteration }}" action="{{ route('publikasiartikel.destroy', ['publikasiartikel' => encrypt($item->id)]) }}" method="POST">
{{ method_field('DELETE') }}
@csrf
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
......@@ -167,5 +83,26 @@
"lengthMenu": [10, 20, 50],
"pageLength": 10
});
$("body").on("click", ".delete", function (e) {
e.preventDefault();
var id = $(this).data('target');
Swal.fire({
title: "Apakah Anda Yakin?",
text: "Anda akan menghapus data ini!",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "No"
}).then((result) => {
if (result.value) {
Swal.close();
$("#"+id).submit();
} else if (result.dismiss === Swal.DismissReason.cancel) {
Swal.fire('Dibatalkan', 'Data batal dihapus', 'error');
}
});
});
</script>
@endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment