Commit b661a232 by Aan Choesni Herlingga

view team from i-sdm

parent f8c92c8f
<?php
namespace App\Http\Controllers\Webprofile\Backend;
use App\Http\Controllers\Controller;
use App\Models\Webprofile\Setting;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
use Alert;
class PersonController extends Controller
{
public function index()
{
$unit = $this->listUnit();
$pick = Setting::where('name_setting', 'team')->first();
$listTeam = null;
if ($pick) {
$listTeam = $this->listTeam($pick->value_setting);
}
$data = [
'unit' => $unit,
'pick' => $pick,
'listTeam' => $listTeam,
];
return view('webprofile.backend.person.index', $data)->withTitle('Person');
}
public function store(Request $request)
{
$data = $request->except('_token');
$data['show_name_setting'] = 'TEAM';
$data['name_setting'] = 'team';
$data['userid_created'] = auth()->user()->id;
$data['userid_updated'] = auth()->user()->id;
Setting::updateOrCreate(['name_setting' => $data['name_setting']], $data);
Alert::success('Data berhasil disimpan')->persistent('Ok');
return redirect()->route('person.index');
}
private function listUnit()
{
try {
$client = new Client();
$URI = 'https://i-sdm.unesa.ac.id/api/satker/asdfLKJH12309==';
$response = $client->get($URI);
$statuscode = $response->getStatusCode();
if (200 === $statuscode) {
// Do something
$responseJson = json_decode($response->getBody(), true);
} elseif (304 === $statuscode) {
// Nothing to do
} elseif (404 === $statuscode) {
// Clean up DB or something like this
$responseJson = [];
} else {
}
foreach ($responseJson as $value) {
$unit[$value['idsatker']] = $value['namasatker'];
}
} catch (\Throwable $th) {
//throw $th;
$unit[] = 'error';
}
return $unit;
}
private function listTeam($unit)
{
try {
$client = new Client();
$URI = 'http://i-sdm.unesa.ac.id/api/pegawai-per-prodi/asdfLKJH12309==/'.$unit;
$response = $client->get($URI);
$statuscode = $response->getStatusCode();
if (200 === $statuscode) {
// Do something
$responseJson = json_decode($response->getBody(), true);
} elseif (304 === $statuscode) {
// Nothing to do
} elseif (404 === $statuscode) {
// Clean up DB or something like this
$responseJson = [];
} else {
}
} catch (\Throwable $th) {
//throw $th;
}
return $responseJson;
}
public function showDosen()
{
$data = $request->except('_token');
$data['show_name_setting'] = 'Dosen';
$data['name_setting'] = 'dosen';
$data['userid_created'] = auth()->user()->id;
$data['userid_updated'] = auth()->user()->id;
Setting::updateOrCreate(['name_setting' => $data['name_setting']], $data);
Alert::success('Data berhasil disimpan')->persistent('Ok');
return redirect()->route('person.index');
}
public function showTendik()
{
$data = $request->except('_token');
$data['show_name_setting'] = 'TENDIK';
$data['name_setting'] = 'tendik';
$data['userid_created'] = auth()->user()->id;
$data['userid_updated'] = auth()->user()->id;
Setting::updateOrCreate(['name_setting' => $data['name_setting']], $data);
Alert::success('Data berhasil disimpan')->persistent('Ok');
return redirect()->route('person.index');
}
}
<?php
namespace App\Http\Controllers\Webprofile\Front;
use App\Http\Controllers\Controller;
use App\Models\Webprofile\Design;
use App\Models\Webprofile\Menu;
use App\Models\Webprofile\Setting;
use GuzzleHttp\Client;
use Session;
class PersonController extends Controller
{
public function index($name)
{
$setting = webprofilesetting();
if (!Session::has('selected_language')) {
session(['selected_language' => 'id']);
}
if (Session::get('selected_language') == 'id') {
$data = $this->getDataId($setting, $name);
return view('webprofile.front.'.$setting['theme'].'.team', $data);
} elseif (Session::get('selected_language') == 'en') {
$data = $this->getDataEn($setting, $name);
return view('webprofile.front.'.$setting['theme'].'.en.team', $data);
}
}
public function getDataId($setting, $name)
{
$setting = webprofilesetting();
$data = $this->getData($name);
$menu = Menu::orderby('urutan', 'asc')->get();
$widget_right = Design::where('name_design', 'widget_right')->orderBy('urutan', 'ASC')->get();
$widget_left = Design::where('name_design', 'widget_left')->orderBy('urutan', 'ASC')->get();
$footer = Design::where('name_design', 'like', '%footer_row%')->get();
$data = [
'setting' => $setting,
'data' => $data,
'menu' => $menu,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
'footer' => $footer,
'name' => $name,
];
return $data;
}
public function getDataEn($setting, $name)
{
$setting = webprofilesetting();
$data = $this->getData($name);
$menu = Menu::with(['rEn'])->orderby('urutan', 'asc')->get();
$widget_right = Design::where('name_design', 'widget_right')->orderBy('urutan', 'ASC')->get();
$widget_left = Design::where('name_design', 'widget_left')->orderBy('urutan', 'ASC')->get();
$footer = Design::where('name_design', 'like', '%footer_row%')->get();
$data = [
'setting' => $setting,
'data' => $data,
'menu' => $menu,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
'footer' => $footer,
'name' => $name,
];
return $data;
}
public function getData($name)
{
$pick = Setting::where('name_setting', 'team')->first();
$listTeam = null;
if ($pick) {
$listTeam = $this->listTeam($pick->value_setting);
}
$team = [];
if ($name == 'lecturer') {
$team = $listTeam[1];
} elseif ($name == 'academic-staff') {
$team = $listTeam[0];
}
return $team;
}
private function listTeam($unit)
{
try {
$client = new Client();
$URI = 'http://i-sdm.unesa.ac.id/api/pegawai-per-prodi/asdfLKJH12309==/'.$unit;
$response = $client->get($URI);
$statuscode = $response->getStatusCode();
if (200 === $statuscode) {
// Do something
$responseJson = json_decode($response->getBody(), true);
} elseif (304 === $statuscode) {
// Nothing to do
} elseif (404 === $statuscode) {
// Clean up DB or something like this
$responseJson = [];
} else {
}
} catch (\Throwable $th) {
//throw $th;
$responseJson = [];
}
return $responseJson;
}
}
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).html()).select();
document.execCommand("copy");
$temp.remove();
swal("Copied!", "", "success");
}
\ No newline at end of file
...@@ -30,4 +30,7 @@ return [ ...@@ -30,4 +30,7 @@ return [
'title_show' => 'Title Show', 'title_show' => 'Title Show',
'as' => 'As', 'as' => 'As',
'keys' => 'Keyword', 'keys' => 'Keyword',
'unit' => 'Unit',
'lecturer' => 'Lecturer',
'employe' => 'Academic Staff',
]; ];
...@@ -30,4 +30,7 @@ return [ ...@@ -30,4 +30,7 @@ return [
'title_show' => 'Judul ditampilkan', 'title_show' => 'Judul ditampilkan',
'as' => 'Sebagai', 'as' => 'Sebagai',
'keys' => 'Kata Kunci', 'keys' => 'Kata Kunci',
'unit' => 'Unit',
'lecturer' => 'Dosen',
'employe' => 'Tenaga Kependidikan',
]; ];
...@@ -42,5 +42,8 @@ ...@@ -42,5 +42,8 @@
<a href="{{ url('webprofile/layouts') }}"><span class="fa fa-tasks"></span> <span class="xn-text">@lang('feature.layout')</span></a> <a href="{{ url('webprofile/layouts') }}"><span class="fa fa-tasks"></span> <span class="xn-text">@lang('feature.layout')</span></a>
</li> </li>
<li> <li>
<a href="{{ url('webprofile/settingperson') }}"><span class="fa fa-edit"></span><span class="xn-text">@lang('label.unit')</span></a>
</li>
<li>
<a href="{{ url('webprofile/settings') }}"><span class="fa fa-gears"></span><span class="xn-text">@lang('feature.setting')</span></a> <a href="{{ url('webprofile/settings') }}"><span class="fa fa-gears"></span><span class="xn-text">@lang('feature.setting')</span></a>
</li> </li>
@extends('webprofile.backend.layouts.master')
@section('title')
{{ $title }}
@stop
@section('assets')
<link rel="stylesheet" href="{!! asset('backend/assets/select2/select2.min.css') !!}">
@endsection
@section('breadcrumbs')
<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
<li class="active">@lang('feature.create_setting')</li>
@stop
@section('content')
{!! Form::open(array('url' => route('person.store'), 'method' => 'POST', 'id' => 'setting', 'class' => 'form-horizontal')) !!}
{!! csrf_field() !!}
<!-- page start-->
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><strong>@lang('label.update')</strong> @lang('label.unit')</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="form-group @if ($errors->has('value_setting')) has-error @endif">
<label class="col-md-2 control-label">@lang('label.name') @lang('feature.setting')</label>
<div class="col-md-10">
{{ Form::select('value_setting', $unit, $pick->value_setting, ['class' => 'form-control select2', 'style' => 'width: 100%; font-size: 14pt;', 'id' => 'value_setting', 'placeholder' => app('translator')->getFromJson('feature.category'), 'required']) }}
@if ($errors->has('value_setting'))
<label id="login-error" class="error" for="login">{{$errors->first('value_setting')}}</label>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-footer">
<a href="{{ url('webprofile/settings') }}" class="btn btn-default pull-right">@lang('label.cancel')</a>
<button class="btn btn-info pull-right">@lang('label.save')</button>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<h1>@lang('label.lecturer')</h1>
<div style="padding: 10px; color: blue; font-size: 14px;">
URL : <a href="{{ url('team/lecturer') }}" target="_blank">{{ url('lecturer') }}</a>
<label id="urllecturer" hidden>team/lecturer</label>
<button type="button" onclick="copyToClipboard('#urllecturer')" class="btn btn-info btn-xs">Copy URL</button>
</div>
<table class="table table-hover" width="100%">
<tr>
<th width="20%">NIP</th>
<th>Nama</th>
</tr>
@if(array_key_exists(1, $listTeam))
@foreach ($listTeam[1] as $value)
<tr>
<td>{{ $value['nip'] }}</td>
<td>{{ $value['namalengkap'] }}</td>
</tr>
@endforeach
@endif
</table>
<h1>@lang('label.employe')</h1>
<div style="padding: 10px; color: blue; font-size: 14px;">
URL : <a href="{{ url('team/employe') }}" target="_blank">{{ url('employe') }}</a>
<label id="urlemploye" hidden>team/employe</label>
<button type="button" onclick="copyToClipboard('#urlemploye')" class="btn btn-info btn-xs">Copy URL</button>
</div>
<table class="table table-hover" width="100%">
<tr>
<th width="20%">NIP</th>
<th>Nama</th>
</tr>
@if(array_key_exists(0, $listTeam))
@foreach ($listTeam[0] as $value)
<tr>
<td>{{ $value['nip'] }}</td>
<td>{{ $value['namalengkap'] }}</td>
</tr>
@endforeach
@endif
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
<!-- page end-->
@stop
@section('script')
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-datepicker.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-timepicker.min.js') !!}
{!! Html::script('backend/js/plugins/bootstrap/bootstrap-file-input.js') !!}
{!! Html::script('backend/assets/select2/select2.full.min.js') !!}
<script type="text/javascript">
$('#value_setting').select2();
</script>
{{ Html::script('js/master/team.js') }}
@stop
@extends('webprofile.front.jollyany.master')
@section('meta')
<meta name="{!! Str::slug(app('translator')->getFromJson('label.'.$name)) !!}" content="custom"/>
<meta name="description" content="">
<meta name="author" content="{{ $setting['header_admin'] }}">
@endsection
@section('content')
<section class="post-wrapper-top jt-shadow clearfix">
<div class="container">
<div class="col-lg-12">
<h2>@lang('label.'.$name)</h2>
</div>
</div>
</section><!-- end post-wrapper-top -->
<section class="blog-wrapper">
<div class="container">
<div class="row">
<div id="main-content" class="col-md-12" role="main" align="justify">
<table class="table table-bordered" style="vertical-align: baseline;">
<thead>
<tr>
<th style="width: 5%;">NO</th>
<th style="width: 15%;">PHOTO</th>
<th>INFORMATION</th>
</tr>
</thead>
<tbody>
@php
$no = 1;
@endphp
@foreach ($data as $value)
<tr>
<td style="text-align: center; color: black;">{{ $no++ }}</td>
<td style="color: black; text-align:center;">
<img style="width: 200px; height: auto;" src="https://i-sdm.unesa.ac.id/assets/images/kepegawaian/pegawai//{!! $value['nip'] !!}.jpg" class="user-image" alt="{{ $value['namalengkap'] }}"><br>
</td>
<td style="color: black;">
<table width="100%">
<tr>
<td width="10%">NIP</td>
<td>: {{ $value['nip'] }}</td>
</tr>
<tr>
<td>NAMA</td>
<td>: {{ $value['namalengkap'] }}</td>
</tr>
</table>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div><!-- end title -->
</div><!-- end container -->
</section><!--end white-wrapper -->
@endsection
@extends('webprofile.front.jollyany.master')
@section('meta')
<meta name="{!! Str::slug(app('translator')->getFromJson('label.'.$name)) !!}" content="custom"/>
<meta name="description" content="">
<meta name="author" content="{{ $setting['header_admin'] }}">
@endsection
@section('content')
<section class="post-wrapper-top jt-shadow clearfix">
<div class="container">
<div class="col-lg-12">
<h2>@lang('label.'.$name)</h2>
</div>
</div>
</section><!-- end post-wrapper-top -->
<section class="blog-wrapper">
<div class="container">
<div class="row">
<div id="main-content" class="col-md-12" role="main" align="justify">
<table class="table table-bordered" style="vertical-align: baseline;">
<thead>
<tr>
<th style="width: 5%;">NO</th>
<th style="width: 15%;">FOTO</th>
<th>INFORMASI</th>
</tr>
</thead>
<tbody>
@php
$no = 1;
@endphp
@foreach ($data as $value)
<tr>
<td style="text-align: center; color: black;">{{ $no++ }}</td>
<td style="color: black; text-align:center;">
<img style="width: 200px; height: auto;" src="https://i-sdm.unesa.ac.id/assets/images/kepegawaian/pegawai//{!! $value['nip'] !!}.jpg" class="user-image" alt="{{ $value['namalengkap'] }}"><br>
</td>
<td style="color: black;">
<table width="100%">
<tr>
<td width="10%">NIP</td>
<td>: {{ $value['nip'] }}</td>
</tr>
<tr>
<td>NAMA</td>
<td>: {{ $value['namalengkap'] }}</td>
</tr>
</table>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div><!-- end title -->
</div><!-- end container -->
</section><!--end white-wrapper -->
@endsection
...@@ -29,6 +29,9 @@ Route::group(['middleware' => 'auth'], function () { ...@@ -29,6 +29,9 @@ Route::group(['middleware' => 'auth'], function () {
Route::post('storepage', 'MenuController@storepage')->name('menu.storepage'); Route::post('storepage', 'MenuController@storepage')->name('menu.storepage');
Route::get('menu_up/{id}', 'MenuController@menu_up')->name('menu_up'); Route::get('menu_up/{id}', 'MenuController@menu_up')->name('menu_up');
Route::get('menu_down/{id}', 'MenuController@menu_down')->name('menu_down'); Route::get('menu_down/{id}', 'MenuController@menu_down')->name('menu_down');
Route::get('settingperson', 'PersonController@index')->name('person.index');
Route::post('settingperson', 'PersonController@store')->name('person.store');
}); });
}); });
}); });
<?php <?php
Route::group(['namespace' => 'Webprofile\Front'], function () { Route::group(['namespace' => 'Webprofile\Front'], function () {
Route::get('/', 'FrontController@index'); Route::get('/', 'FrontController@index');
Route::get('page/{id}', 'PageController@index')->name('page'); Route::get('page/{id}', 'PageController@index')->name('page');
Route::get('post/{id}', 'PostController@index')->name('post'); Route::get('post/{id}', 'PostController@index')->name('post');
Route::get('archive', 'ArchiveController@index')->name('archive'); Route::get('archive', 'ArchiveController@index')->name('archive');
Route::get('category/{id}','CategoryController@index')->name('category'); Route::get('category/{id}', 'CategoryController@index')->name('category');
Route::get('information/{id}', 'InformationController@index')->name('infomation'); Route::get('information/{id}', 'InformationController@index')->name('infomation');
Route::get('agenda', 'AgendaController@index')->name('agenda'); Route::get('agenda', 'AgendaController@index')->name('agenda');
Route::get('error', 'ErrorController@index')->name('error'); Route::get('error', 'ErrorController@index')->name('error');
Route::get('download', 'DownloadController@index')->name('download'); Route::get('download', 'DownloadController@index')->name('download');
Route::get('downloadlink/{data}', 'DownloadController@downloadFile')->name('downloadFile'); Route::get('downloadlink/{data}', 'DownloadController@downloadFile')->name('downloadFile');
Route::get('team/{name}', 'PersonController@index')->name('team');
}); });
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