Compare commits

..

10 Commits

Author SHA1 Message Date
novitabening a364dbf24a edit deskripsi 2 2025-01-01 22:50:48 +07:00
novitabening 3ca34ccf52 edit deskripsi 2024-12-24 21:45:35 +07:00
misbahsurur 0f3ab13ade fix redirect 2024-12-24 21:11:37 +07:00
misbahsurur 502b420a04 add user in history 2024-12-21 20:44:01 +07:00
misbahsurur c69b228c8a change logo 2024-12-20 22:14:14 +07:00
misbahsurur bc0cde4c6f fix dashboard admin 2024-12-20 21:30:40 +07:00
misbahsurur 7ac456577d History detail & fixing 2024-12-20 21:20:37 +07:00
misbahsurur e7063b16f7 fix alert 2024-12-20 19:09:18 +07:00
misbahsurur 49caec88af remove column in addiction test 2024-12-20 18:35:35 +07:00
misbahsurur 3b8990d6a3 user feature 2024-12-13 21:45:54 +07:00
45 changed files with 899 additions and 525 deletions

View File

@ -58,6 +58,7 @@ public function store(Request $request)
'name' => $request->name,
'code' => $request->code,
'description' => $request->description,
'solution' => $request->solution,
'min_percentage' => $request->min_percentage,
'max_percentage' => $request->max_percentage,
'status' => $request->status,
@ -117,6 +118,7 @@ public function update(Request $request, Addiction $addiction)
'name' => $request->name,
'code' => $request->code,
'description' => $request->description,
'solution' => $request->solution,
'min_percentage' => $request->min_percentage,
'max_percentage' => $request->max_percentage,
'status' => $request->status,

View File

@ -3,6 +3,9 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Addiction;
use App\Models\Factor;
use App\Models\Item;
use Carbon\Carbon;
use Illuminate\Http\Request;
@ -15,17 +18,9 @@ public function __construct()
public function index()
{
// Get current hour of the day
$hour = Carbon::now()->hour;
// Determine greeting based on the hour
if ($hour >= 5 && $hour < 12) {
$greeting = 'Good Morning';
} elseif ($hour >= 12 && $hour < 18) {
$greeting = 'Good Afternoon';
} else {
$greeting = 'Good Evening';
}
return view('admin.dashboard', compact('greeting'));
$addictionCount = Addiction::count();
$itemCount = Item::count();
$factorCount = Factor::count();
return view('admin.dashboard', compact('addictionCount', 'itemCount', 'factorCount'));
}
}

View File

@ -54,7 +54,7 @@ public function store(Request $request)
*/
public function show(History $history)
{
//
return view('admin.histories.show', compact('history'));
}
/**

View File

@ -28,6 +28,6 @@ class HomeController extends Controller
*/
public function index()
{
return view('home');
return view('welcome');
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\Addiction;
use App\Models\History;
use App\Models\Item;
use App\Models\Likert;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
public function __construct()
{
$this->middleware('role:user');
}
public function index()
{
$addictions = Addiction::where('status', 'active')
->orderBy('min_percentage', 'desc')
->get();
return view('user.dashboard', compact('addictions'));
}
public function history()
{
$histories = History::with('user', 'addiction')
->where('user_id', Auth::id())
->orderBy('created_at', 'desc')
->get();
return view('user.history', compact('histories'));
}
public function detailHistory($id)
{
$history = History::with('user', 'addiction', 'details')->find($id);
return view('user.history-detail', compact('history'));
}
public function addiction()
{
$items = Item::where('status', 'active')->orderBy('created_at', 'asc')->get();
// $items = Item::where('status', 'active')->inRandomOrder()->get();
$likerts = Likert::orderBy('score')->get();
return view('user.addiction', compact('items', 'likerts'));
}
public function storeAddiction(Request $request)
{
$items = $request->items;
$values = $request->values;
$answers = $request->answers;
$maxLikert = Likert::orderBy('score', 'desc')->first()->score;
$userScores = [];
$maxScores = [];
foreach ($values as $key => $value) {
$score = Likert::find($answers[$key])->score;
$userScores[] = $value * $score;
$maxScores[] = $value * $maxLikert;
}
$totalUserScore = array_sum($userScores);
$totalMaxScore = array_sum($maxScores);
$percentage = round(($totalUserScore / $totalMaxScore) * 100, 2);
$addiction = Addiction::where('min_percentage', '<=', $percentage)
->where('max_percentage', '>=', $percentage)
->where('status', 'active')
->first();
if (is_null($addiction)) {
return redirect()->back()->with('error', 'Terjadi kesalahan saat mencari jenis kecanduan');
}
$history = History::create([
'user_id' => Auth::id(),
'addiction_id' => $addiction->id,
'result' => $percentage,
]);
foreach ($items as $key => $item) {
$history->details()->create([
'item_id' => $item,
'likert_id' => $answers[$key],
]);
}
return redirect()->route('user.history')->with('success', 'Berhasil menambahkan riwayat');
}
}

View File

@ -20,4 +20,9 @@ public function addiction()
{
return $this->belongsTo(Addiction::class, 'addiction_id', 'id');
}
public function details()
{
return $this->hasMany(HistoryDetail::class, 'history_id', 'id');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class HistoryDetail extends Model
{
use HasFactory;
protected $guarded = [];
public function history()
{
return $this->belongsTo(History::class, 'history_id', 'id');
}
public function item()
{
return $this->belongsTo(Item::class, 'item_id', 'id');
}
public function likert()
{
return $this->belongsTo(Likert::class, 'likert_id', 'id');
}
}

View File

@ -42,4 +42,9 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
];
public function histories()
{
return $this->hasMany(History::class, 'user_id', 'id');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\HistoryDetail>
*/
class HistoryDetailFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
//
];
}
}

View File

@ -0,0 +1,34 @@
<?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('history_details', function (Blueprint $table) {
$table->id();
$table->foreignId('history_id')->constrained()->onDelete('cascade');
$table->foreignId('item_id')->constrained()->onDelete('cascade');
$table->foreignId('likert_id')->constrained()->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('history_details');
}
};

View File

@ -0,0 +1,32 @@
<?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::table('addictions', function (Blueprint $table) {
$table->text('solution')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('addictions', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,19 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class HistoryDetailSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
public/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

BIN
public/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 15 KiB

1
public/site.webmanifest Normal file
View File

@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

View File

@ -69,6 +69,16 @@
@enderror
</div>
<div class="mb-3">
<label class="form-label">Solution</label>
<textarea name="solution" id="solution" rows="5" class="form-control @error('solution') is-invalid @enderror" placeholder="Enter solution">{{ old('solution') }}</textarea>
@error('solution')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="mb-3">
<label class="form-label">Status</label>
<select name="status" id="statusAddiction" class="form-select" required>

View File

@ -69,6 +69,16 @@
@enderror
</div>
<div class="mb-3">
<label class="form-label">Solution</label>
<textarea name="solution" id="solution" rows="5" class="form-control @error('solution') is-invalid @enderror" placeholder="Enter solution" disabled>{{ old('solution', $addiction->solution) }}</textarea>
@error('solution')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="mb-3">
<label class="form-label">Status</label>
<select name="status" id="statusAddiction" class="form-select" disabled>

View File

@ -69,6 +69,16 @@
@enderror
</div>
<div class="mb-3">
<label class="form-label">Solution</label>
<textarea name="solution" id="solution" rows="5" class="form-control @error('solution') is-invalid @enderror" placeholder="Enter solution">{{ old('solution', $addiction->solution) }}</textarea>
@error('solution')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="mb-3">
<label class="form-label">Status</label>
<select name="status" id="statusAddiction" class="form-select" required>

View File

@ -22,15 +22,16 @@
<h4 class="card-title">Addiction Data</h4>
<a href="{{ route('admin.addictions.create') }}" class="btn btn-primary mb-3">Create Addiction</a>
<div class="table-responsive">
<table id="datatable" class="table align-middle">
<table id="datatable" class="table align-middle text-wrap w-100">
<thead>
<tr>
<th width="10px" class="text-center">#</th>
<th width="10px" class="text-center">No</th>
<th>Name</th>
<th>Percentage</th>
<th>Description</th>
<th>Solution</th>
<th class="text-center">Status</th>
<th width="10px" class="text-center">#</th>
<th width="10px" class="text-center">Detail</th>
</tr>
</thead>
<tbody>
@ -41,7 +42,8 @@
{{ $addiction->name }} <br> <p class="text-muted m-0"> Code: {{ $addiction->code }}</p>
</td>
<td>{{ $addiction->min_percentage }} % - {{ $addiction->max_percentage }} %</td>
<td>{{ $addiction->description }}</td>
<td class="text-wrap">{{ $addiction->description }}</td>
<td class="text-wrap">{{ $addiction->solution }}</td>
<td class="text-center">
<span class="badge rounded-pill bg-{{ $addiction->status == 'active' ? 'success' : 'danger' }}">{{ ucwords($addiction->status) }}</span>
</td>

View File

@ -10,22 +10,6 @@
<div>
<h4 class="mb-3 mb-md-0">Welcome to Dashboard</h4>
</div>
<div class="d-flex align-items-center flex-wrap text-nowrap">
<div class="input-group flatpickr w-200px me-2 mb-2 mb-md-0" id="dashboardDate">
<span class="input-group-text input-group-addon bg-transparent border-primary" data-toggle><i
data-feather="calendar" class="text-primary"></i></span>
<input type="text" class="form-control bg-transparent border-primary" placeholder="Select date"
data-input>
</div>
<button type="button" class="btn btn-outline-primary btn-icon-text me-2 mb-2 mb-md-0">
<i class="btn-icon-prepend" data-feather="printer"></i>
Print
</button>
<button type="button" class="btn btn-primary btn-icon-text mb-2 mb-md-0">
<i class="btn-icon-prepend" data-feather="download-cloud"></i>
Download Report
</button>
</div>
</div>
<div class="row">
@ -35,43 +19,23 @@
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline">
<h6 class="card-title mb-0">New Customers</h6>
<h6 class="card-title mb-0">Addictions Data</h6>
<div class="dropdown mb-2">
<a type="button" id="dropdownMenuButton" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
<a class="dropdown-item d-flex align-items-center" href="{{ route('admin.addictions.index') }}">
<i data-feather="eye" class="icon-sm me-2"></i>
<span class="">View</span>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-6 col-md-12 col-xl-5">
<h3 class="mb-2">3,897</h3>
<div class="d-flex align-items-baseline">
<p class="text-success">
<span>+3.3%</span>
<i data-feather="arrow-up" class="icon-sm mb-1"></i>
</p>
</div>
</div>
<div class="col-6 col-md-12 col-xl-7">
<div id="customersChart" class="mt-md-3 mt-xl-0"></div>
<h3 class="mb-2">{{ $addictionCount }}</h3>
</div>
</div>
</div>
@ -81,43 +45,23 @@ class="">Download</span></a>
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline">
<h6 class="card-title mb-0">New Orders</h6>
<h6 class="card-title mb-0">Factors Data</h6>
<div class="dropdown mb-2">
<a type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown"
<a type="button" id="dropdownMenuButton" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item d-flex align-items-center" href="{{ route('admin.factors.index') }}">
<i data-feather="eye" class="icon-sm me-2"></i>
<span class="">View</span>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-6 col-md-12 col-xl-5">
<h3 class="mb-2">35,084</h3>
<div class="d-flex align-items-baseline">
<p class="text-danger">
<span>-2.8%</span>
<i data-feather="arrow-down" class="icon-sm mb-1"></i>
</p>
</div>
</div>
<div class="col-6 col-md-12 col-xl-7">
<div id="ordersChart" class="mt-md-3 mt-xl-0"></div>
<h3 class="mb-2">{{ $factorCount }}</h3>
</div>
</div>
</div>
@ -127,43 +71,23 @@ class="">Download</span></a>
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline">
<h6 class="card-title mb-0">Growth</h6>
<h6 class="card-title mb-0">Items Data</h6>
<div class="dropdown mb-2">
<a type="button" id="dropdownMenuButton2" data-bs-toggle="dropdown"
<a type="button" id="dropdownMenuButton" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton2">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item d-flex align-items-center" href="{{ route('admin.items.index') }}">
<i data-feather="eye" class="icon-sm me-2"></i>
<span class="">View</span>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-6 col-md-12 col-xl-5">
<h3 class="mb-2">89.87%</h3>
<div class="d-flex align-items-baseline">
<p class="text-success">
<span>+2.8%</span>
<i data-feather="arrow-up" class="icon-sm mb-1"></i>
</p>
</div>
</div>
<div class="col-6 col-md-12 col-xl-7">
<div id="growthChart" class="mt-md-3 mt-xl-0"></div>
<h3 class="mb-2">{{ $itemCount }}</h3>
</div>
</div>
</div>
@ -171,356 +95,7 @@ class="">Download</span></a>
</div>
</div>
</div>
</div> <!-- row -->
<div class="row">
<div class="col-12 col-xl-12 grid-margin stretch-card">
<div class="card overflow-hidden">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline mb-4 mb-md-3">
<h6 class="card-title mb-0">Revenue</h6>
<div class="dropdown">
<a type="button" id="dropdownMenuButton3" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton3">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
</div>
</div>
</div>
<div class="row align-items-start">
<div class="col-md-7">
<p class="text-secondary fs-13px mb-3 mb-md-0">Revenue is the income that a business has
from its normal business activities, usually from the sale of goods and services to
customers.</p>
</div>
<div class="col-md-5 d-flex justify-content-md-end">
<div class="btn-group mb-3 mb-md-0" role="group" aria-label="Basic example">
<button type="button" class="btn btn-outline-primary">Today</button>
<button type="button" class="btn btn-outline-primary d-none d-md-block">Week</button>
<button type="button" class="btn btn-primary">Month</button>
<button type="button" class="btn btn-outline-primary">Year</button>
</div>
</div>
</div>
<div id="revenueChart"></div>
</div>
</div>
</div>
</div> <!-- row -->
<div class="row">
<div class="col-lg-7 col-xl-8 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline mb-2">
<h6 class="card-title mb-0">Monthly sales</h6>
<div class="dropdown mb-2">
<a type="button" id="dropdownMenuButton4" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton4">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
</div>
</div>
</div>
<p class="text-secondary">Sales are activities related to selling or the number of goods or
services sold in a given time period.</p>
<div id="monthlySalesChart"></div>
</div>
</div>
</div>
<div class="col-lg-5 col-xl-4 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline">
<h6 class="card-title mb-0">Cloud storage</h6>
<div class="dropdown mb-2">
<a type="button" id="dropdownMenuButton5" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton5">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
</div>
</div>
</div>
<div id="storageChart"></div>
<div class="row mb-3">
<div class="col-6 d-flex justify-content-end">
<div>
<label
class="d-flex align-items-center justify-content-end fs-10px text-uppercase fw-bolder">Total
storage <span class="p-1 ms-1 rounded-circle bg-secondary"></span></label>
<h5 class="fw-bolder mb-0 text-end">8TB</h5>
</div>
</div>
<div class="col-6">
<div>
<label class="d-flex align-items-center fs-10px text-uppercase fw-bolder"><span
class="p-1 me-1 rounded-circle bg-primary"></span> Used storage</label>
<h5 class="fw-bolder mb-0">~5TB</h5>
</div>
</div>
</div>
<div class="d-grid">
<button class="btn btn-primary">Upgrade storage</button>
</div>
</div>
</div>
</div>
</div> <!-- row -->
<div class="row">
<div class="col-lg-5 col-xl-4 grid-margin grid-margin-xl-0 stretch-card">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline mb-2">
<h6 class="card-title mb-0">Inbox</h6>
<div class="dropdown mb-2">
<a type="button" id="dropdownMenuButton6" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton6">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
</div>
</div>
</div>
<div class="d-flex flex-column">
<a href="javascript:;" class="d-flex align-items-center border-bottom pb-3">
<div class="me-3">
<img src="https://via.placeholder.com/35x35" class="rounded-circle w-35px"
alt="user">
</div>
<div class="w-100">
<div class="d-flex justify-content-between">
<h6 class="text-body mb-2">Leonardo Payne</h6>
<p class="text-secondary fs-12px">12.30 PM</p>
</div>
<p class="text-secondary fs-13px">Hey! there I'm available...</p>
</div>
</a>
<a href="javascript:;" class="d-flex align-items-center border-bottom py-3">
<div class="me-3">
<img src="https://via.placeholder.com/35x35" class="rounded-circle w-35px"
alt="user">
</div>
<div class="w-100">
<div class="d-flex justify-content-between">
<h6 class="text-body mb-2">Carl Henson</h6>
<p class="text-secondary fs-12px">02.14 AM</p>
</div>
<p class="text-secondary fs-13px">I've finished it! See you so..</p>
</div>
</a>
<a href="javascript:;" class="d-flex align-items-center border-bottom py-3">
<div class="me-3">
<img src="https://via.placeholder.com/35x35" class="rounded-circle w-35px"
alt="user">
</div>
<div class="w-100">
<div class="d-flex justify-content-between">
<h6 class="text-body mb-2">Jensen Combs</h6>
<p class="text-secondary fs-12px">08.22 PM</p>
</div>
<p class="text-secondary fs-13px">This template is awesome!</p>
</div>
</a>
<a href="javascript:;" class="d-flex align-items-center border-bottom py-3">
<div class="me-3">
<img src="https://via.placeholder.com/35x35" class="rounded-circle w-35px"
alt="user">
</div>
<div class="w-100">
<div class="d-flex justify-content-between">
<h6 class="text-body mb-2">Amiah Burton</h6>
<p class="text-secondary fs-12px">05.49 AM</p>
</div>
<p class="text-secondary fs-13px">Nice to meet you</p>
</div>
</a>
<a href="javascript:;" class="d-flex align-items-center border-bottom py-3">
<div class="me-3">
<img src="https://via.placeholder.com/35x35" class="rounded-circle w-35px"
alt="user">
</div>
<div class="w-100">
<div class="d-flex justify-content-between">
<h6 class="text-body mb-2">Yaretzi Mayo</h6>
<p class="text-secondary fs-12px">01.19 AM</p>
</div>
<p class="text-secondary fs-13px">Hey! there I'm available...</p>
</div>
</a>
</div>
</div>
</div>
</div>
<div class="col-lg-7 col-xl-8 stretch-card">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-baseline mb-2">
<h6 class="card-title mb-0">Projects</h6>
<div class="dropdown mb-2">
<a type="button" id="dropdownMenuButton7" data-bs-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="icon-lg text-secondary pb-3px" data-feather="more-horizontal"></i>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton7">
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="eye" class="icon-sm me-2"></i> <span
class="">View</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="edit-2" class="icon-sm me-2"></i> <span
class="">Edit</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="trash" class="icon-sm me-2"></i> <span
class="">Delete</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="printer" class="icon-sm me-2"></i> <span
class="">Print</span></a>
<a class="dropdown-item d-flex align-items-center" href="javascript:;"><i
data-feather="download" class="icon-sm me-2"></i> <span
class="">Download</span></a>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead>
<tr>
<th class="pt-0">#</th>
<th class="pt-0">Project Name</th>
<th class="pt-0">Start Date</th>
<th class="pt-0">Due Date</th>
<th class="pt-0">Status</th>
<th class="pt-0">Assign</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>NobleUI jQuery</td>
<td>01/01/2024</td>
<td>26/04/2024</td>
<td><span class="badge bg-danger">Released</span></td>
<td>Leonardo Payne</td>
</tr>
<tr>
<td>2</td>
<td>NobleUI Angular</td>
<td>01/01/2024</td>
<td>26/04/2024</td>
<td><span class="badge bg-success">Review</span></td>
<td>Carl Henson</td>
</tr>
<tr>
<td>3</td>
<td>NobleUI ReactJs</td>
<td>01/05/2024</td>
<td>10/09/2024</td>
<td><span class="badge bg-info">Pending</span></td>
<td>Jensen Combs</td>
</tr>
<tr>
<td>4</td>
<td>NobleUI VueJs</td>
<td>01/01/2024</td>
<td>31/11/2024</td>
<td><span class="badge bg-warning">Work in Progress</span>
</td>
<td>Amiah Burton</td>
</tr>
<tr>
<td>5</td>
<td>NobleUI Laravel</td>
<td>01/01/2024</td>
<td>31/12/2024</td>
<td><span class="badge bg-danger">Coming soon</span></td>
<td>Yaretzi Mayo</td>
</tr>
<tr>
<td>6</td>
<td>NobleUI NodeJs</td>
<td>01/01/2024</td>
<td>31/12/2024</td>
<td><span class="badge bg-primary">Coming soon</span></td>
<td>Carl Henson</td>
</tr>
<tr>
<td class="border-bottom">3</td>
<td class="border-bottom">NobleUI EmberJs</td>
<td class="border-bottom">01/05/2024</td>
<td class="border-bottom">10/11/2024</td>
<td class="border-bottom"><span class="badge bg-info">Pending</span></td>
<td class="border-bottom">Jensen Combs</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div> <!-- row -->
</div>
</div>
@endsection

View File

@ -29,16 +29,27 @@
<th>Addiction</th>
<th>Result</th>
<th>Date Time</th>
<th width="10px" class="text-center">Detail</th>
</tr>
</thead>
<tbody>
@foreach ($histories as $history)
<tr>
<td>{{ $loop->iteration }}</td>
<td class="text-center">{{ $loop->iteration }}</td>
<td>{{ $history->user->name }}</td>
<td>{{ $history->addiction->name }}</td>
<td>{{ $history->result }}</td>
<td>{{ $history->result }}%</td>
<td>{{ $history->created_at->format('d-m-Y H:i:s') }}</td>
<td class="text-center">
<div class="dropdown d-inline-block">
<button class="btn btn-inverse-secondary btn-xs dropdown py-0 px-1" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i data-feather="more-horizontal"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="{{ route('admin.histories.show', $history->id) }}"><i class="mdi mdi-eye-outline align-bottom me-2 text-muted"></i> Detail</a></li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>

View File

@ -0,0 +1,71 @@
@extends('layouts.master')
@section('title', 'Detail History')
@section('content')
<div class="page-content">
<nav class="page-breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Master</a></li>
<li class="breadcrumb-item"><a href="{{ route('admin.histories.index') }}">History</a></li>
<li class="breadcrumb-item active" aria-current="page">Detail History</li>
</ol>
</nav>
<div class="row">
<div class="col-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Detail History</h4>
<div class="row">
<div class="col-md-12 col-lg-6">
<div class="mb-3">
<label class="form-label">Name</label>
<input type="text" class="form-control" value="{{ $history->user->name }}" disabled placeholder="Enter addiction">
</div>
<div class="mb-3">
<label class="form-label">Addiction</label>
<input type="text" class="form-control" value="{{ $history->addiction->name }}" disabled placeholder="Enter addiction">
</div>
<div class="mb-3">
<label class="form-label">Result (%)</label>
<input type="text" class="form-control" value="{{ $history->result }}" disabled placeholder="Enter result"/>
</div>
</div>
<div class="col-md-12 col-lg-6">
<div class="mb-3">
<label class="form-label">Date Time</label>
<input type="text" class="form-control" value="{{ $history->created_at->format('d-m-Y H:i:s') }}" disabled placeholder="Enter date time">
</div>
<div class="mb-3">
<label class="form-label">Solution</label>
<textarea class="form-control" disabled placeholder="Enter solution">{{ $history->addiction->solution ?? '' }}</textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h4 class="card-title">Addiction Test Result</h4>
<table class="table table-bordered w-100 text-wrap align-middle">
<thead>
<tr>
<th width="10px" class="text-center">#</th>
<th>Item Content</th>
<th class="text-center">Answer</th>
</tr>
</thead>
<tbody>
@foreach ($history->details as $detail)
<tr>
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-wrap">{{ $detail->item->content }}</td>
<td class="text-center">{{ $detail->likert->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -23,7 +23,7 @@
<h4 class="card-title">Item Data</h4>
<a href="{{ route('admin.items.create') }}" class="btn btn-primary mb-3">Create Item</a>
<div class="table-responsive">
<table id="datatable" class="table align-middle">
<table id="datatable" class="table align-middle text-wrap w-100">
<thead>
<tr>
<th width="10px" class="text-center">#</th>
@ -39,10 +39,10 @@
@foreach ($items as $factorName => $groupedItems)
@foreach ($groupedItems as $index => $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td class="text-center">{{ $loop->iteration }}</td>
<td><strong>{{ $factorName }}</strong></td>
<td>{{ $item->code }}</td>
<td>{{ $item->content }}</td>
<td class="text-wrap">{{ $item->content }}</td>
<td>{{ $item->value }}</td>
<td class="text-center">
<span class="badge rounded-pill bg-{{ $item->status == 'active' ? 'success' : 'danger' }}">{{ ucwords($item->status) }}</span>
@ -96,7 +96,8 @@
columnDefs: [
{ targets: 1, visible: false }
],
responsive: true,
responsive: false,
scrollX: true,
order: [[1, 'asc']],
});
});

View File

@ -57,8 +57,8 @@
</div>
<div class="col-md-8 ps-md-0">
<div class="auth-form-wrapper px-4 py-5">
<a href="#" class="nobleui-logo d-block mb-2">Noble<span>UI</span></a>
<h5 class="text-secondary fw-normal mb-4">Welcome back! Log in to Admin.
<a href="#" class="nobleui-logo d-block mb-2">Deteksi Kecanduan Belanja Online<span></span></a>
<h5 class="text-secondary fw-normal mb-4">Log in to Admin.
</h5>
<form class="forms-sample" method="POST" action="{{ route('admin.postlogin') }}">
@csrf
@ -82,12 +82,12 @@
</span>
@enderror
</div>
<div class="form-check mb-3">
<!--<div class="form-check mb-3">
<input type="checkbox" class="form-check-input" id="authCheck">
<label class="form-check-label" for="authCheck">
Remember me
</label>
</div>
</div> -->
<div>
<button type="submit" class="btn btn-primary me-2 mb-2 mb-md-0 text-white">Login</button>
</div>

View File

@ -57,8 +57,8 @@
</div>
<div class="col-md-8 ps-md-0">
<div class="auth-form-wrapper px-4 py-5">
<a href="#" class="nobleui-logo d-block mb-2">Noble<span>UI</span></a>
<h5 class="text-secondary fw-normal mb-4">Welcome back! Log in to your account.
<a href="#" class="nobleui-logo d-block mb-2">Deteksi Kecanduan Belanja Online<span></span></a>
<h5 class="text-secondary fw-normal mb-4">Log in to your account.
</h5>
<form class="forms-sample" method="POST" action="{{ route('login') }}">
@csrf
@ -82,12 +82,12 @@
</span>
@enderror
</div>
<div class="form-check mb-3">
<!--<div class="form-check mb-3">
<input type="checkbox" class="form-check-input" id="authCheck">
<label class="form-check-label" for="authCheck">
Remember me
</label>
</div>
</div> -->
<div>
<button type="submit" class="btn btn-primary me-2 mb-2 mb-md-0 text-white">Login</button>
</div>

View File

@ -58,7 +58,7 @@
</div>
<div class="col-md-8 ps-md-0">
<div class="auth-form-wrapper px-4 py-5">
<a href="#" class="nobleui-logo d-block mb-2">Noble<span>UI</span></a>
<a href="#" class="nobleui-logo d-block mb-2">Deteksi Kecanduan Belanja Online<span></span></a>
<h5 class="text-secondary fw-normal mb-4">Create a free account.</h5>
<form class="forms-sample"method="POST" action="{{ route('register') }}">
@csrf
@ -94,12 +94,12 @@
<label for="userPassword" class="form-label">Confirm Password</label>
<input id="password-confirm" type="password" placeholder="Confirm password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
<div class="form-check mb-3">
<!-- <div class="form-check mb-3">
<input type="checkbox" class="form-check-input" id="authCheck">
<label class="form-check-label" for="authCheck">
Remember me
</label>
</div>
</div> -->
<div>
<button type="submit" class="btn btn-primary text-white me-2 mb-2 mb-md-0">Sign up</button>
</div>

View File

@ -1,44 +1,28 @@
<!-- Toast Notification (Hidden by default) -->
<div class="position-fixed top-0 end-0 p-3" style="z-index: 1111">
<div id="toast-container" class="toast overflow-hidden mt-3 fade hide" role="alert" aria-live="assertive" aria-atomic="true">
@if (session('success'))
<div class="align-items-center text-white bg-success border-0">
<div class="d-flex">
<div class="toast-body">
{{ session('success') }}
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
@if (session()->has('success') || session()->has('error') || session()->has('warning'))
<div class="position-fixed top-0 end-0 p-3" style="z-index: 1111">
<div id="toastContainer" class="toast fade hide mt-3 overflow-hidden" role="alert" aria-live="assertive" aria-atomic="true">
@foreach (['success' => 'bg-success', 'error' => 'bg-danger', 'warning' => 'bg-warning'] as $type => $class)
@if (session()->has($type))
<div class="align-items-center text-white {{ $class }} border-0">
<div class="d-flex">
<div class="toast-body">
{{ session($type) }}
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
@endif
@endforeach
</div>
@endif
@if (session('error'))
<div class="align-items-center text-white bg-danger border-0">
<div class="d-flex">
<div class="toast-body">
{{ session('error') }}
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
@endif
@if (session('warning'))
<div class="align-items-center text-white bg-warning border-0">
<div class="d-flex">
<div class="toast-body">
{{ session('warning') }}
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
@endif
</div>
</div>
@endif
<!-- Toast JavaScript -->
<script>
document.addEventListener('DOMContentLoaded', function () {
// Show the toast when a message is flashed
const toastTrigger = document.getElementById("toast-container");
const toastTrigger = document.getElementById("toastContainer");
if (toastTrigger) {
const toast = new bootstrap.Toast(toastTrigger, { delay: 3000 });
toast.show();

View File

@ -40,7 +40,10 @@
<link rel="stylesheet" href="{{ asset('assets/css/demo1/style.css') }}">
<!-- End layout styles -->
<link rel="shortcut icon" href="{{ asset('assets/images/favicon.png') }}" />
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('apple-touch-icon.png') }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ asset('favicon-32x32.png') }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('favicon-16x16.png') }}">
<link rel="manifest" href="{{ asset('site.webmanifest') }}">
</head>
@ -66,8 +69,8 @@
<!-- End Page-content -->
<footer class="footer d-flex flex-row align-items-center justify-content-between px-4 py-3 border-top small">
<p class="text-secondary mb-1 mb-md-0">Copyright © 2024 <a href="https://www.nobleui.com" target="_blank">NobleUI</a>.</p>
<p class="text-secondary">Handcrafted With <i class="mb-1 text-primary ms-1 icon-sm" data-feather="heart"></i></p>
<p class="text-secondary mb-1 mb-md-0">Copyright © 2024 <a href="https://www.nobleui.com" target="_blank">Novita Bening</a>.</p>
<!-- <p class="text-secondary">Handcrafted With <i class="mb-1 text-primary ms-1 icon-sm" data-feather="heart"></i></p> -->
</footer>
</div>

View File

@ -0,0 +1,112 @@
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="Responsive HTML Admin Dashboard Template based on Bootstrap 5">
<meta name="author" content="NobleUI">
<meta name="keywords" content="nobleui, bootstrap, bootstrap 5, bootstrap5, admin, dashboard, template, responsive, css, sass, html, theme, front-end, ui kit, web">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title')</title>
<!-- color-modes:js -->
<script src="{{ asset('assets/js/color-modes.js') }}"></script>
<!-- endinject -->
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap" rel="stylesheet">
<!-- End fonts -->
<!-- core:css -->
<link rel="stylesheet" href="{{ asset('assets/vendors/core/core.css') }}">
<!-- endinject -->
<!-- Plugin css for this page -->
<link rel="stylesheet" href="{{ asset('assets/vendors/sweetalert2/sweetalert2.min.css') }}">
@yield('styles')
<!-- End plugin css for this page -->
<!-- inject:css -->
<link rel="stylesheet" href="{{ asset('assets/vendors/mdi/css/materialdesignicons.min.css') }}">
<link rel="stylesheet" href="{{ asset('assets/fonts/feather-font/css/iconfont.css') }}">
<!-- endinject -->
<!-- Layout styles -->
<link rel="stylesheet" href="{{ asset('assets/css/demo2/style.css') }}">
<!-- End layout styles -->
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('apple-touch-icon.png') }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ asset('favicon-32x32.png') }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('favicon-16x16.png') }}">
<link rel="manifest" href="{{ asset('site.webmanifest') }}">
</head>
<body>
<!-- Begin page -->
<div class="main-wrapper">
<!-- ========== Left Sidebar Start ========== -->
@include('layouts.navbar')
<!-- Left Sidebar End -->
<!-- ============================================================== -->
<!-- Start right Content here -->
<!-- ============================================================== -->
<div class="page-wrapper">
<!-- End topbar -->
@yield('content')
<!-- End Page-content -->
<footer class="footer border-top">
<div class="container d-flex flex-row align-items-center justify-content-between py-3 small">
<p class="text-secondary mb-1 mb-md-0">Copyright © 2024 <a href="https://www.nobleui.com" target="_blank">Novita Bening</a>.</p>
<!-- <p class="text-secondary">Handcrafted With <i class="mb-1 text-primary ms-1 icon-sm" data-feather="heart"></i></p> -->
</div>
</footer>
</div>
<!-- end main content-->
</div>
<!-- END layout-wrapper -->
@include('layouts.alert')
<!-- JAVASCRIPT -->
<!-- core:js -->
<script src="{{ asset('assets/vendors/core/core.js') }}"></script>
<!-- endinject -->
<!-- Plugin js for this page -->
<script src="{{ asset('assets/vendors/jquery/jquery.min.js') }}"></script>
<!-- End plugin js for this page -->
<!-- inject:js -->
<script src="{{ asset('assets/vendors/sweetalert2/sweetalert2.min.js') }}"></script>
<script src="{{ asset('assets/vendors/feather-icons/feather.min.js') }}"></script>
<script src="{{ asset('assets/js/app.js') }}"></script>
<!-- endinject -->
<!-- Custom js for this page -->
<script>
var n = Swal.mixin({
customClass:{
confirmButton:"btn btn-label-info btn-wide mx-1",
denyButton:"btn btn-label-secondary btn-wide mx-1",
cancelButton:"btn btn-label-danger btn-wide mx-1"
},
buttonsStyling:!1
});
</script>
@yield('scripts')
<!-- End custom js for this page -->
</body>
</html>

