Commit eba931fe by novanbagus

update user external

parent ee952692
...@@ -78,4 +78,15 @@ class InseoHelper ...@@ -78,4 +78,15 @@ class InseoHelper
return $fak; 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 @@ ...@@ -2,20 +2,21 @@
namespace App\Http\Controllers\Operator; namespace App\Http\Controllers\Operator;
use App\Http\Controllers\Controller;
use DB; use DB;
use URL; use URL;
use Auth; use Auth;
use Uuid; use Uuid;
use Alert; use Alert;
use Crypt; use Crypt;
use App\Models\User;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use App\Models\Reviewer; use App\Models\Reviewer;
use App\Traits\LoginTrait;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Authentication\LoginController; use App\Http\Controllers\Authentication\LoginController;
use App\Traits\LoginTrait;
class ReviewerController extends Controller class ReviewerController extends Controller
{ {
...@@ -196,12 +197,16 @@ class ReviewerController extends Controller ...@@ -196,12 +197,16 @@ class ReviewerController extends Controller
public function getDosen(Request $request) public function getDosen(Request $request)
{ {
$tipe = $request->get('tipe');
$i = 0;
if($tipe == '1' || $tipe == '' || $tipe == null)
{
$client = new Client(); $client = new Client();
$response = $client->request('GET', 'https://i-sdm.unesa.ac.id/api/data-dosen'); $response = $client->request('GET', 'https://i-sdm.unesa.ac.id/api/data-dosen');
$data = json_decode($response->getBody(), true); $data = json_decode($response->getBody(), true);
$result = []; $result = [];
$i = 0;
foreach ($data['data'] as $key => $value) { foreach ($data['data'] as $key => $value) {
$jenjang = substr($value['namasatker'],-2); $jenjang = substr($value['namasatker'],-2);
...@@ -216,10 +221,31 @@ class ReviewerController extends Controller ...@@ -216,10 +221,31 @@ class ReviewerController extends Controller
$result[$i]['nidn'] = $value['nidn']; $result[$i]['nidn'] = $value['nidn'];
$result[$i]['fakultas'] = $value['namaparentsatker']; $result[$i]['fakultas'] = $value['namaparentsatker'];
$result[$i]['prodi'] = $xyz; $result[$i]['prodi'] = $xyz;
$result[$i]['tipe'] = 'Internal';
$result[$i]['id_sdm'] = $value['nidn']; $result[$i]['id_sdm'] = $value['nidn'];
$i++; $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['kode'] = "200";
$hasil['pesan'] = "sukses"; $hasil['pesan'] = "sukses";
......
...@@ -21,7 +21,7 @@ class UserController extends Controller ...@@ -21,7 +21,7 @@ class UserController extends Controller
$data['title'] = 'Daftar User'; $data['title'] = 'Daftar User';
$data['users'] = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){ $data['users'] = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){
$q->whereIn('name', ['dosen','reviewer']); $q->whereIn('name', ['dosen','reviewer']);
})->get(); })->where('status', '1')->get();
$data['roles'] = Role::whereIn('name', ['reviewer', 'operator'])->orderBy('name')->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 ...@@ -31,7 +31,7 @@ class User extends Authenticatable
* @var string[] * @var string[]
*/ */
protected $fillable = [ protected $fillable = [
'id', 'name', 'email', 'password', 'id', 'name', 'email', 'password', 'status', 'password_decrypt'
]; ];
/** /**
......
/*! jQuery Validation Plugin - v1.19.1 - 6/15/2019
* https://jqueryvalidation.org/
* Copyright (c) 2019 Jörn Zaefferer; Licensed MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr.pseudos||a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a});
\ No newline at end of file
...@@ -71,6 +71,16 @@ ...@@ -71,6 +71,16 @@
aria-label="Close"></button> aria-label="Close"></button>
</div> </div>
<div class="modal-body" style="min-height: 500px !important"> <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%;"> <table id="example1" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead> <thead>
<tr> <tr>
...@@ -78,6 +88,7 @@ ...@@ -78,6 +88,7 @@
<th>NIDN</th> <th>NIDN</th>
<th>Fakultas</th> <th>Fakultas</th>
<th>Prodi</th> <th>Prodi</th>
<th>Tipe</th>
<th>Aksi</th> <th>Aksi</th>
</tr> </tr>
</thead> </thead>
...@@ -132,6 +143,10 @@ ...@@ -132,6 +143,10 @@
processing: true, processing: true,
ajax: { ajax: {
url: "{{route('operator.getDosen')}}", url: "{{route('operator.getDosen')}}",
"data" : function ( data )
{
data.tipe = $("#reqTipe").val();
},
dataSrc: 'data' dataSrc: 'data'
}, },
columns: [ columns: [
...@@ -139,6 +154,7 @@ ...@@ -139,6 +154,7 @@
{ data: 'nidn' }, { data: 'nidn' },
{ data: 'fakultas' }, { data: 'fakultas' },
{ data: 'prodi' }, { data: 'prodi' },
{ data: 'tipe' },
{ data: 'id_sdm' }, { data: 'id_sdm' },
], ],
columnDefs: [ columnDefs: [
...@@ -154,6 +170,10 @@ ...@@ -154,6 +170,10 @@
] ]
}); });
$('#reqTipe').change(function(){
oTable1.ajax.reload();
});
function createManageBtn() { function createManageBtn() {
return '<button id="manageBtn" type="button" class="btn btn-success btn-sm">Tambah</button>'; 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 @@ ...@@ -15,6 +15,9 @@
<li> <li>
<a href="{{ URL::to('/operator/user') }}" class="waves-effect"><i class="ti-user"></i><span>User</span></a> <a href="{{ URL::to('/operator/user') }}" class="waves-effect"><i class="ti-user"></i><span>User</span></a>
</li> </li>
<li>
<a href="{{ URL::to('/operator/user-external') }}" class="waves-effect"><i class="ti-user"></i><span>User External</span></a>
</li>
<li> <li>
<a href="javascript: void(0);" class="has-arrow waves-effect"> <a href="javascript: void(0);" class="has-arrow waves-effect">
......
...@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route; ...@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
use App\Http\Controllers\DashboardController; use App\Http\Controllers\DashboardController;
use App\Http\Controllers\Operator\UserController; use App\Http\Controllers\Operator\UserController;
use App\Http\Controllers\Operator\CheckController;
use App\Http\Controllers\Operator\JenisController; use App\Http\Controllers\Operator\JenisController;
use App\Http\Controllers\Operator\SelectController; use App\Http\Controllers\Operator\SelectController;
use App\Http\Controllers\Mahasiswa\AnggotaController; use App\Http\Controllers\Mahasiswa\AnggotaController;
...@@ -13,18 +14,19 @@ use App\Http\Controllers\Operator\ProposalController; ...@@ -13,18 +14,19 @@ use App\Http\Controllers\Operator\ProposalController;
use App\Http\Controllers\Operator\ReviewerController; use App\Http\Controllers\Operator\ReviewerController;
use App\Http\Controllers\Authentication\LoginController; use App\Http\Controllers\Authentication\LoginController;
use App\Http\Controllers\Reviewer\DaftarMonevController; use App\Http\Controllers\Reviewer\DaftarMonevController;
use App\Http\Controllers\Operator\UserExternalController;
use App\Http\Controllers\Operator\MonevProposalController; use App\Http\Controllers\Operator\MonevProposalController;
use App\Http\Controllers\Operator\ReviewerMonevController; use App\Http\Controllers\Operator\ReviewerMonevController;
use App\Http\Controllers\Reviewer\DaftarSeleksiController; use App\Http\Controllers\Reviewer\DaftarSeleksiController;
use App\Http\Controllers\Operator\DaftarProposalController; use App\Http\Controllers\Operator\DaftarProposalController;
use App\Http\Controllers\Operator\JadwalKegiatanController; use App\Http\Controllers\Operator\JadwalKegiatanController;
use App\Http\Controllers\Dosen\MonevController as DosenMonev; use App\Http\Controllers\Dosen\MonevController as DosenMonev;
use App\Http\Controllers\Operator\JenisPenilaianMonevController; use App\Http\Controllers\Operator\JenisPenilaianMonevController;
use App\Http\Controllers\Dosen\BiodataController as DosenBiodata; use App\Http\Controllers\Dosen\BiodataController as DosenBiodata;
use App\Http\Controllers\Dosen\SeleksiController as DosenSeleksi; use App\Http\Controllers\Dosen\SeleksiController as DosenSeleksi;
use App\Http\Controllers\Dosen\KelompokController as DosenKelompok; use App\Http\Controllers\Dosen\KelompokController as DosenKelompok;
use App\Http\Controllers\Dosen\ProposalController as DosenProposal; use App\Http\Controllers\Dosen\ProposalController as DosenProposal;
use App\Http\Controllers\Mahasiswa\MonevController as MonevMahasiswa; use App\Http\Controllers\Mahasiswa\MonevController as MonevMahasiswa;
use App\Http\Controllers\Mahasiswa\LuaranController as LuaranMahasiswa; use App\Http\Controllers\Mahasiswa\LuaranController as LuaranMahasiswa;
...@@ -184,6 +186,12 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () { ...@@ -184,6 +186,12 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
Route::resource('user', UserController::class); Route::resource('user', UserController::class);
Route::post('/user/remove-role', [UserController::class, 'removeRole'])->name('remove-role'); Route::post('/user/remove-role', [UserController::class, 'removeRole'])->name('remove-role');
Route::post('/user/add-role', [UserController::class, 'addRole'])->name('add-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 () { 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