add module tagihan
parent
e3aa0d5f30
commit
eda2e94a70
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$users = App\User::orderBy('created_at','desc')->paginate(5);
|
||||
return view('users.index', ['users' => $users]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,132 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('site-name','Sistem Informasi SPP')
|
||||
@section('page-name', (isset($tagihan) ? 'Ubah Tagihan' : 'Tagihan Baru'))
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<form action="{{ (isset($tagihan) ? route('tagihan.update', $tagihan->id) : route('tagihan.create')) }}" method="post" class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">@yield('page-name')</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if($errors->any())
|
||||
<div class="alert alert-danger">
|
||||
@foreach($errors->all() as $error)
|
||||
{{ $error }}<br>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label class="form-label">Nama</label>
|
||||
<input type="text" class="form-control" name="nama" placeholder="Nama" value="{{ isset($tagihan) ? $tagihan->nama : old('nama') }}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Jumlah</label>
|
||||
<input type="number" class="form-control" name="jumlah" value="{{ isset($tagihan) ? $tagihan->jumlah : old('jumlah') }}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-label">Peserta</div>
|
||||
<div class="custom-switches-stacked">
|
||||
<label class="custom-switch">
|
||||
<input type="radio" name="peserta" value="1" class="custom-switch-input" {{ isset($tagihan) ? ($tagihan->wajib_semua == 1 ? 'checked' : '') : 'checked' }}>
|
||||
<span class="custom-switch-indicator"></span>
|
||||
<span class="custom-switch-description">Wajib Semua Siswa</span>
|
||||
</label>
|
||||
<label class="custom-switch">
|
||||
<input type="radio" name="peserta" value="2" class="custom-switch-input" {{ isset($tagihan) ? (($tagihan->kelas_id != null) ? 'checked' : '') : '' }}>
|
||||
<span class="custom-switch-indicator"></span>
|
||||
<span class="custom-switch-description">Hanya Kelas</span>
|
||||
</label>
|
||||
<label class="custom-switch">
|
||||
<input type="radio" name="peserta" value="3" class="custom-switch-input" {{ isset($tagihan) ? (($tagihan->kelas_id == null && $tagihan->wajib_semua == null) ? 'checked' : '') : '' }}>
|
||||
<span class="custom-switch-indicator"></span>
|
||||
<span class="custom-switch-description">Hanya Siswa</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: {{ isset($tagihan) ? (($tagihan->kelas_id != null) ? 'block' : 'none') : 'none' }}" id="form-kelas">
|
||||
<label class="form-label">Kelas</label>
|
||||
<select class="form-control" name="kelas_id" id="hanya-kelas">
|
||||
@foreach($kelas as $item)
|
||||
<option value="{{ $item->id }}" {{ isset($tagihan) ? (($tagihan->kelas_id == $item->id) ? 'selected' : '') : '' }}>
|
||||
{{ $item->nama }} - {{ isset($item->periode) ? $item->periode->nama : '' }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" style="display: {{ isset($tagihan) ? (($tagihan->kelas_id == null && $tagihan->wajib_semua == null) ? 'block' : 'none') : 'none' }}" id="form-siswa">
|
||||
<label class="form-label">Siswa</label>
|
||||
<select class="form-control" name="siswa_id[]" id="hanya-siswa" multiple>
|
||||
@foreach($siswa as $item)
|
||||
<option value="{{ $item->id }}" {{ isset($tagihan) ? (($tagihan->wajib_semua == null && $tagihan->kelas_id == null) ? (in_array($item->id, $tagihan->siswa->pluck('id')->toArray()) ? 'selected' : '') : '') : '' }}>
|
||||
{{ $item->nama }} - {{ $item->kelas->nama }} {{ isset($item->kelas->periode) ? "(". $item->kelas->periode->nama .")" : ''}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer text-right">
|
||||
<div class="d-flex">
|
||||
<a href="{{ url()->previous() }}" class="btn btn-link">Batal</a>
|
||||
<button type="submit" class="btn btn-primary ml-auto">Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('css')
|
||||
<link href="{{ asset('assets/plugins/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
<style>
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
color: black;
|
||||
}
|
||||
.select2{
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
@section('js')
|
||||
<script>
|
||||
require(['jquery', 'selectize','select2'], function ($, selectize) {
|
||||
$(document).ready(function () {
|
||||
$('#select-beast').selectize({});
|
||||
});
|
||||
$('#hanya-kelas').select2({
|
||||
placeholder: "Pilih Kelas",
|
||||
});
|
||||
$('#hanya-siswa').select2({
|
||||
placeholder: "Pilih Siswa",
|
||||
});
|
||||
|
||||
$('.custom-switch-input').change(function(){
|
||||
if(this.value == 2){
|
||||
$('#form-kelas').show()
|
||||
$('#form-siswa').hide()
|
||||
|
||||
$('#hanya-kelas').prop('required', true)
|
||||
$('#hanya-siswa').prop('required', false)
|
||||
}else if(this.value == 3){
|
||||
$('#form-kelas').hide()
|
||||
$('#form-siswa').show()
|
||||
|
||||
$('#hanya-kelas').prop('required', false)
|
||||
$('#hanya-siswa').prop('required', true)
|
||||
}else{
|
||||
$('#form-kelas').hide()
|
||||
$('#form-siswa').hide()
|
||||
|
||||
$('#hanya-kelas').prop('required', false)
|
||||
$('#hanya-siswa').prop('required', false)
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endsection
|
@ -0,0 +1,114 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('site-name','Sistem Informasi SPP')
|
||||
@section('page-name','Tagihan')
|
||||
|
||||
@section('content')
|
||||
<div class="page-header">
|
||||
<h1 class="page-title">
|
||||
@yield('page-name')
|
||||
</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">@yield('page-name')</h3>
|
||||
<a href="{{ route('tagihan.create') }}" class="btn btn-outline-primary btn-sm ml-5">Tambah Tagihan</a>
|
||||
</div>
|
||||
@if(session()->has('msg'))
|
||||
<div class="alert alert-{{ session()->get('type') }}" id="message" style="border-radius: 0px !important">
|
||||
@if(session()->get('type') == 'success')
|
||||
<i class="fe fe-check mr-2" aria-hidden="true"></i>
|
||||
@else
|
||||
<i class="fe fe-alert-triangle mr-2" aria-hidden="true"></i>
|
||||
@endif
|
||||
{{ session()->get('msg') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table card-table table-hover table-vcenter text-nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-1">No.</th>
|
||||
<th>Nama</th>
|
||||
<th>Jumlah</th>
|
||||
<th>Peserta</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($tagihan as $index => $item)
|
||||
<tr>
|
||||
<td><span class="text-muted">{{ $index+1 }}</span></td>
|
||||
<td>
|
||||
{{ $item->nama }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $item->jumlah_idr }}
|
||||
</td>
|
||||
<td>
|
||||
@if($item->wajib_semua != null)
|
||||
<p>Wajib Semua</p>
|
||||
@elseif($item->kelas_id != null)
|
||||
<p>{{ $item->kelas->nama }} {{ isset($item->kelas->periode) ? ' - '.$item->kelas->periode->nama : '' }}</p>
|
||||
@elseif($item->wajib_semua == null && $item->kelas_id == null)
|
||||
@foreach ($item->role as $role)
|
||||
{{ $role->siswa->nama }}{{ " (".$role->siswa->kelas->nama.")" }},
|
||||
@endforeach
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a class="icon" href="{{ route('tagihan.edit', $item->id) }}" title="edit item">
|
||||
<i class="fe fe-edit"></i>
|
||||
</a>
|
||||
<a class="icon btn-delete" href="#!" data-id="{{ $item->id }}" title="delete item">
|
||||
<i class="fe fe-trash"></i>
|
||||
</a>
|
||||
<form action="{{ route('tagihan.destroy', $item->id) }}" method="POST" id="form-{{ $item->id }}">
|
||||
@csrf
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="d-flex">
|
||||
<div class="ml-auto mb-0">
|
||||
{{ $tagihan->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('js')
|
||||
<script>
|
||||
require(['jquery', 'sweetalert'], function ($, sweetalert) {
|
||||
$(document).ready(function () {
|
||||
|
||||
$(document).on('click','.btn-delete', function(){
|
||||
formid = $(this).attr('data-id');
|
||||
swal({
|
||||
title: 'Anda yakin ingin menghapus?',
|
||||
text: 'tagihan yang dihapus tidak dapat dikembalikan',
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
}).then((result) => {
|
||||
if (result) {
|
||||
$('#form-' + formid).submit();
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
Loading…
Reference in New Issue