View File

@ -0,0 +1,95 @@
<div class="horizontal-menu">
<nav class="navbar top-navbar">
<div class="container">
<div class="navbar-content">
<a href="/dashboard" class="navbar-brand d-none d-lg-flex">
<img src="{{ asset('assets/images/olshop.png') }}" width="48" height="48" class="d-inline-block align-text-top" alt="logo">
</a>
<!-- Logo-mini for small screen devices (mobile/tablet) -->
<div class="logo-mini-wrapper">
<img src="{{ asset('assets/images/olshop.png') }}" class="logo-mini logo-mini-light" alt="logo">
<img src="{{ asset('assets/images/olshop.png') }}" class="logo-mini logo-mini-dark" alt="logo">
</div>
<ul class="navbar-nav">
<li class="theme-switcher-wrapper nav-item">
<input type="checkbox" value="" id="theme-switcher">
<label for="theme-switcher">
<div class="box">
<div class="ball"></div>
<div class="icons">
<i class="feather icon-sun"></i>
<i class="feather icon-moon"></i>
</div>
</div>
</label>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="profileDropdown" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img class="w-30px h-30px ms-1 rounded-circle" src="{{ asset('assets/images/pp.jpeg') }}" alt="profile">
</a>
<div class="dropdown-menu p-0" aria-labelledby="profileDropdown">
<div class="d-flex flex-column align-items-center border-bottom px-5 py-3">
<div class="mb-3">
<img class="w-80px h-80px rounded-circle" src="{{ asset('assets/images/pp.jpeg') }}" alt="">
</div>
<div class="text-center">
<p class="fs-16px fw-bolder">{{ Auth::user()->name }}</p>
<p class="fs-12px text-secondary">{{ Auth::user()->email }}</p>
</div>
</div>
<ul class="list-unstyled p-1">
<li class="dropdown-item py-2">
<a href="{{ route('logout') }}" class="text-body ms-0" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
<i class="me-2 icon-md" data-feather="log-out"></i>
<span>Log Out</span>
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
@csrf
</form>
</li>
</ul>
</div>
</li>
</ul>
<!-- navbar toggler for small devices -->
<div data-toggle="horizontal-menu-toggle"
class="navbar-toggler navbar-toggler-right d-lg-none align-self-center">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</nav>
<nav class="bottom-navbar">
<div class="container">
<ul class="nav page-navigation">
<li class="nav-item">
<a class="nav-link @if (Request::is('dashboard')) active @endif" href="{{ route('user.dashboard') }}">
<i class="link-icon" data-feather="box"></i>
<span class="menu-title">Dashboard</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link @if (Request::is('addiction')) active @endif" href="{{ route('user.addiction') }}">
<i class="link-icon" data-feather="search"></i>
<span class="menu-title">Addiction Test</span>
</a>
</li>
<li class="nav-item">
<a href="{{ route('user.history') }}" class="nav-link @if (Request::is('history')) active @endif">
<i class="link-icon" data-feather="bar-chart-2"></i>
<span class="menu-title">History</span>
</a>
</li>
</ul>
</div>
</nav>
</div>

