Spaces:
Sleeping
Sleeping
Commit
·
2338cac
1
Parent(s):
20b9075
added progress bar for tasks
Browse files- app/Http/Controllers/DashboardController.php +1 -1
- public/css/dashboard/home.css +4 -0
- public/css/dashboard/myskills.css +15 -0
- public/css/dashboard/skill.css +164 -57
- public/css/home.css +5 -1
- public/js/dashboard/skill.js +84 -14
- resources/views/components/progressbar.blade.php +23 -0
- resources/views/dashboard/skill.blade.php +9 -3
app/Http/Controllers/DashboardController.php
CHANGED
@@ -133,7 +133,7 @@ public function taskPracticed(Request $request){
|
|
133 |
]);
|
134 |
|
135 |
// check if it has been a given amount of time since they last practiced
|
136 |
-
$minutes =
|
137 |
$task = Task::where('id',$request->task_id);
|
138 |
$task = $task->first();
|
139 |
|
|
|
133 |
]);
|
134 |
|
135 |
// check if it has been a given amount of time since they last practiced
|
136 |
+
$minutes = 60*6;
|
137 |
$task = Task::where('id',$request->task_id);
|
138 |
$task = $task->first();
|
139 |
|
public/css/dashboard/home.css
CHANGED
@@ -39,6 +39,10 @@ #get_started_btn{
|
|
39 |
|
40 |
|
41 |
@media screen and (max-width: 550px) {
|
|
|
|
|
|
|
|
|
42 |
#new_user_section{
|
43 |
flex-direction: column-reverse;
|
44 |
}
|
|
|
39 |
|
40 |
|
41 |
@media screen and (max-width: 550px) {
|
42 |
+
section{
|
43 |
+
min-height:400px;
|
44 |
+
padding:1rem 1rem;
|
45 |
+
}
|
46 |
#new_user_section{
|
47 |
flex-direction: column-reverse;
|
48 |
}
|
public/css/dashboard/myskills.css
CHANGED
@@ -117,3 +117,18 @@ .error_msg{
|
|
117 |
|
118 |
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
|
119 |
|
120 |
+
@media screen and (max-width: 550px) {
|
121 |
+
#main_section {
|
122 |
+
margin: 1rem;
|
123 |
+
margin-top: 2rem;
|
124 |
+
padding: 1rem;
|
125 |
+
}
|
126 |
+
.skill{
|
127 |
+
padding:3rem;
|
128 |
+
background-color: #fff;
|
129 |
+
border-radius: 10px;
|
130 |
+
margin:1rem;
|
131 |
+
margin-top:0;
|
132 |
+
margin-left:0;
|
133 |
+
}
|
134 |
+
}
|
public/css/dashboard/skill.css
CHANGED
@@ -26,7 +26,7 @@ .new_btn {
|
|
26 |
color: #fff;
|
27 |
padding: 0.7rem 1rem;
|
28 |
border-radius: 50px;
|
29 |
-
border:none;
|
30 |
cursor: pointer;
|
31 |
}
|
32 |
|
@@ -37,100 +37,107 @@ .line {
|
|
37 |
border-bottom: 2px solid black;
|
38 |
}
|
39 |
|
40 |
-
.task_container{
|
41 |
-
width:100%;
|
42 |
-
display:flex;
|
43 |
flex-direction: column;
|
44 |
align-items: center;
|
45 |
background-color: #fff;
|
46 |
border-radius: 10px;
|
47 |
-
margin:1rem;
|
48 |
-
padding:1rem;
|
49 |
}
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
54 |
flex-direction: row;
|
55 |
-
flex-wrap:wrap;
|
56 |
align-items: center;
|
57 |
background-color: #fff;
|
58 |
border-radius: 10px;
|
59 |
-
min-height:200px;
|
60 |
}
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
64 |
background-color: #fff;
|
65 |
border-radius: 10px;
|
66 |
-
margin:2rem;
|
67 |
-
margin-top:0;
|
68 |
-
margin-left:0;
|
69 |
-
width:
|
70 |
cursor: pointer;
|
71 |
-
border:none;
|
72 |
display: block;
|
73 |
}
|
74 |
-
|
|
|
75 |
text-align: center;
|
76 |
font-size: 1rem;
|
77 |
font-weight: 600;
|
78 |
color: rgb(90, 90, 90);
|
79 |
}
|
80 |
|
81 |
-
#createtask_modal
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
87 |
outline: none;
|
88 |
border-radius: 10px;
|
89 |
-
padding:2rem;
|
90 |
background-color: #fafafa;
|
|
|
91 |
}
|
92 |
|
93 |
-
#createtask_modal>.close_btn
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
97 |
cursor: pointer;
|
98 |
}
|
99 |
|
100 |
-
#createtask_modal>.container
|
|
|
101 |
display: flex;
|
102 |
flex-direction: column;
|
103 |
align-items: center;
|
104 |
}
|
105 |
|
106 |
-
#createtask_modal>.container>.title{
|
107 |
font-size: 2rem;
|
108 |
margin-bottom: 1rem;
|
109 |
}
|
110 |
|
111 |
-
#createtask_modal .field{
|
112 |
display: flex;
|
113 |
flex-direction: column;
|
114 |
margin-top: 1rem;
|
115 |
}
|
116 |
|
117 |
-
#createtask_modal .task_input{
|
118 |
border-radius: 10px;
|
119 |
border: none;
|
120 |
outline: none;
|
121 |
font-size: 1rem;
|
122 |
-
padding:1rem 2rem;
|
123 |
background-color: #fff;
|
124 |
box-shadow: 0px 0px 10px -8px;
|
125 |
}
|
126 |
|
127 |
-
#createtask_modal .submit_btn{
|
128 |
border-radius: 50px;
|
129 |
border: none;
|
130 |
outline: none;
|
131 |
background-color: #2b60f2;
|
132 |
color: #fff;
|
133 |
-
padding:0.7rem 1.5rem;
|
134 |
margin-top: 2rem;
|
135 |
cursor: pointer;
|
136 |
}
|
@@ -138,26 +145,94 @@ #createtask_modal .submit_btn{
|
|
138 |
|
139 |
|
140 |
|
141 |
-
#task_modal .title{
|
142 |
-
font-size:2rem;
|
143 |
margin-bottom: 1rem;
|
144 |
}
|
145 |
|
146 |
-
#task_modal .practice_btn{
|
147 |
border-radius: 50px;
|
148 |
border: none;
|
149 |
outline: none;
|
150 |
background-color: #2b60f2;
|
151 |
color: #fff;
|
152 |
-
padding:0.7rem 1.5rem;
|
153 |
margin-top: 1rem;
|
154 |
cursor: pointer;
|
155 |
}
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
|
|
|
|
|
|
158 |
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
position: fixed;
|
162 |
bottom: 40px;
|
163 |
right: 30px;
|
@@ -168,10 +243,10 @@ #error_container{
|
|
168 |
|
169 |
}
|
170 |
|
171 |
-
#error_container>.error{
|
172 |
-
min-width:100px;
|
173 |
-
min-height:50px;
|
174 |
-
width:fit-content;
|
175 |
background-color: #fff;
|
176 |
box-shadow: 0px 0px 10px -5px #000;
|
177 |
border-radius: 10px;
|
@@ -179,26 +254,58 @@ #error_container>.error{
|
|
179 |
align-items: center;
|
180 |
margin: 6px 0;
|
181 |
}
|
182 |
-
|
|
|
183 |
background-color: red;
|
184 |
-
color
|
185 |
|
186 |
-
padding:0.3rem;
|
187 |
margin: 1rem;
|
188 |
|
189 |
-
border-radius:50%;
|
190 |
-
width:2rem;
|
191 |
aspect-ratio: 1;
|
192 |
display: flex;
|
193 |
align-items: center;
|
194 |
justify-content: center;
|
195 |
}
|
196 |
|
197 |
-
#error_container>.error>span{
|
198 |
margin-right: 1rem;
|
199 |
|
200 |
}
|
201 |
-
|
|
|
202 |
color: red;
|
203 |
-
font-size:0.8rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
|
|
26 |
color: #fff;
|
27 |
padding: 0.7rem 1rem;
|
28 |
border-radius: 50px;
|
29 |
+
border: none;
|
30 |
cursor: pointer;
|
31 |
}
|
32 |
|
|
|
37 |
border-bottom: 2px solid black;
|
38 |
}
|
39 |
|
40 |
+
.task_container {
|
41 |
+
width: 100%;
|
42 |
+
display: flex;
|
43 |
flex-direction: column;
|
44 |
align-items: center;
|
45 |
background-color: #fff;
|
46 |
border-radius: 10px;
|
47 |
+
margin: 1rem;
|
48 |
+
padding: 1rem;
|
49 |
}
|
50 |
+
|
51 |
+
.tasks {
|
52 |
+
width: 100%;
|
53 |
+
margin-top: 2rem;
|
54 |
+
display: flex;
|
55 |
flex-direction: row;
|
56 |
+
flex-wrap: wrap;
|
57 |
align-items: center;
|
58 |
background-color: #fff;
|
59 |
border-radius: 10px;
|
60 |
+
min-height: 200px;
|
61 |
}
|
62 |
+
|
63 |
+
.task {
|
64 |
+
box-shadow: 0px 0px 10px -6px #000;
|
65 |
+
padding: 3rem 2rem;
|
66 |
background-color: #fff;
|
67 |
border-radius: 10px;
|
68 |
+
margin: 2rem;
|
69 |
+
margin-top: 0;
|
70 |
+
margin-left: 0;
|
71 |
+
width: fit-content;
|
72 |
cursor: pointer;
|
73 |
+
border: none;
|
74 |
display: block;
|
75 |
}
|
76 |
+
|
77 |
+
.task>span {
|
78 |
text-align: center;
|
79 |
font-size: 1rem;
|
80 |
font-weight: 600;
|
81 |
color: rgb(90, 90, 90);
|
82 |
}
|
83 |
|
84 |
+
#createtask_modal,
|
85 |
+
#task_modal {
|
86 |
+
position: fixed;
|
87 |
+
top: 50%;
|
88 |
+
left: 50%;
|
89 |
+
transform: translate(-50%, -50%);
|
90 |
+
border: none;
|
91 |
outline: none;
|
92 |
border-radius: 10px;
|
93 |
+
padding: 2rem;
|
94 |
background-color: #fafafa;
|
95 |
+
|
96 |
}
|
97 |
|
98 |
+
#createtask_modal>.close_btn,
|
99 |
+
#task_modal>.close_btn {
|
100 |
+
position: absolute;
|
101 |
+
top: 10px;
|
102 |
+
right: 10px;
|
103 |
cursor: pointer;
|
104 |
}
|
105 |
|
106 |
+
#createtask_modal>.container,
|
107 |
+
#task_modal>.container {
|
108 |
display: flex;
|
109 |
flex-direction: column;
|
110 |
align-items: center;
|
111 |
}
|
112 |
|
113 |
+
#createtask_modal>.container>.title {
|
114 |
font-size: 2rem;
|
115 |
margin-bottom: 1rem;
|
116 |
}
|
117 |
|
118 |
+
#createtask_modal .field {
|
119 |
display: flex;
|
120 |
flex-direction: column;
|
121 |
margin-top: 1rem;
|
122 |
}
|
123 |
|
124 |
+
#createtask_modal .task_input {
|
125 |
border-radius: 10px;
|
126 |
border: none;
|
127 |
outline: none;
|
128 |
font-size: 1rem;
|
129 |
+
padding: 1rem 2rem;
|
130 |
background-color: #fff;
|
131 |
box-shadow: 0px 0px 10px -8px;
|
132 |
}
|
133 |
|
134 |
+
#createtask_modal .submit_btn {
|
135 |
border-radius: 50px;
|
136 |
border: none;
|
137 |
outline: none;
|
138 |
background-color: #2b60f2;
|
139 |
color: #fff;
|
140 |
+
padding: 0.7rem 1.5rem;
|
141 |
margin-top: 2rem;
|
142 |
cursor: pointer;
|
143 |
}
|
|
|
145 |
|
146 |
|
147 |
|
148 |
+
#task_modal .title {
|
149 |
+
font-size: 2rem;
|
150 |
margin-bottom: 1rem;
|
151 |
}
|
152 |
|
153 |
+
#task_modal .practice_btn {
|
154 |
border-radius: 50px;
|
155 |
border: none;
|
156 |
outline: none;
|
157 |
background-color: #2b60f2;
|
158 |
color: #fff;
|
159 |
+
padding: 0.7rem 1.5rem;
|
160 |
margin-top: 1rem;
|
161 |
cursor: pointer;
|
162 |
}
|
163 |
|
164 |
+
.progress_bar_container {
|
165 |
+
width: 500px;
|
166 |
+
display: flex;
|
167 |
+
overflow-x: auto;
|
168 |
+
}
|
169 |
+
|
170 |
+
.progress_bar {
|
171 |
+
/* background:linear-gradient(-45deg, rgb(197, 137, 126) ,rgb(218, 151, 162)); */
|
172 |
+
background-color: transparent;
|
173 |
+
height: 120px;
|
174 |
+
/* width:400px; */
|
175 |
+
|
176 |
+
/* color:#fafafa; */
|
177 |
+
border-radius: 50px;
|
178 |
+
padding: 0.8rem 1.2rem;
|
179 |
+
padding-right: 4rem;
|
180 |
+
|
181 |
+
display: flex;
|
182 |
+
align-items: center;
|
183 |
+
|
184 |
|
185 |
+
}
|
186 |
+
|
187 |
+
.progress_bar>.milestone {
|
188 |
|
189 |
+
height: 100%;
|
190 |
+
display: flex;
|
191 |
+
flex-direction: column;
|
192 |
+
justify-content: center;
|
193 |
+
|
194 |
+
position: relative;
|
195 |
+
}
|
196 |
+
|
197 |
+
.progress_bar .circle {
|
198 |
+
background-color: #cbcbcb;
|
199 |
+
/* border: 1px solid #000; */
|
200 |
+
border-radius: 50%;
|
201 |
+
/* height:50%; */
|
202 |
+
aspect-ratio: 1;
|
203 |
+
width: 40px;
|
204 |
+
}
|
205 |
+
|
206 |
+
.progress_bar .text {
|
207 |
+
/* display: hidden; */
|
208 |
+
position: absolute;
|
209 |
+
/* bottom:0; */
|
210 |
+
bottom: -10px;
|
211 |
+
left: 0;
|
212 |
+
width: 100px;
|
213 |
+
}
|
214 |
+
|
215 |
+
.progress_bar .line {
|
216 |
+
/* display: none; */
|
217 |
+
background: linear-gradient(-45deg, rgb(224, 69, 2), rgb(255, 191, 0));
|
218 |
+
border: none;
|
219 |
+
height: 5px;
|
220 |
+
width: 100px;
|
221 |
+
}
|
222 |
+
|
223 |
+
|
224 |
+
.progress_bar .circle.learn {
|
225 |
+
background: linear-gradient(-45deg, rgb(237, 129, 20), lightgreen, transparent);
|
226 |
+
box-shadow: 0px 0px 20px -5px rgb(116, 121, 110);
|
227 |
+
}
|
228 |
+
|
229 |
+
.progress_bar .circle.practice {
|
230 |
+
background: linear-gradient(-75deg, rgb(217, 108, 133), rgb(220, 157, 75), transparent);
|
231 |
+
box-shadow: 0px 0px 20px -5px #a9e085;
|
232 |
+
}
|
233 |
+
|
234 |
+
#error_container {
|
235 |
+
height: 80%;
|
236 |
position: fixed;
|
237 |
bottom: 40px;
|
238 |
right: 30px;
|
|
|
243 |
|
244 |
}
|
245 |
|
246 |
+
#error_container>.error {
|
247 |
+
min-width: 100px;
|
248 |
+
min-height: 50px;
|
249 |
+
width: fit-content;
|
250 |
background-color: #fff;
|
251 |
box-shadow: 0px 0px 10px -5px #000;
|
252 |
border-radius: 10px;
|
|
|
254 |
align-items: center;
|
255 |
margin: 6px 0;
|
256 |
}
|
257 |
+
|
258 |
+
#error_container>.error>i {
|
259 |
background-color: red;
|
260 |
+
color: #fafafa;
|
261 |
|
262 |
+
padding: 0.3rem;
|
263 |
margin: 1rem;
|
264 |
|
265 |
+
border-radius: 50%;
|
266 |
+
width: 2rem;
|
267 |
aspect-ratio: 1;
|
268 |
display: flex;
|
269 |
align-items: center;
|
270 |
justify-content: center;
|
271 |
}
|
272 |
|
273 |
+
#error_container>.error>span {
|
274 |
margin-right: 1rem;
|
275 |
|
276 |
}
|
277 |
+
|
278 |
+
.error_msg {
|
279 |
color: red;
|
280 |
+
font-size: 0.8rem;
|
281 |
+
}
|
282 |
+
|
283 |
+
|
284 |
+
|
285 |
+
@media screen and (max-width: 550px) {
|
286 |
+
#main_section {
|
287 |
+
margin: 1rem;
|
288 |
+
margin-top: 2rem;
|
289 |
+
padding: 1rem;
|
290 |
+
}
|
291 |
+
|
292 |
+
.task {
|
293 |
+
|
294 |
+
padding: 2rem;
|
295 |
+
margin: 1rem;
|
296 |
+
margin-top: 0;
|
297 |
+
margin-left: 0;
|
298 |
+
|
299 |
+
width: fit-content;
|
300 |
+
}
|
301 |
+
|
302 |
+
dialog {
|
303 |
+
width: 100%;
|
304 |
+
}
|
305 |
+
|
306 |
+
.progress_bar_container {
|
307 |
+
width: 100%;
|
308 |
+
}
|
309 |
+
|
310 |
+
|
311 |
}
|
public/css/home.css
CHANGED
@@ -10,6 +10,7 @@ #info_container {
|
|
10 |
flex-direction: row;
|
11 |
align-items: center;
|
12 |
justify-content: space-evenly;
|
|
|
13 |
}
|
14 |
|
15 |
#info_container>p {
|
@@ -21,10 +22,11 @@ #info_container>p {
|
|
21 |
#info_container>img {
|
22 |
max-width: 550px;
|
23 |
width: 50%;
|
|
|
24 |
}
|
25 |
|
26 |
#topdown_container {
|
27 |
-
background-image:linear-gradient(-45deg, white, pink,
|
28 |
}
|
29 |
|
30 |
#topdown_container>.heading,
|
@@ -35,6 +37,7 @@ #bottomup_container>.heading {
|
|
35 |
|
36 |
#bottomup_container>.heading {
|
37 |
text-align: right;
|
|
|
38 |
}
|
39 |
|
40 |
#topdown_container>.main_section,
|
@@ -74,6 +77,7 @@ @media screen and (max-width: 768px) {
|
|
74 |
|
75 |
>img {
|
76 |
width: 80%;
|
|
|
77 |
}
|
78 |
}
|
79 |
|
|
|
10 |
flex-direction: row;
|
11 |
align-items: center;
|
12 |
justify-content: space-evenly;
|
13 |
+
|
14 |
}
|
15 |
|
16 |
#info_container>p {
|
|
|
22 |
#info_container>img {
|
23 |
max-width: 550px;
|
24 |
width: 50%;
|
25 |
+
|
26 |
}
|
27 |
|
28 |
#topdown_container {
|
29 |
+
background-image:linear-gradient(-45deg, white, pink, transparent);
|
30 |
}
|
31 |
|
32 |
#topdown_container>.heading,
|
|
|
37 |
|
38 |
#bottomup_container>.heading {
|
39 |
text-align: right;
|
40 |
+
background-image:linear-gradient(-45deg, white, pink, transparent);
|
41 |
}
|
42 |
|
43 |
#topdown_container>.main_section,
|
|
|
77 |
|
78 |
>img {
|
79 |
width: 80%;
|
80 |
+
|
81 |
}
|
82 |
}
|
83 |
|
public/js/dashboard/skill.js
CHANGED
@@ -1,38 +1,55 @@
|
|
1 |
-
function showCreateTask(task_type){
|
2 |
var task_type_elem = createtask_modal.querySelector("#task_type");
|
3 |
task_type_elem.value = task_type;
|
4 |
createtask_modal.showModal();
|
5 |
}
|
6 |
-
function closeCreateTask(){
|
7 |
createtask_modal.close();
|
8 |
}
|
9 |
-
function showTask(task_id){
|
10 |
-
fetch(`${taskdetail_url}/${task_id}`,{
|
11 |
-
method:"GET",
|
12 |
-
}).then(res=>res.json()).then((res)=>{
|
13 |
// console.log(res);
|
14 |
title_elem = task_modal.querySelector(".title");
|
15 |
-
count_elem = task_modal.querySelector(".count");
|
16 |
task_id_elem = task_modal.querySelector('#task_id');
|
|
|
17 |
|
18 |
title_elem.innerText = res['title'];
|
19 |
-
count_elem.innerText = res['practice_count'];
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
// task_id_elem.value = "bye";
|
22 |
task_id_elem.value = res['id'];
|
23 |
-
|
24 |
|
25 |
task_modal.showModal();
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
})
|
28 |
|
29 |
}
|
30 |
-
function closeTask(){
|
31 |
task_modal.close();
|
32 |
}
|
33 |
|
34 |
|
35 |
-
function addError(msg){
|
36 |
// <div class="error">
|
37 |
// <i class="fa-solid fa-xmark"></i>
|
38 |
// <span>error see</span>
|
@@ -45,9 +62,62 @@ function addError(msg){
|
|
45 |
|
46 |
error_container.append(error_elem);
|
47 |
|
48 |
-
setTimeout(function(){
|
49 |
error_elem.remove(); // remove after 7 seconds
|
50 |
-
},1000*7);
|
51 |
}
|
52 |
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function showCreateTask(task_type) {
|
2 |
var task_type_elem = createtask_modal.querySelector("#task_type");
|
3 |
task_type_elem.value = task_type;
|
4 |
createtask_modal.showModal();
|
5 |
}
|
6 |
+
function closeCreateTask() {
|
7 |
createtask_modal.close();
|
8 |
}
|
9 |
+
function showTask(task_id) {
|
10 |
+
fetch(`${taskdetail_url}/${task_id}`, {
|
11 |
+
method: "GET",
|
12 |
+
}).then(res => res.json()).then((res) => {
|
13 |
// console.log(res);
|
14 |
title_elem = task_modal.querySelector(".title");
|
|
|
15 |
task_id_elem = task_modal.querySelector('#task_id');
|
16 |
+
// count_elem = task_modal.querySelector(".count");
|
17 |
|
18 |
title_elem.innerText = res['title'];
|
19 |
+
// count_elem.innerText = res['practice_count'];
|
20 |
+
var total_count = res['practice_count']; // goal count
|
21 |
+
if(total_count==0) total_count=4; // learn + 3 practice
|
22 |
+
else total_count = Math.floor((total_count-1)/3)*3+4; // formula to give 3 new practice everytime we reach the goal
|
23 |
+
createMilestones(document.querySelector('#task_modal .progress_bar'),res['practice_count'],total_count);
|
24 |
+
|
25 |
+
|
26 |
|
|
|
27 |
task_id_elem.value = res['id'];
|
28 |
+
|
29 |
|
30 |
task_modal.showModal();
|
31 |
|
32 |
+
|
33 |
+
// scroll to the end
|
34 |
+
var progressbar_container = document.querySelector("#task_modal .progress_bar_container");
|
35 |
+
var scrollWidth = progressbar_container.scrollWidth;
|
36 |
+
scrollWidth/=total_count;
|
37 |
+
scrollWidth*=res['practice_count']-1; // -1 to scroll it a little less than the last completed one
|
38 |
+
// scrollWidth=0;
|
39 |
+
// scrollWidth
|
40 |
+
console.log(scrollWidth);
|
41 |
+
progressbar_container.scrollTo(scrollWidth, 0); // x,y
|
42 |
+
|
43 |
+
|
44 |
})
|
45 |
|
46 |
}
|
47 |
+
function closeTask() {
|
48 |
task_modal.close();
|
49 |
}
|
50 |
|
51 |
|
52 |
+
function addError(msg) {
|
53 |
// <div class="error">
|
54 |
// <i class="fa-solid fa-xmark"></i>
|
55 |
// <span>error see</span>
|
|
|
62 |
|
63 |
error_container.append(error_elem);
|
64 |
|
65 |
+
setTimeout(function () {
|
66 |
error_elem.remove(); // remove after 7 seconds
|
67 |
+
}, 1000 * 7);
|
68 |
}
|
69 |
|
70 |
|
71 |
+
|
72 |
+
function createMilestones(progress_bar,practice_count,total_count) {
|
73 |
+
|
74 |
+
// <div class="milestone">
|
75 |
+
// <div class="circle learn"></div>
|
76 |
+
// <span class='text'>Learn</span>
|
77 |
+
// </div>
|
78 |
+
// <div class="line"></div>
|
79 |
+
// <div class="milestone">
|
80 |
+
// <div class="circle practice"></div>
|
81 |
+
// <span class='text'>Practice 1</span>
|
82 |
+
// </div>
|
83 |
+
// total_count+=1;
|
84 |
+
progress_bar.innerHTML = " ";
|
85 |
+
|
86 |
+
for (var i = 1; i <= total_count; i++) {
|
87 |
+
|
88 |
+
|
89 |
+
var milestone = document.createElement("div");
|
90 |
+
milestone.className = "milestone";
|
91 |
+
|
92 |
+
circle = document.createElement('div');
|
93 |
+
circle.className = "circle";
|
94 |
+
|
95 |
+
var text = document.createElement("span");
|
96 |
+
text.className = "text";
|
97 |
+
|
98 |
+
if(i<= practice_count){
|
99 |
+
if(i == 1) circle.classList.add("learn");
|
100 |
+
else circle.classList.add("practice");
|
101 |
+
}
|
102 |
+
|
103 |
+
if(i == 1) text.innerText = "learn";
|
104 |
+
else text.innerText = `practice ${i-1}`;
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
milestone.appendChild(circle);
|
109 |
+
milestone.appendChild(text);
|
110 |
+
|
111 |
+
var line = document.createElement('div');
|
112 |
+
line.className = "line";
|
113 |
+
|
114 |
+
progress_bar.appendChild(milestone);
|
115 |
+
if(i<total_count) progress_bar.appendChild(line);
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
// createMilestones(document.querySelector('#task_modal .progress_bar'), ['learn', null, null])
|
122 |
+
createMilestones(document.querySelector('#task_modal .progress_bar'),2,4);
|
123 |
+
// createMilestones(document.querySelector('#task_modal .progress_bar'),4,15);
|
resources/views/components/progressbar.blade.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="progress_bar">
|
2 |
+
<div class="circles">
|
3 |
+
<div class="circle_container">
|
4 |
+
<div class="circle learn"></div>
|
5 |
+
</div>
|
6 |
+
<div class="line"></div>
|
7 |
+
<div class="circle_container">
|
8 |
+
<div class="circle practice"></div>
|
9 |
+
</div>
|
10 |
+
<div class="line"></div>
|
11 |
+
<div class="circle_container">
|
12 |
+
<div class="circle practice"></div>
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
<div class="texts">
|
17 |
+
<div class="text">Learn</div>
|
18 |
+
<div class="line"></div>
|
19 |
+
<div class="text">Practice 1</div>
|
20 |
+
<div class="line"></div>
|
21 |
+
<div class="text">Practice 2</div>
|
22 |
+
</div>
|
23 |
+
</div>
|
resources/views/dashboard/skill.blade.php
CHANGED
@@ -100,7 +100,12 @@
|
|
100 |
@csrf
|
101 |
<input type='text' name="task_id" id="task_id" hidden>
|
102 |
<span class='title'>Title</span>
|
103 |
-
<span>Practice Count: <span class='count'>0</span></span>
|
|
|
|
|
|
|
|
|
|
|
104 |
<input class="practice_btn" type="submit" value="practiced">
|
105 |
</form>
|
106 |
</dialog>
|
@@ -114,9 +119,10 @@
|
|
114 |
var taskdetail_url = "{{ route('dashboard.taskdetail', 1) }}";
|
115 |
taskdetail_url = taskdetail_url.split('/').slice(0, -1).join("/");
|
116 |
|
117 |
-
// task_modal.showModal();
|
118 |
@foreach ($errors->all() as $error)
|
119 |
-
|
120 |
@endforeach
|
|
|
|
|
121 |
</script>
|
122 |
@endsection
|
|
|
100 |
@csrf
|
101 |
<input type='text' name="task_id" id="task_id" hidden>
|
102 |
<span class='title'>Title</span>
|
103 |
+
{{-- <span>Practice Count: <span class='count'>0</span></span> --}}
|
104 |
+
<div class="progress_bar_container">
|
105 |
+
|
106 |
+
<div class="progress_bar"></div>
|
107 |
+
|
108 |
+
</div>
|
109 |
<input class="practice_btn" type="submit" value="practiced">
|
110 |
</form>
|
111 |
</dialog>
|
|
|
119 |
var taskdetail_url = "{{ route('dashboard.taskdetail', 1) }}";
|
120 |
taskdetail_url = taskdetail_url.split('/').slice(0, -1).join("/");
|
121 |
|
|
|
122 |
@foreach ($errors->all() as $error)
|
123 |
+
addError('{{ $error }}');
|
124 |
@endforeach
|
125 |
+
|
126 |
+
// task_modal.showModal();
|
127 |
</script>
|
128 |
@endsection
|