update
parent
7c367a02bc
commit
032ca31b47
|
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\SampahBelumTerkelola;
|
||||
|
||||
class SampahBelumTerkelolaController extends Controller
|
||||
{
|
||||
protected $template = 'modules.sampah-belum';
|
||||
protected $route = 'modules.sampah-belum';
|
||||
protected $title = 'Sampah Belum Terkelola';
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = $this->title;
|
||||
$data['route'] = $this->route;
|
||||
return view($this->template.'.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function grid(Request $request)
|
||||
{
|
||||
if(session('group_alias') == 'sekolah'){
|
||||
$data = SampahBelumTerkelola::where('ms_sekolah_id',session('sekolah_id'))
|
||||
->orderBy('tahun','DESC')
|
||||
->orderBy('bulan','ASC');
|
||||
}else{
|
||||
if(session('kabupaten_id') != ''){
|
||||
$data = SampahBelumTerkelola::whereHas('sekolah',function($query){
|
||||
$query->where('ms_kabupaten_id',session('kabupaten_id'));
|
||||
})->orderBy('tahun','DESC')
|
||||
->orderBy('bulan','ASC');
|
||||
|
||||
}else{
|
||||
$data = SampahBelumTerkelola::with(['sekolah'])->orderBy('tahun','DESC')
|
||||
->orderBy('bulan','ASC');
|
||||
}
|
||||
}
|
||||
|
||||
if(@request()->tahun){
|
||||
$tahun = request()->tahun;
|
||||
}else{
|
||||
$tahun = date('Y');
|
||||
}
|
||||
|
||||
$data->where('tahun',$tahun);
|
||||
|
||||
|
||||
$_data = [];
|
||||
|
||||
|
||||
|
||||
foreach ($data->get() as $key => $row) {
|
||||
|
||||
$action = '';
|
||||
$action .= '<a href="'.url('sampah/update/'.encode_id($row->SampahBelumTerkelolaId)).'" class="btn text-white btn-primary btn-sm">Edit</a>';
|
||||
|
||||
|
||||
$sekolah = '';
|
||||
$sekolah .= @$row->sekolah->nama_sekolah.'<br>';
|
||||
$sekolah .= '<div class="d-flex">';
|
||||
$sekolah .= '<span class="badge bg-warning-light text-warning">'.@$row->sekolah->npsn.'</span> ';
|
||||
$sekolah .= '<span class="badge bg-success-light text-success">'.@$row->sekolah->kabupaten->name.'</span> ';
|
||||
$sekolah .= '<span class="badge bg-primary-light text-primary">'.@$row->sekolah->kecamatan->name.'</span> ';
|
||||
$sekolah .= '</div>';
|
||||
$sekolah .= '<span class="badge bg-info-light text-info">Level '.levelAdiwiyata($row->sekolah->npsn).'</span>';
|
||||
// $sekolah .= '<span class="badge bg-secondary text-secondary text-left mt-1">'.@$row->sekolah->profile->alamat_sekolah.'</span> ';
|
||||
|
||||
$_data[] = [
|
||||
'no' => $key+1,
|
||||
'action' => $action,
|
||||
'id' => encode_id($row->SampahBelumTekelolaId),
|
||||
'tahun' => $row->tahun,
|
||||
'sekolah' => $sekolah,
|
||||
'bulan' => monthtString($row->bulan),
|
||||
'organik' => $row->organik,
|
||||
'mitra' => $row->mitra,
|
||||
'sampah_anorganik' => $row->sampah_anorganik,
|
||||
'b3' => $row->b3,
|
||||
'residu' => $row->residu,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
// return response()->json($_data); // Return the data as a JSON response
|
||||
return response()->json($_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
if(@$request->secure_id){
|
||||
$data = SampahBelumTerkelola::find(decode_id($request->secure_id));
|
||||
$data->organik = $request->organik;
|
||||
$data->sampah_anorganik = $request->anorganik;
|
||||
$data->b3 = $request->b3;
|
||||
$data->residu = $request->residu;
|
||||
$data->save();
|
||||
}else{
|
||||
$data = SampahBelumTerkelola::updateOrCreate([
|
||||
'tahun' => date('Y'),
|
||||
'bulan' => $request->bulan,
|
||||
'ms_sekolah_id' => session('sekolah_id'),
|
||||
],[
|
||||
'tahun' => date('Y'),
|
||||
'ms_sekolah_id' => session('sekolah_id'),
|
||||
'bulan' => $request->bulan,
|
||||
'organik' => $request->organik,
|
||||
'sampah_anorganik' => $request->anorganik,
|
||||
'b3' => $request->b3,
|
||||
'residu' => $request->residu,
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Berhasil update data',
|
||||
'type' => 'success',
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
|
||||
dd($th);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
$data['title'] = $this->title;
|
||||
$data['route'] = $this->route;
|
||||
$data['item'] = SampahBelumTerkelola::find(decode_id($id));
|
||||
return view($this->template.'.form', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SampahBelumTerkelola extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'sampah_belum_terkelola';
|
||||
protected $guarded = [];
|
||||
protected $primaryKey = 'SampahBelumTerkelolaId';
|
||||
|
||||
public function sekolah()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Master\Sekolah::class,'ms_sekolah_id','MsSekolahId');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sampah_belum_terkelola', function (Blueprint $table) {
|
||||
$table->id('SampahBelumTerkelolaId');
|
||||
$table->integer('ms_sekolah_id');
|
||||
$table->year('tahun');
|
||||
$table->integer('bulan');
|
||||
$table->string('organik');
|
||||
$table->string('sampah_anorganik');
|
||||
$table->string('b3');
|
||||
$table->string('residu');
|
||||
$table->timestampsTz();
|
||||
$table->softdeletesTz();
|
||||
|
||||
$table->foreign('ms_sekolah_id')->references('MsSekolahId')->on('ms_sekolah')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('sampah_terkelola', function (Blueprint $table) {
|
||||
$table->string('residu')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('table_sampah_belum_terkelola');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
@extends('layouts.master')
|
||||
|
||||
@section('page-css')
|
||||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/datagrid/datatables/datatables.bundle.css')}}">
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-4" class="card">
|
||||
<form action="{{ route($route.'.store') }}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="secure_id" value="{{ encode_id($item->SampahTerkelolaId) }}">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0 fw-500">Form Edit Sampah Terkelola</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Tahun</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input type="text" class="form-control" name="tahun" value="{{ date('Y') }}" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Bulan</label>
|
||||
<div class="col-12 pr-1">
|
||||
<select name="bulan" disabled class="form-control is-required @error('bulan') is-invalid @enderror" id="">
|
||||
<option value="">-- Pilih Bulan --</option>
|
||||
<option {{ $item->bulan == '1' ? 'selected' : '' }} value="1">Januari</option>
|
||||
<option {{ $item->bulan == '2' ? 'selected' : '' }} value="2">Februari</option>
|
||||
<option {{ $item->bulan == '3' ? 'selected' : '' }} value="3">Maret</option>
|
||||
<option {{ $item->bulan == '4' ? 'selected' : '' }} value="4">April</option>
|
||||
<option {{ $item->bulan == '5' ? 'selected' : '' }} value="5">Mei</option>
|
||||
<option {{ $item->bulan == '6' ? 'selected' : '' }} value="6">Juni</option>
|
||||
<option {{ $item->bulan == '7' ? 'selected' : '' }} value="7">Juli</option>
|
||||
<option {{ $item->bulan == '8' ? 'selected' : '' }} value="8">Agustus</option>
|
||||
<option {{ $item->bulan == '9' ? 'selected' : '' }} value="9">September</option>
|
||||
<option {{ $item->bulan == '10' ? 'selected' : '' }} value="10">Oktober</option>
|
||||
<option {{ $item->bulan == '11' ? 'selected' : '' }} value="11">November</option>
|
||||
<option {{ $item->bulan == '12' ? 'selected' : '' }} value="12">Desember</option>
|
||||
</select>
|
||||
@error('bulan')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah Organik</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="organik" value="{{ @$item->organik }}" class="form-control numberInput @error('organik') is-invalid @enderror" placeholder="Masukan Jumlah Sampah Organik">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('organik')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah An Organik</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="anorganik" value="{{ @$item->sampah_anorganik }}" class="form-control numberInput @error('anorganik') is-invalid @enderror" placeholder="Masukan Jumlah Sampah An Organik">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('anorganik')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah B3</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="b3" value="{{ @$item->b3 }}" class="form-control numberInput @error('b3') is-invalid @enderror" placeholder="Masukan Jumlah Sampah B3">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('b3')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Mitra Minyak Jelantah</label>
|
||||
<div class="col-12 pr-1">
|
||||
<select name="mitra" class="form-control is-required @error('mitra') is-invalid @enderror" id="">
|
||||
<option value="">-- Pilih Mitra --</option>
|
||||
<option {{ $item->mitra == 'Rumah Sosial Kutub' ? 'selected' : '' }} value="Rumah Sosial Kutub">Rumah Sosial Kutub</option>
|
||||
<option {{ $item->mitra == 'T-Care' ? 'selected' : '' }} value="T-Care">T-Care</option>
|
||||
<option {{ $item->mitra == 'TUKR' ? 'selected' : '' }} value="TUKR">TUKR</option>
|
||||
</select>
|
||||
@error('mitra')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Minyak Jelantah</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="minyak_jelantah" value="{{ @$item->minyak_jelantah }}" class="form-control numberInput @error('minyak_jelantah') is-invalid @enderror" placeholder="Masukan Jumlah Minyak Jelantah">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">L</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('minyak_jelantah')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="{{ url('sampah') }}" class="btn btn-secondary" data-dismiss="modal"><i class="fal fa-arrow-left"></i> Kembali</a>
|
||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('page-js')
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,420 @@
|
|||
@extends('layouts.master')
|
||||
@section('page-css')
|
||||
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/datagrid/datatables/datatables.bundle.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('assets/css/bootstrap-table.min.css')}}">
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="subheader">
|
||||
<h1 class="subheader-title">
|
||||
{{$title}}
|
||||
</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div id="panel-4" class="panel">
|
||||
<div class="panel-container show">
|
||||
<div class="panel-content">
|
||||
<div id="toolbar" class="d-flex gap-2 align-items-center">
|
||||
<div>
|
||||
<span>Filter :</span>
|
||||
</div>
|
||||
<div>
|
||||
<select name="tahun" class="form-control numberInput filterTahun">
|
||||
@for ($i = date('Y')-3; date('Y') >= $i; $i++)
|
||||
<option {{ $i == date('Y') ? 'selected' : '' }} value="{{$i}}">{{$i}}</option>
|
||||
@endfor
|
||||
</select>
|
||||
</div>
|
||||
{{-- <a class="btn btn-secondary btn-filter btn-sm text-white"><i class="fal fa-filter text-white"></i> Filter</a> --}}
|
||||
@if(session('group_alias') == 'sekolah')
|
||||
<div>
|
||||
<a data-toggle="modal" data-target="#modal" class="btn btn-success btn-sm text-white"><i class="fal fa-plus text-white"></i> Tambah Data</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<table class="table w-100 wrap"
|
||||
data-search="true"
|
||||
data-toggle="table"
|
||||
data-pagination="true"
|
||||
data-toolbar="#toolbar"
|
||||
data-show-refresh="false"
|
||||
data-url="{{route($route.'.grid')}}"
|
||||
data-ajax-options='{"xhrFields": {"withCredentials": true}}'
|
||||
data-sort-name="ids"
|
||||
data-sort-order="desc"
|
||||
data-page-size="10"
|
||||
data-id-field="id"
|
||||
data-query-params="queryParams"
|
||||
id="grid-data">
|
||||
<thead class="bg-primary-light text-primary">
|
||||
<tr>
|
||||
{{-- <th data-field="action">#</th> --}}
|
||||
<th data-field="no">No</th>
|
||||
@if(session('group_alias') == 'sekolah')
|
||||
<th data-field="action">#</th>
|
||||
@endif
|
||||
@if(session('group_alias') != 'sekolah')
|
||||
<th data-field="sekolah">Sekolah</th>
|
||||
@endif
|
||||
{{-- <th data-field="mitra">Mitra</th> --}}
|
||||
<th data-field="tahun">Tahun</th>
|
||||
<th data-field="bulan">Bulan</th>
|
||||
<th data-field="organik">Organik (Kg)</th>
|
||||
<th data-field="sampah_anorganik">An Organik (Kg)</th>
|
||||
<th data-field="b3">B3 (Kg)</th>
|
||||
<th data-field="residu">Residu (Kg)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<!-- datatable end -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-secondary">
|
||||
<h5><b>Tambah Data Sampah Belum Terkelola</b></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="{{ route($route.'.store') }}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Tahun</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input type="text" class="form-control" name="tahun" value="{{ date('Y') }}" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Bulan</label>
|
||||
<div class="col-12 pr-1">
|
||||
<select name="bulan" class="form-control is-required @error('bulan') is-invalid @enderror" id="" required>
|
||||
<option value="">-- Pilih Bulan --</option>
|
||||
<option value="1">Januari</option>
|
||||
<option value="2">Februari</option>
|
||||
<option value="3">Maret</option>
|
||||
<option value="4">April</option>
|
||||
<option value="5">Mei</option>
|
||||
<option value="6">Juni</option>
|
||||
<option value="7">Juli</option>
|
||||
<option value="8">Agustus</option>
|
||||
<option value="9">September</option>
|
||||
<option value="10">Oktober</option>
|
||||
<option value="11">November</option>
|
||||
<option value="12">Desember</option>
|
||||
</select>
|
||||
@error('bulan')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah Organik</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="organik" class="form-control numberInput @error('organik') is-invalid @enderror" placeholder="Masukan Jumlah Sampah Organik" required>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('organik')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah An Organik</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="anorganik" class="form-control numberInput @error('anorganik') is-invalid @enderror" placeholder="Masukan Jumlah Sampah An Organik" required>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('anorganik')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah B3</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="b3" class="form-control numberInput @error('b3') is-invalid @enderror" placeholder="Masukan Jumlah Sampah B3" required>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('b3')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah Residu</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="residu" class="form-control numberInput @error('residu') is-invalid @enderror" placeholder="Masukan Jumlah Sampah Residu" required>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('residu')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
|
||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('page-js')
|
||||
<script src="{{asset('assets/js/datagrid/datatables/datatables.bundle.js')}}"></script>
|
||||
<script src="{{asset('assets/js/bootstrap-table.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
var $table = $('#grid-data');
|
||||
$('.btn-filter').on('click',function(){
|
||||
$('#filter').toggleClass('d-none');
|
||||
});
|
||||
function queryParams(params) {
|
||||
$('#toolbar').find('input[name], select').each(function() {
|
||||
params[$(this).attr('name')] = $(this).val()
|
||||
})
|
||||
|
||||
return params
|
||||
}
|
||||
$(function() {
|
||||
$('.filterTahun').on('change',function(){
|
||||
$table.bootstrapTable('refresh');
|
||||
});
|
||||
});
|
||||
$("#grid-data").on("click", ".tolak", function() {
|
||||
var base_url = $(this).attr('data-href');
|
||||
var id = $(this).attr('data-id');
|
||||
swal({
|
||||
title: "Tolak Kuesioner!",
|
||||
text: "Apa anda yakin ingin tolak kuesioner ini ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#BF3131",
|
||||
confirmButtonText: "Tolak Sekarang",
|
||||
cancelButtonText: "Batal",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
},
|
||||
function(isConfirm) {
|
||||
if(isConfirm){
|
||||
|
||||
request = $.ajax({
|
||||
url: base_url,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
type: "GET",
|
||||
});
|
||||
|
||||
// Callback handler that will be called on success
|
||||
request.done(function(response, textStatus, jqXHR){
|
||||
console.log(response);
|
||||
toastr.success("Berhasil Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
window.location.href = '{{url("/kuesioner")}}';
|
||||
history.pushState(null, null, location.href);
|
||||
window.onpopstate = function () {
|
||||
history.go(1);
|
||||
};
|
||||
});
|
||||
|
||||
// Callback handler that will be called on failure
|
||||
request.fail(function (jqXHR, textStatus, errorThrown){
|
||||
toastr.error(
|
||||
"Gagal "+textStatus, errorThrown
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$("#grid-data").on("click", ".verifikasi", function() {
|
||||
var base_url = $(this).attr('data-href');
|
||||
var id = $(this).attr('data-id');
|
||||
swal({
|
||||
title: "Verifikasi Kuesioner!",
|
||||
text: "Apa anda yakin ingin verifikasi kuesioner ini ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3F7D58",
|
||||
confirmButtonText: "Approve Sekarang",
|
||||
cancelButtonText: "Batal",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
},
|
||||
function(isConfirm) {
|
||||
if(isConfirm){
|
||||
|
||||
request = $.ajax({
|
||||
url: base_url,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
type: "GET",
|
||||
});
|
||||
|
||||
// Callback handler that will be called on success
|
||||
request.done(function(response, textStatus, jqXHR){
|
||||
console.log(response);
|
||||
toastr.success("Berhasil Login", 'Berhasil!', {positionClass: 'toast-bottom-right', containerId: 'toast-bottom-right'});
|
||||
window.location.href = '{{url("/kuesioner")}}';
|
||||
history.pushState(null, null, location.href);
|
||||
window.onpopstate = function () {
|
||||
history.go(1);
|
||||
};
|
||||
});
|
||||
|
||||
// Callback handler that will be called on failure
|
||||
request.fail(function (jqXHR, textStatus, errorThrown){
|
||||
toastr.error(
|
||||
"Gagal "+textStatus, errorThrown
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$('select').on("select2:selecting", function(e) {
|
||||
var selectorOrigin = this.id;
|
||||
var id = e.params.args.data.id;
|
||||
|
||||
|
||||
if(selectorOrigin=='provinsi'){
|
||||
$('#loading-spinner').show();
|
||||
clear('kabupaten');
|
||||
selector = 'kabupaten';
|
||||
url_to = 'kabupaten';
|
||||
getSelect(id, selector, url_to);
|
||||
}
|
||||
|
||||
if(selectorOrigin=='kabupaten'){
|
||||
$('#loading-spinner').show();
|
||||
clear('kecamatan');
|
||||
selector = 'kecamatan';
|
||||
url_to = 'kecamatan';
|
||||
getSelect(id, selector, url_to);
|
||||
}
|
||||
if(selectorOrigin=='kecamatan'){
|
||||
$('#loading-spinner').show();
|
||||
clear('sekolah');
|
||||
selector = 'sekolah';
|
||||
url_to = 'sekolah';
|
||||
getSelect(id, selector, url_to);
|
||||
}
|
||||
});
|
||||
|
||||
function clear(elementId) {
|
||||
$('#' + elementId).empty();
|
||||
$('#' + elementId).select2();
|
||||
}
|
||||
|
||||
function getSelect(id, selectTo, urlTo, selected = "") {
|
||||
id = id;
|
||||
var base_url = "{{url('/')}}";
|
||||
//alert(id);
|
||||
destino = "#" + selectTo;
|
||||
valor = $('#' + id).find(":selected").val();
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: base_url + "/get/" + urlTo,
|
||||
xhrFields: {
|
||||
withCredentials: true
|
||||
},
|
||||
data: {
|
||||
_token: '{{csrf_token()}}',
|
||||
id: id
|
||||
}
|
||||
}).done(function(msg) {
|
||||
obj = msg.data;
|
||||
|
||||
if (obj.length > 0) {
|
||||
//Clear the current options
|
||||
$(destino).empty();
|
||||
|
||||
if(selectTo=='kabupaten'){
|
||||
$(destino).append('<option value="">-PILIH KABUPATEN/KOTA-</option>').select2("val", "0");
|
||||
|
||||
|
||||
|
||||
$.each(obj, function(index) {
|
||||
value = obj[index].id;
|
||||
text = obj[index].name;
|
||||
$(destino).append('<option value=' + value + '>' + text + '</option>');
|
||||
});
|
||||
console.log(selected)
|
||||
if (selected) {
|
||||
$(destino).val(selected).trigger('change');
|
||||
selected = "";
|
||||
}
|
||||
}
|
||||
|
||||
if(selectTo=='kecamatan'){
|
||||
$(destino).append('<option value="">-PILIH KECAMATAN-</option>').select2("val", "0");
|
||||
|
||||
$.each(obj, function(index) {
|
||||
value = obj[index].id;
|
||||
text = obj[index].name;
|
||||
$(destino).append('<option value=' + value + '>' + text + '</option>');
|
||||
});
|
||||
console.log(selected)
|
||||
if (selected) {
|
||||
$(destino).val(selected).trigger('change');
|
||||
selected = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if(selectTo=='provinsi'){
|
||||
$(destino).empty().append('<option value="0">-PILIH PROVINSI-</option>').select2("val", "0");
|
||||
}
|
||||
if(selectTo=='kabupaten'){
|
||||
$(destino).empty().append('<option value="0">-PILIH KABUPATEN/KOTA-</option>').select2("val", "0");
|
||||
}
|
||||
if(selectTo=='kecamatan'){
|
||||
$(destino).empty().append('<option value="0">-PILIH KECAMATAN-</option>').select2("val", "0");
|
||||
}
|
||||
|
||||
}
|
||||
$('#loading-spinner').hide();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -62,6 +62,7 @@
|
|||
<th data-field="organik">Organik (Kg)</th>
|
||||
<th data-field="sampah_anorganik">An Organik (Kg)</th>
|
||||
<th data-field="b3">B3 (Kg)</th>
|
||||
<th data-field="b3">Residu (Kg)</th>
|
||||
<th data-field="minyak_jelantah">Minyak Jelantah (Liter)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -120,7 +121,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah Organik</label>
|
||||
<div class="col-12 pr-1">
|
||||
|
|
@ -136,7 +137,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah An Organik</label>
|
||||
<div class="col-12 pr-1">
|
||||
|
|
@ -152,7 +153,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Sampah B3</label>
|
||||
<div class="col-12 pr-1">
|
||||
|
|
@ -168,6 +169,22 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Residu</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="text" name="residu" class="form-control numberInput @error('residu') is-invalid @enderror" placeholder="Masukan Jumlah Sampah Residu" required>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button">Kg</button>
|
||||
</div>
|
||||
</div>
|
||||
@error('residu')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Http\Controllers\AjaxController;
|
|||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\KuesionerController;
|
||||
use App\Http\Controllers\SampahController;
|
||||
use App\Http\Controllers\SampahBelumTerkelolaController;
|
||||
use App\Http\Controllers\Master\IndikatorController;
|
||||
use App\Http\Controllers\Master\KomponenController;
|
||||
use App\Http\Controllers\Master\FormKriteriaController;
|
||||
|
|
@ -88,6 +89,12 @@ Route::name('sampah.')->prefix('sampah')->group(function () {
|
|||
Route::get('/grid',[SampahController::class,'grid'])->name('grid');
|
||||
});
|
||||
|
||||
Route::name('sampah-belum.')->prefix('sampah-belum-terkelola')->group(function () {
|
||||
Route::resource('/',SampahBelumTerkelolaController::class);
|
||||
Route::get('/update/{id}',[SampahBelumTerkelolaController::class,'update'])->name('update');
|
||||
Route::get('/grid',[SampahBelumTerkelolaController::class,'grid'])->name('grid');
|
||||
});
|
||||
|
||||
Route::name('usulan.')->prefix('usulan')->group(function () {
|
||||
|
||||
Route::name('csak.')->prefix('csak')->group(function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue