create kekayaan intelektual

parent 67fd160d
......@@ -3,7 +3,12 @@
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\Biodata;
use App\Models\User\KekayaanIntelektual;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Validator;
class KekayaanIntelController extends Controller
{
......@@ -14,7 +19,6 @@ class KekayaanIntelController extends Controller
*/
public function index()
{
//
return view('user.kekayaan.index');
}
......@@ -25,63 +29,72 @@ class KekayaanIntelController extends Controller
*/
public function create()
{
//
return view('user.kekayaan.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$data = $request->except('_token');
Validator::make($data, KekayaanIntelektual::RULES, KekayaanIntelektual::ERROR_MESSAGES)->validate();
try {
$biodata = Biodata::query()->where('nidn', $request->nidn)->firstOrFail();
$data['userid_created'] = Auth::user()->id;
$data['userid_updated'] = Auth::user()->id;
KekayaanIntelektual::query()->create($data);
} catch (Exception $ex) {
return redirect()->back()->withInput();
}
return redirect()->route('kekayaanintelek.index');
}
/**
* Display the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
......@@ -94,6 +94,7 @@ class PenelitianSumberDanaController extends Controller
if (!is_null($dosen) && $request->name == 'dosen') {
$data['name'] = $request->name;
$data['nama'] = $request->nama;
$data['jenis'] = encrypt($dosen->jenis);
} elseif (is_null($dosen) && $request->name == 'non_dosen') {
$data['name'] = $request->name;
......
......@@ -10,5 +10,6 @@ class Biodata extends Model
use HasFactory;
protected $table = 'biodata';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = ['id', 'user_id', 'nip', 'nidn', 'name', 'fakultas', 'prodi', 'telephone', 'phone', 'email', 'web', 'userid_created', 'userid_updated', 'jenis'];
}
<?php
namespace App\Models\User;
use App\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class KekayaanIntelektual extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'kekayaanintelektual';
protected $keyType = 'string';
protected $fillable = ['judul_hki', 'jenis', 'status', 'nopendaftaran', 'nidn'];
public const RULES = [
'judul_hki' => 'required',
'jenis' => 'required',
'status' => 'required',
'nopendaftaran' => 'required',
'nidn' => 'required',
];
public const ERROR_MESSAGES = [
'judul_hki.required' => 'Judul tidak boleh kosong',
'jenis.required' => 'Jenis tidak boleh kosong',
'status.required' => 'Status tidak boleh kosong',
'nopendaftaran.required' => 'No pendaftaran tidak boleh kosong',
'nidn.required' => 'NIDN tidak tervalidasi atau kosong',
];
}
function checkNidn(id) {
var value = $('#input_' + id).val();
var request = $.ajax({
url: "{{ route('get-biodata') }}",
type: "get",
dataType: "json",
data: { nidn: value },
success: function (result) {
$('#nama_' + id).val(result['name']);
$('#prodi_' + id).val(result['prodi']);
$('#' + id).val(result['nidn']);
}
})
}
......@@ -283,8 +283,6 @@
$('#nama_'+id).val(result['name']);
$('#prodi_'+id).val(result['prodi']);
$('#'+id).val(result['nidn']);
// var r = JSON.parse(result);
// alert(result['name']);
}
})
}
......
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