View File

@ -1,7 +1,7 @@
<nav class="sidebar">
<div class="sidebar-header">
<a href="#" class="sidebar-brand">
Noble<span>UI</span>
<img src="{{ asset('assets/images/olshop.png') }}" width="48" height="48" class="d-inline-block align-text-top" alt="logo">
</a>
<div class="sidebar-toggler">
<span></span>

View File

@ -2,8 +2,8 @@
<div class="navbar-content">
<div class="logo-mini-wrapper">
<img src="{{ asset('assets/images/logo-mini-light.png') }}" class="logo-mini logo-mini-light" alt="logo">
<img src="{{ asset('assets/images/logo-mini-dark.png') }}" class="logo-mini logo-mini-dark" alt="logo">
<img src="{{ asset('assets/images/olshop.png') }}" class="logo-mini logo-mini-light" alt="logo">
<img src="{{ asset('assets/images/olshop.png') }}" class="logo-mini logo-mini-dark" alt="logo">
</div>
<ul class="navbar-nav">
@ -22,12 +22,12 @@
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="profileDropdown" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img class="w-30px h-30px ms-1 rounded-circle" src="{{ asset('assets/images/avatar-8.png') }}" alt="profile">
<img class="w-30px h-30px ms-1 rounded-circle" src="{{ asset('assets/images/pp.jpeg') }}" alt="profile">
</a>
<div class="dropdown-menu p-0" aria-labelledby="profileDropdown">
<div class="d-flex flex-column align-items-center border-bottom px-5 py-3">
<div class="mb-3">
<img class="w-80px h-80px rounded-circle" src="{{ asset('assets/images/avatar-8.png') }}" alt="">
<img class="w-80px h-80px rounded-circle" src="{{ asset('assets/images/pp.jpeg') }}" alt="">
</div>
<div class="text-center">
<p class="fs-16px fw-bolder">{{ Auth::user()->name }}</p>

