Likerts
This commit is contained in:
parent
dea7c349d3
commit
4dd8cbfdb3
|
@ -0,0 +1,137 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Likert;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
class LikertController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('role:admin');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$likerts = Likert::all();
|
||||||
|
return view('admin.likerts.index', compact('likerts'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.likerts.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'score' => 'required|numeric',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$likert = Likert::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'score' => $request->score,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($likert) {
|
||||||
|
return redirect()->route('admin.likerts.index')->with('success', 'Likert created successfully.');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Failed to create likert.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Likert $likert
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(Likert $likert)
|
||||||
|
{
|
||||||
|
return view('admin.likerts.detail', compact('likert'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Likert $likert
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Likert $likert)
|
||||||
|
{
|
||||||
|
return view('admin.likerts.edit', compact('likert'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Models\Likert $likert
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Likert $likert)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'score' => 'required|numeric',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$likert->update([
|
||||||
|
'name' => $request->name,
|
||||||
|
'score' => $request->score,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($likert) {
|
||||||
|
return redirect()->route('admin.likerts.index')->with('success', 'Likert updated successfully.');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Failed to create updated.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Likert $likert
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Likert $likert)
|
||||||
|
{
|
||||||
|
if (!$likert->delete()) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Data has been used on another page'
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Success delete data'
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Requests;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
|
|
||||||
class StoreAddictionRequest extends FormRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function authorize()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public function rules()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Requests;
|
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
|
||||||
|
|
||||||
class UpdateAddictionRequest extends FormRequest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function authorize()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
public function rules()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Likert extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
|
@ -1,94 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Policies;
|
|
||||||
|
|
||||||
use App\Models\Addiction;
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
||||||
|
|
||||||
class AddictionPolicy
|
|
||||||
{
|
|
||||||
use HandlesAuthorization;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view any models.
|
|
||||||
*
|
|
||||||
* @param \App\Models\User $user
|
|
||||||
* @return \Illuminate\Auth\Access\Response|bool
|
|
||||||
*/
|
|
||||||
public function viewAny(User $user)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view the model.
|
|
||||||
*
|
|
||||||
* @param \App\Models\User $user
|
|
||||||
* @param \App\Models\Addiction $addiction
|
|
||||||
* @return \Illuminate\Auth\Access\Response|bool
|
|
||||||
*/
|
|
||||||
public function view(User $user, Addiction $addiction)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can create models.
|
|
||||||
*
|
|
||||||
* @param \App\Models\User $user
|
|
||||||
* @return \Illuminate\Auth\Access\Response|bool
|
|
||||||
*/
|
|
||||||
public function create(User $user)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can update the model.
|
|
||||||
*
|
|
||||||
* @param \App\Models\User $user
|
|
||||||
* @param \App\Models\Addiction $addiction
|
|
||||||
* @return \Illuminate\Auth\Access\Response|bool
|
|
||||||
*/
|
|
||||||
public function update(User $user, Addiction $addiction)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete the model.
|
|
||||||
*
|
|
||||||
* @param \App\Models\User $user
|
|
||||||
* @param \App\Models\Addiction $addiction
|
|
||||||
* @return \Illuminate\Auth\Access\Response|bool
|
|
||||||
*/
|
|
||||||
public function delete(User $user, Addiction $addiction)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore the model.
|
|
||||||
*
|
|
||||||
* @param \App\Models\User $user
|
|
||||||
* @param \App\Models\Addiction $addiction
|
|
||||||
* @return \Illuminate\Auth\Access\Response|bool
|
|
||||||
*/
|
|
||||||
public function restore(User $user, Addiction $addiction)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete the model.
|
|
||||||
*
|
|
||||||
* @param \App\Models\User $user
|
|
||||||
* @param \App\Models\Addiction $addiction
|
|
||||||
* @return \Illuminate\Auth\Access\Response|bool
|
|
||||||
*/
|
|
||||||
public function forceDelete(User $user, Addiction $addiction)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Likert>
|
||||||
|
*/
|
||||||
|
class LikertFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('likerts', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->integer('score');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('likerts');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class LikertSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,7 @@
|
||||||
<h4 class="card-title">Edit Addiction</h4>
|
<h4 class="card-title">Edit Addiction</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="custom-validation" action="{{ route('admin.addictions.update', $addiction->id) }}" method="POST" enctype="multipart/form-data" id="update-user-form') }}" method="POST" enctype="multipart/form-data">
|
<form class="custom-validation" action="{{ route('admin.addictions.update', $addiction->id) }}" method="POST" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
@extends('layouts.master')
|
||||||
|
@section('title', 'Create Likert')
|
||||||
|
@section('content')
|
||||||
|
<div class="page-content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">Likerts</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Master</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.likerts.index') }}">Likerts</a></li>
|
||||||
|
<li class="breadcrumb-item active">Create Likert</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="card-title">Create Likert</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form class="custom-validation" action="{{ route('admin.likerts.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
@method('POST')
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Name</label>
|
||||||
|
<input type="text" name="name" id="name" class="form-control @error('name') is-invalid @enderror" required placeholder="Enter name" value="{{ old('name') }}" />
|
||||||
|
@error('name')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Score</label>
|
||||||
|
<input type="number" name="score" id="score" class="form-control @error('score') is-invalid @enderror" required placeholder="Enter score" value="{{ old('score') }}" />
|
||||||
|
@error('score')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="mb-0 text-end">
|
||||||
|
<div>
|
||||||
|
<button type="reset" class="btn btn-secondary waves-effect me-1">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-primary waves-effect waves-light">
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
|
@ -0,0 +1,58 @@
|
||||||
|
@extends('layouts.master')
|
||||||
|
@section('title', 'Detail Likert')
|
||||||
|
@section('content')
|
||||||
|
<div class="page-content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">Likerts</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Master</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.likerts.index') }}">Likerts</a></li>
|
||||||
|
<li class="breadcrumb-item active">Detail Likert</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="card-title">Detail Likert</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form class="custom-validation" action="{{ route('admin.likerts.update', $likert->id) }}" method="POST" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Name</label>
|
||||||
|
<input type="text" name="name" id="name" class="form-control @error('name') is-invalid @enderror" disabled placeholder="Enter name" value="{{ old('name', $likert->name) }}" />
|
||||||
|
@error('name')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Score</label>
|
||||||
|
<input type="number" name="score" id="score" class="form-control @error('score') is-invalid @enderror" disabled placeholder="Enter score" value="{{ old('score', $likert->score) }}" />
|
||||||
|
@error('score')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
|
@ -0,0 +1,68 @@
|
||||||
|
@extends('layouts.master')
|
||||||
|
@section('title', 'Edit Likert')
|
||||||
|
@section('content')
|
||||||
|
<div class="page-content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">Likerts</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Master</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.likerts.index') }}">Likerts</a></li>
|
||||||
|
<li class="breadcrumb-item active">Edit Likert</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-lg-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="card-title">Edit Likert</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form class="custom-validation" action="{{ route('admin.likerts.update', $likert->id) }}" method="POST" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Name</label>
|
||||||
|
<input type="text" name="name" id="name" class="form-control @error('name') is-invalid @enderror" required placeholder="Enter name" value="{{ old('name', $likert->name) }}" />
|
||||||
|
@error('name')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Score</label>
|
||||||
|
<input type="number" name="score" id="score" class="form-control @error('score') is-invalid @enderror" required placeholder="Enter score" value="{{ old('score', $likert->score) }}" />
|
||||||
|
@error('score')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="mb-0 text-end">
|
||||||
|
<div>
|
||||||
|
<button type="reset" class="btn btn-secondary waves-effect me-1">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-primary waves-effect waves-light">
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
|
@ -0,0 +1,150 @@
|
||||||
|
@extends('layouts.master')
|
||||||
|
@section('title', 'Likert Datas')
|
||||||
|
@section('styles')
|
||||||
|
<!-- DataTables -->
|
||||||
|
<link href="{{ asset('assets/libs/datatables.net-bs5/css/dataTables.bootstrap5.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
|
<!-- Responsive datatable examples -->
|
||||||
|
<link href="{{ asset('assets/libs/datatables.net-responsive-bs5/css/responsive.bootstrap5.min.css') }}" rel="stylesheet" type="text/css" />
|
||||||
|
@endsection
|
||||||
|
@section('content')
|
||||||
|
<div class="page-content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box d-flex align-items-center justify-content-between">
|
||||||
|
<h4 class="mb-sm-0">Likert</h4>
|
||||||
|
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Master</a></li>
|
||||||
|
<li class="breadcrumb-item active">Likert</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="card-title">Likert Data</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<a href="{{ route('admin.likerts.create') }}" class="btn btn-primary mb-3">Create Likert</a>
|
||||||
|
<table id="datatable" class="table table-hover align-middle table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="10px" class="text-center">#</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Score</th>
|
||||||
|
<th width="10px" class="text-center">#</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($likerts as $key => $likert)
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ $loop->iteration }}</td>
|
||||||
|
<td>{{ $likert->name }}</td>
|
||||||
|
<td>{{ $likert->score }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<div class="dropdown d-inline-block">
|
||||||
|
<button class="btn btn-flat-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="fas fa-ellipsis-h align-middle"></i>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-end">
|
||||||
|
<li><a class="dropdown-item" href="{{ route('admin.likerts.edit', $likert->id) }}"><i class="mdi mdi-square-edit-outline align-bottom me-2 text-muted"></i> Edit</a></li>
|
||||||
|
<li><a class="dropdown-item" href="{{ route('admin.likerts.show', $likert->id) }}"><i class="mdi mdi-eye-outline align-bottom me-2 text-muted"></i> Detail</a></li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:void(0);" class="dropdown-item delete" data-id="{{ $likert->id }}">
|
||||||
|
<i class="mdi mdi-delete-outline align-bottom me-2 text-muted"></i> Delete
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- end col -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
@section('scripts')
|
||||||
|
<!-- Required datatable js -->
|
||||||
|
<script src="{{ asset('assets/libs/datatables.net/js/jquery.dataTables.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/libs/datatables.net-bs5/js/dataTables.bootstrap5.min.js') }}"></script>
|
||||||
|
|
||||||
|
<!-- Responsive examples -->
|
||||||
|
<script src="{{ asset('assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/libs/datatables.net-responsive-bs5/js/responsive.bootstrap5.min.js') }}"></script>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$('#datatable').DataTable();
|
||||||
|
$('.delete').click(function (e) {
|
||||||
|
var id = $(this).data('id');
|
||||||
|
e.preventDefault();
|
||||||
|
n.fire({
|
||||||
|
title:"Are you sure?",
|
||||||
|
text:"You won't be able to revert this!",
|
||||||
|
icon:"warning",
|
||||||
|
showCancelButton:!0,
|
||||||
|
confirmButtonColor:"#3085d6",
|
||||||
|
cancelButtonColor:"#d33",
|
||||||
|
confirmButtonText:"Yes, delete it!"
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
var data = {
|
||||||
|
_token: "{{ csrf_token() }}",
|
||||||
|
_method:'delete'
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: `{{ url('admin/likerts')}}/${id}`,
|
||||||
|
dataType: 'json',
|
||||||
|
data: data,
|
||||||
|
type: 'POST',
|
||||||
|
}).done(function(response) {
|
||||||
|
if (response.status) {
|
||||||
|
n.fire({
|
||||||
|
title: "Success!",
|
||||||
|
text: response.message,
|
||||||
|
icon: "success",
|
||||||
|
confirmButtonClass: "btn btn-primary w-xs mt-2",
|
||||||
|
buttonsStyling: !1
|
||||||
|
})
|
||||||
|
setTimeout(
|
||||||
|
function() {
|
||||||
|
window.location.reload(true);
|
||||||
|
}, 1000
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
n.fire({
|
||||||
|
title: "Error!",
|
||||||
|
text: response.message,
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonClass: "btn btn-primary w-xs mt-2",
|
||||||
|
buttonsStyling: !1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).fail(function(response) {
|
||||||
|
var response = response.responseJSON;
|
||||||
|
n.fire({
|
||||||
|
title: "Error!",
|
||||||
|
text: response.message,
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonClass: "btn btn-primary w-xs mt-2",
|
||||||
|
buttonsStyling: !1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
|
@ -26,7 +26,7 @@
|
||||||
<h4 class="card-title">Detail User</h4>
|
<h4 class="card-title">Detail User</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="custom-validation" action="{{ route('admin.users.update', $user->id) }}" method="POST" enctype="multipart/form-data" id="update-user-form') }}" method="POST" enctype="multipart/form-data">
|
<form class="custom-validation" action="{{ route('admin.users.update', $user->id) }}" method="POST" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<h4 class="card-title">Edit User</h4>
|
<h4 class="card-title">Edit User</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="custom-validation" action="{{ route('admin.users.update', $user->id) }}" method="POST" enctype="multipart/form-data" id="update-user-form') }}" method="POST" enctype="multipart/form-data">
|
<form class="custom-validation" action="{{ route('admin.users.update', $user->id) }}" method="POST" enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
<i class="mdi mdi-checkbox-blank-circle align-middle"></i> Addiction
|
<i class="mdi mdi-checkbox-blank-circle align-middle"></i> Addiction
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('admin.likerts.index') }}" class="@if (Request::is('admin/likerts*')) active @endif">
|
||||||
|
<i class="mdi mdi-checkbox-blank-circle align-middle"></i> Likert
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
|
|
||||||
// Addcition
|
// Addcition
|
||||||
Route::resource('addictions', App\Http\Controllers\Admin\AddictionController::class);
|
Route::resource('addictions', App\Http\Controllers\Admin\AddictionController::class);
|
||||||
|
|
||||||
|
// Addcition
|
||||||
|
Route::resource('likerts', App\Http\Controllers\Admin\LikertController::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::middleware('role:user')->name('user.')->group(function () {
|
Route::middleware('role:user')->name('user.')->group(function () {
|
||||||
|
|
Loading…
Reference in New Issue