Skip to content

Commit

Permalink
Admin dashboard layout editing: complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Slymee committed Dec 26, 2023
1 parent b0df8fe commit a703e06
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 128 deletions.
3 changes: 2 additions & 1 deletion app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class CategoryController extends Controller
*/
public function index()
{
return view('backend.adminCategory');
$datas = Category::whereNull('parent_id')->get();
return view('backend.adminCategory', ['datas' => $datas]);
}

//Add Category Form
Expand Down
85 changes: 39 additions & 46 deletions resources/views/backend/adminCategory.blade.php
Original file line number Diff line number Diff line change
@@ -1,50 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/fontawesome.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" />
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
@vite(['resources/css/admin-dashboard.css', 'resources/css/side-nav.css', 'resources/css/admin-dashboard-category.css'])
<title>Dashboard - Category</title>
</head>
<body>
<section>
<div class="side-nav">
@include('commonComponents.side-nav')
</div>
<div class="side-container">
@include('commonComponents.bread-crumb')
<div class="content-container">
<div class="add-button-container">
<a href={{ route('add.category.form') }}><button>Add Category</button></a>
</div>
<div class="display-data-container">
<span>Categories</span>
@extends('backend.layouts.dashboard-template')

@section('vite-resource')
@vite(['resources/css/admin-dashboard.css', 'resources/css/side-nav.css', 'resources/css/admin-dashboard-category.css'])
@endsection

@section('page-title')
Dashboard-Category
@endsection

@section('bread-crumb')
Dashboard/Category
@endsection

@section('content')
<div class="add-button-container">
<a href={{ route('add.category.form') }}><button>Add Category</button></a>
</div>
<div class="display-data-container">
<span>Categories</span>

<div class="table-container">
<table>
<tr>
<th>SN</th>
<th>Category Name</th>
<th colspan="3">Utilities</th>
</tr>
<div class="table-container">
<table>
<tr>
<th>SN</th>
<th>Category Name</th>
<th colspan="3">Utilities</th>
</tr>

<tr>
<td>1</td>
<td>Fruit</td>
<td><button>Sub-categories</button></td>
<td><button>Edit</button></td>
<td><button>Delete</button></td>
</tr>
@foreach ($datas as $data)
<tr>
<td>{{ $data->id }}</td>
<td>{{ $data->category_name }}</td>
<td><button>Sub-categories</button></td>
<td><button>Edit</button></td>
<td><button>Delete</button></td>
</tr>
@endforeach

</table>
</div>
</div>
</div>
</table>
</div>
</section>
</body>
</html>
</div>
@endsection
54 changes: 23 additions & 31 deletions resources/views/backend/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/fontawesome.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" />
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
@vite(['resources/css/admin-dashboard.css', 'resources/css/side-nav.css'])
<title>Dashboard</title>
</head>
<body>
<section>
<div class="side-nav">
@include('commonComponents.side-nav')
</div>
<div class="side-container">
@include('commonComponents.bread-crumb')
<div class="content-container">
<div class="statistics">
<div class="stats-box">asdasd</div>
<div class="stats-box">asdasd</div>
<div class="stats-box">asdasd</div>
<div class="stats-box">asdasd</div>
</div>
</div>
</div>
</section>
</body>
</html>
@extends('backend.layouts.dashboard-template')


@section('vite-resource')
@vite(['resources/css/admin-dashboard.css', 'resources/css/side-nav.css'])
@endsection

@section('page-title')
Dashboard
@endsection

@section('bread-crumb')
Dashboard
@endsection

@section('content')
<div class="statistics">
<div class="stats-box">asdasd</div>
<div class="stats-box">asdasd</div>
<div class="stats-box">asdasd</div>
<div class="stats-box">asdasd</div>
</div>
@endsection
26 changes: 26 additions & 0 deletions resources/views/backend/layouts/dashboard-template.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/fontawesome.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" />
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
@yield('vite-resource')
<title>@yield('page-title')</title>
</head>
<body>
<section>
<div class="side-nav">
@include('commonComponents.side-nav')
</div>
<div class="side-container">
@include('commonComponents.bread-crumb')
<div class="content-container">
@yield('content')
</div>
</div>
</section>
</body>
</html>
2 changes: 1 addition & 1 deletion resources/views/commonComponents/bread-crumb.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="bread-crumb-banner">
<span>Dashboard</span>
<span>@yield('bread-crumb')</span>
<span>{{ auth()->user()->username }}</span>
</div>
91 changes: 42 additions & 49 deletions resources/views/modals/adminAddCategory.blade.php
Original file line number Diff line number Diff line change
@@ -1,49 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/fontawesome.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" />
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
@vite(['resources/css/admin-dashboard.css', 'resources/css/side-nav.css', 'resources/css/admin-dashboard-category.css'])
<title>Dashboard - Add Category</title>
</head>
<body>
<section>
<div class="side-nav">
@include('commonComponents.side-nav')
</div>
<div class="side-container">
@include('commonComponents.bread-crumb')
<div class="content-container">
<div class="form-container">
<span>Add a Category</span>
<form action={{ route('admin.insert.category') }} autocomplete="off" method="POST">
@csrf
<label for="category_name">Category Name </label><br>
<input type="text" name="category_name" placeholder="Enter Category Name"><br>

<select name="parent_id" id="">
<option value="" selected>-- Select Parent Category --</option>
@if($datas)
@foreach ($datas as $data)
<option value={{ $data->id }}>{{ $data->category_name }}</option>
@endforeach
@endif
</select>

<input type="submit" name="" id="" value="Create New Category">

@if (session('message'))
<span class="message">Category Inserted</span>
@endif

</form>
</div>
</div>
</div>
</section>
</body>
</html>
@extends('backend.layouts.dashboard-template')

@section('vite-resource')
@vite(['resources/css/admin-dashboard.css', 'resources/css/side-nav.css', 'resources/css/admin-dashboard-category.css'])
@endsection

@section('page-title')
Dashboard-Add Category
@endsection

@section('bread-crumb')
Dashboard/Category/AddCategory
@endsection

@section('content')
<div class="form-container">
<span>Add a Category</span>
<form action={{ route('admin.insert.category') }} autocomplete="off" method="POST">
@csrf
<label for="category_name">Category Name </label><br>
<input type="text" name="category_name" placeholder="Enter Category Name"><br>

<select name="parent_id" id="">
<option value="" selected>-- Select Parent Category --</option>
@if($datas)
@foreach ($datas as $data)
<option value={{ $data->id }}>{{ $data->category_name }}</option>
@endforeach
@endif
</select>

<input type="submit" name="" id="" value="Create New Category">

@if (session('message'))
<span class="message">Category Inserted</span>
@endif

</form>
</div>
@endsection


0 comments on commit a703e06

Please sign in to comment.