diff --git a/.babelrc b/.babelrc index cdcf92c67..0960c0126 100644 --- a/.babelrc +++ b/.babelrc @@ -2,27 +2,5 @@ "presets": [ "@babel/preset-env", "@babel/preset-react" - ], - "env": { - "test": { - "plugins": [ - "istanbul" - ] - } - }, - "plugins": [ - "react-hot-loader/babel", - "@babel/plugin-proposal-class-properties", - [ - "module-resolver", - { - "root": [ - "./src" - ], - "alias": { - "src": "./src" - } - } - ] ] } \ No newline at end of file diff --git a/.env.example b/.env.example index 67dd880dd..5afea5b9f 100644 --- a/.env.example +++ b/.env.example @@ -1,10 +1,10 @@ # Required -API_URL=https://mvj.dev.hel.ninja/v1 -STORAGE_PREFIX=MVJ +VITE_API_URL=https://mvj.dev.hel.ninja/v1 +VITE_STORAGE_PREFIX=MVJ PORT=3000 # The SSO OpenId Connect settings -OPENID_CONNECT_API_TOKEN_KEY=https://api.hel.fi/auth/mvj -OPENID_CONNECT_API_TOKEN_URL=https://api.hel.fi/sso/api-tokens/ -OPENID_CONNECT_AUTHORITY_URL=https://api.hel.fi/sso/openid/ -OPENID_CONNECT_CLIENT_ID=https://api.hel.fi/auth/mvj -OPENID_CONNECT_SCOPE=openid profile mvj https://api.hel.fi/auth/mvj \ No newline at end of file +VITE_OPENID_CONNECT_API_TOKEN_KEY=https://api.hel.fi/auth/mvj +VITE_OPENID_CONNECT_API_TOKEN_URL=https://api.hel.fi/sso/api-tokens/ +VITE_OPENID_CONNECT_AUTHORITY_URL=https://api.hel.fi/sso/openid/ +VITE_OPENID_CONNECT_CLIENT_ID=https://api.hel.fi/auth/mvj +VITE_OPENID_CONNECT_SCOPE=openid profile mvj https://api.hel.fi/auth/mvj \ No newline at end of file diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 7329cae38..000000000 --- a/.eslintrc +++ /dev/null @@ -1,41 +0,0 @@ -{ - "extends": [ - "eslint:recommended", - "plugin:react/recommended" - ], - "env": { - "browser": true, - "es6": true, - "mocha": true, - "node": true - }, - "globals": { - "Generator": true, - "__DEV__": true - }, - "parser": "@babel/eslint-parser", - "rules": { - "comma-dangle": [2, "always-multiline"], - "comma-spacing": 2, - "display-name": 0, - "eol-last": [2, "always"], - "indent": [2, 2, {"SwitchCase":1}], - "key-spacing": ["error"], - "no-console": 0, - "no-multiple-empty-lines": 2, - "object-curly-spacing": [2, "never"], - "quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}], - "semi": [2, "always"], - "react/display-name": "off", - "react/no-find-dom-node": "off", - "no-case-declarations": "off" - }, - "plugins": [ - "react" - ], - "settings": { - "react": { - "version": "detect" - } - } -} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b529bf71f..fafe58384 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,5 +22,5 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: yarn - - run: yarn test:coverage - - run: yarn compile \ No newline at end of file + - run: yarn coverage + - run: yarn build \ No newline at end of file diff --git a/LICENSE b/LICENSE index 1394b3b0f..0d39b83d4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 City of Helsinki +Copyright (c) 2024 City of Helsinki Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 04cd9c201..a7f22fac4 100644 --- a/README.md +++ b/README.md @@ -4,24 +4,19 @@ # MVJ UI -City of Helsinki ground rental system UI +City of Helsinki Land lease UI -Based on [React Boilerplate](https://github.com/nordsoftware/react-boilerplate). ## What's in the box? -- [Flowtype](https://flowtype.org/) Type checker +- [Typescript](https://www.typescriptlang.org/) Type checker - [Yarn](https://yarnpkg.com/) Dependency manager +- [Vite](https://vitejs.dev/) Front-end tooling +- [Vitest](https://vitest.dev/) Testing framework - [React](https://facebook.github.io/react/) User interface components - [Redux](http://redux.js.org/) Predictable state container - [Lodash](https://lodash.com/) Utility library -- [Babel](https://babeljs.io/) ES.Next transpiler - [Eslint](http://eslint.org/) Linting utility -- [Webpack](https://webpack.github.io/) Module bundler -- [Mocha](https://mochajs.org/) Testing framework -- [Chai](http://chaijs.com/) Assertion library -- [Enzyme](https://github.com/airbnb/enzyme) React testing utilities -- And more... ## Usage with Docker @@ -54,32 +49,23 @@ Make sure you have [Yarn](https://yarnpkg.com/en/docs/install) installed globall ```bash yarn ``` -#### 3. Setup Flow typing definitions for dependencies -```bash -flow-typed install -``` -If the tool cannot be found as is, you can invoke it from -the node binary folder manually (i.e. -`./node_modules/.bin/flow-typed`) instead of just -`flow-typed`). - -#### 4. Add .env file +#### 3. Add .env file ```bash cp .env.example .env ``` -#### 5. Start the development server +#### 4. Start the development server ```bash yarn start ``` -#### 6. Compile the distribution build +#### 5. Compile the distribution build ```bash -yarn run compile +yarn run build ``` ## Test @@ -91,12 +77,12 @@ yarn test #### Run the test suit in watch mode -``` +```bash yarn run test:watch ``` #### Generate the test coverage report -``` +```bash yarn run test:coverage ``` diff --git a/config/env.js b/config/env.js deleted file mode 100644 index 0b340c861..000000000 --- a/config/env.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const paths = require('./paths'); - -// Make sure that including paths.js after env.js will read .env variables. -delete require.cache[require.resolve('./paths')]; - -const NODE_ENV = process.env.NODE_ENV; -if (!NODE_ENV) { - throw new Error( - 'The NODE_ENV environment variable is required but was not specified.' - ); -} - -// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use -var dotenvFiles = [ - paths.dotenv, -].filter(Boolean); - -// Load environment variables from .env* files. Suppress warnings using silent -// if this file is missing. dotenv will never modify any environment variables -// that have already been set. -// https://github.com/motdotla/dotenv -dotenvFiles.forEach(dotenvFile => { - if (fs.existsSync(dotenvFile)) { - require('dotenv').config({ - path: dotenvFile, - }); - } -}); - -function getClientEnvironment() { - const raw = Object.keys(process.env) - .reduce( - (env, key) => { - env[key] = process.env[key]; - return env; - }, - { - // Useful for determining whether we’re running in production mode. - // Most importantly, it switches React into the correct mode. - NODE_ENV: process.env.NODE_ENV || 'development', - } - ); - // Stringify all values so we can feed into Webpack DefinePlugin - const stringified = { - 'process.env': Object.keys(raw).reduce((env, key) => { - env[key] = JSON.stringify(raw[key]); - return env; - }, {}), - }; - - return {raw, stringified}; -} - -module.exports = getClientEnvironment; diff --git a/config/paths.js b/config/paths.js deleted file mode 100644 index fc0fe22d6..000000000 --- a/config/paths.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -const path = require('path'); -const fs = require('fs'); -const url = require('url'); - -// Make sure any symlinks in the project folder are resolved: -// https://github.com/facebookincubator/create-react-app/issues/637 -const appDirectory = fs.realpathSync(process.cwd()); -const resolveApp = relativePath => path.resolve(appDirectory, relativePath); - -const envPublicUrl = process.env.PUBLIC_URL; - -function ensureSlash(path, needsSlash) { - const hasSlash = path.endsWith('/'); - if (hasSlash && !needsSlash) { - return path.substr(path, path.length - 1); - } else if (!hasSlash && needsSlash) { - return `${path}/`; - } else { - return path; - } -} - - -const getPublicUrl = appPackageJson => - envPublicUrl || require(appPackageJson).homepage; - -// We use `PUBLIC_URL` environment variable or "homepage" field to infer -// "public path" at which the app is served. -// Webpack needs to know it to put the right diff --git a/package.json b/package.json index 94eb3d2a0..ed8909fdf 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,26 @@ { "name": "mvj-ui", "version": "1.0.0", - "description": "City of Helsinki ground rent system UI", - "main": "src/index.ts", + "description": "City of Helsinki Land lease UI", + "main": "src/index.tsx", "author": "Jori Lindell ", "license": "MIT", - "nyc": { - "require": [ - "@babel/register", - "./src/test.ts" - ], - "sourceMap": false, - "instrument": false - }, + "type": "module", "scripts": { + "build": "vite build", + "dev": "vite", "lint": "eslint src", - "serve": "webpack serve", - "start": "node scripts/start.js", - "compile": "node scripts/compile.js", + "start": "vite", + "compile": "vite build", "precommit": "npm-run-all lint", "prepush": "npm-run-all test", - "test": "mocha --require @babel/register --require ts-node/register --require tsconfig-paths/register --require src/test.ts \"src/**/*spec.ts\"", - "test:coverage": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text --require ts-node/register --require tsconfig-paths/register mocha \"src/**/*spec.ts\" --exit", - "test:watch": "npm run test -- --watch" + "test": "vitest", + "coverage": "vitest run --coverage", + "test:watch": "vitest watch" }, "dependencies": { "classnames": "^2.2.6", - "connected-react-router": "^6.5.2", + "connected-react-router": "^6.9.3", "copy-to-clipboard": "^3.2.0", "date-fns": "^2.0.0-beta.4", "dotenv": "^8.0.0", @@ -42,21 +36,20 @@ "leaflet-zoombox": "^0.5.1", "lodash": "^4.17.21", "normalize.css": "^8.0.1", - "offline-plugin": "^5.0.7", "oidc-client": "^1.8.2", "proj4": "^2.5.0", "proj4leaflet": "^1.0.2", "prop-types": "^15.7.2", - "react": "16.8.6", + "react": "^16.9", "react-datepicker": "2.8.0", - "react-dom": "16.8.6", + "react-dom": "^16.9", "react-dual-listbox": "^2.0.0", - "react-foundation": "^0.9.6", + "react-foundation": "^0.9.7", "react-leaflet": "^2.8.0", "react-leaflet-draw": "^0.19.0", - "react-leaflet-fullscreen": "1.0.1", + "react-leaflet-fullscreen": "^1.0.2", "react-redux": "^7.1.0", - "react-redux-toastr": "^7.5.1", + "react-redux-toastr": "^7.6.12", "react-resize-detector": "^4.2.0", "react-router": "^5.0.1", "react-router-dom": "^5.0.1", @@ -72,68 +65,48 @@ "whatwg-fetch": "^3.0.0" }, "devDependencies": { - "@babel/core": "^7.23.9", + "@babel/core": "^7.25.2", "@babel/eslint-parser": "^7.23.9", - "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/polyfill": "^7.12.1", - "@babel/preset-env": "^7.5.5", - "@babel/preset-react": "^7.23.3", - "@babel/register": "^7.23.7", - "@hot-loader/react-dom": "17.0.2", - "@istanbuljs/nyc-config-typescript": "^1.0.2", - "@types/chai": "^4.3.16", + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/preset-env": "^7.25.3", + "@babel/preset-react": "^7.24.7", + "@eslint/js": "^9.9.0", + "@rollup/plugin-babel": "^6.0.4", "@types/history": "^5.0.0", - "@types/leaflet": "1.5.23", + "@types/leaflet": "^1.5.23", + "@types/leaflet-draw": "^1.0.11", "@types/lodash": "^4.17.1", - "@types/mocha": "^10.0.6", - "@types/react": "^18.3.2", - "@types/react-dom": "^18.3.0", + "@types/proj4leaflet": "^1.0.2", + "@types/react": "^16.9.56", + "@types/react-dom": "^16.9.24", + "@types/react-redux": "^7.1.33", "@types/redux-actions": "^2.6.5", - "@types/webpack-env": "^1.18.5", - "babel-loader": "^9.1.3", - "babel-plugin-istanbul": "^6.1.1", + "@types/redux-form": "^8.2.5", + "@typescript-eslint/parser": "^8.1.0", + "@vitejs/plugin-react": "^4.3.1", + "@vitest/coverage-istanbul": "^2.0.5", + "@vitest/ui": "^2.0.5", "babel-plugin-module-resolver": "^5.0.0", - "case-sensitive-paths-webpack-plugin": "^2.4.0", - "chai": "^4.2.0", - "chai-enzyme": "^1.0.0-beta.1", - "cheerio": "^1.0.0-rc.3", - "clean-webpack-plugin": "^4.0.0", - "codecov": "^3.5.0", "cross-env": "^5.2.0", - "css-loader": "^6.10.0", - "debug": "^4.3.4", - "enzyme": "^3.10.0", - "enzyme-adapter-react-16": "^1.14.0", - "eslint": "^8.56.0", - "eslint-plugin-react": "^7.14.3", - "favicons-webpack-plugin": "^6.0.1", - "file-loader": "^6.2.0", - "fs-extra": "^11.2.0", - "html-webpack-plugin": "^5.6.0", - "json-loader": "^0.5.7", - "mini-css-extract-plugin": "^2.7.7", - "mocha": "^6.2.0", - "node-sass": "^8.0.0", - "nodemon": "^3.0.3", + "eslint": "^8.57.0", + "eslint-plugin-react": "^7.35.0", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.7", + "globals": "^15.9.0", + "jsdom": "^24.1.1", "npm-run-all": "^4.1.5", - "nyc": "^14.1.1", - "react-dev-utils": "^12.0.1", - "react-hot-loader": "^4.13.1", - "sass-loader": "^14.1.0", - "sinon": "^7.3.2", - "sinon-chai": "^3.3.0", - "style-loader": "^3.3.4", - "terser-webpack-plugin": "^5.3.10", - "ts-loader": "^9.5.1", + "postcss": "^8.4.41", + "postcss-url": "^10.1.3", + "sass": "^1.77.8", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", "typescript": "^5.5.4", - "url": "^0.11.3", - "url-loader": "^4.1.1", - "webpack": "^5.9.0", - "webpack-dev-server": "^4.15.1", - "webpack-hot-middleware": "^2.26.0", - "webpack-manifest-plugin": "^5.0.0", - "workbox-webpack-plugin": "7.0.0" + "typescript-eslint": "^8.1.0", + "vite": "^5.3.5", + "vite-plugin-commonjs": "^0.10.1", + "vitest": "^2.0.5" + }, + "resolutions": { + "@types/react": "^16" } } diff --git a/scripts/compile.js b/scripts/compile.js deleted file mode 100644 index 666bb3616..000000000 --- a/scripts/compile.js +++ /dev/null @@ -1,127 +0,0 @@ -'use strict'; - -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = 'production'; -process.env.NODE_ENV = 'production'; - -// Makes the script crash on unhandled rejections instead of silently -// ignoring them. In the future, promise rejections that are not handled will -// terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { - throw err; -}); - -// Ensure environment variables are read. -require('../config/env'); - -const path = require('path'); -const chalk = require('chalk'); -const fs = require('fs-extra'); -const webpack = require('webpack'); -const config = require('../config/webpack.config.prod'); -const paths = require('../config/paths'); -const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); -const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); -const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); -const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); -const printBuildError = require('react-dev-utils/printBuildError'); - -const measureFileSizesBeforeBuild = - FileSizeReporter.measureFileSizesBeforeBuild; -const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; -const useYarn = fs.existsSync(paths.yarnLockFile); - -// These sizes are pretty large. We'll warn for bundles exceeding them. -const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024; -const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; - -// Warn and crash if required files are missing -if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs, paths.silentRenewHtml, paths.silentRenewJs])) { - process.exit(1); -} - -// First, read the current file sizes in build directory. -// This lets us display how much they changed later. -measureFileSizesBeforeBuild(paths.appBuild) - .then(previousFileSizes => { - // Remove all content but keep the directory so that - // if you're in it, you don't end up in Trash - fs.emptyDirSync(paths.appBuild); - // Start the webpack build - return build(previousFileSizes); - }) - .then( - ({stats, previousFileSizes, warnings}) => { - if (warnings.length) { - console.log(chalk.yellow('Compiled with warnings.\n')); - console.log(warnings.join('\n\n')); - console.log( - '\nSearch for the ' + - chalk.underline(chalk.yellow('keywords')) + - ' to learn more about each warning.' - ); - console.log( - 'To ignore, add ' + - chalk.cyan('// eslint-disable-next-line') + - ' to the line before.\n' - ); - } else { - console.log(chalk.green('Compiled successfully.\n')); - } - - console.log('File sizes after gzip:\n'); - printFileSizesAfterBuild( - stats, - previousFileSizes, - paths.appBuild, - WARN_AFTER_BUNDLE_GZIP_SIZE, - WARN_AFTER_CHUNK_GZIP_SIZE - ); - console.log(); - - const appPackage = require(paths.appPackageJson); - const publicUrl = paths.publicUrl; - const publicPath = config.output.publicPath; - const buildFolder = path.relative(process.cwd(), paths.appBuild); - printHostingInstructions( - appPackage, - publicUrl, - publicPath, - buildFolder, - useYarn - ); - }, - err => { - console.log(chalk.red('Failed to compile.\n')); - printBuildError(err); - process.exit(1); - } - ); - -// Create the production build and print the deployment instructions. -function build(previousFileSizes) { - console.log('Creating an optimized production build...'); - - let compiler = webpack(config); - return new Promise((resolve, reject) => { - compiler.run((err, stats) => { - if (err) { - return reject(err); - } - const messages = formatWebpackMessages(stats.toJson({}, true)); - if (messages.errors.length) { - // Only keep the first error. Others are often indicative - // of the same problem, but confuse the reader with noise. - if (messages.errors.length > 1) { - messages.errors.length = 1; - } - return reject(new Error(messages.errors.join('\n\n'))); - } - return resolve({ - stats, - previousFileSizes, - warnings: messages.warnings, - }); - }); - }); -} diff --git a/scripts/start.js b/scripts/start.js deleted file mode 100644 index 949e993f7..000000000 --- a/scripts/start.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict'; - -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = 'development'; -process.env.NODE_ENV = 'development'; - -// Makes the script crash on unhandled rejections instead of silently -// ignoring them. In the future, promise rejections that are not handled will -// terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { - throw err; -}); - -// Ensure environment variables are read. -require('../config/env'); - -const fs = require('fs'); -const chalk = require('react-dev-utils/chalk'); -const webpack = require('webpack'); -const WebpackDevServer = require('webpack-dev-server'); -const clearConsole = require('react-dev-utils/clearConsole'); -const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); -const { - choosePort, - createCompiler, - prepareProxy, - prepareUrls, -} = require('react-dev-utils/WebpackDevServerUtils'); -const openBrowser = require('react-dev-utils/openBrowser'); -const paths = require('../config/paths'); -const config = require('../config/webpack.config.dev'); -const createDevServerConfig = require('../config/webpackDevServer.config'); - -const useYarn = fs.existsSync(paths.yarnLockFile); -const isInteractive = process.stdout.isTTY; - -// Warn and crash if required files are missing -if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs, paths.silentRenewHtml, paths.silentRenewJs])) { - process.exit(1); -} - -// Tools like Cloud9 rely on this. -const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; -const HOST = process.env.HOST || '0.0.0.0'; - -// We attempt to use the default port but if it is busy, we offer the user to -// run on a different port. `detect()` Promise resolves to the next free port. -choosePort(HOST, DEFAULT_PORT) - .then(port => { - if (port == null) { - // We have not found a port. - return; - } - const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; - const appName = require(paths.appPackageJson).name; - const useTypeScript = true; - const urls = prepareUrls(protocol, HOST, port); - const devSocket = { - warnings: warnings => - devServer.sockWrite(devServer.sockets, 'warnings', warnings), - errors: errors => - devServer.sockWrite(devServer.sockets, 'errors', errors), - }; - // Create a webpack compiler that is configured with custom messages. - const compiler = createCompiler({ - appName, - config, - devSocket, - urls, - useYarn, - useTypeScript, - webpack, - }); - // Load proxy config - const proxySetting = require(paths.appPackageJson).proxy; - const proxyConfig = prepareProxy(proxySetting, paths.appPublic); - // Serve webpack assets generated by the compiler over a web sever. - const serverConfig = createDevServerConfig( - proxyConfig, - urls.lanUrlForConfig - ); - - const devServer = new WebpackDevServer(serverConfig, compiler); - // Launch WebpackDevServer. - devServer.startCallback((port, HOST, err) => { - if (err) { - return console.log(err); - } - if (isInteractive) { - clearConsole(); - } - console.log(chalk.cyan('Starting the development server...\n')); - openBrowser(urls.localUrlForBrowser); - }); - - ['SIGINT', 'SIGTERM'].forEach(function(sig) { - process.on(sig, function() { - devServer.close(); - process.exit(); - }); - }); - }) - .catch(err => { - if (err && err.message) { - console.log(err.message, err); - } - process.exit(1); - }); diff --git a/src/api/ApiErrorModal.tsx b/src/api/ApiErrorModal.tsx index 8cd98db7f..c4b6be914 100644 --- a/src/api/ApiErrorModal.tsx +++ b/src/api/ApiErrorModal.tsx @@ -2,8 +2,8 @@ import flowRight from "lodash/flowRight"; import React from "react"; import { Button } from "react-foundation"; -import { reveal } from "../foundation/reveal"; -import { Sizes } from "../foundation/enums"; +import { reveal } from "@/foundation/reveal"; +import { Sizes } from "@/foundation/enums"; const ApiErrorModal = ({ data, diff --git a/src/api/spec.ts b/src/api/api.spec.ts similarity index 95% rename from src/api/spec.ts rename to src/api/api.spec.ts index 33b497f54..a14eda316 100644 --- a/src/api/spec.ts +++ b/src/api/api.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { receiveError, clearError } from "./actions"; import apiReducer from "./reducer"; import type { ApiState } from "./types"; diff --git a/src/api/callApi.ts b/src/api/callApi.ts index 85ee74024..64d35f2db 100644 --- a/src/api/callApi.ts +++ b/src/api/callApi.ts @@ -1,6 +1,6 @@ import { call, select } from "redux-saga/effects"; -import { getApiToken } from "auth/selectors"; -import { UI_ACCEPT_LANGUAGE_VALUE } from "api/constants"; +import { getApiToken } from "@/auth/selectors"; +import { UI_ACCEPT_LANGUAGE_VALUE } from "@/api/constants"; function* callApi(request: Request): Generator { const apiToken = yield select(getApiToken); diff --git a/src/api/callApiAsync.ts b/src/api/callApiAsync.ts index 685947309..f5a79edec 100644 --- a/src/api/callApiAsync.ts +++ b/src/api/callApiAsync.ts @@ -1,6 +1,6 @@ -import { store } from "root/startApp"; -import { getApiToken } from "auth/selectors"; -import { UI_ACCEPT_LANGUAGE_VALUE } from "api/constants"; +import { store } from "@/index"; +import { getApiToken } from "@/auth/selectors"; +import { UI_ACCEPT_LANGUAGE_VALUE } from "@/api/constants"; import type { ApiSyncResponse } from "./types"; import type { ApiResponse } from "types"; diff --git a/src/api/callUploadRequest.ts b/src/api/callUploadRequest.ts index 36c5e7d68..e9b28d674 100644 --- a/src/api/callUploadRequest.ts +++ b/src/api/callUploadRequest.ts @@ -1,7 +1,7 @@ import { call, put, select } from "redux-saga/effects"; -import { receiveError } from "api/actions"; -import { getApiToken } from "auth/selectors"; -import { UI_ACCEPT_LANGUAGE_VALUE } from "api/constants"; +import { receiveError } from "@/api/actions"; +import { getApiToken } from "@/auth/selectors"; +import { UI_ACCEPT_LANGUAGE_VALUE } from "@/api/constants"; function* callUploadRequest(request: Request): Generator { const apiToken = yield select(getApiToken); diff --git a/src/api/createUrl.ts b/src/api/createUrl.ts index 2d57c79f1..aadeb9967 100644 --- a/src/api/createUrl.ts +++ b/src/api/createUrl.ts @@ -1,4 +1,4 @@ import isArray from "lodash/isArray"; export const stringifyQuery = (query: Record): string => Object.keys(query).map(key => [key, query[key]].map(v => encodeURIComponent(v)).join('=')).join('&'); export const standardStringifyQuery = (query: Record): string => Object.keys(query).map(key => isArray(query[key]) ? [key, query[key].map(v => encodeURIComponent(v)).join(`&${key}=`)].join('=') : [key, query[key]].map(v => encodeURIComponent(v)).join('=')).join('&'); -export default ((url: string, params?: Record): string => `${process.env.API_URL || ''}/${url}${params ? `?${stringifyQuery(params)}` : ''}`); \ No newline at end of file +export default ((url: string, params?: Record): string => `${import.meta.env.VITE_API_URL || ''}/${url}${params ? `?${stringifyQuery(params)}` : ''}`); \ No newline at end of file diff --git a/src/api/createUrlWithoutVersionSuffix.ts b/src/api/createUrlWithoutVersionSuffix.ts index 9f472b730..5dd2bb97a 100644 --- a/src/api/createUrlWithoutVersionSuffix.ts +++ b/src/api/createUrlWithoutVersionSuffix.ts @@ -1,4 +1,4 @@ -import { getApiUrlWithOutVersionSuffix } from "util/helpers"; +import { getApiUrlWithOutVersionSuffix } from "@/util/helpers"; import { stringifyQuery } from "./createUrl"; export default ((url: string, params?: Record) => { const apiUrlWithOutVersionSuffix = getApiUrlWithOutVersionSuffix(); diff --git a/src/api/reducer.ts b/src/api/reducer.ts index bedae0a29..5e850c53d 100644 --- a/src/api/reducer.ts +++ b/src/api/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Reducer } from "../types"; +import type { Reducer } from "@/types"; import type { ApiError, ReceiveErrorAction } from "./types"; export const errorReducer: Reducer = handleActions({ ['mvj/api/RECEIVE_ERROR']: (state, { diff --git a/src/api/selectors.ts b/src/api/selectors.ts index e417b985c..b02600a77 100644 --- a/src/api/selectors.ts +++ b/src/api/selectors.ts @@ -1,3 +1,3 @@ -import type { Selector } from "../types"; +import type { Selector } from "@/types"; import type { ApiError } from "./types"; export const getError: Selector = state => state.api.error; \ No newline at end of file diff --git a/src/api/types.ts b/src/api/types.ts index d89d59f8a..ca926a3d1 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -1,4 +1,4 @@ -import type { Action } from "../types"; +import type { Action } from "@/types"; export type ApiError = Record | null; export type ReceiveErrorAction = Action; export type ClearErrorAction = Action; diff --git a/src/app/App.tsx b/src/app/App.tsx index cd3170e68..9ce6b073b 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -5,33 +5,34 @@ import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; import get from "lodash/get"; -import { Sizes } from "foundation/enums"; -import { revealContext } from "foundation/reveal"; -import { ActionTypes, AppConsumer, AppProvider } from "app/AppContext"; -import ApiErrorModal from "api/ApiErrorModal"; -import ConfirmationModal from "components/modal/ConfirmationModal"; -import Loader from "components/loader/Loader"; -import LoginPage from "auth/components/LoginPage"; -import SideMenu from "components/sideMenu/SideMenu"; -import TopNavigation from "components/topNavigation/TopNavigation"; -import userManager from "auth/util/user-manager"; -import { Routes, getRouteById } from "root/routes"; -import { clearError } from "api/actions"; -import { clearApiToken, fetchApiToken } from "auth/actions"; -import { getEpochTime } from "util/helpers"; -import { getError } from "api/selectors"; -import { getApiToken, getApiTokenExpires, getIsFetching, getLoggedInUser } from "auth/selectors"; -import { getLinkUrl, getPageTitle, getShowSearch } from "components/topNavigation/selectors"; -import { getUserGroups, getUserActiveServiceUnit, getUserServiceUnits } from "usersPermissions/selectors"; -import { setRedirectUrlToSessionStorage } from "util/storage"; -import type { ApiError } from "../api/types"; -import type { ApiToken } from "../auth/types"; -import type { UserGroups, UserServiceUnit, UserServiceUnits } from "usersPermissions/types"; -import type { RootState } from "../root/types"; +import { Sizes } from "@/foundation/enums"; +import { revealContext } from "@/foundation/reveal"; +import { ActionTypes, AppConsumer, AppProvider } from "@/app/AppContext"; +import ApiErrorModal from "@/api/ApiErrorModal"; +import ConfirmationModal from "@/components/modal/ConfirmationModal"; +import Loader from "@/components/loader/Loader"; +import LoginPage from "@/auth/components/LoginPage"; +import SideMenu from "@/components/sideMenu/SideMenu"; +import TopNavigation from "@/components/topNavigation/TopNavigation"; +import userManager from "@/auth/util/user-manager"; +import { Routes, getRouteById } from "@/root/routes"; +import { clearError } from "@/api/actions"; +import { clearApiToken, fetchApiToken } from "@/auth/actions"; +import { getEpochTime } from "@/util/helpers"; +import { getError } from "@/api/selectors"; +import { getApiToken, getApiTokenExpires, getIsFetching, getLoggedInUser } from "@/auth/selectors"; +import { getLinkUrl, getPageTitle, getShowSearch } from "@/components/topNavigation/selectors"; +import { getUserGroups, getUserActiveServiceUnit, getUserServiceUnits } from "@/usersPermissions/selectors"; +import { setRedirectUrlToSessionStorage } from "@/util/storage"; +import type { ApiError } from "@/api/types"; +import type { ApiToken } from "@/auth/types"; +import type { UserGroups, UserServiceUnit, UserServiceUnits } from "@/usersPermissions/types"; +import type { RootState } from "@/root/types"; +import "@/main.scss"; const url = window.location.toString(); const IS_DEVELOPMENT_URL = url.includes('ninja') || url.includes('localhost'); type OwnProps = { - children: React.ReactNode; + children: JSX.Element; }; type Props = OwnProps & { apiError: ApiError; diff --git a/src/app/AppContext.tsx b/src/app/AppContext.tsx index 4b670db0d..76f4a43fc 100644 --- a/src/app/AppContext.tsx +++ b/src/app/AppContext.tsx @@ -57,7 +57,7 @@ export class AppProvider extends React.Component { } }; - render(): React.ReactNode { + render() { const { state, props: { diff --git a/src/app/_app.scss b/src/app/_app.scss index a1e1b64ab..54a3b0290 100644 --- a/src/app/_app.scss +++ b/src/app/_app.scss @@ -87,7 +87,7 @@ display: block; overflow: hidden; min-height: 100%; - background: url('../assets/images/dev-background.png'); + background: url('/assets/images/dev-background.png'); background-repeat: repeat; [type="radio"] { diff --git a/src/application/actions.ts b/src/application/actions.ts index 77742705b..87db92e63 100644 --- a/src/application/actions.ts +++ b/src/application/actions.ts @@ -1,5 +1,5 @@ import { createAction } from "redux-actions"; -import type { ApplicantInfoCheckAttributesNotFoundAction, ApplicationRelatedAttachmentsNotFoundAction, AttachmentAttributesNotFoundAction, AttributesNotFoundAction, DeleteUploadAction, FetchApplicantInfoCheckAttributesAction, FetchApplicationRelatedAttachmentsAction, FetchAttachmentAttributesAction, FetchAttributesAction, FetchFormAttributesAction, FetchPendingUploadsAction, FormAttributesNotFoundAction, PendingUploadsNotFoundAction, ReceiveApplicantInfoCheckAttributesAction, ReceiveApplicationRelatedAttachmentsAction, ReceiveAttachmentAttributesAction, ReceiveAttachmentMethodsAction, ReceiveAttributesAction, ReceiveFileOperationFinishedAction, ReceiveFormAttributesAction, ReceiveMethodsAction, ReceivePendingUploadsAction, ReceiveUpdatedApplicantInfoCheckItemAction, ReceiveUpdatedTargetInfoCheckItemAction, UploadAttachmentPayload, UploadFileAction } from "application/types"; +import type { ApplicantInfoCheckAttributesNotFoundAction, ApplicationRelatedAttachmentsNotFoundAction, AttachmentAttributesNotFoundAction, AttributesNotFoundAction, DeleteUploadAction, FetchApplicantInfoCheckAttributesAction, FetchApplicationRelatedAttachmentsAction, FetchAttachmentAttributesAction, FetchAttributesAction, FetchFormAttributesAction, FetchPendingUploadsAction, FormAttributesNotFoundAction, PendingUploadsNotFoundAction, ReceiveApplicantInfoCheckAttributesAction, ReceiveApplicationRelatedAttachmentsAction, ReceiveAttachmentAttributesAction, ReceiveAttachmentMethodsAction, ReceiveAttributesAction, ReceiveFileOperationFinishedAction, ReceiveFormAttributesAction, ReceiveMethodsAction, ReceivePendingUploadsAction, ReceiveUpdatedApplicantInfoCheckItemAction, ReceiveUpdatedTargetInfoCheckItemAction, UploadAttachmentPayload, UploadFileAction } from "@/application/types"; import type { Attributes, Methods } from "types"; export const fetchAttributes = (): FetchAttributesAction => createAction('mvj/application/FETCH_ATTRIBUTES')(); export const receiveMethods = (methods: Methods): ReceiveMethodsAction => createAction('mvj/application/RECEIVE_METHODS')(methods); diff --git a/src/application/spec.ts b/src/application/application.spec.ts similarity index 97% rename from src/application/spec.ts rename to src/application/application.spec.ts index 1b26adb45..4bdb3b372 100644 --- a/src/application/spec.ts +++ b/src/application/application.spec.ts @@ -1,9 +1,9 @@ -import { expect } from "chai"; -import applicationReducer from "application/reducer"; -import type { ApplicationState } from "application/types"; -import { attributesNotFound, fetchAttachmentAttributes, fetchAttributes, receiveAttachmentAttributes, receiveAttributes, receiveFormAttributes, receiveMethods } from "application/actions"; -import mockFormAttributes from "application/form-attributes-mock-data.json"; -import { companyIdentifierValidator, emailValidator, personalIdentifierValidator, validateApplicationForm } from "application/formValidation"; +import { describe, expect, it } from "vitest"; +import applicationReducer from "./reducer"; +import type { ApplicationState } from "./types"; +import { attributesNotFound, fetchAttachmentAttributes, fetchAttributes, receiveAttachmentAttributes, receiveAttributes, receiveFormAttributes, receiveMethods } from "./actions"; +import mockFormAttributes from "./form-attributes-mock-data.json" assert { type: "json" }; +import { companyIdentifierValidator, emailValidator, personalIdentifierValidator, validateApplicationForm } from "./formValidation"; import { get } from "lodash/object"; const baseState: ApplicationState = { attributes: null, diff --git a/src/application/components/ApplicationAnswersField.tsx b/src/application/components/ApplicationAnswersField.tsx index d5071af1c..5aafe5fb1 100644 --- a/src/application/components/ApplicationAnswersField.tsx +++ b/src/application/components/ApplicationAnswersField.tsx @@ -1,11 +1,11 @@ import React from "react"; import { Column, Row } from "react-foundation"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import FormTextTitle from "components/form/FormTextTitle"; -import FormText from "components/form/FormText"; -import ApplicationAnswersSection from "application/components/ApplicationAnswersSection"; -import { getApplicationAttachmentDownloadLink } from "application/helpers"; -import type { FormSection, SavedApplicationFormSection, SectionExtraComponentProps, UploadedFileMeta } from "application/types"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import FormText from "@/components/form/FormText"; +import ApplicationAnswersSection from "@/application/components/ApplicationAnswersSection"; +import { getApplicationAttachmentDownloadLink } from "@/application/helpers"; +import type { FormSection, SavedApplicationFormSection, SectionExtraComponentProps, UploadedFileMeta } from "@/application/types"; type Props = { section: FormSection; answer: SavedApplicationFormSection; @@ -27,7 +27,7 @@ const ApplicationAnswersField = ({ identifier, sectionExtraComponent: SectionExtraComponent, sectionTitleTransformers -}: Props): React.ReactNode => { +}: Props): JSX.Element => { return <> {section.fields.filter(field => field.enabled).map(field => { diff --git a/src/application/components/ApplicationAnswersSection.tsx b/src/application/components/ApplicationAnswersSection.tsx index eb135a3e6..a7ca38532 100644 --- a/src/application/components/ApplicationAnswersSection.tsx +++ b/src/application/components/ApplicationAnswersSection.tsx @@ -1,8 +1,8 @@ import React from "react"; -import Collapse from "components/collapse/Collapse"; -import SubTitle from "components/content/SubTitle"; -import ApplicationAnswersField from "application/components/ApplicationAnswersField"; -import type { FormSection, SavedApplicationFormSection, SectionExtraComponentProps } from "application/types"; +import Collapse from "@/components/collapse/Collapse"; +import SubTitle from "@/components/content/SubTitle"; +import ApplicationAnswersField from "@/application/components/ApplicationAnswersField"; +import type { FormSection, SavedApplicationFormSection, SectionExtraComponentProps } from "@/application/types"; type Props = { section: FormSection; answer: SavedApplicationFormSection | Array; @@ -21,7 +21,7 @@ const ApplicationAnswersSection = ({ fieldTypes, sectionExtraComponent, sectionTitleTransformers -}: Props): React.ReactNode => { +}: Props): JSX.Element => { if (!answer) { return null; } diff --git a/src/application/components/ApplicationSubsection.tsx b/src/application/components/ApplicationSubsection.tsx index bb3556c08..1b5ded0d9 100644 --- a/src/application/components/ApplicationSubsection.tsx +++ b/src/application/components/ApplicationSubsection.tsx @@ -2,28 +2,28 @@ import React, { Fragment, useCallback } from "react"; import { change, FieldArray, formValueSelector } from "redux-form"; import { connect } from "react-redux"; import { Column, Row } from "react-foundation"; -import AddButton from "components/form/AddButton"; -import RemoveButton from "components/form/RemoveButton"; -import FormField from "components/form/FormField"; -import AddFileButton from "components/form/AddFileButton"; -import FormTextTitle from "components/form/FormTextTitle"; -import FormText from "components/form/FormText"; -import Authorization from "components/authorization/Authorization"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import LoadingIndicator from "components/multi-select/LoadingIndicator"; -import { ButtonColors } from "components/enums"; -import FormHintText from "components/form/FormHintText"; -import { formatDate, isFieldAllowedToRead } from "util/helpers"; -import { ConfirmationModalTexts } from "enums"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import { ApplicantTypes } from "application/enums"; -import { getApplicationAttachmentDownloadLink, getFieldFileIds, getSectionApplicantType, getSectionTemplate, valueToApplicantType } from "application/helpers"; -import { getAttachmentAttributes, getAttachmentMethods, getExistingUploads, getFieldTypeMapping, getIsFetchingApplicationRelatedAttachments, getIsFetchingAttachmentAttributes, getIsFetchingPendingUploads, getIsPerformingFileOperation, getPendingUploads } from "application/selectors"; -import { ApplicationSectionKeys } from "application/components/enums"; -import { APPLICANT_MAIN_IDENTIFIERS, APPLICANT_SECTION_IDENTIFIER, APPLICANT_TYPE_FIELD_IDENTIFIER, EMAIL_FIELD_IDENTIFIER, TARGET_SECTION_IDENTIFIER } from "application/constants"; -import { deleteUploadedAttachment, uploadAttachment } from "application/actions"; -import type { FormSection, PlotApplicationFormValue, UploadedFileMeta } from "application/types"; -import { companyIdentifierValidator, emailValidator, personalIdentifierValidator } from "application/formValidation"; +import AddButton from "@/components/form/AddButton"; +import RemoveButton from "@/components/form/RemoveButton"; +import FormField from "@/components/form/FormField"; +import AddFileButton from "@/components/form/AddFileButton"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import FormText from "@/components/form/FormText"; +import Authorization from "@/components/authorization/Authorization"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import LoadingIndicator from "@/components/multi-select/LoadingIndicator"; +import { ButtonColors } from "@/components/enums"; +import FormHintText from "@/components/form/FormHintText"; +import { formatDate, isFieldAllowedToRead } from "@/util/helpers"; +import { ConfirmationModalTexts } from "@/enums"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import { ApplicantTypes } from "@/application/enums"; +import { getApplicationAttachmentDownloadLink, getFieldFileIds, getSectionApplicantType, getSectionTemplate, valueToApplicantType } from "@/application/helpers"; +import { getAttachmentAttributes, getAttachmentMethods, getExistingUploads, getFieldTypeMapping, getIsFetchingApplicationRelatedAttachments, getIsFetchingAttachmentAttributes, getIsFetchingPendingUploads, getIsPerformingFileOperation, getPendingUploads } from "@/application/selectors"; +import { ApplicationSectionKeys } from "@/application/components/enums"; +import { APPLICANT_MAIN_IDENTIFIERS, APPLICANT_SECTION_IDENTIFIER, APPLICANT_TYPE_FIELD_IDENTIFIER, EMAIL_FIELD_IDENTIFIER, TARGET_SECTION_IDENTIFIER } from "@/application/constants"; +import { deleteUploadedAttachment, uploadAttachment } from "@/application/actions"; +import type { FormSection, PlotApplicationFormValue, UploadedFileMeta } from "@/application/types"; +import { companyIdentifierValidator, emailValidator, personalIdentifierValidator } from "@/application/formValidation"; const ApplicationFormFileField = connect((state, props) => { const { formName, @@ -344,13 +344,13 @@ const ApplicationFormSubsectionFieldArray = ({ fields: any; section: any; headerTag: string | React.ComponentType<{ - children?: React.ReactNode; + children?: JSX.Element; }>; formName: string; formPath: string; sectionTitleTransformers: Array<(arg0: string, arg1: FormSection, arg2: string) => string>; answerId: number | null; -}): React.ReactNode => { +}): JSX.Element => { return
{fields.map((identifier, i) => { const subtitle: string = (sectionTitleTransformers || []).reduce((title, transformer) => transformer(title, section, identifier), `${section.title} (${i + 1})`); @@ -383,14 +383,14 @@ const ApplicationSubsection = ({ path: Array; section: any; headerTag?: string | React.ComponentType<{ - children?: React.ReactNode; + children?: JSX.Element; }>; parentApplicantType?: string | null; formName: string; formPath: string | null | undefined; sectionTitleTransformers: Array<(arg0: string, arg1: FormSection, arg2: string) => string>; answerId: number | null; -}): React.ReactNode => { +}): JSX.Element => { if (!section.visible) { return null; } diff --git a/src/application/components/infoCheck/ApplicantInfoCheck.tsx b/src/application/components/infoCheck/ApplicantInfoCheck.tsx index ab637be46..b6aa3a94d 100644 --- a/src/application/components/infoCheck/ApplicantInfoCheck.tsx +++ b/src/application/components/infoCheck/ApplicantInfoCheck.tsx @@ -1,14 +1,14 @@ import React, { Component } from "react"; import { Column, Row } from "react-foundation"; -import { getLabelOfOption } from "util/helpers"; -import { getUserFullName } from "users/helpers"; +import { getLabelOfOption } from "@/util/helpers"; +import { getUserFullName } from "@/users/helpers"; type Props = { infoChecks: Record; infoCheckStateOptions: any; }; class ApplicantInfoCheck extends Component { - render(): React.ReactNode { + render(): JSX.Element { const { infoChecks, infoCheckStateOptions diff --git a/src/application/components/infoCheck/ApplicantInfoCheckEdit.tsx b/src/application/components/infoCheck/ApplicantInfoCheckEdit.tsx index 3ebd042b7..f0355da87 100644 --- a/src/application/components/infoCheck/ApplicantInfoCheckEdit.tsx +++ b/src/application/components/infoCheck/ApplicantInfoCheckEdit.tsx @@ -2,11 +2,11 @@ import React, { Component } from "react"; import { Row } from "react-foundation"; import { connect } from "react-redux"; import { change } from "redux-form"; -import ApplicantInfoCheckModal from "application/components/infoCheck/ApplicantInfoCheckModal"; -import { ApplicantInfoCheckFieldPaths, ApplicantInfoCheckFieldTitles, ApplicantTypes } from "application/enums"; -import ApplicantInfoCheckEditItem from "application/components/infoCheck/ApplicantInfoCheckEditItem"; -import FormText from "components/form/FormText"; -import { getApplicantInfoCheckFormName } from "application/helpers"; +import ApplicantInfoCheckModal from "@/application/components/infoCheck/ApplicantInfoCheckModal"; +import { ApplicantInfoCheckFieldPaths, ApplicantInfoCheckFieldTitles, ApplicantTypes } from "@/application/enums"; +import ApplicantInfoCheckEditItem from "@/application/components/infoCheck/ApplicantInfoCheckEditItem"; +import FormText from "@/components/form/FormText"; +import { getApplicantInfoCheckFormName } from "@/application/helpers"; type OwnProps = { infoCheckIds: Array; answer: Record; @@ -71,7 +71,7 @@ class ApplicantInfoCheckEdit extends Component { } }; - renderErrors(): React.ReactNode { + renderErrors(): JSX.Element { const { submissionErrors } = this.props; @@ -113,7 +113,7 @@ class ApplicantInfoCheckEdit extends Component { ; } - render(): React.ReactNode { + render(): JSX.Element { const { isModalOpen, modalCheckItem, diff --git a/src/application/components/infoCheck/ApplicantInfoCheckEditItem.tsx b/src/application/components/infoCheck/ApplicantInfoCheckEditItem.tsx index e8f8bfaef..a7e76b868 100644 --- a/src/application/components/infoCheck/ApplicantInfoCheckEditItem.tsx +++ b/src/application/components/infoCheck/ApplicantInfoCheckEditItem.tsx @@ -4,9 +4,9 @@ import { connect } from "react-redux"; import { getFormValues, reduxForm } from "redux-form"; import { Column, Row } from "react-foundation"; import classNames from "classnames"; -import { getApplicantInfoCheckAttributes } from "application/selectors"; -import { getFieldOptions, getLabelOfOption } from "util/helpers"; -import { getUserFullName } from "users/helpers"; +import { getApplicantInfoCheckAttributes } from "@/application/selectors"; +import { getFieldOptions, getLabelOfOption } from "@/util/helpers"; +import { getUserFullName } from "@/users/helpers"; import type { Attributes } from "types"; type OwnProps = { openModal: (...args: Array) => any; diff --git a/src/application/components/infoCheck/ApplicantInfoCheckForm.tsx b/src/application/components/infoCheck/ApplicantInfoCheckForm.tsx index d4666b882..46394f473 100644 --- a/src/application/components/infoCheck/ApplicantInfoCheckForm.tsx +++ b/src/application/components/infoCheck/ApplicantInfoCheckForm.tsx @@ -4,13 +4,13 @@ import { Column, Row } from "react-foundation"; import get from "lodash/get"; import flowRight from "lodash/flowRight"; import { connect } from "react-redux"; -import { FieldTypes, FormNames } from "enums"; -import { ButtonColors } from "components/enums"; -import FormField from "components/form/FormField"; -import ModalButtonWrapper from "components/modal/ModalButtonWrapper"; -import Button from "components/button/Button"; -import { ApplicantInfoCheckFieldPaths, ApplicantInfoCheckFieldTitles } from "application/enums"; -import { getApplicantInfoCheckAttributes } from "application/selectors"; +import { FieldTypes, FormNames } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import FormField from "@/components/form/FormField"; +import ModalButtonWrapper from "@/components/modal/ModalButtonWrapper"; +import Button from "@/components/button/Button"; +import { ApplicantInfoCheckFieldPaths, ApplicantInfoCheckFieldTitles } from "@/application/enums"; +import { getApplicantInfoCheckAttributes } from "@/application/selectors"; import type { Attributes } from "types"; type OwnProps = { infoCheck: Record; @@ -62,7 +62,7 @@ class ApplicantInfoCheckForm extends Component { onSubmit(formValues); }; - render(): React.ReactNode { + render(): JSX.Element { const { attributes, valid, diff --git a/src/application/components/infoCheck/ApplicantInfoCheckModal.tsx b/src/application/components/infoCheck/ApplicantInfoCheckModal.tsx index 33b3b88c9..41f5aad43 100644 --- a/src/application/components/infoCheck/ApplicantInfoCheckModal.tsx +++ b/src/application/components/infoCheck/ApplicantInfoCheckModal.tsx @@ -1,12 +1,12 @@ import React, { Component } from "react"; -import Modal from "components/modal/Modal"; -import ModalButtonWrapper from "components/modal/ModalButtonWrapper"; -import Button from "components/button/Button"; -import ApplicantInfoCheckForm from "application/components/infoCheck/ApplicantInfoCheckForm"; -import TradeRegisterTemplate from "tradeRegister/components/TradeRegisterTemplate"; -import CreditDecisionTemplate from "creditDecision/components/CreditDecisionTemplate"; -import { ContactTypes } from "contacts/enums"; -import { ApplicantInfoCheckExternalTypes } from "application/enums"; +import Modal from "@/components/modal/Modal"; +import ModalButtonWrapper from "@/components/modal/ModalButtonWrapper"; +import Button from "@/components/button/Button"; +import ApplicantInfoCheckForm from "@/application/components/infoCheck/ApplicantInfoCheckForm"; +import TradeRegisterTemplate from "@/tradeRegister/components/TradeRegisterTemplate"; +import CreditDecisionTemplate from "@/creditDecision/components/CreditDecisionTemplate"; +import { ContactTypes } from "@/contacts/enums"; +import { ApplicantInfoCheckExternalTypes } from "@/application/enums"; type Props = { isOpen: boolean; onClose: (...args: Array) => any; @@ -39,7 +39,7 @@ class ApplicantInfoCheckModal extends Component { this.form = element; }; - render(): React.ReactNode { + render(): JSX.Element { const { isOpen, onClose, diff --git a/src/application/constants.ts b/src/application/constants.ts index fe07ec4b0..33bf82771 100644 --- a/src/application/constants.ts +++ b/src/application/constants.ts @@ -1,4 +1,4 @@ -import { ApplicantTypes } from "application/enums"; +import { ApplicantTypes } from "@/application/enums"; export const APPLICANT_SECTION_IDENTIFIER = 'hakijan-tiedot'; export const TARGET_SECTION_IDENTIFIER = 'haettava-kohde'; export const APPLICANT_TYPE_FIELD_IDENTIFIER = 'hakija'; diff --git a/src/application/formValidation.ts b/src/application/formValidation.ts index 1eb4ab636..fb563e829 100644 --- a/src/application/formValidation.ts +++ b/src/application/formValidation.ts @@ -1,6 +1,6 @@ import { parseISO } from "date-fns"; import { get, set } from "lodash/object"; -import { CONTROL_SHARE_FIELD_IDENTIFIER } from "application/constants"; +import { CONTROL_SHARE_FIELD_IDENTIFIER } from "@/application/constants"; const PERSONAL_IDENTIFIER_CHECK_CHAR_LIST = '0123456789ABCDEFHJKLMNPRSTUVWXY'; // from the rightmost digit to the leftmost const COMPANY_IDENTIFIER_CHECKSUM_MULTIPLIERS = [2, 4, 8, 5, 10, 9, 7]; diff --git a/src/application/helpers.ts b/src/application/helpers.ts index a24a9860a..9bb2e30e5 100644 --- a/src/application/helpers.ts +++ b/src/application/helpers.ts @@ -1,15 +1,15 @@ import { formValueSelector } from "redux-form"; import _ from "lodash"; -import { FormNames } from "enums"; -import { ApplicantInfoCheckExternalTypes, ApplicantInfoCheckTypes, ApplicantTypes, TargetIdentifierTypes } from "application/enums"; -import { getContentUser } from "users/helpers"; -import createUrl from "api/createUrl"; -import { APPLICANT_MAIN_IDENTIFIERS, APPLICANT_SECTION_IDENTIFIER, TARGET_SECTION_IDENTIFIER } from "application/constants"; -import { store } from "root/startApp"; -import { displayUIMessage } from "util/helpers"; -import type { PlotSearch } from "plotSearch/types"; -import type { RootState } from "root/types"; -import type { ApplicationFormSection, Form, FormSection, PlotApplicationFormValue, SavedApplicationFormSection, UploadedFileMeta } from "application/types"; +import { FormNames } from "@/enums"; +import { ApplicantInfoCheckExternalTypes, ApplicantInfoCheckTypes, ApplicantTypes, TargetIdentifierTypes } from "@/application/enums"; +import { getContentUser } from "@/users/helpers"; +import createUrl from "@/api/createUrl"; +import { APPLICANT_MAIN_IDENTIFIERS, APPLICANT_SECTION_IDENTIFIER, TARGET_SECTION_IDENTIFIER } from "@/application/constants"; +import { store } from "@/index"; +import { displayUIMessage } from "@/util/helpers"; +import type { PlotSearch } from "@/plotSearch/types"; +import type { RootState } from "@/root/types"; +import type { ApplicationFormSection, Form, FormSection, PlotApplicationFormValue, SavedApplicationFormSection, UploadedFileMeta } from "@/application/types"; export const transformTargetSectionTitle = (plotSearch: PlotSearch): (...args: Array) => any => (title: string, section: FormSection, answer: SavedApplicationFormSection): string => { if (section.identifier === TARGET_SECTION_IDENTIFIER && answer?.metadata?.identifier) { const target = plotSearch?.plot_search_targets.find(target => target.id === answer.metadata?.identifier); diff --git a/src/application/reducer.ts b/src/application/reducer.ts index 118cc60ab..67b366d04 100644 --- a/src/application/reducer.ts +++ b/src/application/reducer.ts @@ -2,7 +2,7 @@ import type { Action } from "redux"; import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import type { Attributes, Methods, Reducer } from "types"; -import type { ApplicationState, ReceiveApplicantInfoCheckAttributesAction, ReceiveApplicationRelatedAttachmentsAction, ReceiveAttachmentAttributesAction, ReceiveAttachmentMethodsAction, ReceiveAttributesAction, ReceiveFormAttributesAction, ReceiveMethodsAction } from "application/types"; +import type { ApplicationState, ReceiveApplicantInfoCheckAttributesAction, ReceiveApplicationRelatedAttachmentsAction, ReceiveAttachmentAttributesAction, ReceiveAttachmentMethodsAction, ReceiveAttributesAction, ReceiveFormAttributesAction, ReceiveMethodsAction } from "@/application/types"; const attributesReducer: Reducer = handleActions({ ['mvj/application/RECEIVE_ATTRIBUTES']: (state: Attributes, { payload: attributes diff --git a/src/application/requests.ts b/src/application/requests.ts index ef97e59ee..6ece53c02 100644 --- a/src/application/requests.ts +++ b/src/application/requests.ts @@ -1,6 +1,6 @@ -import callApi from "api/callApi"; -import createUrl from "api/createUrl"; -import callUploadRequest from "api/callUploadRequest"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; +import callUploadRequest from "@/api/callUploadRequest"; import { UploadFileData } from "./types"; export const fetchAttributesRequest = (): Generator => { return callApi(new Request(createUrl('answer/'), { diff --git a/src/application/saga.ts b/src/application/saga.ts index b67b331b4..c96ae8a8c 100644 --- a/src/application/saga.ts +++ b/src/application/saga.ts @@ -1,12 +1,12 @@ import { all, call, fork, put, select, takeEvery, takeLatest } from "redux-saga/effects"; import { getFormValues, initialize } from "redux-form"; -import { applicantInfoCheckAttributesNotFound, applicationRelatedAttachmentsNotFound, attachmentAttributesNotFound, attributesNotFound, fetchApplicationRelatedAttachments, fetchPendingUploads, formAttributesNotFound, pendingUploadsNotFound, receiveApplicantInfoCheckAttributes, receiveApplicationRelatedAttachments, receiveAttachmentAttributes, receiveAttachmentMethods, receiveAttributes, receiveFileOperationFinished, receiveFormAttributes, receiveMethods, receivePendingUploads } from "application/actions"; -import { receiveError } from "api/actions"; -import { deleteUploadRequest, fetchApplicantInfoCheckAttributesRequest, fetchAttachmentAttributesRequest, fetchAttributesRequest, fetchFormAttributesRequest, fetchPendingUploadsRequest, fetchSingleApplicationAttachments, uploadFileRequest } from "application/requests"; -import { getApplicantInfoCheckFormName } from "application/helpers"; -import { getContentUser } from "users/helpers"; -import { displayUIMessage } from "util/helpers"; -import type { DeleteUploadAction, ReceiveUpdatedTargetInfoCheckItemAction, UploadFileAction } from "application/types"; +import { applicantInfoCheckAttributesNotFound, applicationRelatedAttachmentsNotFound, attachmentAttributesNotFound, attributesNotFound, fetchApplicationRelatedAttachments, fetchPendingUploads, formAttributesNotFound, pendingUploadsNotFound, receiveApplicantInfoCheckAttributes, receiveApplicationRelatedAttachments, receiveAttachmentAttributes, receiveAttachmentMethods, receiveAttributes, receiveFileOperationFinished, receiveFormAttributes, receiveMethods, receivePendingUploads } from "@/application/actions"; +import { receiveError } from "@/api/actions"; +import { deleteUploadRequest, fetchApplicantInfoCheckAttributesRequest, fetchAttachmentAttributesRequest, fetchAttributesRequest, fetchFormAttributesRequest, fetchPendingUploadsRequest, fetchSingleApplicationAttachments, uploadFileRequest } from "@/application/requests"; +import { getApplicantInfoCheckFormName } from "@/application/helpers"; +import { getContentUser } from "@/users/helpers"; +import { displayUIMessage } from "@/util/helpers"; +import type { DeleteUploadAction, ReceiveUpdatedTargetInfoCheckItemAction, UploadFileAction } from "@/application/types"; function* fetchAttributesSaga(): Generator { try { diff --git a/src/application/selectors.ts b/src/application/selectors.ts index c6bab8d53..897c5e2b4 100644 --- a/src/application/selectors.ts +++ b/src/application/selectors.ts @@ -1,5 +1,5 @@ -import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { Attributes, Methods, Selector } from "@/types"; +import type { RootState } from "@/root/types"; export const getAttributes: Selector = (state: RootState): Attributes => state.application.attributes; export const getMethods: Selector = (state: RootState): Methods => state.application.methods; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.application.isFetchingAttributes; diff --git a/src/areaNote/spec.ts b/src/areaNote/areanote.spec.ts similarity index 99% rename from src/areaNote/spec.ts rename to src/areaNote/areanote.spec.ts index 95846faf8..d743b5076 100644 --- a/src/areaNote/spec.ts +++ b/src/areaNote/areanote.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, receiveAreaNoteList, receiveDeletedAreaNote, receiveEditedAreaNote, fetchAreaNoteList, createAreaNote, deleteAreaNote, editAreaNote, notFound, showEditMode, hideEditMode, initializeAreaNote } from "./actions"; import areaNotesReducer from "./reducer"; import type { AreaNoteState } from "./types"; diff --git a/src/areaNote/components/AreaNoteListPage.tsx b/src/areaNote/components/AreaNoteListPage.tsx index 86e451edf..6f79cf249 100644 --- a/src/areaNote/components/AreaNoteListPage.tsx +++ b/src/areaNote/components/AreaNoteListPage.tsx @@ -5,26 +5,26 @@ import { withRouter } from "react-router"; import { initialize } from "redux-form"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import AreaNotesEditMap from "areaNote/components/AreaNotesEditMap"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import AreaNotesEditMap from "@/areaNote/components/AreaNotesEditMap"; import AreaNotesLayer from "./AreaNotesLayer"; -import Authorization from "components/authorization/Authorization"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; +import Authorization from "@/components/authorization/Authorization"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; import Search from "./search/Search"; -import { fetchAreaNoteList, hideEditMode, initializeAreaNote, showEditMode } from "areaNote/actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { FormNames, Methods, PermissionMissingTexts } from "enums"; -import { getAreaNoteById, getAreaNoteCoordinates } from "areaNote/helpers"; -import { getSearchQuery, getUrlParams, isMethodAllowed, setPageTitle } from "util/helpers"; -import { getBoundsFromCoordinates, getCenterFromCoordinates } from "util/map"; -import { getRouteById, Routes } from "root/routes"; -import { getAreaNoteList, getIsEditMode, getIsFetching } from "areaNote/selectors"; -import { withAreaNoteAttributes } from "components/attributes/AreaNoteAttributes"; +import { fetchAreaNoteList, hideEditMode, initializeAreaNote, showEditMode } from "@/areaNote/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { getAreaNoteById, getAreaNoteCoordinates } from "@/areaNote/helpers"; +import { getSearchQuery, getUrlParams, isMethodAllowed, setPageTitle } from "@/util/helpers"; +import { getBoundsFromCoordinates, getCenterFromCoordinates } from "@/util/map"; +import { getRouteById, Routes } from "@/root/routes"; +import { getAreaNoteList, getIsEditMode, getIsFetching } from "@/areaNote/selectors"; +import { withAreaNoteAttributes } from "@/components/attributes/AreaNoteAttributes"; import type { Methods as MethodsType } from "types"; -import type { AreaNoteList } from "areaNote/types"; +import type { AreaNoteList } from "@/areaNote/types"; type Props = { areaNoteMethods: MethodsType; areaNotes: AreaNoteList; diff --git a/src/areaNote/components/AreaNotesEditMap.tsx b/src/areaNote/components/AreaNotesEditMap.tsx index 53d91a236..1643b5e72 100644 --- a/src/areaNote/components/AreaNotesEditMap.tsx +++ b/src/areaNote/components/AreaNotesEditMap.tsx @@ -9,11 +9,11 @@ import throttle from "lodash/throttle"; import MapContainer from "./MapContainer"; import SaveConditionPanel from "./SaveConditionPanel"; import ZoomLevelWarning from "./ZoomLevelWarning"; -import { createAreaNote, deleteAreaNote, editAreaNote, hideEditMode } from "areaNote/actions"; -import { DEFAULT_CENTER, DEFAULT_ZOOM } from "util/constants"; -import { convertFeatureCollectionToFeature } from "areaNote/helpers"; -import { localizeMap } from "util/map"; -import { getInitialAreaNote, getIsEditMode } from "areaNote/selectors"; +import { createAreaNote, deleteAreaNote, editAreaNote, hideEditMode } from "@/areaNote/actions"; +import { DEFAULT_CENTER, DEFAULT_ZOOM } from "@/util/constants"; +import { convertFeatureCollectionToFeature } from "@/areaNote/helpers"; +import { localizeMap } from "@/util/map"; +import { getInitialAreaNote, getIsEditMode } from "@/areaNote/selectors"; localizeMap(); const SHAPE_COLOR = '#9c27b0'; const SHAPE_FILL_OPACITY = 0.5; diff --git a/src/areaNote/components/AreaNotesLayer.tsx b/src/areaNote/components/AreaNotesLayer.tsx index 2601b7247..9d5326ea8 100644 --- a/src/areaNote/components/AreaNotesLayer.tsx +++ b/src/areaNote/components/AreaNotesLayer.tsx @@ -1,14 +1,14 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import { GeoJSON } from "react-leaflet"; -import { initializeAreaNote, showEditMode } from "areaNote/actions"; -import { Methods } from "enums"; -import { convertAreaNoteListToGeoJson, convertFeatureToFeatureCollection } from "areaNote/helpers"; -import { getUserFullName } from "users/helpers"; -import { formatDate, isMethodAllowed } from "util/helpers"; -import { getIsEditMode, getMethods as getAreaNoteMethods } from "areaNote/selectors"; +import { initializeAreaNote, showEditMode } from "@/areaNote/actions"; +import { Methods } from "@/enums"; +import { convertAreaNoteListToGeoJson, convertFeatureToFeatureCollection } from "@/areaNote/helpers"; +import { getUserFullName } from "@/users/helpers"; +import { formatDate, isMethodAllowed } from "@/util/helpers"; +import { getIsEditMode, getMethods as getAreaNoteMethods } from "@/areaNote/selectors"; import type { Methods as MethodsType } from "types"; -import type { AreaNoteList } from "areaNote/types"; +import type { AreaNoteList } from "@/areaNote/types"; type Props = { allowToEdit?: boolean; areaNoteMethods: MethodsType; diff --git a/src/areaNote/components/MapContainer.tsx b/src/areaNote/components/MapContainer.tsx index b960efc16..6343f7c62 100644 --- a/src/areaNote/components/MapContainer.tsx +++ b/src/areaNote/components/MapContainer.tsx @@ -9,11 +9,11 @@ const { import FullscreenControl from "react-leaflet-fullscreen"; import proj4 from "proj4"; import "proj4leaflet"; -import GeoSearch from "components/map/GeoSearch"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import ZoomBox from "components/map/ZoomBox"; -import { MIN_ZOOM, MAX_ZOOM } from "util/constants"; +import GeoSearch from "@/components/map/GeoSearch"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import ZoomBox from "@/components/map/ZoomBox"; +import { MIN_ZOOM, MAX_ZOOM } from "@/util/constants"; const bounds = L.bounds([25440000, 6630000], [25571072, 6761072]); const CRS = new L.Proj.CRS('EPSG:3879', '+proj=tmerc +lat_0=0 +lon_0=25 +k=1 +x_0=25500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', { resolutions: [256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5, 0.25, 0.125, 0.0625, 0.03125], @@ -68,7 +68,7 @@ class MapContainer extends Component { }; }; - render(): React.ReactNode { + render(): JSX.Element { const { bounds, center, diff --git a/src/areaNote/components/SaveConditionPanel.tsx b/src/areaNote/components/SaveConditionPanel.tsx index f6de3640c..8684fb889 100644 --- a/src/areaNote/components/SaveConditionPanel.tsx +++ b/src/areaNote/components/SaveConditionPanel.tsx @@ -2,15 +2,15 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import classNames from "classnames"; import { Row, Column } from "react-foundation"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import Authorization from "components/authorization/Authorization"; -import Button from "components/button/Button"; -import FormFieldLabel from "components/form/FormFieldLabel"; -import TextAreaInput from "components/inputs/TextAreaInput"; -import { ConfirmationModalTexts, Methods } from "enums"; -import { ButtonColors } from "components/enums"; -import { isMethodAllowed } from "util/helpers"; -import { getMethods as getAreaNoteMethods } from "areaNote/selectors"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import Authorization from "@/components/authorization/Authorization"; +import Button from "@/components/button/Button"; +import FormFieldLabel from "@/components/form/FormFieldLabel"; +import TextAreaInput from "@/components/inputs/TextAreaInput"; +import { ConfirmationModalTexts, Methods } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { isMethodAllowed } from "@/util/helpers"; +import { getMethods as getAreaNoteMethods } from "@/areaNote/selectors"; import type { Methods as MethodsType } from "types"; type Props = { areaNoteMethods: MethodsType; diff --git a/src/areaNote/components/search/Search.tsx b/src/areaNote/components/search/Search.tsx index 8438a78e4..2a01f071f 100644 --- a/src/areaNote/components/search/Search.tsx +++ b/src/areaNote/components/search/Search.tsx @@ -5,10 +5,10 @@ import { Row, Column } from "react-foundation"; import debounce from "lodash/debounce"; import flowRight from "lodash/flowRight"; import isEqual from "lodash/isEqual"; -import FormField from "components/form/FormField"; -import SearchClearLink from "components/search/SearchClearLink"; -import SearchContainer from "components/search/SearchContainer"; -import { FieldTypes, FormNames } from "enums"; +import FormField from "@/components/form/FormField"; +import SearchClearLink from "@/components/search/SearchClearLink"; +import SearchContainer from "@/components/search/SearchContainer"; +import { FieldTypes, FormNames } from "@/enums"; type Props = { formValues: Record; handleSubmit: (...args: Array) => any; diff --git a/src/areaNote/helpers.ts b/src/areaNote/helpers.ts index 3f5c27726..a05a6662e 100644 --- a/src/areaNote/helpers.ts +++ b/src/areaNote/helpers.ts @@ -1,5 +1,5 @@ import get from "lodash/get"; -import { getCoordinatesOfGeometry } from "util/map"; +import { getCoordinatesOfGeometry } from "@/util/map"; import type { AreaNote } from "./types"; /** diff --git a/src/areaNote/requests.ts b/src/areaNote/requests.ts index 43dcfc81f..2e3c01b9f 100644 --- a/src/areaNote/requests.ts +++ b/src/areaNote/requests.ts @@ -1,6 +1,6 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; -import type { AreaNote, AreaNoteId } from "areaNote/types"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; +import type { AreaNote, AreaNoteId } from "@/areaNote/types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl(`area_note/`), { method: 'OPTIONS' diff --git a/src/areaNote/saga.ts b/src/areaNote/saga.ts index 7213bd136..1ce42eb2b 100644 --- a/src/areaNote/saga.ts +++ b/src/areaNote/saga.ts @@ -1,8 +1,8 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { receiveAttributes, receiveMethods, attributesNotFound, hideEditMode, notFound, receiveAreaNoteList, receiveDeletedAreaNote, receiveEditedAreaNote } from "./actions"; -import { displayUIMessage } from "util/helpers"; +import { displayUIMessage } from "@/util/helpers"; import { createAreaNote, deleteAreaNote, editAreaNote, fetchAreaNotes, fetchAttributes } from "./requests"; function* fetchAttributesSaga(): Generator { diff --git a/src/areaNote/selectors.ts b/src/areaNote/selectors.ts index c8ef02385..c3521c133 100644 --- a/src/areaNote/selectors.ts +++ b/src/areaNote/selectors.ts @@ -1,5 +1,5 @@ import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { AreaNoteList } from "./types"; export const getIsFetching: Selector = (state: RootState): boolean => state.areaNote.isFetching; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.areaNote.isFetchingAttributes; diff --git a/src/areaSearch/actions.ts b/src/areaSearch/actions.ts index b6fcb7ce5..e2d8c1c61 100644 --- a/src/areaSearch/actions.ts +++ b/src/areaSearch/actions.ts @@ -1,5 +1,5 @@ import { createAction } from "redux-actions"; -import type { AreaSearchesByBBoxNotFoundAction, AreaSearchesNotFoundAction, AttributesNotFoundAction, FetchAreaSearchListAction, FetchAreaSearchListByBBoxAction, FetchAttributesAction, FetchSingleAreaSearchAction, ReceiveAreaSearchListAction, ReceiveAreaSearchListByBBoxAction, ReceiveAttributesAction, ReceiveMethodsAction, ReceiveSingleAreaSearchAction, SingleAreaSearchNotFoundAction, ClearFormValidFlagsAction, HideEditModeAction, ReceiveCollapseStatesAction, ReceiveFormValidFlagsAction, ReceiveIsSaveClickedAction, ShowEditModeAction, FetchListAttributesAction, ReceiveListAttributesAction, ReceiveListMethodsAction, ListAttributesNotFoundAction, ReceiveAreaSearchInfoCheckBatchEditSuccessAction, ReceiveAreaSearchInfoCheckBatchEditFailureAction, BatchEditAreaSearchInfoChecksAction, EditAreaSearchAction, ReceiveAreaSearchEditedAction, ReceiveAreaSearchEditFailedAction, CreateAreaSearchSpecsAction, ReceiveAreaSearchSpecsCreateFailedAction, ReceiveAreaSearchSpecsCreatedAction, CreateAreaSearchApplicationAction, ReceiveAreaSearchApplicationCreatedAction, ReceiveAreaSearchApplicationCreateFailedAction, DeleteAreaSearchAttachmentAction, UploadAreaSearchAttachmentAction, ReceiveFileOperationFinishedAction, ReceiveFileOperationFailedAction, SetAreaSearchAttachmentsAction, UploadedAreaSearchAttachmentMeta } from "areaSearch/types"; +import type { AreaSearchesByBBoxNotFoundAction, AreaSearchesNotFoundAction, AttributesNotFoundAction, FetchAreaSearchListAction, FetchAreaSearchListByBBoxAction, FetchAttributesAction, FetchSingleAreaSearchAction, ReceiveAreaSearchListAction, ReceiveAreaSearchListByBBoxAction, ReceiveAttributesAction, ReceiveMethodsAction, ReceiveSingleAreaSearchAction, SingleAreaSearchNotFoundAction, ClearFormValidFlagsAction, HideEditModeAction, ReceiveCollapseStatesAction, ReceiveFormValidFlagsAction, ReceiveIsSaveClickedAction, ShowEditModeAction, FetchListAttributesAction, ReceiveListAttributesAction, ReceiveListMethodsAction, ListAttributesNotFoundAction, ReceiveAreaSearchInfoCheckBatchEditSuccessAction, ReceiveAreaSearchInfoCheckBatchEditFailureAction, BatchEditAreaSearchInfoChecksAction, EditAreaSearchAction, ReceiveAreaSearchEditedAction, ReceiveAreaSearchEditFailedAction, CreateAreaSearchSpecsAction, ReceiveAreaSearchSpecsCreateFailedAction, ReceiveAreaSearchSpecsCreatedAction, CreateAreaSearchApplicationAction, ReceiveAreaSearchApplicationCreatedAction, ReceiveAreaSearchApplicationCreateFailedAction, DeleteAreaSearchAttachmentAction, UploadAreaSearchAttachmentAction, ReceiveFileOperationFinishedAction, ReceiveFileOperationFailedAction, SetAreaSearchAttachmentsAction, UploadedAreaSearchAttachmentMeta } from "@/areaSearch/types"; import type { Attributes, Methods } from "types"; export const hideEditMode = (): HideEditModeAction => createAction('mvj/areaSearch/HIDE_EDIT')(); export const showEditMode = (): ShowEditModeAction => createAction('mvj/areaSearch/SHOW_EDIT')(); diff --git a/src/areaSearch/spec.ts b/src/areaSearch/areasearch.spec.ts similarity index 97% rename from src/areaSearch/spec.ts rename to src/areaSearch/areasearch.spec.ts index f40df178c..630b852af 100644 --- a/src/areaSearch/spec.ts +++ b/src/areaSearch/areasearch.spec.ts @@ -1,7 +1,7 @@ -import { expect } from "chai"; -import areaSearchReducer from "areaSearch/reducer"; -import { areaSearchesByBBoxNotFound, areaSearchesNotFound, attributesNotFound, batchEditAreaSearchInfoChecks, editAreaSearch, fetchAreaSearchList, fetchAreaSearchListByBBox, fetchAttributes, fetchListAttributes, fetchSingleAreaSearch, hideEditMode, listAttributesNotFound, receiveAreaSearchByBBoxList, receiveAreaSearchEdited, receiveAreaSearchEditFailed, receiveAreaSearchList, receiveAttributes, receiveListAttributes, receiveListMethods, receiveMethods, receiveSingleAreaSearch, setAreaSearchAttachments, showEditMode, singleAreaSearchNotFound } from "areaSearch/actions"; -import type { AreaSearchState } from "areaSearch/types"; +import { describe, expect, it } from "vitest"; +import areaSearchReducer from "@/areaSearch/reducer"; +import { areaSearchesByBBoxNotFound, areaSearchesNotFound, attributesNotFound, batchEditAreaSearchInfoChecks, editAreaSearch, fetchAreaSearchList, fetchAreaSearchListByBBox, fetchAttributes, fetchListAttributes, fetchSingleAreaSearch, hideEditMode, listAttributesNotFound, receiveAreaSearchByBBoxList, receiveAreaSearchEdited, receiveAreaSearchEditFailed, receiveAreaSearchList, receiveAttributes, receiveListAttributes, receiveListMethods, receiveMethods, receiveSingleAreaSearch, setAreaSearchAttachments, showEditMode, singleAreaSearchNotFound } from "@/areaSearch/actions"; +import type { AreaSearchState } from "@/areaSearch/types"; const defaultState: AreaSearchState = { attributes: null, methods: null, diff --git a/src/areaSearch/components/AreaSearchApplicantInfoCheck.tsx b/src/areaSearch/components/AreaSearchApplicantInfoCheck.tsx index ad74eb890..e51e948b3 100644 --- a/src/areaSearch/components/AreaSearchApplicantInfoCheck.tsx +++ b/src/areaSearch/components/AreaSearchApplicantInfoCheck.tsx @@ -1,10 +1,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; -import { getFieldOptions } from "util/helpers"; +import { getFieldOptions } from "@/util/helpers"; import type { Attributes } from "types"; -import ApplicantInfoCheck from "application/components/infoCheck/ApplicantInfoCheck"; -import { getApplicantInfoCheckAttributes } from "application/selectors"; -import { getApplicantInfoCheckItems } from "application/helpers"; +import ApplicantInfoCheck from "@/application/components/infoCheck/ApplicantInfoCheck"; +import { getApplicantInfoCheckAttributes } from "@/application/selectors"; +import { getApplicantInfoCheckItems } from "@/application/helpers"; type OwnProps = { infoCheckData: Array>; }; @@ -13,7 +13,7 @@ type Props = OwnProps & { }; class AreaSearchApplicantInfoCheck extends PureComponent { - render(): React.ReactNode { + render(): JSX.Element { const { infoCheckAttributes, infoCheckData diff --git a/src/areaSearch/components/AreaSearchApplicantInfoCheckEdit.tsx b/src/areaSearch/components/AreaSearchApplicantInfoCheckEdit.tsx index 4936d9f41..ce5cfa97b 100644 --- a/src/areaSearch/components/AreaSearchApplicantInfoCheckEdit.tsx +++ b/src/areaSearch/components/AreaSearchApplicantInfoCheckEdit.tsx @@ -1,10 +1,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import { change } from "redux-form"; -import PlotApplicationInfoCheckCollapse from "plotApplications/components/infoCheck/PlotApplicationInfoCheckCollapse"; -import { getApplicantInfoCheckSubmissionErrors, getApplicationApplicantInfoCheckData } from "areaSearch/selectors"; -import ApplicantInfoCheckEdit from "application/components/infoCheck/ApplicantInfoCheckEdit"; -import { getApplicantInfoCheckFormName } from "application/helpers"; +import PlotApplicationInfoCheckCollapse from "@/plotApplications/components/infoCheck/PlotApplicationInfoCheckCollapse"; +import { getApplicantInfoCheckSubmissionErrors, getApplicationApplicantInfoCheckData } from "@/areaSearch/selectors"; +import ApplicantInfoCheckEdit from "@/application/components/infoCheck/ApplicantInfoCheckEdit"; +import { getApplicantInfoCheckFormName } from "@/application/helpers"; type OwnProps = { section: Record; identifier: string; @@ -21,7 +21,7 @@ type Props = OwnProps & { }; class PlotApplicationApplicantInfoCheck extends PureComponent { - render(): React.ReactNode { + render(): JSX.Element { const { infoCheckIds, answer, diff --git a/src/areaSearch/components/AreaSearchApplication.tsx b/src/areaSearch/components/AreaSearchApplication.tsx index a950796a2..f60de978f 100644 --- a/src/areaSearch/components/AreaSearchApplication.tsx +++ b/src/areaSearch/components/AreaSearchApplication.tsx @@ -4,32 +4,32 @@ import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import orderBy from "lodash/orderBy"; import { Column, Row } from "react-foundation"; -import { getAttributes, getCurrentAreaSearch } from "areaSearch/selectors"; -import ApplicationAnswersSection from "application/components/ApplicationAnswersSection"; -import { formatDate, formatDateRange, formatNumber, getFieldAttributes, getFieldOptions, getLabelOfOption } from "util/helpers"; +import { getAttributes, getCurrentAreaSearch } from "@/areaSearch/selectors"; +import ApplicationAnswersSection from "@/application/components/ApplicationAnswersSection"; +import { formatDate, formatDateRange, formatNumber, getFieldAttributes, getFieldOptions, getLabelOfOption } from "@/util/helpers"; import type { Attributes } from "types"; -import { reshapeSavedApplicationObject } from "plotApplications/helpers"; -import { transformApplicantSectionTitle, getAreaSearchApplicationAttachmentDownloadLink } from "application/helpers"; -import Title from "components/content/Title"; -import Divider from "components/content/Divider"; -import Collapse from "components/collapse/Collapse"; -import Loader from "components/loader/Loader"; -import FormTextTitle from "components/form/FormTextTitle"; -import FormText from "components/form/FormText"; -import { AreaSearchFieldTitles } from "areaSearch/enums"; -import { getUserFullName } from "users/helpers"; -import SubTitle from "components/content/SubTitle"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import { getAreaFromGeoJSON } from "util/map"; -import SingleAreaSearchMap from "areaSearch/components/map/SingleAreaSearchMap"; -import AreaSearchApplicationPropertyIdentifiers from "areaSearch/components/AreaSearchApplicationPropertyIdentifiers"; -import AreaSearchApplicantInfoCheck from "areaSearch/components/AreaSearchApplicantInfoCheck"; -import { transformApplicantInfoCheckTitle } from "areaSearch/helpers"; -import TitleH3 from "components/content/TitleH3"; -import AreaSearchStatusNoteHistory from "areaSearch/components/AreaSearchStatusNoteHistory"; -import { getFormAttributes, getIsFetchingFormAttributes } from "application/selectors"; -import { APPLICANT_SECTION_IDENTIFIER } from "application/constants"; -import type { Form } from "application/types"; +import { reshapeSavedApplicationObject } from "@/plotApplications/helpers"; +import { transformApplicantSectionTitle, getAreaSearchApplicationAttachmentDownloadLink } from "@/application/helpers"; +import Title from "@/components/content/Title"; +import Divider from "@/components/content/Divider"; +import Collapse from "@/components/collapse/Collapse"; +import Loader from "@/components/loader/Loader"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import FormText from "@/components/form/FormText"; +import { AreaSearchFieldTitles } from "@/areaSearch/enums"; +import { getUserFullName } from "@/users/helpers"; +import SubTitle from "@/components/content/SubTitle"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import { getAreaFromGeoJSON } from "@/util/map"; +import SingleAreaSearchMap from "@/areaSearch/components/map/SingleAreaSearchMap"; +import AreaSearchApplicationPropertyIdentifiers from "@/areaSearch/components/AreaSearchApplicationPropertyIdentifiers"; +import AreaSearchApplicantInfoCheck from "@/areaSearch/components/AreaSearchApplicantInfoCheck"; +import { transformApplicantInfoCheckTitle } from "@/areaSearch/helpers"; +import TitleH3 from "@/components/content/TitleH3"; +import AreaSearchStatusNoteHistory from "@/areaSearch/components/AreaSearchStatusNoteHistory"; +import { getFormAttributes, getIsFetchingFormAttributes } from "@/application/selectors"; +import { APPLICANT_SECTION_IDENTIFIER } from "@/application/constants"; +import type { Form } from "@/application/types"; type OwnProps = {}; type Props = OwnProps & { areaSearch: Record | null; @@ -51,7 +51,7 @@ class AreaSearchApplication extends Component { selectedAreaSectionRefreshKey: 0 }; - render(): React.ReactNode { + render(): JSX.Element { const { areaSearch, isFetchingFormAttributes, diff --git a/src/areaSearch/components/AreaSearchApplicationAuditLog.tsx b/src/areaSearch/components/AreaSearchApplicationAuditLog.tsx index 6ac91f625..3cb456a15 100644 --- a/src/areaSearch/components/AreaSearchApplicationAuditLog.tsx +++ b/src/areaSearch/components/AreaSearchApplicationAuditLog.tsx @@ -1,21 +1,21 @@ import React, { Fragment, PureComponent } from "react"; import { connect } from "react-redux"; import isEmpty from "lodash/isEmpty"; -import AuditLogTable from "components/auditLog/AuditLogTable"; -import Divider from "components/content/Divider"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import Pagination from "components/table/Pagination"; -import TableWrapper from "components/table/TableWrapper"; -import Title from "components/content/Title"; -import { fetchAuditLogByAreaSearch } from "auditLog/actions"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import { AreaSearchFieldPaths, AreaSearchFieldTitles } from "areaSearch/enums"; -import { getApiResponseCount, getApiResponseMaxPage, getApiResponseResults } from "util/helpers"; -import { getUiDataLeaseKey } from "uiData/helpers"; -import { getAuditLogByAreaSearch, getIsFetchingByAreaSearch } from "auditLog/selectors"; -import { getIsEditMode } from "leases/selectors"; -import type { AuditLogList } from "auditLog/types"; +import AuditLogTable from "@/components/auditLog/AuditLogTable"; +import Divider from "@/components/content/Divider"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import Pagination from "@/components/table/Pagination"; +import TableWrapper from "@/components/table/TableWrapper"; +import Title from "@/components/content/Title"; +import { fetchAuditLogByAreaSearch } from "@/auditLog/actions"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import { AreaSearchFieldPaths, AreaSearchFieldTitles } from "@/areaSearch/enums"; +import { getApiResponseCount, getApiResponseMaxPage, getApiResponseResults } from "@/util/helpers"; +import { getUiDataLeaseKey } from "@/uiData/helpers"; +import { getAuditLogByAreaSearch, getIsFetchingByAreaSearch } from "@/auditLog/selectors"; +import { getIsEditMode } from "@/leases/selectors"; +import type { AuditLogList } from "@/auditLog/types"; type Props = { auditLogList: AuditLogList; fetchAuditLogByAreaSearch: (...args: Array) => any; diff --git a/src/areaSearch/components/AreaSearchApplicationCreateForm.tsx b/src/areaSearch/components/AreaSearchApplicationCreateForm.tsx index 9b7dc505b..6a39cc445 100644 --- a/src/areaSearch/components/AreaSearchApplicationCreateForm.tsx +++ b/src/areaSearch/components/AreaSearchApplicationCreateForm.tsx @@ -2,12 +2,12 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import { flowRight } from "lodash/util"; import { getFormValues, reduxForm } from "redux-form"; -import ApplicationSubsection from "application/components/ApplicationSubsection"; -import { getInitialApplicationForm } from "application/helpers"; -import { getFieldTypeMapping } from "application/selectors"; -import { FormNames } from "enums"; -import { receiveFormValidFlags } from "areaSearch/actions"; -import { validateApplicationForm } from "application/formValidation"; +import ApplicationSubsection from "@/application/components/ApplicationSubsection"; +import { getInitialApplicationForm } from "@/application/helpers"; +import { getFieldTypeMapping } from "@/application/selectors"; +import { FormNames } from "@/enums"; +import { receiveFormValidFlags } from "@/areaSearch/actions"; +import { validateApplicationForm } from "@/application/formValidation"; type OwnProps = { formData: any; }; @@ -52,7 +52,7 @@ class AreaSearchApplicationCreateForm extends Component { } } - render(): React.ReactNode { + render(): JSX.Element { const { formData, formValues diff --git a/src/areaSearch/components/AreaSearchApplicationCreatePage.tsx b/src/areaSearch/components/AreaSearchApplicationCreatePage.tsx index 647fedfe4..af1d2338c 100644 --- a/src/areaSearch/components/AreaSearchApplicationCreatePage.tsx +++ b/src/areaSearch/components/AreaSearchApplicationCreatePage.tsx @@ -2,28 +2,28 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import { flowRight } from "lodash/util"; import { destroy, getFormValues, initialize, isDirty } from "redux-form"; -import { getRouteById, Routes } from "root/routes"; -import FullWidthContainer from "components/content/FullWidthContainer"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; -import ControlButtonBar from "components/controlButtons/ControlButtonBar"; -import ControlButtons from "components/controlButtons/ControlButtons"; -import Tabs from "components/tabs/Tabs"; -import TabContent from "components/tabs/TabContent"; -import TabPane from "components/tabs/TabPane"; -import PageContainer from "components/content/PageContainer"; -import ContentContainer from "components/content/ContentContainer"; -import AreaSearchApplicationCreateSpecs from "areaSearch/components/AreaSearchApplicationCreateSpecs"; -import { createAreaSearchApplication, createAreaSearchSpecs, deleteUploadedAttachment, fetchAttributes, hideEditMode, receiveIsSaveClicked, receiveSingleAreaSearch, showEditMode, uploadAttachment } from "areaSearch/actions"; -import { getAttributes, getCurrentAreaSearch, getIsFetchingAttributes, getIsFormValidById, getIsSaveClicked, getIsPerformingFileOperation, getIsSubmittingAreaSearchSpecs, getIsSubmittingAreaSearchApplication } from "areaSearch/selectors"; -import { setPageTitle } from "util/helpers"; -import Loader from "components/loader/Loader"; -import AreaSearchApplicationCreateForm from "areaSearch/components/AreaSearchApplicationCreateForm"; -import { FormNames } from "enums"; -import { getInitialAreaSearchCreateForm, prepareAreaSearchDataForSubmission } from "areaSearch/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; +import ControlButtonBar from "@/components/controlButtons/ControlButtonBar"; +import ControlButtons from "@/components/controlButtons/ControlButtons"; +import Tabs from "@/components/tabs/Tabs"; +import TabContent from "@/components/tabs/TabContent"; +import TabPane from "@/components/tabs/TabPane"; +import PageContainer from "@/components/content/PageContainer"; +import ContentContainer from "@/components/content/ContentContainer"; +import AreaSearchApplicationCreateSpecs from "@/areaSearch/components/AreaSearchApplicationCreateSpecs"; +import { createAreaSearchApplication, createAreaSearchSpecs, deleteUploadedAttachment, fetchAttributes, hideEditMode, receiveIsSaveClicked, receiveSingleAreaSearch, showEditMode, uploadAttachment } from "@/areaSearch/actions"; +import { getAttributes, getCurrentAreaSearch, getIsFetchingAttributes, getIsFormValidById, getIsSaveClicked, getIsPerformingFileOperation, getIsSubmittingAreaSearchSpecs, getIsSubmittingAreaSearchApplication } from "@/areaSearch/selectors"; +import { setPageTitle } from "@/util/helpers"; +import Loader from "@/components/loader/Loader"; +import AreaSearchApplicationCreateForm from "@/areaSearch/components/AreaSearchApplicationCreateForm"; +import { FormNames } from "@/enums"; +import { getInitialAreaSearchCreateForm, prepareAreaSearchDataForSubmission } from "@/areaSearch/helpers"; import type { Attributes } from "types"; -import { getFormAttributes, getIsFetchingFormAttributes } from "application/selectors"; -import { fetchFormAttributes } from "application/actions"; -import type { UploadedFileMeta } from "application/types"; +import { getFormAttributes, getIsFetchingFormAttributes } from "@/application/selectors"; +import { fetchFormAttributes } from "@/application/actions"; +import type { UploadedFileMeta } from "@/application/types"; type OwnProps = {}; type Props = OwnProps & { history: Record; @@ -207,7 +207,7 @@ class AreaSearchApplicationCreatePage extends Component { } }; - render(): React.ReactNode { + render(): JSX.Element { const { isFetchingAttributes, currentAreaSearch, diff --git a/src/areaSearch/components/AreaSearchApplicationCreateSpecs.tsx b/src/areaSearch/components/AreaSearchApplicationCreateSpecs.tsx index 2a6d6bb97..d7c2995e7 100644 --- a/src/areaSearch/components/AreaSearchApplicationCreateSpecs.tsx +++ b/src/areaSearch/components/AreaSearchApplicationCreateSpecs.tsx @@ -4,19 +4,19 @@ import { connect } from "react-redux"; import { Column, Row } from "react-foundation"; import get from "lodash/get"; import { flowRight } from "lodash/util"; -import Title from "components/content/Title"; -import { FieldTypes, FormNames } from "enums"; -import { getAttributes, getIsPerformingFileOperation, getIsSaveClicked, getIsSubmittingAreaSearchSpecs } from "areaSearch/selectors"; +import Title from "@/components/content/Title"; +import { FieldTypes, FormNames } from "@/enums"; +import { getAttributes, getIsPerformingFileOperation, getIsSaveClicked, getIsSubmittingAreaSearchSpecs } from "@/areaSearch/selectors"; import type { Attributes } from "types"; -import Authorization from "components/authorization/Authorization"; -import FormField from "components/form/FormField"; -import AreaSearchMap from "areaSearch/components/map/AreaSearchMap"; -import FormFieldLabel from "components/form/FormFieldLabel"; -import { createAreaSearchSpecs, receiveFormValidFlags } from "areaSearch/actions"; -import AddFileButton from "components/form/AddFileButton"; -import RemoveButton from "components/form/RemoveButton"; -import type { UploadedFileMeta } from "application/types"; -import { nonEmptyGeometry } from "areaSearch/validators"; +import Authorization from "@/components/authorization/Authorization"; +import FormField from "@/components/form/FormField"; +import AreaSearchMap from "@/areaSearch/components/map/AreaSearchMap"; +import FormFieldLabel from "@/components/form/FormFieldLabel"; +import { createAreaSearchSpecs, receiveFormValidFlags } from "@/areaSearch/actions"; +import AddFileButton from "@/components/form/AddFileButton"; +import RemoveButton from "@/components/form/RemoveButton"; +import type { UploadedFileMeta } from "@/application/types"; +import { nonEmptyGeometry } from "@/areaSearch/validators"; import { startOfToday } from "date-fns"; type OwnProps = { onFileAdded: (...args: Array) => any; @@ -75,7 +75,7 @@ class AreaSearchApplicationCreateSpecs extends Component { onFileRemoved(index); }; - render(): React.ReactNode { + render(): JSX.Element { const { attributes, change, diff --git a/src/areaSearch/components/AreaSearchApplicationEdit.tsx b/src/areaSearch/components/AreaSearchApplicationEdit.tsx index 44d0909fa..78df61f10 100644 --- a/src/areaSearch/components/AreaSearchApplicationEdit.tsx +++ b/src/areaSearch/components/AreaSearchApplicationEdit.tsx @@ -6,38 +6,38 @@ import orderBy from "lodash/orderBy"; import get from "lodash/get"; import { Column, Row } from "react-foundation"; import { reduxForm } from "redux-form"; -import { getAttributes, getCurrentAreaSearch } from "areaSearch/selectors"; -import ApplicationAnswersSection from "application/components/ApplicationAnswersSection"; -import { formatDate, formatDateRange, formatNumber, getFieldAttributes, getFieldOptions, getLabelOfOption, displayUIMessage } from "util/helpers"; +import { getAttributes, getCurrentAreaSearch } from "@/areaSearch/selectors"; +import ApplicationAnswersSection from "@/application/components/ApplicationAnswersSection"; +import { formatDate, formatDateRange, formatNumber, getFieldAttributes, getFieldOptions, getLabelOfOption, displayUIMessage } from "@/util/helpers"; import type { Attributes } from "types"; -import { reshapeSavedApplicationObject } from "plotApplications/helpers"; -import { transformApplicantSectionTitle, getAreaSearchApplicationAttachmentDownloadLink } from "application/helpers"; -import Title from "components/content/Title"; -import Divider from "components/content/Divider"; -import Collapse from "components/collapse/Collapse"; -import Loader from "components/loader/Loader"; -import FormTextTitle from "components/form/FormTextTitle"; -import FormText from "components/form/FormText"; -import { AreaSearchFieldTitles } from "areaSearch/enums"; -import { getUserFullName } from "users/helpers"; -import SubTitle from "components/content/SubTitle"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import { getAreaFromGeoJSON } from "util/map"; -import SingleAreaSearchMap from "areaSearch/components/map/SingleAreaSearchMap"; -import AreaSearchApplicationPropertyIdentifiers from "areaSearch/components/AreaSearchApplicationPropertyIdentifiers"; -import AreaSearchApplicantInfoCheckEdit from "areaSearch/components/AreaSearchApplicantInfoCheckEdit"; -import { FieldTypes, FormNames } from "enums"; -import { getInitialAreaSearchEditForm, transformApplicantInfoCheckTitle } from "areaSearch/helpers"; -import FormField from "components/form/FormField"; -import TitleH3 from "components/content/TitleH3"; -import AreaSearchStatusNoteHistory from "areaSearch/components/AreaSearchStatusNoteHistory"; -import { getFormAttributes, getIsFetchingFormAttributes, getIsPerformingFileOperation } from "application/selectors"; -import { APPLICANT_SECTION_IDENTIFIER } from "application/constants"; -import type { Form } from "application/types"; -import type { AreaSearch, UploadedAreaSearchAttachmentMeta } from "areaSearch/types"; -import AddFileButton from "components/form/AddFileButton"; -import { uploadAttachment, setAreaSearchAttachments } from "areaSearch/actions"; -import RemoveButton from "components/form/RemoveButton"; +import { reshapeSavedApplicationObject } from "@/plotApplications/helpers"; +import { transformApplicantSectionTitle, getAreaSearchApplicationAttachmentDownloadLink } from "@/application/helpers"; +import Title from "@/components/content/Title"; +import Divider from "@/components/content/Divider"; +import Collapse from "@/components/collapse/Collapse"; +import Loader from "@/components/loader/Loader"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import FormText from "@/components/form/FormText"; +import { AreaSearchFieldTitles } from "@/areaSearch/enums"; +import { getUserFullName } from "@/users/helpers"; +import SubTitle from "@/components/content/SubTitle"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import { getAreaFromGeoJSON } from "@/util/map"; +import SingleAreaSearchMap from "@/areaSearch/components/map/SingleAreaSearchMap"; +import AreaSearchApplicationPropertyIdentifiers from "@/areaSearch/components/AreaSearchApplicationPropertyIdentifiers"; +import AreaSearchApplicantInfoCheckEdit from "@/areaSearch/components/AreaSearchApplicantInfoCheckEdit"; +import { FieldTypes, FormNames } from "@/enums"; +import { getInitialAreaSearchEditForm, transformApplicantInfoCheckTitle } from "@/areaSearch/helpers"; +import FormField from "@/components/form/FormField"; +import TitleH3 from "@/components/content/TitleH3"; +import AreaSearchStatusNoteHistory from "@/areaSearch/components/AreaSearchStatusNoteHistory"; +import { getFormAttributes, getIsFetchingFormAttributes, getIsPerformingFileOperation } from "@/application/selectors"; +import { APPLICANT_SECTION_IDENTIFIER } from "@/application/constants"; +import type { Form } from "@/application/types"; +import type { AreaSearch, UploadedAreaSearchAttachmentMeta } from "@/areaSearch/types"; +import AddFileButton from "@/components/form/AddFileButton"; +import { uploadAttachment, setAreaSearchAttachments } from "@/areaSearch/actions"; +import RemoveButton from "@/components/form/RemoveButton"; type Props = { areaSearch: AreaSearch | null; isFetchingFormAttributes: boolean; @@ -112,7 +112,7 @@ class AreaSearchApplicationEdit extends Component { } }; - render(): React.ReactNode { + render(): JSX.Element { const { areaSearch, isFetchingFormAttributes, diff --git a/src/areaSearch/components/AreaSearchApplicationListPage.tsx b/src/areaSearch/components/AreaSearchApplicationListPage.tsx index 62bbe0e59..b5671834e 100644 --- a/src/areaSearch/components/AreaSearchApplicationListPage.tsx +++ b/src/areaSearch/components/AreaSearchApplicationListPage.tsx @@ -7,46 +7,46 @@ import { Row, Column } from "react-foundation"; import { formValueSelector, initialize, reduxForm } from "redux-form"; import { withRouter } from "react-router"; import debounce from "lodash/debounce"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import { FieldTypes, FormNames, Methods, PermissionMissingTexts } from "enums"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import Pagination from "components/table/Pagination"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import Search from "areaSearch/components/search/Search"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import SortableTable from "components/table/SortableTable"; -import TableFilters from "components/table/TableFilters"; -import TableFilterWrapper from "components/table/TableFilterWrapper"; -import TableWrapper from "components/table/TableWrapper"; -import IconRadioButtons from "components/button/IconRadioButtons"; -import TableIcon from "components/icons/TableIcon"; -import MapIcon from "components/icons/MapIcon"; -import { getRouteById, Routes } from "root/routes"; -import { formatDate, getLabelOfOption, setPageTitle, getFieldOptions, getSearchQuery, getApiResponseCount, getApiResponseMaxPage, getUrlParams, isMethodAllowed } from "util/helpers"; -import { withAreaSearchAttributes } from "components/attributes/AreaSearchAttributes"; -import { getAreaSearchList, getAreaSearchListByBBox, getIsEditingAreaSearch, getIsFetchingAreaSearchList, getIsFetchingAreaSearchListByBBox, getLastAreaSearchEditError } from "areaSearch/selectors"; -import { DEFAULT_AREA_SEARCH_STATES, DEFAULT_SORT_KEY, DEFAULT_SORT_ORDER } from "areaSearch/constants"; -import { editAreaSearch, fetchAreaSearchList, fetchAreaSearchListByBBox } from "areaSearch/actions"; -import { getUserFullName } from "users/helpers"; -import { areaSearchSearchFilters } from "areaSearch/helpers"; -import { BOUNDING_BOX_FOR_SEARCH_QUERY, MAX_ZOOM_LEVEL_TO_FETCH_AREA_SEARCHES } from "areaSearch/constants"; -import AreaSearchListMap from "areaSearch/components/map/AreaSearchListMap"; -import VisualisationTypeWrapper from "components/table/VisualisationTypeWrapper"; -import { ButtonColors } from "components/enums"; -import Button from "components/button/Button"; -import EditAreaSearchPreparerModal from "areaSearch/components/EditAreaSearchPreparerModal"; -import Authorization from "components/authorization/Authorization"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import FormField from "components/form/FormField"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import { FieldTypes, FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import Pagination from "@/components/table/Pagination"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import Search from "@/areaSearch/components/search/Search"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import SortableTable from "@/components/table/SortableTable"; +import TableFilters from "@/components/table/TableFilters"; +import TableFilterWrapper from "@/components/table/TableFilterWrapper"; +import TableWrapper from "@/components/table/TableWrapper"; +import IconRadioButtons from "@/components/button/IconRadioButtons"; +import TableIcon from "@/components/icons/TableIcon"; +import MapIcon from "@/components/icons/MapIcon"; +import { getRouteById, Routes } from "@/root/routes"; +import { formatDate, getLabelOfOption, setPageTitle, getFieldOptions, getSearchQuery, getApiResponseCount, getApiResponseMaxPage, getUrlParams, isMethodAllowed } from "@/util/helpers"; +import { withAreaSearchAttributes } from "@/components/attributes/AreaSearchAttributes"; +import { getAreaSearchList, getAreaSearchListByBBox, getIsEditingAreaSearch, getIsFetchingAreaSearchList, getIsFetchingAreaSearchListByBBox, getLastAreaSearchEditError } from "@/areaSearch/selectors"; +import { DEFAULT_AREA_SEARCH_STATES, DEFAULT_SORT_KEY, DEFAULT_SORT_ORDER } from "@/areaSearch/constants"; +import { editAreaSearch, fetchAreaSearchList, fetchAreaSearchListByBBox } from "@/areaSearch/actions"; +import { getUserFullName } from "@/users/helpers"; +import { areaSearchSearchFilters } from "@/areaSearch/helpers"; +import { BOUNDING_BOX_FOR_SEARCH_QUERY, MAX_ZOOM_LEVEL_TO_FETCH_AREA_SEARCHES } from "@/areaSearch/constants"; +import AreaSearchListMap from "@/areaSearch/components/map/AreaSearchListMap"; +import VisualisationTypeWrapper from "@/components/table/VisualisationTypeWrapper"; +import { ButtonColors } from "@/components/enums"; +import Button from "@/components/button/Button"; +import EditAreaSearchPreparerModal from "@/areaSearch/components/EditAreaSearchPreparerModal"; +import Authorization from "@/components/authorization/Authorization"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import FormField from "@/components/form/FormField"; import type { Attributes, Methods as MethodsType } from "types"; import type { ApiResponse } from "types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; -import AreaSearchExportModal from "areaSearch/components/AreaSearchExportModal"; -import { getUserActiveServiceUnit } from "usersPermissions/selectors"; -import type { UserServiceUnit } from "usersPermissions/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; +import AreaSearchExportModal from "@/areaSearch/components/AreaSearchExportModal"; +import { getUserActiveServiceUnit } from "@/usersPermissions/selectors"; +import type { UserServiceUnit } from "@/usersPermissions/types"; const VisualizationTypes = { MAP: 'map', TABLE: 'table' diff --git a/src/areaSearch/components/AreaSearchApplicationPage.tsx b/src/areaSearch/components/AreaSearchApplicationPage.tsx index 6ba7e9cc0..42797a087 100644 --- a/src/areaSearch/components/AreaSearchApplicationPage.tsx +++ b/src/areaSearch/components/AreaSearchApplicationPage.tsx @@ -7,40 +7,40 @@ import isEmpty from "lodash/isEmpty"; import { groupBy } from "lodash/collection"; import { initialize, isDirty, destroy, getFormValues, isValid, change } from "redux-form"; import type { ContextRouter } from "react-router"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import FullWidthContainer from "components/content/FullWidthContainer"; -import PageContainer from "components/content/PageContainer"; -import { ButtonColors } from "components/enums"; -import Loader from "components/loader/Loader"; -import TabContent from "components/tabs/TabContent"; -import TabPane from "components/tabs/TabPane"; -import Tabs from "components/tabs/Tabs"; -import ContentContainer from "components/content/ContentContainer"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; -import ControlButtonBar from "components/controlButtons/ControlButtonBar"; -import ControlButtons from "components/controlButtons/ControlButtons"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { getRouteById, Routes } from "root/routes"; -import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "enums"; -import { getIsEditMode, getIsSaveClicked, getIsFormValidFlags, getCurrentAreaSearch, getIsFetchingCurrentAreaSearch } from "areaSearch/selectors"; -import { showEditMode, receiveIsSaveClicked, hideEditMode, clearFormValidFlags, receiveFormValidFlags, fetchSingleAreaSearch, batchEditAreaSearchInfoChecks } from "areaSearch/actions"; -import { getUrlParams, setPageTitle, isMethodAllowed, getSearchQuery, scrollToTopPage } from "util/helpers"; -import { clearUnsavedChanges } from "contacts/helpers"; -import ConfirmationModal from "components/modal/ConfirmationModal"; -import AreaSearchApplication from "areaSearch/components/AreaSearchApplication"; -import { withAreaSearchAttributes } from "components/attributes/AreaSearchAttributes"; -import AreaSearchApplicationEdit from "areaSearch/components/AreaSearchApplicationEdit"; -import AreaSearchApplicationAuditLog from "areaSearch/components/AreaSearchApplicationAuditLog"; -import { fetchApplicantInfoCheckAttributes, fetchFormAttributes } from "application/actions"; -import { getFormAttributes, getIsFetchingApplicantInfoCheckAttributes, getIsFetchingFormAttributes } from "application/selectors"; -import { getApplicationApplicantInfoCheckData } from "areaSearch/selectors"; -import { getApplicantInfoCheckFormName, getApplicantInfoCheckItems, prepareApplicantInfoCheckForSubmission } from "application/helpers"; -import { prepareAreaSearchForSubmission } from "areaSearch/helpers"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; +import PageContainer from "@/components/content/PageContainer"; +import { ButtonColors } from "@/components/enums"; +import Loader from "@/components/loader/Loader"; +import TabContent from "@/components/tabs/TabContent"; +import TabPane from "@/components/tabs/TabPane"; +import Tabs from "@/components/tabs/Tabs"; +import ContentContainer from "@/components/content/ContentContainer"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; +import ControlButtonBar from "@/components/controlButtons/ControlButtonBar"; +import ControlButtons from "@/components/controlButtons/ControlButtons"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { getRouteById, Routes } from "@/root/routes"; +import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { getIsEditMode, getIsSaveClicked, getIsFormValidFlags, getCurrentAreaSearch, getIsFetchingCurrentAreaSearch } from "@/areaSearch/selectors"; +import { showEditMode, receiveIsSaveClicked, hideEditMode, clearFormValidFlags, receiveFormValidFlags, fetchSingleAreaSearch, batchEditAreaSearchInfoChecks } from "@/areaSearch/actions"; +import { getUrlParams, setPageTitle, isMethodAllowed, getSearchQuery, scrollToTopPage } from "@/util/helpers"; +import { clearUnsavedChanges } from "@/contacts/helpers"; +import ConfirmationModal from "@/components/modal/ConfirmationModal"; +import AreaSearchApplication from "@/areaSearch/components/AreaSearchApplication"; +import { withAreaSearchAttributes } from "@/components/attributes/AreaSearchAttributes"; +import AreaSearchApplicationEdit from "@/areaSearch/components/AreaSearchApplicationEdit"; +import AreaSearchApplicationAuditLog from "@/areaSearch/components/AreaSearchApplicationAuditLog"; +import { fetchApplicantInfoCheckAttributes, fetchFormAttributes } from "@/application/actions"; +import { getFormAttributes, getIsFetchingApplicantInfoCheckAttributes, getIsFetchingFormAttributes } from "@/application/selectors"; +import { getApplicationApplicantInfoCheckData } from "@/areaSearch/selectors"; +import { getApplicantInfoCheckFormName, getApplicantInfoCheckItems, prepareApplicantInfoCheckForSubmission } from "@/application/helpers"; +import { prepareAreaSearchForSubmission } from "@/areaSearch/helpers"; import type { Attributes, Methods as MethodsType } from "types"; -import type { InfoCheckBatchEditData } from "areaSearch/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; -import SingleAreaSearchMap from "areaSearch/components/map/SingleAreaSearchMap"; +import type { InfoCheckBatchEditData } from "@/areaSearch/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; +import SingleAreaSearchMap from "@/areaSearch/components/map/SingleAreaSearchMap"; type OwnProps = {}; type Props = ContextRouter & OwnProps & { clearFormValidFlags: (...args: Array) => any; diff --git a/src/areaSearch/components/AreaSearchApplicationPropertyIdentifiers.tsx b/src/areaSearch/components/AreaSearchApplicationPropertyIdentifiers.tsx index 29d544bb7..9d34c5a04 100644 --- a/src/areaSearch/components/AreaSearchApplicationPropertyIdentifiers.tsx +++ b/src/areaSearch/components/AreaSearchApplicationPropertyIdentifiers.tsx @@ -1,6 +1,6 @@ import React, { Component, Fragment } from "react"; -import Button from "components/button/Button"; -import { ButtonColors } from "components/enums"; +import Button from "@/components/button/Button"; +import { ButtonColors } from "@/components/enums"; type Props = { ids: Array | null | undefined; }; @@ -13,7 +13,7 @@ class AreaSearchApplicationPropertyIdentifiers extends Component { expanded: false }; - render(): React.ReactNode { + render(): JSX.Element { const { ids } = this.props; diff --git a/src/areaSearch/components/AreaSearchExportModal.tsx b/src/areaSearch/components/AreaSearchExportModal.tsx index 244e9dc6b..295b57219 100644 --- a/src/areaSearch/components/AreaSearchExportModal.tsx +++ b/src/areaSearch/components/AreaSearchExportModal.tsx @@ -2,15 +2,15 @@ import React, { Component } from "react"; import { formValueSelector, reduxForm } from "redux-form"; import { flowRight } from "lodash/util"; import { connect } from "react-redux"; -import Modal from "components/modal/Modal"; -import ModalButtonWrapper from "components/modal/ModalButtonWrapper"; -import Button from "components/button/Button"; -import { ButtonColors } from "components/enums"; -import FileDownloadButton from "components/file/FileDownloadButton"; -import FormField from "components/form/FormField"; -import { FieldTypes, FormNames } from "enums"; -import type { RootState } from "root/types"; -import createUrl from "api/createUrl"; +import Modal from "@/components/modal/Modal"; +import ModalButtonWrapper from "@/components/modal/ModalButtonWrapper"; +import Button from "@/components/button/Button"; +import { ButtonColors } from "@/components/enums"; +import FileDownloadButton from "@/components/file/FileDownloadButton"; +import FormField from "@/components/form/FormField"; +import { FieldTypes, FormNames } from "@/enums"; +import type { RootState } from "@/root/types"; +import createUrl from "@/api/createUrl"; type OwnProps = { isOpen: boolean; onClose: () => void; @@ -41,7 +41,7 @@ class AreaSearchExportModal extends Component { } } - render(): React.ReactNode { + render(): JSX.Element { const { isOpen, onClose, diff --git a/src/areaSearch/components/AreaSearchStatusNoteHistory.tsx b/src/areaSearch/components/AreaSearchStatusNoteHistory.tsx index 94a9138ee..3146bdf7d 100644 --- a/src/areaSearch/components/AreaSearchStatusNoteHistory.tsx +++ b/src/areaSearch/components/AreaSearchStatusNoteHistory.tsx @@ -1,13 +1,13 @@ import React, { Component } from "react"; -import Collapse from "components/collapse/Collapse"; -import { formatDate } from "util/helpers"; -import { getUserFullName } from "users/helpers"; +import Collapse from "@/components/collapse/Collapse"; +import { formatDate } from "@/util/helpers"; +import { getUserFullName } from "@/users/helpers"; type Props = { statusNotes: Array> | null | undefined; }; class AreaSearchStatusNoteHistory extends Component { - render(): React.ReactNode { + render(): JSX.Element { const { statusNotes } = this.props; diff --git a/src/areaSearch/components/EditAreaSearchPreparerForm.tsx b/src/areaSearch/components/EditAreaSearchPreparerForm.tsx index 4227e2fa0..f6f968752 100644 --- a/src/areaSearch/components/EditAreaSearchPreparerForm.tsx +++ b/src/areaSearch/components/EditAreaSearchPreparerForm.tsx @@ -4,16 +4,16 @@ import { getFormValues, reduxForm } from "redux-form"; import { connect } from "react-redux"; import { Column, Row } from "react-foundation"; import get from "lodash/get"; -import { editAreaSearch } from "areaSearch/actions"; -import FormField from "components/form/FormField"; -import { getAttributes } from "areaSearch/selectors"; -import { AreaSearchFieldTitles } from "areaSearch/enums"; -import { FieldTypes, FormNames } from "enums"; -import Button from "components/button/Button"; -import { ButtonColors } from "components/enums"; -import { getInitialAreaSearchEditForm } from "areaSearch/helpers"; -import ModalButtonWrapper from "components/modal/ModalButtonWrapper"; -import AreaSearchStatusNoteHistory from "areaSearch/components/AreaSearchStatusNoteHistory"; +import { editAreaSearch } from "@/areaSearch/actions"; +import FormField from "@/components/form/FormField"; +import { getAttributes } from "@/areaSearch/selectors"; +import { AreaSearchFieldTitles } from "@/areaSearch/enums"; +import { FieldTypes, FormNames } from "@/enums"; +import Button from "@/components/button/Button"; +import { ButtonColors } from "@/components/enums"; +import { getInitialAreaSearchEditForm } from "@/areaSearch/helpers"; +import ModalButtonWrapper from "@/components/modal/ModalButtonWrapper"; +import AreaSearchStatusNoteHistory from "@/areaSearch/components/AreaSearchStatusNoteHistory"; import type { Attributes } from "types"; type OwnProps = { onClose: (...args: Array) => any; @@ -51,7 +51,7 @@ class EditAreaSearchPreparerForm extends Component { } }; - render(): React.ReactNode { + render(): JSX.Element { const { areaSearchAttributes, areaSearchData, diff --git a/src/areaSearch/components/EditAreaSearchPreparerModal.tsx b/src/areaSearch/components/EditAreaSearchPreparerModal.tsx index f7bfc8a42..7033e5644 100644 --- a/src/areaSearch/components/EditAreaSearchPreparerModal.tsx +++ b/src/areaSearch/components/EditAreaSearchPreparerModal.tsx @@ -1,10 +1,10 @@ import React, { Component } from "react"; -import Modal from "components/modal/Modal"; -import EditAreaSearchPreparerForm from "areaSearch/components/EditAreaSearchPreparerForm"; -import { getAreaSearchList } from "areaSearch/selectors"; +import Modal from "@/components/modal/Modal"; +import EditAreaSearchPreparerForm from "@/areaSearch/components/EditAreaSearchPreparerForm"; +import { getAreaSearchList } from "@/areaSearch/selectors"; import { connect } from "react-redux"; -import { formatDate } from "util/helpers"; -import FormText from "components/form/FormText"; +import { formatDate } from "@/util/helpers"; +import FormText from "@/components/form/FormText"; type OwnProps = { allowToChangeRelateTo?: boolean; isOpen: boolean; @@ -29,7 +29,7 @@ class EditAreaSearchPreparerModal extends Component { this.form = element; }; - render(): React.ReactNode { + render(): JSX.Element { const { isOpen, onClose, diff --git a/src/areaSearch/components/map/AreaSearchLayer.tsx b/src/areaSearch/components/map/AreaSearchLayer.tsx index 8752dd730..6abbb20da 100644 --- a/src/areaSearch/components/map/AreaSearchLayer.tsx +++ b/src/areaSearch/components/map/AreaSearchLayer.tsx @@ -3,10 +3,10 @@ import { withRouter } from "react-router"; import { FeatureGroup, GeoJSON, Popup } from "react-leaflet"; import flowRight from "lodash/flowRight"; import { Link } from "react-router-dom"; -import { getRouteById, Routes } from "root/routes"; +import { getRouteById, Routes } from "@/root/routes"; import type { Attributes, LeafletGeoJson } from "types"; -import { withAreaSearchAttributes } from "components/attributes/AreaSearchAttributes"; -import { formatDate, getFieldOptions, getLabelOfOption } from "util/helpers"; +import { withAreaSearchAttributes } from "@/components/attributes/AreaSearchAttributes"; +import { formatDate, getFieldOptions, getLabelOfOption } from "@/util/helpers"; type OwnProps = { color: string; areaSearchesGeoJson: LeafletGeoJson; diff --git a/src/areaSearch/components/map/AreaSearchListMap.tsx b/src/areaSearch/components/map/AreaSearchListMap.tsx index f42b479d9..f24ab6abd 100644 --- a/src/areaSearch/components/map/AreaSearchListMap.tsx +++ b/src/areaSearch/components/map/AreaSearchListMap.tsx @@ -3,19 +3,19 @@ import { connect } from "react-redux"; import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import AreaNotesEditMap from "areaNote/components/AreaNotesEditMap"; -import { DEFAULT_ZOOM, MAP_COLORS } from "util/constants"; -import { getApiResponseResults, getUrlParams } from "util/helpers"; -import { getBoundsFromBBox, getBoundsFromFeatures } from "util/map"; -import { getAreaNoteList } from "areaNote/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import AreaSearchLayer from "areaSearch/components/map/AreaSearchLayer"; -import { getAreaSearchListByBBox } from "areaSearch/selectors"; -import { getAreaSearchGeoJson } from "areaSearch/helpers"; -import { MAX_ZOOM_LEVEL_TO_FETCH_AREA_SEARCHES } from "areaSearch/constants"; +import AreaNotesEditMap from "@/areaNote/components/AreaNotesEditMap"; +import { DEFAULT_ZOOM, MAP_COLORS } from "@/util/constants"; +import { getApiResponseResults, getUrlParams } from "@/util/helpers"; +import { getBoundsFromBBox, getBoundsFromFeatures } from "@/util/map"; +import { getAreaNoteList } from "@/areaNote/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import AreaSearchLayer from "@/areaSearch/components/map/AreaSearchLayer"; +import { getAreaSearchListByBBox } from "@/areaSearch/selectors"; +import { getAreaSearchGeoJson } from "@/areaSearch/helpers"; +import { MAX_ZOOM_LEVEL_TO_FETCH_AREA_SEARCHES } from "@/areaSearch/constants"; import type { ApiResponse, LeafletGeoJson } from "types"; -import type { AreaNoteList } from "areaNote/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import type { AreaNoteList } from "@/areaNote/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; const getMapBounds = () => { const { diff --git a/src/areaSearch/components/map/AreaSearchMap.tsx b/src/areaSearch/components/map/AreaSearchMap.tsx index a98106061..381a4bfc0 100644 --- a/src/areaSearch/components/map/AreaSearchMap.tsx +++ b/src/areaSearch/components/map/AreaSearchMap.tsx @@ -1,11 +1,15 @@ import React, { Component } from "react"; import { FeatureGroup } from "react-leaflet"; import { EditControl } from "react-leaflet-draw"; +// This is a hack to get react-leaflet-draw, the issue and solution described at: +// https://github.com/Leaflet/Leaflet.draw/issues/1026#issuecomment-986702652 +// @ts-ignore +window.type = true; import throttle from "lodash/throttle"; import classNames from "classnames"; -import MapContainer from "areaNote/components/MapContainer"; -import { DEFAULT_CENTER, DEFAULT_ZOOM } from "util/constants"; -import { convertFeatureCollectionToFeature } from "areaNote/helpers"; +import MapContainer from "@/areaNote/components/MapContainer"; +import { DEFAULT_CENTER, DEFAULT_ZOOM } from "@/util/constants"; +import { convertFeatureCollectionToFeature } from "@/areaNote/helpers"; const SHAPE_COLOR = '#9c27b0'; const SHAPE_FILL_OPACITY = 0.5; const SHAPE_ERROR_COLOR = '#bd2719'; @@ -64,7 +68,7 @@ class AreaSearchMap extends Component { change(convertFeatureCollectionToFeature(features).geometry); }; - render(): React.ReactNode { + render(): JSX.Element { const { hasError } = this.props; diff --git a/src/areaSearch/components/map/SingleAreaSearchMap.tsx b/src/areaSearch/components/map/SingleAreaSearchMap.tsx index ed56749c5..f6e8a1867 100644 --- a/src/areaSearch/components/map/SingleAreaSearchMap.tsx +++ b/src/areaSearch/components/map/SingleAreaSearchMap.tsx @@ -1,11 +1,11 @@ import React, { Component } from "react"; import { FeatureGroup, GeoJSON } from "react-leaflet"; import classNames from "classnames"; -import { DEFAULT_CENTER, DEFAULT_ZOOM } from "util/constants"; -import MapContainer from "areaNote/components/MapContainer"; -import { getBoundsFromFeatures, getCenterFromCoordinates, getCoordinatesOfGeometry } from "util/map"; +import { DEFAULT_CENTER, DEFAULT_ZOOM } from "@/util/constants"; +import MapContainer from "@/areaNote/components/MapContainer"; +import { getBoundsFromFeatures, getCenterFromCoordinates, getCoordinatesOfGeometry } from "@/util/map"; import type { LeafletFeatureGeometry } from "types"; -import { getAreaSearchFeatures } from "areaSearch/helpers"; +import { getAreaSearchFeatures } from "@/areaSearch/helpers"; type Props = { geometry: LeafletFeatureGeometry; minimap?: boolean; @@ -55,7 +55,7 @@ class SingleAreaSearchMap extends Component { this.initialize(); }; - render(): React.ReactNode { + render(): JSX.Element { const { geometry, minimap = false diff --git a/src/areaSearch/components/search/Search.tsx b/src/areaSearch/components/search/Search.tsx index fd637ca38..a4b748057 100644 --- a/src/areaSearch/components/search/Search.tsx +++ b/src/areaSearch/components/search/Search.tsx @@ -7,21 +7,21 @@ import debounce from "lodash/debounce"; import flowRight from "lodash/flowRight"; import isEqual from "lodash/isEqual"; import isEmpty from "lodash/isEmpty"; -import { getFieldOptions, getUrlParams } from "util/helpers"; -import FormField from "components/form/FormField"; -import SearchClearLink from "components/search/SearchClearLink"; -import SearchChangeTypeLink from "components/search/SearchChangeTypeLink"; -import SearchContainer from "components/search/SearchContainer"; -import SearchRow from "components/search/SearchRow"; -import SearchLabelColumn from "components/search/SearchLabelColumn"; -import SearchLabel from "components/search/SearchLabel"; -import SearchInputColumn from "components/search/SearchInputColumn"; -import { FieldTypes, FormNames } from "enums"; +import { getFieldOptions, getUrlParams } from "@/util/helpers"; +import FormField from "@/components/form/FormField"; +import SearchClearLink from "@/components/search/SearchClearLink"; +import SearchChangeTypeLink from "@/components/search/SearchChangeTypeLink"; +import SearchContainer from "@/components/search/SearchContainer"; +import SearchRow from "@/components/search/SearchRow"; +import SearchLabelColumn from "@/components/search/SearchLabelColumn"; +import SearchLabel from "@/components/search/SearchLabel"; +import SearchInputColumn from "@/components/search/SearchInputColumn"; +import { FieldTypes, FormNames } from "@/enums"; import type { ApiResponse, Attributes } from "types"; -import { getAreaSearchList, getAttributes } from "areaSearch/selectors"; -import SearchSubtitleLabel from "components/search/SearchSubtitleLabel"; -import { AreaSearchFieldPaths } from "areaSearch/enums"; -import { getIsFetching as getIsFetchingDistricts } from "district/selectors"; +import { getAreaSearchList, getAttributes } from "@/areaSearch/selectors"; +import SearchSubtitleLabel from "@/components/search/SearchSubtitleLabel"; +import { AreaSearchFieldPaths } from "@/areaSearch/enums"; +import { getIsFetching as getIsFetchingDistricts } from "@/district/selectors"; type OwnProps = { isSearchInitialized: boolean; onSearch: (...args: Array) => any; @@ -100,7 +100,6 @@ class Search extends Component { delete searchQuery.zoom; const keys = Object.keys(searchQuery); - // $FlowFixMe[method-unbinding] https://github.com/facebook/flow/issues/8689 if (!keys.length || keys.length === 1 && Object.prototype.hasOwnProperty.call(searchQuery, 'search')) { return true; } diff --git a/src/areaSearch/constants.ts b/src/areaSearch/constants.ts index f77beb893..89f1dd3b5 100644 --- a/src/areaSearch/constants.ts +++ b/src/areaSearch/constants.ts @@ -1,4 +1,4 @@ -import { TableSortOrder } from "enums"; +import { TableSortOrder } from "@/enums"; export const DEFAULT_AREA_SEARCH_STATES: Array = []; export const DEFAULT_SORT_KEY = 'identifier'; export const DEFAULT_SORT_ORDER = TableSortOrder.ASCENDING; diff --git a/src/areaSearch/helpers.ts b/src/areaSearch/helpers.ts index 0a00ac687..8010a0fd3 100644 --- a/src/areaSearch/helpers.ts +++ b/src/areaSearch/helpers.ts @@ -1,14 +1,14 @@ import isArray from "lodash/isArray"; import get from "lodash/get"; import { formValueSelector, getFormValues } from "redux-form"; -import { FormNames, TableSortOrder } from "enums"; -import { APPLICANT_MAIN_IDENTIFIERS } from "application/constants"; -import { getUserFullName } from "users/helpers"; -import { store } from "root/startApp"; -import { getCurrentAreaSearch } from "areaSearch/selectors"; -import { prepareApplicationForSubmission } from "application/helpers"; +import { FormNames, TableSortOrder } from "@/enums"; +import { APPLICANT_MAIN_IDENTIFIERS } from "@/application/constants"; +import { getUserFullName } from "@/users/helpers"; +import { store } from "@/index"; +import { getCurrentAreaSearch } from "@/areaSearch/selectors"; +import { prepareApplicationForSubmission } from "@/application/helpers"; import type { LeafletFeature, LeafletGeoJson } from "types"; -import type { SavedApplicationFormSection } from "application/types"; +import type { SavedApplicationFormSection } from "@/application/types"; export const areaSearchSearchFilters = (query: Record): Record => { const searchQuery = { ...query }; diff --git a/src/areaSearch/reducer.ts b/src/areaSearch/reducer.ts index eacd83ca9..aebf109b2 100644 --- a/src/areaSearch/reducer.ts +++ b/src/areaSearch/reducer.ts @@ -2,8 +2,8 @@ import { combineReducers } from "redux"; import type { Action } from "redux"; import { handleActions } from "redux-actions"; import type { Attributes, Methods, Reducer } from "types"; -import type { AreaSearchState, ReceiveAreaSearchEditFailedAction, ReceiveAreaSearchListAction, ReceiveCollapseStatesAction, ReceiveFormValidFlagsAction, ReceiveIsSaveClickedAction, ReceiveSingleAreaSearchAction } from "areaSearch/types"; -import type { ReceiveAttributesAction, ReceiveMethodsAction, SetAreaSearchAttachmentsAction } from "areaSearch/types"; +import type { AreaSearchState, ReceiveAreaSearchEditFailedAction, ReceiveAreaSearchListAction, ReceiveCollapseStatesAction, ReceiveFormValidFlagsAction, ReceiveIsSaveClickedAction, ReceiveSingleAreaSearchAction } from "@/areaSearch/types"; +import type { ReceiveAttributesAction, ReceiveMethodsAction, SetAreaSearchAttachmentsAction } from "@/areaSearch/types"; import type { ApiResponse } from "types"; import merge from "lodash/merge"; const attributesReducer: Reducer = handleActions({ diff --git a/src/areaSearch/requests.ts b/src/areaSearch/requests.ts index e3aa3325f..746330430 100644 --- a/src/areaSearch/requests.ts +++ b/src/areaSearch/requests.ts @@ -1,6 +1,6 @@ -import callApi from "api/callApi"; -import createUrl from "api/createUrl"; -import callUploadRequest from "api/callUploadRequest"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; +import callUploadRequest from "@/api/callUploadRequest"; export const fetchAreaSearchListAttributesRequest = (): Generator => { return callApi(new Request(createUrl('area_search/'), { method: 'OPTIONS' diff --git a/src/areaSearch/saga.ts b/src/areaSearch/saga.ts index edd64d2c7..6e0ce5700 100644 --- a/src/areaSearch/saga.ts +++ b/src/areaSearch/saga.ts @@ -1,14 +1,14 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; -import { receiveError } from "api/actions"; -import { receiveAttributes, receiveMethods, attributesNotFound, receiveAreaSearchList, areaSearchesNotFound, areaSearchesByBBoxNotFound, receiveAreaSearchByBBoxList, receiveSingleAreaSearch, singleAreaSearchNotFound, listAttributesNotFound, receiveListAttributes, receiveListMethods, receiveAreaSearchInfoChecksBatchEditFailure, receiveAreaSearchInfoChecksBatchEditSuccess, hideEditMode, fetchSingleAreaSearch, receiveAreaSearchEdited, receiveAreaSearchEditFailed, receiveAreaSearchSpecsCreated, receiveAreaSearchSpecsCreateFailed, receiveAreaSearchApplicationCreated, receiveAreaSearchApplicationCreateFailed, receiveFileOperationFailed, receiveFileOperationFinished } from "areaSearch/actions"; -import { editSingleAreaSearchRequest, fetchAreaSearchAttributesRequest, fetchAreaSearchesRequest, fetchAreaSearchListAttributesRequest, fetchSingleAreaSearchRequest, createAreaSearchSpecsRequest, deleteAreaSearchAttachmentRequest, uploadAreaSearchAttachmentRequest } from "areaSearch/requests"; -import { editApplicantInfoCheckItemRequest } from "plotApplications/requests"; -import { receiveUpdatedApplicantInfoCheckItem } from "application/actions"; -import { displayUIMessage } from "util/helpers"; +import { receiveError } from "@/api/actions"; +import { receiveAttributes, receiveMethods, attributesNotFound, receiveAreaSearchList, areaSearchesNotFound, areaSearchesByBBoxNotFound, receiveAreaSearchByBBoxList, receiveSingleAreaSearch, singleAreaSearchNotFound, listAttributesNotFound, receiveListAttributes, receiveListMethods, receiveAreaSearchInfoChecksBatchEditFailure, receiveAreaSearchInfoChecksBatchEditSuccess, hideEditMode, fetchSingleAreaSearch, receiveAreaSearchEdited, receiveAreaSearchEditFailed, receiveAreaSearchSpecsCreated, receiveAreaSearchSpecsCreateFailed, receiveAreaSearchApplicationCreated, receiveAreaSearchApplicationCreateFailed, receiveFileOperationFailed, receiveFileOperationFinished } from "@/areaSearch/actions"; +import { editSingleAreaSearchRequest, fetchAreaSearchAttributesRequest, fetchAreaSearchesRequest, fetchAreaSearchListAttributesRequest, fetchSingleAreaSearchRequest, createAreaSearchSpecsRequest, deleteAreaSearchAttachmentRequest, uploadAreaSearchAttachmentRequest } from "@/areaSearch/requests"; +import { editApplicantInfoCheckItemRequest } from "@/plotApplications/requests"; +import { receiveUpdatedApplicantInfoCheckItem } from "@/application/actions"; +import { displayUIMessage } from "@/util/helpers"; import { push } from "react-router-redux"; -import { getRouteById, Routes } from "root/routes"; -import { createApplicationRequest } from "application/requests"; -import type { DeleteAreaSearchAttachmentAction, UploadAreaSearchAttachmentAction } from "areaSearch/types"; +import { getRouteById, Routes } from "@/root/routes"; +import { createApplicationRequest } from "@/application/requests"; +import type { DeleteAreaSearchAttachmentAction, UploadAreaSearchAttachmentAction } from "@/areaSearch/types"; function* fetchListAttributesSaga(): Generator { try { diff --git a/src/areaSearch/selectors.ts b/src/areaSearch/selectors.ts index 7643a233c..fccc3d08a 100644 --- a/src/areaSearch/selectors.ts +++ b/src/areaSearch/selectors.ts @@ -1,6 +1,6 @@ import get from "lodash/get"; import type { ApiResponse, Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; export const getAttributes: Selector = (state: RootState): Attributes => state.areaSearch.attributes; export const getMethods: Selector = (state: RootState): Methods => state.areaSearch.methods; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.areaSearch.isFetchingAttributes; diff --git a/src/areaSearch/types.ts b/src/areaSearch/types.ts index 836573484..bad25af4f 100644 --- a/src/areaSearch/types.ts +++ b/src/areaSearch/types.ts @@ -1,5 +1,5 @@ import type { Action, ApiResponse, Attributes, Methods, User } from "types"; -import type { UploadedFileMeta } from "application/types"; +import type { UploadedFileMeta } from "@/application/types"; export type AreaSearchState = { attributes: Attributes; methods: Methods; diff --git a/src/auditLog/actions.ts b/src/auditLog/actions.ts index 5415976a9..8ce38b6ff 100644 --- a/src/auditLog/actions.ts +++ b/src/auditLog/actions.ts @@ -1,8 +1,8 @@ import { createAction } from "redux-actions"; -import type { ContactId } from "contacts/types"; -import type { LeaseId } from "leases/types"; -import type { AreaSearchId } from "areaSearch/types"; -import type { AuditLogListMap, FetchAuditLogByContactAction, ReceiveAuditLogByContactAction, NotFoundByContactAction, FetchAuditLogByLeaseAction, ReceiveAuditLogByLeaseAction, NotFoundByLeaseAction, FetchAuditLogByAreaSearchAction, ReceiveAuditLogByAreaSearchAction, NotFoundByAreaSearchAction } from "auditLog/types"; +import type { ContactId } from "@/contacts/types"; +import type { LeaseId } from "@/leases/types"; +import type { AreaSearchId } from "@/areaSearch/types"; +import type { AuditLogListMap, FetchAuditLogByContactAction, ReceiveAuditLogByContactAction, NotFoundByContactAction, FetchAuditLogByLeaseAction, ReceiveAuditLogByLeaseAction, NotFoundByLeaseAction, FetchAuditLogByAreaSearchAction, ReceiveAuditLogByAreaSearchAction, NotFoundByAreaSearchAction } from "@/auditLog/types"; export const fetchAuditLogByContact = (contactId: ContactId): FetchAuditLogByContactAction => createAction('mvj/auditLog/FETCH_BY_CONTACT')(contactId); export const receiveAuditLogByContact = (payload: AuditLogListMap): ReceiveAuditLogByContactAction => createAction('mvj/auditLog/RECEIVE_BY_CONTACT')(payload); export const notFoundByContact = (contactId: ContactId): NotFoundByContactAction => createAction('mvj/auditLog/NOT_FOUND_BY_CONTACT')(contactId); diff --git a/src/auditLog/spec.ts b/src/auditLog/auditlog.spec.ts similarity index 98% rename from src/auditLog/spec.ts rename to src/auditLog/auditlog.spec.ts index 093b9cdec..aef8dc904 100644 --- a/src/auditLog/spec.ts +++ b/src/auditLog/auditlog.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAuditLogByContact, receiveAuditLogByContact, notFoundByContact, fetchAuditLogByLease, receiveAuditLogByLease, notFoundByLease } from "./actions"; import auditLogReducer from "./reducer"; import type { AuditLogState } from "./types"; diff --git a/src/auditLog/helpers.ts b/src/auditLog/helpers.ts index cf164fda7..f87e3f63a 100644 --- a/src/auditLog/helpers.ts +++ b/src/auditLog/helpers.ts @@ -1,8 +1,8 @@ import get from "lodash/get"; -import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeaseDecisionsFieldPaths, InfillDevelopmentCompensationLeaseIntendedUsesFieldPaths } from "infillDevelopment/enums"; -import { InvoicePaymentsFieldPaths, InvoiceRowsFieldPaths } from "invoices/enums"; -import { LeaseAreasFieldPaths, LeaseAreaAddressesFieldPaths, LeaseBasisOfRentsFieldPaths, LeaseContractsFieldPaths, LeaseContractChangesFieldPaths, LeaseContractCollateralsFieldPaths, LeaseConstructabilityDescriptionsFieldPaths, LeaseDecisionsFieldPaths, LeaseDecisionConditionsFieldPaths, LeaseInspectionsFieldPaths, LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths, LeaseRentsFieldPaths, LeaseRentContractRentsFieldPaths, LeaseRentDueDatesFieldPaths, LeaseRentFixedInitialYearRentsFieldPaths, LeaseRentAdjustmentsFieldPaths, LeaseTenantsFieldPaths, LeaseTenantContactSetFieldPaths } from "leases/enums"; -import { getFieldAttributes } from "util/helpers"; +import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeaseDecisionsFieldPaths, InfillDevelopmentCompensationLeaseIntendedUsesFieldPaths } from "@/infillDevelopment/enums"; +import { InvoicePaymentsFieldPaths, InvoiceRowsFieldPaths } from "@/invoices/enums"; +import { LeaseAreasFieldPaths, LeaseAreaAddressesFieldPaths, LeaseBasisOfRentsFieldPaths, LeaseContractsFieldPaths, LeaseContractChangesFieldPaths, LeaseContractCollateralsFieldPaths, LeaseConstructabilityDescriptionsFieldPaths, LeaseDecisionsFieldPaths, LeaseDecisionConditionsFieldPaths, LeaseInspectionsFieldPaths, LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths, LeaseRentsFieldPaths, LeaseRentContractRentsFieldPaths, LeaseRentDueDatesFieldPaths, LeaseRentFixedInitialYearRentsFieldPaths, LeaseRentAdjustmentsFieldPaths, LeaseTenantsFieldPaths, LeaseTenantContactSetFieldPaths } from "@/leases/enums"; +import { getFieldAttributes } from "@/util/helpers"; import type { Attributes } from "types"; /** diff --git a/src/auditLog/reducer.ts b/src/auditLog/reducer.ts index 6dedc82c5..dda81f467 100644 --- a/src/auditLog/reducer.ts +++ b/src/auditLog/reducer.ts @@ -1,7 +1,7 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import type { Reducer } from "types"; -import type { AuditLogListMap, AuditLogIsFetchingMap, FetchAuditLogByContactAction, ReceiveAuditLogByContactAction, NotFoundByContactAction, FetchAuditLogByLeaseAction, ReceiveAuditLogByLeaseAction, NotFoundByLeaseAction, FetchAuditLogByAreaSearchAction, NotFoundByAreaSearchAction, ReceiveAuditLogByAreaSearchAction } from "auditLog/types"; +import type { AuditLogListMap, AuditLogIsFetchingMap, FetchAuditLogByContactAction, ReceiveAuditLogByContactAction, NotFoundByContactAction, FetchAuditLogByLeaseAction, ReceiveAuditLogByLeaseAction, NotFoundByLeaseAction, FetchAuditLogByAreaSearchAction, NotFoundByAreaSearchAction, ReceiveAuditLogByAreaSearchAction } from "@/auditLog/types"; const isFetchingByContactReducer: Reducer = handleActions({ ['mvj/auditLog/FETCH_BY_CONTACT']: (state: AuditLogIsFetchingMap, { payload: contactId diff --git a/src/auditLog/requests.ts b/src/auditLog/requests.ts index 250e8e2b4..aa9333c43 100644 --- a/src/auditLog/requests.ts +++ b/src/auditLog/requests.ts @@ -1,5 +1,5 @@ -import callApi from "api/callApi"; -import createUrl from "api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; export const fetchAuditLog = (params: Record): Generator => { return callApi(new Request(createUrl('auditlog/', params))); }; \ No newline at end of file diff --git a/src/auditLog/saga.ts b/src/auditLog/saga.ts index 6d5d9c81e..0e3be8de3 100644 --- a/src/auditLog/saga.ts +++ b/src/auditLog/saga.ts @@ -1,5 +1,5 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { receiveAuditLogByContact, notFoundByContact, receiveAuditLogByLease, notFoundByLease, receiveAuditLogByAreaSearch, notFoundByAreaSearch } from "./actions"; import { fetchAuditLog } from "./requests"; diff --git a/src/auditLog/selectors.ts b/src/auditLog/selectors.ts index e6f89b4c8..f8c020a37 100644 --- a/src/auditLog/selectors.ts +++ b/src/auditLog/selectors.ts @@ -1,4 +1,4 @@ -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { Selector } from "types"; export const getIsFetchingByContact: Selector = (state: RootState, contactId: string): boolean => state.auditLog.isFetchingByContact[contactId]; export const getAuditLogByContact: Selector = (state: RootState, contactId: string): boolean => state.auditLog.byContact[contactId]; diff --git a/src/auditLog/types.ts b/src/auditLog/types.ts index 22fae8f6e..3e20fa5a2 100644 --- a/src/auditLog/types.ts +++ b/src/auditLog/types.ts @@ -1,7 +1,7 @@ -import type { Action } from "../types"; -import type { ContactId } from "contacts/types"; -import type { LeaseId } from "leases/types"; -import type { AreaSearchId } from "areaSearch/types"; +import type { Action } from "@/types"; +import type { ContactId } from "@/contacts/types"; +import type { LeaseId } from "@/leases/types"; +import type { AreaSearchId } from "@/areaSearch/types"; export type AuditLogState = { byContact: AuditLogListMap; byLease: AuditLogListMap; diff --git a/src/auth/spec.ts b/src/auth/auth.spec.ts similarity index 97% rename from src/auth/spec.ts rename to src/auth/auth.spec.ts index 73abaf513..b40b9ce6c 100644 --- a/src/auth/spec.ts +++ b/src/auth/auth.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { clearApiToken, fetchApiToken, receiveApiToken, tokenNotFound } from "./actions"; import authReducer from "./reducer"; describe('Auth', () => { diff --git a/src/auth/components/CallbackPage.tsx b/src/auth/components/CallbackPage.tsx index 6294d279f..effcbba87 100644 --- a/src/auth/components/CallbackPage.tsx +++ b/src/auth/components/CallbackPage.tsx @@ -1,14 +1,14 @@ import React, { PureComponent } from "react"; import { withRouter } from "react-router"; import { CallbackComponent, CallbackComponentProps } from "redux-oidc"; -import { getRedirectUrlFromSessionStorage } from "util/storage"; -import userManager from "auth/util/user-manager"; -import { getRouteById, Routes } from "root/routes"; +import { getRedirectUrlFromSessionStorage } from "@/util/storage"; +import userManager from "@/auth/util/user-manager"; +import { getRouteById, Routes } from "@/root/routes"; type Props = { history: Record; }; -const CallbackComponentWithChildren = ({ children, ...rest }: CallbackComponentProps & { children: React.ReactNode }): React.ReactNode => { +const CallbackComponentWithChildren = ({ children, ...rest }: CallbackComponentProps & { children: JSX.Element }): JSX.Element => { return {children} ; diff --git a/src/auth/reducer.ts b/src/auth/reducer.ts index 38326648f..d5de7ff98 100644 --- a/src/auth/reducer.ts +++ b/src/auth/reducer.ts @@ -1,6 +1,6 @@ import { handleActions } from "redux-actions"; import { combineReducers } from "redux"; -import type { Reducer } from "../types"; +import type { Reducer } from "@/types"; import type { ReceiveApiTokenAction } from "./types"; const isFetchingReducer: Reducer = handleActions({ 'mvj/auth/FETCH_API_TOKEN': () => true, diff --git a/src/auth/saga.ts b/src/auth/saga.ts index 3648817f5..9d728b631 100644 --- a/src/auth/saga.ts +++ b/src/auth/saga.ts @@ -1,14 +1,14 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { tokenNotFound, receiveApiToken } from "./actions"; -import { getEpochTime } from "util/helpers"; -import userManager from "../auth/util/user-manager"; +import { getEpochTime } from "@/util/helpers"; +import userManager from "@/auth/util/user-manager"; function* fetchApiTokenSaga({ payload: token, type: any }): Generator { try { - const request = new Request(process.env.OPENID_CONNECT_API_TOKEN_URL || 'https://api.hel.fi/sso/api-tokens/', { + const request = new Request(import.meta.env.VITE_OPENID_CONNECT_API_TOKEN_URL || 'https://api.hel.fi/sso/api-tokens/', { headers: { 'Authorization': `Bearer ${token}` } diff --git a/src/auth/selectors.ts b/src/auth/selectors.ts index 1fe022bd7..b4d7ed563 100644 --- a/src/auth/selectors.ts +++ b/src/auth/selectors.ts @@ -1,7 +1,7 @@ -import type { Selector } from "../types"; +import type { Selector } from "@/types"; import type { ApiToken, AuthState } from "./types"; // Helper functions to select state -export const getApiToken: Selector = (state: Record): AuthState => state.auth.apiToken[process.env.OPENID_CONNECT_API_TOKEN_KEY || 'https://api.hel.fi/auth/mvj']; +export const getApiToken: Selector = (state: Record): AuthState => state.auth.apiToken[import.meta.env.VITE_OPENID_CONNECT_API_TOKEN_KEY || 'https://api.hel.fi/auth/mvj']; export const getApiTokenExpires: Selector = (state: Record): AuthState => state.auth.apiToken['expires_at']; export const getIsFetching: Selector = (state: Record): AuthState => state.auth.isFetching; export const getLoggedInUser: Selector, void> = (state: Record): Record => state.oidc.user; \ No newline at end of file diff --git a/src/auth/types.ts b/src/auth/types.ts index 1884afa20..161cacc49 100644 --- a/src/auth/types.ts +++ b/src/auth/types.ts @@ -1,4 +1,4 @@ -import type { Action } from "../types"; +import type { Action } from "@/types"; export type ApiToken = Record | null; export type AuthState = Record | null; export type FetchApiTokenAction = Action; diff --git a/src/auth/util/user-manager.ts b/src/auth/util/user-manager.ts index 8613fbf20..2c8275712 100644 --- a/src/auth/util/user-manager.ts +++ b/src/auth/util/user-manager.ts @@ -3,14 +3,14 @@ // TODO: migrate to oidc-client-ts, because oidc-client is not maintained anymore import { Global, Log, UserManager, WebStorageStateStore } from "oidc-client"; const userManagerConfig = { - authority: process.env.OPENID_CONNECT_AUTHORITY_URL || 'https://api.hel.fi/sso/openid/', + authority: import.meta.env.VITE_OPENID_CONNECT_AUTHORITY_URL || 'https://api.hel.fi/sso/openid/', automaticSilentRenew: true, - client_id: process.env.OPENID_CONNECT_CLIENT_ID || '', + client_id: import.meta.env.VITE_OPENID_CONNECT_CLIENT_ID || '', filterProtocolClaims: true, loadUserInfo: true, redirect_uri: `${location.origin}/callback`, response_type: 'id_token token', - scope: process.env.OPENID_CONNECT_SCOPE || 'openid profile https://api.hel.fi/auth/mvj', + scope: import.meta.env.VITE_OPENID_CONNECT_SCOPE || 'openid profile https://api.hel.fi/auth/mvj', silent_redirect_uri: `${location.origin}/silent_renew.html`, userStore: new WebStorageStateStore({ store: Global.localStorage diff --git a/src/basisOfRentCalculator/components/BasisOfRentCalculatorForm.tsx b/src/basisOfRentCalculator/components/BasisOfRentCalculatorForm.tsx index 32eb7fcad..06d5cc4f9 100644 --- a/src/basisOfRentCalculator/components/BasisOfRentCalculatorForm.tsx +++ b/src/basisOfRentCalculator/components/BasisOfRentCalculatorForm.tsx @@ -2,12 +2,12 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import { FieldArray, formValueSelector, reduxForm } from "redux-form"; import flowRight from "lodash/flowRight"; -import BasisOfRentsEdit from "leases/components/leaseSections/rent/BasisOfRentsEdit"; -import Divider from "components/content/Divider"; -import Title from "components/content/Title"; -import { FormNames } from "enums"; -import { LeaseBasisOfRentsFieldPaths, LeaseBasisOfRentsFieldTitles } from "leases/enums"; -import { getUiDataLeaseKey } from "uiData/helpers"; +import BasisOfRentsEdit from "@/leases/components/leaseSections/rent/BasisOfRentsEdit"; +import Divider from "@/components/content/Divider"; +import Title from "@/components/content/Title"; +import { FormNames } from "@/enums"; +import { LeaseBasisOfRentsFieldPaths, LeaseBasisOfRentsFieldTitles } from "@/leases/enums"; +import { getUiDataLeaseKey } from "@/uiData/helpers"; type Props = { basisOfRents: Array>; }; diff --git a/src/basisOfRentCalculator/components/BasisOfRentCalculatorPage.tsx b/src/basisOfRentCalculator/components/BasisOfRentCalculatorPage.tsx index 6d2e06115..e69b87ec2 100644 --- a/src/basisOfRentCalculator/components/BasisOfRentCalculatorPage.tsx +++ b/src/basisOfRentCalculator/components/BasisOfRentCalculatorPage.tsx @@ -1,19 +1,19 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import AuthorizationError from "components/authorization/AuthorizationError"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; import BasisOfRentCalculatorForm from "./BasisOfRentCalculatorForm"; -import ContentContainer from "components/content/ContentContainer"; -import Loader from "components/loader/Loader"; -import PageContainer from "components/content/PageContainer"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { PermissionMissingTexts } from "enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { hasPermissions, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import { withLeaseAttributes } from "components/attributes/LeaseAttributes"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import ContentContainer from "@/components/content/ContentContainer"; +import Loader from "@/components/loader/Loader"; +import PageContainer from "@/components/content/PageContainer"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { PermissionMissingTexts } from "@/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { hasPermissions, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import { withLeaseAttributes } from "@/components/attributes/LeaseAttributes"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { isFetchingLeaseAttributes: boolean; isFetchingUsersPermissions: boolean; diff --git a/src/batchrun/actions.ts b/src/batchrun/actions.ts index d22142eaa..fb3440cfa 100644 --- a/src/batchrun/actions.ts +++ b/src/batchrun/actions.ts @@ -1,6 +1,6 @@ import { createAction } from "redux-actions"; import type { Attributes, Methods } from "types"; -import type { FetchJobRunAttributesAction, ReceiveJobRunAttributesAction, ReceiveJobRunMethodsAction, NotFoundJobRunAttributesAction, FetchJobRunLogEntryAttributesAction, ReceiveJobRunLogEntryAttributesAction, ReceiveJobRunLogEntryMethodsAction, NotFoundJobRunLogEntryAttributesAction, FetchScheduledJobAttributesAction, ReceiveScheduledJobAttributesAction, ReceiveScheduledJobMethodsAction, NotFoundScheduledJobAttributesAction, FetchJobRunsAction, ReceiveJobRunsAction, NotFoundJobRunsAction, FetchJobRunLogEntriesByRunAction, ReceiveJobRunLogEntriesByRunAction, NotFoundJobRunLogEntriesByRunAction, FetchScheduledJobsAction, ReceiveScheduledJobsAction, NotFoundScheduledJobsAction } from "batchrun/types"; +import type { FetchJobRunAttributesAction, ReceiveJobRunAttributesAction, ReceiveJobRunMethodsAction, NotFoundJobRunAttributesAction, FetchJobRunLogEntryAttributesAction, ReceiveJobRunLogEntryAttributesAction, ReceiveJobRunLogEntryMethodsAction, NotFoundJobRunLogEntryAttributesAction, FetchScheduledJobAttributesAction, ReceiveScheduledJobAttributesAction, ReceiveScheduledJobMethodsAction, NotFoundScheduledJobAttributesAction, FetchJobRunsAction, ReceiveJobRunsAction, NotFoundJobRunsAction, FetchJobRunLogEntriesByRunAction, ReceiveJobRunLogEntriesByRunAction, NotFoundJobRunLogEntriesByRunAction, FetchScheduledJobsAction, ReceiveScheduledJobsAction, NotFoundScheduledJobsAction } from "@/batchrun/types"; export const fetchJobRunAttributes = (): FetchJobRunAttributesAction => createAction('mvj/batchrun/FETCH_JOB_RUN_ATTRIBUTES')(); export const receiveJobRunAttributes = (attributes: Attributes): ReceiveJobRunAttributesAction => createAction('mvj/batchrun/RECEIVE_JOB_RUN_ATTRIBUTES')(attributes); export const receiveJobRunMethods = (methods: Methods): ReceiveJobRunMethodsAction => createAction('mvj/batchrun/RECEIVE_JOB_RUN_METHODS')(methods); diff --git a/src/batchrun/spec.ts b/src/batchrun/batchrun.spec.ts similarity index 99% rename from src/batchrun/spec.ts rename to src/batchrun/batchrun.spec.ts index 419ca7ff7..4b74fbd4e 100644 --- a/src/batchrun/spec.ts +++ b/src/batchrun/batchrun.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchJobRunAttributes, notFoundJobRunAttributes, receiveJobRunAttributes, receiveJobRunMethods, fetchJobRunLogEntryAttributes, notFoundJobRunLogEntryAttributes, receiveJobRunLogEntryAttributes, receiveJobRunLogEntryMethods, fetchScheduledJobAttributes, notFoundScheduledJobAttributes, receiveScheduledJobAttributes, receiveScheduledJobMethods, fetchJobRuns, receiveJobRuns, notFoundJobRuns, fetchJobRunLogEntriesByRun, receiveJobRunLogEntriesByRun, notFoundJobRunLogEntriesByRun, fetchScheduledJobs, receiveScheduledJobs, notFoundScheduledJobs } from "./actions"; import batchrunReducer from "./reducer"; import type { BatchRunState } from "./types"; diff --git a/src/batchrun/components/BatchRunPage.tsx b/src/batchrun/components/BatchRunPage.tsx index 361128bf5..5ce0ee9e9 100644 --- a/src/batchrun/components/BatchRunPage.tsx +++ b/src/batchrun/components/BatchRunPage.tsx @@ -3,26 +3,26 @@ import { connect } from "react-redux"; import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import ContentContainer from "components/content/ContentContainer"; -import Divider from "components/content/Divider"; -import FullWidthContainer from "components/content/FullWidthContainer"; -import PageContainer from "components/content/PageContainer"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; -import JobRuns from "batchrun/components/JobRuns"; -import Loader from "components/loader/Loader"; -import ScheduledJobs from "batchrun/components/ScheduledJobs"; -import Tabs from "components/tabs/Tabs"; -import TabContent from "components/tabs/TabContent"; -import TabPane from "components/tabs/TabPane"; -import Title from "components/content/Title"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { PermissionMissingTexts } from "enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getSearchQuery, getUrlParams, hasPermissions, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import ContentContainer from "@/components/content/ContentContainer"; +import Divider from "@/components/content/Divider"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; +import PageContainer from "@/components/content/PageContainer"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; +import JobRuns from "@/batchrun/components/JobRuns"; +import Loader from "@/components/loader/Loader"; +import ScheduledJobs from "@/batchrun/components/ScheduledJobs"; +import Tabs from "@/components/tabs/Tabs"; +import TabContent from "@/components/tabs/TabContent"; +import TabPane from "@/components/tabs/TabPane"; +import Title from "@/components/content/Title"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { PermissionMissingTexts } from "@/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getSearchQuery, getUrlParams, hasPermissions, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { history: Record; isFetchingUsersPermissions: boolean; diff --git a/src/batchrun/components/JobRunLogEntryPanel.tsx b/src/batchrun/components/JobRunLogEntryPanel.tsx index 74af7a1a4..e6092df7e 100644 --- a/src/batchrun/components/JobRunLogEntryPanel.tsx +++ b/src/batchrun/components/JobRunLogEntryPanel.tsx @@ -1,16 +1,16 @@ import React, { Fragment, PureComponent } from "react"; import { connect } from "react-redux"; import isEmpty from "lodash/isEmpty"; -import CopyToClipboardButton from "components/form/CopyToClipboardButton"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import SortableTable from "components/table/SortableTable"; -import TablePanel from "components/table/TablePanel"; -import { fetchJobRunLogEntriesByRun } from "batchrun/actions"; -import { JobRunLogEntryFieldPaths, JobRunLogEntryFieldTitles } from "batchrun/enums"; -import { copyElementContentsToClipboard, displayUIMessage, formatDate, getApiResponseResults, isFieldAllowedToRead } from "util/helpers"; -import { TableSortOrder } from "enums"; -import { getIsFetchingJobRunLogEntriesByRun, getJobRunLogEntryAttributes, getJobRunLogEntriesByRun } from "batchrun/selectors"; +import CopyToClipboardButton from "@/components/form/CopyToClipboardButton"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import SortableTable from "@/components/table/SortableTable"; +import TablePanel from "@/components/table/TablePanel"; +import { fetchJobRunLogEntriesByRun } from "@/batchrun/actions"; +import { JobRunLogEntryFieldPaths, JobRunLogEntryFieldTitles } from "@/batchrun/enums"; +import { copyElementContentsToClipboard, displayUIMessage, formatDate, getApiResponseResults, isFieldAllowedToRead } from "@/util/helpers"; +import { TableSortOrder } from "@/enums"; +import { getIsFetchingJobRunLogEntriesByRun, getJobRunLogEntryAttributes, getJobRunLogEntriesByRun } from "@/batchrun/selectors"; import type { ApiResponse, Attributes } from "types"; type Props = { fetchJobRunLogEntriesByRun: (...args: Array) => any; diff --git a/src/batchrun/components/JobRuns.tsx b/src/batchrun/components/JobRuns.tsx index e265065c5..f4eff9153 100644 --- a/src/batchrun/components/JobRuns.tsx +++ b/src/batchrun/components/JobRuns.tsx @@ -3,28 +3,28 @@ import { withRouter } from "react-router"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import ErrorIcon from "components/icons/ErrorIcon"; -import GreenBox from "components/content/GreenBox"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import ErrorIcon from "@/components/icons/ErrorIcon"; +import GreenBox from "@/components/content/GreenBox"; import JobRunLogEntryPanel from "./JobRunLogEntryPanel"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import Pagination from "components/table/Pagination"; -import SortableTable from "components/table/SortableTable"; -import SuccessIcon from "components/icons/SuccessIcon"; -import TableAndPanelWrapper from "components/table/TableAndPanelWrapper"; -import { fetchJobRuns } from "batchrun/actions"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import { PermissionMissingTexts } from "enums"; -import { JobRunFieldPaths, JobRunFieldTitles, JobRunJobFieldPaths, JobRunJobFieldTitles } from "batchrun/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { formatDate, getApiResponseCount, getApiResponseMaxPage, getApiResponseResults, hasPermissions, isFieldAllowedToRead } from "util/helpers"; -import { getIsFetchingJobRuns, getJobRunAttributes, getJobRuns } from "batchrun/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import { withBatchrunJobRunTabAttributes } from "components/attributes/BatchrunJobRunsTabAttributes"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import Pagination from "@/components/table/Pagination"; +import SortableTable from "@/components/table/SortableTable"; +import SuccessIcon from "@/components/icons/SuccessIcon"; +import TableAndPanelWrapper from "@/components/table/TableAndPanelWrapper"; +import { fetchJobRuns } from "@/batchrun/actions"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import { PermissionMissingTexts } from "@/enums"; +import { JobRunFieldPaths, JobRunFieldTitles, JobRunJobFieldPaths, JobRunJobFieldTitles } from "@/batchrun/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { formatDate, getApiResponseCount, getApiResponseMaxPage, getApiResponseResults, hasPermissions, isFieldAllowedToRead } from "@/util/helpers"; +import { getIsFetchingJobRuns, getJobRunAttributes, getJobRuns } from "@/batchrun/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import { withBatchrunJobRunTabAttributes } from "@/components/attributes/BatchrunJobRunsTabAttributes"; import type { Attributes } from "types"; -import type { JobRuns as JobRunsType } from "batchrun/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import type { JobRuns as JobRunsType } from "@/batchrun/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { fetchJobRuns: (...args: Array) => any; isFetchingBatchrunJobRunsTabAttributes: boolean; diff --git a/src/batchrun/components/ScheduledJobs.tsx b/src/batchrun/components/ScheduledJobs.tsx index c9645646e..d60d93d54 100644 --- a/src/batchrun/components/ScheduledJobs.tsx +++ b/src/batchrun/components/ScheduledJobs.tsx @@ -3,23 +3,23 @@ import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; import isEmpty from "lodash/isEmpty"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import FormText from "components/form/FormText"; -import GreenBox from "components/content/GreenBox"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import SortableTable from "components/table/SortableTable"; -import { fetchScheduledJobs } from "batchrun/actions"; -import { PermissionMissingTexts } from "enums"; -import { ScheduledJobFieldPaths, ScheduledJobFieldTitles, ScheduledJobJobFieldPaths, ScheduledJobJobFieldTitles } from "batchrun/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getApiResponseResults, hasPermissions, isFieldAllowedToRead } from "util/helpers"; -import { getIsFetchingScheduledJobs, getScheduledJobs } from "batchrun/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import { withBatchrunScheduledJobTabAttributes } from "components/attributes/BatchrunScheduledJobsTabAttributes"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import FormText from "@/components/form/FormText"; +import GreenBox from "@/components/content/GreenBox"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import SortableTable from "@/components/table/SortableTable"; +import { fetchScheduledJobs } from "@/batchrun/actions"; +import { PermissionMissingTexts } from "@/enums"; +import { ScheduledJobFieldPaths, ScheduledJobFieldTitles, ScheduledJobJobFieldPaths, ScheduledJobJobFieldTitles } from "@/batchrun/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getApiResponseResults, hasPermissions, isFieldAllowedToRead } from "@/util/helpers"; +import { getIsFetchingScheduledJobs, getScheduledJobs } from "@/batchrun/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import { withBatchrunScheduledJobTabAttributes } from "@/components/attributes/BatchrunScheduledJobsTabAttributes"; import type { Attributes } from "types"; -import type { ScheduledJobs as ScheduledJobsType } from "batchrun/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import type { ScheduledJobs as ScheduledJobsType } from "@/batchrun/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { batchrunScheduledJobAttributes: Attributes; fetchScheduledJobs: (...args: Array) => any; diff --git a/src/batchrun/reducer.ts b/src/batchrun/reducer.ts index 7f90ed10a..904f09531 100644 --- a/src/batchrun/reducer.ts +++ b/src/batchrun/reducer.ts @@ -1,7 +1,7 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import type { Attributes, Methods, Reducer } from "types"; -import type { ReceiveJobRunAttributesAction, ReceiveJobRunMethodsAction, ReceiveJobRunsAction, JobRuns, ReceiveJobRunLogEntryAttributesAction, ReceiveJobRunLogEntryMethodsAction, FetchJobRunLogEntriesByRunAction, ReceiveJobRunLogEntriesByRunAction, NotFoundJobRunLogEntriesByRunAction, ReceiveScheduledJobAttributesAction, ReceiveScheduledJobMethodsAction, ReceiveScheduledJobsAction, ScheduledJobs } from "batchrun/types"; +import type { ReceiveJobRunAttributesAction, ReceiveJobRunMethodsAction, ReceiveJobRunsAction, JobRuns, ReceiveJobRunLogEntryAttributesAction, ReceiveJobRunLogEntryMethodsAction, FetchJobRunLogEntriesByRunAction, ReceiveJobRunLogEntriesByRunAction, NotFoundJobRunLogEntriesByRunAction, ReceiveScheduledJobAttributesAction, ReceiveScheduledJobMethodsAction, ReceiveScheduledJobsAction, ScheduledJobs } from "@/batchrun/types"; const isFetchingJobRunsReducer: Reducer = handleActions({ 'mvj/batchrun/FETCH_JOB_RUNS': () => true, 'mvj/batchrun/RECEIVE_JOB_RUNS': () => false, diff --git a/src/batchrun/requests.ts b/src/batchrun/requests.ts index d0153bf97..6ad0226be 100644 --- a/src/batchrun/requests.ts +++ b/src/batchrun/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; export const fetchJobRunAttributes = () => { return callApi(new Request(createUrl('job_run/'), { method: 'OPTIONS' diff --git a/src/batchrun/saga.ts b/src/batchrun/saga.ts index 13f275323..fde449a6b 100644 --- a/src/batchrun/saga.ts +++ b/src/batchrun/saga.ts @@ -1,7 +1,7 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; -import { receiveError } from "api/actions"; -import { notFoundJobRuns, notFoundJobRunAttributes, notFoundJobRunLogEntryAttributes, notFoundJobRunLogEntriesByRun, notFoundScheduledJobAttributes, notFoundScheduledJobs, receiveJobRunAttributes, receiveJobRunMethods, receiveJobRuns, receiveJobRunLogEntryAttributes, receiveJobRunLogEntryMethods, receiveJobRunLogEntriesByRun, receiveScheduledJobAttributes, receiveScheduledJobMethods, receiveScheduledJobs } from "batchrun/actions"; -import { fetchJobRunAttributes, fetchJobRuns, fetchJobRunLogEntryAttributes, fetchJobRunLogEntries, fetchScheduledJobAttributes, fetchScheduledJobs } from "batchrun/requests"; +import { receiveError } from "@/api/actions"; +import { notFoundJobRuns, notFoundJobRunAttributes, notFoundJobRunLogEntryAttributes, notFoundJobRunLogEntriesByRun, notFoundScheduledJobAttributes, notFoundScheduledJobs, receiveJobRunAttributes, receiveJobRunMethods, receiveJobRuns, receiveJobRunLogEntryAttributes, receiveJobRunLogEntryMethods, receiveJobRunLogEntriesByRun, receiveScheduledJobAttributes, receiveScheduledJobMethods, receiveScheduledJobs } from "@/batchrun/actions"; +import { fetchJobRunAttributes, fetchJobRuns, fetchJobRunLogEntryAttributes, fetchJobRunLogEntries, fetchScheduledJobAttributes, fetchScheduledJobs } from "@/batchrun/requests"; function* fetchJobRunAttributesSaga(): Generator { try { diff --git a/src/batchrun/selectors.ts b/src/batchrun/selectors.ts index 181b46eec..35da4f860 100644 --- a/src/batchrun/selectors.ts +++ b/src/batchrun/selectors.ts @@ -1,6 +1,6 @@ import type { ApiResponse, Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; -import type { JobRuns, ScheduledJobs } from "batchrun/types"; +import type { RootState } from "@/root/types"; +import type { JobRuns, ScheduledJobs } from "@/batchrun/types"; export const getIsFetchingJobRunAttributes: Selector = (state: RootState): boolean => state.batchrun.isFetchingJobRunAttributes; export const getJobRunAttributes: Selector = (state: RootState): Attributes => state.batchrun.jobRunAttributes; export const getJobRunMethods: Selector = (state: RootState): Methods => state.batchrun.jobRunMethods; diff --git a/src/billingPeriods/spec.ts b/src/billingPeriods/billingPeriods.spec.ts similarity index 97% rename from src/billingPeriods/spec.ts rename to src/billingPeriods/billingPeriods.spec.ts index e7636395e..ca30a6f38 100644 --- a/src/billingPeriods/spec.ts +++ b/src/billingPeriods/billingPeriods.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { receiveBillingPeriodsByLease, fetchBillingPeriodsByLease, notFound } from "./actions"; import billingPeriodsReducer from "./reducer"; import type { BillingPeriodState } from "./types"; diff --git a/src/billingPeriods/reducer.ts b/src/billingPeriods/reducer.ts index 13c47242a..4b3f587c2 100644 --- a/src/billingPeriods/reducer.ts +++ b/src/billingPeriods/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Reducer } from "../types"; +import type { Reducer } from "@/types"; import type { ReceiveBillingPeriodsAction } from "./types"; const isFetchingReducer: Reducer = handleActions({ 'mvj/billingperiods/FETCH_ALL': () => true, diff --git a/src/billingPeriods/requests.ts b/src/billingPeriods/requests.ts index 14ed2f954..5ddc6b71a 100644 --- a/src/billingPeriods/requests.ts +++ b/src/billingPeriods/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; import type { FetchBillingPeriodsPayload } from "./types"; export const fetchBillingPeriods = (payload: FetchBillingPeriodsPayload): Generator => { return callApi(new Request(createUrl(`lease_billing_periods/?lease=${payload.leaseId}&year=${payload.year}`))); diff --git a/src/billingPeriods/saga.ts b/src/billingPeriods/saga.ts index cc689d0e2..c5c30471b 100644 --- a/src/billingPeriods/saga.ts +++ b/src/billingPeriods/saga.ts @@ -1,7 +1,7 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { notFound, receiveBillingPeriodsByLease } from "./actions"; import { fetchBillingPeriods } from "./requests"; -import { receiveError } from "../api/actions"; +import { receiveError } from "@/api/actions"; function* fetchBillingPeriodsSaga({ payload, diff --git a/src/billingPeriods/selectors.ts b/src/billingPeriods/selectors.ts index e18ca1d28..ac944a243 100644 --- a/src/billingPeriods/selectors.ts +++ b/src/billingPeriods/selectors.ts @@ -1,6 +1,6 @@ import type { Selector } from "types"; -import type { RootState } from "root/types"; -import type { LeaseId } from "leases/types"; +import type { RootState } from "@/root/types"; +import type { LeaseId } from "@/leases/types"; export const getIsFetching: Selector = (state: RootState): boolean => state.billingPeriod.isFetching; export const getBillingPeriodsByLease: Selector, LeaseId> = (state: RootState, leaseId: LeaseId): Record => { return state.billingPeriod.byLease[leaseId]; diff --git a/src/billingPeriods/types.ts b/src/billingPeriods/types.ts index bb90acb98..b219f4f29 100644 --- a/src/billingPeriods/types.ts +++ b/src/billingPeriods/types.ts @@ -1,5 +1,5 @@ -import type { Action } from "../types"; -import type { LeaseId } from "leases/types"; +import type { Action } from "@/types"; +import type { LeaseId } from "@/leases/types"; export type BillingPeriodState = { byLease: Record; isFetching: boolean; diff --git a/src/collectionCourtDecision/actions.ts b/src/collectionCourtDecision/actions.ts index ba00411b9..be48b89db 100644 --- a/src/collectionCourtDecision/actions.ts +++ b/src/collectionCourtDecision/actions.ts @@ -1,6 +1,6 @@ import { createAction } from "redux-actions"; import type { Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; import type { FetchAttributesAction, ReceiveAttributesAction, ReceiveMethodsAction, CollectionCourtDecisionAttributesNotFoundAction, UploadCollectionCourtDecisionPayload, DeleteCollectionCourtDecisionPayload, FetchCollectionCourtDecisionsByLeaseAction, ReceiveCollectionCourtDecisionsByLeaseAction, CollectionCourtDecisionsNotFoundByLeaseAction, UploadCollectionCourtDecisionAction, DeleteCollectionCourtDecisionAction, HideCollectionCourtDecisionPanelAction, ShowCollectionCourtDecisionPanelAction } from "./types"; export const fetchAttributes = (): FetchAttributesAction => createAction('mvj/collectionCourtDecision/FETCH_ATTRIBUTES')(); export const receiveAttributes = (attributes: Attributes): ReceiveAttributesAction => createAction('mvj/collectionCourtDecision/RECEIVE_ATTRIBUTES')(attributes); diff --git a/src/collectionCourtDecision/spec.ts b/src/collectionCourtDecision/collectionCourtDecision.spec.ts similarity index 99% rename from src/collectionCourtDecision/spec.ts rename to src/collectionCourtDecision/collectionCourtDecision.spec.ts index aafb24687..bfc449b2e 100644 --- a/src/collectionCourtDecision/spec.ts +++ b/src/collectionCourtDecision/collectionCourtDecision.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, fetchCollectionCourtDecisionsByLease, receiveCollectionCourtDecisionsByLease, notFoundByLease, uploadCollectionCourtDecision, deleteCollectionCourtDecision, hideCollectionCourtDecisionPanel, showCollectionCourtDecisionPanel } from "./actions"; import collectionCourtDecisionReducer from "./reducer"; import type { CollectionCourtDecisionState } from "./types"; diff --git a/src/collectionCourtDecision/reducer.ts b/src/collectionCourtDecision/reducer.ts index deaeb4b77..824f12292 100644 --- a/src/collectionCourtDecision/reducer.ts +++ b/src/collectionCourtDecision/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Attributes, Methods, Reducer } from "../types"; +import type { Attributes, Methods, Reducer } from "@/types"; import type { ReceiveAttributesAction, ReceiveMethodsAction, FetchCollectionCourtDecisionsByLeaseAction, ReceiveCollectionCourtDecisionsByLeaseAction, CollectionCourtDecisionsNotFoundByLeaseAction } from "./types"; const isFetchingAttributesReducer: Reducer = handleActions({ 'mvj/collectionCourtDecision/FETCH_ATTRIBUTES': () => true, diff --git a/src/collectionCourtDecision/requests.ts b/src/collectionCourtDecision/requests.ts index 92df22e36..f112b8ef9 100644 --- a/src/collectionCourtDecision/requests.ts +++ b/src/collectionCourtDecision/requests.ts @@ -1,8 +1,8 @@ -import callApi from "api/callApi"; -import callUploadRequest from "api/callUploadRequest"; -import createUrl from "api/createUrl"; +import callApi from "@/api/callApi"; +import callUploadRequest from "@/api/callUploadRequest"; +import createUrl from "@/api/createUrl"; import type { CollectionCourtDecisionId, UploadCollectionCourtDecisionPayload } from "./types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl('collection_court_decision/'), { method: 'OPTIONS' diff --git a/src/collectionCourtDecision/saga.ts b/src/collectionCourtDecision/saga.ts index ed04824d7..665b8c0a3 100644 --- a/src/collectionCourtDecision/saga.ts +++ b/src/collectionCourtDecision/saga.ts @@ -1,8 +1,8 @@ import { all, call, fork, put, select, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { receiveAttributes, receiveMethods, attributesNotFound, fetchCollectionCourtDecisionsByLease as fetchCollectionCourtDecisionsByLeaseAction, hideCollectionCourtDecisionPanel, receiveCollectionCourtDecisionsByLease, notFoundByLease } from "./actions"; -import { displayUIMessage } from "../util/helpers"; +import { displayUIMessage } from "@/util/helpers"; import { fetchAttributes, fetchCollectionCourtDecisionsByLease, uploadCollectionCourtDecision, deleteCollectionCourtDecision } from "./requests"; import { getCollectionCourtDecisionsByLease } from "./selectors"; diff --git a/src/collectionCourtDecision/selectors.ts b/src/collectionCourtDecision/selectors.ts index 6ae1cb4f9..e69ff1ffd 100644 --- a/src/collectionCourtDecision/selectors.ts +++ b/src/collectionCourtDecision/selectors.ts @@ -1,6 +1,6 @@ import type { Attributes, Methods, Selector } from "types"; -import type { LeaseId } from "leases/types"; -import type { RootState } from "root/types"; +import type { LeaseId } from "@/leases/types"; +import type { RootState } from "@/root/types"; export const getAttributes: Selector = (state: RootState): Attributes => state.collectionCourtDecision.attributes; export const getMethods: Selector = (state: RootState): Methods => state.collectionCourtDecision.methods; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.collectionCourtDecision.isFetchingAttributes; diff --git a/src/collectionCourtDecision/types.ts b/src/collectionCourtDecision/types.ts index fb7cfe9df..cb3ed65c8 100644 --- a/src/collectionCourtDecision/types.ts +++ b/src/collectionCourtDecision/types.ts @@ -1,5 +1,5 @@ import type { Action, Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export type CollectionCourtDecisionState = { attributes: Attributes; byLease: Record; diff --git a/src/collectionLetter/actions.ts b/src/collectionLetter/actions.ts index cec086781..e9f74163e 100644 --- a/src/collectionLetter/actions.ts +++ b/src/collectionLetter/actions.ts @@ -1,6 +1,6 @@ import { createAction } from "redux-actions"; import type { Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; import type { FetchAttributesAction, ReceiveAttributesAction, ReceiveMethodsAction, CollectionLetterAttributesNotFoundAction, UploadCollectionLetterPayload, DeleteCollectionLetterPayload, FetchCollectionLettersByLeaseAction, ReceiveCollectionLettersByLeaseAction, CollectionLettersNotFoundByLeaseAction, UploadCollectionLetterAction, DeleteCollectionLetterAction } from "./types"; export const fetchAttributes = (): FetchAttributesAction => createAction('mvj/collectionLetter/FETCH_ATTRIBUTES')(); export const receiveAttributes = (attributes: Attributes): ReceiveAttributesAction => createAction('mvj/collectionLetter/RECEIVE_ATTRIBUTES')(attributes); diff --git a/src/collectionLetter/spec.ts b/src/collectionLetter/collectionLetter.spec.ts similarity index 98% rename from src/collectionLetter/spec.ts rename to src/collectionLetter/collectionLetter.spec.ts index 7c5551329..ecaf0a65d 100644 --- a/src/collectionLetter/spec.ts +++ b/src/collectionLetter/collectionLetter.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, fetchCollectionLettersByLease, receiveCollectionLettersByLease, notFoundByLease, uploadCollectionLetter, deleteCollectionLetter } from "./actions"; import collectionLetterReducer from "./reducer"; import type { CollectionLetterState } from "./types"; diff --git a/src/collectionLetter/requests.ts b/src/collectionLetter/requests.ts index 66fac847e..48c69f16a 100644 --- a/src/collectionLetter/requests.ts +++ b/src/collectionLetter/requests.ts @@ -1,8 +1,8 @@ -import callApi from "api/callApi"; -import callUploadRequest from "api/callUploadRequest"; -import createUrl from "api/createUrl"; +import callApi from "@/api/callApi"; +import callUploadRequest from "@/api/callUploadRequest"; +import createUrl from "@/api/createUrl"; import type { CollectionLetterId, UploadCollectionLetterPayload } from "./types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl('collection_letter/'), { method: 'OPTIONS' diff --git a/src/collectionLetter/saga.ts b/src/collectionLetter/saga.ts index 262e5f49e..7cc3c02ea 100644 --- a/src/collectionLetter/saga.ts +++ b/src/collectionLetter/saga.ts @@ -1,8 +1,8 @@ import { all, call, fork, put, select, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { attributesNotFound, receiveAttributes, receiveMethods, fetchCollectionLettersByLease as fetchCollectionLettersByLeaseAction, receiveCollectionLettersByLease, notFoundByLease } from "./actions"; -import { displayUIMessage } from "../util/helpers"; +import { displayUIMessage } from "@/util/helpers"; import { fetchAttributes, fetchCollectionLettersByLease, uploadCollectionLetter, deleteCollectionLetter } from "./requests"; import { getCollectionLettersByLease } from "./selectors"; diff --git a/src/collectionLetter/selectors.ts b/src/collectionLetter/selectors.ts index bd58f300e..857b890cb 100644 --- a/src/collectionLetter/selectors.ts +++ b/src/collectionLetter/selectors.ts @@ -1,6 +1,6 @@ import type { Attributes, Methods, Selector } from "types"; -import type { LeaseId } from "leases/types"; -import type { RootState } from "root/types"; +import type { LeaseId } from "@/leases/types"; +import type { RootState } from "@/root/types"; export const getAttributes: Selector = (state: RootState): Attributes => state.collectionLetter.attributes; export const getMethods: Selector = (state: RootState): Methods => state.collectionLetter.methods; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.collectionLetter.isFetchingAttributes; diff --git a/src/collectionLetter/types.ts b/src/collectionLetter/types.ts index dd2ec7895..85bee3b22 100644 --- a/src/collectionLetter/types.ts +++ b/src/collectionLetter/types.ts @@ -1,5 +1,5 @@ import type { Action, Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export type CollectionLetterState = { attributes: Attributes; byLease: Record; diff --git a/src/collectionNote/actions.ts b/src/collectionNote/actions.ts index d2ced8c88..7765d6408 100644 --- a/src/collectionNote/actions.ts +++ b/src/collectionNote/actions.ts @@ -1,7 +1,7 @@ import { createAction } from "redux-actions"; import type { Attributes, Methods } from "types"; import type { FetchAttributesAction, ReceiveAttributesAction, ReceiveMethodsAction, CollectionNoteAttributesNotFoundAction, CreateCollectionNotePayload, DeleteCollectionNotePayload, FetchCollectionNotesByLeaseAction, ReceiveCollectionNotesByLeaseAction, CollectionNotesNotFoundByLeaseAction, CreateCollectionNoteAction, DeleteCollectionNoteAction } from "./types"; -import type { LeaseId } from "../leases/types"; +import type { LeaseId } from "@/leases/types"; export const fetchAttributes = (): FetchAttributesAction => createAction('mvj/collectionNote/FETCH_ATTRIBUTES')(); export const receiveAttributes = (attributes: Attributes): ReceiveAttributesAction => createAction('mvj/collectionNote/RECEIVE_ATTRIBUTES')(attributes); export const receiveMethods = (methods: Methods): ReceiveMethodsAction => createAction('mvj/collectionNote/RECEIVE_METHODS')(methods); diff --git a/src/collectionNote/spec.ts b/src/collectionNote/collectionNote.spec.ts similarity index 98% rename from src/collectionNote/spec.ts rename to src/collectionNote/collectionNote.spec.ts index 0f858c1d0..711c43a22 100644 --- a/src/collectionNote/spec.ts +++ b/src/collectionNote/collectionNote.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, fetchCollectionNotesByLease, receiveCollectionNotesByLease, notFoundByLease, createCollectionNote, deleteCollectionNote } from "./actions"; import collectionNoteReducer from "./reducer"; import type { CollectionNoteState } from "./types"; diff --git a/src/collectionNote/requests.ts b/src/collectionNote/requests.ts index 9eccb874c..d139fd417 100644 --- a/src/collectionNote/requests.ts +++ b/src/collectionNote/requests.ts @@ -1,7 +1,7 @@ -import callApi from "api/callApi"; -import createUrl from "api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; import type { CollectionNoteId } from "./types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl('collection_note/'), { method: 'OPTIONS' diff --git a/src/collectionNote/saga.ts b/src/collectionNote/saga.ts index 476b731e7..afbdf38bb 100644 --- a/src/collectionNote/saga.ts +++ b/src/collectionNote/saga.ts @@ -1,8 +1,8 @@ import { all, call, fork, put, select, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { receiveAttributes, receiveMethods, attributesNotFound, fetchCollectionNotesByLease as fetchCollectionNotesByLeaseAction, receiveCollectionNotesByLease, notFoundByLease } from "./actions"; -import { displayUIMessage } from "util/helpers"; +import { displayUIMessage } from "@/util/helpers"; import { fetchAttributes, fetchCollectionNotesByLease, createCollectionNote, deleteCollectionNote } from "./requests"; import { getCollectionNotesByLease } from "./selectors"; diff --git a/src/collectionNote/selectors.ts b/src/collectionNote/selectors.ts index a0f7f56f3..e9c7f4b4d 100644 --- a/src/collectionNote/selectors.ts +++ b/src/collectionNote/selectors.ts @@ -1,6 +1,6 @@ -import type { Attributes, Methods, Selector } from "../types"; -import type { LeaseId } from "leases/types"; -import type { RootState } from "root/types"; +import type { Attributes, Methods, Selector } from "@/types"; +import type { LeaseId } from "@/leases/types"; +import type { RootState } from "@/root/types"; export const getAttributes: Selector = (state: RootState): Attributes => state.collectionNote.attributes; export const getMethods: Selector = (state: RootState): Methods => state.collectionNote.methods; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.collectionNote.isFetchingAttributes; diff --git a/src/collectionNote/types.ts b/src/collectionNote/types.ts index 69b67a025..c5db47d0a 100644 --- a/src/collectionNote/types.ts +++ b/src/collectionNote/types.ts @@ -1,5 +1,5 @@ import type { Action, Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export type CollectionNoteId = number; export type CollectionNoteState = { attributes: Attributes; diff --git a/src/comments/actions.ts b/src/comments/actions.ts index bce5ad53f..b4f7d1d6a 100644 --- a/src/comments/actions.ts +++ b/src/comments/actions.ts @@ -1,6 +1,6 @@ import { createAction } from "redux-actions"; import type { Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; import type { Comment, CommentId, FetchAttributesAction, ReceiveAttributesAction, ReceiveMethodsAction, FetchCommentsByLeaseAction, CreateCommentAction, EditCommentAction, ReceiveCommentsByLeaseAction, CommentAttributesNotFoundAction, CommentNotFoundAction, ClearEditFlagsAction, HideEditModeByIdAction, ShowEditModeByIdAction, ReceiveIsSaveClickedAction } from "./types"; export const attributesNotFound = (): CommentAttributesNotFoundAction => createAction('mvj/comments/ATTRIBUTES_NOT_FOUND')(); export const notFound = (): CommentNotFoundAction => createAction('mvj/comments/NOT_FOUND')(); diff --git a/src/comments/spec.ts b/src/comments/comments.spec.ts similarity index 99% rename from src/comments/spec.ts rename to src/comments/comments.spec.ts index 757f97e60..c02cb7eda 100644 --- a/src/comments/spec.ts +++ b/src/comments/comments.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, receiveAttributes, receiveMethods, attributesNotFound, fetchCommentsByLease, receiveCommentsByLease, createComment, editComment, notFound, clearEditFlags, showEditModeById, hideEditModeById, receiveIsSaveClicked } from "./actions"; import commentReducer from "./reducer"; import type { CommentState } from "./types"; diff --git a/src/comments/helpers.ts b/src/comments/helpers.ts index 6ea571dcb..2dce93fd5 100644 --- a/src/comments/helpers.ts +++ b/src/comments/helpers.ts @@ -1,5 +1,5 @@ import get from "lodash/get"; -import { getContentUser } from "users/helpers"; +import { getContentUser } from "@/users/helpers"; /** * Get content comments diff --git a/src/comments/requests.ts b/src/comments/requests.ts index 12d6556f0..b20fbc161 100644 --- a/src/comments/requests.ts +++ b/src/comments/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; import type { Comment } from "./types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl('comment/'), { diff --git a/src/comments/saga.ts b/src/comments/saga.ts index 8736bb619..2f3ce1764 100644 --- a/src/comments/saga.ts +++ b/src/comments/saga.ts @@ -1,9 +1,9 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { initialize, SubmissionError } from "redux-form"; import { attributesNotFound, notFound, fetchCommentsByLease, hideEditModeById, receiveAttributes, receiveMethods, receiveCommentsByLease, receiveIsSaveClicked } from "./actions"; -import { receiveError } from "../api/actions"; -import { FormNames } from "enums"; -import { displayUIMessage } from "util/helpers"; +import { receiveError } from "@/api/actions"; +import { FormNames } from "@/enums"; +import { displayUIMessage } from "@/util/helpers"; import { createComment, editComment, fetchAttributes, fetchComments } from "./requests"; function* fetchAttributesSaga(): Generator { diff --git a/src/comments/selectors.ts b/src/comments/selectors.ts index 1b9000b18..d5a01be8a 100644 --- a/src/comments/selectors.ts +++ b/src/comments/selectors.ts @@ -1,7 +1,7 @@ import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { CommentId, CommentList } from "./types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export const getEditModeFlags: Selector, void> = (state: RootState): Record => state.comment.isEditModeById; export const getIsEditModeById: Selector = (state: RootState, commentId: CommentId): boolean => state.comment.isEditModeById[commentId]; export const getIsFetching: Selector = (state: RootState): boolean => state.comment.isFetching; diff --git a/src/comments/types.ts b/src/comments/types.ts index 62f9093ac..e4f4f34b9 100644 --- a/src/comments/types.ts +++ b/src/comments/types.ts @@ -1,5 +1,5 @@ import type { Action, Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export type CommentState = { attributes: Attributes; byLease: Record; diff --git a/src/components/address-search/AddressSearchInput.tsx b/src/components/address-search/AddressSearchInput.tsx index 696ebe76a..a2537b44e 100644 --- a/src/components/address-search/AddressSearchInput.tsx +++ b/src/components/address-search/AddressSearchInput.tsx @@ -3,13 +3,12 @@ import ReactDOM from "react-dom"; import classNames from "classnames"; import capitalize from "lodash/capitalize"; import debounce from "lodash/debounce"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import { stringifyQuery } from "api/createUrl"; -import { KeyCodes } from "enums"; -import { findFromOcdString } from "util/helpers"; -import { SERVICE_MAP_URL } from "util/constants"; - +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import { stringifyQuery } from "@/api/createUrl"; +import { KeyCodes } from "@/enums"; +import { findFromOcdString } from "@/util/helpers"; +import { SERVICE_MAP_URL } from "@/util/constants"; type Language = "fi" | "sv"; const MINIMUM_SEARCH_STRING = 3; const DEBOUNCE_TIME_MILLISECONDS = 500; diff --git a/src/components/attributes/AreaNoteAttributes.tsx b/src/components/attributes/AreaNoteAttributes.tsx index 9b604b3e8..b1ac90ec4 100644 --- a/src/components/attributes/AreaNoteAttributes.tsx +++ b/src/components/attributes/AreaNoteAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchAreaNoteAttributes } from "areaNote/actions"; -import { getAttributes as getAreaNoteAttributes, getIsFetchingAttributes as getIsFetchingAreaNoteAttributes, getMethods as getAreaNoteMethods } from "areaNote/selectors"; +import { fetchAttributes as fetchAreaNoteAttributes } from "@/areaNote/actions"; +import { getAttributes as getAreaNoteAttributes, getIsFetchingAttributes as getIsFetchingAreaNoteAttributes, getMethods as getAreaNoteMethods } from "@/areaNote/selectors"; import type { Attributes, Methods } from "types"; function AreaNoteAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/AreaSearchAttributes.tsx b/src/components/attributes/AreaSearchAttributes.tsx index 9bdd4bfa5..db582dd3c 100644 --- a/src/components/attributes/AreaSearchAttributes.tsx +++ b/src/components/attributes/AreaSearchAttributes.tsx @@ -1,10 +1,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { getAttributes, getIsFetchingAttributes, getIsFetchingListAttributes, getListAttributes, getListMethods, getMethods } from "areaSearch/selectors"; +import { getAttributes, getIsFetchingAttributes, getIsFetchingListAttributes, getListAttributes, getListMethods, getMethods } from "@/areaSearch/selectors"; import type { Attributes, Methods } from "types"; -import { fetchAttributes, fetchListAttributes } from "areaSearch/actions"; -import type { RootState } from "root/types"; +import { fetchAttributes, fetchListAttributes } from "@/areaSearch/actions"; +import type { RootState } from "@/root/types"; function AreaSearchAttributes(WrappedComponent: React.ComponentType) { type Props = { diff --git a/src/components/attributes/BatchrunJobRunsTabAttributes.tsx b/src/components/attributes/BatchrunJobRunsTabAttributes.tsx index 6867b81bf..40de77c7e 100644 --- a/src/components/attributes/BatchrunJobRunsTabAttributes.tsx +++ b/src/components/attributes/BatchrunJobRunsTabAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchJobRunAttributes as fetchBatchrunJobRunAttributes, fetchJobRunLogEntryAttributes as fetchBatchrunJobRunLogEntryAttributes } from "batchrun/actions"; -import { getIsFetchingJobRunAttributes as getIsFetchingBatchrunJobRunAttributes, getIsFetchingJobRunLogEntryAttributes as getIsFetchingBatchrunJobRunLogEntryAttributes, getJobRunAttributes as getBatchrunJobRunAttributes, getJobRunMethods as getBatchrunJobRunMethods, getJobRunLogEntryAttributes as getBatchrunJobRunLogEntryAttributes, getJobRunLogEntryMethods as getBatchrunJobRunLogEntryMethods } from "batchrun/selectors"; +import { fetchJobRunAttributes as fetchBatchrunJobRunAttributes, fetchJobRunLogEntryAttributes as fetchBatchrunJobRunLogEntryAttributes } from "@/batchrun/actions"; +import { getIsFetchingJobRunAttributes as getIsFetchingBatchrunJobRunAttributes, getIsFetchingJobRunLogEntryAttributes as getIsFetchingBatchrunJobRunLogEntryAttributes, getJobRunAttributes as getBatchrunJobRunAttributes, getJobRunMethods as getBatchrunJobRunMethods, getJobRunLogEntryAttributes as getBatchrunJobRunLogEntryAttributes, getJobRunLogEntryMethods as getBatchrunJobRunLogEntryMethods } from "@/batchrun/selectors"; import type { Attributes, Methods } from "types"; function BatchrunJobRunTabAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/BatchrunScheduledJobsTabAttributes.tsx b/src/components/attributes/BatchrunScheduledJobsTabAttributes.tsx index ffaa061de..617f6c8b0 100644 --- a/src/components/attributes/BatchrunScheduledJobsTabAttributes.tsx +++ b/src/components/attributes/BatchrunScheduledJobsTabAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchScheduledJobAttributes as fetchBatchrunScheduledJobAttributes } from "batchrun/actions"; -import { getScheduledJobAttributes as getBatchrunScheduledJobAttributes, getIsFetchingScheduledJobAttributes as getIsFetchingBatchrunScheduledJobAttributes, getScheduledJobMethods as getBatchrunScheduledJobMethods } from "batchrun/selectors"; +import { fetchScheduledJobAttributes as fetchBatchrunScheduledJobAttributes } from "@/batchrun/actions"; +import { getScheduledJobAttributes as getBatchrunScheduledJobAttributes, getIsFetchingScheduledJobAttributes as getIsFetchingBatchrunScheduledJobAttributes, getScheduledJobMethods as getBatchrunScheduledJobMethods } from "@/batchrun/selectors"; import type { Attributes, Methods } from "types"; function BatchrunScheduledJobTabAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/ContactAttributes.tsx b/src/components/attributes/ContactAttributes.tsx index b8b4aea63..7ea29f825 100644 --- a/src/components/attributes/ContactAttributes.tsx +++ b/src/components/attributes/ContactAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchContactAttributes } from "contacts/actions"; -import { getAttributes as getContactAttributes, getIsFetchingAttributes as getIsFetchingContactAttributes, getMethods as getContactMethods } from "contacts/selectors"; +import { fetchAttributes as fetchContactAttributes } from "@/contacts/actions"; +import { getAttributes as getContactAttributes, getIsFetchingAttributes as getIsFetchingContactAttributes, getMethods as getContactMethods } from "@/contacts/selectors"; import type { Attributes, Methods } from "types"; function ContactAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/InfillDevelopmentListPageAttributes.tsx b/src/components/attributes/InfillDevelopmentListPageAttributes.tsx index 8db87013d..d51be592e 100644 --- a/src/components/attributes/InfillDevelopmentListPageAttributes.tsx +++ b/src/components/attributes/InfillDevelopmentListPageAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchInfillDevelopmentAttributes } from "infillDevelopment/actions"; -import { getAttributes as getInfillDevelopmentAttributes, getIsFetchingAttributes as getIsFetchingInfillDevelopmentAttributes, getMethods as getInfillDevelopmentMethods } from "infillDevelopment/selectors"; +import { fetchAttributes as fetchInfillDevelopmentAttributes } from "@/infillDevelopment/actions"; +import { getAttributes as getInfillDevelopmentAttributes, getIsFetchingAttributes as getIsFetchingInfillDevelopmentAttributes, getMethods as getInfillDevelopmentMethods } from "@/infillDevelopment/selectors"; import type { Attributes, Methods } from "types"; function InfillDevelopmentListPageAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/InfillDevelopmentPageAttributes.tsx b/src/components/attributes/InfillDevelopmentPageAttributes.tsx index 09527666e..36ac5df21 100644 --- a/src/components/attributes/InfillDevelopmentPageAttributes.tsx +++ b/src/components/attributes/InfillDevelopmentPageAttributes.tsx @@ -1,12 +1,12 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchInfillDevelopmentAttributes } from "infillDevelopment/actions"; -import { fetchAttributes as fetchInfillDevelopmentAttachmentAttributes } from "infillDevelopmentAttachment/actions"; -import { fetchAttributes as fetchLeaseAttributes } from "leases/actions"; -import { getAttributes as getInfillDevelopmentAttributes, getIsFetchingAttributes as getIsFetchingInfillDevelopmentAttributes, getMethods as getInfillDevelopmentMethods } from "infillDevelopment/selectors"; -import { getAttributes as getInfillDevelopmentAttachmentAttributes, getIsFetchingAttributes as getIsFetchingInfillDevelopmentAttachmentAttributes, getMethods as getInfillDevelopmentAttachmentMethods } from "infillDevelopmentAttachment/selectors"; -import { getAttributes as getLeaseAttributes, getIsFetchingAttributes as getIsFetchingLeaseAttributes, getMethods as getLeaseMethods } from "leases/selectors"; +import { fetchAttributes as fetchInfillDevelopmentAttributes } from "@/infillDevelopment/actions"; +import { fetchAttributes as fetchInfillDevelopmentAttachmentAttributes } from "@/infillDevelopmentAttachment/actions"; +import { fetchAttributes as fetchLeaseAttributes } from "@/leases/actions"; +import { getAttributes as getInfillDevelopmentAttributes, getIsFetchingAttributes as getIsFetchingInfillDevelopmentAttributes, getMethods as getInfillDevelopmentMethods } from "@/infillDevelopment/selectors"; +import { getAttributes as getInfillDevelopmentAttachmentAttributes, getIsFetchingAttributes as getIsFetchingInfillDevelopmentAttachmentAttributes, getMethods as getInfillDevelopmentAttachmentMethods } from "@/infillDevelopmentAttachment/selectors"; +import { getAttributes as getLeaseAttributes, getIsFetchingAttributes as getIsFetchingLeaseAttributes, getMethods as getLeaseMethods } from "@/leases/selectors"; import type { Attributes, Methods } from "types"; function InfillDevelopmentPageAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/InvoiceNoteAttributes.tsx b/src/components/attributes/InvoiceNoteAttributes.tsx index 9f41774ca..bd1ee6984 100644 --- a/src/components/attributes/InvoiceNoteAttributes.tsx +++ b/src/components/attributes/InvoiceNoteAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchInvoiceNoteAttributes } from "invoiceNote/actions"; -import { getAttributes as getInvoiceNoteAttributes, getIsFetchingAttributes as getIsFetchingInvoiceNoteAttributes, getMethods as getInvoiceNoteMethods } from "invoiceNote/selectors"; +import { fetchAttributes as fetchInvoiceNoteAttributes } from "@/invoiceNote/actions"; +import { getAttributes as getInvoiceNoteAttributes, getIsFetchingAttributes as getIsFetchingInvoiceNoteAttributes, getMethods as getInvoiceNoteMethods } from "@/invoiceNote/selectors"; import type { Attributes, Methods } from "types"; function InvoiceNoteAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/LandUseContractAttributes.tsx b/src/components/attributes/LandUseContractAttributes.tsx index 1bb84651d..5cc659139 100644 --- a/src/components/attributes/LandUseContractAttributes.tsx +++ b/src/components/attributes/LandUseContractAttributes.tsx @@ -1,11 +1,11 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchLandUseContractAttributes } from "landUseContract/actions"; -import { getAttributes as getLandUseContractAttributes, getIsFetchingAttributes as getIsFetchingLandUseContractAttributes, getMethods as getLandUseContractMethods } from "landUseContract/selectors"; +import { fetchAttributes as fetchLandUseContractAttributes } from "@/landUseContract/actions"; +import { getAttributes as getLandUseContractAttributes, getIsFetchingAttributes as getIsFetchingLandUseContractAttributes, getMethods as getLandUseContractMethods } from "@/landUseContract/selectors"; import type { Attributes, Methods } from "types"; -import { fetchAttributes as fetchLandUseAgreementAttachmentAttributes } from "landUseAgreementAttachment/actions"; -import { getAttributes as getLandUseAgreementAttachmentAttributes, getIsFetchingAttributes as getIsFetchingLandUseAgreementAttachmentAttributes, getMethods as getLandUseAgreementAttachmentMethods } from "landUseAgreementAttachment/selectors"; +import { fetchAttributes as fetchLandUseAgreementAttachmentAttributes } from "@/landUseAgreementAttachment/actions"; +import { getAttributes as getLandUseAgreementAttachmentAttributes, getIsFetchingAttributes as getIsFetchingLandUseAgreementAttachmentAttributes, getMethods as getLandUseAgreementAttachmentMethods } from "@/landUseAgreementAttachment/selectors"; function LandUseContractAttributes(WrappedComponent: any) { type Props = { diff --git a/src/components/attributes/LeaseAttributes.tsx b/src/components/attributes/LeaseAttributes.tsx index 635ef8b4d..f196f3cea 100644 --- a/src/components/attributes/LeaseAttributes.tsx +++ b/src/components/attributes/LeaseAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchLeaseAttributes } from "leases/actions"; -import { getAttributes as getLeaseAttributes, getIsFetchingAttributes as getIsFetchingLeaseAttributes, getMethods as getLeaseMethods } from "leases/selectors"; +import { fetchAttributes as fetchLeaseAttributes } from "@/leases/actions"; +import { getAttributes as getLeaseAttributes, getIsFetchingAttributes as getIsFetchingLeaseAttributes, getMethods as getLeaseMethods } from "@/leases/selectors"; import type { Attributes, Methods } from "types"; function LeaseAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/LeaseInvoiceTabAttributes.tsx b/src/components/attributes/LeaseInvoiceTabAttributes.tsx index 7855f1297..edbc09c11 100644 --- a/src/components/attributes/LeaseInvoiceTabAttributes.tsx +++ b/src/components/attributes/LeaseInvoiceTabAttributes.tsx @@ -1,20 +1,20 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchCollectionCourtDecisionAttributes } from "collectionCourtDecision/actions"; -import { fetchAttributes as fetchCollectionLetterAttributes } from "collectionLetter/actions"; -import { fetchAttributes as fetchCollectionNoteAttributes } from "collectionNote/actions"; -import { fetchAttributes as fetchCreateCollectionLetterAttributes } from "createCollectionLetter/actions"; -import { fetchAttributes as fetchInvoiceNoteAttributes } from "invoiceNote/actions"; -import { fetchAttributes as fetchLeaseCreateChargeAttributes } from "leaseCreateCharge/actions"; -import { fetchReceivableTypes } from "leaseCreateCharge/actions"; -import { getAttributes as getCollectionCourtDecisionAttributes, getIsFetchingAttributes as getIsFetchingCollectionCourtDecisionAttributes, getMethods as getCollectionCourtDecisionMethods } from "collectionCourtDecision/selectors"; -import { getAttributes as getCollectionLetterAttributes, getIsFetchingAttributes as getIsFetchignCollectionLetterAttributes, getMethods as getCollectionLetterMethods } from "collectionLetter/selectors"; -import { getAttributes as getCollectionNoteAttributes, getIsFetchingAttributes as getIsFetchingCollectionNoteAttributes, getMethods as getCollectionNoteMethods } from "collectionNote/selectors"; -import { getAttributes as getCreateCollectionLetterAttributes, getIsFetchingAttributes as getIsFetchignCreateCollectionLetterAttributes } from "createCollectionLetter/selectors"; -import { getAttributes as getInvoiceNoteAttributes, getIsFetchingAttributes as getIsFetchingInvoiceNoteAttributes, getMethods as getInvoiceNoteMethods } from "invoiceNote/selectors"; -import { getAttributes as getLeaseCreateChargeAttributes, getIsFetchingAttributes as getIsFetchingLeaseCreateChargeAttributes } from "leaseCreateCharge/selectors"; -import { getIsFetchingReceivableTypes, getReceivableTypes } from "leaseCreateCharge/selectors"; +import { fetchAttributes as fetchCollectionCourtDecisionAttributes } from "@/collectionCourtDecision/actions"; +import { fetchAttributes as fetchCollectionLetterAttributes } from "@/collectionLetter/actions"; +import { fetchAttributes as fetchCollectionNoteAttributes } from "@/collectionNote/actions"; +import { fetchAttributes as fetchCreateCollectionLetterAttributes } from "@/createCollectionLetter/actions"; +import { fetchAttributes as fetchInvoiceNoteAttributes } from "@/invoiceNote/actions"; +import { fetchAttributes as fetchLeaseCreateChargeAttributes } from "@/leaseCreateCharge/actions"; +import { fetchReceivableTypes } from "@/leaseCreateCharge/actions"; +import { getAttributes as getCollectionCourtDecisionAttributes, getIsFetchingAttributes as getIsFetchingCollectionCourtDecisionAttributes, getMethods as getCollectionCourtDecisionMethods } from "@/collectionCourtDecision/selectors"; +import { getAttributes as getCollectionLetterAttributes, getIsFetchingAttributes as getIsFetchignCollectionLetterAttributes, getMethods as getCollectionLetterMethods } from "@/collectionLetter/selectors"; +import { getAttributes as getCollectionNoteAttributes, getIsFetchingAttributes as getIsFetchingCollectionNoteAttributes, getMethods as getCollectionNoteMethods } from "@/collectionNote/selectors"; +import { getAttributes as getCreateCollectionLetterAttributes, getIsFetchingAttributes as getIsFetchignCreateCollectionLetterAttributes } from "@/createCollectionLetter/selectors"; +import { getAttributes as getInvoiceNoteAttributes, getIsFetchingAttributes as getIsFetchingInvoiceNoteAttributes, getMethods as getInvoiceNoteMethods } from "@/invoiceNote/selectors"; +import { getAttributes as getLeaseCreateChargeAttributes, getIsFetchingAttributes as getIsFetchingLeaseCreateChargeAttributes } from "@/leaseCreateCharge/selectors"; +import { getIsFetchingReceivableTypes, getReceivableTypes } from "@/leaseCreateCharge/selectors"; import type { Attributes, Methods } from "types"; function LeaseInvoiceTabAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/LeaseInvoicingConfirmationReportAttributes.tsx b/src/components/attributes/LeaseInvoicingConfirmationReportAttributes.tsx index 430964f65..baf45d590 100644 --- a/src/components/attributes/LeaseInvoicingConfirmationReportAttributes.tsx +++ b/src/components/attributes/LeaseInvoicingConfirmationReportAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchLeaseInvoicingConfirmationReportAttributes } from "leaseStatisticReport/actions"; -import { getReportData, getIsFetchingReportData, getReportOptions, getReports } from "leaseStatisticReport/selectors"; +import { fetchLeaseInvoicingConfirmationReportAttributes } from "@/leaseStatisticReport/actions"; +import { getReportData, getIsFetchingReportData, getReportOptions, getReports } from "@/leaseStatisticReport/selectors"; function LeaseInvoicingConfirmationReportAttributes(WrappedComponent: any) { type Props = {}; diff --git a/src/components/attributes/LeasePageAttributes.tsx b/src/components/attributes/LeasePageAttributes.tsx index 29cb5ab2b..fb4244810 100644 --- a/src/components/attributes/LeasePageAttributes.tsx +++ b/src/components/attributes/LeasePageAttributes.tsx @@ -1,15 +1,15 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchCommentAttributes } from "comments/actions"; -import { fetchAttributes as fetchInvoiceAttributes } from "invoices/actions"; -import { fetchAttributes as fetchLeaseAttributes } from "leases/actions"; -import { getAttributes as getCommentAttributes, getIsFetchingAttributes as getIsFetchingCommentAttributes, getMethods as getCommentMethods } from "comments/selectors"; -import { getAttributes as getInvoiceAttributes, getIsFetchingAttributes as getIsFetchingInvoiceAttributes, getMethods as getInvoiceMethods } from "invoices/selectors"; -import { getAttributes as getLeaseAttributes, getIsFetchingAttributes as getIsFetchingLeaseAttributes, getMethods as getLeaseMethods } from "leases/selectors"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; +import { fetchAttributes as fetchCommentAttributes } from "@/comments/actions"; +import { fetchAttributes as fetchInvoiceAttributes } from "@/invoices/actions"; +import { fetchAttributes as fetchLeaseAttributes } from "@/leases/actions"; +import { getAttributes as getCommentAttributes, getIsFetchingAttributes as getIsFetchingCommentAttributes, getMethods as getCommentMethods } from "@/comments/selectors"; +import { getAttributes as getInvoiceAttributes, getIsFetchingAttributes as getIsFetchingInvoiceAttributes, getMethods as getInvoiceMethods } from "@/invoices/selectors"; +import { getAttributes as getLeaseAttributes, getIsFetchingAttributes as getIsFetchingLeaseAttributes, getMethods as getLeaseMethods } from "@/leases/selectors"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; import type { Attributes, Methods } from "types"; -import type { UsersPermissions } from "usersPermissions/types"; +import type { UsersPermissions } from "@/usersPermissions/types"; function LeasePageAttributes(WrappedComponent: any) { type Props = { diff --git a/src/components/attributes/LeaseStatisticReportAttributes.tsx b/src/components/attributes/LeaseStatisticReportAttributes.tsx index 2df1f2346..3707b8caa 100644 --- a/src/components/attributes/LeaseStatisticReportAttributes.tsx +++ b/src/components/attributes/LeaseStatisticReportAttributes.tsx @@ -1,9 +1,9 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchLeaseStatisticReportAttributes } from "leaseStatisticReport/actions"; -import { fetchReports } from "leaseStatisticReport/actions"; -import { getAttributes as getLeaseStatisticReportAttributes, getIsFetchingAttributes as getIsFetchingLeaseStatisticReportAttributes, getReports, getIsFetchingReports, getIsFetchingReportData, getIsSendingMail } from "leaseStatisticReport/selectors"; +import { fetchAttributes as fetchLeaseStatisticReportAttributes } from "@/leaseStatisticReport/actions"; +import { fetchReports } from "@/leaseStatisticReport/actions"; +import { getAttributes as getLeaseStatisticReportAttributes, getIsFetchingAttributes as getIsFetchingLeaseStatisticReportAttributes, getReports, getIsFetchingReports, getIsFetchingReportData, getIsSendingMail } from "@/leaseStatisticReport/selectors"; import type { Attributes, Methods, Reports } from "types"; function LeaseStatisticReportTabAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/LeaseholdTransferAttributes.tsx b/src/components/attributes/LeaseholdTransferAttributes.tsx index ff11da25e..b6409a67f 100644 --- a/src/components/attributes/LeaseholdTransferAttributes.tsx +++ b/src/components/attributes/LeaseholdTransferAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchLeaseholdTransferAttributes } from "leaseholdTransfer/actions"; -import { getAttributes as getLeaseholdTransferAttributes, getIsFetchingAttributes as getIsFetchingLeaseholdTransferAttributes, getMethods as getLeaseholdTransferMethods } from "leaseholdTransfer/selectors"; +import { fetchAttributes as fetchLeaseholdTransferAttributes } from "@/leaseholdTransfer/actions"; +import { getAttributes as getLeaseholdTransferAttributes, getIsFetchingAttributes as getIsFetchingLeaseholdTransferAttributes, getMethods as getLeaseholdTransferMethods } from "@/leaseholdTransfer/selectors"; import type { Attributes, Methods } from "types"; function LeaseholdTransferAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/PlotApplicationsAttributes.tsx b/src/components/attributes/PlotApplicationsAttributes.tsx index e40346c1a..235e08350 100644 --- a/src/components/attributes/PlotApplicationsAttributes.tsx +++ b/src/components/attributes/PlotApplicationsAttributes.tsx @@ -2,8 +2,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import type { Attributes, Methods } from "types"; -import { fetchAttributes as fetchPlotApplicationsAttributes } from "application/actions"; -import { getAttributes as getPlotApplicationsAttributes, getIsFetchingAttributes as getIsFetchingPlotApplicationsAttributes, getMethods } from "application/selectors"; +import { fetchAttributes as fetchPlotApplicationsAttributes } from "@/application/actions"; +import { getAttributes as getPlotApplicationsAttributes, getIsFetchingAttributes as getIsFetchingPlotApplicationsAttributes, getMethods } from "@/application/selectors"; function PlotApplicationsAttributes(WrappedComponent: any) { type Props = { diff --git a/src/components/attributes/PlotSearchAttributes.tsx b/src/components/attributes/PlotSearchAttributes.tsx index ab75b7c25..6557bf324 100644 --- a/src/components/attributes/PlotSearchAttributes.tsx +++ b/src/components/attributes/PlotSearchAttributes.tsx @@ -1,10 +1,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchPlotSearchAttributes, fetchPlotSearchSubtypes } from "plotSearch/actions"; -import { getAttributes as getPlotSearchAttributes, getIsFetchingAttributes as getIsFetchingPlotSearchAttributes, getPlotSearchMethods, getPlotSearchSubTypes, getIsFetching } from "plotSearch/selectors"; -import { getFormAttributes, getIsFetchingFormAttributes } from "application/selectors"; -import { fetchFormAttributes } from "application/actions"; +import { fetchAttributes as fetchPlotSearchAttributes, fetchPlotSearchSubtypes } from "@/plotSearch/actions"; +import { getAttributes as getPlotSearchAttributes, getIsFetchingAttributes as getIsFetchingPlotSearchAttributes, getPlotSearchMethods, getPlotSearchSubTypes, getIsFetching } from "@/plotSearch/selectors"; +import { getFormAttributes, getIsFetchingFormAttributes } from "@/application/selectors"; +import { fetchFormAttributes } from "@/application/actions"; import type { Attributes, Methods } from "types"; function PlotSearchAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/RentBasisAttributes.tsx b/src/components/attributes/RentBasisAttributes.tsx index 7a83aa033..b72e3d3f0 100644 --- a/src/components/attributes/RentBasisAttributes.tsx +++ b/src/components/attributes/RentBasisAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchRentBasisAttributes } from "rentbasis/actions"; -import { getAttributes as getRentBasisAttributes, getIsFetchingAttributes as getIsFetchingRentBasisAttributes, getMethods as getRentBasisMethods } from "rentbasis/selectors"; +import { fetchAttributes as fetchRentBasisAttributes } from "@/rentbasis/actions"; +import { getAttributes as getRentBasisAttributes, getIsFetchingAttributes as getIsFetchingRentBasisAttributes, getMethods as getRentBasisMethods } from "@/rentbasis/selectors"; import type { Attributes, Methods } from "types"; function RentBasisAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/SapInvoicesAttributes.tsx b/src/components/attributes/SapInvoicesAttributes.tsx index 1a9eb392e..e31acb93d 100644 --- a/src/components/attributes/SapInvoicesAttributes.tsx +++ b/src/components/attributes/SapInvoicesAttributes.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import { fetchAttributes as fetchInvoiceAttributes } from "invoices/actions"; -import { getAttributes as getInvoiceAttributes, getIsFetchingAttributes as getIsFetchingInvoiceAttributes, getMethods as getInvoiceMethods } from "invoices/selectors"; +import { fetchAttributes as fetchInvoiceAttributes } from "@/invoices/actions"; +import { getAttributes as getInvoiceAttributes, getIsFetchingAttributes as getIsFetchingInvoiceAttributes, getMethods as getInvoiceMethods } from "@/invoices/selectors"; import type { Attributes, Methods } from "types"; function SapInvoicesAttributes(WrappedComponent: any) { diff --git a/src/components/attributes/UsersPermissions.tsx b/src/components/attributes/UsersPermissions.tsx index 7d96587ef..85b336862 100644 --- a/src/components/attributes/UsersPermissions.tsx +++ b/src/components/attributes/UsersPermissions.tsx @@ -2,9 +2,9 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import { fetchUsersPermissions } from "usersPermissions/actions"; -import { getUsersPermissions, getIsFetching as getIsFetchingUsersPermissions } from "usersPermissions/selectors"; -import type { UsersPermissions } from "usersPermissions/types"; +import { fetchUsersPermissions } from "@/usersPermissions/actions"; +import { getUsersPermissions, getIsFetching as getIsFetchingUsersPermissions } from "@/usersPermissions/selectors"; +import type { UsersPermissions } from "@/usersPermissions/types"; function UsersPermissionsWrapper(WrappedComponent: any) { type Props = { diff --git a/src/components/auditLog/AuditLogTableItem.tsx b/src/components/auditLog/AuditLogTableItem.tsx index 47ba20324..82917c499 100644 --- a/src/components/auditLog/AuditLogTableItem.tsx +++ b/src/components/auditLog/AuditLogTableItem.tsx @@ -1,10 +1,10 @@ import React, { Fragment, PureComponent } from "react"; import classNames from "classnames"; -import AccordionIcon from "components/icons/AccordionIcon"; +import AccordionIcon from "@/components/icons/AccordionIcon"; import AuditLogTableItemChange from "./AuditLogTableItemChange"; -import { formatDate } from "util/helpers"; -import { getAuditLogActionTypeInFinnish } from "auditLog/helpers"; -import { getUserFullName } from "users/helpers"; +import { formatDate } from "@/util/helpers"; +import { getAuditLogActionTypeInFinnish } from "@/auditLog/helpers"; +import { getUserFullName } from "@/users/helpers"; type Props = { item: Record; }; diff --git a/src/components/auditLog/AuditLogTableItemChange.tsx b/src/components/auditLog/AuditLogTableItemChange.tsx index bca2b9ac0..eb699395c 100644 --- a/src/components/auditLog/AuditLogTableItemChange.tsx +++ b/src/components/auditLog/AuditLogTableItemChange.tsx @@ -1,12 +1,12 @@ import React from "react"; import { connect } from "react-redux"; -import ShowMore from "components/showMore/ShowMore"; -import { getAuditLogContentLabel } from "auditLog/helpers"; -import { getAttributes as getCommentAttributes } from "comments/selectors"; -import { getAttributes as getContactAttributes } from "contacts/selectors"; -import { getAttributes as getInfillDevelopmentCompensationAttributes } from "infillDevelopment/selectors"; -import { getAttributes as getInvoiceAttributes } from "invoices/selectors"; -import { getAttributes as getLeaseAttributes } from "leases/selectors"; +import ShowMore from "@/components/showMore/ShowMore"; +import { getAuditLogContentLabel } from "@/auditLog/helpers"; +import { getAttributes as getCommentAttributes } from "@/comments/selectors"; +import { getAttributes as getContactAttributes } from "@/contacts/selectors"; +import { getAttributes as getInfillDevelopmentCompensationAttributes } from "@/infillDevelopment/selectors"; +import { getAttributes as getInvoiceAttributes } from "@/invoices/selectors"; +import { getAttributes as getLeaseAttributes } from "@/leases/selectors"; import type { Attributes } from "types"; type Props = { change: { diff --git a/src/components/authorization/Authorization.ts b/src/components/authorization/Authorization.ts index 6ec273b07..a5067691c 100644 --- a/src/components/authorization/Authorization.ts +++ b/src/components/authorization/Authorization.ts @@ -1,13 +1,13 @@ type Props = { allow: boolean; - children?: React.ReactNode; - errorComponent?: React.ReactNode; + children?: JSX.Element; + errorComponent?: JSX.Element; }; const Authorization = ({ allow, children, errorComponent -}: Props): React.ReactNode => allow ? children || null : errorComponent ? errorComponent : null; +}: Props): JSX.Element => allow ? children || null : errorComponent ? errorComponent : null; export default Authorization; \ No newline at end of file diff --git a/src/components/button/BackButton.tsx b/src/components/button/BackButton.tsx index de786654e..860aa0c6e 100644 --- a/src/components/button/BackButton.tsx +++ b/src/components/button/BackButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import BackIcon from "components/icons/BackIcon"; +import BackIcon from "@/components/icons/BackIcon"; import IconButton from "./IconButton"; type Props = { className?: string; diff --git a/src/components/button/Button.tsx b/src/components/button/Button.tsx index 8f8488648..4cebcb997 100644 --- a/src/components/button/Button.tsx +++ b/src/components/button/Button.tsx @@ -20,7 +20,7 @@ const Button = ({ text, title, type = 'button' -}: Props): React.ReactNode => { +}: Props): JSX.Element => { return ; diff --git a/src/components/button/CloseButton.tsx b/src/components/button/CloseButton.tsx index d01a7c5f9..ee5db0e45 100644 --- a/src/components/button/CloseButton.tsx +++ b/src/components/button/CloseButton.tsx @@ -1,7 +1,5 @@ import React from "react"; import classNames from "classnames"; -// @ts-ignore: unable to find svg file. Handled by webpack? -import closeIcon from "../../../assets/icons/icon_close.svg"; type Props = { className?: string; onClick: (...args: Array) => any; @@ -31,7 +29,7 @@ const CloseButton = ({ }; return ; }; diff --git a/src/components/button/EditButton.tsx b/src/components/button/EditButton.tsx index e5033bba0..bd184026a 100644 --- a/src/components/button/EditButton.tsx +++ b/src/components/button/EditButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import EditIcon from "components/icons/EditIcon"; +import EditIcon from "@/components/icons/EditIcon"; type Props = { className?: string; disabled?: boolean; diff --git a/src/components/button/SendupButton.tsx b/src/components/button/SendupButton.tsx index c70273a38..4e01dc0b5 100644 --- a/src/components/button/SendupButton.tsx +++ b/src/components/button/SendupButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import SendupIcon from "components/icons/SendupIcon"; +import SendupIcon from "@/components/icons/SendupIcon"; type Props = { className?: string; onClick: (...args: Array) => any; diff --git a/src/components/button/_close-button.scss b/src/components/button/_close-button.scss index 161990356..cb7e3dc6b 100644 --- a/src/components/button/_close-button.scss +++ b/src/components/button/_close-button.scss @@ -2,7 +2,7 @@ cursor: pointer; position: relative; top: rem-calc(-1px); - + background-image: url(/assets/icons/icon_error.svg); img { height: 20px; width: 20px; diff --git a/src/components/collapse/Collapse.tsx b/src/components/collapse/Collapse.tsx index b797a2883..806206da6 100644 --- a/src/components/collapse/Collapse.tsx +++ b/src/components/collapse/Collapse.tsx @@ -4,13 +4,13 @@ import ReactDOM from "react-dom"; import classNames from "classnames"; import { Row, Column } from "react-foundation"; import ReactResizeDetector from "react-resize-detector"; -import AccordionIcon from "../icons/AccordionIcon"; -import ArchiveButton from "../form/ArchiveButton"; +import AccordionIcon from "@/components/icons/AccordionIcon"; +import ArchiveButton from "@/components/form/ArchiveButton"; import CollapseHeaderTitle from "./CollapseHeaderTitle"; -import AttachButton from "../form/AttachButton"; -import CopyToClipboardButton from "../form/CopyToClipboardButton"; -import RemoveButton from "../form/RemoveButton"; -import UnarchiveButton from "../form/UnarchiveButton"; +import AttachButton from "@/components/form/AttachButton"; +import CopyToClipboardButton from "@/components/form/CopyToClipboardButton"; +import RemoveButton from "@/components/form/RemoveButton"; +import UnarchiveButton from "@/components/form/UnarchiveButton"; type Props = { archived?: boolean; children: any; @@ -143,7 +143,7 @@ class Collapse extends PureComponent { } }; - render(): React.ReactNode { + render(): JSX.Element { const { contentHeight, isOpen, diff --git a/src/components/collapse/CollapseHeaderSubtitle.tsx b/src/components/collapse/CollapseHeaderSubtitle.tsx index ee86c1666..70fd293db 100644 --- a/src/components/collapse/CollapseHeaderSubtitle.tsx +++ b/src/components/collapse/CollapseHeaderSubtitle.tsx @@ -5,6 +5,6 @@ type Props = { const CollapseHeaderSubtitle = ({ children -}: Props): React.ReactNode => {children}; +}: Props): JSX.Element => {children}; export default CollapseHeaderSubtitle; \ No newline at end of file diff --git a/src/components/collapse/CollapseHeaderTitle.tsx b/src/components/collapse/CollapseHeaderTitle.tsx index a7375902c..5f675a018 100644 --- a/src/components/collapse/CollapseHeaderTitle.tsx +++ b/src/components/collapse/CollapseHeaderTitle.tsx @@ -2,7 +2,7 @@ import { $Shape } from "utility-types"; import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import classNames from "classnames"; -import UIDataTooltip from "components/tooltip/UIDataTooltip"; +import UIDataTooltip from "@/components/tooltip/UIDataTooltip"; type Props = { children?: any; enableUiDataEdit?: boolean; @@ -64,7 +64,7 @@ class CollapseHeaderTitle extends PureComponent { }); }; - render(): React.ReactNode { + render(): JSX.Element { const { children, enableUiDataEdit, diff --git a/src/components/spec.ts b/src/components/components.spec.ts similarity index 82% rename from src/components/spec.ts rename to src/components/components.spec.ts index 385dc057c..5a425915d 100644 --- a/src/components/spec.ts +++ b/src/components/components.spec.ts @@ -1,7 +1,7 @@ -import { expect } from "chai"; -import ErrorIcon from "components/icons/ErrorIcon"; -import SuccessIcon from "components/icons/SuccessIcon"; -import ToastrIcons from "components/toastr/ToastrIcons"; +import { describe, expect, it } from "vitest"; +import ErrorIcon from "@/components/icons/ErrorIcon"; +import SuccessIcon from "@/components/icons/SuccessIcon"; +import ToastrIcons from "@/components/toastr/ToastrIcons"; describe('components', () => { describe('ErrorIcon', () => { diff --git a/src/components/content/SubTitle.tsx b/src/components/content/SubTitle.tsx index 216c462ab..99b813f23 100644 --- a/src/components/content/SubTitle.tsx +++ b/src/components/content/SubTitle.tsx @@ -2,7 +2,7 @@ import { $Shape } from "utility-types"; import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import classNames from "classnames"; -import UIDataTooltip from "components/tooltip/UIDataTooltip"; +import UIDataTooltip from "@/components/tooltip/UIDataTooltip"; type Props = { children?: any; enableUiDataEdit?: boolean; @@ -63,7 +63,7 @@ class SubTitle extends PureComponent { }); }; - render(): React.ReactNode { + render(): JSX.Element { const { children, enableUiDataEdit, diff --git a/src/components/content/Title.tsx b/src/components/content/Title.tsx index 8511c5499..e195a69b8 100644 --- a/src/components/content/Title.tsx +++ b/src/components/content/Title.tsx @@ -2,7 +2,7 @@ import { $Shape } from "utility-types"; import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import classNames from "classnames"; -import UIDataTooltip from "components/tooltip/UIDataTooltip"; +import UIDataTooltip from "@/components/tooltip/UIDataTooltip"; type Props = { children?: any; enableUiDataEdit?: boolean; @@ -63,7 +63,7 @@ class Title extends PureComponent { }); }; - render(): React.ReactNode { + render(): JSX.Element { const { children, enableUiDataEdit, diff --git a/src/components/content/TitleH3.tsx b/src/components/content/TitleH3.tsx index 464e05aa3..0e3a083bc 100644 --- a/src/components/content/TitleH3.tsx +++ b/src/components/content/TitleH3.tsx @@ -2,7 +2,7 @@ import { $Shape } from "utility-types"; import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import classNames from "classnames"; -import UIDataTooltip from "components/tooltip/UIDataTooltip"; +import UIDataTooltip from "@/components/tooltip/UIDataTooltip"; type Props = { children?: any; enableUiDataEdit?: boolean; @@ -63,7 +63,7 @@ class TitleH3 extends PureComponent { }); }; - render(): React.ReactNode { + render(): JSX.Element { const { children, enableUiDataEdit, diff --git a/src/components/controlButtons/CommentButton.tsx b/src/components/controlButtons/CommentButton.tsx index 75e843bef..a0bb85b08 100644 --- a/src/components/controlButtons/CommentButton.tsx +++ b/src/components/controlButtons/CommentButton.tsx @@ -1,5 +1,5 @@ import React from "react"; -import CommentIcon from "components/icons/CommentIcon"; +import CommentIcon from "@/components/icons/CommentIcon"; type Props = { commentAmount: number; onClick: (...args: Array) => any; diff --git a/src/components/controlButtons/ControlButtonBar.tsx b/src/components/controlButtons/ControlButtonBar.tsx index 4c814af0a..c1bb121ac 100644 --- a/src/components/controlButtons/ControlButtonBar.tsx +++ b/src/components/controlButtons/ControlButtonBar.tsx @@ -1,9 +1,9 @@ import React from "react"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import BackButton from "components/button/BackButton"; -import { ConfirmationModalTexts } from "enums"; -import { ButtonColors } from "components/enums"; -import { hasAnyPageDirtyForms } from "util/forms"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import BackButton from "@/components/button/BackButton"; +import { ConfirmationModalTexts } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { hasAnyPageDirtyForms } from "@/util/forms"; type Props = { buttonComponent?: any; infoComponent?: any; diff --git a/src/components/controlButtons/ControlButtons.tsx b/src/components/controlButtons/ControlButtons.tsx index f861c939f..6abb4b778 100644 --- a/src/components/controlButtons/ControlButtons.tsx +++ b/src/components/controlButtons/ControlButtons.tsx @@ -1,11 +1,11 @@ import React from "react"; import Button from "../button/Button"; -import Authorization from "components/authorization/Authorization"; +import Authorization from "@/components/authorization/Authorization"; import CommentButton from "./CommentButton"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import { ConfirmationModalTexts } from "enums"; -import { hasAnyPageDirtyForms } from "util/forms"; -import { ButtonColors } from "components/enums"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import { ConfirmationModalTexts } from "@/enums"; +import { hasAnyPageDirtyForms } from "@/util/forms"; +import { ButtonColors } from "@/components/enums"; type Props = { allowComments?: boolean; allowCopy?: boolean; @@ -55,7 +55,7 @@ const ControlButtons = ({ showCommentButton = true, showCopyButton = false, saveButtonText = 'Tallenna' -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleComment = () => { onComment?.(); }; diff --git a/src/components/excel/ExcelLink.tsx b/src/components/excel/ExcelLink.tsx index c50c62d82..7b2681228 100644 --- a/src/components/excel/ExcelLink.tsx +++ b/src/components/excel/ExcelLink.tsx @@ -1,11 +1,11 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import { saveAs } from "file-saver"; -import ExcelIcon from "components/icons/ExcelIcon"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import { getApiToken } from "auth/selectors"; -import { displayUIMessage } from "util/helpers"; +import ExcelIcon from "@/components/icons/ExcelIcon"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import { getApiToken } from "@/auth/selectors"; +import { displayUIMessage } from "@/util/helpers"; type Props = { label: string; apiToken: string; diff --git a/src/components/file/FileDownloadButton.tsx b/src/components/file/FileDownloadButton.tsx index bc9a9a3ae..33c1f85bb 100644 --- a/src/components/file/FileDownloadButton.tsx +++ b/src/components/file/FileDownloadButton.tsx @@ -2,10 +2,10 @@ import React from "react"; import { connect } from "react-redux"; import debounce from "lodash/debounce"; import { saveAs } from "file-saver"; -import Button from "components/button/Button"; -import { ButtonColors } from "components/enums"; -import { displayUIMessage, getFileNameFromResponse } from "util/helpers"; -import { getApiToken } from "auth/selectors"; +import Button from "@/components/button/Button"; +import { ButtonColors } from "@/components/enums"; +import { displayUIMessage, getFileNameFromResponse } from "@/util/helpers"; +import { getApiToken } from "@/auth/selectors"; type OwnProps = { disabled: boolean; label: string; diff --git a/src/components/file/FileDownloadLink.tsx b/src/components/file/FileDownloadLink.tsx index 2a941945f..0755a7552 100644 --- a/src/components/file/FileDownloadLink.tsx +++ b/src/components/file/FileDownloadLink.tsx @@ -2,10 +2,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import { saveAs } from "file-saver"; import classNames from "classnames"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import { displayUIMessage, getFileNameFromResponse } from "util/helpers"; -import { getApiToken } from "auth/selectors"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import { displayUIMessage, getFileNameFromResponse } from "@/util/helpers"; +import { getApiToken } from "@/auth/selectors"; type Props = { apiToken: string; className?: string; diff --git a/src/components/form/ActionButtonWrapper.tsx b/src/components/form/ActionButtonWrapper.tsx index f75fa5d3e..7c8c22f1f 100644 --- a/src/components/form/ActionButtonWrapper.tsx +++ b/src/components/form/ActionButtonWrapper.tsx @@ -5,6 +5,6 @@ type Props = { const ActionButtonWrapper = ({ children -}: Props): React.ReactNode =>
{children}
; +}: Props): JSX.Element =>
{children}
; export default ActionButtonWrapper; \ No newline at end of file diff --git a/src/components/form/AddButton.tsx b/src/components/form/AddButton.tsx index 88afdaccf..1d6c26533 100644 --- a/src/components/form/AddButton.tsx +++ b/src/components/form/AddButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import AddIcon from "components/icons/AddIcon"; +import AddIcon from "@/components/icons/AddIcon"; type Props = { className?: string; disabled?: boolean; @@ -17,7 +17,7 @@ const AddButton = ({ onClick, style, title -}: Props): React.ReactNode => ; diff --git a/src/components/form/AddButtonSecondary.tsx b/src/components/form/AddButtonSecondary.tsx index 5b86699fa..c1928736b 100644 --- a/src/components/form/AddButtonSecondary.tsx +++ b/src/components/form/AddButtonSecondary.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import AddIcon from "components/icons/AddIcon"; +import AddIcon from "@/components/icons/AddIcon"; type Props = { className?: string; disabled?: boolean; @@ -17,7 +17,7 @@ const AddButtonSecondary = ({ onClick, style, title -}: Props): React.ReactNode => ; diff --git a/src/components/form/AddButtonThird.tsx b/src/components/form/AddButtonThird.tsx index 469c1d07c..ffce39044 100644 --- a/src/components/form/AddButtonThird.tsx +++ b/src/components/form/AddButtonThird.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import AddIcon from "components/icons/AddIcon"; +import AddIcon from "@/components/icons/AddIcon"; type Props = { className?: string; disabled?: boolean; @@ -17,7 +17,7 @@ const AddButtonThird = ({ onClick, style, title -}: Props): React.ReactNode => ; diff --git a/src/components/form/AddFileButton.tsx b/src/components/form/AddFileButton.tsx index a9da8417b..5f4d78ce1 100644 --- a/src/components/form/AddFileButton.tsx +++ b/src/components/form/AddFileButton.tsx @@ -1,5 +1,5 @@ import React from "react"; -import AddIcon from "components/icons/AddIcon"; +import AddIcon from "@/components/icons/AddIcon"; type Props = { label: string; name: string; @@ -11,7 +11,7 @@ const AddFileButton = ({ label, name, onChange -}: Props): React.ReactNode => { +}: Props): JSX.Element => { let input: any; const handleKeyDown = (e: any) => { diff --git a/src/components/form/ArchiveButton.tsx b/src/components/form/ArchiveButton.tsx index cad81d35b..134e07339 100644 --- a/src/components/form/ArchiveButton.tsx +++ b/src/components/form/ArchiveButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import ArchiveIcon from "components/icons/ArchiveIcon"; +import ArchiveIcon from "@/components/icons/ArchiveIcon"; type Props = { className?: string; disabled?: boolean; @@ -15,7 +15,7 @@ const ArchiveButton = ({ onClick, title, type = 'button' -}: Props): React.ReactNode => ; diff --git a/src/components/form/AsyncSelect.tsx b/src/components/form/AsyncSelect.tsx index 6610f991c..16b879c17 100644 --- a/src/components/form/AsyncSelect.tsx +++ b/src/components/form/AsyncSelect.tsx @@ -1,8 +1,8 @@ import React, { Component } from "react"; import Async from "react-select/async"; import classNames from "classnames"; -import DropdownIndicator from "components/inputs/DropdownIndicator"; -import LoadingIndicator from "components/inputs/SelectLoadingIndicator"; +import DropdownIndicator from "@/components/inputs/DropdownIndicator"; +import LoadingIndicator from "@/components/inputs/SelectLoadingIndicator"; type Props = { disabled?: boolean; displayError: boolean; @@ -127,7 +127,7 @@ class AsyncSelect extends Component { } }; - render(): React.ReactNode { + render(): JSX.Element { const { disabled, displayError, diff --git a/src/components/form/AttachButton.tsx b/src/components/form/AttachButton.tsx index 19020b067..1cbfa1751 100644 --- a/src/components/form/AttachButton.tsx +++ b/src/components/form/AttachButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import AttachIcon from "components/icons/AttachIcon"; +import AttachIcon from "@/components/icons/AttachIcon"; type Props = { className?: string; disabled?: boolean; @@ -15,7 +15,7 @@ const AttachButton = ({ onClick, title, type = 'button' -}: Props): React.ReactNode => ; diff --git a/src/components/form/CopyToClipboardButton.tsx b/src/components/form/CopyToClipboardButton.tsx index 757f810db..d3e0c2b8a 100644 --- a/src/components/form/CopyToClipboardButton.tsx +++ b/src/components/form/CopyToClipboardButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import CopyToClipboardIcon from "components/icons/CopyToClipboardIcon"; +import CopyToClipboardIcon from "@/components/icons/CopyToClipboardIcon"; type Props = { className?: string; disabled?: boolean; @@ -10,7 +10,7 @@ type Props = { style?: any; }; -const CopyToClipboardButton = (props: Props): React.ReactNode => { +const CopyToClipboardButton = (props: Props): JSX.Element => { const { className, disabled, diff --git a/src/components/form/DecisionSelectInput.tsx b/src/components/form/DecisionSelectInput.tsx index 3c3a6b4d8..d77bdc7f3 100644 --- a/src/components/form/DecisionSelectInput.tsx +++ b/src/components/form/DecisionSelectInput.tsx @@ -1,8 +1,8 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { fetchDecisions } from "leases/requestsAsync"; -import { formatDecisionName } from "plotSearch/helpers"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { fetchDecisions } from "@/leases/requestsAsync"; +import { formatDecisionName } from "@/plotSearch/helpers"; type Props = { disabled?: boolean; name: string; @@ -25,7 +25,7 @@ const DecisionSelectInput = ({ getOptions, cacheOptions, hasError -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const getDecisionOptions = (decisionList: Array>): Array> => decisionList.map(decision => { return { value: decision.id, diff --git a/src/components/form/DocumentsButton.tsx b/src/components/form/DocumentsButton.tsx index e3d90c1ce..902004852 100644 --- a/src/components/form/DocumentsButton.tsx +++ b/src/components/form/DocumentsButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import DocIcon from "components/icons/DocIcon"; +import DocIcon from "@/components/icons/DocIcon"; type Props = { className?: string; disabled?: boolean; @@ -17,7 +17,7 @@ const AddButton = ({ onClick, style, title -}: Props): React.ReactNode => ; diff --git a/src/components/form/EditButton.tsx b/src/components/form/EditButton.tsx index 0804762f1..30c105aef 100644 --- a/src/components/form/EditButton.tsx +++ b/src/components/form/EditButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import EditIcon from "components/icons/EditIcon"; +import EditIcon from "@/components/icons/EditIcon"; type Props = { className?: string; disabled?: boolean; @@ -15,7 +15,7 @@ const EditButton = ({ onClick, title, type = 'button' -}: Props): React.ReactNode => ; diff --git a/src/components/form/ErrorBlock.tsx b/src/components/form/ErrorBlock.tsx index 4c9dfca71..97b687f37 100644 --- a/src/components/form/ErrorBlock.tsx +++ b/src/components/form/ErrorBlock.tsx @@ -5,6 +5,6 @@ type Props = { const ErrorBlock = ({ error -}: Props): React.ReactNode => {error}; +}: Props): JSX.Element => {error}; export default ErrorBlock; \ No newline at end of file diff --git a/src/components/form/ErrorField.tsx b/src/components/form/ErrorField.tsx index dd9f69f4a..690ed188a 100644 --- a/src/components/form/ErrorField.tsx +++ b/src/components/form/ErrorField.tsx @@ -11,6 +11,6 @@ const ErrorField = ({ }, showError = false, style -}: Props): React.ReactNode => showError && error ? {error} : null; +}: Props): JSX.Element => showError && error ? {error} : null; export default ErrorField; \ No newline at end of file diff --git a/src/components/form/FieldAndRemoveButtonWrapper.tsx b/src/components/form/FieldAndRemoveButtonWrapper.tsx index d31d2566d..3ef3d9b63 100644 --- a/src/components/form/FieldAndRemoveButtonWrapper.tsx +++ b/src/components/form/FieldAndRemoveButtonWrapper.tsx @@ -10,7 +10,7 @@ const FieldAndRemoveButtonWrapper = ({ className, field, removeButton -}: Props): React.ReactNode =>
+}: Props): JSX.Element =>
{field}
{removeButton} diff --git a/src/components/form/FieldTypeAddress.tsx b/src/components/form/FieldTypeAddress.tsx index 6b3cc493e..77b910e3f 100644 --- a/src/components/form/FieldTypeAddress.tsx +++ b/src/components/form/FieldTypeAddress.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import AddressSearchInput from "components/address-search/AddressSearchInput"; +import AddressSearchInput from "@/components/address-search/AddressSearchInput"; type Props = { autoComplete: string; disabled: boolean; @@ -23,7 +23,7 @@ const FieldTypeAddress = ({ }, isDirty, valueSelectedCallback -}: Props): React.ReactNode => { +}: Props): JSX.Element => { return
{ +}: Props): JSX.Element => { const handleChange = (e: any) => { if (autoBlur) { onBlur(e.target.value); diff --git a/src/components/form/FieldTypeBoolean.tsx b/src/components/form/FieldTypeBoolean.tsx index da657b04e..435575305 100644 --- a/src/components/form/FieldTypeBoolean.tsx +++ b/src/components/form/FieldTypeBoolean.tsx @@ -22,7 +22,7 @@ const FieldTypeBoolean = ({ }, isDirty = false, label -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const options = [{ value: false, label: 'Ei' diff --git a/src/components/form/FieldTypeCheckbox.tsx b/src/components/form/FieldTypeCheckbox.tsx index 022b5de74..dc98262b2 100644 --- a/src/components/form/FieldTypeCheckbox.tsx +++ b/src/components/form/FieldTypeCheckbox.tsx @@ -20,7 +20,7 @@ const FieldTypeCheckbox = ({ isDirty = false, label, options -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const hasMultipleValues = options && options.length > 1; const handleChange = (event: any, optionValue) => { diff --git a/src/components/form/FieldTypeCheckboxDateTime.tsx b/src/components/form/FieldTypeCheckboxDateTime.tsx index bcc8627b1..3d719be2c 100644 --- a/src/components/form/FieldTypeCheckboxDateTime.tsx +++ b/src/components/form/FieldTypeCheckboxDateTime.tsx @@ -28,7 +28,7 @@ class FieldTypeCheckboxDateTime extends PureComponent { onBlur(value ? null : defaultValue ? defaultValue : new Date().toISOString()); }; - render(): React.ReactNode { + render(): JSX.Element { const { disabled = false, displayError = false, diff --git a/src/components/form/FieldTypeContactSelect.tsx b/src/components/form/FieldTypeContactSelect.tsx index 9476b6b20..76f1db28f 100644 --- a/src/components/form/FieldTypeContactSelect.tsx +++ b/src/components/form/FieldTypeContactSelect.tsx @@ -1,10 +1,10 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { getContentContact } from "contacts/helpers"; -import { addEmptyOption, sortStringByKeyAsc } from "util/helpers"; -import { fetchContacts } from "contacts/requestsAsync"; -import type { UserServiceUnit } from "usersPermissions/types"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { getContentContact } from "@/contacts/helpers"; +import { addEmptyOption, sortStringByKeyAsc } from "@/util/helpers"; +import { fetchContacts } from "@/contacts/requestsAsync"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { disabled?: boolean; displayError: boolean; @@ -23,7 +23,7 @@ const FieldTypeContactSelect = ({ onChange, placeholder, serviceUnit -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const getContacts = debounce(async (inputValue: string, callback: (...args: Array) => any) => { const contacts = await fetchContacts({ search: inputValue, diff --git a/src/components/form/FieldTypeDatePicker.tsx b/src/components/form/FieldTypeDatePicker.tsx index 688ec5b0d..989cca8b9 100644 --- a/src/components/form/FieldTypeDatePicker.tsx +++ b/src/components/form/FieldTypeDatePicker.tsx @@ -3,7 +3,7 @@ import DatePicker, { registerLocale } from "react-datepicker"; import parse from "date-fns/parse"; import fi from "date-fns/locale/fi"; import classNames from "classnames"; -import { isValidDate } from "util/date"; +import { isValidDate } from "@/util/date"; registerLocale('fi', fi); type Props = { disabled: boolean; @@ -29,7 +29,7 @@ const FieldTypeDatePicker = ({ maxDate, placeholder, setRefForField -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleSetReference = (element: any) => { if (setRefForField) { setRefForField(element); diff --git a/src/components/form/FieldTypeDecimal.tsx b/src/components/form/FieldTypeDecimal.tsx index f23d904ff..7b94bd90f 100644 --- a/src/components/form/FieldTypeDecimal.tsx +++ b/src/components/form/FieldTypeDecimal.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from "react"; import classNames from "classnames"; -import { formatNumber } from "util/helpers"; -import { convertStrToDecimalNumber, isDecimalNumberStr } from "util/helpers"; +import { formatNumber } from "@/util/helpers"; +import { convertStrToDecimalNumber, isDecimalNumberStr } from "@/util/helpers"; type Props = { autoBlur: boolean; autoComplete?: string; @@ -77,7 +77,7 @@ class FieldTypeDecimal extends PureComponent { } }; - render(): React.ReactNode { + render(): JSX.Element { const { autoComplete, disabled, diff --git a/src/components/form/FieldTypeFractional.tsx b/src/components/form/FieldTypeFractional.tsx index 90f330859..57e567feb 100644 --- a/src/components/form/FieldTypeFractional.tsx +++ b/src/components/form/FieldTypeFractional.tsx @@ -24,7 +24,7 @@ const FieldTypeFractional = ({ isDirty = false, setRefForField, input -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const firstFieldRef = useRef(null); const secondFieldRef = useRef(null); diff --git a/src/components/form/FieldTypeHidden.tsx b/src/components/form/FieldTypeHidden.tsx index 00c902a55..bce69c9f8 100644 --- a/src/components/form/FieldTypeHidden.tsx +++ b/src/components/form/FieldTypeHidden.tsx @@ -15,7 +15,7 @@ const FieldTypeHidden = ({ input, isDirty, setRefForField -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleSetRefForField = (element: any) => { if (setRefForField) { setRefForField(element); diff --git a/src/components/form/FieldTypeIntendedUseSelect.tsx b/src/components/form/FieldTypeIntendedUseSelect.tsx index 312c5ee08..98eed1d00 100644 --- a/src/components/form/FieldTypeIntendedUseSelect.tsx +++ b/src/components/form/FieldTypeIntendedUseSelect.tsx @@ -1,10 +1,10 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { addEmptyOption, sortStringByKeyAsc } from "util/helpers"; -import { getContentIntendedUse } from "leases/helpers"; -import { fetchIntendedUses } from "leases/requestsAsync"; -import type { ServiceUnit } from "serviceUnits/types"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { addEmptyOption, sortStringByKeyAsc } from "@/util/helpers"; +import { getContentIntendedUse } from "@/leases/helpers"; +import { fetchIntendedUses } from "@/leases/requestsAsync"; +import type { ServiceUnit } from "@/serviceUnits/types"; type Props = { disabled?: boolean; displayError: boolean; @@ -22,7 +22,7 @@ const FieldTypeIntendedUseSelect = ({ onChange, placeholder, serviceUnit -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const getIntendedUses = debounce(async (inputValue: string, callback: (...args: Array) => any) => { const intendedUses = await fetchIntendedUses({ search: inputValue, diff --git a/src/components/form/FieldTypeLeaseSelect.tsx b/src/components/form/FieldTypeLeaseSelect.tsx index 253f82201..1a2ec7ddd 100644 --- a/src/components/form/FieldTypeLeaseSelect.tsx +++ b/src/components/form/FieldTypeLeaseSelect.tsx @@ -1,10 +1,10 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { getContentLeaseOption } from "leases/helpers"; -import { addEmptyOption, sortStringByKeyAsc } from "util/helpers"; -import { fetchLeases } from "leases/requestsAsync"; -import type { UserServiceUnit } from "usersPermissions/types"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { getContentLeaseOption } from "@/leases/helpers"; +import { addEmptyOption, sortStringByKeyAsc } from "@/util/helpers"; +import { fetchLeases } from "@/leases/requestsAsync"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { disabled?: boolean; displayError: boolean; @@ -23,7 +23,7 @@ const FieldTypeLeaseSelect = ({ onChange, placeholder, serviceUnit -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const getLeases = debounce(async (inputValue: string, callback: (...args: Array) => any) => { const leases = await fetchLeases({ succinct: true, diff --git a/src/components/form/FieldTypeLessorSelect.tsx b/src/components/form/FieldTypeLessorSelect.tsx index 8d098eb6e..1e04dd90a 100644 --- a/src/components/form/FieldTypeLessorSelect.tsx +++ b/src/components/form/FieldTypeLessorSelect.tsx @@ -1,10 +1,10 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { getContentLessor } from "lessor/helpers"; -import { addEmptyOption, sortStringByKeyAsc } from "util/helpers"; -import { fetchContacts } from "contacts/requestsAsync"; -import type { UserServiceUnit } from "usersPermissions/types"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { getContentLessor } from "@/lessor/helpers"; +import { addEmptyOption, sortStringByKeyAsc } from "@/util/helpers"; +import { fetchContacts } from "@/contacts/requestsAsync"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { disabled?: boolean; displayError: boolean; @@ -23,7 +23,7 @@ const FieldTypeLessorSelect = ({ onChange, placeholder, serviceUnit -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const getLessors = debounce(async (inputValue: string, callback: (...args: Array) => any) => { const lessors = await fetchContacts({ is_lessor: true, diff --git a/src/components/form/FieldTypeMultiSelect.tsx b/src/components/form/FieldTypeMultiSelect.tsx index d244205b4..04863cd24 100644 --- a/src/components/form/FieldTypeMultiSelect.tsx +++ b/src/components/form/FieldTypeMultiSelect.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import MultiSelect from "components/multi-select/MultiSelect"; +import MultiSelect from "@/components/multi-select/MultiSelect"; type Props = { disabled: boolean; displayError: boolean; @@ -23,7 +23,7 @@ const FieldTypeMultiSelect = ({ isDirty, isLoading = false, options -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleBlur = (selected: Array) => onBlur(selected); return
{ +}: Props): JSX.Element => { const handleChange = (e: any) => { if (autoBlur) { onBlur(e.target.value); diff --git a/src/components/form/FieldTypeSearch.tsx b/src/components/form/FieldTypeSearch.tsx index 78a784e70..c5896dea4 100644 --- a/src/components/form/FieldTypeSearch.tsx +++ b/src/components/form/FieldTypeSearch.tsx @@ -24,7 +24,7 @@ const FieldTypeSearch = ({ isDirty, placeholder, type = 'text' -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleChange = (e: any) => { if (autoBlur) { onBlur(e.target.value); diff --git a/src/components/form/FieldTypeSelect.tsx b/src/components/form/FieldTypeSelect.tsx index b9750fb23..0bc829fec 100644 --- a/src/components/form/FieldTypeSelect.tsx +++ b/src/components/form/FieldTypeSelect.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import Select from "react-select"; import classNames from "classnames"; -import DropdownIndicator from "components/inputs/DropdownIndicator"; -import LoadingIndicator from "components/inputs/SelectLoadingIndicator"; +import DropdownIndicator from "@/components/inputs/DropdownIndicator"; +import LoadingIndicator from "@/components/inputs/SelectLoadingIndicator"; type Props = { autoBlur: boolean; disabled: boolean; @@ -89,7 +89,7 @@ class FieldTypeSelect extends PureComponent { } }; - render(): React.ReactNode { + render(): JSX.Element { const { disabled, displayError, diff --git a/src/components/form/FieldTypeTextArea.tsx b/src/components/form/FieldTypeTextArea.tsx index 77da30bb8..b856b5cc8 100644 --- a/src/components/form/FieldTypeTextArea.tsx +++ b/src/components/form/FieldTypeTextArea.tsx @@ -29,7 +29,7 @@ const FieldTypeTextArea = ({ rows = 3, setRefForField, type = 'text' -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleChange = (e: any) => { if (autoBlur) { onBlur(e.target.value); diff --git a/src/components/form/FieldTypeTime.tsx b/src/components/form/FieldTypeTime.tsx index 71b8d4239..7d257d509 100644 --- a/src/components/form/FieldTypeTime.tsx +++ b/src/components/form/FieldTypeTime.tsx @@ -23,7 +23,7 @@ const FieldTypeTime = ({ isDirty = false, placeholder, setRefForField -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleSetReference = (element: any) => { if (setRefForField) { setRefForField(element); diff --git a/src/components/form/FieldTypeUserSelect.tsx b/src/components/form/FieldTypeUserSelect.tsx index 68c14d1de..f1919eabd 100644 --- a/src/components/form/FieldTypeUserSelect.tsx +++ b/src/components/form/FieldTypeUserSelect.tsx @@ -1,10 +1,10 @@ import React, { useEffect, useState, useRef } from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { getContentUser } from "users/helpers"; -import { addEmptyOption, sortStringByKeyAsc } from "util/helpers"; -import { fetchSingleUser, fetchUsers } from "users/requestsAsync"; -import type { UserServiceUnit } from "usersPermissions/types"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { getContentUser } from "@/users/helpers"; +import { addEmptyOption, sortStringByKeyAsc } from "@/util/helpers"; +import { fetchSingleUser, fetchUsers } from "@/users/requestsAsync"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { disabled?: boolean; displayError: boolean; @@ -26,7 +26,7 @@ const FieldTypeUserSelect = ({ placeholder, multiSelect, serviceUnit -}: Props): React.ReactNode => { +}: Props): JSX.Element => { // If a plain ID value has already been set when the component mounts, // retrieve the corresponding single user object and set the state up accordingly // so that we can show the user's name in the closed dropdown properly. diff --git a/src/components/form/FormField.tsx b/src/components/form/FormField.tsx index 8be2c386e..570b11b46 100644 --- a/src/components/form/FormField.tsx +++ b/src/components/form/FormField.tsx @@ -4,39 +4,39 @@ import { Field } from "redux-form"; import classNames from "classnames"; import get from "lodash/get"; import ErrorBlock from "./ErrorBlock"; -import ExternalLink from "components/links/ExternalLink"; -import FieldTypeAddress from "components/form/FieldTypeAddress"; -import FieldTypeBasic from "components/form/FieldTypeBasic"; -import FieldTypeBoolean from "components/form/FieldTypeBoolean"; -import FieldTypeCheckbox from "components/form/FieldTypeCheckbox"; -import FieldTypeCheckboxDateTime from "components/form/FieldTypeCheckboxDateTime"; -import FieldTypeContactSelect from "components/form/FieldTypeContactSelect"; -import FieldTypeDatePicker from "components/form/FieldTypeDatePicker"; -import FieldTypeDecimal from "components/form/FieldTypeDecimal"; -import FieldTypeIntendedUseSelect from "components/form/FieldTypeIntendedUseSelect"; -import FieldTypeLeaseSelect from "components/form/FieldTypeLeaseSelect"; -import FieldTypeLessorSelect from "components/form/FieldTypeLessorSelect"; -import FieldTypeMultiSelect from "components/form/FieldTypeMultiSelect"; -import FieldTypeRadioWithField from "components/form/FieldTypeRadioWithField"; -import FieldTypeSearch from "components/form/FieldTypeSearch"; -import FieldTypeSelect from "components/form/FieldTypeSelect"; -import FieldTypeTextArea from "components/form/FieldTypeTextArea"; -import FieldTypeUserSelect from "components/form/FieldTypeUserSelect"; -import FormFieldLabel from "components/form/FormFieldLabel"; -import FieldTypeTime from "components/form/FieldTypeTime"; -import FieldTypeHidden from "components/form/FieldTypeHidden"; -import FieldTypeFractional from "components/form/FieldTypeFractional"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import { FieldTypes as FieldTypeOptions } from "enums"; -import { getContactFullName } from "contacts/helpers"; -import { formatDate, formatNumber, getFieldAttributeOptions, getLabelOfOption, isEmptyValue, getReferenceNumberLink } from "util/helpers"; -import { getUserFullName } from "users/helpers"; -import { genericNormalizer } from "components/form/normalizers"; -import { getRouteById, Routes } from "root/routes"; -import { genericValidator } from "components/form/validations"; -import { getHoursAndMinutes } from "util/date"; -import type { UserServiceUnit } from "usersPermissions/types"; +import ExternalLink from "@/components/links/ExternalLink"; +import FieldTypeAddress from "@/components/form/FieldTypeAddress"; +import FieldTypeBasic from "@/components/form/FieldTypeBasic"; +import FieldTypeBoolean from "@/components/form/FieldTypeBoolean"; +import FieldTypeCheckbox from "@/components/form/FieldTypeCheckbox"; +import FieldTypeCheckboxDateTime from "@/components/form/FieldTypeCheckboxDateTime"; +import FieldTypeContactSelect from "@/components/form/FieldTypeContactSelect"; +import FieldTypeDatePicker from "@/components/form/FieldTypeDatePicker"; +import FieldTypeDecimal from "@/components/form/FieldTypeDecimal"; +import FieldTypeIntendedUseSelect from "@/components/form/FieldTypeIntendedUseSelect"; +import FieldTypeLeaseSelect from "@/components/form/FieldTypeLeaseSelect"; +import FieldTypeLessorSelect from "@/components/form/FieldTypeLessorSelect"; +import FieldTypeMultiSelect from "@/components/form/FieldTypeMultiSelect"; +import FieldTypeRadioWithField from "@/components/form/FieldTypeRadioWithField"; +import FieldTypeSearch from "@/components/form/FieldTypeSearch"; +import FieldTypeSelect from "@/components/form/FieldTypeSelect"; +import FieldTypeTextArea from "@/components/form/FieldTypeTextArea"; +import FieldTypeUserSelect from "@/components/form/FieldTypeUserSelect"; +import FormFieldLabel from "@/components/form/FormFieldLabel"; +import FieldTypeTime from "@/components/form/FieldTypeTime"; +import FieldTypeHidden from "@/components/form/FieldTypeHidden"; +import FieldTypeFractional from "@/components/form/FieldTypeFractional"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import { FieldTypes as FieldTypeOptions } from "@/enums"; +import { getContactFullName } from "@/contacts/helpers"; +import { formatDate, formatNumber, getFieldAttributeOptions, getLabelOfOption, isEmptyValue, getReferenceNumberLink } from "@/util/helpers"; +import { getUserFullName } from "@/users/helpers"; +import { genericNormalizer } from "@/components/form/normalizers"; +import { getRouteById, Routes } from "@/root/routes"; +import { genericValidator } from "@/components/form/validations"; +import { getHoursAndMinutes } from "@/util/date"; +import type { UserServiceUnit } from "@/usersPermissions/types"; const FieldTypes = { [FieldTypeOptions.ADDRESS]: FieldTypeAddress, [FieldTypeOptions.BOOLEAN]: FieldTypeBoolean, @@ -171,9 +171,12 @@ const FormFieldInput = ({ case FieldTypeOptions.STRING: case FieldTypeOptions.HIDDEN: case FieldTypeOptions.FRACTIONAL: - case FieldTypeOptions.INTENDED_USE: + case FieldTypeOptions.TEXTAREA: return value; + case FieldTypeOptions.INTENDED_USE: + return value?.name ?? '-'; + case FieldTypeOptions.REFERENCE_NUMBER: return value ? : null; @@ -381,7 +384,7 @@ class FormField extends PureComponent { return validate(value); }; - render(): React.ReactNode { + render(): JSX.Element { const { autoBlur, autoComplete, diff --git a/src/components/form/FormFieldLabel.tsx b/src/components/form/FormFieldLabel.tsx index f75ddf4b5..1867b9704 100644 --- a/src/components/form/FormFieldLabel.tsx +++ b/src/components/form/FormFieldLabel.tsx @@ -2,7 +2,7 @@ import { $Shape } from "utility-types"; import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import classNames from "classnames"; -import UIDataTooltip from "components/tooltip/UIDataTooltip"; +import UIDataTooltip from "@/components/tooltip/UIDataTooltip"; type Props = { children?: any; className?: string; @@ -67,7 +67,7 @@ class FormFieldLabel extends PureComponent { }); }; - render(): React.ReactNode { + render(): JSX.Element { const { children, className, diff --git a/src/components/form/FormHintText.tsx b/src/components/form/FormHintText.tsx index 57c009a3a..bbd6fa4a2 100644 --- a/src/components/form/FormHintText.tsx +++ b/src/components/form/FormHintText.tsx @@ -6,7 +6,7 @@ type Props = { style?: Record; }; -const FormHintText = (props: Props): React.ReactNode => { +const FormHintText = (props: Props): JSX.Element => { const { children, className, diff --git a/src/components/form/FormText.tsx b/src/components/form/FormText.tsx index 5026574a0..b9d6643a9 100644 --- a/src/components/form/FormText.tsx +++ b/src/components/form/FormText.tsx @@ -6,7 +6,7 @@ type Props = { style?: Record; }; -const FormText = (props: Props): React.ReactNode => { +const FormText = (props: Props): JSX.Element => { const { children, className, diff --git a/src/components/form/FormTextTitle.tsx b/src/components/form/FormTextTitle.tsx index 79e2918f7..b94d1c6d3 100644 --- a/src/components/form/FormTextTitle.tsx +++ b/src/components/form/FormTextTitle.tsx @@ -2,7 +2,7 @@ import { $Shape } from "utility-types"; import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import classNames from "classnames"; -import UIDataTooltip from "components/tooltip/UIDataTooltip"; +import UIDataTooltip from "@/components/tooltip/UIDataTooltip"; type Props = { children?: any; enableUiDataEdit?: boolean; @@ -68,7 +68,7 @@ class FormTextTitle extends PureComponent { }); }; - render(): React.ReactNode { + render(): JSX.Element { const { children, enableUiDataEdit, diff --git a/src/components/form/FormTitleAndText.tsx b/src/components/form/FormTitleAndText.tsx index 663fcb6b6..3060aff5b 100644 --- a/src/components/form/FormTitleAndText.tsx +++ b/src/components/form/FormTitleAndText.tsx @@ -1,6 +1,6 @@ import React from "react"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; type Props = { text: any; textClassName?: string; @@ -11,7 +11,7 @@ const FormTitleAndText = ({ text, textClassName, title -}: Props): React.ReactNode => { +}: Props): JSX.Element => { return
{text} diff --git a/src/components/form/FormWrapper.tsx b/src/components/form/FormWrapper.tsx index 84c1fb0a0..1c15d706d 100644 --- a/src/components/form/FormWrapper.tsx +++ b/src/components/form/FormWrapper.tsx @@ -5,6 +5,6 @@ type Props = { const FormWrapper = ({ children -}: Props): React.ReactNode =>
{children}
; +}: Props): JSX.Element =>
{children}
; export default FormWrapper; \ No newline at end of file diff --git a/src/components/form/FormWrapperLeft.tsx b/src/components/form/FormWrapperLeft.tsx index 350ff3442..31380e50a 100644 --- a/src/components/form/FormWrapperLeft.tsx +++ b/src/components/form/FormWrapperLeft.tsx @@ -5,6 +5,6 @@ type Props = { const FormWrapperLeft = ({ children -}: Props): React.ReactNode =>
{children}
; +}: Props): JSX.Element =>
{children}
; export default FormWrapperLeft; \ No newline at end of file diff --git a/src/components/form/FormWrapperRight.tsx b/src/components/form/FormWrapperRight.tsx index e98b510f9..273752bde 100644 --- a/src/components/form/FormWrapperRight.tsx +++ b/src/components/form/FormWrapperRight.tsx @@ -5,6 +5,6 @@ type Props = { const FormWrapperRight = ({ children -}: Props): React.ReactNode =>
{children}
; +}: Props): JSX.Element =>
{children}
; export default FormWrapperRight; \ No newline at end of file diff --git a/src/components/form/RemoveButton.tsx b/src/components/form/RemoveButton.tsx index d8812b907..98e434c7b 100644 --- a/src/components/form/RemoveButton.tsx +++ b/src/components/form/RemoveButton.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { createClassName, generalClassNames, GeneralPropTypes } from "foundation/utils"; -import TrashIcon from "components/icons/TrashIcon"; +import { createClassName, generalClassNames, GeneralPropTypes } from "@/foundation/utils"; +import TrashIcon from "@/components/icons/TrashIcon"; type Props = { className?: string; disabled?: boolean; @@ -10,7 +10,7 @@ type Props = { type?: "button" | "submit" | "reset"; }; -const RemoveButton = (props: Props): React.ReactNode => { +const RemoveButton = (props: Props): JSX.Element => { const { className, disabled, diff --git a/src/components/form/SuccessField.tsx b/src/components/form/SuccessField.tsx index 5846511a5..9cd3802c7 100644 --- a/src/components/form/SuccessField.tsx +++ b/src/components/form/SuccessField.tsx @@ -11,7 +11,7 @@ const SuccessField = ({ }, showWarning = true, style -}: Props): React.ReactNode => { +}: Props): JSX.Element => { return showWarning && warning ? {warning} : null; }; diff --git a/src/components/form/UnarchiveButton.tsx b/src/components/form/UnarchiveButton.tsx index 9e37ec864..e0a85e2ee 100644 --- a/src/components/form/UnarchiveButton.tsx +++ b/src/components/form/UnarchiveButton.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import UnarchiveIcon from "components/icons/UnarchiveIcon"; +import UnarchiveIcon from "@/components/icons/UnarchiveIcon"; type Props = { className?: string; disabled?: boolean; @@ -15,7 +15,7 @@ const UnarchiveButton = ({ onClick, title, type = 'button' -}: Props): React.ReactNode => ; diff --git a/src/components/form/WarningField.tsx b/src/components/form/WarningField.tsx index 4536c95c3..d1fc5021b 100644 --- a/src/components/form/WarningField.tsx +++ b/src/components/form/WarningField.tsx @@ -11,7 +11,7 @@ const WarningField = ({ }, showWarning = true, style -}: Props): React.ReactNode => { +}: Props): JSX.Element => { return showWarning && warning ? {warning} : null; }; diff --git a/src/components/form/normalizers.ts b/src/components/form/normalizers.ts index 2f0e95116..e2d97774f 100644 --- a/src/components/form/normalizers.ts +++ b/src/components/form/normalizers.ts @@ -1,5 +1,5 @@ import format from "date-fns/format"; -import { FieldTypes } from "enums"; +import { FieldTypes } from "@/enums"; export const normalizeDate = (date: any): string | null => date && format(new Date(date), 'yyyy-MM-dd') || null; export const normalizeInteger = (value: any): any => value && Number.isInteger(Number(value)) ? Number(value) : value; export const genericNormalizer = (value: any, options: Record): any => { diff --git a/src/components/form/validations.ts b/src/components/form/validations.ts index b5d928a95..c0b05dd19 100644 --- a/src/components/form/validations.ts +++ b/src/components/form/validations.ts @@ -1,7 +1,7 @@ import isBefore from "date-fns/isBefore"; import isArray from "lodash/isArray"; -import { isValidDate } from "util/date"; -import { isEmptyValue } from "util/helpers"; +import { isValidDate } from "@/util/date"; +import { isEmptyValue } from "@/util/helpers"; const decimalPlaces = n => { let result = /^-?[0-9]+\.([0-9]+)$/.exec(n); diff --git a/src/components/formValidations.ts b/src/components/formValidations.ts index ae659f212..49c44c0fb 100644 --- a/src/components/formValidations.ts +++ b/src/components/formValidations.ts @@ -1,5 +1,5 @@ import { RentCalculatorTypes } from "./enums"; -import { isEmptyValue } from "util/helpers"; +import { isEmptyValue } from "@/util/helpers"; import { year } from "./form/validations"; export const validateRentCalculatorForm = (values: Record) => { const errors: any = {}; diff --git a/src/components/helpers.ts b/src/components/helpers.ts index ccd664908..47210c68e 100644 --- a/src/components/helpers.ts +++ b/src/components/helpers.ts @@ -1,9 +1,9 @@ import get from "lodash/get"; import { RentExplanationSubjectType, RentSubItemSubjectType, RentSubItemType } from "./enums"; -import { LeaseRentsFieldPaths, LeaseRentAdjustmentsFieldPaths, LeaseRentContractRentsFieldPaths, TenantContactType } from "leases/enums"; -import { formatNumber, getFieldOptions, getLabelOfOption } from "util/helpers"; +import { LeaseRentsFieldPaths, LeaseRentAdjustmentsFieldPaths, LeaseRentContractRentsFieldPaths, TenantContactType } from "@/leases/enums"; +import { formatNumber, getFieldOptions, getLabelOfOption } from "@/util/helpers"; import type { Attributes } from "types"; -import type { BillingPeriod, BillingPeriodInvoice, PreviewInvoices } from "previewInvoices/types"; +import type { BillingPeriod, BillingPeriodInvoice, PreviewInvoices } from "@/previewInvoices/types"; export const getRentsTotalAmount = (rents: Array>) => { let amount = 0; rents.forEach(rent => { diff --git a/src/components/inputs/EstateIdSelectInput.tsx b/src/components/inputs/EstateIdSelectInput.tsx index fa99bf974..2551fef3f 100644 --- a/src/components/inputs/EstateIdSelectInput.tsx +++ b/src/components/inputs/EstateIdSelectInput.tsx @@ -1,7 +1,7 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { fetchEstateIdList } from "landUseContract/requestsAsync"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { fetchEstateIdList } from "@/landUseContract/requestsAsync"; type Props = { disabled?: boolean; name: string; diff --git a/src/components/inputs/LeaseSelectInput.tsx b/src/components/inputs/LeaseSelectInput.tsx index 6629f6187..38e3460e0 100644 --- a/src/components/inputs/LeaseSelectInput.tsx +++ b/src/components/inputs/LeaseSelectInput.tsx @@ -1,14 +1,14 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { getContentLeaseIdentifier } from "leases/helpers"; -import { fetchLeases } from "leases/requestsAsync"; -import { fetchAreaSearches, fetchTargetStatuses, fetchPlotSearches } from "leases/requestsAsync"; -import { getLabelOfOption, getFieldOptions } from "util/helpers"; -import { getAttributes as getLeaseAttributes } from "leases/selectors"; -import { store } from "root/startApp"; -import { LeaseFieldPaths, LeaseHistoryItemTypes, LeaseHistoryContentTypes } from "leases/enums"; -import type { UserServiceUnit } from "usersPermissions/types"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { getContentLeaseIdentifier } from "@/leases/helpers"; +import { fetchLeases } from "@/leases/requestsAsync"; +import { fetchAreaSearches, fetchTargetStatuses, fetchPlotSearches } from "@/leases/requestsAsync"; +import { getLabelOfOption, getFieldOptions } from "@/util/helpers"; +import { getAttributes as getLeaseAttributes } from "@/leases/selectors"; +import { store } from "@/index"; +import { LeaseFieldPaths, LeaseHistoryItemTypes, LeaseHistoryContentTypes } from "@/leases/enums"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { disabled?: boolean; name: string; diff --git a/src/components/inputs/PlanUnitSelectInput.tsx b/src/components/inputs/PlanUnitSelectInput.tsx index 95537db6a..5573d9a88 100644 --- a/src/components/inputs/PlanUnitSelectInput.tsx +++ b/src/components/inputs/PlanUnitSelectInput.tsx @@ -1,8 +1,8 @@ import React from "react"; import debounce from "lodash/debounce"; -import AsyncSelect from "components/form/AsyncSelect"; -import { getContentPlanUnitIdentifier } from "plotSearch/helpers"; -import { fetchPlanUnitListWithIdentifiersList, fetchCustomDetailedPlanListWithIdentifiersList } from "plotSearch/requestsAsync"; +import AsyncSelect from "@/components/form/AsyncSelect"; +import { getContentPlanUnitIdentifier } from "@/plotSearch/helpers"; +import { fetchPlanUnitListWithIdentifiersList, fetchCustomDetailedPlanListWithIdentifiersList } from "@/plotSearch/requestsAsync"; type Props = { disabled?: boolean; name: string; @@ -19,7 +19,7 @@ const PlanUnitSelectInput = ({ onBlur, placeholder, value -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const getPlanUnitOptions = (planUnitList: Array>, customDetailedPlanList: Array>): Array> => { return [...planUnitList, ...customDetailedPlanList].map(planUnit => { return { diff --git a/src/components/inputs/SelectLoadingIndicator.tsx b/src/components/inputs/SelectLoadingIndicator.tsx index 97900477b..8f6ca7176 100644 --- a/src/components/inputs/SelectLoadingIndicator.tsx +++ b/src/components/inputs/SelectLoadingIndicator.tsx @@ -1,7 +1,7 @@ // flow import React from "react"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; const SelectLoadingIndicator = () => diff --git a/src/components/inputs/SingleRadioInput.tsx b/src/components/inputs/SingleRadioInput.tsx index 72f0cbb98..12abf2cf3 100644 --- a/src/components/inputs/SingleRadioInput.tsx +++ b/src/components/inputs/SingleRadioInput.tsx @@ -1,6 +1,6 @@ import React, { Fragment } from "react"; import classNames from "classnames"; -import { KeyCodes } from "enums"; +import { KeyCodes } from "@/enums"; type Props = { checked: boolean; disabled?: boolean; diff --git a/src/components/inputs/UserServiceUnitSelectInput.tsx b/src/components/inputs/UserServiceUnitSelectInput.tsx index 9c9f57b75..2cca1dfc6 100644 --- a/src/components/inputs/UserServiceUnitSelectInput.tsx +++ b/src/components/inputs/UserServiceUnitSelectInput.tsx @@ -3,12 +3,12 @@ import flowRight from "lodash/flowRight"; import { connect } from "react-redux"; import { reduxForm } from "redux-form"; import Select from "react-select"; -import FormFieldLabel from "components/form/FormFieldLabel"; -import DropdownIndicator from "components/inputs/DropdownIndicator"; -import LoadingIndicator from "components/inputs/SelectLoadingIndicator"; -import { FormNames } from "enums"; -import { setUserActiveServiceUnit } from "usersPermissions/actions"; -import type { UserServiceUnit, UserServiceUnits } from "usersPermissions/types"; +import FormFieldLabel from "@/components/form/FormFieldLabel"; +import DropdownIndicator from "@/components/inputs/DropdownIndicator"; +import LoadingIndicator from "@/components/inputs/SelectLoadingIndicator"; +import { FormNames } from "@/enums"; +import { setUserActiveServiceUnit } from "@/usersPermissions/actions"; +import type { UserServiceUnit, UserServiceUnits } from "@/usersPermissions/types"; type Props = { userServiceUnits: UserServiceUnits; userActiveServiceUnit: UserServiceUnit; diff --git a/src/components/invoice-simulator/InvoiceSimulator.tsx b/src/components/invoice-simulator/InvoiceSimulator.tsx index a50ed71fb..fc061923d 100644 --- a/src/components/invoice-simulator/InvoiceSimulator.tsx +++ b/src/components/invoice-simulator/InvoiceSimulator.tsx @@ -3,28 +3,28 @@ import { connect } from "react-redux"; import classNames from "classnames"; import { formValueSelector, isValid } from "redux-form"; import { Row, Column } from "react-foundation"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import Button from "components/button/Button"; -import FormText from "components/form/FormText"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import Button from "@/components/button/Button"; +import FormText from "@/components/form/FormText"; import InvoiceSimulatorBillingPeriod from "./InvoiceSimulatorBillingPeriods"; import InvoiceSimulatorForm from "./InvoiceSimulatorForm"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import { fetchPreviewInvoices } from "previewInvoices/actions"; -import { FormNames, PermissionMissingTexts } from "enums"; -import { ButtonColors } from "components/enums"; -import { InvoiceFieldPaths, InvoiceRowsFieldPaths } from "invoices/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getContentPreviewInvoiceBillingPeriods } from "components/helpers"; -import { getFieldOptions, hasPermissions } from "util/helpers"; -import { getAttributes as getInvoiceAttributes } from "invoices/selectors"; -import { getCurrentLease } from "leases/selectors"; -import { getIsFetching, getPreviewInvoices } from "previewInvoices/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import { fetchPreviewInvoices } from "@/previewInvoices/actions"; +import { FormNames, PermissionMissingTexts } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { InvoiceFieldPaths, InvoiceRowsFieldPaths } from "@/invoices/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getContentPreviewInvoiceBillingPeriods } from "@/components/helpers"; +import { getFieldOptions, hasPermissions } from "@/util/helpers"; +import { getAttributes as getInvoiceAttributes } from "@/invoices/selectors"; +import { getCurrentLease } from "@/leases/selectors"; +import { getIsFetching, getPreviewInvoices } from "@/previewInvoices/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; import type { Attributes } from "types"; -import type { Lease } from "leases/types"; -import type { PreviewInvoices } from "previewInvoices/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import type { Lease } from "@/leases/types"; +import type { PreviewInvoices } from "@/previewInvoices/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { currentLease: Lease; fetchPreviewInvoices: (...args: Array) => any; diff --git a/src/components/invoice-simulator/InvoiceSimulatorBillingPeriods.tsx b/src/components/invoice-simulator/InvoiceSimulatorBillingPeriods.tsx index 0d6ec14ae..f545538f4 100644 --- a/src/components/invoice-simulator/InvoiceSimulatorBillingPeriods.tsx +++ b/src/components/invoice-simulator/InvoiceSimulatorBillingPeriods.tsx @@ -1,13 +1,13 @@ import React, { Fragment } from "react"; import { Row, Column } from "react-foundation"; -import AmountWithVat from "components/vat/AmountWithVat"; -import Collapse from "components/collapse/Collapse"; -import CollapseHeaderSubtitle from "components/collapse/CollapseHeaderSubtitle"; -import RentCalculatorExplanation from "components/rent-calculator/RentCalculatorExplanation"; -import FormTitleAndText from "components/form/FormTitleAndText"; +import AmountWithVat from "@/components/vat/AmountWithVat"; +import Collapse from "@/components/collapse/Collapse"; +import CollapseHeaderSubtitle from "@/components/collapse/CollapseHeaderSubtitle"; +import RentCalculatorExplanation from "@/components/rent-calculator/RentCalculatorExplanation"; +import FormTitleAndText from "@/components/form/FormTitleAndText"; import InvoiceSimulatorInvoice from "./InvoiceSimulatorInvoice"; -import SubTitle from "components/content/SubTitle"; -import { formatDate, formatDateRange } from "util/helpers"; +import SubTitle from "@/components/content/SubTitle"; +import { formatDate, formatDateRange } from "@/util/helpers"; type Props = { dueDate: string; endDate: string; diff --git a/src/components/invoice-simulator/InvoiceSimulatorForm.tsx b/src/components/invoice-simulator/InvoiceSimulatorForm.tsx index d72255d7d..e433d8f6a 100644 --- a/src/components/invoice-simulator/InvoiceSimulatorForm.tsx +++ b/src/components/invoice-simulator/InvoiceSimulatorForm.tsx @@ -3,11 +3,11 @@ import { connect } from "react-redux"; import { change, formValueSelector, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import FormField from "components/form/FormField"; -import { FormNames } from "enums"; -import { getCurrentYear } from "util/date"; -import { getCurrentLease } from "leases/selectors"; -import { getBillingPeriodsByLease } from "billingPeriods/selectors"; +import FormField from "@/components/form/FormField"; +import { FormNames } from "@/enums"; +import { getCurrentYear } from "@/util/date"; +import { getCurrentLease } from "@/leases/selectors"; +import { getBillingPeriodsByLease } from "@/billingPeriods/selectors"; type Props = { onSubmit: (...args: Array) => any; }; diff --git a/src/components/invoice-simulator/InvoiceSimulatorInvoice.tsx b/src/components/invoice-simulator/InvoiceSimulatorInvoice.tsx index afbe89dd7..fb40abe3f 100644 --- a/src/components/invoice-simulator/InvoiceSimulatorInvoice.tsx +++ b/src/components/invoice-simulator/InvoiceSimulatorInvoice.tsx @@ -1,14 +1,14 @@ import React, { Fragment } from "react"; import { Row, Column } from "react-foundation"; -import AmountWithVat from "components/vat/AmountWithVat"; -import Collapse from "components/collapse/Collapse"; -import CollapseHeaderSubtitle from "components/collapse/CollapseHeaderSubtitle"; -import FormText from "components/form/FormText"; -import FormTitleAndText from "components/form/FormTitleAndText"; +import AmountWithVat from "@/components/vat/AmountWithVat"; +import Collapse from "@/components/collapse/Collapse"; +import CollapseHeaderSubtitle from "@/components/collapse/CollapseHeaderSubtitle"; +import FormText from "@/components/form/FormText"; +import FormTitleAndText from "@/components/form/FormTitleAndText"; import InvoiceSimulatorInvoiceRows from "./InvoiceSimulatorInvoiceRows"; -import SubTitle from "components/content/SubTitle"; -import { getContactFullName } from "contacts/helpers"; -import { formatDate, formatDateRange, getLabelOfOption } from "util/helpers"; +import SubTitle from "@/components/content/SubTitle"; +import { getContactFullName } from "@/contacts/helpers"; +import { formatDate, formatDateRange, getLabelOfOption } from "@/util/helpers"; type Props = { billedAmount: number; dueDate: string; diff --git a/src/components/invoice-simulator/InvoiceSimulatorInvoiceRows.tsx b/src/components/invoice-simulator/InvoiceSimulatorInvoiceRows.tsx index 890f114ad..6f1aa5669 100644 --- a/src/components/invoice-simulator/InvoiceSimulatorInvoiceRows.tsx +++ b/src/components/invoice-simulator/InvoiceSimulatorInvoiceRows.tsx @@ -1,11 +1,11 @@ import React from "react"; import { Row, Column } from "react-foundation"; -import AmountWithVat from "components/vat/AmountWithVat"; -import Divider from "components/content/Divider"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import { getContactFullName } from "contacts/helpers"; -import { getLabelOfOption } from "util/helpers"; +import AmountWithVat from "@/components/vat/AmountWithVat"; +import Divider from "@/components/content/Divider"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import { getContactFullName } from "@/contacts/helpers"; +import { getLabelOfOption } from "@/util/helpers"; type Props = { dueDate: string; receivableTypeOptions: Array>; diff --git a/src/components/ktj/KtjLink.tsx b/src/components/ktj/KtjLink.tsx index 303b4e063..dd400568c 100644 --- a/src/components/ktj/KtjLink.tsx +++ b/src/components/ktj/KtjLink.tsx @@ -1,10 +1,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import { saveAs } from "file-saver"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import { getApiToken } from "auth/selectors"; -import { displayUIMessage, getApiUrlWithOutVersionSuffix } from "util/helpers"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import { getApiToken } from "@/auth/selectors"; +import { displayUIMessage, getApiUrlWithOutVersionSuffix } from "@/util/helpers"; type Props = { apiToken: string; fileKey: string; diff --git a/src/components/links/DecisionLink.tsx b/src/components/links/DecisionLink.tsx index 366a4ff2e..60a7fb79b 100644 --- a/src/components/links/DecisionLink.tsx +++ b/src/components/links/DecisionLink.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { getLabelOfOption, getReferenceNumberLink } from "../../util/helpers"; -import FormText from "components/form/FormText"; +import { getLabelOfOption, getReferenceNumberLink } from "@/util/helpers"; +import FormText from "@/components/form/FormText"; type Props = { decision: Record | null | undefined; decisionOptions: Array>; diff --git a/src/components/links/ExternalLink.tsx b/src/components/links/ExternalLink.tsx index c5ec02d67..693a4b703 100644 --- a/src/components/links/ExternalLink.tsx +++ b/src/components/links/ExternalLink.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import ExternalLinkIcon from "components/icons/ExternalLinkIcon"; +import ExternalLinkIcon from "@/components/icons/ExternalLinkIcon"; type Props = { className?: string; href: string | null | undefined; diff --git a/src/components/map/HelsinkiProvider.ts b/src/components/map/HelsinkiProvider.ts index 742e6ee62..552ef733d 100644 --- a/src/components/map/HelsinkiProvider.ts +++ b/src/components/map/HelsinkiProvider.ts @@ -1,5 +1,5 @@ import { Provider } from 'leaflet-geosearch'; -import { SERVICE_MAP_URL } from 'util/constants'; +import { SERVICE_MAP_URL } from '@/util/constants'; import type { AddressResult, ServiceMapResponse, ParseArgument, SearchArgument, SearchResult } from './types'; export default class HelsinkiProvider extends Provider { options: Record; diff --git a/src/components/map/_leaflet.scss b/src/components/map/_leaflet.scss index 5fc1849c5..d74449d5a 100644 --- a/src/components/map/_leaflet.scss +++ b/src/components/map/_leaflet.scss @@ -284,7 +284,7 @@ margin-bottom: 0 !important; } .leaflet-control-layers-toggle { - background-image: url(../assets/images/layers-2x.png); + background-image: url(/assets/images/layers-2x.png); background-size: 70%; } .leaflet-bar a:hover { @@ -384,7 +384,7 @@ /* Default icon URLs */ .leaflet-default-icon-path { - //background-image: url(../assets/images/marker-icon.png); + background-image: url(/assets/images/marker-icon.png); } diff --git a/src/components/modal/ConfirmationModal.tsx b/src/components/modal/ConfirmationModal.tsx index 208901b60..b0e1b43aa 100644 --- a/src/components/modal/ConfirmationModal.tsx +++ b/src/components/modal/ConfirmationModal.tsx @@ -1,7 +1,7 @@ import React, { Component } from "react"; -import Button from "components/button/Button"; -import Modal from "components/modal/Modal"; -import { ButtonColors } from "components/enums"; +import Button from "@/components/button/Button"; +import Modal from "@/components/modal/Modal"; +import { ButtonColors } from "@/components/enums"; type Props = { confirmButtonClassName?: string | null | undefined; confirmButtonLabel?: string | null | undefined; @@ -27,7 +27,7 @@ class ConfirmationModal extends Component { } } - render(): React.ReactNode { + render(): JSX.Element { const { confirmButtonClassName, confirmButtonLabel = 'Tallenna', diff --git a/src/components/modal/Modal.tsx b/src/components/modal/Modal.tsx index 586e23524..c3f85f9b4 100644 --- a/src/components/modal/Modal.tsx +++ b/src/components/modal/Modal.tsx @@ -1,6 +1,6 @@ import React, { Component } from "react"; import classnames from "classnames"; -import CloseButton from "../button/CloseButton"; +import CloseButton from "@/components/button/CloseButton"; type Props = { children?: any; className?: string; @@ -50,7 +50,7 @@ class Modal extends Component { }); }; - render(): React.ReactNode { + render(): JSX.Element { const { children, className, diff --git a/src/components/modal/ModalButtonWrapper.tsx b/src/components/modal/ModalButtonWrapper.tsx index f2e4a9912..227e8e15e 100644 --- a/src/components/modal/ModalButtonWrapper.tsx +++ b/src/components/modal/ModalButtonWrapper.tsx @@ -5,6 +5,6 @@ type Props = { const ModalButtonWrapper = ({ children -}: Props): React.ReactNode =>
{children}
; +}: Props): JSX.Element =>
{children}
; export default ModalButtonWrapper; \ No newline at end of file diff --git a/src/components/multi-select/MultiSelect.tsx b/src/components/multi-select/MultiSelect.tsx index c5cabc0e9..63b3f44fb 100644 --- a/src/components/multi-select/MultiSelect.tsx +++ b/src/components/multi-select/MultiSelect.tsx @@ -34,7 +34,7 @@ const MultiSelect = ({ hasSelectAll = true, onSelectedChanged, valueRenderer -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const getSelectedText = () => { const selectedOptions = selected.map(s => options.find(o => o.value === s)); const selectedLabels = selectedOptions.map(s => s ? s.label : ''); diff --git a/src/components/rent-calculator/RentCalculator.tsx b/src/components/rent-calculator/RentCalculator.tsx index b760de2f2..f04655856 100644 --- a/src/components/rent-calculator/RentCalculator.tsx +++ b/src/components/rent-calculator/RentCalculator.tsx @@ -3,29 +3,29 @@ import { connect } from "react-redux"; import { formValueSelector, isValid } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import Button from "components/button/Button"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; +import Button from "@/components/button/Button"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; import RentCalculatorForm from "./RentCalculatorForm"; import RentForPeriod from "./RentForPeriod"; -import SubTitle from "components/content/SubTitle"; -import { fetchBillingPeriodsByLease } from "billingPeriods/actions"; -import { deleteRentForPeriodByLease, fetchRentForPeriodByLease, receiveIsSaveClicked } from "rentForPeriod/actions"; -import { FormNames } from "enums"; -import { ButtonColors, RentCalculatorFieldPaths, RentCalculatorFieldTitles, RentCalculatorTypes } from "components/enums"; -import { RentCycles } from "leases/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getContentRents } from "leases/helpers"; -import { hasPermissions } from "util/helpers"; -import { getCurrentYear } from "util/date"; -import { getUiDataRentCalculatorKey } from "uiData/helpers"; -import { getBillingPeriodsByLease } from "billingPeriods/selectors"; -import { getCurrentLease, getIsEditMode } from "leases/selectors"; -import { getIsFetching, getIsSaveClicked, getRentForPeriodArrayByLease } from "rentForPeriod/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import type { Lease } from "leases/types"; -import type { RentForPeriodId } from "rentForPeriod/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import SubTitle from "@/components/content/SubTitle"; +import { fetchBillingPeriodsByLease } from "@/billingPeriods/actions"; +import { deleteRentForPeriodByLease, fetchRentForPeriodByLease, receiveIsSaveClicked } from "@/rentForPeriod/actions"; +import { FormNames } from "@/enums"; +import { ButtonColors, RentCalculatorFieldPaths, RentCalculatorFieldTitles, RentCalculatorTypes } from "@/components/enums"; +import { RentCycles } from "@/leases/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getContentRents } from "@/leases/helpers"; +import { hasPermissions } from "@/util/helpers"; +import { getCurrentYear } from "@/util/date"; +import { getUiDataRentCalculatorKey } from "@/uiData/helpers"; +import { getBillingPeriodsByLease } from "@/billingPeriods/selectors"; +import { getCurrentLease, getIsEditMode } from "@/leases/selectors"; +import { getIsFetching, getIsSaveClicked, getRentForPeriodArrayByLease } from "@/rentForPeriod/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import type { Lease } from "@/leases/types"; +import type { RentForPeriodId } from "@/rentForPeriod/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; let rentForPeriodId = 1; type Props = { billingPeriod: number; diff --git a/src/components/rent-calculator/RentCalculatorExplanation.tsx b/src/components/rent-calculator/RentCalculatorExplanation.tsx index 33d30d2ca..1d7221aef 100644 --- a/src/components/rent-calculator/RentCalculatorExplanation.tsx +++ b/src/components/rent-calculator/RentCalculatorExplanation.tsx @@ -3,13 +3,13 @@ import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; import classNames from "classnames"; import get from "lodash/get"; -import AmountWithVat from "components/vat/AmountWithVat"; -import FormText from "components/form/FormText"; +import AmountWithVat from "@/components/vat/AmountWithVat"; +import FormText from "@/components/form/FormText"; import RentCalculatorSubItem from "./RentCalculatorSubItem"; -import { RentExplanationSubjectType } from "../enums"; -import { formatDateRange, formatNumber } from "util/helpers"; -import { getRentExplanationAmount, getRentExplanationDescription } from "../helpers"; -import { getAttributes } from "leases/selectors"; +import { RentExplanationSubjectType } from "@/components/enums"; +import { formatDateRange, formatNumber } from "@/util/helpers"; +import { getRentExplanationAmount, getRentExplanationDescription } from "@/components/helpers"; +import { getAttributes } from "@/leases/selectors"; import type { Attributes } from "types"; type Props = { attributes: Attributes; diff --git a/src/components/rent-calculator/RentCalculatorForm.tsx b/src/components/rent-calculator/RentCalculatorForm.tsx index 7e881c718..8ce94f880 100644 --- a/src/components/rent-calculator/RentCalculatorForm.tsx +++ b/src/components/rent-calculator/RentCalculatorForm.tsx @@ -3,16 +3,16 @@ import { connect } from "react-redux"; import { change, Field, formValueSelector, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import ErrorField from "components/form/ErrorField"; -import FormField from "components/form/FormField"; -import { FieldTypes, FormNames } from "enums"; -import { RentCalculatorTypes } from "components/enums"; -import { validateRentCalculatorForm } from "components/formValidations"; -import { formatDateRange } from "util/helpers"; -import { getCurrentYear } from "util/date"; -import { getCurrentLease } from "leases/selectors"; -import { getBillingPeriodsByLease } from "billingPeriods/selectors"; -import type { BillingPeriodList } from "billingPeriods/types"; +import ErrorField from "@/components/form/ErrorField"; +import FormField from "@/components/form/FormField"; +import { FieldTypes, FormNames } from "@/enums"; +import { RentCalculatorTypes } from "@/components/enums"; +import { validateRentCalculatorForm } from "@/components/formValidations"; +import { formatDateRange } from "@/util/helpers"; +import { getCurrentYear } from "@/util/date"; +import { getCurrentLease } from "@/leases/selectors"; +import { getBillingPeriodsByLease } from "@/billingPeriods/selectors"; +import type { BillingPeriodList } from "@/billingPeriods/types"; type Props = { billingPeriod: number | null | undefined; billingPeriods: BillingPeriodList; diff --git a/src/components/rent-calculator/RentCalculatorSubItem.tsx b/src/components/rent-calculator/RentCalculatorSubItem.tsx index e25a68f27..05a9186dc 100644 --- a/src/components/rent-calculator/RentCalculatorSubItem.tsx +++ b/src/components/rent-calculator/RentCalculatorSubItem.tsx @@ -3,11 +3,11 @@ import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; import classNames from "classnames"; import get from "lodash/get"; -import FormText from "components/form/FormText"; -import { RentSubItemSubjectType } from "components/enums"; -import { formatDateRange, formatNumber } from "util/helpers"; -import { getRentSubItemAmount, getRentSubItemDescription } from "../helpers"; -import { getAttributes } from "leases/selectors"; +import FormText from "@/components/form/FormText"; +import { RentSubItemSubjectType } from "@/components/enums"; +import { formatDateRange, formatNumber } from "@/util/helpers"; +import { getRentSubItemAmount, getRentSubItemDescription } from "@/components/helpers"; +import { getAttributes } from "@/leases/selectors"; import type { Attributes } from "types"; type Props = { attributes: Attributes; diff --git a/src/components/rent-calculator/RentCalculatorTotalRow.tsx b/src/components/rent-calculator/RentCalculatorTotalRow.tsx index 5443d493b..47d42ff9d 100644 --- a/src/components/rent-calculator/RentCalculatorTotalRow.tsx +++ b/src/components/rent-calculator/RentCalculatorTotalRow.tsx @@ -2,10 +2,10 @@ import React from "react"; import { Row, Column } from "react-foundation"; import isAfter from "date-fns/isAfter"; import get from "lodash/get"; -import AmountWithVat from "components/vat/AmountWithVat"; -import Divider from "components/content/Divider"; -import FormText from "components/form/FormText"; -import { getRentsTotalAmount } from "../helpers"; +import AmountWithVat from "@/components/vat/AmountWithVat"; +import Divider from "@/components/content/Divider"; +import FormText from "@/components/form/FormText"; +import { getRentsTotalAmount } from "@/components/helpers"; type Props = { rents: Array>; }; diff --git a/src/components/rent-calculator/RentForPeriod.tsx b/src/components/rent-calculator/RentForPeriod.tsx index cb20257bc..8716c6a03 100644 --- a/src/components/rent-calculator/RentForPeriod.tsx +++ b/src/components/rent-calculator/RentForPeriod.tsx @@ -1,13 +1,13 @@ import React from "react"; import { Row, Column } from "react-foundation"; import get from "lodash/get"; -import FormText from "components/form/FormText"; -import RemoveButton from "components/form/RemoveButton"; +import FormText from "@/components/form/FormText"; +import RemoveButton from "@/components/form/RemoveButton"; import RentCalculatorRent from "./RentCalculatorRent"; import RentCalculatorTotalRow from "./RentCalculatorTotalRow"; -import { RentCalculatorTypeOptions } from "components/constants"; -import { RentCalculatorTypes } from "components/enums"; -import { formatDateRange, getLabelOfOption } from "util/helpers"; +import { RentCalculatorTypeOptions } from "@/components/constants"; +import { RentCalculatorTypes } from "@/components/enums"; +import { formatDateRange, getLabelOfOption } from "@/util/helpers"; type Props = { onRemove: (...args: Array) => any; rentForPeriod: Record; diff --git a/src/components/resize/WindowResizeHandler.tsx b/src/components/resize/WindowResizeHandler.tsx index 86f8777de..3fce73801 100644 --- a/src/components/resize/WindowResizeHandler.tsx +++ b/src/components/resize/WindowResizeHandler.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from "react"; import throttle from "lodash/throttle"; -import { isLargeScreen } from "util/helpers"; +import { isLargeScreen } from "@/util/helpers"; export function withWindowResize(WrappedComponent: any) { type Props = Record; type State = { diff --git a/src/components/search/SearchContainer.tsx b/src/components/search/SearchContainer.tsx index a4a495800..d8951e32d 100644 --- a/src/components/search/SearchContainer.tsx +++ b/src/components/search/SearchContainer.tsx @@ -7,7 +7,7 @@ type Props = { const SearchContainer = ({ children, onSubmit -}: Props): React.ReactNode => // TODO: determine which components actually have an use for onSubmit and consider +}: Props): JSX.Element => // TODO: determine which components actually have an use for onSubmit and consider // making it optional. Several search components seem to provide a function that // they themselves take as props, but then that prop is never defined itself.
{children}
; diff --git a/src/components/search/SearchSubtitleLabel.tsx b/src/components/search/SearchSubtitleLabel.tsx index d748732ea..900da9998 100644 --- a/src/components/search/SearchSubtitleLabel.tsx +++ b/src/components/search/SearchSubtitleLabel.tsx @@ -7,6 +7,6 @@ type Props = { const SearchSubtitleLabel = ({ children, style -}: Props): React.ReactNode =>
{children}
; +}: Props): JSX.Element =>
{children}
; export default SearchSubtitleLabel; \ No newline at end of file diff --git a/src/components/sideMenu/SideMenu.tsx b/src/components/sideMenu/SideMenu.tsx index a8b873a4e..cbd479285 100644 --- a/src/components/sideMenu/SideMenu.tsx +++ b/src/components/sideMenu/SideMenu.tsx @@ -5,19 +5,19 @@ import { withRouter } from "react-router"; import classnames from "classnames"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import Authorization from "components/authorization/Authorization"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; +import Authorization from "@/components/authorization/Authorization"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; import SubMenu from "./SubMenu"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import { ConfirmationModalTexts } from "enums"; -import { ButtonColors } from "components/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { hasAnyPageDirtyForms } from "util/forms"; -import { hasPermissions } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { withUsersPermissions } from "components/attributes/UsersPermissions"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import { ConfirmationModalTexts } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { hasAnyPageDirtyForms } from "@/util/forms"; +import { hasPermissions } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { withUsersPermissions } from "@/components/attributes/UsersPermissions"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type OwnProps = { isOpen: boolean; onLinkClick: (...args: Array) => any; @@ -195,7 +195,7 @@ class SideMenu extends Component { color: '#b7b7b7' }} onClick={handleClick} to={getRouteById(Routes.LAND_USE_CONTRACTS)}>Maankäyttösopimukset - {process.env.NODE_ENV !== 'production' && { text: 'Tonttihakemukset', to: getRouteById(Routes.PLOT_APPLICATIONS) }]} menuKey='plot' onHeaderClick={this.handleHeaderClick} />} - {process.env.NODE_ENV !== 'production' && + {!import.meta.env.PROD &&
  • Aluehaut
  • } diff --git a/src/components/sideMenu/SubMenu.tsx b/src/components/sideMenu/SubMenu.tsx index 67a23a5c7..90f881dfa 100644 --- a/src/components/sideMenu/SubMenu.tsx +++ b/src/components/sideMenu/SubMenu.tsx @@ -2,9 +2,9 @@ import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; import { Link } from "react-router-dom"; import classNames from "classnames"; -import BackIcon from "components/icons/BackIcon"; -import Authorization from "components/authorization/Authorization"; -import { KeyCodes } from "enums"; +import BackIcon from "@/components/icons/BackIcon"; +import Authorization from "@/components/authorization/Authorization"; +import { KeyCodes } from "@/enums"; type Props = { header: string; isOpen: boolean; @@ -61,7 +61,7 @@ class SubMenu extends PureComponent { } }; - render(): React.ReactNode { + render(): JSX.Element { const { header, isOpen, diff --git a/src/components/table/MultiItemCollapse.tsx b/src/components/table/MultiItemCollapse.tsx index 7e40c2404..5033b1c8c 100644 --- a/src/components/table/MultiItemCollapse.tsx +++ b/src/components/table/MultiItemCollapse.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from "react"; import classNames from "classnames"; -import ListItem from "components/content/ListItem"; +import ListItem from "@/components/content/ListItem"; type Props = { items: Array; itemRenderer: (...args: Array) => any; diff --git a/src/components/table/SortableTable.tsx b/src/components/table/SortableTable.tsx index 7ce400088..af8be67be 100644 --- a/src/components/table/SortableTable.tsx +++ b/src/components/table/SortableTable.tsx @@ -8,8 +8,8 @@ import isEmpty from "lodash/isEmpty"; import SortableTableHeader from "./SortableTableHeader"; import SortableTableGroup from "./SortableTableGroup"; import SortableTableRow from "./SortableTableRow"; -import { sortStringByKeyAsc, sortStringByKeyDesc } from "util/helpers"; -import { TableSortOrder } from "enums"; +import { sortStringByKeyAsc, sortStringByKeyDesc } from "@/util/helpers"; +import { TableSortOrder } from "@/enums"; export type Column = { arrayRenderer?: (...args: Array) => any; dataClassName?: string; @@ -52,7 +52,7 @@ type Props = { className?: string; footer?: (arg0: { columnCount: number; - }) => React.ReactNode; + }) => JSX.Element; invoiceToCredit?: any; onSelectRow?: any; }; @@ -408,7 +408,7 @@ class SortableTable extends Component { return colSpan; }; - render(): React.ReactNode { + render(): JSX.Element { const { columns, fixedHeader, diff --git a/src/components/table/SortableTableGroup.tsx b/src/components/table/SortableTableGroup.tsx index 31a436da9..c845c587e 100644 --- a/src/components/table/SortableTableGroup.tsx +++ b/src/components/table/SortableTableGroup.tsx @@ -3,7 +3,7 @@ import React, { PureComponent, KeyboardEventHandler } from "react"; import classNames from "classnames"; import get from "lodash/get"; import isArray from "lodash/isArray"; -import AccordionIcon from "components/icons/AccordionIcon"; +import AccordionIcon from "@/components/icons/AccordionIcon"; import MultiItemCollapse from "./MultiItemCollapse"; import SortableTableRow from "./SortableTableRow"; import type { Column } from "./SortableTable"; @@ -56,7 +56,7 @@ class SortableTableGroup extends PureComponent { this.forceUpdate(); }; - render(): React.ReactNode { + render(): JSX.Element { const { columns, id, diff --git a/src/components/table/SortableTableHeader.tsx b/src/components/table/SortableTableHeader.tsx index 881d96e00..047afdafe 100644 --- a/src/components/table/SortableTableHeader.tsx +++ b/src/components/table/SortableTableHeader.tsx @@ -1,8 +1,8 @@ import React from "react"; import classNames from "classnames"; import kebabCase from "lodash/kebabCase"; -import { SortIconBoth, SortIconDesc, SortIconAsc } from "components/table/Icons"; -import { TableSortOrder } from "enums"; +import { SortIconBoth, SortIconDesc, SortIconAsc } from "@/components/table/Icons"; +import { TableSortOrder } from "@/enums"; import type { Column } from "./SortableTable"; type Props = { columns: Array; @@ -26,7 +26,7 @@ const SortableTableHeader = ({ sortable, sortKey, sortOrder -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const setTheadRef = (el: any) => { if (getRef) { getRef(el); diff --git a/src/components/table/SortableTableRow.tsx b/src/components/table/SortableTableRow.tsx index 6abaa6e3f..7edbc823b 100644 --- a/src/components/table/SortableTableRow.tsx +++ b/src/components/table/SortableTableRow.tsx @@ -3,7 +3,7 @@ import React, { PureComponent, KeyboardEventHandler } from "react"; import classNames from "classnames"; import get from "lodash/get"; import isArray from "lodash/isArray"; -import AccordionIcon from "components/icons/AccordionIcon"; +import AccordionIcon from "@/components/icons/AccordionIcon"; import MultiItemCollapse from "./MultiItemCollapse"; import type { Column } from "./SortableTable"; type Props = { @@ -103,7 +103,7 @@ class SortableTableRow extends PureComponent { this.forceUpdate(); }; - render(): React.ReactNode { + render(): JSX.Element { const { className, columns, diff --git a/src/components/table/TableFilters.tsx b/src/components/table/TableFilters.tsx index 9589ceef1..0942c2f6a 100644 --- a/src/components/table/TableFilters.tsx +++ b/src/components/table/TableFilters.tsx @@ -1,13 +1,13 @@ import React from "react"; import classNames from "classnames"; -import CheckboxInput from "components/inputs/CheckboxInput"; +import CheckboxInput from "@/components/inputs/CheckboxInput"; type Props = { alignFiltersRight?: boolean; amountText: React.ReactNode; filterOptions: Array>; filterValue: Array; onFilterChange?: (...args: Array) => any; - componentToRenderUnderTitle?: React.ReactNode; + componentToRenderUnderTitle?: JSX.Element; }; const TableFilters = ({ @@ -17,7 +17,7 @@ const TableFilters = ({ filterValue, onFilterChange, componentToRenderUnderTitle = null -}: Props): React.ReactNode => { +}: Props): JSX.Element => { const handleFilterChange = (values: Array>) => { if (onFilterChange) { onFilterChange(values); diff --git a/src/components/table/TablePanel.tsx b/src/components/table/TablePanel.tsx index 145c8843e..d4bb0e25d 100644 --- a/src/components/table/TablePanel.tsx +++ b/src/components/table/TablePanel.tsx @@ -1,5 +1,5 @@ import React from "react"; -import CloseButton from "components/button/CloseButton"; +import CloseButton from "@/components/button/CloseButton"; type Props = { children: any; onClose: (...args: Array) => any; diff --git a/src/components/table/TablePanelContainer.tsx b/src/components/table/TablePanelContainer.tsx index dbbe33d27..9ac8079ff 100644 --- a/src/components/table/TablePanelContainer.tsx +++ b/src/components/table/TablePanelContainer.tsx @@ -1,6 +1,6 @@ import React from "react"; import classNames from "classnames"; -import CloseButton from "components/button/CloseButton"; +import CloseButton from "@/components/button/CloseButton"; type Props = { footer?: any; children: any; diff --git a/src/components/tabs/Tabs.tsx b/src/components/tabs/Tabs.tsx index 09dca17a0..ebdbdf5b1 100644 --- a/src/components/tabs/Tabs.tsx +++ b/src/components/tabs/Tabs.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from "react"; import classNames from "classnames"; -import Authorization from "components/authorization/Authorization"; +import Authorization from "@/components/authorization/Authorization"; type Props = { active: number | null | undefined; className?: string; diff --git a/src/components/tooltip/Tooltip.tsx b/src/components/tooltip/Tooltip.tsx index fb8efcd6a..5f87352af 100644 --- a/src/components/tooltip/Tooltip.tsx +++ b/src/components/tooltip/Tooltip.tsx @@ -1,13 +1,13 @@ import React, { Component, Fragment } from "react"; import classNames from "classnames"; -import CloseButton from "components/button/CloseButton"; -import type { TooltipPosition } from "components/tooltip/types"; +import CloseButton from "@/components/button/CloseButton"; +import type { TooltipPosition } from "@/components/tooltip/types"; import ReactDOM from "react-dom"; type Props = { isOpen: boolean; className?: string | Record; onClose: (arg0: Event) => void; - children: React.ReactNode; + children: JSX.Element; relativeTo?: Element; }; type State = { @@ -112,7 +112,7 @@ class Tooltip extends Component { return 'bottom-right'; }; - render(): React.ReactNode { + render(): JSX.Element { const { isOpen, className, diff --git a/src/components/tooltip/TooltipToggleButton.tsx b/src/components/tooltip/TooltipToggleButton.tsx index a87f27677..50d315ed2 100644 --- a/src/components/tooltip/TooltipToggleButton.tsx +++ b/src/components/tooltip/TooltipToggleButton.tsx @@ -3,7 +3,7 @@ type Props = { className?: string; onClick: (arg0: React.MouseEvent) => void; style?: Record; - children: React.ReactNode; + children: JSX.Element; }; class TooltipToggleButton extends Component { @@ -19,7 +19,7 @@ class TooltipToggleButton extends Component { } }; - render(): React.ReactNode { + render(): JSX.Element { const { className, style, diff --git a/src/components/tooltip/TooltipWrapper.tsx b/src/components/tooltip/TooltipWrapper.tsx index ff2220dd6..2c90263fe 100644 --- a/src/components/tooltip/TooltipWrapper.tsx +++ b/src/components/tooltip/TooltipWrapper.tsx @@ -2,11 +2,11 @@ import React, { Component } from "react"; type Props = { style?: Record; innerRef?: any; - children: React.ReactNode; + children: JSX.Element; }; class TooltipWrapper extends Component { - render(): React.ReactNode { + render(): JSX.Element { const { style, innerRef, diff --git a/src/components/tooltip/UIDataTooltip.tsx b/src/components/tooltip/UIDataTooltip.tsx index 1ce078ec8..e2d07b50f 100644 --- a/src/components/tooltip/UIDataTooltip.tsx +++ b/src/components/tooltip/UIDataTooltip.tsx @@ -1,29 +1,29 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import isEmpty from "lodash/isEmpty"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddIcon from "components/icons/AddIcon"; -import Button from "components/button/Button"; -import ErrorBlock from "components/form/ErrorBlock"; -import FormFieldLabel from "components/form/FormFieldLabel"; -import InfoIcon from "components/icons/InfoIcon"; -import ModalButtonWrapper from "components/modal/ModalButtonWrapper"; -import TextAreaInput from "components/inputs/TextAreaInput"; -import { createUiData, deleteUiData, editUiData } from "uiData/actions"; -import { ConfirmationModalTexts } from "enums"; -import { ButtonColors } from "components/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getFieldAttributes, hasPermissions } from "util/helpers"; -import { getUiDataByKey } from "uiData/helpers"; -import { getAttributes as getUiDataAttributes, getUiDataList } from "uiData/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import { genericValidator } from "components/form/validations"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddIcon from "@/components/icons/AddIcon"; +import Button from "@/components/button/Button"; +import ErrorBlock from "@/components/form/ErrorBlock"; +import FormFieldLabel from "@/components/form/FormFieldLabel"; +import InfoIcon from "@/components/icons/InfoIcon"; +import ModalButtonWrapper from "@/components/modal/ModalButtonWrapper"; +import TextAreaInput from "@/components/inputs/TextAreaInput"; +import { createUiData, deleteUiData, editUiData } from "@/uiData/actions"; +import { ConfirmationModalTexts } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getFieldAttributes, hasPermissions } from "@/util/helpers"; +import { getUiDataByKey } from "@/uiData/helpers"; +import { getAttributes as getUiDataAttributes, getUiDataList } from "@/uiData/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import { genericValidator } from "@/components/form/validations"; import type { Attributes } from "types"; -import type { UiDataList } from "uiData/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; -import Tooltip from "components/tooltip/Tooltip"; -import TooltipWrapper from "components/tooltip/TooltipWrapper"; -import TooltipToggleButton from "components/tooltip/TooltipToggleButton"; +import type { UiDataList } from "@/uiData/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; +import Tooltip from "@/components/tooltip/Tooltip"; +import TooltipWrapper from "@/components/tooltip/TooltipWrapper"; +import TooltipToggleButton from "@/components/tooltip/TooltipToggleButton"; type OwnProps = { relativeTo?: Element; enableUiDataEdit?: boolean; diff --git a/src/components/topNavigation/TopNavigation.tsx b/src/components/topNavigation/TopNavigation.tsx index e92f3076a..dbea6059d 100644 --- a/src/components/topNavigation/TopNavigation.tsx +++ b/src/components/topNavigation/TopNavigation.tsx @@ -3,17 +3,17 @@ import classNames from "classnames"; import { withRouter } from "react-router"; import { Link } from "react-router-dom"; import { IconMenuDots } from "hds-react"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import MainMenuIcon from "../icons/MainMenuIcon"; -import SearchInput from "../inputs/SearchInput"; -import UserServiceUnitSelectInput from "../inputs/UserServiceUnitSelectInput"; -import { ConfirmationModalTexts } from "enums"; -import { ButtonColors } from "components/enums"; -import { hasAnyPageDirtyForms } from "util/forms"; -import { getSearchQuery, getUrlParams } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; - -import type { UserGroups, UserServiceUnit, UserServiceUnits } from "usersPermissions/types"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import MainMenuIcon from "@/components/icons/MainMenuIcon"; +import SearchInput from "@/components/inputs/SearchInput"; +import UserServiceUnitSelectInput from "@/components/inputs/UserServiceUnitSelectInput"; +import { ConfirmationModalTexts } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { hasAnyPageDirtyForms } from "@/util/forms"; +import { getSearchQuery, getUrlParams } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; + +import type { UserGroups, UserServiceUnit, UserServiceUnits } from "@/usersPermissions/types"; type Props = { history: Record; diff --git a/src/components/uiData/UiDataListHOC.tsx b/src/components/uiData/UiDataListHOC.tsx index a0df98b20..1cef06b34 100644 --- a/src/components/uiData/UiDataListHOC.tsx +++ b/src/components/uiData/UiDataListHOC.tsx @@ -2,10 +2,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import { fetchAttributes as fetchUiDataAttributes, fetchUiDataList } from "uiData/actions"; -import { getAttributes as getUiDataAttributes, getIsFetching, getIsFetchingAttributes as getIsFetchingUiDataAttributes, getMethods as getUiDataMethods, getUiDataList } from "uiData/selectors"; +import { fetchAttributes as fetchUiDataAttributes, fetchUiDataList } from "@/uiData/actions"; +import { getAttributes as getUiDataAttributes, getIsFetching, getIsFetchingAttributes as getIsFetchingUiDataAttributes, getMethods as getUiDataMethods, getUiDataList } from "@/uiData/selectors"; import type { Attributes, Methods } from "types"; -import type { UiDataList } from "uiData/types"; +import type { UiDataList } from "@/uiData/types"; function UiDataListHOC(WrappedComponent: any) { type Props = { diff --git a/src/components/vat/AmountWithVat.tsx b/src/components/vat/AmountWithVat.tsx index d4a9e5d4e..8535617b7 100644 --- a/src/components/vat/AmountWithVat.tsx +++ b/src/components/vat/AmountWithVat.tsx @@ -2,10 +2,10 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import isAfter from "date-fns/isAfter"; import isBefore from "date-fns/isBefore"; -import { formatNumber } from "util/helpers"; -import { getCurrentLease } from "leases/selectors"; -import { getVats } from "vat/selectors"; -import type { VatList } from "vat/types"; +import { formatNumber } from "@/util/helpers"; +import { getCurrentLease } from "@/leases/selectors"; +import { getVats } from "@/vat/selectors"; +import type { VatList } from "@/vat/types"; type Props = { amount: number; date: string; diff --git a/src/contacts/components/ContactAuditLog.tsx b/src/contacts/components/ContactAuditLog.tsx index 671be79a2..43621c12a 100644 --- a/src/contacts/components/ContactAuditLog.tsx +++ b/src/contacts/components/ContactAuditLog.tsx @@ -1,21 +1,21 @@ import React, { Fragment, PureComponent } from "react"; import { connect } from "react-redux"; import isEmpty from "lodash/isEmpty"; -import AuditLogTable from "components/auditLog/AuditLogTable"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import Pagination from "components/table/Pagination"; -import TableWrapper from "components/table/TableWrapper"; -import { fetchAuditLogByContact } from "auditLog/actions"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import { getApiResponseCount, getApiResponseMaxPage, getApiResponseResults } from "util/helpers"; -import { getAuditLogByContact, getIsFetchingByContact } from "auditLog/selectors"; -import type { AuditLogList } from "auditLog/types"; +import AuditLogTable from "@/components/auditLog/AuditLogTable"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import Pagination from "@/components/table/Pagination"; +import TableWrapper from "@/components/table/TableWrapper"; +import { fetchAuditLogByContact } from "@/auditLog/actions"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import { getApiResponseCount, getApiResponseMaxPage, getApiResponseResults } from "@/util/helpers"; +import { getAuditLogByContact, getIsFetchingByContact } from "@/auditLog/selectors"; +import type { AuditLogList } from "@/auditLog/types"; type Props = { - auditLogList: AuditLogList; + auditLogList?: AuditLogList; contactId: string; - fetchAuditLogByContact: (...args: Array) => any; - isFetching: boolean; + fetchAuditLogByContact?: (...args: Array) => any; + isFetching?: boolean; }; type State = { activePage: number; diff --git a/src/contacts/components/ContactEdit.tsx b/src/contacts/components/ContactEdit.tsx index 00e926c71..fb63dd1a8 100644 --- a/src/contacts/components/ContactEdit.tsx +++ b/src/contacts/components/ContactEdit.tsx @@ -1,6 +1,6 @@ import React from "react"; import ContactForm from "./forms/ContactForm"; -import GreenBox from "components/content/GreenBox"; +import GreenBox from "@/components/content/GreenBox"; const ContactEdit = () => { return diff --git a/src/contacts/components/ContactModal.tsx b/src/contacts/components/ContactModal.tsx index eb1e35746..b4202a030 100644 --- a/src/contacts/components/ContactModal.tsx +++ b/src/contacts/components/ContactModal.tsx @@ -1,15 +1,15 @@ import React from "react"; import { connect } from "react-redux"; -import Button from "components/button/Button"; +import Button from "@/components/button/Button"; import ContactForm from "./forms/ContactForm"; -import GreenBox from "components/content/GreenBox"; -import Modal from "components/modal/Modal"; -import { ButtonColors } from "components/enums"; -import { Methods } from "enums"; -import { isMethodAllowed } from "util/helpers"; -import { getIsContactFormValid, getIsSaveClicked, getMethods as getContactMethods } from "contacts/selectors"; +import GreenBox from "@/components/content/GreenBox"; +import Modal from "@/components/modal/Modal"; +import { ButtonColors } from "@/components/enums"; +import { Methods } from "@/enums"; +import { isMethodAllowed } from "@/util/helpers"; +import { getIsContactFormValid, getIsSaveClicked, getMethods as getContactMethods } from "@/contacts/selectors"; import type { Methods as MethodsType } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; type Props = { contactMethods: MethodsType; isContactFormValid: boolean; diff --git a/src/contacts/components/ContactPage.tsx b/src/contacts/components/ContactPage.tsx index 7998bc659..0032371fa 100644 --- a/src/contacts/components/ContactPage.tsx +++ b/src/contacts/components/ContactPage.tsx @@ -4,46 +4,46 @@ import { change, formValueSelector, getFormValues, isDirty } from "redux-form"; import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import Authorization from "components/authorization/Authorization"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import ConfirmationModal from "components/modal/ConfirmationModal"; +import Authorization from "@/components/authorization/Authorization"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import ConfirmationModal from "@/components/modal/ConfirmationModal"; import ContactAuditLog from "./ContactAuditLog"; import ContactEdit from "./ContactEdit"; import ContactReadonly from "./ContactReadonly"; -import ContentContainer from "components/content/ContentContainer"; -import ControlButtonBar from "components/controlButtons/ControlButtonBar"; -import ControlButtons from "components/controlButtons/ControlButtons"; -import CreditDecisionTemplate from "../../creditDecision/components/CreditDecisionTemplate"; -import Divider from "components/content/Divider"; -import FullWidthContainer from "components/content/FullWidthContainer"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; -import Tabs from "components/tabs/Tabs"; -import TabPane from "components/tabs/TabPane"; -import TabContent from "components/tabs/TabContent"; -import Title from "components/content/Title"; -import TradeRegisterTemplate from "tradeRegister/components/TradeRegisterTemplate"; -import { editContact, fetchSingleContact, hideEditMode, initializeContactForm, receiveIsSaveClicked, receiveSingleContact, showEditMode } from "contacts/actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "enums"; -import { ContactFieldPaths, ContactFieldTitles, ContactTypes } from "contacts/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { clearUnsavedChanges, getContactFullName } from "contacts/helpers"; -import { getUiDataContactKey } from "uiData/helpers"; -import { hasPermissions, getSearchQuery, getUrlParams, isMethodAllowed, scrollToTopPage, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getCurrentContact, getIsContactFormValid, getIsEditMode, getIsFetching, getIsSaveClicked, getIsSaving } from "contacts/selectors"; -import { getSessionStorageItem, removeSessionStorageItem, setSessionStorageItem } from "util/storage"; -import { withContactAttributes } from "components/attributes/ContactAttributes"; -import { withUiDataList } from "components/uiData/UiDataListHOC"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import { getUserActiveServiceUnit } from "usersPermissions/selectors"; +import ContentContainer from "@/components/content/ContentContainer"; +import ControlButtonBar from "@/components/controlButtons/ControlButtonBar"; +import ControlButtons from "@/components/controlButtons/ControlButtons"; +import CreditDecisionTemplate from "@/creditDecision/components/CreditDecisionTemplate"; +import Divider from "@/components/content/Divider"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; +import Tabs from "@/components/tabs/Tabs"; +import TabPane from "@/components/tabs/TabPane"; +import TabContent from "@/components/tabs/TabContent"; +import Title from "@/components/content/Title"; +import TradeRegisterTemplate from "@/tradeRegister/components/TradeRegisterTemplate"; +import { editContact, fetchSingleContact, hideEditMode, initializeContactForm, receiveIsSaveClicked, receiveSingleContact, showEditMode } from "@/contacts/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { ContactFieldPaths, ContactFieldTitles, ContactTypes } from "@/contacts/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { clearUnsavedChanges, getContactFullName } from "@/contacts/helpers"; +import { getUiDataContactKey } from "@/uiData/helpers"; +import { hasPermissions, getSearchQuery, getUrlParams, isMethodAllowed, scrollToTopPage, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getCurrentContact, getIsContactFormValid, getIsEditMode, getIsFetching, getIsSaveClicked, getIsSaving } from "@/contacts/selectors"; +import { getSessionStorageItem, removeSessionStorageItem, setSessionStorageItem } from "@/util/storage"; +import { withContactAttributes } from "@/components/attributes/ContactAttributes"; +import { withUiDataList } from "@/components/uiData/UiDataListHOC"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import { getUserActiveServiceUnit } from "@/usersPermissions/selectors"; import type { Methods as MethodsType } from "types"; -import type { RootState } from "root/types"; -import type { UsersPermissions as UsersPermissionsType, UserServiceUnit } from "usersPermissions/types"; -import type { Contact } from "../types"; +import type { RootState } from "@/root/types"; +import type { UsersPermissions as UsersPermissionsType, UserServiceUnit } from "@/usersPermissions/types"; +import type { Contact } from "@/contacts/types"; type Props = { change: (...args: Array) => any; contact: Contact; @@ -441,7 +441,13 @@ class ContactPage extends Component { {ContactFieldTitles.BASIC_INFO} - {isEditMode ? }> : } + {isEditMode ? ( + }> + + + ) : ( + + )} @@ -462,11 +468,13 @@ class ContactPage extends Component { }> + <> {ContactFieldTitles.CREDIT_DECISION} + @@ -474,11 +482,13 @@ class ContactPage extends Component { }> + <> {ContactFieldTitles.AUDIT_LOG} + diff --git a/src/contacts/components/ContactReadonly.tsx b/src/contacts/components/ContactReadonly.tsx index 87f837391..2dd54f882 100644 --- a/src/contacts/components/ContactReadonly.tsx +++ b/src/contacts/components/ContactReadonly.tsx @@ -1,7 +1,7 @@ import React from "react"; -import ContactTemplate from "contacts/components/templates/ContactTemplate"; -import GreenBox from "components/content/GreenBox"; -import type { Contact } from "../types"; +import ContactTemplate from "@/contacts/components/templates/ContactTemplate"; +import GreenBox from "@/components/content/GreenBox"; +import type { Contact } from "@/types"; type Props = { contact: Contact; }; diff --git a/src/contacts/components/ContactsListPage.tsx b/src/contacts/components/ContactsListPage.tsx index 49c84611a..d32853fa0 100644 --- a/src/contacts/components/ContactsListPage.tsx +++ b/src/contacts/components/ContactsListPage.tsx @@ -4,33 +4,33 @@ import { withRouter } from "react-router"; import { initialize } from "redux-form"; import flowRight from "lodash/flowRight"; import { Row, Column } from "react-foundation"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import Authorization from "components/authorization/Authorization"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import Pagination from "components/table/Pagination"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import Authorization from "@/components/authorization/Authorization"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import Pagination from "@/components/table/Pagination"; import Search from "./search/Search"; -import SortableTable from "components/table/SortableTable"; -import TableFilters from "components/table/TableFilters"; -import TableWrapper from "components/table/TableWrapper"; -import { fetchContacts, initializeContactForm } from "../actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import { DEFAULT_SORT_KEY, DEFAULT_SORT_ORDER } from "contacts/constants"; -import { FormNames, Methods, PermissionMissingTexts } from "enums"; -import { ContactFieldPaths, ContactFieldTitles } from "contacts/enums"; -import { getContactFullName, mapContactSearchFilters } from "contacts/helpers"; -import { getApiResponseCount, getApiResponseMaxPage, getApiResponseResults, getFieldOptions, getLabelOfOption, getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getContactList, getIsFetching } from "../selectors"; -import { withContactAttributes } from "components/attributes/ContactAttributes"; -import { getUserActiveServiceUnit } from "usersPermissions/selectors"; -import type { ContactList } from "../types"; +import SortableTable from "@/components/table/SortableTable"; +import TableFilters from "@/components/table/TableFilters"; +import TableWrapper from "@/components/table/TableWrapper"; +import { fetchContacts, initializeContactForm } from "@/contacts/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import { DEFAULT_SORT_KEY, DEFAULT_SORT_ORDER } from "@/contacts/constants"; +import { FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { ContactFieldPaths, ContactFieldTitles } from "@/contacts/enums"; +import { getContactFullName, mapContactSearchFilters } from "@/contacts/helpers"; +import { getApiResponseCount, getApiResponseMaxPage, getApiResponseResults, getFieldOptions, getLabelOfOption, getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getContactList, getIsFetching } from "@/contacts/selectors"; +import { withContactAttributes } from "@/components/attributes/ContactAttributes"; +import { getUserActiveServiceUnit } from "@/usersPermissions/selectors"; +import type { ContactList } from "@/contacts/types"; import type { Attributes, Methods as MethodsType } from "types"; -import type { RootState } from "root/types"; -import type { UserServiceUnit } from "usersPermissions/types"; +import type { RootState } from "@/root/types"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { contactAttributes: Attributes; contactList: ContactList; diff --git a/src/contacts/components/NewContactPage.tsx b/src/contacts/components/NewContactPage.tsx index f7eb31799..613c0e1d4 100644 --- a/src/contacts/components/NewContactPage.tsx +++ b/src/contacts/components/NewContactPage.tsx @@ -3,31 +3,31 @@ import { connect } from "react-redux"; import { getFormValues, isDirty } from "redux-form"; import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AuthorizationError from "components/authorization/AuthorizationError"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; import ContactForm from "./forms/ContactForm"; -import ContentContainer from "components/content/ContentContainer"; -import ControlButtonBar from "components/controlButtons/ControlButtonBar"; -import ControlButtons from "components/controlButtons/ControlButtons"; -import FullWidthContainer from "components/content/FullWidthContainer"; -import GreenBox from "components/content/GreenBox"; -import Loader from "components/loader/Loader"; -import PageContainer from "components/content/PageContainer"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; -import { createContact, hideEditMode, receiveIsSaveClicked, showEditMode } from "contacts/actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "enums"; -import { ButtonColors } from "components/enums"; -import { ContactTypes } from "contacts/enums"; -import { isEmptyValue, isMethodAllowed, setPageTitle } from "util/helpers"; -import { contactExists } from "contacts/requestsAsync"; -import { getRouteById, Routes } from "root/routes"; -import { getIsContactFormValid, getIsSaveClicked } from "contacts/selectors"; -import { withContactAttributes } from "components/attributes/ContactAttributes"; -import { withUiDataList } from "components/uiData/UiDataListHOC"; +import ContentContainer from "@/components/content/ContentContainer"; +import ControlButtonBar from "@/components/controlButtons/ControlButtonBar"; +import ControlButtons from "@/components/controlButtons/ControlButtons"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; +import GreenBox from "@/components/content/GreenBox"; +import Loader from "@/components/loader/Loader"; +import PageContainer from "@/components/content/PageContainer"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; +import { createContact, hideEditMode, receiveIsSaveClicked, showEditMode } from "@/contacts/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { ContactTypes } from "@/contacts/enums"; +import { isEmptyValue, isMethodAllowed, setPageTitle } from "@/util/helpers"; +import { contactExists } from "@/contacts/requestsAsync"; +import { getRouteById, Routes } from "@/root/routes"; +import { getIsContactFormValid, getIsSaveClicked } from "@/contacts/selectors"; +import { withContactAttributes } from "@/components/attributes/ContactAttributes"; +import { withUiDataList } from "@/components/uiData/UiDataListHOC"; import type { Methods as MethodsType } from "types"; -import type { RootState } from "root/types"; -import type { Contact } from "../types"; +import type { RootState } from "@/root/types"; +import type { Contact } from "@/types"; type Props = { contactFormValues: Contact; contactMethods: MethodsType; diff --git a/src/contacts/components/forms/ContactForm.tsx b/src/contacts/components/forms/ContactForm.tsx index 198020814..451f6d9f4 100644 --- a/src/contacts/components/forms/ContactForm.tsx +++ b/src/contacts/components/forms/ContactForm.tsx @@ -4,26 +4,26 @@ import { Row, Column } from "react-foundation"; import { change, formValueSelector, reduxForm } from "redux-form"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import Authorization from "components/authorization/Authorization"; -import FormField from "components/form/FormField"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import FormWrapper from "components/form/FormWrapper"; -import FormWrapperLeft from "components/form/FormWrapperLeft"; -import FormWrapperRight from "components/form/FormWrapperRight"; -import { receiveContactFormValid } from "contacts/actions"; -import { FieldTypes, FormNames } from "enums"; -import WarningContainer from "components/content/WarningContainer"; -import WarningField from "components/form/WarningField"; -import { getContactBusinessIdFieldError } from "contacts/helpers"; -import { ContactFieldPaths, ContactFieldTitles, ContactTypes } from "contacts/enums"; -import { getUiDataContactKey } from "uiData/helpers"; -import { getFieldAttributes, isEmptyValue, isFieldAllowedToRead } from "util/helpers"; -import { getAttributes, getInitialContactFormValues, getIsContactFormValid, getIsSaveClicked } from "contacts/selectors"; -import { getUserActiveServiceUnit } from "usersPermissions/selectors"; +import Authorization from "@/components/authorization/Authorization"; +import FormField from "@/components/form/FormField"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import FormWrapper from "@/components/form/FormWrapper"; +import FormWrapperLeft from "@/components/form/FormWrapperLeft"; +import FormWrapperRight from "@/components/form/FormWrapperRight"; +import { receiveContactFormValid } from "@/contacts/actions"; +import { FieldTypes, FormNames } from "@/enums"; +import WarningContainer from "@/components/content/WarningContainer"; +import WarningField from "@/components/form/WarningField"; +import { getContactBusinessIdFieldError } from "@/contacts/helpers"; +import { ContactFieldPaths, ContactFieldTitles, ContactTypes } from "@/contacts/enums"; +import { getUiDataContactKey } from "@/uiData/helpers"; +import { getFieldAttributes, isEmptyValue, isFieldAllowedToRead } from "@/util/helpers"; +import { getAttributes, getInitialContactFormValues, getIsContactFormValid, getIsSaveClicked } from "@/contacts/selectors"; +import { getUserActiveServiceUnit } from "@/usersPermissions/selectors"; import type { Attributes } from "types"; -import type { RootState } from "root/types"; -import type { UserServiceUnit } from "usersPermissions/types"; +import type { RootState } from "@/root/types"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { attributes: Attributes; change: (...args: Array) => any; @@ -274,12 +274,14 @@ class ContactForm extends Component { + <> {ContactFieldTitles.SERVICE_UNIT} {initialValues.service_unit ? initialValues.service_unit.name || '-' : userActiveServiceUnit && userActiveServiceUnit.name || '-'} + {type === ContactTypes.PERSON && diff --git a/src/contacts/components/search/Search.tsx b/src/contacts/components/search/Search.tsx index e5391e1fb..1eff8d652 100644 --- a/src/contacts/components/search/Search.tsx +++ b/src/contacts/components/search/Search.tsx @@ -6,13 +6,13 @@ import debounce from "lodash/debounce"; import flowRight from "lodash/flowRight"; import isEqual from "lodash/isEqual"; import isEmpty from "lodash/isEmpty"; -import FormField from "components/form/FormField"; -import SearchClearLink from "components/search/SearchClearLink"; -import SearchContainer from "components/search/SearchContainer"; -import { FieldTypes, FormNames } from "enums"; -import { fetchServiceUnits } from "serviceUnits/actions"; -import { getServiceUnits, getIsFetching as getIsFetchingServiceUnits } from "serviceUnits/selectors"; -import type { ServiceUnits } from "serviceUnits/types"; +import FormField from "@/components/form/FormField"; +import SearchClearLink from "@/components/search/SearchClearLink"; +import SearchContainer from "@/components/search/SearchContainer"; +import { FieldTypes, FormNames } from "@/enums"; +import { fetchServiceUnits } from "@/serviceUnits/actions"; +import { getServiceUnits, getIsFetching as getIsFetchingServiceUnits } from "@/serviceUnits/selectors"; +import type { ServiceUnits } from "@/serviceUnits/types"; type Props = { formValues: Record; fetchServiceUnits: (...args: Array) => any; diff --git a/src/contacts/components/templates/ContactTemplate.tsx b/src/contacts/components/templates/ContactTemplate.tsx index 51b1c89ac..54ec91d28 100644 --- a/src/contacts/components/templates/ContactTemplate.tsx +++ b/src/contacts/components/templates/ContactTemplate.tsx @@ -1,17 +1,17 @@ import React from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; -import Authorization from "components/authorization/Authorization"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import FormWrapper from "components/form/FormWrapper"; -import FormWrapperLeft from "components/form/FormWrapperLeft"; -import FormWrapperRight from "components/form/FormWrapperRight"; -import { ContactFieldPaths, ContactFieldTitles } from "contacts/enums"; -import { getUiDataContactKey } from "uiData/helpers"; -import { getFieldOptions, getLabelOfOption, isFieldAllowedToRead } from "util/helpers"; -import { getAttributes } from "contacts/selectors"; -import { ContactTypes } from "contacts/enums"; +import Authorization from "@/components/authorization/Authorization"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import FormWrapper from "@/components/form/FormWrapper"; +import FormWrapperLeft from "@/components/form/FormWrapperLeft"; +import FormWrapperRight from "@/components/form/FormWrapperRight"; +import { ContactFieldPaths, ContactFieldTitles } from "@/contacts/enums"; +import { getUiDataContactKey } from "@/uiData/helpers"; +import { getFieldOptions, getLabelOfOption, isFieldAllowedToRead } from "@/util/helpers"; +import { getAttributes } from "@/contacts/selectors"; +import { ContactTypes } from "@/contacts/enums"; import type { Attributes } from "types"; type Props = { attributes: Attributes; @@ -31,98 +31,120 @@ const ContactTemplate = ({ + <> {ContactFieldTitles.TYPE} {getLabelOfOption(typeOptions, contact.type) || '-'} + {contact.type === ContactTypes.PERSON && + <> {ContactFieldTitles.LAST_NAME} {contact.last_name || '-'} + } {contact.type === ContactTypes.PERSON && + <> {ContactFieldTitles.FIRST_NAME} {contact.first_name || '-'} + } {contact.type && contact.type !== ContactTypes.PERSON && + <> {ContactFieldTitles.NAME} {contact.name || '-'} + } + <> {ContactFieldTitles.CARE_OF} {contact.care_of || '-'} + + <> {ContactFieldTitles.ADDRESS} {contact.address || '-'} + + <> {ContactFieldTitles.POSTAL_CODE} {contact.postal_code || '-'} + + <> {ContactFieldTitles.CITY} {contact.city || '-'} + + <> {ContactFieldTitles.COUNTRY} {getLabelOfOption(countryOptions, contact.country) || '-'} + + <> {ContactFieldTitles.PHONE} {contact.phone || '-'} + + <> {ContactFieldTitles.EMAIL} {contact.email || '-'} + @@ -131,78 +153,96 @@ const ContactTemplate = ({ {contact.type === ContactTypes.PERSON && + <> {ContactFieldTitles.NATIONAL_IDENTIFICATION_NUMBER} {contact.national_identification_number || '-'} + } {contact.type && contact.type !== ContactTypes.PERSON && + <> {ContactFieldTitles.BUSINESS_ID} {contact.business_id || '-'} + } + <> {ContactFieldTitles.LANGUAGE} {getLabelOfOption(languageOptions, contact.language) || '-'} + + <> {ContactFieldTitles.SAP_CUSTOMER_NUMBER} {contact.sap_customer_number || '-'} + + <> {ContactFieldTitles.PARTNER_CODE} {contact.partner_code || '-'} + + <> {ContactFieldTitles.ELECTRONIC_BILLING_ADDRESS} {contact.electronic_billing_address || '-'} + + <> {ContactFieldTitles.ID} {contact.id || '-'} + + <> {ContactFieldTitles.IS_LESSOR} {contact.is_lessor ? 'Kyllä' : 'Ei'} + + <> {ContactFieldTitles.SERVICE_UNIT} {contact.service_unit && contact.service_unit.name ? contact.service_unit.name : '-'} + {contact.type === ContactTypes.PERSON && @@ -215,10 +255,12 @@ const ContactTemplate = ({ + <> {ContactFieldTitles.NOTE} {contact.note || '-'} + diff --git a/src/contacts/constants.ts b/src/contacts/constants.ts index 71ef3a8d1..5f983a052 100644 --- a/src/contacts/constants.ts +++ b/src/contacts/constants.ts @@ -1,4 +1,4 @@ -import { TableSortOrder } from "enums"; +import { TableSortOrder } from "@/enums"; /** * Default sort key of contact list page diff --git a/src/contacts/spec.ts b/src/contacts/contacts.spec.ts similarity index 99% rename from src/contacts/spec.ts rename to src/contacts/contacts.spec.ts index 5e9fec7c1..88fa3f2c2 100644 --- a/src/contacts/spec.ts +++ b/src/contacts/contacts.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, receiveAttributes, receiveMethods, attributesNotFound, receiveSingleContact, initializeContactForm, receiveContactFormValid, showEditMode, hideEditMode, showContactModal, hideContactModal, receiveContactModalSettings, receiveContacts, fetchContacts, fetchSingleContact, createContact, editContact, createContactOnModal, editContactOnModal, notFound, receiveIsSaveClicked } from "./actions"; import contactReducer from "./reducer"; import type { ContactState } from "./types"; diff --git a/src/contacts/helpers.ts b/src/contacts/helpers.ts index 789831350..7191ba09f 100644 --- a/src/contacts/helpers.ts +++ b/src/contacts/helpers.ts @@ -1,8 +1,8 @@ import { isDirty } from "redux-form"; -import { FormNames, TableSortOrder } from "enums"; +import { FormNames, TableSortOrder } from "@/enums"; import { ContactTypes } from "./enums"; -import { getIsEditMode } from "contacts/selectors"; -import { removeSessionStorageItem } from "util/storage"; +import { getIsEditMode } from "@/contacts/selectors"; +import { removeSessionStorageItem } from "@/util/storage"; /** * Get full name of contact diff --git a/src/contacts/reducer.ts b/src/contacts/reducer.ts index 0cb650bae..1c9f73a9d 100644 --- a/src/contacts/reducer.ts +++ b/src/contacts/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Attributes, Methods, Reducer } from "../types"; +import type { Attributes, Methods, Reducer } from "@/types"; import type { Contact, ContactList, ContactModalSettings, InitializeContactFormValuesAction, ReceiveAttributesAction, ReceiveMethodsAction, ReceiveContactsAction, ReceiveSingleContactAction, ReceiveContactFormValidAction, ReceiveContactModalSettingsAction, ReceiveIsSaveClickedAction } from "./types"; const isEditModeReducer: Reducer = handleActions({ 'mvj/contacts/HIDE_EDIT': () => false, diff --git a/src/contacts/requests.ts b/src/contacts/requests.ts index 274b3e071..c12557d17 100644 --- a/src/contacts/requests.ts +++ b/src/contacts/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; import type { Contact, ContactId } from "./types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl(`contact/`), { diff --git a/src/contacts/requestsAsync.ts b/src/contacts/requestsAsync.ts index 174772570..f10f004d4 100644 --- a/src/contacts/requestsAsync.ts +++ b/src/contacts/requestsAsync.ts @@ -1,5 +1,5 @@ -import createUrl from "api/createUrl"; -import callApiAsync from "api/callApiAsync"; +import createUrl from "@/api/createUrl"; +import callApiAsync from "@/api/callApiAsync"; import { ContactExistsResponse } from "./types"; export const fetchContacts = async (query?: Record) => { const { diff --git a/src/contacts/saga.ts b/src/contacts/saga.ts index 44d329101..07a4f4e8e 100644 --- a/src/contacts/saga.ts +++ b/src/contacts/saga.ts @@ -2,10 +2,10 @@ import { all, call, fork, put, select, takeLatest } from "redux-saga/effects"; import { push } from "react-router-redux"; import { SubmissionError } from "redux-form"; import { hideContactModal, hideEditMode, receiveAttributes, receiveMethods, attributesNotFound, receiveContacts, receiveContactModalSettings, receiveSingleContact, notFound } from "./actions"; -import { receiveError } from "api/actions"; -import { displayUIMessage } from "util/helpers"; +import { receiveError } from "@/api/actions"; +import { displayUIMessage } from "@/util/helpers"; import { createContact, editContact, fetchAttributes, fetchContacts, fetchSingleContact } from "./requests"; -import { getRouteById, Routes } from "../root/routes"; +import { getRouteById, Routes } from "@/root/routes"; import { getContactModalSettings } from "./selectors"; function* fetchAttributesSaga(): Generator { diff --git a/src/contacts/selectors.ts b/src/contacts/selectors.ts index 47afd2f1f..aec078770 100644 --- a/src/contacts/selectors.ts +++ b/src/contacts/selectors.ts @@ -1,5 +1,5 @@ import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { Contact, ContactList, ContactModalSettings } from "./types"; export const getInitialContactFormValues: Selector = (state: RootState): Contact => state.contact.initialContactFormValues; export const getIsContactFormValid: Selector = (state: RootState): boolean => state.contact.isContactFormValid; diff --git a/src/contacts/types.ts b/src/contacts/types.ts index e5b3abe2f..05d230414 100644 --- a/src/contacts/types.ts +++ b/src/contacts/types.ts @@ -1,4 +1,4 @@ -import type { Action, Attributes, Methods } from "../types"; +import type { Action, Attributes, Methods } from "@/types"; export type ContactState = { attributes: Attributes; contactModalSettings: ContactModalSettings; diff --git a/src/contractFile/spec.ts b/src/contractFile/contractFile.spec.ts similarity index 97% rename from src/contractFile/spec.ts rename to src/contractFile/contractFile.spec.ts index 993366926..01fd49e62 100644 --- a/src/contractFile/spec.ts +++ b/src/contractFile/contractFile.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchContractFilesById, receiveContractFilesById, notFoundById } from "./actions"; import contractFileReducer from "./reducer"; import type { ContractFileState } from "./types"; diff --git a/src/contractFile/reducer.ts b/src/contractFile/reducer.ts index ef6db02a9..9004f811e 100644 --- a/src/contractFile/reducer.ts +++ b/src/contractFile/reducer.ts @@ -1,7 +1,7 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import type { Reducer } from "types"; -import type { FetchContractFilesByIdAction, ReceiveContractFilesByIdAction, NotFoundByIdAction } from "contractFile/types"; +import type { FetchContractFilesByIdAction, ReceiveContractFilesByIdAction, NotFoundByIdAction } from "@/contractFile/types"; const isFetchingByIdReducer: Reducer> = handleActions({ ['mvj/contractFile/FETCH_BY_ID']: (state: Record, { payload: contractId diff --git a/src/contractFile/requests.ts b/src/contractFile/requests.ts index 86697df50..ba5e8fcc5 100644 --- a/src/contractFile/requests.ts +++ b/src/contractFile/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrlWithoutVersionSuffix from "../api/createUrlWithoutVersionSuffix"; +import callApi from "@/api/callApi"; +import createUrlWithoutVersionSuffix from "@/api/createUrlWithoutVersionSuffix"; import type { ContractId } from "./types"; export const fetchContractFiles = (id: ContractId): Generator => { return callApi(new Request(createUrlWithoutVersionSuffix(`contract_file/${id}/`))); diff --git a/src/contractFile/saga.ts b/src/contractFile/saga.ts index 39386e4a2..27f2c0103 100644 --- a/src/contractFile/saga.ts +++ b/src/contractFile/saga.ts @@ -1,6 +1,6 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { receiveContractFilesById, notFoundById } from "./actions"; import { fetchContractFiles } from "./requests"; diff --git a/src/contractFile/selectors.ts b/src/contractFile/selectors.ts index 2252894cf..79a1a277c 100644 --- a/src/contractFile/selectors.ts +++ b/src/contractFile/selectors.ts @@ -1,4 +1,4 @@ -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { Selector } from "types"; import type { ContractId } from "./types"; export const getContractFilesById: Selector>, ContractId> = (state: RootState, id: ContractId): Array> => state.contractFile.byId[id]; diff --git a/src/contractFile/types.ts b/src/contractFile/types.ts index 941d05dea..646a2fbff 100644 --- a/src/contractFile/types.ts +++ b/src/contractFile/types.ts @@ -1,4 +1,4 @@ -import type { Action } from "../types"; +import type { Action } from "@/types"; export type ContractId = number; export type ReceiveContractFilePayload = { contractId: ContractId; diff --git a/src/createCollectionLetter/spec.ts b/src/createCollectionLetter/createCollectionLetter.spec.ts similarity index 97% rename from src/createCollectionLetter/spec.ts rename to src/createCollectionLetter/createCollectionLetter.spec.ts index 848afd5ef..dd5494da6 100644 --- a/src/createCollectionLetter/spec.ts +++ b/src/createCollectionLetter/createCollectionLetter.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes } from "./actions"; import createCollectionLetterReducer from "./reducer"; import type { CreateCollectionLetterState } from "./types"; diff --git a/src/createCollectionLetter/reducer.ts b/src/createCollectionLetter/reducer.ts index 101c7a32a..6a524a9f7 100644 --- a/src/createCollectionLetter/reducer.ts +++ b/src/createCollectionLetter/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Attributes, Reducer } from "../types"; +import type { Attributes, Reducer } from "@/types"; import type { ReceiveAttributesAction } from "./types"; const isFetchingAttributesReducer: Reducer = handleActions({ 'mvj/createCollectionLetter/FETCH_ATTRIBUTES': () => true, diff --git a/src/createCollectionLetter/requests.ts b/src/createCollectionLetter/requests.ts index ff03846a5..f89215fad 100644 --- a/src/createCollectionLetter/requests.ts +++ b/src/createCollectionLetter/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl(`lease_create_collection_letter/`), { method: 'OPTIONS' diff --git a/src/createCollectionLetter/saga.ts b/src/createCollectionLetter/saga.ts index bfee5a589..6062ff7a8 100644 --- a/src/createCollectionLetter/saga.ts +++ b/src/createCollectionLetter/saga.ts @@ -1,7 +1,7 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { receiveAttributes, attributesNotFound } from "./actions"; import { fetchAttributes } from "./requests"; -import { receiveError } from "../api/actions"; +import { receiveError } from "@/api/actions"; function* fetchAttributesSaga(): Generator { try { diff --git a/src/createCollectionLetter/selectors.ts b/src/createCollectionLetter/selectors.ts index 13322d195..55132793e 100644 --- a/src/createCollectionLetter/selectors.ts +++ b/src/createCollectionLetter/selectors.ts @@ -1,4 +1,4 @@ import type { Attributes, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.createCollectionLetter.isFetchingAttributes; export const getAttributes: Selector = (state: RootState): Attributes => state.createCollectionLetter.attributes; \ No newline at end of file diff --git a/src/createCollectionLetter/types.ts b/src/createCollectionLetter/types.ts index 0aaa57568..469458415 100644 --- a/src/createCollectionLetter/types.ts +++ b/src/createCollectionLetter/types.ts @@ -1,4 +1,4 @@ -import type { Action, Attributes } from "../types"; +import type { Action, Attributes } from "@/types"; export type CreateCollectionLetterState = { attributes: Attributes; isFetchingAttributes: boolean; diff --git a/src/creditDecision/actions.ts b/src/creditDecision/actions.ts index db52165ae..6a993d203 100644 --- a/src/creditDecision/actions.ts +++ b/src/creditDecision/actions.ts @@ -1,5 +1,5 @@ import { createAction } from "redux-actions"; -import type { CreditDecisionNotFoundByBusinessIdAction, CreditDecisionNotFoundByContactIdAction, CreditDecisionNotFoundByNinAction, FetchCreditDecisionByBusinessIdAction, FetchCreditDecisionByContactIdAction, FetchCreditDecisionByNinAction, FetchHistoryByBusinessIdAction, FetchHistoryByContactIdAction, HistoryDataMap, HistoryNotFoundByBusinessIdAction, HistoryNotFoundByContactIdAction, ReceiveCreditDecisionByBusinessIdAction, ReceiveCreditDecisionByContactIdAction, ReceiveCreditDecisionByNinAction, ReceiveHistoryByBusinessIdAction, ReceiveHistoryByContactIdAction } from "creditDecision/types"; +import type { CreditDecisionNotFoundByBusinessIdAction, CreditDecisionNotFoundByContactIdAction, CreditDecisionNotFoundByNinAction, FetchCreditDecisionByBusinessIdAction, FetchCreditDecisionByContactIdAction, FetchCreditDecisionByNinAction, FetchHistoryByBusinessIdAction, FetchHistoryByContactIdAction, HistoryDataMap, HistoryNotFoundByBusinessIdAction, HistoryNotFoundByContactIdAction, ReceiveCreditDecisionByBusinessIdAction, ReceiveCreditDecisionByContactIdAction, ReceiveCreditDecisionByNinAction, ReceiveHistoryByBusinessIdAction, ReceiveHistoryByContactIdAction } from "@/creditDecision/types"; export const fetchHistoryByBusinessId = (id: string): FetchHistoryByBusinessIdAction => createAction('mvj/creditDecision/FETCH_HISTORY_BY_BUSINESS_ID')(id); export const receiveHistoryByBusinessId = (payload: HistoryDataMap): ReceiveHistoryByBusinessIdAction => createAction('mvj/creditDecision/RECEIVE_HISTORY_BY_BUSINESS_ID')(payload); export const historyNotFoundByBusinessId = (id: string): HistoryNotFoundByBusinessIdAction => createAction('mvj/creditDecision/HISTORY_NOT_FOUND_BY_BUSINESS_ID')(id); diff --git a/src/creditDecision/components/CreditDecisionHistory.tsx b/src/creditDecision/components/CreditDecisionHistory.tsx index c5716265e..9d8ed6b2a 100644 --- a/src/creditDecision/components/CreditDecisionHistory.tsx +++ b/src/creditDecision/components/CreditDecisionHistory.tsx @@ -2,17 +2,17 @@ import React, { Fragment, PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import InfoIcon from "components/icons/InfoIcon"; -import GreenBox from "components/content/GreenBox"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import StatusText from "creditDecision/components/StatusText"; -import WhiteBox from "components/content/WhiteBox"; -import { CreditDecisionText } from "creditDecision/enums"; -import { formatDate } from "util/helpers"; -import { getHoursAndMinutes } from "util/date"; -import { fetchHistoryByBusinessId, fetchHistoryByContactId } from "creditDecision/actions"; -import { getHistoryByBusinessId, getIsFetchingHistoryByBusinessId, getHistoryByContactId, getIsFetchingHistoryByContactId } from "creditDecision/selectors"; +import InfoIcon from "@/components/icons/InfoIcon"; +import GreenBox from "@/components/content/GreenBox"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import StatusText from "@/creditDecision/components/StatusText"; +import WhiteBox from "@/components/content/WhiteBox"; +import { CreditDecisionText } from "@/creditDecision/enums"; +import { formatDate } from "@/util/helpers"; +import { getHoursAndMinutes } from "@/util/date"; +import { fetchHistoryByBusinessId, fetchHistoryByContactId } from "@/creditDecision/actions"; +import { getHistoryByBusinessId, getIsFetchingHistoryByBusinessId, getHistoryByContactId, getIsFetchingHistoryByContactId } from "@/creditDecision/selectors"; type Props = { businessId?: string; contactId?: string; diff --git a/src/creditDecision/components/CreditDecisionRequest.tsx b/src/creditDecision/components/CreditDecisionRequest.tsx index 1e683db6d..e8d2e8eff 100644 --- a/src/creditDecision/components/CreditDecisionRequest.tsx +++ b/src/creditDecision/components/CreditDecisionRequest.tsx @@ -1,26 +1,26 @@ import React, { Fragment, PureComponent } from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import Button from "components/button/Button"; -import ErrorIcon from "components/icons/ErrorIcon"; -import GreenBox from "components/content/GreenBox"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import StatusText from "creditDecision/components/StatusText"; -import WhiteBox from "components/content/WhiteBox"; -import { ContactTypes } from "contacts/enums"; -import { CreditDecisionText } from "creditDecision/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { hasPermissions } from "util/helpers"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import { formatDate } from "util/helpers"; -import { getHoursAndMinutes } from "util/date"; -import { fetchCreditDecisionByBusinessId, fetchCreditDecisionByContactId, fetchCreditDecisionByNin } from "creditDecision/actions"; -import { getCreditDecisionByBusinessId, getCreditDecisionByContactId, getCreditDecisionByNin, getIsFetchingCreditDecisionByBusinessId, getIsFetchingCreditDecisionByContactId, getIsFetchingCreditDecisionByNin } from "creditDecision/selectors"; +import Button from "@/components/button/Button"; +import ErrorIcon from "@/components/icons/ErrorIcon"; +import GreenBox from "@/components/content/GreenBox"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import StatusText from "@/creditDecision/components/StatusText"; +import WhiteBox from "@/components/content/WhiteBox"; +import { ContactTypes } from "@/contacts/enums"; +import { CreditDecisionText } from "@/creditDecision/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { hasPermissions } from "@/util/helpers"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import { formatDate } from "@/util/helpers"; +import { getHoursAndMinutes } from "@/util/date"; +import { fetchCreditDecisionByBusinessId, fetchCreditDecisionByContactId, fetchCreditDecisionByNin } from "@/creditDecision/actions"; +import { getCreditDecisionByBusinessId, getCreditDecisionByContactId, getCreditDecisionByNin, getIsFetchingCreditDecisionByBusinessId, getIsFetchingCreditDecisionByContactId, getIsFetchingCreditDecisionByNin } from "@/creditDecision/selectors"; type Props = { businessId: string; contactId: string; diff --git a/src/creditDecision/components/CreditDecisionSearchPage.tsx b/src/creditDecision/components/CreditDecisionSearchPage.tsx index 627391d03..ded004170 100644 --- a/src/creditDecision/components/CreditDecisionSearchPage.tsx +++ b/src/creditDecision/components/CreditDecisionSearchPage.tsx @@ -4,22 +4,22 @@ import { initialize } from "redux-form"; import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import ContentContainer from "components/content/ContentContainer"; -import Divider from "components/content/Divider"; -import Loader from "components/loader/Loader"; -import PageContainer from "components/content/PageContainer"; -import SearchForm from "creditDecision/components/SearchForm"; -import CreditDecisionTemplate from "creditDecision/components/CreditDecisionTemplate"; -import { ContactTypes } from "contacts/enums"; -import { CreditDecisionText } from "creditDecision/enums"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { FormNames, PermissionMissingTexts } from "enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { hasPermissions, getSearchQuery, getUrlParams, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import ContentContainer from "@/components/content/ContentContainer"; +import Divider from "@/components/content/Divider"; +import Loader from "@/components/loader/Loader"; +import PageContainer from "@/components/content/PageContainer"; +import SearchForm from "@/creditDecision/components/SearchForm"; +import CreditDecisionTemplate from "@/creditDecision/components/CreditDecisionTemplate"; +import { ContactTypes } from "@/contacts/enums"; +import { CreditDecisionText } from "@/creditDecision/enums"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { FormNames, PermissionMissingTexts } from "@/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { hasPermissions, getSearchQuery, getUrlParams, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { history: Record; initialize: (...args: Array) => any; diff --git a/src/creditDecision/components/CreditDecisionTemplate.tsx b/src/creditDecision/components/CreditDecisionTemplate.tsx index f37c336c0..eca4c18d5 100644 --- a/src/creditDecision/components/CreditDecisionTemplate.tsx +++ b/src/creditDecision/components/CreditDecisionTemplate.tsx @@ -1,7 +1,7 @@ import React, { Fragment } from "react"; -import CreditDecisionRequest from "creditDecision/components/CreditDecisionRequest"; -import CreditDecisionHistory from "creditDecision/components/CreditDecisionHistory"; -import { ContactTypes } from "contacts/enums"; +import CreditDecisionRequest from "@/creditDecision/components/CreditDecisionRequest"; +import CreditDecisionHistory from "@/creditDecision/components/CreditDecisionHistory"; +import { ContactTypes } from "@/contacts/enums"; type Props = { businessId?: string; contactId?: string; @@ -14,7 +14,7 @@ const CreditDecisionTemplate = ({ contactId, contactType, nin -}: Props): React.ReactNode => +}: Props) => {contactType !== ContactTypes.PERSON && } diff --git a/src/creditDecision/components/SearchForm.tsx b/src/creditDecision/components/SearchForm.tsx index 907e27170..0c80a1f82 100644 --- a/src/creditDecision/components/SearchForm.tsx +++ b/src/creditDecision/components/SearchForm.tsx @@ -2,17 +2,17 @@ import React, { Fragment } from "react"; import { connect } from "react-redux"; import { getFormValues, formValueSelector, reduxForm } from "redux-form"; import flowRight from "lodash/flowRight"; -import Button from "components/button/Button"; -import FormField from "components/form/FormField"; -import GreenBox from "components/content/GreenBox"; -import SearchInputColumn from "components/search/SearchInputColumn"; -import SearchLabel from "components/search/SearchLabel"; -import SearchLabelColumn from "components/search/SearchLabelColumn"; -import SearchRow from "components/search/SearchRow"; -import { ButtonColors } from "components/enums"; -import { ContactTypes } from "contacts/enums"; -import { FieldTypes, FormNames } from "enums"; -import { CreditDecisionText, SearchLabels } from "creditDecision/enums"; +import Button from "@/components/button/Button"; +import FormField from "@/components/form/FormField"; +import GreenBox from "@/components/content/GreenBox"; +import SearchInputColumn from "@/components/search/SearchInputColumn"; +import SearchLabel from "@/components/search/SearchLabel"; +import SearchLabelColumn from "@/components/search/SearchLabelColumn"; +import SearchRow from "@/components/search/SearchRow"; +import { ButtonColors } from "@/components/enums"; +import { ContactTypes } from "@/contacts/enums"; +import { FieldTypes, FormNames } from "@/enums"; +import { CreditDecisionText, SearchLabels } from "@/creditDecision/enums"; type Props = { formSelectedType: String; formValues: Record; diff --git a/src/creditDecision/components/StatusText.tsx b/src/creditDecision/components/StatusText.tsx index 47ad0e161..d809ce071 100644 --- a/src/creditDecision/components/StatusText.tsx +++ b/src/creditDecision/components/StatusText.tsx @@ -1,9 +1,9 @@ import React from "react"; import classNames from "classnames"; -import QuestionIcon from "components/icons/QuestionIcon"; -import SuccessIcon from "components/icons/SuccessIcon"; -import CancelIcon from "components/icons/CancelIcon"; -import { CreditDecisionStatus, CreditDecisionStatusLabels } from "creditDecision/enums"; +import QuestionIcon from "@/components/icons/QuestionIcon"; +import SuccessIcon from "@/components/icons/SuccessIcon"; +import CancelIcon from "@/components/icons/CancelIcon"; +import { CreditDecisionStatus, CreditDecisionStatusLabels } from "@/creditDecision/enums"; type Props = { status: String; className?: String; diff --git a/src/creditDecision/creditDecision.spec.ts b/src/creditDecision/creditDecision.spec.ts new file mode 100644 index 000000000..7c46eb415 --- /dev/null +++ b/src/creditDecision/creditDecision.spec.ts @@ -0,0 +1,11 @@ +import { describe, expect, it } from "vitest"; + +describe('Credit Decision', () => { + describe('Reducer', () => { + describe('creditDecisionReducer', () => { + it('should have a placeholder test', () => { + expect(true).toBe(true); + }); + }); + }); +}); \ No newline at end of file diff --git a/src/creditDecision/reducer.ts b/src/creditDecision/reducer.ts index b72a074a0..5643238af 100644 --- a/src/creditDecision/reducer.ts +++ b/src/creditDecision/reducer.ts @@ -1,7 +1,7 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import type { Reducer } from "types"; -import type { CreditDecisionDataMap, CreditDecisionNotFoundByBusinessIdAction, CreditDecisionNotFoundByContactIdAction, CreditDecisionNotFoundByNinAction, FetchCreditDecisionByBusinessIdAction, FetchCreditDecisionByContactIdAction, FetchCreditDecisionByNinAction, FetchHistoryByBusinessIdAction, FetchHistoryByContactIdAction, HistoryDataMap, HistoryNotFoundByBusinessIdAction, HistoryNotFoundByContactIdAction, IsFetchingCreditDecisionMap, IsFetchingHistoryMap, ReceiveCreditDecisionByBusinessIdAction, ReceiveCreditDecisionByContactIdAction, ReceiveCreditDecisionByNinAction, ReceiveHistoryByBusinessIdAction, ReceiveHistoryByContactIdAction } from "creditDecision/types"; +import type { CreditDecisionDataMap, CreditDecisionNotFoundByBusinessIdAction, CreditDecisionNotFoundByContactIdAction, CreditDecisionNotFoundByNinAction, FetchCreditDecisionByBusinessIdAction, FetchCreditDecisionByContactIdAction, FetchCreditDecisionByNinAction, FetchHistoryByBusinessIdAction, FetchHistoryByContactIdAction, HistoryDataMap, HistoryNotFoundByBusinessIdAction, HistoryNotFoundByContactIdAction, IsFetchingCreditDecisionMap, IsFetchingHistoryMap, ReceiveCreditDecisionByBusinessIdAction, ReceiveCreditDecisionByContactIdAction, ReceiveCreditDecisionByNinAction, ReceiveHistoryByBusinessIdAction, ReceiveHistoryByContactIdAction } from "@/creditDecision/types"; const isFetchingHistoryByBusinessIdReducer: Reducer = handleActions({ ['mvj/creditDecision/FETCH_HISTORY_BY_BUSINESS_ID']: (state: IsFetchingHistoryMap, { payload: id diff --git a/src/creditDecision/requests.ts b/src/creditDecision/requests.ts index b8f1df23a..bb8ff3b29 100644 --- a/src/creditDecision/requests.ts +++ b/src/creditDecision/requests.ts @@ -1,5 +1,5 @@ -import callApi from "api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; export const fetchHistoryBusinessId = (id: string): Generator => { return callApi(new Request(createUrl(`get_credit_decisions?business_id=${id}`))); }; diff --git a/src/creditDecision/saga.ts b/src/creditDecision/saga.ts index d61f22bfd..15192b213 100644 --- a/src/creditDecision/saga.ts +++ b/src/creditDecision/saga.ts @@ -1,5 +1,5 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { creditDecisionNotFoundByBusinessId, creditDecisionNotFoundByContactId, creditDecisionNotFoundByNin, fetchHistoryByBusinessId, fetchHistoryByContactId, historyNotFoundByBusinessId, historyNotFoundByContactId, receiveCreditDecisionByBusinessId, receiveCreditDecisionByContactId, receiveCreditDecisionByNin, receiveHistoryByBusinessId, receiveHistoryByContactId } from "./actions"; import { fetchHistoryBusinessId, fetchHistoryContactId, fetchCreditDecisionContactId, fetchCreditDecisionBusinessId, fetchCreditDecisionNin } from "./requests"; diff --git a/src/creditDecision/selectors.ts b/src/creditDecision/selectors.ts index 687d055ae..56d466a95 100644 --- a/src/creditDecision/selectors.ts +++ b/src/creditDecision/selectors.ts @@ -1,4 +1,4 @@ -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { Selector } from "types"; export const getIsFetchingHistoryByBusinessId: Selector = (state: RootState, id: string): boolean => state.creditDecision.isFetchingHistoryByBusinessId[id]; export const getIsFetchingHistoryByContactId: Selector = (state: RootState, id: string): boolean => state.creditDecision.isFetchingHistoryByContactId[id]; diff --git a/src/creditDecision/spec.ts b/src/creditDecision/spec.ts deleted file mode 100644 index 2a2a9ce8b..000000000 --- a/src/creditDecision/spec.ts +++ /dev/null @@ -1,7 +0,0 @@ - -describe('Credit Decision', () => { - describe('Reducer', () => { - describe('creditDecisionReducer', () => {// TODO - }); - }); -}); \ No newline at end of file diff --git a/src/district/spec.ts b/src/district/district.spec.ts similarity index 97% rename from src/district/spec.ts rename to src/district/district.spec.ts index efd66d553..b569d2730 100644 --- a/src/district/spec.ts +++ b/src/district/district.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchDistrictsByMunicipality, receiveDistrictsByMunicipality, notFound } from "./actions"; import districtReducer from "./reducer"; import type { DistrictState } from "./types"; diff --git a/src/district/helpers.ts b/src/district/helpers.ts index 303f936fd..d9bf3cbf2 100644 --- a/src/district/helpers.ts +++ b/src/district/helpers.ts @@ -1,4 +1,4 @@ -import { addEmptyOption } from "util/helpers"; +import { addEmptyOption } from "@/util/helpers"; /** * Get district options diff --git a/src/district/reducer.ts b/src/district/reducer.ts index 2ff1474df..978111ad9 100644 --- a/src/district/reducer.ts +++ b/src/district/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Reducer } from "../types"; +import type { Reducer } from "@/types"; import type { DistrictListMap, ReceiveDistrictsByMunicipalityAction } from "./types"; const isFetchingReducer: Reducer = handleActions({ 'mvj/district/FETCH_BY_MUNICIPALITY': () => true, diff --git a/src/district/requests.ts b/src/district/requests.ts index a15f74e2f..2156d6941 100644 --- a/src/district/requests.ts +++ b/src/district/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; export const fetchDistricts = (search: string) => { return callApi(new Request(createUrl(`district/${search || ''}`))); }; \ No newline at end of file diff --git a/src/district/saga.ts b/src/district/saga.ts index dfd0e648f..ccf5f41de 100644 --- a/src/district/saga.ts +++ b/src/district/saga.ts @@ -1,7 +1,7 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { notFound, receiveDistrictsByMunicipality } from "./actions"; import { fetchDistricts } from "./requests"; -import { receiveError } from "../api/actions"; +import { receiveError } from "@/api/actions"; function* fetchDistrictsByMunicipalitySaga({ payload: municipalityId, diff --git a/src/district/selectors.ts b/src/district/selectors.ts index 7be306ed9..64ebe463d 100644 --- a/src/district/selectors.ts +++ b/src/district/selectors.ts @@ -1,5 +1,5 @@ import type { Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { DistrictList } from "./types"; export const getIsFetching: Selector = (state: RootState): boolean => state.district.isFetching; export const getDistrictsByMunicipality: Selector = (state: RootState, municipalityId: number): DistrictList | null | undefined => { diff --git a/src/district/types.ts b/src/district/types.ts index 7be035d58..7835a7ce4 100644 --- a/src/district/types.ts +++ b/src/district/types.ts @@ -1,4 +1,4 @@ -import type { Action } from "../types"; +import type { Action } from "@/types"; export type DistrictState = { byMunicipality: DistrictListMap; isFetching: boolean; diff --git a/src/enums.tsx b/src/enums.tsx index eea0b7dff..cf23d0dda 100644 --- a/src/enums.tsx +++ b/src/enums.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { DELETE_MODAL_BUTTON_TEXT } from "util/constants"; +import { DELETE_MODAL_BUTTON_TEXT } from './util/constants'; /** * Table sort order enumerable. diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index a7c5d6042..000000000 --- a/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import startApp from "./root/startApp"; -import "./polyfills"; -startApp(); \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx new file mode 100644 index 000000000..bc1ddc7c9 --- /dev/null +++ b/src/index.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Provider } from 'react-redux'; +import { ConnectedRouter } from 'connected-react-router'; +import { OidcProvider } from 'redux-oidc'; +import configureStore, { history } from '@/root/configureStore'; +import routes from '@/root/routes'; +import userManager from '@/auth/util/user-manager'; + +import './polyfills'; +export const store = configureStore(); + +const container = document.getElementById('root'); +ReactDOM.render( + + {/* + // @ts-ignore: Children not included in type error */} + + {/* + // @ts-ignore: Children not included in type error */} + + {routes} + + + , + container + ); \ No newline at end of file diff --git a/src/index/actions.ts b/src/index/actions.ts index c30ecf620..5cb120aef 100644 --- a/src/index/actions.ts +++ b/src/index/actions.ts @@ -1,5 +1,5 @@ import { createAction } from "redux-actions"; -import type { IndexList, FetchIndexListAction, ReceiveIndexListAction, NotFoundAction } from "index/types"; +import type { IndexList, FetchIndexListAction, ReceiveIndexListAction, NotFoundAction } from "@/index/types"; export const fetchIndexList = (query: Record): FetchIndexListAction => createAction('mvj/index/FETCH_ALL')(query); export const receiveIndexList = (indexList: IndexList): ReceiveIndexListAction => createAction('mvj/index/RECEIVE_ALL')(indexList); export const notFound = (): NotFoundAction => createAction('mvj/index/NOT_FOUND')(); \ No newline at end of file diff --git a/src/index/components/IndexListPage.tsx b/src/index/components/IndexListPage.tsx index 38bf3b6a0..cd3cb7e7e 100644 --- a/src/index/components/IndexListPage.tsx +++ b/src/index/components/IndexListPage.tsx @@ -2,21 +2,21 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import AuthorizationError from "components/authorization/AuthorizationError"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; import IndexTable from "./IndexTable"; -import Loader from "components/loader/Loader"; -import PageContainer from "components/content/PageContainer"; -import { fetchIndexList } from "index/actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { PermissionMissingTexts } from "enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getContentYearlyIndexes } from "index/helpers"; -import { hasPermissions, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getIndexList, getIsFetching } from "index/selectors"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import type { IndexList } from "index/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import Loader from "@/components/loader/Loader"; +import PageContainer from "@/components/content/PageContainer"; +import { fetchIndexList } from "@/index/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { PermissionMissingTexts } from "@/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getContentYearlyIndexes } from "@/index/helpers"; +import { hasPermissions, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getIndexList, getIsFetching } from "@/index/selectors"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import type { IndexList } from "@/index/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { fetchIndexList: (...args: Array) => any; indexList: IndexList; diff --git a/src/index/helpers.ts b/src/index/helpers.ts index 226e9be13..3e3e8d818 100644 --- a/src/index/helpers.ts +++ b/src/index/helpers.ts @@ -1,4 +1,4 @@ -import { sortNumberByKeyDesc } from "util/helpers"; +import { sortNumberByKeyDesc } from "@/util/helpers"; /** * Get content yearly indexes to display on index table diff --git a/src/index/spec.ts b/src/index/index.spec.ts similarity index 96% rename from src/index/spec.ts rename to src/index/index.spec.ts index 9ede22456..9c39bcf62 100644 --- a/src/index/spec.ts +++ b/src/index/index.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchIndexList, receiveIndexList, notFound } from "./actions"; import indexReducer from "./reducer"; import type { IndexState } from "./types"; diff --git a/src/index/reducer.ts b/src/index/reducer.ts index e73e373d6..5a5262564 100644 --- a/src/index/reducer.ts +++ b/src/index/reducer.ts @@ -1,7 +1,7 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import type { Reducer } from "types"; -import type { IndexList, ReceiveIndexListAction } from "index/types"; +import type { IndexList, ReceiveIndexListAction } from "@/index/types"; const isFetchingReducer: Reducer = handleActions({ 'mvj/index/FETCH_ALL': () => true, 'mvj/index/RECEIVE_ALL': () => false, diff --git a/src/index/requests.ts b/src/index/requests.ts index 21ec4e7f9..5a29f8386 100644 --- a/src/index/requests.ts +++ b/src/index/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; export const fetchIndexList = (query: Record): Generator => { return callApi(new Request(createUrl('index/', query))); }; \ No newline at end of file diff --git a/src/index/selectors.ts b/src/index/selectors.ts index 8b5e2040f..fb4a99cb5 100644 --- a/src/index/selectors.ts +++ b/src/index/selectors.ts @@ -1,5 +1,5 @@ import type { Selector } from "types"; -import type { RootState } from "root/types"; -import type { IndexList } from "index/types"; +import type { RootState } from "@/root/types"; +import type { IndexList } from "@/index/types"; export const getIsFetching: Selector = (state: RootState): boolean => state.index.isFetching; export const getIndexList: Selector = (state: RootState): IndexList => state.index.list; \ No newline at end of file diff --git a/src/infillDevelopment/components/InfillDevelopmentListPage.tsx b/src/infillDevelopment/components/InfillDevelopmentListPage.tsx index 7e0301929..a32b3263d 100644 --- a/src/infillDevelopment/components/InfillDevelopmentListPage.tsx +++ b/src/infillDevelopment/components/InfillDevelopmentListPage.tsx @@ -5,30 +5,30 @@ import { initialize } from "redux-form"; import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; import isArray from "lodash/isArray"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import Authorization from "components/authorization/Authorization"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import Pagination from "components/table/Pagination"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import Authorization from "@/components/authorization/Authorization"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import Pagination from "@/components/table/Pagination"; import Search from "./search/Search"; -import SortableTable from "components/table/SortableTable"; -import TableFilters from "components/table/TableFilters"; -import TableWrapper from "components/table/TableWrapper"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { fetchInfillDevelopments, receiveFormInitialValues } from "infillDevelopment/actions"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import { DEFAULT_SORT_KEY, DEFAULT_SORT_ORDER } from "infillDevelopment/constants"; -import { FormNames, Methods, PermissionMissingTexts } from "enums"; -import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationLeasesFieldPaths } from "infillDevelopment/enums"; -import { getContentInfillDevelopmentListResults, mapInfillDevelopmentSearchFilters } from "infillDevelopment/helpers"; -import { getApiResponseCount, getApiResponseMaxPage, getFieldOptions, getLabelOfOption, getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getInfillDevelopments, getIsFetching } from "infillDevelopment/selectors"; -import { withInfillDevelopmentListPageAttributes } from "components/attributes/InfillDevelopmentListPageAttributes"; +import SortableTable from "@/components/table/SortableTable"; +import TableFilters from "@/components/table/TableFilters"; +import TableWrapper from "@/components/table/TableWrapper"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { fetchInfillDevelopments, receiveFormInitialValues } from "@/infillDevelopment/actions"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import { DEFAULT_SORT_KEY, DEFAULT_SORT_ORDER } from "@/infillDevelopment/constants"; +import { FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationLeasesFieldPaths } from "@/infillDevelopment/enums"; +import { getContentInfillDevelopmentListResults, mapInfillDevelopmentSearchFilters } from "@/infillDevelopment/helpers"; +import { getApiResponseCount, getApiResponseMaxPage, getFieldOptions, getLabelOfOption, getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getInfillDevelopments, getIsFetching } from "@/infillDevelopment/selectors"; +import { withInfillDevelopmentListPageAttributes } from "@/components/attributes/InfillDevelopmentListPageAttributes"; import type { Attributes, Methods as MethodsType } from "types"; -import type { InfillDevelopmentList } from "infillDevelopment/types"; +import type { InfillDevelopmentList } from "@/infillDevelopment/types"; type Props = { fetchInfillDevelopments: (...args: Array) => any; history: Record; diff --git a/src/infillDevelopment/components/InfillDevelopmentPage.tsx b/src/infillDevelopment/components/InfillDevelopmentPage.tsx index 70b34c989..f60269d57 100644 --- a/src/infillDevelopment/components/InfillDevelopmentPage.tsx +++ b/src/infillDevelopment/components/InfillDevelopmentPage.tsx @@ -5,41 +5,41 @@ import { connect } from "react-redux"; import { change, destroy, getFormValues, isDirty } from "redux-form"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import Authorization from "components/authorization/Authorization"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import ConfirmationModal from "components/modal/ConfirmationModal"; -import ContentContainer from "components/content/ContentContainer"; -import ControlButtonBar from "components/controlButtons/ControlButtonBar"; -import ControlButtons from "components/controlButtons/ControlButtons"; -import Divider from "components/content/Divider"; -import FullWidthContainer from "components/content/FullWidthContainer"; +import Authorization from "@/components/authorization/Authorization"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import ConfirmationModal from "@/components/modal/ConfirmationModal"; +import ContentContainer from "@/components/content/ContentContainer"; +import ControlButtonBar from "@/components/controlButtons/ControlButtonBar"; +import ControlButtons from "@/components/controlButtons/ControlButtons"; +import Divider from "@/components/content/Divider"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; import InfillDevelopmentForm from "./forms/InfillDevelopmentForm"; import InfillDevelopmentTemplate from "./sections/basicInfo/InfillDevelopmentTemplate"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; import SingleInfillDevelopmentMap from "./sections/map/SingleInfillDevelopmentMap"; -import Tabs from "components/tabs/Tabs"; -import TabContent from "components/tabs/TabContent"; -import TabPane from "components/tabs/TabPane"; -import Title from "components/content/Title"; -import { clearFormValidFlags, editInfillDevelopment, fetchSingleInfillDevelopment, hideEditMode, receiveFormInitialValues, receiveSingleInfillDevelopment, receiveIsSaveClicked, showEditMode } from "infillDevelopment/actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "enums"; -import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationFieldTitles, InfillDevelopmentCompensationLeasesFieldPaths } from "infillDevelopment/enums"; -import { clearUnsavedChanges, getContentInfillDevelopment, getCopyOfInfillDevelopment, getPayloadInfillDevelopment } from "infillDevelopment/helpers"; -import { getUiDataInfillDevelopmentKey } from "uiData/helpers"; -import { getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed, scrollToTopPage, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getCurrentInfillDevelopment, getIsEditMode, getIsFetching, getIsFormValidById, getIsSaveClicked, getIsSaving } from "infillDevelopment/selectors"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import { getSessionStorageItem, removeSessionStorageItem, setSessionStorageItem } from "util/storage"; -import { withInfillDevelopmentPageAttributes } from "components/attributes/InfillDevelopmentPageAttributes"; -import { withUiDataList } from "components/uiData/UiDataListHOC"; +import Tabs from "@/components/tabs/Tabs"; +import TabContent from "@/components/tabs/TabContent"; +import TabPane from "@/components/tabs/TabPane"; +import Title from "@/components/content/Title"; +import { clearFormValidFlags, editInfillDevelopment, fetchSingleInfillDevelopment, hideEditMode, receiveFormInitialValues, receiveSingleInfillDevelopment, receiveIsSaveClicked, showEditMode } from "@/infillDevelopment/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { ConfirmationModalTexts, FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationFieldTitles, InfillDevelopmentCompensationLeasesFieldPaths } from "@/infillDevelopment/enums"; +import { clearUnsavedChanges, getContentInfillDevelopment, getCopyOfInfillDevelopment, getPayloadInfillDevelopment } from "@/infillDevelopment/helpers"; +import { getUiDataInfillDevelopmentKey } from "@/uiData/helpers"; +import { getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed, scrollToTopPage, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getCurrentInfillDevelopment, getIsEditMode, getIsFetching, getIsFormValidById, getIsSaveClicked, getIsSaving } from "@/infillDevelopment/selectors"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import { getSessionStorageItem, removeSessionStorageItem, setSessionStorageItem } from "@/util/storage"; +import { withInfillDevelopmentPageAttributes } from "@/components/attributes/InfillDevelopmentPageAttributes"; +import { withUiDataList } from "@/components/uiData/UiDataListHOC"; import type { Attributes, Methods as MethodsType } from "types"; -import type { InfillDevelopment } from "infillDevelopment/types"; -import type { UsersPermissions } from "usersPermissions/types"; +import type { InfillDevelopment } from "@/infillDevelopment/types"; +import type { UsersPermissions } from "@/usersPermissions/types"; type Props = { change: (...args: Array) => any; clearFormValidFlags: (...args: Array) => any; @@ -463,12 +463,14 @@ class InfillDevelopmentPage extends Component { }> + <> {InfillDevelopmentCompensationFieldTitles.MAP} + diff --git a/src/infillDevelopment/components/NewInfillDevelopmentPage.tsx b/src/infillDevelopment/components/NewInfillDevelopmentPage.tsx index c28965470..cc3ef569c 100644 --- a/src/infillDevelopment/components/NewInfillDevelopmentPage.tsx +++ b/src/infillDevelopment/components/NewInfillDevelopmentPage.tsx @@ -3,27 +3,27 @@ import { connect } from "react-redux"; import { withRouter } from "react-router"; import { getFormValues, isDirty } from "redux-form"; import flowRight from "lodash/flowRight"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import ContentContainer from "components/content/ContentContainer"; -import ControlButtonBar from "components/controlButtons/ControlButtonBar"; -import ControlButtons from "components/controlButtons/ControlButtons"; -import FullWidthContainer from "components/content/FullWidthContainer"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import ContentContainer from "@/components/content/ContentContainer"; +import ControlButtonBar from "@/components/controlButtons/ControlButtonBar"; +import ControlButtons from "@/components/controlButtons/ControlButtons"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; import InfillDevelopmentForm from "./forms/InfillDevelopmentForm"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; -import { clearFormValidFlags, createInfillDevelopment, hideEditMode, receiveIsSaveClicked, showEditMode } from "infillDevelopment/actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { FormNames, Methods, PermissionMissingTexts } from "enums"; -import { getPayloadInfillDevelopment } from "infillDevelopment/helpers"; -import { isMethodAllowed, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getIsFormValidById, getIsSaveClicked, getIsSaving } from "infillDevelopment/selectors"; -import { withInfillDevelopmentPageAttributes } from "components/attributes/InfillDevelopmentPageAttributes"; -import { withUiDataList } from "components/uiData/UiDataListHOC"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; +import { clearFormValidFlags, createInfillDevelopment, hideEditMode, receiveIsSaveClicked, showEditMode } from "@/infillDevelopment/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { getPayloadInfillDevelopment } from "@/infillDevelopment/helpers"; +import { isMethodAllowed, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getIsFormValidById, getIsSaveClicked, getIsSaving } from "@/infillDevelopment/selectors"; +import { withInfillDevelopmentPageAttributes } from "@/components/attributes/InfillDevelopmentPageAttributes"; +import { withUiDataList } from "@/components/uiData/UiDataListHOC"; import type { Methods as MethodsType } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; type Props = { clearFormValidFlags: (...args: Array) => any; createInfillDevelopment: (...args: Array) => any; diff --git a/src/infillDevelopment/components/forms/InfillDevelopmentForm.tsx b/src/infillDevelopment/components/forms/InfillDevelopmentForm.tsx index 98f226a40..d812b4127 100644 --- a/src/infillDevelopment/components/forms/InfillDevelopmentForm.tsx +++ b/src/infillDevelopment/components/forms/InfillDevelopmentForm.tsx @@ -3,20 +3,20 @@ import { connect } from "react-redux"; import { FieldArray, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import Authorization from "components/authorization/Authorization"; -import FormField from "components/form/FormField"; -import GreenBox from "components/content/GreenBox"; +import Authorization from "@/components/authorization/Authorization"; +import FormField from "@/components/form/FormField"; +import GreenBox from "@/components/content/GreenBox"; import LeaseItemsEdit from "./LeaseItemsEdit"; -import SubTitle from "components/content/SubTitle"; -import { receiveFormValidFlags } from "infillDevelopment/actions"; -import { FieldTypes, FormNames } from "enums"; -import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationFieldTitles, InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles } from "infillDevelopment/enums"; -import { getUiDataInfillDevelopmentKey } from "uiData/helpers"; -import { getFieldAttributes, isFieldAllowedToRead } from "util/helpers"; -import { getAttributes as getInfillDevelopmentAttributes, getFormInitialValues, getIsSaveClicked } from "infillDevelopment/selectors"; -import { referenceNumber } from "components/form/validations"; +import SubTitle from "@/components/content/SubTitle"; +import { receiveFormValidFlags } from "@/infillDevelopment/actions"; +import { FieldTypes, FormNames } from "@/enums"; +import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationFieldTitles, InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles } from "@/infillDevelopment/enums"; +import { getUiDataInfillDevelopmentKey } from "@/uiData/helpers"; +import { getFieldAttributes, isFieldAllowedToRead } from "@/util/helpers"; +import { getAttributes as getInfillDevelopmentAttributes, getFormInitialValues, getIsSaveClicked } from "@/infillDevelopment/selectors"; +import { referenceNumber } from "@/components/form/validations"; import type { Attributes } from "types"; -import type { InfillDevelopment } from "infillDevelopment/types"; +import type { InfillDevelopment } from "@/infillDevelopment/types"; type Props = { infillDevelopment: InfillDevelopment; infillDevelopmentAttributes: Attributes; @@ -123,10 +123,12 @@ class InfillDevelopmentForm extends Component { + <> {InfillDevelopmentCompensationLeasesFieldTitles.INFILL_DEVELOPMENT_COMPENSATION_LEASES} + ; diff --git a/src/infillDevelopment/components/forms/LeaseItemEdit.tsx b/src/infillDevelopment/components/forms/LeaseItemEdit.tsx index 1713b1855..8bababb0b 100644 --- a/src/infillDevelopment/components/forms/LeaseItemEdit.tsx +++ b/src/infillDevelopment/components/forms/LeaseItemEdit.tsx @@ -5,45 +5,45 @@ import { Row, Column } from "react-foundation"; import isEmpty from "lodash/isEmpty"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddButtonThird from "components/form/AddButtonThird"; -import AddFileButton from "components/form/AddFileButton"; -import Authorization from "components/authorization/Authorization"; -import BoxContentWrapper from "components/content/BoxContentWrapper"; -import Collapse from "components/collapse/Collapse"; -import ExternalLink from "components/links/ExternalLink"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import FormField from "components/form/FormField"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import ListItem from "components/content/ListItem"; -import ListItems from "components/content/ListItems"; -import RemoveButton from "components/form/RemoveButton"; -import SubTitle from "components/content/SubTitle"; -import { receiveCollapseStates } from "infillDevelopment/actions"; -import { createInfillDevelopmentAttachment, deleteInfillDevelopmentAttachment } from "infillDevelopmentAttachment/actions"; -import { fetchLeaseById } from "leases/actions"; -import { ConfirmationModalTexts, FieldTypes, FormNames, Methods, ViewModes } from "enums"; -import { ButtonColors } from "components/enums"; -import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles, InfillDevelopmentCompensationLeaseDecisionsFieldPaths, InfillDevelopmentCompensationLeaseDecisionsFieldTitles, InfillDevelopmentCompensationLeaseIntendedUsesFieldPaths, InfillDevelopmentCompensationLeaseIntendedUsesFieldTitles } from "infillDevelopment/enums"; -import { InfillDevelopmentCompensationAttachmentFieldPaths, InfillDevelopmentCompensationAttachmentFieldTitles } from "infillDevelopmentAttachment/enums"; -import { LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths, LeaseTenantsFieldPaths } from "leases/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getUiDataInfillDevelopmentKey, getUiDataInfillDevelopmentAttachmentKey } from "uiData/helpers"; -import { convertStrToDecimalNumber, formatDate, formatNumber, getFieldAttributes, hasPermissions, isActive, isFieldAllowedToRead, isFieldRequired, isMethodAllowed } from "util/helpers"; -import { getContactFullName } from "contacts/helpers"; -import { getContentLeaseAreas, getContentLeaseIdentifier, getContentTenants } from "leases/helpers"; -import { getUserFullName } from "users/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getAttributes as getInfillDevelopmentAttributes, getCollapseStateByKey } from "infillDevelopment/selectors"; -import { getAttributes as getInfillDevelopmentAttachmentAttributes, getMethods as getInfillDevelopmentAttachmentMethods } from "infillDevelopmentAttachment/selectors"; -import { getAttributes as getLeaseAttributes, getIsFetchingById, getLeaseById } from "leases/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import { referenceNumber } from "components/form/validations"; -import { getUserActiveServiceUnit } from "usersPermissions/selectors"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddButtonThird from "@/components/form/AddButtonThird"; +import AddFileButton from "@/components/form/AddFileButton"; +import Authorization from "@/components/authorization/Authorization"; +import BoxContentWrapper from "@/components/content/BoxContentWrapper"; +import Collapse from "@/components/collapse/Collapse"; +import ExternalLink from "@/components/links/ExternalLink"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import FormField from "@/components/form/FormField"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import ListItem from "@/components/content/ListItem"; +import ListItems from "@/components/content/ListItems"; +import RemoveButton from "@/components/form/RemoveButton"; +import SubTitle from "@/components/content/SubTitle"; +import { receiveCollapseStates } from "@/infillDevelopment/actions"; +import { createInfillDevelopmentAttachment, deleteInfillDevelopmentAttachment } from "@/infillDevelopmentAttachment/actions"; +import { fetchLeaseById } from "@/leases/actions"; +import { ConfirmationModalTexts, FieldTypes, FormNames, Methods, ViewModes } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles, InfillDevelopmentCompensationLeaseDecisionsFieldPaths, InfillDevelopmentCompensationLeaseDecisionsFieldTitles, InfillDevelopmentCompensationLeaseIntendedUsesFieldPaths, InfillDevelopmentCompensationLeaseIntendedUsesFieldTitles } from "@/infillDevelopment/enums"; +import { InfillDevelopmentCompensationAttachmentFieldPaths, InfillDevelopmentCompensationAttachmentFieldTitles } from "@/infillDevelopmentAttachment/enums"; +import { LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths, LeaseTenantsFieldPaths } from "@/leases/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getUiDataInfillDevelopmentKey, getUiDataInfillDevelopmentAttachmentKey } from "@/uiData/helpers"; +import { convertStrToDecimalNumber, formatDate, formatNumber, getFieldAttributes, hasPermissions, isActive, isFieldAllowedToRead, isFieldRequired, isMethodAllowed } from "@/util/helpers"; +import { getContactFullName } from "@/contacts/helpers"; +import { getContentLeaseAreas, getContentLeaseIdentifier, getContentTenants } from "@/leases/helpers"; +import { getUserFullName } from "@/users/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getAttributes as getInfillDevelopmentAttributes, getCollapseStateByKey } from "@/infillDevelopment/selectors"; +import { getAttributes as getInfillDevelopmentAttachmentAttributes, getMethods as getInfillDevelopmentAttachmentMethods } from "@/infillDevelopmentAttachment/selectors"; +import { getAttributes as getLeaseAttributes, getIsFetchingById, getLeaseById } from "@/leases/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import { referenceNumber } from "@/components/form/validations"; +import { getUserActiveServiceUnit } from "@/usersPermissions/selectors"; import type { Attributes, Methods as MethodsType } from "types"; -import type { Lease, LeaseId } from "leases/types"; -import type { UsersPermissions as UsersPermissionsType, UserServiceUnit } from "usersPermissions/types"; +import type { Lease, LeaseId } from "@/leases/types"; +import type { UsersPermissions as UsersPermissionsType, UserServiceUnit } from "@/usersPermissions/types"; type DecisionsProps = { fields: any; infillDevelopmentAttributes: Attributes; @@ -459,6 +459,7 @@ class LeaseItemEdit extends PureComponent { + <> Vuokralainen @@ -470,10 +471,12 @@ class LeaseItemEdit extends PureComponent { )} } + + <> Kiinteistö @@ -483,10 +486,12 @@ class LeaseItemEdit extends PureComponent { {!isFetching && !!plots.length && {plots.map((plot, index) => {plot.identifier || '-'})} } + + <> Kaavayksikkö @@ -496,13 +501,16 @@ class LeaseItemEdit extends PureComponent { {!isFetching && !!planUnits.length && {planUnits.map((planUnit, index) => {planUnit.identifier || '-'})} } + + <> {isFetching && Ladataan...} {!isFetching && !leaseId && -} {!isFetching && leaseId && } + @@ -536,10 +544,12 @@ class LeaseItemEdit extends PureComponent { + <> {InfillDevelopmentCompensationLeasesFieldTitles.TOTAL_COMPENSATION} {`${formatNumber(totalCompensation)} €`} + @@ -689,7 +699,7 @@ class LeaseItemEdit extends PureComponent { } const selector = formValueSelector(FormNames.INFILL_DEVELOPMENT); -export default flowRight(connect((state, props) => { +export default flowRight(connect((state, props: Props) => { const { field } = props; diff --git a/src/infillDevelopment/components/forms/LeaseItemsEdit.tsx b/src/infillDevelopment/components/forms/LeaseItemsEdit.tsx index d4df7cb2a..889aacc64 100644 --- a/src/infillDevelopment/components/forms/LeaseItemsEdit.tsx +++ b/src/infillDevelopment/components/forms/LeaseItemsEdit.tsx @@ -1,18 +1,18 @@ import React, { Fragment, ReactElement } from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import Authorization from "components/authorization/Authorization"; -import FormText from "components/form/FormText"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import Authorization from "@/components/authorization/Authorization"; +import FormText from "@/components/form/FormText"; import LeaseItemEdit from "./LeaseItemEdit"; -import { ConfirmationModalTexts } from "enums"; -import { ButtonColors } from "components/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { hasPermissions } from "util/helpers"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; -import type { InfillDevelopment } from "infillDevelopment/types"; +import { ConfirmationModalTexts } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { hasPermissions } from "@/util/helpers"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; +import type { InfillDevelopment } from "@/infillDevelopment/types"; type Props = { fields: any; infillDevelopment: InfillDevelopment; diff --git a/src/infillDevelopment/components/search/Search.tsx b/src/infillDevelopment/components/search/Search.tsx index 04e36679b..298607b67 100644 --- a/src/infillDevelopment/components/search/Search.tsx +++ b/src/infillDevelopment/components/search/Search.tsx @@ -7,18 +7,18 @@ import debounce from "lodash/debounce"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; import isEqual from "lodash/isEqual"; -import FormField from "components/form/FormField"; -import SearchChangeTypeLink from "components/search/SearchChangeTypeLink"; -import SearchClearLink from "components/search/SearchClearLink"; -import SearchContainer from "components/search/SearchContainer"; -import SearchLabel from "components/search/SearchLabel"; -import SearchLabelColumn from "components/search/SearchLabelColumn"; -import SearchInputColumn from "components/search/SearchInputColumn"; -import SearchRow from "components/search/SearchRow"; -import { FieldTypes, FormNames } from "enums"; -import { InfillDevelopmentCompensationLeaseDecisionsFieldPaths } from "infillDevelopment/enums"; -import { getFieldOptions, getUrlParams } from "util/helpers"; -import { getAttributes as getInfillDevelopmentAttributes } from "infillDevelopment/selectors"; +import FormField from "@/components/form/FormField"; +import SearchChangeTypeLink from "@/components/search/SearchChangeTypeLink"; +import SearchClearLink from "@/components/search/SearchClearLink"; +import SearchContainer from "@/components/search/SearchContainer"; +import SearchLabel from "@/components/search/SearchLabel"; +import SearchLabelColumn from "@/components/search/SearchLabelColumn"; +import SearchInputColumn from "@/components/search/SearchInputColumn"; +import SearchRow from "@/components/search/SearchRow"; +import { FieldTypes, FormNames } from "@/enums"; +import { InfillDevelopmentCompensationLeaseDecisionsFieldPaths } from "@/infillDevelopment/enums"; +import { getFieldOptions, getUrlParams } from "@/util/helpers"; +import { getAttributes as getInfillDevelopmentAttributes } from "@/infillDevelopment/selectors"; import type { Attributes } from "types"; type Props = { formValues: Record; diff --git a/src/infillDevelopment/components/sections/basicInfo/InfillDevelopmentTemplate.tsx b/src/infillDevelopment/components/sections/basicInfo/InfillDevelopmentTemplate.tsx index 88ff99dc5..9695e2dc3 100644 --- a/src/infillDevelopment/components/sections/basicInfo/InfillDevelopmentTemplate.tsx +++ b/src/infillDevelopment/components/sections/basicInfo/InfillDevelopmentTemplate.tsx @@ -2,24 +2,24 @@ import React, { Fragment } from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; import get from "lodash/get"; -import Authorization from "components/authorization/Authorization"; -import ExternalLink from "components/links/ExternalLink"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import GreenBox from "components/content/GreenBox"; +import Authorization from "@/components/authorization/Authorization"; +import ExternalLink from "@/components/links/ExternalLink"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import GreenBox from "@/components/content/GreenBox"; import LeaseItem from "./LeaseItem"; -import SubTitle from "components/content/SubTitle"; -import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationFieldTitles, InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles } from "infillDevelopment/enums"; -import { getUiDataInfillDevelopmentKey } from "uiData/helpers"; -import { formatDate, getFieldOptions, getLabelOfOption, getReferenceNumberLink, isFieldAllowedToRead } from "util/helpers"; -import { getUserFullName } from "users/helpers"; -import { getAttributes as getInfillDevelopmentAttributes } from "infillDevelopment/selectors"; +import SubTitle from "@/components/content/SubTitle"; +import { InfillDevelopmentCompensationFieldPaths, InfillDevelopmentCompensationFieldTitles, InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles } from "@/infillDevelopment/enums"; +import { getUiDataInfillDevelopmentKey } from "@/uiData/helpers"; +import { formatDate, getFieldOptions, getLabelOfOption, getReferenceNumberLink, isFieldAllowedToRead } from "@/util/helpers"; +import { getUserFullName } from "@/users/helpers"; +import { getAttributes as getInfillDevelopmentAttributes } from "@/infillDevelopment/selectors"; import type { Attributes } from "types"; -import type { InfillDevelopment } from "infillDevelopment/types"; +import type { InfillDevelopment } from "@/infillDevelopment/types"; type Props = { infillDevelopment: InfillDevelopment; infillDevelopmentAttributes: Attributes; - isFetching: boolean; + isFetching?: boolean; }; const InfillDevelopmentTemplate = ({ @@ -33,65 +33,80 @@ const InfillDevelopmentTemplate = ({ + <> {InfillDevelopmentCompensationFieldTitles.NAME} {infillDevelopment.name || '-'} + + <> {InfillDevelopmentCompensationFieldTitles.DETAILED_PLAN_IDENTIFIER} {infillDevelopment.detailed_plan_identifier || '-'} + + <> {InfillDevelopmentCompensationFieldTitles.REFERENCE_NUMBER} {infillDevelopment.reference_number ? : '-'} + + <> {InfillDevelopmentCompensationFieldTitles.STATE} {getLabelOfOption(stateOptions, infillDevelopment.state) || '-'} + + <> {InfillDevelopmentCompensationFieldTitles.USER} {getUserFullName(infillDevelopment.user) || '-'} + + <> {InfillDevelopmentCompensationFieldTitles.LEASE_CONTRACT_CHANGE_DATE} {formatDate(infillDevelopment.lease_contract_change_date) || '-'} + + <> {InfillDevelopmentCompensationFieldTitles.NOTE} {infillDevelopment.note || '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.INFILL_DEVELOPMENT_COMPENSATION_LEASES} @@ -102,6 +117,7 @@ const InfillDevelopmentTemplate = ({ }}> {leases.map(lease => )}
    } + ; diff --git a/src/infillDevelopment/components/sections/basicInfo/LeaseInfo.tsx b/src/infillDevelopment/components/sections/basicInfo/LeaseInfo.tsx index b6b36d238..32bec250f 100644 --- a/src/infillDevelopment/components/sections/basicInfo/LeaseInfo.tsx +++ b/src/infillDevelopment/components/sections/basicInfo/LeaseInfo.tsx @@ -5,22 +5,22 @@ import { withRouter } from "react-router"; import { Link } from "react-router-dom"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; -import Authorization from "components/authorization/Authorization"; -import ExternalLink from "components/links/ExternalLink"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import ListItem from "components/content/ListItem"; -import ListItems from "components/content/ListItems"; -import { getRouteById, Routes } from "root/routes"; -import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles } from "infillDevelopment/enums"; -import { LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths, LeaseTenantsFieldPaths } from "leases/enums"; -import { getContactFullName } from "contacts/helpers"; -import { getUiDataInfillDevelopmentKey } from "uiData/helpers"; -import { getSearchQuery, getUrlParams, isFieldAllowedToRead } from "util/helpers"; -import { getAttributes as getInfillDevelopmentAttributes } from "infillDevelopment/selectors"; -import { getAttributes as getLeaseAttributes } from "leases/selectors"; +import Authorization from "@/components/authorization/Authorization"; +import ExternalLink from "@/components/links/ExternalLink"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import ListItem from "@/components/content/ListItem"; +import ListItems from "@/components/content/ListItems"; +import { getRouteById, Routes } from "@/root/routes"; +import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles } from "@/infillDevelopment/enums"; +import { LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths, LeaseTenantsFieldPaths } from "@/leases/enums"; +import { getContactFullName } from "@/contacts/helpers"; +import { getUiDataInfillDevelopmentKey } from "@/uiData/helpers"; +import { getSearchQuery, getUrlParams, isFieldAllowedToRead } from "@/util/helpers"; +import { getAttributes as getInfillDevelopmentAttributes } from "@/infillDevelopment/selectors"; +import { getAttributes as getLeaseAttributes } from "@/leases/selectors"; import type { Attributes } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; type Props = { identifier: string | null | undefined; infillDevelopmentAttributes: Attributes; @@ -57,14 +57,17 @@ const LeaseInfo = ({ + <> {InfillDevelopmentCompensationLeasesFieldTitles.LEASE} + + <> Vuokralainen @@ -75,10 +78,12 @@ const LeaseInfo = ({ )} } + + <> Kiinteistö @@ -87,10 +92,12 @@ const LeaseInfo = ({ {!!plots.length && {plots.map((plot, index) => {plot.identifier || '-'})} } + + <> Kaavayksikkö @@ -99,6 +106,7 @@ const LeaseInfo = ({ {!!planUnits.length && {planUnits.map((planUnit, index) => {planUnit.identifier || '-'})} } + @@ -110,7 +118,7 @@ const LeaseInfo = ({ ; }; -export default flowRight( // $FlowFixMe +export default flowRight( withRouter, connect(state => { return { infillDevelopmentAttributes: getInfillDevelopmentAttributes(state), diff --git a/src/infillDevelopment/components/sections/basicInfo/LeaseItem.tsx b/src/infillDevelopment/components/sections/basicInfo/LeaseItem.tsx index 04c3963ee..7605c79d0 100644 --- a/src/infillDevelopment/components/sections/basicInfo/LeaseItem.tsx +++ b/src/infillDevelopment/components/sections/basicInfo/LeaseItem.tsx @@ -4,33 +4,33 @@ import { Row, Column } from "react-foundation"; import isEmpty from "lodash/isEmpty"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; -import Authorization from "components/authorization/Authorization"; -import Collapse from "components/collapse/Collapse"; -import ExternalLink from "components/links/ExternalLink"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; +import Authorization from "@/components/authorization/Authorization"; +import Collapse from "@/components/collapse/Collapse"; +import ExternalLink from "@/components/links/ExternalLink"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; import LeaseInfo from "./LeaseInfo"; -import ListItem from "components/content/ListItem"; -import ListItems from "components/content/ListItems"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import SubTitle from "components/content/SubTitle"; -import { receiveCollapseStates } from "infillDevelopment/actions"; -import { fetchLeaseById } from "leases/actions"; -import { FormNames, Methods, ViewModes } from "enums"; -import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles, InfillDevelopmentCompensationLeaseDecisionsFieldPaths, InfillDevelopmentCompensationLeaseDecisionsFieldTitles, InfillDevelopmentCompensationLeaseIntendedUsesFieldPaths, InfillDevelopmentCompensationLeaseIntendedUsesFieldTitles } from "infillDevelopment/enums"; -import { InfillDevelopmentCompensationAttachmentFieldPaths, InfillDevelopmentCompensationAttachmentFieldTitles } from "infillDevelopmentAttachment/enums"; -import { LeaseFieldPaths } from "leases/enums"; -import { getContentLeaseAreas, getContentLeaseIdentifier, getContentTenants } from "leases/helpers"; -import { getUiDataInfillDevelopmentKey, getUiDataInfillDevelopmentAttachmentKey } from "uiData/helpers"; -import { getUserFullName } from "users/helpers"; -import { formatDate, formatNumber, getFieldOptions, getLabelOfOption, getReferenceNumberLink, isActive, isEmptyValue, isFieldAllowedToRead, isMethodAllowed } from "util/helpers"; -import { getAttributes as getInfillDevelopmentAttributes, getCollapseStateByKey } from "infillDevelopment/selectors"; -import { getAttributes as getInfillDevelopmentAttachmentAttributes, getMethods as getInfillDevelopmentAttachmentMethods } from "infillDevelopmentAttachment/selectors"; -import { getAttributes as getLeaseAttributes, getIsFetchingById, getLeaseById } from "leases/selectors"; +import ListItem from "@/components/content/ListItem"; +import ListItems from "@/components/content/ListItems"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import SubTitle from "@/components/content/SubTitle"; +import { receiveCollapseStates } from "@/infillDevelopment/actions"; +import { fetchLeaseById } from "@/leases/actions"; +import { FormNames, Methods, ViewModes } from "@/enums"; +import { InfillDevelopmentCompensationLeasesFieldPaths, InfillDevelopmentCompensationLeasesFieldTitles, InfillDevelopmentCompensationLeaseDecisionsFieldPaths, InfillDevelopmentCompensationLeaseDecisionsFieldTitles, InfillDevelopmentCompensationLeaseIntendedUsesFieldPaths, InfillDevelopmentCompensationLeaseIntendedUsesFieldTitles } from "@/infillDevelopment/enums"; +import { InfillDevelopmentCompensationAttachmentFieldPaths, InfillDevelopmentCompensationAttachmentFieldTitles } from "@/infillDevelopmentAttachment/enums"; +import { LeaseFieldPaths } from "@/leases/enums"; +import { getContentLeaseAreas, getContentLeaseIdentifier, getContentTenants } from "@/leases/helpers"; +import { getUiDataInfillDevelopmentKey, getUiDataInfillDevelopmentAttachmentKey } from "@/uiData/helpers"; +import { getUserFullName } from "@/users/helpers"; +import { formatDate, formatNumber, getFieldOptions, getLabelOfOption, getReferenceNumberLink, isActive, isEmptyValue, isFieldAllowedToRead, isMethodAllowed } from "@/util/helpers"; +import { getAttributes as getInfillDevelopmentAttributes, getCollapseStateByKey } from "@/infillDevelopment/selectors"; +import { getAttributes as getInfillDevelopmentAttachmentAttributes, getMethods as getInfillDevelopmentAttachmentMethods } from "@/infillDevelopmentAttachment/selectors"; +import { getAttributes as getLeaseAttributes, getIsFetchingById, getLeaseById } from "@/leases/selectors"; import type { Attributes, Methods as MethodsType } from "types"; -import type { Lease, LeaseId } from "leases/types"; +import type { Lease, LeaseId } from "@/leases/types"; type Props = { collapseState: boolean; fetchLeaseById: (...args: Array) => any; @@ -157,6 +157,7 @@ class LeaseItem extends PureComponent { {isFetching ? : } + <> {InfillDevelopmentCompensationLeaseDecisionsFieldTitles.DECISIONS} @@ -218,9 +219,11 @@ class LeaseItem extends PureComponent { )} } + + <> {InfillDevelopmentCompensationLeaseIntendedUsesFieldTitles.INTENDED_USES} @@ -268,84 +271,104 @@ class LeaseItem extends PureComponent { )} } + + <> {InfillDevelopmentCompensationLeasesFieldTitles.MONETARY_COMPENSATION_AMOUNT} {!isEmptyValue(leaseData.monetary_compensation_amount) ? `${formatNumber(leaseData.monetary_compensation_amount)} €` : '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.COMPENSATION_INVESTMENT_AMOUNT} {!isEmptyValue(leaseData.compensation_investment_amount) ? `${formatNumber(leaseData.compensation_investment_amount)} €` : '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.TOTAL_COMPENSATION} {`${formatNumber(totalCompensation)} €`} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.INCREASE_IN_VALUE} {!isEmptyValue(leaseData.increase_in_value) ? `${formatNumber(leaseData.increase_in_value)} €` : '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.PART_OF_THE_INCREASE_IN_VALUE} {!isEmptyValue(leaseData.part_of_the_increase_in_value) ? `${formatNumber(leaseData.part_of_the_increase_in_value)} €` : '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.DISCOUNT_IN_RENT} {!isEmptyValue(leaseData.discount_in_rent) ? `${formatNumber(leaseData.discount_in_rent)} €` : '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.YEAR} {leaseData.year || '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.SENT_TO_SAP_DATE} {formatDate(leaseData.sent_to_sap_date) || '-'} + + <> {InfillDevelopmentCompensationLeasesFieldTitles.PAID_DATE} {formatDate(leaseData.paid_date) || '-'} + + <> {InfillDevelopmentCompensationAttachmentFieldTitles.ATTACHMENTS} @@ -392,6 +415,7 @@ class LeaseItem extends PureComponent { ; })} } + @@ -409,7 +433,7 @@ class LeaseItem extends PureComponent { } -export default flowRight(connect((state, props) => { +export default flowRight(connect((state, props: Props) => { const id = props.id; return { collapseState: getCollapseStateByKey(state, `${ViewModes.READONLY}.${FormNames.INFILL_DEVELOPMENT}.${id}`), diff --git a/src/infillDevelopment/components/sections/map/InfillDevelopmentLeaseLayer.tsx b/src/infillDevelopment/components/sections/map/InfillDevelopmentLeaseLayer.tsx index 9d5e137ac..8178ccbf6 100644 --- a/src/infillDevelopment/components/sections/map/InfillDevelopmentLeaseLayer.tsx +++ b/src/infillDevelopment/components/sections/map/InfillDevelopmentLeaseLayer.tsx @@ -1,8 +1,8 @@ import React, { PureComponent } from "react"; import { GeoJSON } from "react-leaflet"; -import { MAP_COLORS } from "util/constants"; -import { LeaseAreasFieldTitles, LeasePlanUnitsFieldTitles, LeasePlotsFieldTitles } from "leases/enums"; -import { formatDate, formatNumber, getLabelOfOption, isEmptyValue } from "util/helpers"; +import { MAP_COLORS } from "@/util/constants"; +import { LeaseAreasFieldTitles, LeasePlanUnitsFieldTitles, LeasePlotsFieldTitles } from "@/leases/enums"; +import { formatDate, formatNumber, getLabelOfOption, isEmptyValue } from "@/util/helpers"; type Props = { areaLocationOptions: Array>; areaTypeOptions: Array>; diff --git a/src/infillDevelopment/components/sections/map/SingleInfillDevelopmentMap.tsx b/src/infillDevelopment/components/sections/map/SingleInfillDevelopmentMap.tsx index dc769f2e8..8d28ba312 100644 --- a/src/infillDevelopment/components/sections/map/SingleInfillDevelopmentMap.tsx +++ b/src/infillDevelopment/components/sections/map/SingleInfillDevelopmentMap.tsx @@ -4,29 +4,29 @@ import { withRouter } from "react-router"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; import isEmpty from "lodash/isEmpty"; -import AreaNotesEditMap from "areaNote/components/AreaNotesEditMap"; -import AreaNotesLayer from "areaNote/components/AreaNotesLayer"; +import AreaNotesEditMap from "@/areaNote/components/AreaNotesEditMap"; +import AreaNotesLayer from "@/areaNote/components/AreaNotesLayer"; import InfillDevelopmentLeaseLayer from "./InfillDevelopmentLeaseLayer"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import { fetchAreaNoteList } from "areaNote/actions"; -import { fetchLeaseById } from "leases/actions"; -import { MAP_COLORS } from "util/constants"; -import { LeaseAreasFieldPaths, LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths } from "leases/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getContentLeaseIdentifier, getLeaseCoordinates } from "leases/helpers"; -import { getContentInfillDevelopmentLeaseGeoJson } from "infillDevelopment/helpers"; -import { getFieldOptions, getUrlParams, hasPermissions } from "util/helpers"; -import { getBoundsFromCoordinates, getCenterFromCoordinates } from "util/map"; -import { getAreaNoteList } from "areaNote/selectors"; -import { getCurrentInfillDevelopment } from "infillDevelopment/selectors"; -import { getAllLeases, getAttributes as getLeaseAttributes, getIsFetchingAllLeases } from "leases/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import { fetchAreaNoteList } from "@/areaNote/actions"; +import { fetchLeaseById } from "@/leases/actions"; +import { MAP_COLORS } from "@/util/constants"; +import { LeaseAreasFieldPaths, LeasePlanUnitsFieldPaths, LeasePlotsFieldPaths } from "@/leases/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getContentLeaseIdentifier, getLeaseCoordinates } from "@/leases/helpers"; +import { getContentInfillDevelopmentLeaseGeoJson } from "@/infillDevelopment/helpers"; +import { getFieldOptions, getUrlParams, hasPermissions } from "@/util/helpers"; +import { getBoundsFromCoordinates, getCenterFromCoordinates } from "@/util/map"; +import { getAreaNoteList } from "@/areaNote/selectors"; +import { getCurrentInfillDevelopment } from "@/infillDevelopment/selectors"; +import { getAllLeases, getAttributes as getLeaseAttributes, getIsFetchingAllLeases } from "@/leases/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; import type { Attributes } from "types"; -import type { AreaNoteList } from "areaNote/types"; -import type { InfillDevelopment } from "infillDevelopment/types"; -import type { Lease } from "leases/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import type { AreaNoteList } from "@/areaNote/types"; +import type { InfillDevelopment } from "@/infillDevelopment/types"; +import type { Lease } from "@/leases/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { allLeases: Array; areaNotes: AreaNoteList; diff --git a/src/infillDevelopment/constants.ts b/src/infillDevelopment/constants.ts index 4bafbd24d..6ade639a3 100644 --- a/src/infillDevelopment/constants.ts +++ b/src/infillDevelopment/constants.ts @@ -1,4 +1,4 @@ -import { TableSortOrder } from "enums"; +import { TableSortOrder } from "@/enums"; /** * Default sort key of infill development compensation list page diff --git a/src/infillDevelopment/helpers.ts b/src/infillDevelopment/helpers.ts index 7f894d17b..35d195c6a 100644 --- a/src/infillDevelopment/helpers.ts +++ b/src/infillDevelopment/helpers.ts @@ -1,14 +1,14 @@ import get from "lodash/get"; import { isDirty } from "redux-form"; -import { FormNames, TableSortOrder } from "enums"; -import { getContentLeaseIdentifier, getContentLeaseOption } from "leases/helpers"; -import { getContentUser } from "users/helpers"; -import { convertStrToDecimalNumber, getApiResponseResults } from "util/helpers"; -import { getIsEditMode } from "infillDevelopment/selectors"; -import { removeSessionStorageItem } from "util/storage"; -import { getContentLeaseAreasFeatures, getContentPlanUnitFeatures, getContentLeasePlotsFeatures } from "leases/helpers"; +import { FormNames, TableSortOrder } from "@/enums"; +import { getContentLeaseIdentifier, getContentLeaseOption } from "@/leases/helpers"; +import { getContentUser } from "@/users/helpers"; +import { convertStrToDecimalNumber, getApiResponseResults } from "@/util/helpers"; +import { getIsEditMode } from "@/infillDevelopment/selectors"; +import { removeSessionStorageItem } from "@/util/storage"; +import { getContentLeaseAreasFeatures, getContentPlanUnitFeatures, getContentLeasePlotsFeatures } from "@/leases/helpers"; import type { LeafletGeoJson } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; /** * Get infill development compensation list results diff --git a/src/infillDevelopment/spec.ts b/src/infillDevelopment/infillDevelopment.spec.ts similarity index 99% rename from src/infillDevelopment/spec.ts rename to src/infillDevelopment/infillDevelopment.spec.ts index 8fe454826..803fe60a9 100644 --- a/src/infillDevelopment/spec.ts +++ b/src/infillDevelopment/infillDevelopment.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchInfillDevelopments, fetchSingleInfillDevelopment, hideEditMode, notFound, fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, receiveInfillDevelopments, receiveSingleInfillDevelopment, receiveFormInitialValues, createInfillDevelopment, editInfillDevelopment, showEditMode, receiveFormValidFlags, clearFormValidFlags, receiveIsSaveClicked, receiveCollapseStates } from "./actions"; import infillDevelopmentReducer from "./reducer"; import type { InfillDevelopmentState } from "./types"; diff --git a/src/infillDevelopment/reducer.ts b/src/infillDevelopment/reducer.ts index 95a73f7ca..ba177f640 100644 --- a/src/infillDevelopment/reducer.ts +++ b/src/infillDevelopment/reducer.ts @@ -1,8 +1,8 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; import merge from "lodash/merge"; -import { FormNames } from "enums"; -import type { Attributes, Methods, Reducer } from "../types"; +import { FormNames } from "@/enums"; +import type { Attributes, Methods, Reducer } from "@/types"; import type { InfillDevelopment, InfillDevelopmentList, ReceiveAttributesAction, ReceiveMethodsAction, ReceiveFormInitialValuesAction, ReceiveFormValidFlagsAction, ReceiveInfillDevelopmentListAction, ReceiveIsSaveClickedAction, ReceiveSingleInfillDevelopmentAction, ReceiveCollapseStatesAction } from "./types"; const isEditModeReducer: Reducer = handleActions({ 'mvj/infillDevelopment/HIDE_EDIT': () => false, diff --git a/src/infillDevelopment/requests.ts b/src/infillDevelopment/requests.ts index 36b727fa0..f968fef62 100644 --- a/src/infillDevelopment/requests.ts +++ b/src/infillDevelopment/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; import type { InfillDevelopment, InfillDevelopmentId } from "./types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl(`infill_development_compensation/`), { diff --git a/src/infillDevelopment/saga.ts b/src/infillDevelopment/saga.ts index 7948b7b8d..7936147b8 100644 --- a/src/infillDevelopment/saga.ts +++ b/src/infillDevelopment/saga.ts @@ -2,10 +2,10 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { push } from "react-router-redux"; import { SubmissionError } from "redux-form"; import { fetchSingleInfillDevelopment as fetchSingleInfillDevelopmentAction, hideEditMode, attributesNotFound, notFound, receiveIsSaveClicked, receiveAttributes, receiveMethods, receiveInfillDevelopments, receiveSingleInfillDevelopment } from "./actions"; -import { receiveError } from "api/actions"; -import { displayUIMessage } from "util/helpers"; +import { receiveError } from "@/api/actions"; +import { displayUIMessage } from "@/util/helpers"; import { createInfillDevelopment, editInfillDevelopment, fetchAttributes, fetchInfillDevelopments, fetchSingleInfillDevelopment } from "./requests"; -import { getRouteById, Routes } from "root/routes"; +import { getRouteById, Routes } from "@/root/routes"; function* fetchAttributesSaga(): Generator { try { diff --git a/src/infillDevelopment/selectors.ts b/src/infillDevelopment/selectors.ts index 7592ccee5..475452437 100644 --- a/src/infillDevelopment/selectors.ts +++ b/src/infillDevelopment/selectors.ts @@ -1,6 +1,6 @@ import get from "lodash/get"; import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { InfillDevelopment, InfillDevelopmentList } from "./types"; export const getAttributes: Selector = (state: RootState): Attributes => state.infillDevelopment.attributes; export const getMethods: Selector = (state: RootState): Methods => state.infillDevelopment.methods; diff --git a/src/infillDevelopment/types.ts b/src/infillDevelopment/types.ts index 36b1049bc..51c93681d 100644 --- a/src/infillDevelopment/types.ts +++ b/src/infillDevelopment/types.ts @@ -1,4 +1,4 @@ -import type { Action, Attributes, Methods } from "../types"; +import type { Action, Attributes, Methods } from "@/types"; export type InfillDevelopmentState = { attributes: Attributes; collapseStates: Record; diff --git a/src/infillDevelopmentAttachment/spec.ts b/src/infillDevelopmentAttachment/infillDevelopmentAttachment.spec.ts similarity index 98% rename from src/infillDevelopmentAttachment/spec.ts rename to src/infillDevelopmentAttachment/infillDevelopmentAttachment.spec.ts index d6ac46bc3..74110550b 100644 --- a/src/infillDevelopmentAttachment/spec.ts +++ b/src/infillDevelopmentAttachment/infillDevelopmentAttachment.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, createInfillDevelopmentAttachment, deleteInfillDevelopmentAttachment } from "./actions"; import infillDevelopmentAttachmentReducer from "./reducer"; import type { InfillDevelopmentAttachmentState } from "./types"; diff --git a/src/infillDevelopmentAttachment/reducer.ts b/src/infillDevelopmentAttachment/reducer.ts index c4a3570fe..2a1683736 100644 --- a/src/infillDevelopmentAttachment/reducer.ts +++ b/src/infillDevelopmentAttachment/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Attributes, Methods, Reducer } from "../types"; +import type { Attributes, Methods, Reducer } from "@/types"; import type { ReceiveAttributesAction, ReceiveMethodsAction } from "./types"; const isFetchingAttributesReducer: Reducer = handleActions({ 'mvj/infillDevelopmentAttachment/FETCH_ATTRIBUTES': () => true, diff --git a/src/infillDevelopmentAttachment/requests.ts b/src/infillDevelopmentAttachment/requests.ts index 33061c4d8..1c2f2cc3c 100644 --- a/src/infillDevelopmentAttachment/requests.ts +++ b/src/infillDevelopmentAttachment/requests.ts @@ -1,6 +1,6 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; -import callUploadRequest from "api/callUploadRequest"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; +import callUploadRequest from "@/api/callUploadRequest"; import type { CreateInfillDevelopmentAttachmentPayload } from "./types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl(`infill_development_compensation_attachment/`), { diff --git a/src/infillDevelopmentAttachment/saga.ts b/src/infillDevelopmentAttachment/saga.ts index 5de29ffc1..9724dea37 100644 --- a/src/infillDevelopmentAttachment/saga.ts +++ b/src/infillDevelopmentAttachment/saga.ts @@ -1,9 +1,9 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; import { attributesNotFound, receiveAttributes, receiveMethods } from "./actions"; -import { fetchSingleInfillDevelopment } from "infillDevelopment/actions"; -import { receiveError } from "api/actions"; -import { displayUIMessage } from "util/helpers"; +import { fetchSingleInfillDevelopment } from "@/infillDevelopment/actions"; +import { receiveError } from "@/api/actions"; +import { displayUIMessage } from "@/util/helpers"; import { fetchAttributes, createInfillDevelopmentAttachment, deleteInfillDevelopmentAttachment } from "./requests"; function* fetchAttributesSaga(): Generator { diff --git a/src/infillDevelopmentAttachment/selectors.ts b/src/infillDevelopmentAttachment/selectors.ts index d0ea22164..5eafbd1b3 100644 --- a/src/infillDevelopmentAttachment/selectors.ts +++ b/src/infillDevelopmentAttachment/selectors.ts @@ -1,5 +1,5 @@ import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; export const getAttributes: Selector = (state: RootState): Attributes => state.infillDevelopmentAttachment.attributes; export const getMethods: Selector = (state: RootState): Methods => state.infillDevelopmentAttachment.methods; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.infillDevelopmentAttachment.isFetchingAttributes; \ No newline at end of file diff --git a/src/infillDevelopmentAttachment/types.ts b/src/infillDevelopmentAttachment/types.ts index c44b1f69d..b61d632cc 100644 --- a/src/infillDevelopmentAttachment/types.ts +++ b/src/infillDevelopmentAttachment/types.ts @@ -1,5 +1,5 @@ -import type { Action, Attributes, Methods } from "../types"; -import type { InfillDevelopmentId } from "infillDevelopment/types"; +import type { Action, Attributes, Methods } from "@/types"; +import type { InfillDevelopmentId } from "@/infillDevelopment/types"; export type InfillDevelopmentAttachmentState = { attributes: Attributes; isFetchingAttributes: boolean; diff --git a/src/invoiceNote/components/CreateInvoiceNoteModal.tsx b/src/invoiceNote/components/CreateInvoiceNoteModal.tsx index 518a00325..9f8b0b882 100644 --- a/src/invoiceNote/components/CreateInvoiceNoteModal.tsx +++ b/src/invoiceNote/components/CreateInvoiceNoteModal.tsx @@ -3,18 +3,18 @@ import { reduxForm } from "redux-form"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import Button from "components/button/Button"; -import FormField from "components/form/FormField"; -import Modal from "components/modal/Modal"; -import ModalButtonWrapper from "components/modal/ModalButtonWrapper"; -import { FieldTypes, FormNames } from "enums"; -import { InvoiceNoteFieldPaths, InvoiceNoteFieldTitles } from "invoiceNote/enums"; -import { ButtonColors } from "components/enums"; -import { getFieldAttributes } from "util/helpers"; -import { getAttributes } from "invoiceNote/selectors"; -import { getUserActiveServiceUnit } from "usersPermissions/selectors"; +import Button from "@/components/button/Button"; +import FormField from "@/components/form/FormField"; +import Modal from "@/components/modal/Modal"; +import ModalButtonWrapper from "@/components/modal/ModalButtonWrapper"; +import { FieldTypes, FormNames } from "@/enums"; +import { InvoiceNoteFieldPaths, InvoiceNoteFieldTitles } from "@/invoiceNote/enums"; +import { ButtonColors } from "@/components/enums"; +import { getFieldAttributes } from "@/util/helpers"; +import { getAttributes } from "@/invoiceNote/selectors"; +import { getUserActiveServiceUnit } from "@/usersPermissions/selectors"; import type { Attributes } from "types"; -import type { UserServiceUnit } from "usersPermissions/types"; +import type { UserServiceUnit } from "@/usersPermissions/types"; type Props = { handleSubmit: (...args: Array) => any; initialize: (...args: Array) => any; diff --git a/src/invoiceNote/components/InvoiceNoteListPage.tsx b/src/invoiceNote/components/InvoiceNoteListPage.tsx index d6efc99b3..70d4d66d8 100644 --- a/src/invoiceNote/components/InvoiceNoteListPage.tsx +++ b/src/invoiceNote/components/InvoiceNoteListPage.tsx @@ -5,34 +5,34 @@ import { withRouter } from "react-router"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import Authorization from "components/authorization/Authorization"; -import AuthorizationError from "components/authorization/AuthorizationError"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import Authorization from "@/components/authorization/Authorization"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; import CreateInvoiceNoteModal from "./CreateInvoiceNoteModal"; -import ExternalLink from "components/links/ExternalLink"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import Pagination from "components/table/Pagination"; +import ExternalLink from "@/components/links/ExternalLink"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import Pagination from "@/components/table/Pagination"; import Search from "./Search"; -import ShowMore from "components/showMore/ShowMore"; -import SortableTable from "components/table/SortableTable"; -import TableFilters from "components/table/TableFilters"; -import TableWrapper from "components/table/TableWrapper"; -import { createInvoiceNoteAndFetchList, fetchInvoiceNoteList, hideCreateInvoiceNoteModal, receiveInvoiceNoteList, showCreateInvoiceNoteModal } from "invoiceNote/actions"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import { FormNames, Methods, PermissionMissingTexts } from "enums"; -import { InvoiceNoteFieldPaths, InvoiceNoteFieldTitles } from "invoiceNote/enums"; -import { getContentLeaseIdentifier } from "leases/helpers"; -import { formatDate, getApiResponseCount, getApiResponseResults, getApiResponseMaxPage, getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getInvoiceNoteList, getIsCreateModalOpen, getIsFetching } from "invoiceNote/selectors"; -import { withInvoiceNoteAttributes } from "components/attributes/InvoiceNoteAttributes"; -import { getUserActiveServiceUnit } from "usersPermissions/selectors"; +import ShowMore from "@/components/showMore/ShowMore"; +import SortableTable from "@/components/table/SortableTable"; +import TableFilters from "@/components/table/TableFilters"; +import TableWrapper from "@/components/table/TableWrapper"; +import { createInvoiceNoteAndFetchList, fetchInvoiceNoteList, hideCreateInvoiceNoteModal, receiveInvoiceNoteList, showCreateInvoiceNoteModal } from "@/invoiceNote/actions"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import { FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import { InvoiceNoteFieldPaths, InvoiceNoteFieldTitles } from "@/invoiceNote/enums"; +import { getContentLeaseIdentifier } from "@/leases/helpers"; +import { formatDate, getApiResponseCount, getApiResponseResults, getApiResponseMaxPage, getSearchQuery, getUrlParams, isFieldAllowedToRead, isMethodAllowed } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getInvoiceNoteList, getIsCreateModalOpen, getIsFetching } from "@/invoiceNote/selectors"; +import { withInvoiceNoteAttributes } from "@/components/attributes/InvoiceNoteAttributes"; +import { getUserActiveServiceUnit } from "@/usersPermissions/selectors"; import type { Attributes, Methods as MethodsType } from "types"; -import type { InvoiceNoteList } from "invoiceNote/types"; -import type { UserServiceUnit } from "usersPermissions/types"; +import type { InvoiceNoteList } from "@/invoiceNote/types"; +import type { UserServiceUnit } from "@/usersPermissions/types"; const getColumns = (invoiceNoteAttributes: Attributes) => { const columns = []; diff --git a/src/invoiceNote/components/Search.tsx b/src/invoiceNote/components/Search.tsx index f049b3976..fbe7950e3 100644 --- a/src/invoiceNote/components/Search.tsx +++ b/src/invoiceNote/components/Search.tsx @@ -5,12 +5,12 @@ import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; import isEqual from "lodash/isEqual"; import isEmpty from "lodash/isEmpty"; -import FormField from "components/form/FormField"; -import SearchContainer from "components/search/SearchContainer"; -import { FieldTypes, FormNames } from "enums"; -import { fetchServiceUnits } from "serviceUnits/actions"; -import { getServiceUnits, getIsFetching as getIsFetchingServiceUnits } from "serviceUnits/selectors"; -import type { ServiceUnits } from "serviceUnits/types"; +import FormField from "@/components/form/FormField"; +import SearchContainer from "@/components/search/SearchContainer"; +import { FieldTypes, FormNames } from "@/enums"; +import { fetchServiceUnits } from "@/serviceUnits/actions"; +import { getServiceUnits, getIsFetching as getIsFetchingServiceUnits } from "@/serviceUnits/selectors"; +import type { ServiceUnits } from "@/serviceUnits/types"; type Props = { formValues: Record; fetchServiceUnits: (...args: Array) => any; diff --git a/src/invoiceNote/spec.ts b/src/invoiceNote/invoiceNote.spec.ts similarity index 98% rename from src/invoiceNote/spec.ts rename to src/invoiceNote/invoiceNote.spec.ts index c7bab2ad2..55a6f7ea3 100644 --- a/src/invoiceNote/spec.ts +++ b/src/invoiceNote/invoiceNote.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, fetchInvoiceNoteList, receiveInvoiceNoteList, createInvoiceNoteAndFetchList, notFound, hideCreateInvoiceNoteModal, showCreateInvoiceNoteModal } from "./actions"; import invoiceNoteReducer from "./reducer"; import type { InvoiceNoteState } from "./types"; diff --git a/src/invoiceNote/requests.ts b/src/invoiceNote/requests.ts index 5965cb497..f1ba6cbb6 100644 --- a/src/invoiceNote/requests.ts +++ b/src/invoiceNote/requests.ts @@ -1,5 +1,5 @@ -import callApi from "api/callApi"; -import createUrl from "api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl('invoice_note/'), { method: 'OPTIONS' diff --git a/src/invoiceNote/saga.ts b/src/invoiceNote/saga.ts index c2fdf1735..e43758e82 100644 --- a/src/invoiceNote/saga.ts +++ b/src/invoiceNote/saga.ts @@ -1,8 +1,8 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; -import { receiveError } from "api/actions"; +import { receiveError } from "@/api/actions"; import { attributesNotFound, fetchInvoiceNoteList, hideCreateInvoiceNoteModal, notFound, receiveAttributes, receiveInvoiceNoteList, receiveMethods } from "./actions"; -import { displayUIMessage } from "util/helpers"; +import { displayUIMessage } from "@/util/helpers"; import { createInvoiceNote, fetchAttributes, fetchInvoiceNotes } from "./requests"; function* fetchAttributesSaga(): Generator { diff --git a/src/invoiceNote/selectors.ts b/src/invoiceNote/selectors.ts index 8d9cce6be..8ad5be3b3 100644 --- a/src/invoiceNote/selectors.ts +++ b/src/invoiceNote/selectors.ts @@ -1,6 +1,6 @@ -import type { Attributes, Methods, Selector } from "../types"; -import type { RootState } from "root/types"; -import type { InvoiceNoteList } from "invoiceNote/types"; +import type { Attributes, Methods, Selector } from "@/types"; +import type { RootState } from "@/root/types"; +import type { InvoiceNoteList } from "@/invoiceNote/types"; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.invoiceNote.isFetchingAttributes; export const getAttributes: Selector = (state: RootState): Attributes => state.invoiceNote.attributes; export const getMethods: Selector = (state: RootState): Methods => state.invoiceNote.methods; diff --git a/src/invoiceSets/actions.ts b/src/invoiceSets/actions.ts index 8c3d0420e..8e7263580 100644 --- a/src/invoiceSets/actions.ts +++ b/src/invoiceSets/actions.ts @@ -1,5 +1,5 @@ import { createAction } from "redux-actions"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; import type { FetchInvoiceSetsByLeaseAction, ReceiveInvoiceSetsByLeaseAction, CreditInvoiceSetAction, InvoiceSetsNotFoundAction } from "./types"; export const fetchInvoiceSetsByLease = (leaseId: LeaseId): FetchInvoiceSetsByLeaseAction => createAction('mvj/invoiceSets/FETCH_BY_LEASE')(leaseId); export const receiveInvoiceSetsByLease = (payload: Record): ReceiveInvoiceSetsByLeaseAction => createAction('mvj/invoiceSets/RECEIVE_BY_LEASE')(payload); diff --git a/src/invoiceSets/helpers.ts b/src/invoiceSets/helpers.ts index 61f32a08f..b9df79074 100644 --- a/src/invoiceSets/helpers.ts +++ b/src/invoiceSets/helpers.ts @@ -1,5 +1,5 @@ -import { CreditInvoiceOptions } from "leases/enums"; -import { convertStrToDecimalNumber } from "util/helpers"; +import { CreditInvoiceOptions } from "@/leases/enums"; +import { convertStrToDecimalNumber } from "@/util/helpers"; /** * Get credit invoice set payload for API diff --git a/src/invoiceSets/spec.ts b/src/invoiceSets/invoiceSets.spec.ts similarity index 97% rename from src/invoiceSets/spec.ts rename to src/invoiceSets/invoiceSets.spec.ts index 513e60fd4..0256b9f16 100644 --- a/src/invoiceSets/spec.ts +++ b/src/invoiceSets/invoiceSets.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { receiveInvoiceSetsByLease, fetchInvoiceSetsByLease, notFound, creditInvoiceSet } from "./actions"; import invoiceSetsReducer from "./reducer"; import type { InvoiceSetState } from "./types"; diff --git a/src/invoiceSets/reducer.ts b/src/invoiceSets/reducer.ts index 43a672a10..b1b559279 100644 --- a/src/invoiceSets/reducer.ts +++ b/src/invoiceSets/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Reducer } from "../types"; +import type { Reducer } from "@/types"; import type { InvoiceSetListMap, ReceiveInvoiceSetsByLeaseAction } from "./types"; const isFetchingReducer: Reducer = handleActions({ ['mvj/invoiceSets/FETCH_BY_LEASE']: () => true, diff --git a/src/invoiceSets/requests.ts b/src/invoiceSets/requests.ts index eb642f5e2..88b450d30 100644 --- a/src/invoiceSets/requests.ts +++ b/src/invoiceSets/requests.ts @@ -1,6 +1,6 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; -import type { LeaseId } from "leases/types"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; +import type { LeaseId } from "@/leases/types"; export const fetchInvoiceSetsByLease = (leaseId: LeaseId): Generator => { return callApi(new Request(createUrl(`invoice_set/?lease=${leaseId}&limit=10000`))); }; diff --git a/src/invoiceSets/saga.ts b/src/invoiceSets/saga.ts index f8ab16572..ae5d29890 100644 --- a/src/invoiceSets/saga.ts +++ b/src/invoiceSets/saga.ts @@ -1,9 +1,9 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; -import { fetchInvoicesByLease, receiveInvoiceToCredit, receiveIsCreditInvoicePanelOpen } from "invoices/actions"; +import { fetchInvoicesByLease, receiveInvoiceToCredit, receiveIsCreditInvoicePanelOpen } from "@/invoices/actions"; import { fetchInvoiceSetsByLease as fetchInvoiceSetsByLeaseAction, notFound, receiveInvoiceSetsByLease } from "./actions"; -import { receiveError } from "api/actions"; -import { displayUIMessage } from "util/helpers"; +import { receiveError } from "@/api/actions"; +import { displayUIMessage } from "@/util/helpers"; import { creditInvoiceSet, fetchInvoiceSetsByLease } from "./requests"; function* fetchInvoiceSetsByLeaseSaga({ diff --git a/src/invoiceSets/selectors.ts b/src/invoiceSets/selectors.ts index 24fb137a6..b62c4f8b2 100644 --- a/src/invoiceSets/selectors.ts +++ b/src/invoiceSets/selectors.ts @@ -1,7 +1,7 @@ import type { Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { InvoiceSetList } from "./types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export const getIsFetching: Selector = (state: RootState): boolean => state.invoiceSet.isFetching; export const getInvoiceSetsByLease: Selector = (state: RootState, leaseId: LeaseId): InvoiceSetList => { return state.invoiceSet.byLease[leaseId]; diff --git a/src/invoiceSets/types.ts b/src/invoiceSets/types.ts index 5e41f2a6c..17f252ecd 100644 --- a/src/invoiceSets/types.ts +++ b/src/invoiceSets/types.ts @@ -1,5 +1,5 @@ -import type { Action } from "../types"; -import type { LeaseId } from "leases/types"; +import type { Action } from "@/types"; +import type { LeaseId } from "@/leases/types"; export type InvoiceSetState = { byLease: InvoiceSetListMap; isFetching: boolean; diff --git a/src/invoices/actions.ts b/src/invoices/actions.ts index b98bd84bd..5e02899ec 100644 --- a/src/invoices/actions.ts +++ b/src/invoices/actions.ts @@ -1,7 +1,7 @@ import { createAction } from "redux-actions"; import type { Attributes, Methods } from "types"; import type { FetchAttributesAction, ReceiveAttributesAction, ReceiveMethodsAction, InvoiceAttributesNotFoundAction, Invoice, InvoiceListMap, FetchInvoicesByLeaseAction, ReceiveInvoicesByLeaseAction, CreateInvoiceAction, CreditInvoiceAction, PatchInvoiceAction, ExportInvoiceToLaskeAndUpdateListAction, ExportInvoiceToLaskeAndUpdateListPayload, ReceivePatchedInvoiceAction, ClearPatchedInvoiceAction, InvoiceNotFoundAction, ReceiveInvoiceToCreditAction, ReceiveIsCreateInvoicePanelOpenAction, ReceiveIsCreditInvoicePanelOpenAction, ReceiveIsCreateClickedAction, ReceiveIsCreditClickedAction, ReceiveIsEditClickedAction, DeleteInvoiceAction } from "./types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export const fetchAttributes = (): FetchAttributesAction => createAction('mvj/invoices/FETCH_ATTRIBUTES')(); export const receiveAttributes = (attributes: Attributes): ReceiveAttributesAction => createAction('mvj/invoices/RECEIVE_ATTRIBUTES')(attributes); export const receiveMethods = (methods: Methods): ReceiveMethodsAction => createAction('mvj/invoices/RECEIVE_METHODS')(methods); diff --git a/src/invoices/helpers.ts b/src/invoices/helpers.ts index dec624de1..78b00f8a9 100644 --- a/src/invoices/helpers.ts +++ b/src/invoices/helpers.ts @@ -1,9 +1,9 @@ import isPast from "date-fns/isPast"; import forEach from "lodash/forEach"; import get from "lodash/get"; -import { CreditInvoiceOptions } from "leases/enums"; +import { CreditInvoiceOptions } from "@/leases/enums"; import { InvoiceState, InvoiceType, ReceivableTypes } from "./enums"; -import { convertStrToDecimalNumber, getLabelOfOption, sortStringAsc } from "util/helpers"; +import { convertStrToDecimalNumber, getLabelOfOption, sortStringAsc } from "@/util/helpers"; /** * Get payments of single invoice to show on UI diff --git a/src/invoices/spec.ts b/src/invoices/invoices.spec.ts similarity index 99% rename from src/invoices/spec.ts rename to src/invoices/invoices.spec.ts index 440c8fc91..77ee4f4d8 100644 --- a/src/invoices/spec.ts +++ b/src/invoices/invoices.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { receiveAttributes, receiveMethods, fetchAttributes, attributesNotFound, receiveInvoicesByLease, receiveIsCreateInvoicePanelOpen, receiveIsCreditInvoicePanelOpen, receiveIsCreateClicked, receiveIsCreditClicked, receiveIsEditClicked, fetchInvoicesByLease, createInvoice, patchInvoice, exportInvoiceToLaskeAndUpdateList, receivePatchedInvoice, clearPatchedInvoice, notFound, receiveInvoiceToCredit, creditInvoice, deleteInvoice } from "./actions"; import invoiceReducer from "./reducer"; import type { InvoiceState } from "./types"; diff --git a/src/invoices/reducer.ts b/src/invoices/reducer.ts index 9a0af705a..9412f93b6 100644 --- a/src/invoices/reducer.ts +++ b/src/invoices/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Attributes, Methods, Reducer } from "../types"; +import type { Attributes, Methods, Reducer } from "@/types"; import type { ReceiveAttributesAction, ReceiveMethodsAction, Invoice, InvoiceListMap, ReceiveInvoicesByLeaseAction, ReceiveInvoiceToCreditAction, ReceiveIsCreateInvoicePanelOpenAction, ReceiveIsCreditInvoicePanelOpenAction, ReceiveIsCreateClickedAction, ReceiveIsCreditClickedAction, ReceiveIsEditClickedAction, ReceivePatchedInvoiceAction } from "./types"; const isFetchingReducer: Reducer = handleActions({ 'mvj/invoices/CREATE': () => true, diff --git a/src/invoices/requests.ts b/src/invoices/requests.ts index 40a8e08af..f563ffa6a 100644 --- a/src/invoices/requests.ts +++ b/src/invoices/requests.ts @@ -1,5 +1,5 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; import type { Invoice, InvoiceId } from "./types"; export const fetchAttributes = () => { return callApi(new Request(createUrl('invoice/'), { diff --git a/src/invoices/saga.ts b/src/invoices/saga.ts index ff65d3ef6..fe42750b2 100644 --- a/src/invoices/saga.ts +++ b/src/invoices/saga.ts @@ -1,8 +1,8 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; import { fetchInvoicesByLease, receiveAttributes, receiveMethods, attributesNotFound, receiveInvoicesByLease, receiveInvoiceToCredit, receiveIsCreateInvoicePanelOpen, receiveIsCreditInvoicePanelOpen, receiveIsEditClicked, receivePatchedInvoice, notFound } from "./actions"; -import { receiveError } from "api/actions"; -import { displayUIMessage } from "util/helpers"; +import { receiveError } from "@/api/actions"; +import { displayUIMessage } from "@/util/helpers"; import { exportInvoiceToLaske, fetchAttributes, fetchInvoices, createInvoice, creditInvoice, patchInvoice, deleteInvoice } from "./requests"; function* fetchAttributesSaga(): Generator { diff --git a/src/invoices/selectors.ts b/src/invoices/selectors.ts index afa103be5..6fbc015c7 100644 --- a/src/invoices/selectors.ts +++ b/src/invoices/selectors.ts @@ -1,7 +1,7 @@ import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; import type { Invoice, InvoiceList } from "./types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export const getIsFetching: Selector = (state: RootState): boolean => state.invoice.isFetching; export const getIsSaving: Selector = (state: RootState): boolean => state.invoice.isSaving; export const getIsCreateInvoicePanelOpen: Selector = (state: RootState): boolean => state.invoice.isCreatePanelOpen; diff --git a/src/invoices/types.ts b/src/invoices/types.ts index 7b2117c11..ba904404c 100644 --- a/src/invoices/types.ts +++ b/src/invoices/types.ts @@ -1,5 +1,5 @@ import type { Action, Attributes, Methods } from "types"; -import type { LeaseId } from "leases/types"; +import type { LeaseId } from "@/leases/types"; export type InvoiceState = { attributes: Attributes; byLease: InvoiceListMap; diff --git a/src/landUseAgreementAttachment/spec.ts b/src/landUseAgreementAttachment/landUseAgreementAttachment.spec.ts similarity index 98% rename from src/landUseAgreementAttachment/spec.ts rename to src/landUseAgreementAttachment/landUseAgreementAttachment.spec.ts index 64893c146..e4a621f22 100644 --- a/src/landUseAgreementAttachment/spec.ts +++ b/src/landUseAgreementAttachment/landUseAgreementAttachment.spec.ts @@ -1,4 +1,4 @@ -import { expect } from "chai"; +import { describe, expect, it } from "vitest"; import { fetchAttributes, attributesNotFound, receiveAttributes, receiveMethods, createLandUseAgreementAttachment, deleteLandUseAgreementAttachment } from "./actions"; import landUseAgreementAttachmentReducer from "./reducer"; import type { LandUseAgreementAttachmentState } from "./types"; diff --git a/src/landUseAgreementAttachment/reducer.ts b/src/landUseAgreementAttachment/reducer.ts index 50fa18838..975ca5622 100644 --- a/src/landUseAgreementAttachment/reducer.ts +++ b/src/landUseAgreementAttachment/reducer.ts @@ -1,6 +1,6 @@ import { combineReducers } from "redux"; import { handleActions } from "redux-actions"; -import type { Attributes, Methods, Reducer } from "../types"; +import type { Attributes, Methods, Reducer } from "@/types"; import type { ReceiveAttributesAction, ReceiveMethodsAction } from "./types"; const isFetchingAttributesReducer: Reducer = handleActions({ 'mvj/landUseAgreementAttachment/FETCH_ATTRIBUTES': () => true, diff --git a/src/landUseAgreementAttachment/requests.ts b/src/landUseAgreementAttachment/requests.ts index 02775b987..0a2880b9f 100644 --- a/src/landUseAgreementAttachment/requests.ts +++ b/src/landUseAgreementAttachment/requests.ts @@ -1,6 +1,6 @@ -import callApi from "../api/callApi"; -import createUrl from "../api/createUrl"; -import callUploadRequest from "api/callUploadRequest"; +import callApi from "@/api/callApi"; +import createUrl from "@/api/createUrl"; +import callUploadRequest from "@/api/callUploadRequest"; import type { CreateLandUseAgreementAttachmentPayload } from "./types"; export const fetchAttributes = (): Generator => { return callApi(new Request(createUrl(`land_use_agreement_attachment/`), { diff --git a/src/landUseAgreementAttachment/saga.ts b/src/landUseAgreementAttachment/saga.ts index 4955e828e..0b2689e46 100644 --- a/src/landUseAgreementAttachment/saga.ts +++ b/src/landUseAgreementAttachment/saga.ts @@ -1,9 +1,9 @@ import { all, call, fork, put, takeLatest } from "redux-saga/effects"; import { SubmissionError } from "redux-form"; import { attributesNotFound, receiveAttributes, receiveMethods } from "./actions"; -import { fetchSingleLandUseContract } from "landUseContract/actions"; -import { receiveError } from "api/actions"; -import { displayUIMessage } from "util/helpers"; +import { fetchSingleLandUseContract } from "@/landUseContract/actions"; +import { receiveError } from "@/api/actions"; +import { displayUIMessage } from "@/util/helpers"; import { fetchAttributes, createLandUseAgreementAttachment, deleteLandUseAgreementAttachment } from "./requests"; function* fetchAttributesSaga(): Generator { diff --git a/src/landUseAgreementAttachment/selectors.ts b/src/landUseAgreementAttachment/selectors.ts index 5661caf87..bb3cecc88 100644 --- a/src/landUseAgreementAttachment/selectors.ts +++ b/src/landUseAgreementAttachment/selectors.ts @@ -1,5 +1,5 @@ import type { Attributes, Methods, Selector } from "types"; -import type { RootState } from "root/types"; +import type { RootState } from "@/root/types"; export const getAttributes: Selector = (state: RootState): Attributes => state.landUseAgreementAttachment.attributes; export const getMethods: Selector = (state: RootState): Methods => state.landUseAgreementAttachment.methods; export const getIsFetchingAttributes: Selector = (state: RootState): boolean => state.landUseAgreementAttachment.isFetchingAttributes; \ No newline at end of file diff --git a/src/landUseAgreementAttachment/types.ts b/src/landUseAgreementAttachment/types.ts index 7fde2e4af..48a43729e 100644 --- a/src/landUseAgreementAttachment/types.ts +++ b/src/landUseAgreementAttachment/types.ts @@ -1,4 +1,4 @@ -import type { Action, Attributes, Methods } from "../types"; +import type { Action, Attributes, Methods } from "@/types"; export type LandUseAgreementAttachmentState = { attributes: Attributes; isFetchingAttributes: boolean; diff --git a/src/landUseContract/components/LandUseContractListPage.tsx b/src/landUseContract/components/LandUseContractListPage.tsx index c9e61d073..42c3d30dc 100644 --- a/src/landUseContract/components/LandUseContractListPage.tsx +++ b/src/landUseContract/components/LandUseContractListPage.tsx @@ -5,29 +5,29 @@ import { connect } from "react-redux"; import { initialize } from "redux-form"; import flowRight from "lodash/flowRight"; import isArray from "lodash/isArray"; -import Authorization from "components/authorization/Authorization"; -import AuthorizationError from "components/authorization/AuthorizationError"; -import { FormNames, Methods, PermissionMissingTexts } from "enums"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; +import Authorization from "@/components/authorization/Authorization"; +import AuthorizationError from "@/components/authorization/AuthorizationError"; +import { FormNames, Methods, PermissionMissingTexts } from "@/enums"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; import CreateLandUseContractModal from "./createLandUseContract/CreateLandUseContractModal"; -import Loader from "components/loader/Loader"; -import LoaderWrapper from "components/loader/LoaderWrapper"; -import PageContainer from "components/content/PageContainer"; -import Pagination from "components/table/Pagination"; +import Loader from "@/components/loader/Loader"; +import LoaderWrapper from "@/components/loader/LoaderWrapper"; +import PageContainer from "@/components/content/PageContainer"; +import Pagination from "@/components/table/Pagination"; import Search from "./search/Search"; -import SortableTable from "components/table/SortableTable"; -import TableFilters from "components/table/TableFilters"; -import TableWrapper from "components/table/TableWrapper"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { createLandUseContract, fetchLandUseContractList } from "landUseContract/actions"; -import { LIST_TABLE_PAGE_SIZE } from "util/constants"; -import { getContentLandUseContractListResults } from "landUseContract/helpers"; -import { getApiResponseCount, getApiResponseMaxPage, getFieldOptions, getLabelOfOption, getSearchQuery, getUrlParams, setPageTitle, isMethodAllowed } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getIsFetching, getLandUseContractList } from "landUseContract/selectors"; -import { withLandUseContractAttributes } from "components/attributes/LandUseContractAttributes"; +import SortableTable from "@/components/table/SortableTable"; +import TableFilters from "@/components/table/TableFilters"; +import TableWrapper from "@/components/table/TableWrapper"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { createLandUseContract, fetchLandUseContractList } from "@/landUseContract/actions"; +import { LIST_TABLE_PAGE_SIZE } from "@/util/constants"; +import { getContentLandUseContractListResults } from "@/landUseContract/helpers"; +import { getApiResponseCount, getApiResponseMaxPage, getFieldOptions, getLabelOfOption, getSearchQuery, getUrlParams, setPageTitle, isMethodAllowed } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getIsFetching, getLandUseContractList } from "@/landUseContract/selectors"; +import { withLandUseContractAttributes } from "@/components/attributes/LandUseContractAttributes"; import type { Attributes, Methods as MethodType } from "types"; -import type { LandUseContract, LandUseContractList } from "landUseContract/types"; +import type { LandUseContract, LandUseContractList } from "@/landUseContract/types"; type Props = { createLandUseContract: (...args: Array) => any; fetchLandUseContractList: (...args: Array) => any; diff --git a/src/landUseContract/components/LandUseContractPage.tsx b/src/landUseContract/components/LandUseContractPage.tsx index a2901c95e..41bf97900 100644 --- a/src/landUseContract/components/LandUseContractPage.tsx +++ b/src/landUseContract/components/LandUseContractPage.tsx @@ -4,53 +4,53 @@ import { withRouter } from "react-router"; import { change, destroy, getFormValues, initialize, isDirty } from "redux-form"; import flowRight from "lodash/flowRight"; import isEmpty from "lodash/isEmpty"; -import { withUiDataList } from "components/uiData/UiDataListHOC"; +import { withUiDataList } from "@/components/uiData/UiDataListHOC"; import BasicInformation from "./sections/BasicInformation"; import BasicInformationEdit from "./sections/BasicInformationEdit"; import Conditions from "./sections/Conditions"; import ConditionsEdit from "./sections/ConditionsEdit"; import Compensations from "./sections/Compensations"; import CompensationsEdit from "./sections/CompensationsEdit"; -import ConfirmationModal from "components/modal/ConfirmationModal"; -import ContentContainer from "components/content/ContentContainer"; +import ConfirmationModal from "@/components/modal/ConfirmationModal"; +import ContentContainer from "@/components/content/ContentContainer"; import Contracts from "./sections/Contracts"; import ContractsEdit from "./sections/ContractsEdit"; -import ControlButtonBar from "components/controlButtons/ControlButtonBar"; -import ControlButtons from "components/controlButtons/ControlButtons"; +import ControlButtonBar from "@/components/controlButtons/ControlButtonBar"; +import ControlButtons from "@/components/controlButtons/ControlButtons"; import Decisions from "./sections/Decisions"; import DecisionsEdit from "./sections/DecisionsEdit"; -import Divider from "components/content/Divider"; -import FullWidthContainer from "components/content/FullWidthContainer"; +import Divider from "@/components/content/Divider"; +import FullWidthContainer from "@/components/content/FullWidthContainer"; import InvoicesR from "./sections/InvoicesR"; // import Invoices from './sections/Invoices'; // import InvoicesEdit from './sections/InvoicesEdit'; -import { ButtonColors } from "components/enums"; -import { fetchAttributes as fetchLandUseInvoiceAttributes } from "landUseInvoices/actions"; +import { ButtonColors } from "@/components/enums"; +import { fetchAttributes as fetchLandUseInvoiceAttributes } from "@/landUseInvoices/actions"; import LandUseContractMap from "./sections/LandUseContractMap"; import Litigants from "./sections/Litigants"; import LitigantsEdit from "./sections/LitigantsEdit"; -import Loader from "components/loader/Loader"; -import PageContainer from "components/content/PageContainer"; -import PageNavigationWrapper from "components/content/PageNavigationWrapper"; -import Tabs from "components/tabs/Tabs"; -import TabContent from "components/tabs/TabContent"; -import TabPane from "components/tabs/TabPane"; -import { receiveTopNavigationSettings } from "components/topNavigation/actions"; -import { fetchInvoicesByLandUseContract } from "landUseInvoices/actions"; -import { getInvoicesByLandUseContractId, getIsFetchingAttributes as getIsFetchingLandUseInvoiceAttributes, getAttributes as getLandUseInvoiceAttributes } from "landUseInvoices/selectors"; -import { clearFormValidFlags, editLandUseContract, fetchSingleLandUseContract, hideEditMode, receiveFormValidFlags, receiveIsSaveClicked, receiveSingleLandUseContract, showEditMode, deleteLandUseContract } from "landUseContract/actions"; -import { ConfirmationModalTexts, FormNames } from "enums"; -import { addLitigantsFormValuesToPayload, clearUnsavedChanges, getContentLandUseContractIdentifier, getContentBasicInformation, getContentCompensations, getContentContracts, getContentDecisions, getContentInvoices, getContentLitigants, getContentConditions, convertCompensationValuesToDecimalNumber } from "landUseContract/helpers"; -import { getSearchQuery, getUrlParams, isArchived, scrollToTopPage, setPageTitle } from "util/helpers"; -import { getRouteById, Routes } from "root/routes"; -import { getCurrentLandUseContract, getIsEditMode, getIsFormValidById, getIsFormValidFlags, getIsSaveClicked, getIsFetching } from "landUseContract/selectors"; -import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "usersPermissions/selectors"; -import { getSessionStorageItem, removeSessionStorageItem, setSessionStorageItem } from "util/storage"; -import { withLandUseContractAttributes } from "components/attributes/LandUseContractAttributes"; +import Loader from "@/components/loader/Loader"; +import PageContainer from "@/components/content/PageContainer"; +import PageNavigationWrapper from "@/components/content/PageNavigationWrapper"; +import Tabs from "@/components/tabs/Tabs"; +import TabContent from "@/components/tabs/TabContent"; +import TabPane from "@/components/tabs/TabPane"; +import { receiveTopNavigationSettings } from "@/components/topNavigation/actions"; +import { fetchInvoicesByLandUseContract } from "@/landUseInvoices/actions"; +import { getInvoicesByLandUseContractId, getIsFetchingAttributes as getIsFetchingLandUseInvoiceAttributes, getAttributes as getLandUseInvoiceAttributes } from "@/landUseInvoices/selectors"; +import { clearFormValidFlags, editLandUseContract, fetchSingleLandUseContract, hideEditMode, receiveFormValidFlags, receiveIsSaveClicked, receiveSingleLandUseContract, showEditMode, deleteLandUseContract } from "@/landUseContract/actions"; +import { ConfirmationModalTexts, FormNames } from "@/enums"; +import { addLitigantsFormValuesToPayload, clearUnsavedChanges, getContentLandUseContractIdentifier, getContentBasicInformation, getContentCompensations, getContentContracts, getContentDecisions, getContentInvoices, getContentLitigants, getContentConditions, convertCompensationValuesToDecimalNumber } from "@/landUseContract/helpers"; +import { getSearchQuery, getUrlParams, isArchived, scrollToTopPage, setPageTitle } from "@/util/helpers"; +import { getRouteById, Routes } from "@/root/routes"; +import { getCurrentLandUseContract, getIsEditMode, getIsFormValidById, getIsFormValidFlags, getIsSaveClicked, getIsFetching } from "@/landUseContract/selectors"; +import { getIsFetching as getIsFetchingUsersPermissions, getUsersPermissions } from "@/usersPermissions/selectors"; +import { getSessionStorageItem, removeSessionStorageItem, setSessionStorageItem } from "@/util/storage"; +import { withLandUseContractAttributes } from "@/components/attributes/LandUseContractAttributes"; import type { Attributes } from "types"; -import type { LandUseContract } from "landUseContract/types"; -import type { UsersPermissions } from "usersPermissions/types"; -import type { InvoiceList } from "landUseInvoices/types"; +import type { LandUseContract } from "@/landUseContract/types"; +import type { UsersPermissions } from "@/usersPermissions/types"; +import type { InvoiceList } from "@/landUseInvoices/types"; type Props = { basicInformationFormValues: Record; change: (...args: Array) => any; diff --git a/src/landUseContract/components/createLandUseContract/CreateLandUseContractForm.tsx b/src/landUseContract/components/createLandUseContract/CreateLandUseContractForm.tsx index 7ce73de64..79d5f5ad2 100644 --- a/src/landUseContract/components/createLandUseContract/CreateLandUseContractForm.tsx +++ b/src/landUseContract/components/createLandUseContract/CreateLandUseContractForm.tsx @@ -4,18 +4,18 @@ import { change, formValueSelector, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; -import { getDistrictsByMunicipality } from "district/selectors"; -import Button from "components/button/Button"; -import FormField from "components/form/FormField"; -import ModalButtonWrapper from "components/modal/ModalButtonWrapper"; -import { fetchDistrictsByMunicipality } from "district/actions"; -import { FormNames } from "enums"; -import { ButtonColors } from "components/enums"; -import { getAttributes } from "landUseContract/selectors"; -import { getDistrictOptions } from "district/helpers"; -import { getFieldOptions } from "util/helpers"; +import { getDistrictsByMunicipality } from "@/district/selectors"; +import Button from "@/components/button/Button"; +import FormField from "@/components/form/FormField"; +import ModalButtonWrapper from "@/components/modal/ModalButtonWrapper"; +import { fetchDistrictsByMunicipality } from "@/district/actions"; +import { FormNames } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { getAttributes } from "@/landUseContract/selectors"; +import { getDistrictOptions } from "@/district/helpers"; +import { getFieldOptions } from "@/util/helpers"; import type { Attributes } from "types"; -import type { DistrictList } from "district/types"; +import type { DistrictList } from "@/district/types"; type Props = { attributes: Attributes; change: (...args: Array) => any; diff --git a/src/landUseContract/components/createLandUseContract/CreateLandUseContractModal.tsx b/src/landUseContract/components/createLandUseContract/CreateLandUseContractModal.tsx index 9abeee854..656be0c5f 100644 --- a/src/landUseContract/components/createLandUseContract/CreateLandUseContractModal.tsx +++ b/src/landUseContract/components/createLandUseContract/CreateLandUseContractModal.tsx @@ -1,6 +1,6 @@ import React, { Component } from "react"; import CreateLandUseContractForm from "./CreateLandUseContractForm"; -import Modal from "components/modal/Modal"; +import Modal from "@/components/modal/Modal"; type Props = { isOpen: boolean; onClose: (...args: Array) => any; diff --git a/src/landUseContract/components/search/Search.tsx b/src/landUseContract/components/search/Search.tsx index 7eceefe40..d221457a7 100644 --- a/src/landUseContract/components/search/Search.tsx +++ b/src/landUseContract/components/search/Search.tsx @@ -5,10 +5,10 @@ import { Row, Column } from "react-foundation"; import debounce from "lodash/debounce"; import flowRight from "lodash/flowRight"; import isEqual from "lodash/isEqual"; -import FormField from "components/form/FormField"; -import SearchClearLink from "components/search/SearchClearLink"; -import SearchContainer from "components/search/SearchContainer"; -import { FieldTypes, FormNames } from "enums"; +import FormField from "@/components/form/FormField"; +import SearchClearLink from "@/components/search/SearchClearLink"; +import SearchContainer from "@/components/search/SearchContainer"; +import { FieldTypes, FormNames } from "@/enums"; type Props = { formValues: Record; handleSubmit: (...args: Array) => any; diff --git a/src/landUseContract/components/sections/AddressItemEdit.tsx b/src/landUseContract/components/sections/AddressItemEdit.tsx index 01e81f329..0eb7d42b4 100644 --- a/src/landUseContract/components/sections/AddressItemEdit.tsx +++ b/src/landUseContract/components/sections/AddressItemEdit.tsx @@ -4,14 +4,14 @@ import { formValueSelector, change, reduxForm } from "redux-form"; import flowRight from "lodash/flowRight"; import { Row, Column } from "react-foundation"; import get from "lodash/get"; -import Authorization from "components/authorization/Authorization"; -import FormField from "components/form/FormField"; -import { FieldTypes, FormNames } from "enums"; -import RemoveButton from "components/form/RemoveButton"; -import { getUsersPermissions } from "usersPermissions/selectors"; +import Authorization from "@/components/authorization/Authorization"; +import FormField from "@/components/form/FormField"; +import { FieldTypes, FormNames } from "@/enums"; +import RemoveButton from "@/components/form/RemoveButton"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; import type { Attributes } from "types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; -import { isFieldAllowedToRead, isEmptyValue } from "util/helpers"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; +import { isFieldAllowedToRead, isEmptyValue } from "@/util/helpers"; type Props = { attributes: Attributes; disabled: boolean; diff --git a/src/landUseContract/components/sections/BasicInformation.tsx b/src/landUseContract/components/sections/BasicInformation.tsx index 2c0598345..6c8492e49 100644 --- a/src/landUseContract/components/sections/BasicInformation.tsx +++ b/src/landUseContract/components/sections/BasicInformation.tsx @@ -2,27 +2,27 @@ import React, { Fragment } from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; import get from "lodash/get"; -import Authorization from "components/authorization/Authorization"; -import Collapse from "components/collapse/Collapse"; -import Divider from "components/content/Divider"; -import ExternalLink from "components/links/ExternalLink"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import ListItem from "components/content/ListItem"; -import ListItems from "components/content/ListItems"; -import SubTitle from "components/content/SubTitle"; -import { receiveCollapseStates } from "landUseContract/actions"; -import { FormNames, ViewModes } from "enums"; -import { LandUseAgreementAttachmentFieldPaths } from "landUseAgreementAttachment/enums"; -import { getContentBasicInformation } from "landUseContract/helpers"; -import { getUserFullName } from "users/helpers"; -import { formatDate, getFieldOptions, getLabelOfOption, getReferenceNumberLink, isFieldAllowedToRead } from "util/helpers"; -import { getAttributes, getCollapseStateByKey, getCurrentLandUseContract } from "landUseContract/selectors"; -import { getUiDataLandUseContractKey, getUiDataLandUseAgreementAttachmentKey } from "uiData/helpers"; -import { getAttributes as getLandUseAgreementAttachmentAttributes } from "landUseAgreementAttachment/selectors"; +import Authorization from "@/components/authorization/Authorization"; +import Collapse from "@/components/collapse/Collapse"; +import Divider from "@/components/content/Divider"; +import ExternalLink from "@/components/links/ExternalLink"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import ListItem from "@/components/content/ListItem"; +import ListItems from "@/components/content/ListItems"; +import SubTitle from "@/components/content/SubTitle"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import { FormNames, ViewModes } from "@/enums"; +import { LandUseAgreementAttachmentFieldPaths } from "@/landUseAgreementAttachment/enums"; +import { getContentBasicInformation } from "@/landUseContract/helpers"; +import { getUserFullName } from "@/users/helpers"; +import { formatDate, getFieldOptions, getLabelOfOption, getReferenceNumberLink, isFieldAllowedToRead } from "@/util/helpers"; +import { getAttributes, getCollapseStateByKey, getCurrentLandUseContract } from "@/landUseContract/selectors"; +import { getUiDataLandUseContractKey, getUiDataLandUseAgreementAttachmentKey } from "@/uiData/helpers"; +import { getAttributes as getLandUseAgreementAttachmentAttributes } from "@/landUseAgreementAttachment/selectors"; import type { Attributes } from "types"; -import type { LandUseContract } from "landUseContract/types"; -import FileDownloadLink from "components/file/FileDownloadLink"; +import type { LandUseContract } from "@/landUseContract/types"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; type Props = { attributes: Attributes; basicInformationCollapseState: boolean; diff --git a/src/landUseContract/components/sections/BasicInformationEdit.tsx b/src/landUseContract/components/sections/BasicInformationEdit.tsx index 0300ecf6a..1a10013d5 100644 --- a/src/landUseContract/components/sections/BasicInformationEdit.tsx +++ b/src/landUseContract/components/sections/BasicInformationEdit.tsx @@ -4,34 +4,34 @@ import { change, FieldArray, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; -import AddFileButton from "components/form/AddFileButton"; -import EstateIdSelectInput from "components/inputs/EstateIdSelectInput"; -import Authorization from "components/authorization/Authorization"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddButtonThird from "components/form/AddButtonThird"; -import Collapse from "components/collapse/Collapse"; -import Divider from "components/content/Divider"; -import FieldAndRemoveButtonWrapper from "components/form/FieldAndRemoveButtonWrapper"; -import FormField from "components/form/FormField"; -import FormText from "components/form/FormText"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import FormTextTitle from "components/form/FormTextTitle"; -import RemoveButton from "components/form/RemoveButton"; -import SubTitle from "components/content/SubTitle"; -import { receiveCollapseStates, receiveFormValidFlags } from "landUseContract/actions"; -import { createLandUseAgreementAttachment, deleteLandUseAgreementAttachment } from "landUseAgreementAttachment/actions"; -import { ConfirmationModalTexts, FieldTypes, FormNames, ViewModes, Methods } from "enums"; -import { ButtonColors } from "components/enums"; -import { getAttributes, getCollapseStateByKey, getIsSaveClicked, getCurrentLandUseContract } from "landUseContract/selectors"; -import { referenceNumber } from "components/form/validations"; +import AddFileButton from "@/components/form/AddFileButton"; +import EstateIdSelectInput from "@/components/inputs/EstateIdSelectInput"; +import Authorization from "@/components/authorization/Authorization"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddButtonThird from "@/components/form/AddButtonThird"; +import Collapse from "@/components/collapse/Collapse"; +import Divider from "@/components/content/Divider"; +import FieldAndRemoveButtonWrapper from "@/components/form/FieldAndRemoveButtonWrapper"; +import FormField from "@/components/form/FormField"; +import FormText from "@/components/form/FormText"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import RemoveButton from "@/components/form/RemoveButton"; +import SubTitle from "@/components/content/SubTitle"; +import { receiveCollapseStates, receiveFormValidFlags } from "@/landUseContract/actions"; +import { createLandUseAgreementAttachment, deleteLandUseAgreementAttachment } from "@/landUseAgreementAttachment/actions"; +import { ConfirmationModalTexts, FieldTypes, FormNames, ViewModes, Methods } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { getAttributes, getCollapseStateByKey, getIsSaveClicked, getCurrentLandUseContract } from "@/landUseContract/selectors"; +import { referenceNumber } from "@/components/form/validations"; import AddressItemEdit from "./AddressItemEdit"; import type { Attributes, Methods as MethodsType } from "types"; -import { getUiDataLandUseContractKey, getUiDataLandUseAgreementAttachmentKey } from "uiData/helpers"; -import { LandUseAgreementAttachmentFieldPaths } from "landUseAgreementAttachment/enums"; -import { getUserFullName } from "users/helpers"; -import { isFieldAllowedToRead, isMethodAllowed, formatDate } from "util/helpers"; -import { getMethods as getLandUseAgreementAttachmentMethods, getAttributes as getLandUseAgreementAttachmentAttributes } from "landUseAgreementAttachment/selectors"; -import type { LandUseContract } from "landUseContract/types"; +import { getUiDataLandUseContractKey, getUiDataLandUseAgreementAttachmentKey } from "@/uiData/helpers"; +import { LandUseAgreementAttachmentFieldPaths } from "@/landUseAgreementAttachment/enums"; +import { getUserFullName } from "@/users/helpers"; +import { isFieldAllowedToRead, isMethodAllowed, formatDate } from "@/util/helpers"; +import { getMethods as getLandUseAgreementAttachmentMethods, getAttributes as getLandUseAgreementAttachmentAttributes } from "@/landUseAgreementAttachment/selectors"; +import type { LandUseContract } from "@/landUseContract/types"; type AddressesProps = { fields: any; formName: string; @@ -150,7 +150,8 @@ const renderAreas = ({ return - + + <> { if (estate_id && estate_id.value) { change(`${field}.estate_id`, estate_id.value); @@ -167,6 +168,7 @@ const renderAreas = ({ }}>
    + } removeButton={} /> ; diff --git a/src/landUseContract/components/sections/Changes.tsx b/src/landUseContract/components/sections/Changes.tsx index 93fb2b30b..819004d26 100644 --- a/src/landUseContract/components/sections/Changes.tsx +++ b/src/landUseContract/components/sections/Changes.tsx @@ -2,18 +2,18 @@ import React from "react"; import { Row, Column } from "react-foundation"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import FormTextTitle from "components/form/FormTextTitle"; -import BoxItemContainer from "components/content/BoxItemContainer"; -import Collapse from "components/collapse/Collapse"; -import FormText from "components/form/FormText"; -import { receiveCollapseStates } from "landUseContract/actions"; -import { FormNames, ViewModes } from "enums"; -import { formatDate } from "util/helpers"; -import { getCollapseStateByKey } from "landUseContract/selectors"; -import { withWindowResize } from "components/resize/WindowResizeHandler"; -import { getDecisionById, getDecisionOptions } from "landUseContract/helpers"; -import type { LandUseContract } from "landUseContract/types"; -import DecisionLink from "components/links/DecisionLink"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import BoxItemContainer from "@/components/content/BoxItemContainer"; +import Collapse from "@/components/collapse/Collapse"; +import FormText from "@/components/form/FormText"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import { FormNames, ViewModes } from "@/enums"; +import { formatDate } from "@/util/helpers"; +import { getCollapseStateByKey } from "@/landUseContract/selectors"; +import { withWindowResize } from "@/components/resize/WindowResizeHandler"; +import { getDecisionById, getDecisionOptions } from "@/landUseContract/helpers"; +import type { LandUseContract } from "@/landUseContract/types"; +import DecisionLink from "@/components/links/DecisionLink"; import type { Attributes } from "types"; type Props = { attributes: Attributes; diff --git a/src/landUseContract/components/sections/Compensations.tsx b/src/landUseContract/components/sections/Compensations.tsx index af31a025a..ff4c819a5 100644 --- a/src/landUseContract/components/sections/Compensations.tsx +++ b/src/landUseContract/components/sections/Compensations.tsx @@ -2,25 +2,25 @@ import React, { Fragment } from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; import get from "lodash/get"; -import Authorization from "components/authorization/Authorization"; -import Divider from "components/content/Divider"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import GreenBox from "components/content/GreenBox"; -import SubTitle from "components/content/SubTitle"; -import WhiteBox from "components/content/WhiteBox"; -import { getContentCompensations } from "landUseContract/helpers"; -import { formatNumber } from "util/helpers"; -import { getUserFullName } from "users/helpers"; -import { getCurrentLandUseContract } from "landUseContract/selectors"; -import { LandUseAgreementAttachmentFieldPaths } from "landUseAgreementAttachment/enums"; -import type { LandUseContract } from "landUseContract/types"; -import { getUiDataLandUseAgreementAttachmentKey } from "uiData/helpers"; -import { getAttributes as getLandUseAgreementAttachmentAttributes } from "landUseAgreementAttachment/selectors"; -import { formatDate, isFieldAllowedToRead } from "util/helpers"; +import Authorization from "@/components/authorization/Authorization"; +import Divider from "@/components/content/Divider"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import GreenBox from "@/components/content/GreenBox"; +import SubTitle from "@/components/content/SubTitle"; +import WhiteBox from "@/components/content/WhiteBox"; +import { getContentCompensations } from "@/landUseContract/helpers"; +import { formatNumber } from "@/util/helpers"; +import { getUserFullName } from "@/users/helpers"; +import { getCurrentLandUseContract } from "@/landUseContract/selectors"; +import { LandUseAgreementAttachmentFieldPaths } from "@/landUseAgreementAttachment/enums"; +import type { LandUseContract } from "@/landUseContract/types"; +import { getUiDataLandUseAgreementAttachmentKey } from "@/uiData/helpers"; +import { getAttributes as getLandUseAgreementAttachmentAttributes } from "@/landUseAgreementAttachment/selectors"; +import { formatDate, isFieldAllowedToRead } from "@/util/helpers"; import type { Attributes } from "types"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import { getUsedPrice, getSum } from "landUseContract/helpers"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import { getUsedPrice, getSum } from "@/landUseContract/helpers"; type Props = { currentLandUseContract: LandUseContract; landUseAgreementAttachmentAttributes: Attributes; diff --git a/src/landUseContract/components/sections/CompensationsEdit.tsx b/src/landUseContract/components/sections/CompensationsEdit.tsx index d1f1d65d7..a14517be0 100644 --- a/src/landUseContract/components/sections/CompensationsEdit.tsx +++ b/src/landUseContract/components/sections/CompensationsEdit.tsx @@ -4,35 +4,35 @@ import { Row, Column } from "react-foundation"; import { FieldArray, formValueSelector, reduxForm, change } from "redux-form"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; -import Authorization from "components/authorization/Authorization"; -import AddFileButton from "components/form/AddFileButton"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddButtonThird from "components/form/AddButtonThird"; -import Divider from "components/content/Divider"; -import FormField from "components/form/FormField"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import GreenBox from "components/content/GreenBox"; -import SubTitle from "components/content/SubTitle"; -import WhiteBox from "components/content/WhiteBox"; -import { receiveFormValidFlags } from "landUseContract/actions"; -import { getCurrentLandUseContract } from "landUseContract/selectors"; -import type { LandUseContract } from "landUseContract/types"; -import { FormNames } from "enums"; -import RemoveButton from "components/form/RemoveButton"; -import { ButtonColors } from "components/enums"; -import { convertStrToDecimalNumber, formatNumber } from "util/helpers"; -import { getAttributes, getIsSaveClicked } from "landUseContract/selectors"; +import Authorization from "@/components/authorization/Authorization"; +import AddFileButton from "@/components/form/AddFileButton"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddButtonThird from "@/components/form/AddButtonThird"; +import Divider from "@/components/content/Divider"; +import FormField from "@/components/form/FormField"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import GreenBox from "@/components/content/GreenBox"; +import SubTitle from "@/components/content/SubTitle"; +import WhiteBox from "@/components/content/WhiteBox"; +import { receiveFormValidFlags } from "@/landUseContract/actions"; +import { getCurrentLandUseContract } from "@/landUseContract/selectors"; +import type { LandUseContract } from "@/landUseContract/types"; +import { FormNames } from "@/enums"; +import RemoveButton from "@/components/form/RemoveButton"; +import { ButtonColors } from "@/components/enums"; +import { convertStrToDecimalNumber, formatNumber } from "@/util/helpers"; +import { getAttributes, getIsSaveClicked } from "@/landUseContract/selectors"; import UnitPricesUsedInCalculations from "./UnitPricesUsedInCalculations"; import type { Attributes, Methods as MethodsType } from "types"; -import { getUserFullName } from "users/helpers"; -import { ConfirmationModalTexts, Methods } from "enums"; -import { formatDate, isFieldAllowedToRead, isMethodAllowed } from "util/helpers"; -import FileDownloadLink from "components/file/FileDownloadLink"; -import { getUiDataLandUseAgreementAttachmentKey } from "uiData/helpers"; -import { getMethods as getLandUseAgreementAttachmentMethods, getAttributes as getLandUseAgreementAttachmentAttributes } from "landUseAgreementAttachment/selectors"; -import { LandUseAgreementAttachmentFieldPaths } from "landUseAgreementAttachment/enums"; -import { createLandUseAgreementAttachment, deleteLandUseAgreementAttachment } from "landUseAgreementAttachment/actions"; +import { getUserFullName } from "@/users/helpers"; +import { ConfirmationModalTexts, Methods } from "@/enums"; +import { formatDate, isFieldAllowedToRead, isMethodAllowed } from "@/util/helpers"; +import FileDownloadLink from "@/components/file/FileDownloadLink"; +import { getUiDataLandUseAgreementAttachmentKey } from "@/uiData/helpers"; +import { getMethods as getLandUseAgreementAttachmentMethods, getAttributes as getLandUseAgreementAttachmentAttributes } from "@/landUseAgreementAttachment/selectors"; +import { LandUseAgreementAttachmentFieldPaths } from "@/landUseAgreementAttachment/enums"; +import { createLandUseAgreementAttachment, deleteLandUseAgreementAttachment } from "@/landUseAgreementAttachment/actions"; type InvoicesProps = { attributes: Attributes; fields: any; diff --git a/src/landUseContract/components/sections/ConditionItemEdit.tsx b/src/landUseContract/components/sections/ConditionItemEdit.tsx index 93ccd3ad5..d0270f877 100644 --- a/src/landUseContract/components/sections/ConditionItemEdit.tsx +++ b/src/landUseContract/components/sections/ConditionItemEdit.tsx @@ -3,11 +3,11 @@ import { connect } from "react-redux"; import { formValueSelector } from "redux-form"; import { Row, Column } from "react-foundation"; import get from "lodash/get"; -import FormField from "components/form/FormField"; -import RemoveButton from "components/form/RemoveButton"; -import { getUsersPermissions } from "usersPermissions/selectors"; +import FormField from "@/components/form/FormField"; +import RemoveButton from "@/components/form/RemoveButton"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; import type { Attributes } from "types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { attributes: Attributes; disabled: boolean; diff --git a/src/landUseContract/components/sections/Conditions.tsx b/src/landUseContract/components/sections/Conditions.tsx index 73b7b804b..d113a6310 100644 --- a/src/landUseContract/components/sections/Conditions.tsx +++ b/src/landUseContract/components/sections/Conditions.tsx @@ -1,17 +1,17 @@ import React, { Fragment } from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; -import Collapse from "components/collapse/Collapse"; -import Divider from "components/content/Divider"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import { receiveCollapseStates } from "landUseContract/actions"; -import { FormNames, ViewModes } from "enums"; -import { getAttributes, getCollapseStateByKey, getCurrentLandUseContract } from "landUseContract/selectors"; +import Collapse from "@/components/collapse/Collapse"; +import Divider from "@/components/content/Divider"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import { FormNames, ViewModes } from "@/enums"; +import { getAttributes, getCollapseStateByKey, getCurrentLandUseContract } from "@/landUseContract/selectors"; import type { Attributes } from "types"; -import type { LandUseContract } from "landUseContract/types"; -import { getContentConditions } from "landUseContract/helpers"; -import { getFieldOptions, getLabelOfOption, formatDate } from "util/helpers"; +import type { LandUseContract } from "@/landUseContract/types"; +import { getContentConditions } from "@/landUseContract/helpers"; +import { getFieldOptions, getLabelOfOption, formatDate } from "@/util/helpers"; type Props = { attributes: Attributes; ConditionsCollapseState: boolean; diff --git a/src/landUseContract/components/sections/ConditionsEdit.tsx b/src/landUseContract/components/sections/ConditionsEdit.tsx index 129e46ee6..e2486463f 100644 --- a/src/landUseContract/components/sections/ConditionsEdit.tsx +++ b/src/landUseContract/components/sections/ConditionsEdit.tsx @@ -3,15 +3,15 @@ import { connect } from "react-redux"; import { FieldArray, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import { ButtonColors } from "components/enums"; -import FormTextTitle from "components/form/FormTextTitle"; -import AddButtonThird from "components/form/AddButtonThird"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import Collapse from "components/collapse/Collapse"; -import Divider from "components/content/Divider"; -import { receiveCollapseStates, receiveFormValidFlags } from "landUseContract/actions"; -import { FormNames, ViewModes } from "enums"; -import { getAttributes, getCollapseStateByKey, getIsSaveClicked } from "landUseContract/selectors"; +import { ButtonColors } from "@/components/enums"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import AddButtonThird from "@/components/form/AddButtonThird"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import Collapse from "@/components/collapse/Collapse"; +import Divider from "@/components/content/Divider"; +import { receiveCollapseStates, receiveFormValidFlags } from "@/landUseContract/actions"; +import { FormNames, ViewModes } from "@/enums"; +import { getAttributes, getCollapseStateByKey, getIsSaveClicked } from "@/landUseContract/selectors"; import type { Attributes } from "types"; import ConditionItemEdit from "./ConditionItemEdit"; type ConditionsProps = { diff --git a/src/landUseContract/components/sections/ContractItem.tsx b/src/landUseContract/components/sections/ContractItem.tsx index e88642838..c8aa8de9e 100644 --- a/src/landUseContract/components/sections/ContractItem.tsx +++ b/src/landUseContract/components/sections/ContractItem.tsx @@ -1,15 +1,15 @@ import React from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; -import Collapse from "components/collapse/Collapse"; -import FormTitleAndText from "components/form/FormTitleAndText"; -import { receiveCollapseStates } from "landUseContract/actions"; -import { FormNames, ViewModes } from "enums"; -import { formatDate, getLabelOfOption } from "util/helpers"; -import { getCollapseStateByKey } from "landUseContract/selectors"; +import Collapse from "@/components/collapse/Collapse"; +import FormTitleAndText from "@/components/form/FormTitleAndText"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import { FormNames, ViewModes } from "@/enums"; +import { formatDate, getLabelOfOption } from "@/util/helpers"; +import { getCollapseStateByKey } from "@/landUseContract/selectors"; import Warrants from "./Warrants"; import Changes from "./Changes"; -import type { LandUseContract } from "landUseContract/types"; +import type { LandUseContract } from "@/landUseContract/types"; type Props = { attributes: Record; collapseState: boolean; diff --git a/src/landUseContract/components/sections/ContractItemEdit.tsx b/src/landUseContract/components/sections/ContractItemEdit.tsx index 1ae07c46f..5e6d62366 100644 --- a/src/landUseContract/components/sections/ContractItemEdit.tsx +++ b/src/landUseContract/components/sections/ContractItemEdit.tsx @@ -4,26 +4,26 @@ import { FieldArray, formValueSelector } from "redux-form"; import { Row, Column } from "react-foundation"; import get from "lodash/get"; import isEmpty from "lodash/isEmpty"; -import { ButtonColors } from "components/enums"; -import FormText from "components/form/FormText"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import ActionButtonWrapper from "components/form/ActionButtonWrapper"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import BoxContentWrapper from "components/content/BoxContentWrapper"; -import BoxItem from "components/content/BoxItem"; -import BoxItemContainer from "components/content/BoxItemContainer"; -import Collapse from "components/collapse/Collapse"; -import FormField from "components/form/FormField"; -import { receiveCollapseStates } from "landUseContract/actions"; -import RemoveButton from "components/form/RemoveButton"; -import { FormNames, ViewModes, ConfirmationModalTexts } from "enums"; -import { getLabelOfOption } from "util/helpers"; -import { getCollapseStateByKey } from "landUseContract/selectors"; -import { getFieldAttributes } from "util/helpers"; -import DecisionLink from "components/links/DecisionLink"; -import type { LandUseContract } from "landUseContract/types"; +import { ButtonColors } from "@/components/enums"; +import FormText from "@/components/form/FormText"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import ActionButtonWrapper from "@/components/form/ActionButtonWrapper"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import BoxContentWrapper from "@/components/content/BoxContentWrapper"; +import BoxItem from "@/components/content/BoxItem"; +import BoxItemContainer from "@/components/content/BoxItemContainer"; +import Collapse from "@/components/collapse/Collapse"; +import FormField from "@/components/form/FormField"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import RemoveButton from "@/components/form/RemoveButton"; +import { FormNames, ViewModes, ConfirmationModalTexts } from "@/enums"; +import { getLabelOfOption } from "@/util/helpers"; +import { getCollapseStateByKey } from "@/landUseContract/selectors"; +import { getFieldAttributes } from "@/util/helpers"; +import DecisionLink from "@/components/links/DecisionLink"; +import type { LandUseContract } from "@/landUseContract/types"; import type { Attributes } from "types"; -import { getDecisionById } from "landUseContract/helpers"; +import { getDecisionById } from "@/landUseContract/helpers"; type ContractChangesProps = { attributes: Attributes; collapseState: boolean; diff --git a/src/landUseContract/components/sections/Contracts.tsx b/src/landUseContract/components/sections/Contracts.tsx index 0043acdd2..7c65a31bb 100644 --- a/src/landUseContract/components/sections/Contracts.tsx +++ b/src/landUseContract/components/sections/Contracts.tsx @@ -1,12 +1,12 @@ import React from "react"; import { connect } from "react-redux"; import ContractItem from "./ContractItem"; -import FormText from "components/form/FormText"; -import { getContentContracts } from "landUseContract/helpers"; -import { getFieldOptions } from "util/helpers"; -import { getAttributes, getCurrentLandUseContract } from "landUseContract/selectors"; +import FormText from "@/components/form/FormText"; +import { getContentContracts } from "@/landUseContract/helpers"; +import { getFieldOptions } from "@/util/helpers"; +import { getAttributes, getCurrentLandUseContract } from "@/landUseContract/selectors"; import type { Attributes } from "types"; -import type { LandUseContract } from "landUseContract/types"; +import type { LandUseContract } from "@/landUseContract/types"; type Props = { attributes: Attributes; currentLandUseContract: LandUseContract; diff --git a/src/landUseContract/components/sections/ContractsEdit.tsx b/src/landUseContract/components/sections/ContractsEdit.tsx index 44e9737b1..f1359d835 100644 --- a/src/landUseContract/components/sections/ContractsEdit.tsx +++ b/src/landUseContract/components/sections/ContractsEdit.tsx @@ -3,18 +3,18 @@ import { connect } from "react-redux"; import { FieldArray, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddButton from "components/form/AddButton"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddButton from "@/components/form/AddButton"; import ContractItemEdit from "./ContractItemEdit"; -import { receiveFormValidFlags } from "landUseContract/actions"; -import { ConfirmationModalTexts, FormNames } from "enums"; -import { ButtonColors } from "components/enums"; -import { getContentContracts } from "landUseContract/helpers"; -import { getFieldOptions } from "util/helpers"; -import { getAttributes, getCurrentLandUseContract, getErrorsByFormName, getIsSaveClicked } from "landUseContract/selectors"; -import { getDecisionOptions } from "landUseContract/helpers"; +import { receiveFormValidFlags } from "@/landUseContract/actions"; +import { ConfirmationModalTexts, FormNames } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { getContentContracts } from "@/landUseContract/helpers"; +import { getFieldOptions } from "@/util/helpers"; +import { getAttributes, getCurrentLandUseContract, getErrorsByFormName, getIsSaveClicked } from "@/landUseContract/selectors"; +import { getDecisionOptions } from "@/landUseContract/helpers"; import type { Attributes } from "types"; -import type { LandUseContract } from "landUseContract/types"; +import type { LandUseContract } from "@/landUseContract/types"; type ContractsProps = { attributes: Attributes; contractsData: Array>; diff --git a/src/landUseContract/components/sections/CreateAndCreditInvoiceR.tsx b/src/landUseContract/components/sections/CreateAndCreditInvoiceR.tsx index 0f9bb610a..ae9c5ae0a 100644 --- a/src/landUseContract/components/sections/CreateAndCreditInvoiceR.tsx +++ b/src/landUseContract/components/sections/CreateAndCreditInvoiceR.tsx @@ -3,27 +3,27 @@ import { connect } from "react-redux"; import scrollToComponent from "react-scroll-to-component"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import AddButton from "components/form/AddButton"; -import Authorization from "components/authorization/Authorization"; -import Button from "components/button/Button"; +import AddButton from "@/components/form/AddButton"; +import Authorization from "@/components/authorization/Authorization"; +import Button from "@/components/button/Button"; import CreditInvoiceForm from "./forms/CreditInvoiceForm"; import NewInvoiceForm from "./forms/NewInvoiceForm"; -import { createCharge } from "landUseInvoices/actions"; -import { createInvoice, creditInvoice, deleteInvoice, receiveIsCreateClicked, receiveIsCreateInvoicePanelOpen, receiveIsCreditClicked, receiveIsCreditInvoicePanelOpen } from "landUseInvoices/actions"; -import { creditInvoiceSet } from "invoiceSets/actions"; -import { ButtonColors } from "components/enums"; -import { UsersPermissions } from "usersPermissions/enums"; -import { getPayloadCreditInvoice } from "invoices/helpers"; -import { getCreditInvoiceSetPayload } from "invoiceSets/helpers"; -import { getPayloadCreateInvoice } from "landUseContract/helpers"; -import { hasPermissions } from "util/helpers"; -import { getCurrentLandUseContract } from "landUseContract/selectors"; -import { getIsCreateInvoicePanelOpen, getIsCreditInvoicePanelOpen, getInvoicesByLandUseContractId } from "landUseInvoices/selectors"; -import { getUsersPermissions } from "usersPermissions/selectors"; -import { AppConsumer, ActionTypes } from "app/AppContext"; -import { ConfirmationModalTexts } from "enums"; -import type { LandUseContract } from "landUseInvoices/types"; -import type { UsersPermissions as UsersPermissionsType } from "usersPermissions/types"; +import { createCharge } from "@/landUseInvoices/actions"; +import { createInvoice, creditInvoice, deleteInvoice, receiveIsCreateClicked, receiveIsCreateInvoicePanelOpen, receiveIsCreditClicked, receiveIsCreditInvoicePanelOpen } from "@/landUseInvoices/actions"; +import { creditInvoiceSet } from "@/invoiceSets/actions"; +import { ButtonColors } from "@/components/enums"; +import { UsersPermissions } from "@/usersPermissions/enums"; +import { getPayloadCreditInvoice } from "@/invoices/helpers"; +import { getCreditInvoiceSetPayload } from "@/invoiceSets/helpers"; +import { getPayloadCreateInvoice } from "@/landUseContract/helpers"; +import { hasPermissions } from "@/util/helpers"; +import { getCurrentLandUseContract } from "@/landUseContract/selectors"; +import { getIsCreateInvoicePanelOpen, getIsCreditInvoicePanelOpen, getInvoicesByLandUseContractId } from "@/landUseInvoices/selectors"; +import { getUsersPermissions } from "@/usersPermissions/selectors"; +import { AppConsumer, ActionTypes } from "@/app/AppContext"; +import { ConfirmationModalTexts } from "@/enums"; +import type { LandUseContract } from "@/landUseInvoices/types"; +import type { UsersPermissions as UsersPermissionsType } from "@/usersPermissions/types"; type Props = { createCharge: (...args: Array) => any; createInvoice: (...args: Array) => any; diff --git a/src/landUseContract/components/sections/DecisionConditions.tsx b/src/landUseContract/components/sections/DecisionConditions.tsx index 3e0f21c3d..d57adb2da 100644 --- a/src/landUseContract/components/sections/DecisionConditions.tsx +++ b/src/landUseContract/components/sections/DecisionConditions.tsx @@ -2,17 +2,17 @@ import React from "react"; import { Row, Column } from "react-foundation"; import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; -import BoxItem from "components/content/BoxItem"; -import BoxItemContainer from "components/content/BoxItemContainer"; -import Collapse from "components/collapse/Collapse"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import FormTitleAndText from "components/form/FormTitleAndText"; -import { receiveCollapseStates } from "landUseContract/actions"; -import { FormNames, ViewModes } from "enums"; -import { formatDate, getFieldOptions, getLabelOfOption } from "util/helpers"; -import { getCollapseStateByKey } from "landUseContract/selectors"; -import { withWindowResize } from "components/resize/WindowResizeHandler"; +import BoxItem from "@/components/content/BoxItem"; +import BoxItemContainer from "@/components/content/BoxItemContainer"; +import Collapse from "@/components/collapse/Collapse"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import FormTitleAndText from "@/components/form/FormTitleAndText"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import { FormNames, ViewModes } from "@/enums"; +import { formatDate, getFieldOptions, getLabelOfOption } from "@/util/helpers"; +import { getCollapseStateByKey } from "@/landUseContract/selectors"; +import { withWindowResize } from "@/components/resize/WindowResizeHandler"; import type { Attributes } from "types"; type Props = { attributes: Attributes; diff --git a/src/landUseContract/components/sections/DecisionItem.tsx b/src/landUseContract/components/sections/DecisionItem.tsx index 7eee1ca1f..05e42bea7 100644 --- a/src/landUseContract/components/sections/DecisionItem.tsx +++ b/src/landUseContract/components/sections/DecisionItem.tsx @@ -1,14 +1,14 @@ import React from "react"; import { connect } from "react-redux"; import { Row, Column } from "react-foundation"; -import Collapse from "components/collapse/Collapse"; +import Collapse from "@/components/collapse/Collapse"; import DecisionConditions from "./DecisionConditions"; -import ExternalLink from "components/links/ExternalLink"; -import FormTitleAndText from "components/form/FormTitleAndText"; -import { receiveCollapseStates } from "landUseContract/actions"; -import { FormNames, ViewModes } from "enums"; -import { formatDate, getFieldOptions, getLabelOfOption, getReferenceNumberLink } from "util/helpers"; -import { getCollapseStateByKey } from "landUseContract/selectors"; +import ExternalLink from "@/components/links/ExternalLink"; +import FormTitleAndText from "@/components/form/FormTitleAndText"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import { FormNames, ViewModes } from "@/enums"; +import { formatDate, getFieldOptions, getLabelOfOption, getReferenceNumberLink } from "@/util/helpers"; +import { getCollapseStateByKey } from "@/landUseContract/selectors"; import type { Attributes } from "types"; type Props = { attributes: Attributes; diff --git a/src/landUseContract/components/sections/DecisionItemEdit.tsx b/src/landUseContract/components/sections/DecisionItemEdit.tsx index 8a8251863..84d672b5c 100644 --- a/src/landUseContract/components/sections/DecisionItemEdit.tsx +++ b/src/landUseContract/components/sections/DecisionItemEdit.tsx @@ -5,24 +5,24 @@ import { connect } from "react-redux"; import flowRight from "lodash/flowRight"; import get from "lodash/get"; import isEmpty from "lodash/isEmpty"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import ActionButtonWrapper from "components/form/ActionButtonWrapper"; -import AddButtonSecondary from "components/form/AddButtonSecondary"; -import BoxContentWrapper from "components/content/BoxContentWrapper"; -import BoxItem from "components/content/BoxItem"; -import BoxItemContainer from "components/content/BoxItemContainer"; -import Collapse from "components/collapse/Collapse"; -import FieldAndRemoveButtonWrapper from "components/form/FieldAndRemoveButtonWrapper"; -import FormField from "components/form/FormField"; -import FormTextTitle from "components/form/FormTextTitle"; -import RemoveButton from "components/form/RemoveButton"; -import { receiveCollapseStates } from "landUseContract/actions"; -import { ConfirmationModalTexts, FieldTypes, FormNames, ViewModes } from "enums"; -import { ButtonColors } from "components/enums"; -import { getFieldAttributes, getFieldOptions, getLabelOfOption, isFieldRequired } from "util/helpers"; -import { getCollapseStateByKey } from "landUseContract/selectors"; -import { referenceNumber } from "components/form/validations"; -import { withWindowResize } from "components/resize/WindowResizeHandler"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import ActionButtonWrapper from "@/components/form/ActionButtonWrapper"; +import AddButtonSecondary from "@/components/form/AddButtonSecondary"; +import BoxContentWrapper from "@/components/content/BoxContentWrapper"; +import BoxItem from "@/components/content/BoxItem"; +import BoxItemContainer from "@/components/content/BoxItemContainer"; +import Collapse from "@/components/collapse/Collapse"; +import FieldAndRemoveButtonWrapper from "@/components/form/FieldAndRemoveButtonWrapper"; +import FormField from "@/components/form/FormField"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import RemoveButton from "@/components/form/RemoveButton"; +import { receiveCollapseStates } from "@/landUseContract/actions"; +import { ConfirmationModalTexts, FieldTypes, FormNames, ViewModes } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { getFieldAttributes, getFieldOptions, getLabelOfOption, isFieldRequired } from "@/util/helpers"; +import { getCollapseStateByKey } from "@/landUseContract/selectors"; +import { referenceNumber } from "@/components/form/validations"; +import { withWindowResize } from "@/components/resize/WindowResizeHandler"; import type { Attributes } from "types"; type DecisionConditionsProps = { attributes: Attributes; diff --git a/src/landUseContract/components/sections/Decisions.tsx b/src/landUseContract/components/sections/Decisions.tsx index c835c9f74..e34d5b026 100644 --- a/src/landUseContract/components/sections/Decisions.tsx +++ b/src/landUseContract/components/sections/Decisions.tsx @@ -1,10 +1,10 @@ import React from "react"; import { connect } from "react-redux"; import DecisionItem from "./DecisionItem"; -import { getContentDecisions } from "landUseContract/helpers"; -import { getAttributes, getCurrentLandUseContract } from "landUseContract/selectors"; +import { getContentDecisions } from "@/landUseContract/helpers"; +import { getAttributes, getCurrentLandUseContract } from "@/landUseContract/selectors"; import type { Attributes } from "types"; -import type { LandUseContract } from "landUseContract/types"; +import type { LandUseContract } from "@/landUseContract/types"; type Props = { attributes: Attributes; currentLandUseContract: LandUseContract; diff --git a/src/landUseContract/components/sections/DecisionsEdit.tsx b/src/landUseContract/components/sections/DecisionsEdit.tsx index ce3da30a6..534babd44 100644 --- a/src/landUseContract/components/sections/DecisionsEdit.tsx +++ b/src/landUseContract/components/sections/DecisionsEdit.tsx @@ -3,16 +3,16 @@ import { connect } from "react-redux"; import { FieldArray, getFormValues, reduxForm } from "redux-form"; import { Row, Column } from "react-foundation"; import flowRight from "lodash/flowRight"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddButton from "components/form/AddButton"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddButton from "@/components/form/AddButton"; import DecisionItemEdit from "./DecisionItemEdit"; -import { receiveFormValidFlags } from "landUseContract/actions"; -import { ConfirmationModalTexts, FormNames } from "enums"; -import { ButtonColors } from "components/enums"; -import { getContentDecisions } from "landUseContract/helpers"; -import { getAttributes, getCurrentLandUseContract, getErrorsByFormName, getIsSaveClicked } from "landUseContract/selectors"; +import { receiveFormValidFlags } from "@/landUseContract/actions"; +import { ConfirmationModalTexts, FormNames } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { getContentDecisions } from "@/landUseContract/helpers"; +import { getAttributes, getCurrentLandUseContract, getErrorsByFormName, getIsSaveClicked } from "@/landUseContract/selectors"; import type { Attributes } from "types"; -import type { LandUseContract } from "landUseContract/types"; +import type { LandUseContract } from "@/landUseContract/types"; type DecisionsProps = { attributes: Attributes; decisionsData: Array>; diff --git a/src/landUseContract/components/sections/InvoiceNotesR.tsx b/src/landUseContract/components/sections/InvoiceNotesR.tsx index 8463e1a4a..8ec030a89 100644 --- a/src/landUseContract/components/sections/InvoiceNotesR.tsx +++ b/src/landUseContract/components/sections/InvoiceNotesR.tsx @@ -3,27 +3,27 @@ import { Row, Column } from "react-foundation"; import { connect } from "react-redux"; import { FieldArray, formValueSelector, reduxForm } from "redux-form"; import flowRight from "lodash/flowRight"; -import { ActionTypes, AppConsumer } from "app/AppContext"; -import AddButton from "components/form/AddButton"; -import Authorization from "components/authorization/Authorization"; -import Button from "components/button/Button"; -import ButtonWrapper from "components/content/ButtonWrapper"; -import FieldAndRemoveButtonWrapper from "components/form/FieldAndRemoveButtonWrapper"; -import FormField from "components/form/FormField"; -import FormText from "components/form/FormText"; -import FormTextTitle from "components/form/FormTextTitle"; -import ListItem from "components/content/ListItem"; -import ListItems from "components/content/ListItems"; -import RemoveButton from "components/form/RemoveButton"; -import { patchLeaseInvoiceNotes } from "leases/actions"; -import { ConfirmationModalTexts, FieldTypes, FormNames, Methods } from "enums"; -import { ButtonColors } from "components/enums"; -import { InvoiceNoteFieldPaths, InvoiceNoteFieldTitles } from "invoiceNote/enums"; -import { formatDate, getFieldAttributes, isFieldAllowedToRead, isMethodAllowed } from "util/helpers"; -import { getAttributes as getInvoiceNoteAttributes, getMethods as getInvoiceNoteMethods } from "invoiceNote/selectors"; -import { getCurrentLease } from "leases/selectors"; +import { ActionTypes, AppConsumer } from "@/app/AppContext"; +import AddButton from "@/components/form/AddButton"; +import Authorization from "@/components/authorization/Authorization"; +import Button from "@/components/button/Button"; +import ButtonWrapper from "@/components/content/ButtonWrapper"; +import FieldAndRemoveButtonWrapper from "@/components/form/FieldAndRemoveButtonWrapper"; +import FormField from "@/components/form/FormField"; +import FormText from "@/components/form/FormText"; +import FormTextTitle from "@/components/form/FormTextTitle"; +import ListItem from "@/components/content/ListItem"; +import ListItems from "@/components/content/ListItems"; +import RemoveButton from "@/components/form/RemoveButton"; +import { patchLeaseInvoiceNotes } from "@/leases/actions"; +import { ConfirmationModalTexts, FieldTypes, FormNames, Methods } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { InvoiceNoteFieldPaths, InvoiceNoteFieldTitles } from "@/invoiceNote/enums"; +import { formatDate, getFieldAttributes, isFieldAllowedToRead, isMethodAllowed } from "@/util/helpers"; +import { getAttributes as getInvoiceNoteAttributes, getMethods as getInvoiceNoteMethods } from "@/invoiceNote/selectors"; +import { getCurrentLease } from "@/leases/selectors"; import type { Attributes, Methods as MethodsType } from "types"; -import type { Lease } from "leases/types"; +import type { Lease } from "@/leases/types"; type ReadOnlyProps = { invoiceNoteAttributes: Attributes; invoiceNotes: Array>; diff --git a/src/landUseContract/components/sections/InvoicePanelR.tsx b/src/landUseContract/components/sections/InvoicePanelR.tsx index 8aff982a4..4b4a5ca5d 100644 --- a/src/landUseContract/components/sections/InvoicePanelR.tsx +++ b/src/landUseContract/components/sections/InvoicePanelR.tsx @@ -2,19 +2,19 @@ import React, { PureComponent } from "react"; import { connect } from "react-redux"; import { getFormValues, isValid } from "redux-form"; import isEmpty from "lodash/isEmpty"; -import Authorization from "components/authorization/Authorization"; -import Button from "components/button/Button"; +import Authorization from "@/components/authorization/Authorization"; +import Button from "@/components/button/Button"; import EditInvoiceForm from "./forms/EditInvoiceForm"; import InvoiceTemplateR from "./InvoiceTemplateR"; -import TablePanelContainer from "components/table/TablePanelContainer"; -import { receiveIsEditClicked } from "invoices/actions"; -import { FormNames, Methods } from "enums"; -import { ButtonColors } from "components/enums"; -import { isMethodAllowed } from "util/helpers"; -import { getInvoicesByLandUseContractId, getIsEditClicked, getMethods as getInvoiceMethods } from "landUseInvoices/selectors"; -import { getCurrentLandUseContract } from "landUseContract/selectors"; +import TablePanelContainer from "@/components/table/TablePanelContainer"; +import { receiveIsEditClicked } from "@/invoices/actions"; +import { FormNames, Methods } from "@/enums"; +import { ButtonColors } from "@/components/enums"; +import { isMethodAllowed } from "@/util/helpers"; +import { getInvoicesByLandUseContractId, getIsEditClicked, getMethods as getInvoiceMethods } from "@/landUseInvoices/selectors"; +import { getCurrentLandUseContract } from "@/landUseContract/selectors"; import type { Methods as MethodsType } from "types"; -import type { Invoice, InvoiceList } from "invoices/types"; +import type { Invoice, InvoiceList } from "@/invoices/types"; type Props = { formValues: Record; invoice: Invoice | null | undefined; @@ -86,8 +86,10 @@ class InvoicePanelR extends PureComponent { interestInvoiceFor } = this.state; return + <>