Skip to content

Commit 8eafd9b

Browse files
authored
Merge pull request #261 from dotkernel/issue-255
Javascript refactoring and packages updates
2 parents 975245a + 99377eb commit 8eafd9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+547
-665
lines changed

package.json

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,24 @@
2323
},
2424
"homepage": "https://github.com/dotkernel/admin#readme",
2525
"dependencies": {
26-
"@fullcalendar/core": "^6.1.11",
27-
"@fullcalendar/daygrid": "^6.1.11",
28-
"@fullcalendar/interaction": "^6.1.11",
29-
"@fullcalendar/list": "^6.1.11",
30-
"@fullcalendar/timegrid": "^6.1.11",
26+
"@fullcalendar/core": "^6.1.14",
27+
"@fullcalendar/daygrid": "^6.1.14",
28+
"@fullcalendar/interaction": "^6.1.14",
29+
"@fullcalendar/list": "^6.1.14",
30+
"@fullcalendar/timegrid": "^6.1.14",
3131
"@popperjs/core": "^2.11.8",
3232
"babel-polyfill": "^6.26.0",
3333
"bootstrap": "^5.3.3",
3434
"bootstrap-datepicker": "^1.10.0",
3535
"bootstrap-icons": "^1.11.3",
36-
"bootstrap-table": "^1.22.2",
36+
"bootstrap-table": "^1.23.0",
3737
"brand-colors": "^2.1.1",
38-
"chart.js": "^2.9.4",
38+
"chart.js": "^4.4.3",
3939
"easy-pie-chart": "^2.1.7",
4040
"file-loader": "^6.2.0",
41-
"fullcalendar": "^6.1.11",
41+
"fullcalendar": "^6.1.14",
4242
"jquery": "^3.7.1",
4343
"jquery-sparkline": "^2.4.0",
44-
"jvectormap": "^2.0.4",
4544
"load-google-maps-api": "^2.0.2",
4645
"lodash": "^4.17.21",
4746
"masonry-layout": "^4.2.2",
@@ -50,12 +49,12 @@
5049
"skycons": "^1.0.0"
5150
},
5251
"devDependencies": {
53-
"@babel/core": "^7.23.9",
54-
"@babel/eslint-parser": "^7.23.10",
52+
"@babel/core": "^7.24.7",
53+
"@babel/eslint-parser": "^7.24.7",
5554
"@babel/plugin-proposal-class-properties": "^7.18.6",
5655
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
57-
"@babel/plugin-transform-runtime": "^7.23.9",
58-
"@babel/runtime": "^7.23.9",
56+
"@babel/plugin-transform-runtime": "^7.24.7",
57+
"@babel/runtime": "^7.24.7",
5958
"babel-core": "^6.26.3",
6059
"babel-loader": "^9.1.3",
6160
"babel-preset-env": "^1.7.0",
@@ -64,27 +63,27 @@
6463
"clean-webpack-plugin": "^4.0.0",
6564
"copy-webpack-plugin": "^12.0.2",
6665
"cross-env": "^7.0.3",
67-
"css-loader": "^5.2.6",
68-
"css-minimizer-webpack-plugin": "^6.0.0",
69-
"eslint": "^8.57.0",
66+
"css-loader": "5.2.7",
67+
"css-minimizer-webpack-plugin": "^7.0.0",
68+
"eslint": "^8.56.0",
7069
"eslint-config-airbnb-base": "^15.0.0",
7170
"eslint-plugin-import": "^2.29.1",
7271
"expose-loader": "^5.0.0",
7372
"html-webpack-plugin": "^5.6.0",
7473
"imagemin-webpack-plugin": "^2.4.2",
75-
"mini-css-extract-plugin": "^2.8.0",
76-
"postcss": "^8.4.35",
77-
"postcss-loader": "^8.1.0",
78-
"postcss-preset-env": "^9.4.0",
79-
"sass": "^1.71.1",
80-
"sass-loader": "^14.1.1",
74+
"mini-css-extract-plugin": "^2.9.0",
75+
"postcss": "^8.4.39",
76+
"postcss-loader": "^8.1.1",
77+
"postcss-preset-env": "^9.6.0",
78+
"sass": "^1.77.1",
79+
"sass-loader": "^14.2.1",
8180
"shx": "^0.3.4",
82-
"style-loader": "^3.3.4",
83-
"stylelint": "^16.2.1",
84-
"stylelint-config-standard": "^36.0.0",
85-
"webpack": "^5.90.3",
81+
"style-loader": "^4.0.0",
82+
"stylelint": "^16.6.1",
83+
"stylelint-config-standard": "^36.0.1",
84+
"webpack": "^5.92.1",
8685
"webpack-cli": "^5.1.4",
8786
"webpack-dashboard": "^3.3.8",
88-
"webpack-dev-server": "^5.0.2"
87+
"webpack-dev-server": "^5.0.4"
8988
}
9089
}

