Commit eba931fe by novanbagus

update user external

parent ee952692
......@@ -78,4 +78,15 @@ class InseoHelper
return $fak;
}
public static function random_password() {
$alphabet = '1234567890';
$pass = array(); //remember to declare $pass as an array
$alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
for ($i = 0; $i < 8; $i++) {
$n = rand(0, $alphaLength);
$pass[] = $alphabet[$n];
}
return implode($pass); //turn the array into a string
}
}
<?php
namespace App\Http\Controllers\Operator;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
use App\Models\Auth\Biodata;
use DB;
class CheckController extends Controller
{
public function email(Request $request)
{
$email = strtolower($request->input('value'));
$temp = strtolower($request->input('temp'));
if($email == $temp)
{
echo '0';
exit;
}
$cek = User::select('id')->Where(DB::raw('lower(email)'), $email)->count();
if($cek > 0)
echo '1';
else
echo '0';
}
public function nidn(Request $request)
{
$nidn = $request->input('value');
$temp = $request->input('temp');
if($nidn == $temp)
{
echo '0';
exit;
}
$cek = Biodata::join('users', 'users.id', '=', 'biodata.id')
->select('id')
->Where('noidentitas', $nidn)
->count();
if($cek > 0)
echo '2';
else
echo '0';
}
// public function kecamatan($kota)
// {
// $modelKecamatan = new Kecamatan;
// $kecamatan = new KecamatanRepository($modelKecamatan);
// return $kecamatan->kecamatan($kota);
// }
// public function smu($kecamatan)
// {
// $modelSmu = new KodeSmu;
// $smu = new SmuRepository($modelSmu);
// return $smu->smu($kecamatan);
// }
// public function kelompokJalur($jalur){
// $modelProdiJalur = new Kelompok;
// $modelPendaftar = new Pendaftar;
// $prodiJalur = new KelompokRepository($modelProdiJalur, $modelPendaftar);
// return $prodiJalur->kelompok('ajax', $jalur);
// //dd($prodiJalur->prodiJalurx($kelompok, $jalur));
// }
// public function prodiJalur($kelompok, $jalur){
// $modelProdiJalur = new ProdiJalur;
// $prodiJalur = new ProdiJalurRepository($modelProdiJalur);
// return $prodiJalur->prodiJalurx($kelompok, $jalur);
// //dd($prodiJalur->prodiJalurx($kelompok, $jalur));
// }
// public function spi($prodi)
// {
// $modelSpi = new Spi;
// $spi = new SpiRepository($modelSpi);
// return $spi->spi($prodi);
// }
public function prodi(Request $request)
{
$value = $request->get('value');
if($value != '')
{
$data = DB::table('prodi')->where('fakultas_id', $value)->select('id', 'nama')->get();
$output = '<option value="">- Pilih Data -</option>';
foreach($data as $row)
{
$output .= '<option value="'.$row->id.'">'.$row->nama.'</option>';
}
}
else
{
$output = '';
}
echo $output;
}
// public function prodiunesa($fakultas)
// {
// $modelProdiunesa = new ProdiUnesas;
// $prodiunesa = new ProdiUnesaRepository($modelProdiunesa);
// return $prodiunesa->prodiunesa($fakultas);
// }
}
......@@ -2,20 +2,21 @@
namespace App\Http\Controllers\Operator;
use App\Http\Controllers\Controller;
use DB;
use URL;
use Auth;
use Uuid;
use Alert;
use Crypt;
use App\Models\User;
use GuzzleHttp\Client;
use App\Models\Reviewer;
use App\Traits\LoginTrait;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Authentication\LoginController;
use App\Traits\LoginTrait;
class ReviewerController extends Controller
{
......@@ -196,12 +197,16 @@ class ReviewerController extends Controller
public function getDosen(Request $request)
{
$tipe = $request->get('tipe');
$i = 0;
if($tipe == '1' || $tipe == '' || $tipe == null)
{
$client = new Client();
$response = $client->request('GET', 'https://i-sdm.unesa.ac.id/api/data-dosen');
$data = json_decode($response->getBody(), true);
$result = [];
$i = 0;
foreach ($data['data'] as $key => $value) {
$jenjang = substr($value['namasatker'],-2);
......@@ -216,10 +221,31 @@ class ReviewerController extends Controller
$result[$i]['nidn'] = $value['nidn'];
$result[$i]['fakultas'] = $value['namaparentsatker'];
$result[$i]['prodi'] = $xyz;
$result[$i]['tipe'] = 'Internal';
$result[$i]['id_sdm'] = $value['nidn'];
$i++;
}
}
if($tipe == '2' || $tipe == '' || $tipe == null)
{
$users = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){
$q->whereIn('name', ['reviewer']);
})->where('status', '2')->get();
$j = $i?:0;
foreach ($users as $key => $value) {
$result[$j]['nm_sdm'] = $value->name;
$result[$j]['nidn'] = $value->rBiodata->noidentitas;
$result[$j]['fakultas'] = $value->rBiodata->fakultas;
$result[$j]['prodi'] = $value->rBiodata->prodi;
$result[$j]['tipe'] = 'External';
$result[$j]['id_sdm'] = $value->rBiodata->noidentitas;
$j++;
}
}
$hasil['kode'] = "200";
$hasil['pesan'] = "sukses";
......
......@@ -21,7 +21,7 @@ class UserController extends Controller
$data['title'] = 'Daftar User';
$data['users'] = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){
$q->whereIn('name', ['dosen','reviewer']);
})->get();
})->where('status', '1')->get();
$data['roles'] = Role::whereIn('name', ['reviewer', 'operator'])->orderBy('name')->get();
......
<?php
namespace App\Http\Controllers\Operator;
use Uuid;
use App\Models\Role;
use App\Models\User;
use App\Helpers\InseoHelper;
use App\Models\Auth\Biodata;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Crypt;
use RealRashid\SweetAlert\Facades\Alert;
use Spatie\Permission\Models\Role as ModelsRole;
class UserExternalController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['title'] = 'Daftar User External';
$data['users'] = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){
$q->whereIn('name', ['reviewer']);
})->where('status', '2')->get();
return view('backend.operator.user_external.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('backend.operator.user_external.create')->withTitle('Tambah User External');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$uuid = Uuid::generate();
$password = InseoHelper::random_password();
$data['id'] = $uuid;
$data['name'] = $request->input('nama');
$data['email'] = $request->input('email');
$data['password_decrypt'] = $password;
$data['password'] = Crypt::encrypt($password);
$data['status'] = '2';
if(User::create($data))
{
$detil['id'] = $uuid;
$detil['noidentitas'] = $request->input('nidn');
$detil['name'] = $request->input('nama');
$detil['fakultas'] = $request->input('fakultas');
$detil['prodi'] = $request->input('prodi');
$detil['email'] = $request->input('email');
$detil['userid_created'] = Auth::user()->id;
Biodata::create($detil);
$values = array('role_id' => '2619bc99-0027-4997-9510-d4736bd26862', 'model_type' => 'App\Models\User', 'model_id' => $uuid);
DB::table('model_has_roles')->insert($values);
Alert::success('Data berhasil disimpan')->persistent('Ok');
$successmessage = "Proses Tambah User External Berhasil.";
}
else
{
Alert::success('Data gagal disimpan')->persistent('Ok');
$successmessage = "Proses Tambah User External Gagal.";
}
return redirect()->route('operator.user-external.index')->with('successMessage', $successmessage);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['title'] = 'Ubah User External';
$data['user'] = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){
$q->whereIn('name', ['reviewer']);
})->find(decrypt($id));
return view('backend.operator.user_external.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$user = User::find(decrypt($id));
$user->name = $request->input('nama');
$user->save();
if($user->save())
{
$biodata = Biodata::find(decrypt($id));
$biodata->noidentitas = $request->input('nidn');
$biodata->name = $request->input('nama');
$biodata->fakultas = $request->input('fakultas');
$biodata->prodi = $request->input('prodi');
$biodata->email = $request->input('email');
$biodata->save();
Alert::success('Data berhasil disimpan')->persistent('Ok');
$successmessage = "Proses Tambah User External Berhasil.";
}
else
{
Alert::success('Data gagal disimpan')->persistent('Ok');
$successmessage = "Proses Tambah User External Gagal.";
}
return redirect()->route('operator.user-external.index')->with('successMessage', $successmessage);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
try {
$biodata = Biodata::find(decrypt($id));
$cari = DB::select("SELECT cek_data_reviewer('".$biodata->noidentitas."')")[0]->cek_data_reviewer;
if ($cari == 1) {
$status = false;
$info = "Maaf data user tidak dapat dihapus karena telah dipilih untuk menjadi reviewer.";
}
else{
$biodata = Biodata::find(decrypt($id));
$biodata->delete();
$user = User::find(decrypt($id));
$user->delete();
DB::table('model_has_roles')->where('model_id',decrypt($id))->delete();
$status = true;
$info = "Data berhasil dihapus.";
}
return response()->json([
'status' => $status,
'info' => $info,
]);
} catch (\Exception $id) {
return response()->json([
'status' => false,
'info' => "Data gagal dihapus.",
]);
}
}
}
......@@ -31,7 +31,7 @@ class User extends Authenticatable
* @var string[]
*/
protected $fillable = [
'id', 'name', 'email', 'password',
'id', 'name', 'email', 'password', 'status', 'password_decrypt'
];
/**
......
......@@ -71,6 +71,16 @@
aria-label="Close"></button>
</div>
<div class="modal-body" style="min-height: 500px !important">
<div class="row col-mb-3">
<label class="col-sm-1 col-form-label">Tipe : </label>
<div class="col-sm-2">
<select class="form-select" id="reqTipe" name="reqTipe">
<option value=''>Semua</option>
<option value="1">Internal</option>
<option value="2">External</option>
</select>
</div>
</div><br>
<table id="example1" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
<tr>
......@@ -78,6 +88,7 @@
<th>NIDN</th>
<th>Fakultas</th>
<th>Prodi</th>
<th>Tipe</th>
<th>Aksi</th>
</tr>
</thead>
......@@ -132,6 +143,10 @@
processing: true,
ajax: {
url: "{{route('operator.getDosen')}}",
"data" : function ( data )
{
data.tipe = $("#reqTipe").val();
},
dataSrc: 'data'
},
columns: [
......@@ -139,6 +154,7 @@
{ data: 'nidn' },
{ data: 'fakultas' },
{ data: 'prodi' },
{ data: 'tipe' },
{ data: 'id_sdm' },
],
columnDefs: [
......@@ -154,6 +170,10 @@
]
});
$('#reqTipe').change(function(){
oTable1.ajax.reload();
});
function createManageBtn() {
return '<button id="manageBtn" type="button" class="btn btn-success btn-sm">Tambah</button>';
}
......
@extends('layouts.master')
@section('title')
Dashboard
@endsection
@section('header')
<div class="page-title">
<h3>Dashboard</h3>
</div>
@endsection
@include('sweet::alert')
@section('contents')
<!-- start page title -->
<div class="page-title-box">
<div class="row align-items-center">
<div class="col-md-8">
<h6 class="page-title">{!! $title !!}</h6>
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="{{ URL::to('user-external') }}">Daftar User External</a></li>
<li class="breadcrumb-item">{!! $title !!}</li>
</ol>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
{!! Form::open(array('url' => route('operator.user-external.store'), 'method' => 'POST', 'id' => 'ff', 'class' => 'form-horizontal')) !!}
{!! csrf_field() !!}
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
{{ Form::text('email', old('email'), array('class' => 'form-control check', 'data-info' => 'email', 'id' => 'email', 'placeholder' => 'Masukkan Email', 'required')) }}
@if ($errors->has('email'))
<span class="help-block">{{$errors->first('email')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-text-input" class="col-sm-2 col-form-label">NIDN</label>
<div class="col-sm-10">
{{ Form::text('nidn', old('nidn'), array('class' => 'form-control check', 'data-info' => 'nidn', 'id' => 'nidn', 'placeholder' => 'Masukkan NIDN', 'required')) }}
@if ($errors->has('nidn'))
<span class="help-block">{{$errors->first('nidn')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Nama</label>
<div class="col-sm-10">
{{ Form::text('nama', old('nama'), array('class' => 'form-control', 'placeholder' => 'Masukkan Nama', 'required')) }}
@if ($errors->has('nama'))
<span class="help-block">{{$errors->first('nama')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Fakultas</label>
<div class="col-sm-10">
{{ Form::text('fakultas', old('fakultas'), array('class' => 'form-control', 'placeholder' => 'Masukkan Fakultas', 'required')) }}
@if ($errors->has('fakultas'))
<span class="help-block">{{$errors->first('fakultas')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Prodi</label>
<div class="col-sm-10">
{{ Form::text('prodi', old('prodi'), array('class' => 'form-control', 'placeholder' => 'Masukkan Prodi', 'required')) }}
@if ($errors->has('prodi'))
<span class="help-block">{{$errors->first('prodi')}}</span>
@endif
</div>
</div>
<div class="mb-0">
<div>
<button type="submit" class="btn btn-primary waves-effect waves-light me-1">
Submit
</button>
<button type="reset" class="btn btn-secondary waves-effect">
Cancel
</button>
</div>
</div>
</form>
</div>
</div>
</div> <!-- end col -->
</div> <!-- end row -->
@endsection
@section('js')
<script src="{{ asset('theme/js/pages/jquery.validate.min.js') }}"></script>
<script>
$('.check').on('focusout', function() {
var info = $(this).data('info');
if(info == 'email')
var url = "{{url('/operator/checkemail')}}";
else if(info == 'nidn')
var url = "{{url('/operator/checknidn')}}";
var value = $(this).val();
var _token = $('input[name="_token"]').val();
$.ajax({
url: url,
method:"POST",
data:{value:value, _token:_token},
success: function(data) {
if(data == '1') {
$('#email').focus();
$('#email').val('');
Swal.fire({
icon: 'error',
text: "Email telah terdaftar!",
});
// return false;
}
else if(data == '2') {
$('#nidn').focus();
$('#nidn').val('');
Swal.fire({
icon: 'error',
text: "NIDN telah terdaftar!",
});
// return false;
}
},
error: function(data){
//error
}
});
});
$(document).ready(function() {
$(function() {
// [ Initialize validation ]
$('#ff').validate({
ignore: '.ignore, .select2-input',
focusInvalid: false,
rules: {
'email': {
required: true,
email: true
},
'password': {
required: true,
minlength: 6,
maxlength: 20
},
},
// Errors //
errorPlacement: function errorPlacement(error, element) {
var $parent = $(element).parents('.input');
// Do not duplicate errors
if ($parent.find('.jquery-validation-error').length) {
return;
}
$parent.append(
error.addClass('jquery-validation-error small form-text invalid-feedback')
);
},
highlight: function(element) {
var $el = $(element);
var $parent = $el.parents('.form-group');
$el.addClass('is-invalid');
// Select2 and Tagsinput
if ($el.hasClass('select2-hidden-accessible') || $el.attr('data-role') === 'tagsinput') {
$el.parent().addClass('is-invalid');
}
},
unhighlight: function(element) {
$(element).parents('.form-group').find('.is-invalid').removeClass('is-invalid');
}
});
});
});
</script>
@endsection
@extends('layouts.master')
@section('title')
Dashboard
@endsection
@section('header')
<div class="page-title">
<h3>Dashboard</h3>
</div>
@endsection
@php
// dd($user->rBiodata);
@endphp
@section('contents')
<!-- start page title -->
<div class="page-title-box">
<div class="row align-items-center">
<div class="col-md-8">
<h6 class="page-title">{!! $title !!}</h6>
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="{{ URL::to('user-external') }}">Daftar User External</a></li>
<li class="breadcrumb-item">{!! $title !!}</li>
</ol>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
{!! Form::model($user, ['route' => ['operator.user-external.update', encrypt($user->id)], 'method'=>'patch', 'class'=>'form-horizontal']) !!}
{!! csrf_field() !!}
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
{{ Form::text('email', null, array('class' => 'form-control check', 'data-info' => 'email', 'id' => 'email', 'placeholder' => 'Masukkan Email', 'readonly')) }}
@if ($errors->has('email'))
<span class="help-block">{{$errors->first('email')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-text-input" class="col-sm-2 col-form-label">NIDN</label>
<div class="col-sm-10">
{{ Form::text('nidn', $user->rBiodata->noidentitas, array('class' => 'form-control check', 'data-info' => 'nidn', 'id' => 'nidn', 'placeholder' => 'Masukkan NIDN', 'required')) }}
@if ($errors->has('nidn'))
<span class="help-block">{{$errors->first('nidn')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Nama</label>
<div class="col-sm-10">
{{ Form::text('nama', $user->name, array('class' => 'form-control', 'placeholder' => 'Masukkan Nama', 'required')) }}
@if ($errors->has('nama'))
<span class="help-block">{{$errors->first('nama')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Fakultas</label>
<div class="col-sm-10">
{{ Form::text('fakultas', $user->rBiodata->fakultas, array('class' => 'form-control', 'placeholder' => 'Masukkan Fakultas', 'required')) }}
@if ($errors->has('fakultas'))
<span class="help-block">{{$errors->first('fakultas')}}</span>
@endif
</div>
</div>
<div class="row mb-3">
<label for="example-search-input" class="col-sm-2 col-form-label">Prodi</label>
<div class="col-sm-10">
{{ Form::text('prodi', $user->rBiodata->prodi, array('class' => 'form-control', 'placeholder' => 'Masukkan Prodi', 'required')) }}
@if ($errors->has('prodi'))
<span class="help-block">{{$errors->first('prodi')}}</span>
@endif
</div>
</div>
<div class="mb-0">
<div>
<button type="submit" class="btn btn-primary waves-effect waves-light me-1">
Submit
</button>
<button type="reset" class="btn btn-secondary waves-effect">
Cancel
</button>
</div>
</div>
</form>
</div>
</div>
</div> <!-- end col -->
</div> <!-- end row -->
@endsection
@section('js')
<script src="{{ asset('theme/js/pages/jquery.validate.min.js') }}"></script>
<script>
$('.check').on('focusout', function() {
var info = $(this).data('info');
if(info == 'email')
var url = "{{url('/operator/checkemail')}}";
else if(info == 'nidn')
var url = "{{url('/operator/checknidn')}}";
var value = $(this).val();
var _token = $('input[name="_token"]').val();
$.ajax({
url: url,
method:"POST",
data:{value:value, _token:_token},
success: function(data) {
if(data == '1') {
$('#email').focus();
$('#email').val('');
Swal.fire({
icon: 'error',
text: "Email telah terdaftar!",
});
// return false;
}
else if(data == '2') {
$('#nidn').focus();
$('#nidn').val('');
Swal.fire({
icon: 'error',
text: "NIDN telah terdaftar!",
});
// return false;
}
},
error: function(data){
//error
}
});
});
$(document).ready(function() {
$(function() {
// [ Initialize validation ]
$('#ff').validate({
ignore: '.ignore, .select2-input',
focusInvalid: false,
rules: {
'email': {
required: true,
email: true
},
'password': {
required: true,
minlength: 6,
maxlength: 20
},
},
// Errors //
errorPlacement: function errorPlacement(error, element) {
var $parent = $(element).parents('.input');
// Do not duplicate errors
if ($parent.find('.jquery-validation-error').length) {
return;
}
$parent.append(
error.addClass('jquery-validation-error small form-text invalid-feedback')
);
},
highlight: function(element) {
var $el = $(element);
var $parent = $el.parents('.form-group');
$el.addClass('is-invalid');
// Select2 and Tagsinput
if ($el.hasClass('select2-hidden-accessible') || $el.attr('data-role') === 'tagsinput') {
$el.parent().addClass('is-invalid');
}
},
unhighlight: function(element) {
$(element).parents('.form-group').find('.is-invalid').removeClass('is-invalid');
}
});
});
});
</script>
@endsection
@extends('layouts.master')
@section('title')
Dashboard
@endsection
@section('header')
<div class="page-title">
<h3>Dashboard</h3>
</div>
@endsection
@section('contents')
<!-- start page title -->
<div class="page-title-box">
<div class="row align-items-center">
<div class="col-md-8">
<h6 class="page-title">{!! $title !!}</h6>
<ol class="breadcrumb m-0">
<li class="breadcrumb-item">{!! $title !!}</li>
</ol>
</div>
<div class="col-md-4">
<div class="float-end d-none d-md-block">
<a href="{{ URL::to('operator/user-external/create') }}" type="button" class="btn btn-primary waves-effect waves-light"> <i class="fas fa-plus-circle"></i> Tambah Data</a>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<table id="datatable" class="table table-bordered dt-responsive" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
<tr>
<th>No.</th>
<th>NIDN</th>
<th>Nama</th>
<th>Akun</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($users as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->rBiodata->noidentitas }}</td>
<td>{{ $item->name }}</td>
<td>
Email : <b>{{ $item->email }}</b><br>
Password : <b>{{ $item->password_decrypt }}</b>
</td>
<td>
<a href="{{ URL::to('operator/user-external/'.Crypt::encrypt($item->id).'/edit') }}" class="btn btn-icon-sm btn-primary"><i class="fas fa-edit"></i></a>
<a href="#!" class="btn btn-icon-sm btn-danger" onclick="confirmDelete('{{ Crypt::encrypt($item->id) }}')"><i class="fas fa-trash"></i></a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div> <!-- end col -->
</div> <!-- end row -->
@endsection
@section('js')
<script src="{{ asset('theme/js/pages/datatables.init.js') }}"></script>
<script>
$("body").on("click", ".delete", function (e) {
e.preventDefault();
var id = $(this).data('id');
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');
}
});
});
function confirmDelete(reqId)
{
Swal.fire({
title: "Apakah Anda Yakin?",
text: "Anda akan menghapus data ini!",
icon: "warning",
showCancelButton: !0,
confirmButtonText: "Ya, Hapus data!",
cancelButtonText: "Tidak, Kembali!",
confirmButtonClass: "btn btn-success mt-2",
cancelButtonClass: "btn btn-danger ms-2 mt-2",
buttonsStyling: !1,
allowOutsideClick: !1,
showLoaderOnConfirm: true
}).then((result) => {
if (result.value){
$.ajax({
url:'{{url("/operator/user-external/")}}/' +reqId,
type:'DELETE',
data:{
"_token": "{{ csrf_token() }}",
},
dataType: "JSON",
success: function (data) {
if(data.status == '1')
{
swal.fire({ title: data.info,
text: "",
icon: "success"}).then(okay => {
if (okay) {
location.reload();
}
});
}
else
swal.fire(data.info, "", "warning");
},
error: function (xhr, ajaxOptions, thrownError) {
swal("Data gagal dihapus.", {
icon: "error",
});
}
});
}
else
{
swal.fire('Batal!', 'Data batal dihapus.', 'error');
}
})
}
</script>
@endsection
......@@ -15,6 +15,9 @@
<li>
<a href="{{ URL::to('/operator/user') }}" class="waves-effect"><i class="ti-user"></i><span>User</span></a>
</li>
<li>
<a href="{{ URL::to('/operator/user-external') }}" class="waves-effect"><i class="ti-user"></i><span>User External</span></a>
</li>
<li>
<a href="javascript: void(0);" class="has-arrow waves-effect">
......
......@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\Operator\UserController;
use App\Http\Controllers\Operator\CheckController;
use App\Http\Controllers\Operator\JenisController;
use App\Http\Controllers\Operator\SelectController;
use App\Http\Controllers\Mahasiswa\AnggotaController;
......@@ -13,18 +14,19 @@ use App\Http\Controllers\Operator\ProposalController;
use App\Http\Controllers\Operator\ReviewerController;
use App\Http\Controllers\Authentication\LoginController;
use App\Http\Controllers\Reviewer\DaftarMonevController;
use App\Http\Controllers\Operator\UserExternalController;
use App\Http\Controllers\Operator\MonevProposalController;
use App\Http\Controllers\Operator\ReviewerMonevController;
use App\Http\Controllers\Reviewer\DaftarSeleksiController;
use App\Http\Controllers\Operator\DaftarProposalController;
use App\Http\Controllers\Operator\JadwalKegiatanController;
use App\Http\Controllers\Dosen\MonevController as DosenMonev;
use App\Http\Controllers\Operator\JenisPenilaianMonevController;
use App\Http\Controllers\Dosen\BiodataController as DosenBiodata;
use App\Http\Controllers\Dosen\SeleksiController as DosenSeleksi;
use App\Http\Controllers\Dosen\KelompokController as DosenKelompok;
use App\Http\Controllers\Dosen\ProposalController as DosenProposal;
use App\Http\Controllers\Mahasiswa\MonevController as MonevMahasiswa;
use App\Http\Controllers\Mahasiswa\LuaranController as LuaranMahasiswa;
......@@ -184,6 +186,12 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
Route::resource('user', UserController::class);
Route::post('/user/remove-role', [UserController::class, 'removeRole'])->name('remove-role');
Route::post('/user/add-role', [UserController::class, 'addRole'])->name('add-role');
Route::resource('user-external', UserExternalController::class);
// cek email apakah sudah ada apa belum
Route::post('checkemail', [CheckController::class, 'email'])->name('checkemail');
Route::post('checknidn', [CheckController::class, 'nidn'])->name('checknidn');
});
Route::name('reviewer.')->prefix('reviewer')->middleware(['role:reviewer|operator|dosen|tendik'])->group(function () {
......
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