View File

@ -0,0 +1,63 @@
@extends('layouts.masteruser')
@section('title', 'Addiction Test')
@section('styles')
<link rel="stylesheet" href="{{ asset('assets/vendors/flatpickr/flatpickr.min.css') }}">
@endsection
@section('content')
<div class="page-content">
<div class="row">
<div class="col-12">
<div class="row justify-content-center">
<div class="col-md-8 grid-margin stretch-card">
<div class="card">
<div class="card-header">
<h4 class="card-title mb-0">Addiction Test</h4>
</div>
<div class="card-body">
<form id="addiction-form" action="{{ route('user.addiction.store') }}" method="post" autocomplete="off">
@csrf
@method('POST')
<table class="table table-bordered w-100 text-wrap align-middle">
<thead>
<tr>
<th>Item Content</th>
<th class="text-center">Select Answer</th>
</tr>
</thead>
<tbody>
@foreach ($items as $item)
<tr>
<td class="text-wrap">{{ $item->content }}</td>
<td class="text-center">
<input type="hidden" name="items[]" value="{{ $item->id }}">
<input type="hidden" name="values[]" value="{{ $item->value }}">
<select name="answers[]" class="form-select" required>
<option value="" hidden>Select Answer</option>
@foreach ($likerts as $likert)
<option value="{{ $likert->id }}" {{ in_array($likert->id, old('answers', [])) ? 'selected' : '' }}>
{{ $likert->name }}
</option>
@endforeach
</select>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
<div class="card-footer text-end">
<button type="submit" form="addiction-form" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<script src="{{ asset('assets/vendors/flatpickr/flatpickr.min.js') }}"></script>
<script src="{{ asset('assets/vendors/apexcharts/apexcharts.min.js') }}"></script>
<script src="{{ asset('assets/js/dashboard.js') }}"></script>
@endsection

