Skip to content

Commit ada453d

Browse files
authored
Merge pull request #22 from seiyanz16/main
Enhance Responsive Design & Group Permissions in Form
2 parents cf242aa + 2a3802d commit ada453d

15 files changed

Lines changed: 337 additions & 228 deletions

File tree

app/Http/Controllers/RoleController.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,17 @@ public function search(Request $request)
9999
public function create()
100100
{
101101
$permissions = Permission::all();
102-
return view('roles.create', compact('permissions'));
102+
$groupedPermissions = [];
103+
104+
foreach ($permissions as $permission) {
105+
$parts = explode('-', $permission->name);
106+
107+
if (count($parts)) {
108+
$group = $parts[0];
109+
$groupedPermissions[$group][] = $permission;
110+
}
111+
}
112+
return view('roles.create', compact('groupedPermissions'));
103113
}
104114

105115
/**
@@ -156,8 +166,19 @@ public function edit($id)
156166
$role = Role::find($id);
157167
$permissions = Permission::all();
158168

169+
$groupedPermissions = [];
170+
171+
foreach ($permissions as $permission) {
172+
$parts = explode('-', $permission->name);
173+
174+
if (count($parts)) {
175+
$group = $parts[0];
176+
$groupedPermissions[$group][] = $permission;
177+
}
178+
}
179+
159180
return $role
160-
? view('roles.edit', compact('role', 'permissions'))
181+
? view('roles.edit', compact('role', 'groupedPermissions'))
161182
: redirect()->route('roles.index')->with('error', 'Role tidak ditemukan');
162183
}
163184

resources/css/auth/signin.scss

Lines changed: 93 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,42 @@
2525
#00f0c5 100%
2626
);
2727
height: 100vh;
28+
display: flex;
29+
align-items: center;
30+
justify-content: center;
31+
padding: 20px;
2832

2933
h1 {
3034
font-weight: 700;
31-
margin-bottom: 50px;
35+
margin-bottom: 30px;
3236
}
3337
}
3438

3539
.side-left {
3640
background-color: white;
3741
height: 100vh;
42+
display: flex;
43+
flex-direction: column;
44+
align-items: center;
45+
justify-content: center;
46+
text-align: center;
47+
padding: 20px;
3848

3949
img {
40-
margin-bottom: 50px;
41-
width: 200px;
50+
margin-bottom: 30px;
51+
width: 150px;
4252
}
4353

4454
h1 {
4555
color: #0161a7;
4656
font-weight: 700;
57+
font-size: 2rem;
4758
}
4859

4960
p {
5061
color: #2697d8;
5162
font-weight: 600;
52-
font-size: large;
63+
font-size: 1.2rem;
5364
}
5465

5566
span {
@@ -63,7 +74,13 @@
6374
position: relative;
6475
font-weight: 500;
6576
font-size: large;
66-
width: 450px;
77+
width: 100%;
78+
max-width: 450px;
79+
margin-bottom: 20px;
80+
}
81+
82+
#show {
83+
display: none;
6784
}
6885

6986
.input {
@@ -73,18 +90,7 @@
7390
border-bottom: 2px solid white;
7491
outline: none;
7592
color: white;
76-
}
77-
78-
#email {
79-
margin-bottom: 50px;
80-
}
81-
82-
#password {
83-
margin-bottom: 30px;
84-
}
85-
86-
#show {
87-
display: none;
93+
width: 100%;
8894
}
8995

9096
.submit {
@@ -97,6 +103,8 @@
97103
margin: 20px 0;
98104
text-align: center;
99105
font-weight: 700;
106+
width: 100%;
107+
cursor: pointer;
100108
}
101109

102110
.submit:hover {
@@ -112,7 +120,6 @@
112120
align-items: center;
113121

114122
a {
115-
float: right;
116123
color: white;
117124
text-decoration: none;
118125
}
@@ -150,79 +157,71 @@
150157
}
151158
}
152159

153-
// @media screen and (max-width: 450px) {
154-
// .side-left {
155-
// h1 {
156-
// font-size: 26px;
157-
// }
158-
159-
// p {
160-
// font-size: 13px;
161-
// }
162-
// }
163-
// }
164-
165-
// @media screen and (max-width: 550px) {
166-
// .side-left {
167-
// height: 30vh;
168-
// margin-top: 10px;
169-
170-
// img {
171-
// margin-bottom: 10px;
172-
// width: 100px;
173-
// }
174-
175-
// h1 {
176-
// font-size: 28px;
177-
// }
178-
179-
// p {
180-
// font-size: 14px;
181-
// }
182-
// }
183-
184-
// .side-right {
185-
// height: 70vh;
186-
187-
// h1 {
188-
// margin-bottom: 40px;
189-
// }
190-
// }
191-
192-
// .input-field {
193-
// width: 350px;
194-
// font-size: medium;
195-
// }
196-
197-
// #login-page #email {
198-
// margin-bottom: 30px;
199-
// }
200-
201-
// #login-page #password {
202-
// margin-bottom: 15px;
203-
// }
204-
// }
205-
206-
// @media screen and (max-width: 767px){
207-
// .side-left {
208-
// height: 30vh;
209-
210-
// img {
211-
// margin-bottom: 10px;
212-
// width: 100px;
213-
// }
214-
// }
215-
216-
// .side-right {
217-
// height: 70vh;
218-
219-
// h1 {
220-
// margin-bottom: 40px;
221-
// }
222-
// }
223-
224-
// .input-field {
225-
// width: 500px;
226-
// }
227-
228-
// }
160+
@media screen and (max-width: 767px) {
161+
.side-left {
162+
height: 40vh;
163+
164+
img {
165+
margin-bottom: 20px;
166+
width: 120px;
167+
}
168+
169+
h1 {
170+
font-size: 1.8rem;
171+
}
172+
173+
p {
174+
font-size: 1rem;
175+
}
176+
}
177+
178+
.side-right {
179+
height: 60vh;
180+
padding: 20px;
181+
182+
h1 {
183+
margin-bottom: 20px;
184+
font-size: 1.8rem;
185+
}
186+
}
187+
188+
.input-field {
189+
max-width: 350px;
190+
font-size: medium;
191+
}
192+
193+
.submit {
194+
margin: 15px 0;
195+
}
196+
}
197+
198+
@media screen and (max-width: 450px) {
199+
.side-left {
200+
height: 30vh;
201+
202+
img {
203+
margin-bottom: 10px;
204+
width: 100px;
205+
}
206+
207+
h1 {
208+
font-size: 1.5rem;
209+
}
210+
211+
p {
212+
font-size: 0.9rem;
213+
}
214+
}
215+
216+
.side-right {
217+
height: 70vh;
218+
219+
h1 {
220+
font-size: 1.5rem;
221+
}
222+
}
223+
224+
.input-field {
225+
max-width: 300px;
226+
}
227+
}

resources/css/form/checkbox.scss

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
11
.form-input {
2-
display: flex;
3-
flex-wrap: wrap;
4-
gap: 1em;
2+
display: grid;
3+
grid-template-columns: repeat(3, 1fr);
4+
gap: 1.5em;
55

6-
.form-check {
6+
.permission-group {
77
display: flex;
8-
align-items: center;
9-
margin-bottom: 0;
10-
11-
.form-check-input {
12-
margin-top: 0 !important;
8+
flex-direction: column;
9+
10+
h5 {
11+
font-size: 12px;
12+
margin-bottom: 10px;
1313
}
1414

15-
.form-check-label {
15+
.form-check {
16+
display: flex;
17+
align-items: center;
1618
margin-bottom: 0;
19+
20+
.form-check-input {
21+
margin-top: 0 !important;
22+
}
23+
24+
.form-check-label {
25+
margin-bottom: 0;
26+
font-size: 14px;
27+
}
1728
}
1829
}
30+
31+
@media (max-width: 768px) {
32+
grid-template-columns: 1fr;
33+
}
1934
}

resources/css/form/form.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,17 @@ form.form-data {
2121
}
2222
}
2323
}
24+
25+
26+
@media screen and (max-width: 767px) {
27+
form.form-data {
28+
width: 100%;
29+
padding: 2em 1em;
30+
margin: 1em auto 0;
31+
32+
.footer {
33+
flex-direction: column;
34+
row-gap: 3px;
35+
}
36+
}
37+
}

resources/css/form/radio.scss

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
.input-radio {
2+
margin-bottom: 1.5rem;
3+
4+
.form-label {
5+
font-weight: 500;
6+
margin-bottom: 0.5rem;
7+
display: block;
8+
}
9+
210
.form-input {
311
display: flex;
4-
column-gap: 1em;
12+
flex-wrap: wrap;
13+
gap: 1rem;
14+
}
15+
16+
.form-check {
17+
display: flex;
18+
align-items: center;
19+
gap: 0.5rem;
20+
}
21+
22+
.form-check-input {
23+
margin: 0;
24+
}
25+
26+
.form-check-label {
27+
margin: 0;
528
}
629
}
30+
31+
@media screen and (max-width: 768px) {
32+
.input-radio {
33+
.form-input {
34+
flex-direction: column;
35+
gap: 0.5rem;
36+
}
37+
38+
.form-check {
39+
width: 100%;
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)