Skip to content

Commit

Permalink
Merge pull request #261 from dotkernel/issue-255
Browse files Browse the repository at this point in the history
Javascript refactoring and packages updates
  • Loading branch information
arhimede authored Jul 15, 2024
2 parents 975245a + 99377eb commit 8eafd9b
Show file tree
Hide file tree
Showing 42 changed files with 547 additions and 665 deletions.
53 changes: 26 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,24 @@
},
"homepage": "https://github.com/dotkernel/admin#readme",
"dependencies": {
"@fullcalendar/core": "^6.1.11",
"@fullcalendar/daygrid": "^6.1.11",
"@fullcalendar/interaction": "^6.1.11",
"@fullcalendar/list": "^6.1.11",
"@fullcalendar/timegrid": "^6.1.11",
"@fullcalendar/core": "^6.1.14",
"@fullcalendar/daygrid": "^6.1.14",
"@fullcalendar/interaction": "^6.1.14",
"@fullcalendar/list": "^6.1.14",
"@fullcalendar/timegrid": "^6.1.14",
"@popperjs/core": "^2.11.8",
"babel-polyfill": "^6.26.0",
"bootstrap": "^5.3.3",
"bootstrap-datepicker": "^1.10.0",
"bootstrap-icons": "^1.11.3",
"bootstrap-table": "^1.22.2",
"bootstrap-table": "^1.23.0",
"brand-colors": "^2.1.1",
"chart.js": "^2.9.4",
"chart.js": "^4.4.3",
"easy-pie-chart": "^2.1.7",
"file-loader": "^6.2.0",
"fullcalendar": "^6.1.11",
"fullcalendar": "^6.1.14",
"jquery": "^3.7.1",
"jquery-sparkline": "^2.4.0",
"jvectormap": "^2.0.4",
"load-google-maps-api": "^2.0.2",
"lodash": "^4.17.21",
"masonry-layout": "^4.2.2",
Expand All @@ -50,12 +49,12 @@
"skycons": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/eslint-parser": "^7.23.10",
"@babel/core": "^7.24.7",
"@babel/eslint-parser": "^7.24.7",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-runtime": "^7.23.9",
"@babel/runtime": "^7.23.9",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/runtime": "^7.24.7",
"babel-core": "^6.26.3",
"babel-loader": "^9.1.3",
"babel-preset-env": "^1.7.0",
Expand All @@ -64,27 +63,27 @@
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"cross-env": "^7.0.3",
"css-loader": "^5.2.6",
"css-minimizer-webpack-plugin": "^6.0.0",
"eslint": "^8.57.0",
"css-loader": "5.2.7",
"css-minimizer-webpack-plugin": "^7.0.0",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.29.1",
"expose-loader": "^5.0.0",
"html-webpack-plugin": "^5.6.0",
"imagemin-webpack-plugin": "^2.4.2",
"mini-css-extract-plugin": "^2.8.0",
"postcss": "^8.4.35",
"postcss-loader": "^8.1.0",
"postcss-preset-env": "^9.4.0",
"sass": "^1.71.1",
"sass-loader": "^14.1.1",
"mini-css-extract-plugin": "^2.9.0",
"postcss": "^8.4.39",
"postcss-loader": "^8.1.1",
"postcss-preset-env": "^9.6.0",
"sass": "^1.77.1",
"sass-loader": "^14.2.1",
"shx": "^0.3.4",
"style-loader": "^3.3.4",
"stylelint": "^16.2.1",
"stylelint-config-standard": "^36.0.0",
"webpack": "^5.90.3",
"style-loader": "^4.0.0",
"stylelint": "^16.6.1",
"stylelint-config-standard": "^36.0.1",
"webpack": "^5.92.1",
"webpack-cli": "^5.1.4",
"webpack-dashboard": "^3.3.8",
"webpack-dev-server": "^5.0.2"
"webpack-dev-server": "^5.0.4"
}
}
5 changes: 2 additions & 3 deletions public/css/app.css

Large diffs are not rendered by default.

28 changes: 13 additions & 15 deletions public/images/app/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
324 changes: 31 additions & 293 deletions public/js/app.js

Large diffs are not rendered by default.

33 changes: 20 additions & 13 deletions src/Admin/src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
use Psr\Http\Message\ResponseInterface;
use Throwable;

use function json_decode;
use function password_verify;

class AdminController extends AbstractActionController
Expand Down Expand Up @@ -92,20 +91,20 @@ public function addAction(): ResponseInterface
} else {
return new JsonResponse(
['message' => $this->forms->getMessagesAsString($this->adminForm)],
StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
StatusCodeInterface::STATUS_BAD_REQUEST
);
}
}

return new HtmlResponse(
$this->template->render(
return new JsonResponse([
'data' => $this->template->render(
'partial::ajax-form',
[
'form' => $this->adminForm,
'formAction' => '/admin/add',
]
)
);
),
]);
}

/**
Expand Down Expand Up @@ -152,29 +151,37 @@ public function editAction(): ResponseInterface

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

return new HtmlResponse(
$this->template->render(
return new JsonResponse([
'data' => $this->template->render(
'partial::ajax-form',
[
'form' => $this->adminForm,
'formAction' => '/admin/edit/' . $uuid,
]
)
);
),
]);
}

/**
* @throws NonUniqueResultException
*/
public function deleteAction(): ResponseInterface
{
$data = json_decode($this->getRequest()->getBody()->getContents(), true);
$uuid = $data['value']['uuid'] ?? null;
if (! $this->isDelete()) {
return new JsonResponse([
'error' => [
'messages' => [
[Message::METHOD_NOT_ALLOWED],
],
],
], StatusCodeInterface::STATUS_METHOD_NOT_ALLOWED);
}

$uuid = $this->getAttribute('uuid');
if (empty($uuid)) {
return new JsonResponse(
['message' => Message::ADMIN_NOT_FOUND],
StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR
StatusCodeInterface::STATUS_NOT_FOUND
);
}

Expand Down
6 changes: 5 additions & 1 deletion src/Admin/src/RoutesDelegator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
$app->route(
'/admin[/{action}[/{uuid}]]',
AdminController::class,
[RequestMethodInterface::METHOD_GET, RequestMethodInterface::METHOD_POST],
[
RequestMethodInterface::METHOD_GET,
RequestMethodInterface::METHOD_POST,
RequestMethodInterface::METHOD_DELETE,
],
'admin'
);

Expand Down
Loading

0 comments on commit 8eafd9b

Please sign in to comment.