Skip to content

Commit

Permalink
Proper Folder Structure Update
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitak-gorai committed Aug 9, 2023
1 parent c24064e commit 811dd08
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 34 deletions.
55 changes: 29 additions & 26 deletions app/Http/Controllers/Dashboard/RolesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ class RolesController extends Controller
{
public function index(): Response
{
/**
* Shows the role page
* @return Response
*/
return Inertia::render('Roles',['roles' => []]
/**
* Shows the role page
* @return Response
*/
return Inertia::render(
'AccessControl/Roles',
['roles' => []]
);
}
public function details($roleId): Response
{
/**
* Shows the role page
* @return Response
*/
/**
* Shows the role page
* @return Response
*/
$role = Role::with('permissions')->where('id', $roleId)->first();
$users = $role->users()->get();
$temp = [
Expand All @@ -39,9 +41,10 @@ public function details($roleId): Response
'permissions' => $role->permissions,
'users' => $users,
];
return Inertia::render('RolesDetails',['roleDetails' => $temp]
return Inertia::render(
'AccessControl/RolesDetails',
['roleDetails' => $temp]
);

}
public function store(CreateRoleRequest $request)
{
Expand All @@ -54,29 +57,29 @@ public function store(CreateRoleRequest $request)
$role->permissions()->attach([$permission['id']]);
}
$role->save();
if($role->save()){
if ($role->save()) {
return Inertia::location(route('dashboard.roles.index'));
}else{
} else {
return Redirect::back()->with(['error' => 'Something went wrong']);
}
}
public function getRoles()
{
$result=[];
$result = [];
$roles = Role::with('permissions')->get();
foreach ($roles as $role) {
$users = $role->users()->get();
$temp = [
'id' => $role->id,
'name' => $role->name,
'display_name' => $role->display_name,
'description' => $role->description,
'permissions' => $role->permissions,
'users' => $users,
];
array_push($result, $temp);
}
$users = $role->users()->get();
$temp = [
'id' => $role->id,
'name' => $role->name,
'display_name' => $role->display_name,
'description' => $role->description,
'permissions' => $role->permissions,
'users' => $users,
];
array_push($result, $temp);
}

return response()->json($result, 200);
return response()->json($result, 200);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Dashboard/User/SetupAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public function index()
{
$facilities = Facility::pluck('name', 'id');

return Inertia::render('AddUsers', ['facilities' => $facilities]);
return Inertia::render('Users/AddUsers', ['facilities' => $facilities]);
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/InvitationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function showInvitations(): Response

$facilities = Facility::pluck('name', 'id');

return Inertia::render('Invitations', ['facilities' => $facilities]);
return Inertia::render('Users/Invitations', ['facilities' => $facilities]);
}


Expand Down Expand Up @@ -55,7 +55,7 @@ public function index($token): Response

//send a invalid token message if the invite is not found in the database.
if (!$invite) {
return Inertia::render('AddPassword', ['status' => 'invalid']);
return Inertia::render('Users/AddPassword', ['status' => 'invalid']);
}

//masking the username part of the email.
Expand All @@ -65,7 +65,7 @@ public function index($token): Response
$usernameLength = strlen($username);
$maskedEmail = Str::mask($email, '*', - ($emailLength - $usernameLength / 2), $usernameLength / 2);

return Inertia::render('AddPassword', ['status' => $invite->status, 'email' => $maskedEmail]);
return Inertia::render('Users/AddPassword', ['status' => $invite->status, 'email' => $maskedEmail]);
}

public function sendInvite(Request $request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
</div>
</template>
<script>
import DashboardLayout from "../layouts/DashboardLayout";
import DashboardLayout from "../../layouts/DashboardLayout";
export default {
name: "Roles",
layout: DashboardLayout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</template>

<script>
import DashboardLayout from "../layouts/DashboardLayout";
import DashboardLayout from "../../layouts/DashboardLayout";
export default {
layout: DashboardLayout,
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="flex min-h-screen bg-white py-8 px-4">
<div
class="w-1/2 mx-auto bg-white rounded shadow-md p-6 overflow-y-auto no-scrollbar"
class="mx-auto bg-white rounded shadow-md p-6 overflow-y-auto no-scrollbar"
>
<div v-if="status != 'pending'">
<!-- Show expired message if the token is expired -->
Expand Down Expand Up @@ -85,9 +85,10 @@
</template>

<script>
import axios from "axios";
import AuthLayout from "../../layouts/AuthLayout";
export default {
name: "AddPassword",
layout: AuthLayout,
props: {
errors: Object,
status: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@
</div>
</template>
<script>
import DashboardLayout from "../../layouts/DashboardLayout";
export default {
layout: DashboardLayout,
props: {
facilities: Object,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
</template>

<script>
import DashboardLayout from "../../layouts/DashboardLayout";
export default {
layout: DashboardLayout,
props: {
facilities: Object,
},
Expand Down

0 comments on commit 811dd08

Please sign in to comment.