public/css/app.css

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/images/app/logo.svg

Lines changed: 13 additions & 15 deletions
Loading

public/js/app.js

Lines changed: 31 additions & 293 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Admin/src/Controller/AdminController.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
use Psr\Http\Message\ResponseInterface;
3838
use Throwable;
3939

40-
use function json_decode;
4140
use function password_verify;
4241

4342
class AdminController extends AbstractActionController
@@ -92,20 +91,20 @@ public function addAction(): ResponseInterface
9291
} else {
9392
return new JsonResponse(
9493
['message' => $this->forms->getMessagesAsString($this->adminForm)],
95-
StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
94+
StatusCodeInterface::STATUS_BAD_REQUEST
9695
);
9796
}
9897
}
9998

100-
return new HtmlResponse(
101-
$this->template->render(
99+
return new JsonResponse([
100+
'data' => $this->template->render(
102101
'partial::ajax-form',
103102
[
104103
'form' => $this->adminForm,
105104
'formAction' => '/admin/add',
106105
]
107-
)
108-
);
106+
),
107+
]);
109108
}
110109

111110
/**
@@ -152,29 +151,37 @@ public function editAction(): ResponseInterface
152151

153152
$this->adminForm->bind($adminFormData);
154153

155-
return new HtmlResponse(
156-
$this->template->render(
154+
return new JsonResponse([
155+
'data' => $this->template->render(
157156
'partial::ajax-form',
158157
[
159158
'form' => $this->adminForm,
160159
'formAction' => '/admin/edit/' . $uuid,
161160
]
162-
)
163-
);
161+
),
162+
]);
164163
}
165164

166165
/**
167166
* @throws NonUniqueResultException
168167
*/
169168
public function deleteAction(): ResponseInterface
170169
{
171-
$data = json_decode($this->getRequest()->getBody()->getContents(), true);
172-
$uuid = $data['value']['uuid'] ?? null;
170+
if (! $this->isDelete()) {
171+
return new JsonResponse([
172+
'error' => [
173+
'messages' => [
174+
[Message::METHOD_NOT_ALLOWED],
175+
],
176+
],
177+
], StatusCodeInterface::STATUS_METHOD_NOT_ALLOWED);
178+
}
173179

180+
$uuid = $this->getAttribute('uuid');
174181
if (empty($uuid)) {
175182
return new JsonResponse(
176183
['message' => Message::ADMIN_NOT_FOUND],
177-
StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
184+
StatusCodeInterface::STATUS_NOT_FOUND
178185
);
179186
}
180187

src/Admin/src/RoutesDelegator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
1919
$app->route(
2020
'/admin[/{action}[/{uuid}]]',
2121
AdminController::class,
22-
[RequestMethodInterface::METHOD_GET, RequestMethodInterface::METHOD_POST],
22+
[
23+
RequestMethodInterface::METHOD_GET,
24+
RequestMethodInterface::METHOD_POST,
25+
RequestMethodInterface::METHOD_DELETE,
26+
],
2327
'admin'
2428
);
2529

0 commit comments

Comments
 (0)