View File

@ -0,0 +1,50 @@
@extends('layouts.masteruser')
@section('title', 'Dashboard')
@section('styles')
<link rel="stylesheet" href="{{ asset('assets/vendors/flatpickr/flatpickr.min.css') }}">
@endsection
@section('content')
<div class="page-content">
<div class="row">
<div class="col-12 col-xl-12 stretch-card">
<div class="row justify-content-center">
<div class="col-md-8 grid-margin stretch-card">
<div class="card">
<div class="card-header">
<h4 class="card-title mb-0">Tentang Belanja Online</h4>
</div>
<div class="card-body">
<p class="mb-3" style="text-align: justify">Kegiatan belanja online yang berlebihan dapat menjadi kebiasaan yang jika dilakukan terus menerus akan mengakibatkan kecanduan.</p>
<p style="text-align: justify">Kecanduan belanja online juga memiliki tingkatannya berdasarkan kategori keparahannya meliputi no addiction (tidak kecanduan), mild (rendah), moderate (sedang) dan severe (berat).</p>
<table class="table table-bordered align-middle mt-3">
<thead>
<tr>
<th>Tingkat Kecanduan</th>
<th>Persentase</th>
</tr>
</thead>
<tbody>
@foreach ($addictions as $addiction)
<tr>
<td>{{ $addiction->name }}</td>
<td>{{ $addiction->min_percentage }} - {{ $addiction->max_percentage }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="card-footer text-center">
<a href="{{ route('user.addiction') }}" class="btn btn-primary">Mulai Tes</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<script src="{{ asset('assets/vendors/flatpickr/flatpickr.min.js') }}"></script>
<script src="{{ asset('assets/vendors/apexcharts/apexcharts.min.js') }}"></script>
<script src="{{ asset('assets/js/dashboard.js') }}"></script>
@endsection

View File

@ -0,0 +1,60 @@
@extends('layouts.masteruser')
@section('title', 'Detail History')
@section('content')
<div class="page-content">
<div class="row">
<div class="col-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Detail History</h4>
<div class="row">
<div class="col-md-12 col-lg-6">
<div class="mb-3">
<label class="form-label">Addiction</label>
<input type="text" class="form-control" value="{{ $history->addiction->name }}" disabled placeholder="Enter addiction">
</div>
<div class="mb-3">
<label class="form-label">Result (%)</label>
<input type="text" class="form-control" value="{{ $history->result }}" disabled placeholder="Enter result"/>
</div>
</div>
<div class="col-md-12 col-lg-6">
<div class="mb-3">
<label class="form-label">Date Time</label>
<input type="text" class="form-control" value="{{ $history->created_at->format('d-m-Y H:i:s') }}" disabled placeholder="Enter date time">
</div>
<div class="mb-3">
<label class="form-label">Solution</label>
<textarea class="form-control" disabled placeholder="Enter solution">{{ $history->addiction->solution ?? '' }}</textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h4 class="card-title">Addiction Test Result</h4>
<table class="table table-bordered w-100 text-wrap align-middle">
<thead>
<tr>
<th width="10px" class="text-center">#</th>
<th>Item Content</th>
<th class="text-center">Answer</th>
</tr>
</thead>
<tbody>
@foreach ($history->details as $detail)
<tr>
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-wrap">{{ $detail->item->content }}</td>
<td class="text-center">{{ $detail->likert->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,69 @@
@extends('layouts.masteruser')
@section('title', 'Histories Datas')
@section('styles')
<!-- DataTables -->
<link href="{{ asset('assets/vendors/datatables.net-bs5/css/dataTables.bootstrap5.min.css') }}" rel="stylesheet" type="text/css" />
<!-- Responsive datatable examples -->
<link href="{{ asset('assets/vendors/datatables.net-responsive-bs5/css/responsive.bootstrap5.min.css') }}" rel="stylesheet" type="text/css" />
@endsection
@section('content')
<div class="page-content">
<div class="row">
<div class="col-md-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">History Data</h4>
<div class="table-responsive">
<table id="datatable" class="table align-middle">
<thead>
<tr>
<th width="10px" class="text-center">No</th>
<th>Addiction</th>
<th>Result</th>
<th>Date Time</th>
<th width="10px" class="text-center">Detail</th>
</tr>
</thead>
<tbody>
@foreach ($histories as $history)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $history->addiction->name }}</td>
<td>{{ $history->result }}%</td>
<td>{{ $history->created_at->format('d-m-Y H:i:s') }}</td>
<td class="text-center">
<div class="dropdown d-inline-block">
<button class="btn btn-inverse-secondary btn-xs dropdown py-0 px-1" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<i data-feather="more-horizontal"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="{{ route('user.history.show', $history->id) }}"><i class="mdi mdi-eye-outline align-bottom me-2 text-muted"></i> Detail</a></li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- end col -->
</div>
</div>
@endsection
@section('scripts')
<!-- Required datatable js -->
<script src="{{ asset('assets/vendors/datatables.net/js/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('assets/vendors/datatables.net-bs5/js/dataTables.bootstrap5.min.js') }}"></script>
<!-- Responsive examples -->
<script src="{{ asset('assets/vendors/datatables.net-responsive/js/dataTables.responsive.min.js') }}"></script>
<script src="{{ asset('assets/vendors/datatables.net-responsive-bs5/js/responsive.bootstrap5.min.js') }}"></script>
<script>
$(function () {
$('#datatable').DataTable();
});
</script>
@endsection

View File

@ -48,6 +48,11 @@
Route::middleware('role:user')->name('user.')->group(function () {
Route::get('/home', [HomeController::class, 'index'])->name('dashboard');
Route::get('dashboard', [App\Http\Controllers\User\DashboardController::class, 'index'])->name('dashboard');
Route::get('history', [App\Http\Controllers\User\DashboardController::class, 'history'])->name('history');
Route::get('history/{id}', [App\Http\Controllers\User\DashboardController::class, 'detailHistory'])->name('history.show');
Route::get('addiction', [App\Http\Controllers\User\DashboardController::class, 'addiction'])->name('addiction');
Route::post('addiction', [App\Http\Controllers\User\DashboardController::class, 'storeAddiction'])->name('addiction.store');
});
});