Factor
This commit is contained in:
parent
4dd8cbfdb3
commit
2de620a3e3
|
@ -0,0 +1,137 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Factor;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
class FactorController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('role:admin');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$factors = Factor::all();
|
||||||
|
return view('admin.factors.index', compact('factors'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.factors.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',
|
||||||
|
'status' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$factor = Factor::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'status' => $request->status,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($factor) {
|
||||||
|
return redirect()->route('admin.factors.index')->with('success', 'Factor created successfully.');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Failed to create factor.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Factor $factor
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(Factor $factor)
|
||||||
|
{
|
||||||
|
return view('admin.factors.detail', compact('factor'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Factor $factor
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Factor $factor)
|
||||||
|
{
|
||||||
|
return view('admin.factors.edit', compact('factor'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Models\Factor $factor
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Factor $factor)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'status' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$factor->update([
|
||||||
|
'name' => $request->name,
|
||||||
|
'status' => $request->status,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($factor) {
|
||||||
|
return redirect()->route('admin.factors.index')->with('success', 'Factor updated successfully.');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Failed to update factor.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Models\Factor $factor
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Factor $factor)
|
||||||
|
{
|
||||||
|
if (!$factor->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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Factor extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Factor>
|
||||||
|
*/
|
||||||
|
class FactorFactory 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('factors', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->enum('status', ['active', 'inactive'])->default('active');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('factors');
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class FactorSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
@extends('layouts.master')
|
||||||
|
@section('title', 'Create Factor')
|
||||||
|
@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">Factors</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.factors.index') }}">Factors</a></li>
|
||||||
|
<li class="breadcrumb-item active">Create Factor</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 Factor</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form class="custom-validation" action="{{ route('admin.factors.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">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Status</label>
|
||||||
|
<select name="status" id="statusAddiction" class="form-select" required>
|
||||||
|
<option value="active">Active</option>
|
||||||
|
<option value="inactive">Inactive</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</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 Factor')
|
||||||
|
@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">Factors</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.factors.index') }}">Factors</a></li>
|
||||||
|
<li class="breadcrumb-item active">Detail Factor</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 Factor</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form class="custom-validation" action="{{ route('admin.factors.update', $factor->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', $factor->name) }}" />
|
||||||
|
@error('name')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Status</label>
|
||||||
|
<select name="status" id="statusAddiction" class="form-select" disabled>
|
||||||
|
<option value="active" {{ $factor->status == 'active' ? 'selected' : '' }}>Active</option>
|
||||||
|
<option value="inactive" {{ $factor->status == 'inactive' ? 'selected' : '' }}>Inactive</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
|
@ -0,0 +1,68 @@
|
||||||
|
@extends('layouts.master')
|
||||||
|
@section('title', 'Edit Factor')
|
||||||
|
@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">Factors</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.factors.index') }}">Factors</a></li>
|
||||||
|
<li class="breadcrumb-item active">Edit Factor</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 Factor</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form class="custom-validation" action="{{ route('admin.factors.update', $factor->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', $factor->name) }}" />
|
||||||
|
@error('name')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label>Status</label>
|
||||||
|
<select name="status" id="statusAddiction" class="form-select" required>
|
||||||
|
<option value="active" {{ $factor->status == 'active' ? 'selected' : '' }}>Active</option>
|
||||||
|
<option value="inactive" {{ $factor->status == 'inactive' ? 'selected' : '' }}>Inactive</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</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,156 @@
|
||||||
|
@extends('layouts.master')
|
||||||
|
@section('title', 'Factor 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">Factor</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">Factor</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="card-title">Factor Data</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<a href="{{ route('admin.factors.create') }}" class="btn btn-primary mb-3">Create Factor</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 class="text-center">Status</th>
|
||||||
|
<th width="10px" class="text-center">#</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($factors as $key => $factor)
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">{{ $loop->iteration }}</td>
|
||||||
|
<td>{{ $factor->name }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
@if ($factor->status == 'active')
|
||||||
|
<span class="badge badge-success">{{ ucwords($factor->status) }}</span>
|
||||||
|
@else
|
||||||
|
<span class="badge badge-danger">{{ ucwords($factor->status) }}</span>
|
||||||
|
@endif
|
||||||
|
</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.factors.edit', $factor->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.factors.show', $factor->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="{{ $factor->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/factors')}}/${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
|
|
@ -36,6 +36,11 @@
|
||||||
<i class="mdi mdi-checkbox-blank-circle align-middle"></i> Likert
|
<i class="mdi mdi-checkbox-blank-circle align-middle"></i> Likert
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('admin.factors.index') }}" class="@if (Request::is('admin/factors*')) active @endif">
|
||||||
|
<i class="mdi mdi-checkbox-blank-circle align-middle"></i> Factor
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
|
|
||||||
// Addcition
|
// Addcition
|
||||||
Route::resource('likerts', App\Http\Controllers\Admin\LikertController::class);
|
Route::resource('likerts', App\Http\Controllers\Admin\LikertController::class);
|
||||||
|
|
||||||
|
// Addcition
|
||||||
|
Route::resource('factors', App\Http\Controllers\Admin\FactorController::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::middleware('role:user')->name('user.')->group(function () {
|
Route::middleware('role:user')->name('user.')->group(function () {
|
||||||
|
|
Loading…
Reference in New Issue