master
This commit is contained in:
parent
013b5785be
commit
765ecce31f
@ -1,16 +1,16 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# For the full list of supported browsers by the Angular framework, please see:
|
||||
# https://angular.io/guide/browser-support
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
last 1 Chrome version
|
||||
last 1 Firefox version
|
||||
last 2 Edge major versions
|
||||
last 2 Safari major versions
|
||||
last 2 iOS major versions
|
||||
Firefox ESR
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# For the full list of supported browsers by the Angular framework, please see:
|
||||
# https://angular.io/guide/browser-support
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
last 1 Chrome version
|
||||
last 1 Firefox version
|
||||
last 2 Edge major versions
|
||||
last 2 Safari major versions
|
||||
last 2 iOS major versions
|
||||
Firefox ESR
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
84
.gitignore
vendored
84
.gitignore
vendored
@ -1,42 +1,42 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
8
.vscode/extensions.json
vendored
8
.vscode/extensions.json
vendored
@ -1,4 +1,4 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||
"recommendations": ["angular.ng-template"]
|
||||
}
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||
"recommendations": ["angular.ng-template"]
|
||||
}
|
||||
|
||||
40
.vscode/launch.json
vendored
40
.vscode/launch.json
vendored
@ -1,20 +1,20 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "ng serve",
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: start",
|
||||
"url": "http://localhost:4200/"
|
||||
},
|
||||
{
|
||||
"name": "ng test",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: test",
|
||||
"url": "http://localhost:9876/debug.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "ng serve",
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: start",
|
||||
"url": "http://localhost:4200/"
|
||||
},
|
||||
{
|
||||
"name": "ng test",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: test",
|
||||
"url": "http://localhost:9876/debug.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
84
.vscode/tasks.json
vendored
84
.vscode/tasks.json
vendored
@ -1,42 +1,42 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "start",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "test",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "start",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "test",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "(.*?)"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation complete"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
node('Lithium'){
|
||||
stage('get new version to repo') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Install dependencies') {
|
||||
sh 'npm install'
|
||||
}
|
||||
|
||||
stage('build project') {
|
||||
sh 'npm run build-prod:lithium'
|
||||
}
|
||||
node('Lithium'){
|
||||
stage('get new version to repo') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Install dependencies') {
|
||||
sh 'npm install'
|
||||
}
|
||||
|
||||
stage('build project') {
|
||||
sh 'npm run build-prod:lithium'
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
node('Lithium'){
|
||||
stage('get new version to repo') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Install dependencies') {
|
||||
sh 'npm install'
|
||||
}
|
||||
|
||||
stage('build project') {
|
||||
sh 'npm run build-test:lithium'
|
||||
}
|
||||
}
|
||||
node('Lithium'){
|
||||
stage('get new version to repo') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Install dependencies') {
|
||||
sh 'npm install'
|
||||
}
|
||||
|
||||
stage('build project') {
|
||||
sh 'npm run build-test:lithium'
|
||||
}
|
||||
}
|
||||
|
||||
54
README.md
54
README.md
@ -1,27 +1,27 @@
|
||||
# SelfdeliveryAdminPanel
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.3.5.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||
# SelfdeliveryAdminPanel
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.3.5.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||
|
||||
392
angular.json
392
angular.json
@ -1,196 +1,196 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"cli": {
|
||||
"analytics": false
|
||||
},
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"selfdelivery-admin-panel": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
},
|
||||
"@schematics/angular:application": {
|
||||
"strict": true
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/selfdelivery-admin-panel",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"node_modules/primeng/resources/themes/bootstrap4-light-blue/theme.css",
|
||||
"node_modules/primeicons/primeicons.css",
|
||||
"node_modules/primeng/resources/primeng.min.css",
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "4mb",
|
||||
"maximumError": "5mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"test": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "4mb",
|
||||
"maximumError": "5mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.test.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "selfdelivery-admin-panel:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "selfdelivery-admin-panel:build:development",
|
||||
"proxyConfig": "proxy.confi.json"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "selfdelivery-admin-panel:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/selfdelivery-admin-panel",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"node_modules/primeng/resources/themes/bootstrap4-light-blue/theme.css",
|
||||
"node_modules/primeicons/primeicons.css",
|
||||
"node_modules/primeng/resources/primeng.min.css",
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "4mb",
|
||||
"maximumError": "5mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.test.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"test2": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"karmaConfig": "karma.conf.js",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "selfdelivery-admin-panel"
|
||||
}
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"cli": {
|
||||
"analytics": false
|
||||
},
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"selfdelivery-admin-panel": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
},
|
||||
"@schematics/angular:application": {
|
||||
"strict": true
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/selfdelivery-admin-panel",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"node_modules/primeng/resources/themes/bootstrap4-light-blue/theme.css",
|
||||
"node_modules/primeicons/primeicons.css",
|
||||
"node_modules/primeng/resources/primeng.min.css",
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "4mb",
|
||||
"maximumError": "5mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"test": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "4mb",
|
||||
"maximumError": "5mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.test.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "selfdelivery-admin-panel:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "selfdelivery-admin-panel:build:development",
|
||||
"proxyConfig": "proxy.confi.json"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "selfdelivery-admin-panel:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "dist/selfdelivery-admin-panel",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"node_modules/primeng/resources/themes/bootstrap4-light-blue/theme.css",
|
||||
"node_modules/primeicons/primeicons.css",
|
||||
"node_modules/primeng/resources/primeng.min.css",
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "4mb",
|
||||
"maximumError": "5mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.test.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"test2": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"karmaConfig": "karma.conf.js",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"scripts": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "selfdelivery-admin-panel"
|
||||
}
|
||||
|
||||
@ -1,44 +1,44 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, './coverage/selfdelivery-admin-panel'),
|
||||
subdir: '.',
|
||||
reporters: [
|
||||
{ type: 'html' },
|
||||
{ type: 'text-summary' }
|
||||
]
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
};
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, './coverage/selfdelivery-admin-panel'),
|
||||
subdir: '.',
|
||||
reporters: [
|
||||
{ type: 'html' },
|
||||
{ type: 'text-summary' }
|
||||
]
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
};
|
||||
|
||||
41356
package-lock.json
generated
41356
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
100
package.json
100
package.json
@ -1,50 +1,50 @@
|
||||
{
|
||||
"name": "selfdelivery-admin-panel",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --proxy-config proxy.confi.json",
|
||||
"build": "ng build",
|
||||
"build-test:lithium": "ng build --output-path=/var/www/html/selfdelivery-pitsburg-test.mydatahosting.ru --configuration=test",
|
||||
"build-prod:lithium": "ng build --output-path=/var/www/html/selfdelivery-pitsburg.mydatahosting.ru",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "~13.3.0",
|
||||
"@angular/cdk": "^13.3.8",
|
||||
"@angular/common": "~13.3.0",
|
||||
"@angular/compiler": "~13.3.0",
|
||||
"@angular/core": "~13.3.0",
|
||||
"@angular/forms": "~13.3.0",
|
||||
"@angular/material": "^13.3.8",
|
||||
"@angular/platform-browser": "~13.3.0",
|
||||
"@angular/platform-browser-dynamic": "~13.3.0",
|
||||
"@angular/pwa": "^14.0.0",
|
||||
"@angular/router": "~13.3.0",
|
||||
"@schematics/angular": "^14.0.0",
|
||||
"primeicons": "^5.0.0",
|
||||
"primeng": "^13.4.1",
|
||||
"rxjs": "~7.5.0",
|
||||
"tslib": "^2.3.0",
|
||||
"uuid": "^8.3.2",
|
||||
"web-push": "^3.5.0",
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~13.3.5",
|
||||
"@angular/cli": "~13.3.5",
|
||||
"@angular/compiler-cli": "~13.3.0",
|
||||
"@types/jasmine": "~3.10.0",
|
||||
"@types/node": "^12.11.1",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"jasmine-core": "~4.0.0",
|
||||
"karma": "~6.3.0",
|
||||
"karma-chrome-launcher": "~3.1.0",
|
||||
"karma-coverage": "~2.1.0",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "~1.7.0",
|
||||
"typescript": "~4.6.2"
|
||||
}
|
||||
}
|
||||
{
|
||||
"name": "selfdelivery-admin-panel",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --proxy-config proxy.confi.json",
|
||||
"build": "ng build",
|
||||
"build-test:lithium": "ng build --output-path=/var/www/html/selfdelivery-pitsburg-test.mydatahosting.ru --configuration=test",
|
||||
"build-prod:lithium": "ng build --output-path=/var/www/html/selfdelivery-pitsburg.mydatahosting.ru",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "~13.3.0",
|
||||
"@angular/cdk": "^13.3.8",
|
||||
"@angular/common": "~13.3.0",
|
||||
"@angular/compiler": "~13.3.0",
|
||||
"@angular/core": "~13.3.0",
|
||||
"@angular/forms": "~13.3.0",
|
||||
"@angular/material": "^13.3.8",
|
||||
"@angular/platform-browser": "~13.3.0",
|
||||
"@angular/platform-browser-dynamic": "~13.3.0",
|
||||
"@angular/pwa": "^14.0.0",
|
||||
"@angular/router": "~13.3.0",
|
||||
"@schematics/angular": "^14.0.0",
|
||||
"primeicons": "^5.0.0",
|
||||
"primeng": "^13.4.1",
|
||||
"rxjs": "~7.5.0",
|
||||
"tslib": "^2.3.0",
|
||||
"uuid": "^8.3.2",
|
||||
"web-push": "^3.5.0",
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~13.3.5",
|
||||
"@angular/cli": "~13.3.5",
|
||||
"@angular/compiler-cli": "~13.3.0",
|
||||
"@types/jasmine": "~3.10.0",
|
||||
"@types/node": "^12.11.1",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"jasmine-core": "~4.0.0",
|
||||
"karma": "~6.3.0",
|
||||
"karma-chrome-launcher": "~3.1.0",
|
||||
"karma-coverage": "~2.1.0",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "~1.7.0",
|
||||
"typescript": "~4.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
{
|
||||
"/api": {
|
||||
"target": "http://selfdelivery-pitsburg-test.mydatahosting.ru/api",
|
||||
"secure": false,
|
||||
"pathRewrite": {
|
||||
"^/api": ""
|
||||
},
|
||||
"changeOrigin": true,
|
||||
"logLevel": "debug"
|
||||
}
|
||||
}
|
||||
{
|
||||
"/api": {
|
||||
"target": "http://selfdelivery-pitsburg-test.mydatahosting.ru/api",
|
||||
"secure": false,
|
||||
"pathRewrite": {
|
||||
"^/api": ""
|
||||
},
|
||||
"changeOrigin": true,
|
||||
"logLevel": "debug"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<mat-sidenav-container class="main-container" *ngIf="isAuth">
|
||||
<mat-sidenav #sidenav mode="side" [(opened)]="opened">
|
||||
<app-menu></app-menu>
|
||||
</mat-sidenav>
|
||||
|
||||
<mat-sidenav-content>
|
||||
<button (click)="sidenav.toggle()">Меню</button>
|
||||
<button (click)="signOut()" style="float: right">Выход</button>
|
||||
<router-outlet></router-outlet>
|
||||
</mat-sidenav-content>
|
||||
</mat-sidenav-container>
|
||||
|
||||
<app-login *ngIf="!isAuth" (confirm)="setIsAuth()">
|
||||
|
||||
</app-login>
|
||||
<mat-sidenav-container class="main-container" *ngIf="isAuth">
|
||||
<mat-sidenav #sidenav mode="side" [(opened)]="opened">
|
||||
<app-menu></app-menu>
|
||||
</mat-sidenav>
|
||||
|
||||
<mat-sidenav-content>
|
||||
<button (click)="sidenav.toggle()">Меню</button>
|
||||
<button (click)="signOut()" style="float: right">Выход</button>
|
||||
<router-outlet></router-outlet>
|
||||
</mat-sidenav-content>
|
||||
</mat-sidenav-container>
|
||||
|
||||
<app-login *ngIf="!isAuth" (confirm)="setIsAuth()">
|
||||
|
||||
</app-login>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
.main-container {
|
||||
height: 100%;
|
||||
z-index: auto !important;
|
||||
}
|
||||
.main-container {
|
||||
height: 100%;
|
||||
z-index: auto !important;
|
||||
}
|
||||
|
||||
@ -1,35 +1,35 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'selfdelivery-admin-panel'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('selfdelivery-admin-panel');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('selfdelivery-admin-panel app is running!');
|
||||
});
|
||||
});
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'selfdelivery-admin-panel'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('selfdelivery-admin-panel');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('selfdelivery-admin-panel app is running!');
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,82 +1,82 @@
|
||||
import { Component, ComponentRef, EmbeddedViewRef, OnInit, Type, ViewContainerRef } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { DialogService } from 'primeng/dynamicdialog';
|
||||
import {Toast} from "primeng/toast";
|
||||
import { ExitComponentComponent } from './components/exit-component/exit-component.component';
|
||||
import { CookiesService } from './services/cookies.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
providers: [DialogService],
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
public opened: boolean = true;
|
||||
public isAuth!: boolean;
|
||||
private messageComponent!: ComponentRef<Toast>;
|
||||
title = 'selfdelivery-admin-panel';
|
||||
|
||||
constructor(
|
||||
private cookiesService: CookiesService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
public dialogService: DialogService,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.messageComponent = this.appendComponent(Toast);
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '')
|
||||
this.isAuth = token.length ? true : false;
|
||||
this.router.navigate(['/clients'])
|
||||
}
|
||||
|
||||
|
||||
appendComponent<C>(component: Type<C>): ComponentRef<C> {
|
||||
const componentRef = this.viewContainerRef.createComponent(component);
|
||||
const domElem = (componentRef.hostView as EmbeddedViewRef<any>)
|
||||
.rootNodes[0] as HTMLElement;
|
||||
document.body.appendChild(domElem);
|
||||
return componentRef;
|
||||
}
|
||||
|
||||
openSidenav() {
|
||||
this.opened = true
|
||||
}
|
||||
|
||||
setIsAuth() {
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '')
|
||||
this.isAuth = token.length ? true : false;
|
||||
}
|
||||
|
||||
signOut() {
|
||||
const ref = this.dialogService.open(ExitComponentComponent, {
|
||||
width: 'auto',
|
||||
style: {
|
||||
'max-width': '90vw',
|
||||
'max-height': '90vh',
|
||||
},
|
||||
contentStyle: {
|
||||
'max-height': '90vh',
|
||||
height: 'auto',
|
||||
'max-width': '90vw',
|
||||
overflow: 'auto',
|
||||
'border-radius': '7px',
|
||||
'padding-top': '20px'
|
||||
},
|
||||
baseZIndex: 10000,
|
||||
autoZIndex: true,
|
||||
dismissableMask: true,
|
||||
closeOnEscape: true,
|
||||
showHeader: false,
|
||||
});
|
||||
ref.onClose.subscribe(
|
||||
result => {
|
||||
if (result) {
|
||||
this.cookiesService.deleteCookie('token')
|
||||
this.setIsAuth()
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
import { Component, ComponentRef, EmbeddedViewRef, OnInit, Type, ViewContainerRef } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { DialogService } from 'primeng/dynamicdialog';
|
||||
import {Toast} from "primeng/toast";
|
||||
import { ExitComponentComponent } from './components/exit-component/exit-component.component';
|
||||
import { CookiesService } from './services/cookies.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
providers: [DialogService],
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
public opened: boolean = true;
|
||||
public isAuth!: boolean;
|
||||
private messageComponent!: ComponentRef<Toast>;
|
||||
title = 'selfdelivery-admin-panel';
|
||||
|
||||
constructor(
|
||||
private cookiesService: CookiesService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
public dialogService: DialogService,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.messageComponent = this.appendComponent(Toast);
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '')
|
||||
this.isAuth = token.length ? true : false;
|
||||
this.router.navigate(['/clients'])
|
||||
}
|
||||
|
||||
|
||||
appendComponent<C>(component: Type<C>): ComponentRef<C> {
|
||||
const componentRef = this.viewContainerRef.createComponent(component);
|
||||
const domElem = (componentRef.hostView as EmbeddedViewRef<any>)
|
||||
.rootNodes[0] as HTMLElement;
|
||||
document.body.appendChild(domElem);
|
||||
return componentRef;
|
||||
}
|
||||
|
||||
openSidenav() {
|
||||
this.opened = true
|
||||
}
|
||||
|
||||
setIsAuth() {
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '')
|
||||
this.isAuth = token.length ? true : false;
|
||||
}
|
||||
|
||||
signOut() {
|
||||
const ref = this.dialogService.open(ExitComponentComponent, {
|
||||
width: 'auto',
|
||||
style: {
|
||||
'max-width': '90vw',
|
||||
'max-height': '90vh',
|
||||
},
|
||||
contentStyle: {
|
||||
'max-height': '90vh',
|
||||
height: 'auto',
|
||||
'max-width': '90vw',
|
||||
overflow: 'auto',
|
||||
'border-radius': '7px',
|
||||
'padding-top': '20px'
|
||||
},
|
||||
baseZIndex: 10000,
|
||||
autoZIndex: true,
|
||||
dismissableMask: true,
|
||||
closeOnEscape: true,
|
||||
showHeader: false,
|
||||
});
|
||||
ref.onClose.subscribe(
|
||||
result => {
|
||||
if (result) {
|
||||
this.cookiesService.deleteCookie('token')
|
||||
this.setIsAuth()
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,85 +1,85 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { LoginComponent } from './components/login/login.component';
|
||||
import { HttpClientJsonpModule, HttpClientModule } from "@angular/common/http";
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import {MatNativeDateModule} from '@angular/material/core';
|
||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { LoginModalComponent } from './components/login-modal/login-modal.component';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
import {MessagesModule} from "primeng/messages";
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ClientsComponent } from './pages/clients/clients.component';
|
||||
import { OrdersComponent } from './pages/orders/orders.component';
|
||||
import { TerminalsComponent } from './pages/terminals/terminals.component';
|
||||
import { DivisionsComponent } from './pages/divisions/divisions.component';
|
||||
import { AreasComponent } from './pages/areas/areas.component';
|
||||
import { MenuComponent } from './components/menu/menu.component';
|
||||
import { ExitComponentComponent } from './components/exit-component/exit-component.component';
|
||||
import { TableModule } from 'primeng/table';
|
||||
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
import { DropdownModule } from 'primeng/dropdown';
|
||||
import { ChipsModule } from 'primeng/chips';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { LoginComponent } from './components/login/login.component';
|
||||
import { HttpClientJsonpModule, HttpClientModule } from "@angular/common/http";
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import {MatNativeDateModule} from '@angular/material/core';
|
||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { LoginModalComponent } from './components/login-modal/login-modal.component';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
import {MessagesModule} from "primeng/messages";
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ClientsComponent } from './pages/clients/clients.component';
|
||||
import { OrdersComponent } from './pages/orders/orders.component';
|
||||
import { TerminalsComponent } from './pages/terminals/terminals.component';
|
||||
import { DivisionsComponent } from './pages/divisions/divisions.component';
|
||||
import { AreasComponent } from './pages/areas/areas.component';
|
||||
import { MenuComponent } from './components/menu/menu.component';
|
||||
import { ExitComponentComponent } from './components/exit-component/exit-component.component';
|
||||
import { TableModule } from 'primeng/table';
|
||||
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
||||
import { ToastModule } from 'primeng/toast';
|
||||
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
import { DropdownModule } from 'primeng/dropdown';
|
||||
import { ChipsModule } from 'primeng/chips';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import {MultiSelectModule} from 'primeng/multiselect';
|
||||
import { PaymentTypePipe } from './pipes/payment-type.pipe';
|
||||
import { PaymentStatusPipe } from './pipes/payment-status.pipe';
|
||||
|
||||
const routes = [
|
||||
{ path: 'clients', component: ClientsComponent },
|
||||
{ path: 'orders', component: OrdersComponent },
|
||||
{ path: 'terminals', component: TerminalsComponent },
|
||||
{ path: 'divisions', component: DivisionsComponent },
|
||||
{ path: 'areas', component: AreasComponent },
|
||||
{ path: '', redirectTo: '/clients', pathMatch: 'full' }
|
||||
]
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
LoginComponent,
|
||||
LoginModalComponent,
|
||||
ClientsComponent,
|
||||
OrdersComponent,
|
||||
TerminalsComponent,
|
||||
DivisionsComponent,
|
||||
AreasComponent,
|
||||
MenuComponent,
|
||||
ExitComponentComponent,
|
||||
PaymentTypePipe,
|
||||
PaymentStatusPipe
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
HttpClientModule,
|
||||
HttpClientJsonpModule,
|
||||
BrowserAnimationsModule,
|
||||
MatNativeDateModule,
|
||||
MatSidenavModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
ToastModule,
|
||||
MessagesModule,
|
||||
ConfirmDialogModule,
|
||||
TableModule,
|
||||
ScrollPanelModule,
|
||||
DropdownModule,
|
||||
ChipsModule,
|
||||
ButtonModule,
|
||||
MultiSelectModule,
|
||||
RouterModule.forRoot(routes)
|
||||
],
|
||||
providers: [MessageService, { provide: APP_BASE_HREF, useValue: '/' }, ConfirmationService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
import { PaymentStatusPipe } from './pipes/payment-status.pipe';
|
||||
|
||||
const routes = [
|
||||
{ path: 'clients', component: ClientsComponent },
|
||||
{ path: 'orders', component: OrdersComponent },
|
||||
{ path: 'terminals', component: TerminalsComponent },
|
||||
{ path: 'divisions', component: DivisionsComponent },
|
||||
{ path: 'areas', component: AreasComponent },
|
||||
{ path: '', redirectTo: '/clients', pathMatch: 'full' }
|
||||
]
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
LoginComponent,
|
||||
LoginModalComponent,
|
||||
ClientsComponent,
|
||||
OrdersComponent,
|
||||
TerminalsComponent,
|
||||
DivisionsComponent,
|
||||
AreasComponent,
|
||||
MenuComponent,
|
||||
ExitComponentComponent,
|
||||
PaymentTypePipe,
|
||||
PaymentStatusPipe
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
HttpClientModule,
|
||||
HttpClientJsonpModule,
|
||||
BrowserAnimationsModule,
|
||||
MatNativeDateModule,
|
||||
MatSidenavModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
ToastModule,
|
||||
MessagesModule,
|
||||
ConfirmDialogModule,
|
||||
TableModule,
|
||||
ScrollPanelModule,
|
||||
DropdownModule,
|
||||
ChipsModule,
|
||||
ButtonModule,
|
||||
MultiSelectModule,
|
||||
RouterModule.forRoot(routes)
|
||||
],
|
||||
providers: [MessageService, { provide: APP_BASE_HREF, useValue: '/' }, ConfirmationService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<H2>Вы действительно хотите выйти?</H2>
|
||||
<button class="woocommerce-button button" style="margin-right: 1rem" (click)="onClick(true)">Да</button>
|
||||
<button class="woocommerce-button button " (click)="onClick(false)">Нет</button>
|
||||
</div>
|
||||
<div>
|
||||
<H2>Вы действительно хотите выйти?</H2>
|
||||
<button class="woocommerce-button button" style="margin-right: 1rem" (click)="onClick(true)">Да</button>
|
||||
<button class="woocommerce-button button " (click)="onClick(false)">Нет</button>
|
||||
</div>
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExitComponentComponent } from './exit-component.component';
|
||||
|
||||
describe('ExitComponentComponent', () => {
|
||||
let component: ExitComponentComponent;
|
||||
let fixture: ComponentFixture<ExitComponentComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ExitComponentComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ExitComponentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExitComponentComponent } from './exit-component.component';
|
||||
|
||||
describe('ExitComponentComponent', () => {
|
||||
let component: ExitComponentComponent;
|
||||
let fixture: ComponentFixture<ExitComponentComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ExitComponentComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ExitComponentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {DynamicDialogRef} from "primeng/dynamicdialog";
|
||||
|
||||
@Component({
|
||||
selector: 'app-exit-component',
|
||||
templateUrl: './exit-component.component.html',
|
||||
styleUrls: ['./exit-component.component.scss']
|
||||
})
|
||||
export class ExitComponentComponent{
|
||||
|
||||
constructor(public dialogRef: DynamicDialogRef) { }
|
||||
|
||||
onClick(val: boolean): void {
|
||||
this.dialogRef.close(val);
|
||||
}
|
||||
|
||||
}
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {DynamicDialogRef} from "primeng/dynamicdialog";
|
||||
|
||||
@Component({
|
||||
selector: 'app-exit-component',
|
||||
templateUrl: './exit-component.component.html',
|
||||
styleUrls: ['./exit-component.component.scss']
|
||||
})
|
||||
export class ExitComponentComponent{
|
||||
|
||||
constructor(public dialogRef: DynamicDialogRef) { }
|
||||
|
||||
onClick(val: boolean): void {
|
||||
this.dialogRef.close(val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<form (ngSubmit)="submit()" [formGroup]="mainFormGroup" action="false" autocomplete="on">
|
||||
<div class="login-container">
|
||||
<p>
|
||||
<label class="login-container__label" for="login">Логин</label>
|
||||
<input class="login-container__input" formControlName="login" id="login" pInputText placeholder="Логин" type="text">
|
||||
</p>
|
||||
<p>
|
||||
<label class="login-container__label" for="password">Пароль</label>
|
||||
<input class="login-container__input" formControlName="password" id="password" pInputText placeholder="Пароль" type="password">
|
||||
</p>
|
||||
<button [disabled]="!mainFormGroup.valid" style="margin-bottom: 8px;" type="submit">
|
||||
<span>Войти</span>
|
||||
</button>
|
||||
</div>
|
||||
<form (ngSubmit)="submit()" [formGroup]="mainFormGroup" action="false" autocomplete="on">
|
||||
<div class="login-container">
|
||||
<p>
|
||||
<label class="login-container__label" for="login">Логин</label>
|
||||
<input class="login-container__input" formControlName="login" id="login" pInputText placeholder="Логин" type="text">
|
||||
</p>
|
||||
<p>
|
||||
<label class="login-container__label" for="password">Пароль</label>
|
||||
<input class="login-container__input" formControlName="password" id="password" pInputText placeholder="Пароль" type="password">
|
||||
</p>
|
||||
<button [disabled]="!mainFormGroup.valid" style="margin-bottom: 8px;" type="submit">
|
||||
<span>Войти</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@ -1,52 +1,52 @@
|
||||
.login-container {
|
||||
|
||||
&__label {
|
||||
display: block;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
&__input {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: calc(2.25rem + 2px);
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: #212529;
|
||||
background-color: #fff;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #bdbdbd;
|
||||
border-radius: 0.25rem;
|
||||
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
||||
&::placeholder {
|
||||
color: #212529;
|
||||
opacity: 0.4;
|
||||
}
|
||||
&:focus {
|
||||
color: #212529;
|
||||
background-color: #fff;
|
||||
border-color: #bdbdbd;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(158, 158, 158, 0.25);
|
||||
}
|
||||
}
|
||||
button {
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
background: #3b953b;
|
||||
border: none;
|
||||
border-radius: 7px;
|
||||
color: #fff;
|
||||
transition: all .3s;
|
||||
cursor: pointer;
|
||||
&:disabled {
|
||||
background: #5b8b5b;
|
||||
}
|
||||
&:hover {
|
||||
transform: scale(1.009);
|
||||
}
|
||||
}
|
||||
.login-container {
|
||||
|
||||
&__label {
|
||||
display: block;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
&__input {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: calc(2.25rem + 2px);
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: #212529;
|
||||
background-color: #fff;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #bdbdbd;
|
||||
border-radius: 0.25rem;
|
||||
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
||||
&::placeholder {
|
||||
color: #212529;
|
||||
opacity: 0.4;
|
||||
}
|
||||
&:focus {
|
||||
color: #212529;
|
||||
background-color: #fff;
|
||||
border-color: #bdbdbd;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem rgba(158, 158, 158, 0.25);
|
||||
}
|
||||
}
|
||||
button {
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
background: #3b953b;
|
||||
border: none;
|
||||
border-radius: 7px;
|
||||
color: #fff;
|
||||
transition: all .3s;
|
||||
cursor: pointer;
|
||||
&:disabled {
|
||||
background: #5b8b5b;
|
||||
}
|
||||
&:hover {
|
||||
transform: scale(1.009);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,76 +1,76 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from "@angular/forms";
|
||||
import { UserData } from "src/app/interface/data";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { CookiesService } from "src/app/services/cookies.service";
|
||||
import { DynamicDialogRef } from "primeng/dynamicdialog";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-modal',
|
||||
templateUrl: './login-modal.component.html',
|
||||
styleUrls: ['./login-modal.component.scss'],
|
||||
})
|
||||
export class LoginModalComponent implements OnInit {
|
||||
public mainFormGroup!: FormGroup;
|
||||
public UserData: UserData = {
|
||||
login: '',
|
||||
password: ''
|
||||
}
|
||||
public errorConfirm: boolean = false;
|
||||
|
||||
|
||||
constructor(
|
||||
private fb: FormBuilder,
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private cookiesService: CookiesService,
|
||||
private dialogRef: DynamicDialogRef
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.mainFormGroup = new FormGroup({
|
||||
login: new FormControl('', [Validators.required, Validators.minLength(4)]),
|
||||
password: new FormControl('', [Validators.required, Validators.minLength(4)]),
|
||||
})
|
||||
}
|
||||
|
||||
submit() {
|
||||
const mainControls = this.mainFormGroup.controls;
|
||||
if (this.mainFormGroup.invalid) {
|
||||
Object.keys(mainControls).forEach(groupName => {
|
||||
mainControls[groupName].markAsTouched();
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.submitAuth()
|
||||
}
|
||||
|
||||
submitAuth() {
|
||||
const userData = this.mainFormGroup.value;
|
||||
this.jsonRpcService.rpc({
|
||||
method: 'login',
|
||||
params: [userData.login, userData.password]
|
||||
}, RpcService.authService, false).subscribe({
|
||||
next: (result) => {
|
||||
this.cookiesService.setCookie('token', result.result);
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Авторизация прошла успешно!',
|
||||
})
|
||||
this.dialogRef.close()
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
this.errorConfirm = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from "@angular/forms";
|
||||
import { UserData } from "src/app/interface/data";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { CookiesService } from "src/app/services/cookies.service";
|
||||
import { DynamicDialogRef } from "primeng/dynamicdialog";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-modal',
|
||||
templateUrl: './login-modal.component.html',
|
||||
styleUrls: ['./login-modal.component.scss'],
|
||||
})
|
||||
export class LoginModalComponent implements OnInit {
|
||||
public mainFormGroup!: FormGroup;
|
||||
public UserData: UserData = {
|
||||
login: '',
|
||||
password: ''
|
||||
}
|
||||
public errorConfirm: boolean = false;
|
||||
|
||||
|
||||
constructor(
|
||||
private fb: FormBuilder,
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private cookiesService: CookiesService,
|
||||
private dialogRef: DynamicDialogRef
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.mainFormGroup = new FormGroup({
|
||||
login: new FormControl('', [Validators.required, Validators.minLength(4)]),
|
||||
password: new FormControl('', [Validators.required, Validators.minLength(4)]),
|
||||
})
|
||||
}
|
||||
|
||||
submit() {
|
||||
const mainControls = this.mainFormGroup.controls;
|
||||
if (this.mainFormGroup.invalid) {
|
||||
Object.keys(mainControls).forEach(groupName => {
|
||||
mainControls[groupName].markAsTouched();
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.submitAuth()
|
||||
}
|
||||
|
||||
submitAuth() {
|
||||
const userData = this.mainFormGroup.value;
|
||||
this.jsonRpcService.rpc({
|
||||
method: 'login',
|
||||
params: [userData.login, userData.password]
|
||||
}, RpcService.authService, false).subscribe({
|
||||
next: (result) => {
|
||||
this.cookiesService.setCookie('token', result.result);
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Авторизация прошла успешно!',
|
||||
})
|
||||
this.dialogRef.close()
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
this.errorConfirm = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
.example-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.example-events {
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
overflow: auto;
|
||||
border: 1px solid #555;
|
||||
.example-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.example-events {
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
overflow: auto;
|
||||
border: 1px solid #555;
|
||||
}
|
||||
@ -1,57 +1,57 @@
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { DialogService } from 'primeng/dynamicdialog';
|
||||
import { CookiesService } from 'src/app/services/cookies.service';
|
||||
import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service';
|
||||
import { LoginModalComponent } from '../login-modal/login-modal.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: 'login.component.html',
|
||||
styleUrls: ['login.component.scss'],
|
||||
providers: [DialogService],
|
||||
})
|
||||
export class LoginComponent implements OnInit {
|
||||
@Output() confirm = new EventEmitter<void>();
|
||||
public login!: string;
|
||||
public password!: string;
|
||||
public errorConfirm: boolean = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private jsonrpc: JsonrpcService,
|
||||
private cookiesService: CookiesService,
|
||||
public dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.openDialog();
|
||||
}
|
||||
|
||||
openDialog() {
|
||||
const ref = this.dialogService.open(LoginModalComponent, {
|
||||
width: 'auto',
|
||||
style: {
|
||||
background: '#FDFBFA',
|
||||
'border-radius': '7px'
|
||||
},
|
||||
contentStyle: {
|
||||
height: 'auto',
|
||||
width: '300px',
|
||||
overflow: 'auto',
|
||||
},
|
||||
data: {
|
||||
},
|
||||
header: 'Авторизация',
|
||||
baseZIndex: 10000,
|
||||
autoZIndex: true,
|
||||
dismissableMask: false,
|
||||
closeOnEscape: false,
|
||||
closable: false
|
||||
});
|
||||
ref.onClose.subscribe((res) => {
|
||||
this.confirm.emit();
|
||||
})
|
||||
}
|
||||
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { DialogService } from 'primeng/dynamicdialog';
|
||||
import { CookiesService } from 'src/app/services/cookies.service';
|
||||
import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service';
|
||||
import { LoginModalComponent } from '../login-modal/login-modal.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: 'login.component.html',
|
||||
styleUrls: ['login.component.scss'],
|
||||
providers: [DialogService],
|
||||
})
|
||||
export class LoginComponent implements OnInit {
|
||||
@Output() confirm = new EventEmitter<void>();
|
||||
public login!: string;
|
||||
public password!: string;
|
||||
public errorConfirm: boolean = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private jsonrpc: JsonrpcService,
|
||||
private cookiesService: CookiesService,
|
||||
public dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.openDialog();
|
||||
}
|
||||
|
||||
openDialog() {
|
||||
const ref = this.dialogService.open(LoginModalComponent, {
|
||||
width: 'auto',
|
||||
style: {
|
||||
background: '#FDFBFA',
|
||||
'border-radius': '7px'
|
||||
},
|
||||
contentStyle: {
|
||||
height: 'auto',
|
||||
width: '300px',
|
||||
overflow: 'auto',
|
||||
},
|
||||
data: {
|
||||
},
|
||||
header: 'Авторизация',
|
||||
baseZIndex: 10000,
|
||||
autoZIndex: true,
|
||||
dismissableMask: false,
|
||||
closeOnEscape: false,
|
||||
closable: false
|
||||
});
|
||||
ref.onClose.subscribe((res) => {
|
||||
this.confirm.emit();
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
<div class="menu-container">
|
||||
<div id="menu" *ngFor="let item of menuItems" (click)="redirect(item.path)" style="margin: 20px 20px 20px 5px; font-size:20px">
|
||||
{{item.name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu-container">
|
||||
<div id="menu" *ngFor="let item of menuItems" (click)="redirect(item.path)" style="margin: 20px 20px 20px 5px; font-size:20px">
|
||||
{{item.name}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,48 +1,48 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { MenuItem } from "src/app/interface/data";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
templateUrl: './menu.component.html',
|
||||
styleUrls: ['./menu.component.scss']
|
||||
})
|
||||
export class MenuComponent implements OnInit {
|
||||
public menuItems: Array<MenuItem> = [
|
||||
{
|
||||
name: 'Клиенты',
|
||||
path: '/clients'
|
||||
},
|
||||
{
|
||||
name: 'Заказы',
|
||||
path: '/orders'
|
||||
},
|
||||
{
|
||||
name: 'Терминалы',
|
||||
path: '/terminals'
|
||||
},
|
||||
{
|
||||
name: 'Точки',
|
||||
path: '/divisions'
|
||||
},
|
||||
{
|
||||
name: 'Зоны',
|
||||
path: '/areas'
|
||||
},
|
||||
]
|
||||
constructor(
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
|
||||
redirect(path: string) {
|
||||
/* this.router.navigate([path]);*/
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate([path]);
|
||||
}
|
||||
}
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
import { MenuItem } from "src/app/interface/data";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
templateUrl: './menu.component.html',
|
||||
styleUrls: ['./menu.component.scss']
|
||||
})
|
||||
export class MenuComponent implements OnInit {
|
||||
public menuItems: Array<MenuItem> = [
|
||||
{
|
||||
name: 'Клиенты',
|
||||
path: '/clients'
|
||||
},
|
||||
{
|
||||
name: 'Заказы',
|
||||
path: '/orders'
|
||||
},
|
||||
{
|
||||
name: 'Терминалы',
|
||||
path: '/terminals'
|
||||
},
|
||||
{
|
||||
name: 'Точки',
|
||||
path: '/divisions'
|
||||
},
|
||||
{
|
||||
name: 'Зоны',
|
||||
path: '/areas'
|
||||
},
|
||||
]
|
||||
constructor(
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
|
||||
redirect(path: string) {
|
||||
/* this.router.navigate([path]);*/
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate([path]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
export const OrderTypes = {
|
||||
"mobileApp": "Мобильное приложение",
|
||||
"offlineReline": "Кассовое приложение",
|
||||
"mobileAppOfflineOrder": "Диплинк",
|
||||
"selfServiceTerminalOrder": "Терминал самообслуживания"
|
||||
export const OrderTypes = {
|
||||
"mobileApp": "Мобильное приложение",
|
||||
"offlineReline": "Кассовое приложение",
|
||||
"mobileAppOfflineOrder": "Диплинк",
|
||||
"selfServiceTerminalOrder": "Терминал самообслуживания"
|
||||
}
|
||||
@ -1,128 +1,128 @@
|
||||
export interface UserData {
|
||||
login: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface MenuItem {
|
||||
name: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface Delivery_address {
|
||||
flat: string;
|
||||
house: string;
|
||||
street: string;
|
||||
}
|
||||
|
||||
export interface Modifiers {
|
||||
group: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface Products {
|
||||
area: string;
|
||||
id: string;
|
||||
modifiers: Modifiers[];
|
||||
nomenclature_code: string;
|
||||
requested_quantity: string;
|
||||
status: string;
|
||||
stock_quantity: string;
|
||||
title: string;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
export interface Address {
|
||||
client_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Payment {
|
||||
payload: Payload;
|
||||
summ: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Payload {
|
||||
id: string;
|
||||
status: string
|
||||
}
|
||||
|
||||
export interface Order {
|
||||
address: Address;
|
||||
comment: string;
|
||||
date_created: string;
|
||||
delivery_address: Delivery_address;
|
||||
due_datetime: string;
|
||||
external_id: string;
|
||||
id: number;
|
||||
payment: Payment[];
|
||||
phone: string;
|
||||
products: Products[];
|
||||
status: string;
|
||||
status_h: string;
|
||||
item_style: string;
|
||||
isWarnLine: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Client {
|
||||
id: string;
|
||||
name: string;
|
||||
choose: boolean;
|
||||
}
|
||||
|
||||
export interface Divisions {
|
||||
client_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Areas {
|
||||
client_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
selected: boolean;
|
||||
}
|
||||
|
||||
export interface Terminals {
|
||||
area_types: [];
|
||||
client_id: string;
|
||||
division_id: string;
|
||||
id: string;
|
||||
public_id: string;
|
||||
}
|
||||
export interface TerminalDetails extends Terminals {
|
||||
socket_data: {
|
||||
closed: boolean,
|
||||
connected: boolean,
|
||||
last_ping: string,
|
||||
}
|
||||
}
|
||||
|
||||
export interface Notification {
|
||||
id: string;
|
||||
new: boolean;
|
||||
new_fin: boolean;
|
||||
due: boolean;
|
||||
}
|
||||
|
||||
export interface ref {
|
||||
amount: number | undefined;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface Refund {
|
||||
admin_return: ref;
|
||||
difference_return: ref;
|
||||
full_return: ref;
|
||||
}
|
||||
export interface PaymentRefund {
|
||||
id: string,
|
||||
payment_id: string,
|
||||
data: {
|
||||
token: string
|
||||
},
|
||||
amount: number,
|
||||
status: string,
|
||||
export interface UserData {
|
||||
login: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface MenuItem {
|
||||
name: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface Delivery_address {
|
||||
flat: string;
|
||||
house: string;
|
||||
street: string;
|
||||
}
|
||||
|
||||
export interface Modifiers {
|
||||
group: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface Products {
|
||||
area: string;
|
||||
id: string;
|
||||
modifiers: Modifiers[];
|
||||
nomenclature_code: string;
|
||||
requested_quantity: string;
|
||||
status: string;
|
||||
stock_quantity: string;
|
||||
title: string;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
export interface Address {
|
||||
client_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Payment {
|
||||
payload: Payload;
|
||||
summ: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Payload {
|
||||
id: string;
|
||||
status: string
|
||||
}
|
||||
|
||||
export interface Order {
|
||||
address: Address;
|
||||
comment: string;
|
||||
date_created: string;
|
||||
delivery_address: Delivery_address;
|
||||
due_datetime: string;
|
||||
external_id: string;
|
||||
id: number;
|
||||
payment: Payment[];
|
||||
phone: string;
|
||||
products: Products[];
|
||||
status: string;
|
||||
status_h: string;
|
||||
item_style: string;
|
||||
isWarnLine: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Client {
|
||||
id: string;
|
||||
name: string;
|
||||
choose: boolean;
|
||||
}
|
||||
|
||||
export interface Divisions {
|
||||
client_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Areas {
|
||||
client_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
selected: boolean;
|
||||
}
|
||||
|
||||
export interface Terminals {
|
||||
area_types: [];
|
||||
client_id: string;
|
||||
division_id: string;
|
||||
id: string;
|
||||
public_id: string;
|
||||
}
|
||||
export interface TerminalDetails extends Terminals {
|
||||
socket_data: {
|
||||
closed: boolean,
|
||||
connected: boolean,
|
||||
last_ping: string,
|
||||
}
|
||||
}
|
||||
|
||||
export interface Notification {
|
||||
id: string;
|
||||
new: boolean;
|
||||
new_fin: boolean;
|
||||
due: boolean;
|
||||
}
|
||||
|
||||
export interface ref {
|
||||
amount: number | undefined;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface Refund {
|
||||
admin_return: ref;
|
||||
difference_return: ref;
|
||||
full_return: ref;
|
||||
}
|
||||
export interface PaymentRefund {
|
||||
id: string,
|
||||
payment_id: string,
|
||||
data: {
|
||||
token: string
|
||||
},
|
||||
amount: number,
|
||||
status: string,
|
||||
}
|
||||
@ -1,50 +1,50 @@
|
||||
<h1>Зоны</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="new_ar;else new_Area">
|
||||
<button (click)="createArea()">Добавить</button>
|
||||
<p-table [value]="areas">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th style="width:35%">ID</th>
|
||||
<th style="width:35%">Наименование зоны</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-areas>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr>
|
||||
<td style="width:35%">{{areas.id}}</td>
|
||||
<td style="width:35%">{{areas.name}}</td>
|
||||
<td><button (click)="updateArea1(areas.id, areas.name)">Изменить</button></td>
|
||||
<td><button (click)="confirm(areas.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_Area>
|
||||
<button (click)="getAreas()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите наименование зоны:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="createArea2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="updateArea()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
<h1>Зоны</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="new_ar;else new_Area">
|
||||
<button (click)="createArea()">Добавить</button>
|
||||
<p-table [value]="areas">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th style="width:35%">ID</th>
|
||||
<th style="width:35%">Наименование зоны</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-areas>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr>
|
||||
<td style="width:35%">{{areas.id}}</td>
|
||||
<td style="width:35%">{{areas.name}}</td>
|
||||
<td><button (click)="updateArea1(areas.id, areas.name)">Изменить</button></td>
|
||||
<td><button (click)="confirm(areas.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_Area>
|
||||
<button (click)="getAreas()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите наименование зоны:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="createArea2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="updateArea()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
@ -1,160 +1,160 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Areas } from "src/app/interface/data";
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-areas',
|
||||
templateUrl: './areas.component.html',
|
||||
styleUrls: ['./areas.component.scss']
|
||||
})
|
||||
export class AreasComponent implements OnInit {
|
||||
public areas: Areas[] = [];
|
||||
public new_ar = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.choose) { this.getAreas() };
|
||||
}
|
||||
|
||||
async getAreas() {
|
||||
this.create = false;
|
||||
this.new_ar = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getAreas',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.areas = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 290px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
updateArea1(id: any, name: any) {
|
||||
this.new_ar = false;
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = name, 100);
|
||||
this.jsonRpcService.changeId = id
|
||||
}
|
||||
|
||||
updateArea() {
|
||||
let name_n = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateArea',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"area_id": this.jsonRpcService.changeId,
|
||||
"name": name_n
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_ar = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
setTimeout(() => this.getAreas(), 100);
|
||||
}
|
||||
|
||||
deleteArea(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteArea',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"area_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getAreas(), 100);
|
||||
}
|
||||
|
||||
|
||||
createArea() {
|
||||
this.new_ar = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
createArea2() {
|
||||
let name = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createArea',
|
||||
params: {
|
||||
"name": name,
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getAreas(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteArea(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Areas } from "src/app/interface/data";
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-areas',
|
||||
templateUrl: './areas.component.html',
|
||||
styleUrls: ['./areas.component.scss']
|
||||
})
|
||||
export class AreasComponent implements OnInit {
|
||||
public areas: Areas[] = [];
|
||||
public new_ar = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.choose) { this.getAreas() };
|
||||
}
|
||||
|
||||
async getAreas() {
|
||||
this.create = false;
|
||||
this.new_ar = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getAreas',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.areas = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 290px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
updateArea1(id: any, name: any) {
|
||||
this.new_ar = false;
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = name, 100);
|
||||
this.jsonRpcService.changeId = id
|
||||
}
|
||||
|
||||
updateArea() {
|
||||
let name_n = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateArea',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"area_id": this.jsonRpcService.changeId,
|
||||
"name": name_n
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_ar = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
setTimeout(() => this.getAreas(), 100);
|
||||
}
|
||||
|
||||
deleteArea(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteArea',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"area_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getAreas(), 100);
|
||||
}
|
||||
|
||||
|
||||
createArea() {
|
||||
this.new_ar = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
createArea2() {
|
||||
let name = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createArea',
|
||||
params: {
|
||||
"name": name,
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getAreas(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteArea(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,52 +1,52 @@
|
||||
<h1>Клиенты</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="new_cl;else new_client">
|
||||
<button (click)="createCient()">Добавить</button>
|
||||
<p-table [value]="clients">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th style="width:30%">ID</th>
|
||||
<th style="width:30%">Наименование организации</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-client>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr>
|
||||
<td style="width:30%">{{client.id}}</td>
|
||||
<td style="width:30%">{{client.name}}</td>
|
||||
<td><button [disabled]="choose == client.id" (click)="(chooseClient(client.id, client.name))">{{ choose == client.id ? 'Выбран' : 'Выбрать' }}</button></td>
|
||||
<td><button (click)="changeClient1(client.id, client.name)">Изменить</button></td>
|
||||
<td><button (click)="confirm(client.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_client>
|
||||
<button (click)="getClients()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите наименование организации:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="createClient2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="changeClient()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
<h1>Клиенты</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="new_cl;else new_client">
|
||||
<button (click)="createCient()">Добавить</button>
|
||||
<p-table [value]="clients">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th style="width:30%">ID</th>
|
||||
<th style="width:30%">Наименование организации</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-client>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr>
|
||||
<td style="width:30%">{{client.id}}</td>
|
||||
<td style="width:30%">{{client.name}}</td>
|
||||
<td><button [disabled]="choose == client.id" (click)="(chooseClient(client.id, client.name))">{{ choose == client.id ? 'Выбран' : 'Выбрать' }}</button></td>
|
||||
<td><button (click)="changeClient1(client.id, client.name)">Изменить</button></td>
|
||||
<td><button (click)="confirm(client.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_client>
|
||||
<button (click)="getClients()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите наименование организации:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="createClient2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="changeClient()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
@ -1,166 +1,166 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Client } from "src/app/interface/data";
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-clents',
|
||||
templateUrl: './clients.component.html',
|
||||
styleUrls: ['./clients.component.scss']
|
||||
})
|
||||
export class ClientsComponent implements OnInit {
|
||||
public clients: Client[] = [];
|
||||
public new_cl = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
public myAudio = new Audio();
|
||||
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getClients();
|
||||
}
|
||||
|
||||
async getClients() {
|
||||
this.create = false;
|
||||
this.new_cl = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getClients',
|
||||
params: {
|
||||
"name": ""
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.clients = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 290px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
changeClient1(id: any, name: any) {
|
||||
this.new_cl = false;
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = name, 100);
|
||||
this.jsonRpcService.changeId = id
|
||||
}
|
||||
|
||||
changeClient() {
|
||||
let name_n = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateClient',
|
||||
params: {
|
||||
"client_id": this.jsonRpcService.changeId,
|
||||
"name": name_n
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_cl = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
this.getClients();
|
||||
}
|
||||
|
||||
deleteClient(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteClient',
|
||||
params: {
|
||||
"client_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getClients(), 100);
|
||||
}
|
||||
|
||||
chooseClient(id: any, name: any) {
|
||||
this.jsonRpcService.ClientChooseName = name;
|
||||
this.jsonRpcService.ClientChoose = id;
|
||||
this.choose = this.jsonRpcService.ClientChoose;
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
createCient() {
|
||||
this.new_cl = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
createClient2() {
|
||||
let name = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createClient',
|
||||
params: {
|
||||
"name": name
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getClients(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteClient(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Client } from "src/app/interface/data";
|
||||
import { ConfirmationService } from 'primeng/api';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-clents',
|
||||
templateUrl: './clients.component.html',
|
||||
styleUrls: ['./clients.component.scss']
|
||||
})
|
||||
export class ClientsComponent implements OnInit {
|
||||
public clients: Client[] = [];
|
||||
public new_cl = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
public myAudio = new Audio();
|
||||
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getClients();
|
||||
}
|
||||
|
||||
async getClients() {
|
||||
this.create = false;
|
||||
this.new_cl = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getClients',
|
||||
params: {
|
||||
"name": ""
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.clients = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 290px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
changeClient1(id: any, name: any) {
|
||||
this.new_cl = false;
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = name, 100);
|
||||
this.jsonRpcService.changeId = id
|
||||
}
|
||||
|
||||
changeClient() {
|
||||
let name_n = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateClient',
|
||||
params: {
|
||||
"client_id": this.jsonRpcService.changeId,
|
||||
"name": name_n
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_cl = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
this.getClients();
|
||||
}
|
||||
|
||||
deleteClient(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteClient',
|
||||
params: {
|
||||
"client_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getClients(), 100);
|
||||
}
|
||||
|
||||
chooseClient(id: any, name: any) {
|
||||
this.jsonRpcService.ClientChooseName = name;
|
||||
this.jsonRpcService.ClientChoose = id;
|
||||
this.choose = this.jsonRpcService.ClientChoose;
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
createCient() {
|
||||
this.new_cl = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
createClient2() {
|
||||
let name = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createClient',
|
||||
params: {
|
||||
"name": name
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getClients(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteClient(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,57 +1,57 @@
|
||||
<h1>Подразделения</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="new_div;else new_Division">
|
||||
<button (click)="createDivision()">Добавить</button>
|
||||
<p-table [value]="divisions">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th style="width:35%">ID</th>
|
||||
<th style="width:35%">Наименование подразделения</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr style="position:sticky !important; top: 55px">
|
||||
<th style="width:35%"></th>
|
||||
<th style="width:35%"><p-columnFilter type="text" field="name" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-Division>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr>
|
||||
<td style="width:35%">{{Division.id}}</td>
|
||||
<td style="width:35%">{{Division.name}}</td>
|
||||
<td><button (click)="changeDivision1(Division.id, Division.name)">Изменить</button></td>
|
||||
<td><button (click)="confirm(Division.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_Division>
|
||||
<button (click)="getDivisions()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите наименование подразделения:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="createDivision2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="changeDivision()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
|
||||
<h1>Подразделения</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="new_div;else new_Division">
|
||||
<button (click)="createDivision()">Добавить</button>
|
||||
<p-table [value]="divisions">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th style="width:35%">ID</th>
|
||||
<th style="width:35%">Наименование подразделения</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr style="position:sticky !important; top: 55px">
|
||||
<th style="width:35%"></th>
|
||||
<th style="width:35%"><p-columnFilter type="text" field="name" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-Division>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr>
|
||||
<td style="width:35%">{{Division.id}}</td>
|
||||
<td style="width:35%">{{Division.name}}</td>
|
||||
<td><button (click)="changeDivision1(Division.id, Division.name)">Изменить</button></td>
|
||||
<td><button (click)="confirm(Division.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_Division>
|
||||
<button (click)="getDivisions()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите наименование подразделения:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="createDivision2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="changeDivision()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
@ -1,191 +1,191 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Divisions } from "src/app/interface/data";
|
||||
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-divisions',
|
||||
templateUrl: './divisions.component.html',
|
||||
styleUrls: ['./divisions.component.scss']
|
||||
})
|
||||
export class DivisionsComponent implements OnInit {
|
||||
public divisions: Divisions[] = [];
|
||||
public new_div = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
public ind: boolean = false;
|
||||
public matchModeOptions!: SelectItem[];
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private filterService: FilterService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.choose) { this.getDivisions() };
|
||||
|
||||
const customFilterName = "custom-contains";
|
||||
this.filterService.register(customFilterName, (value: any, filter: any): boolean => {
|
||||
if (filter === undefined || filter === null || filter.trim() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value === undefined || value === null) {
|
||||
return false;
|
||||
}
|
||||
let det = value.toString()
|
||||
let det2 = det.toLowerCase()
|
||||
return det2.includes(filter.toString()) || det.includes(filter.toString());
|
||||
|
||||
});
|
||||
|
||||
this.matchModeOptions = [
|
||||
{ label: 'Содержит', value: customFilterName },
|
||||
{ label: 'Равно', value: FilterMatchMode.EQUALS },
|
||||
{ label: 'Начинается с', value: FilterMatchMode.STARTS_WITH },
|
||||
];
|
||||
}
|
||||
|
||||
async getDivisions() {
|
||||
this.create = false;
|
||||
this.new_div = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getDivisions',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.divisions = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 341px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
changeDivision1(id: any, name: any) {
|
||||
this.new_div = false;
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = name, 100);
|
||||
this.jsonRpcService.changeId = id
|
||||
}
|
||||
|
||||
changeDivision() {
|
||||
let name_n = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateDivision',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"division_id": this.jsonRpcService.changeId,
|
||||
"name": name_n
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_div = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
setTimeout(() => this.getDivisions(), 100);
|
||||
}
|
||||
|
||||
deleteDivision(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteDivision',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"division_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getDivisions(), 100);
|
||||
}
|
||||
|
||||
chooseClient(id: any, name: any) {
|
||||
console.log(id);
|
||||
this.jsonRpcService.ClientChooseName = name;
|
||||
this.jsonRpcService.ClientChoose = id;
|
||||
this.choose = this.jsonRpcService.ClientChoose;
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
createDivision() {
|
||||
this.new_div = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
createDivision2() {
|
||||
let name = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createDivision',
|
||||
params: {
|
||||
"name": name,
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getDivisions(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteDivision(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Divisions } from "src/app/interface/data";
|
||||
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-divisions',
|
||||
templateUrl: './divisions.component.html',
|
||||
styleUrls: ['./divisions.component.scss']
|
||||
})
|
||||
export class DivisionsComponent implements OnInit {
|
||||
public divisions: Divisions[] = [];
|
||||
public new_div = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
public ind: boolean = false;
|
||||
public matchModeOptions!: SelectItem[];
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private filterService: FilterService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.choose) { this.getDivisions() };
|
||||
|
||||
const customFilterName = "custom-contains";
|
||||
this.filterService.register(customFilterName, (value: any, filter: any): boolean => {
|
||||
if (filter === undefined || filter === null || filter.trim() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value === undefined || value === null) {
|
||||
return false;
|
||||
}
|
||||
let det = value.toString()
|
||||
let det2 = det.toLowerCase()
|
||||
return det2.includes(filter.toString()) || det.includes(filter.toString());
|
||||
|
||||
});
|
||||
|
||||
this.matchModeOptions = [
|
||||
{ label: 'Содержит', value: customFilterName },
|
||||
{ label: 'Равно', value: FilterMatchMode.EQUALS },
|
||||
{ label: 'Начинается с', value: FilterMatchMode.STARTS_WITH },
|
||||
];
|
||||
}
|
||||
|
||||
async getDivisions() {
|
||||
this.create = false;
|
||||
this.new_div = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getDivisions',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.divisions = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 341px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
changeDivision1(id: any, name: any) {
|
||||
this.new_div = false;
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = name, 100);
|
||||
this.jsonRpcService.changeId = id
|
||||
}
|
||||
|
||||
changeDivision() {
|
||||
let name_n = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateDivision',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"division_id": this.jsonRpcService.changeId,
|
||||
"name": name_n
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_div = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
setTimeout(() => this.getDivisions(), 100);
|
||||
}
|
||||
|
||||
deleteDivision(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteDivision',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"division_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getDivisions(), 100);
|
||||
}
|
||||
|
||||
chooseClient(id: any, name: any) {
|
||||
console.log(id);
|
||||
this.jsonRpcService.ClientChooseName = name;
|
||||
this.jsonRpcService.ClientChoose = id;
|
||||
this.choose = this.jsonRpcService.ClientChoose;
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
}
|
||||
|
||||
createDivision() {
|
||||
this.new_div = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
createDivision2() {
|
||||
let name = document.getElementsByTagName("input")[0].value
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createDivision',
|
||||
params: {
|
||||
"name": name,
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getDivisions(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteDivision(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,199 +1,199 @@
|
||||
<h1>Заказы</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="view; else order_v">
|
||||
<p>Время последнего обновления: {{lastOrderUpdateTime | date:'dd.MM.yyyy HH:mm:ss'}}</p>
|
||||
<button (click)="getOrders()">Обновить</button>
|
||||
<p-table [value]="orders">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th>ID</th>
|
||||
<th>Статус</th>
|
||||
<!--<p-columnFilter type="text" field="Статус" display="menu"></p-columnFilter>-->
|
||||
<th>ID точки заказа</th>
|
||||
<th>Дата создания</th>
|
||||
<th>Дата самовывоза</th>
|
||||
<th>Внешний ID заказа</th>
|
||||
<th>Телефон клиента</th>
|
||||
<th>Тип оплаты</th>
|
||||
<th>Тип заказа</th>
|
||||
</tr>
|
||||
<tr style="position:sticky !important; top: 55px">
|
||||
<th><p-columnFilter type="text" field="id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="status_h" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="address.name" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th><p-columnFilter type="text" field="external_id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="phone" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th></th>
|
||||
<th><p-columnFilter field="type" matchMode="in" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
||||
<ng-template pTemplate="filter" let-value let-filter="filterCallback">
|
||||
<p-multiSelect [ngModel]="value" [options]="keysFromObject(orderTypes)" placeholder="Тип заказа"
|
||||
(onChange)="filter($event.value)" [label]="orderTypes[leadToTypeOrderType(value)]" [displaySelectedLabel]="false">
|
||||
<ng-template let-option pTemplate="item">
|
||||
<div class="p-multiselect-representative-option">
|
||||
<span class="p-ml-1">{{orderTypes[leadToTypeOrderType(option)]}}</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-multiSelect>
|
||||
</ng-template>
|
||||
</p-columnFilter></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-order>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr (click)="vievOrder(order.id)" #ordtable style="cursor: pointer">
|
||||
<td id="order">{{order.id}}</td>
|
||||
<td [ngClass]="{'red': order.item_style == 'red','orange': order.item_style == 'orange','green': order.item_style == 'green','grey': order.item_style == 'grey','yellow': order.item_style == 'yellow','blue': order.item_style == 'blue','lilac': order.item_style == 'lilac', 'pink': order.item_style == 'pink'}">{{order.status_h}}</td>
|
||||
<td>{{order.address.name}}</td>
|
||||
<td>{{order.date_created | date:'HH:mm dd.MM.yyyy'}}</td>
|
||||
<td>{{order.due_datetime | date:'HH:mm dd.MM.yyyy'}}</td>
|
||||
<td>{{order.external_id}}</td>
|
||||
<td>{{order.phone}}</td>
|
||||
<td *ngIf="order.payment[0]; else nd">{{order.payment[0].type}}</td>
|
||||
<td>{{orderTypes[leadToTypeOrderType(order.type)]}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #nd>
|
||||
<td>Нет данных</td>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #order_v>
|
||||
<div>
|
||||
<button (click)="listOrders()">К списку</button>
|
||||
<h1>Заказ: {{order[0]?.id}}</h1>
|
||||
<p-table [value]="order">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Внешний ID заказа</th>
|
||||
<th>Дата создания</th>
|
||||
<th>ID точки заказа</th>
|
||||
<th>Статус</th>
|
||||
<th>Тип заказа</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-ord>
|
||||
<tr>
|
||||
<td><input type="text" textarea disabled value="{{ord.external_id}}"></td>
|
||||
<td><input textarea disabled type="datetime-local" value="{{ord.date_created}}"></td>
|
||||
<td><input textarea disabled type="text" value="{{ord.address.id}}"></td>
|
||||
<td>
|
||||
<select [(ngModel)]="selectedStatus">
|
||||
<option>{{ord.status_h}}</option>
|
||||
<option>К готовке</option>
|
||||
<option>Готовится</option>
|
||||
<option>Готово</option>
|
||||
<option>Новый</option>
|
||||
<option>Выдан</option>
|
||||
<option>Напечатан чек</option>
|
||||
<option>Отменен</option>
|
||||
</select>
|
||||
<button (click)="saveStatus(ord.id)" [disabled]="!selectedStatus.length">Сохранить</button>
|
||||
</td>
|
||||
<td>{{orderTypes[leadToTypeOrderType(ord.type)]}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<h2>Состав заказа:</h2>
|
||||
<p-table [value]="order[0].products">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Товар</th>
|
||||
<th>Кол-во (факт.)</th>
|
||||
<th>Цена</th>
|
||||
<th>Кол-во (реал.)</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Модификаторы</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-ord>
|
||||
<tr>
|
||||
<td>{{ord.title}}</td>
|
||||
|
||||
<td>{{ord.requested_quantity}}</td>
|
||||
<td>-</td>
|
||||
<td>{{ord.stock_quantity}}</td>
|
||||
<td>-</td>
|
||||
<td>
|
||||
<tbody *ngFor="let mod of ord.modifiers">
|
||||
<tr>
|
||||
{{mod.group}}
|
||||
</tr>
|
||||
<tr>
|
||||
{{mod.title}}
|
||||
</tr>
|
||||
</tbody>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th width="15%">Комментарий:</th>
|
||||
<th width="85%" style="font-weight: normal">{{order[0].comment}}</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<h2>Оплата:</h2>
|
||||
<p-table [value]="order[0].payment">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Сумма оплаты</th>
|
||||
<th>Тип оплаты</th>
|
||||
<th *ngIf="order[0].payment[0]?.type?.toUpperCase() !== 'CASH'">Статус оплаты</th>
|
||||
<!-- <th *ngIf="['PAID', 'NOTIFIED', 'INTERNAL_ERROR', 'PROCESSING'].includes(order[0].payment[0]?.payload?.status || '') && order[0].payment[0]?.type !== 'CASH'">Отмена заказа</th> -->
|
||||
<th>Отмена заказа</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-pay>
|
||||
<tr>
|
||||
<td>{{pay.summ}}</td>
|
||||
<td>{{pay.type | paymentType}}</td>
|
||||
<td *ngIf="pay?.type?.toUpperCase() !== 'CASH'">{{pay?.payload?.status | paymentStatus}}</td>
|
||||
<!-- <td *ngIf="['PAID', 'NOTIFIED', 'INTERNAL_ERROR', 'PROCESSING'].includes(order[0].payment[0]?.payload?.status || '') && order[0].payment[0]?.type !== 'CASH'"> -->
|
||||
<td>
|
||||
<button (click)="cancelOrder(pay.payload?.id)" style="width: auto;">
|
||||
{{pay?.type?.toUpperCase() == 'SBP'? 'Отменить и вернуть ДС' : 'Отменить'}}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<div *ngIf="paymentRefunds.length">
|
||||
<h2>Список возвратов:</h2>
|
||||
<p-table [value]="paymentRefunds">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Сумма</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-paymentRefund>
|
||||
<tr>
|
||||
<td>{{paymentRefund.amount}}</td>
|
||||
<td>{{paymentRefund.status}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<p-toast position="bottom-right" key="br" closable="false"></p-toast>
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined" [style]="{width: '30vw'}"></p-confirmDialog>
|
||||
|
||||
|
||||
|
||||
|
||||
<h1>Заказы</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
|
||||
<div *ngIf="view; else order_v">
|
||||
<p>Время последнего обновления: {{lastOrderUpdateTime | date:'dd.MM.yyyy HH:mm:ss'}}</p>
|
||||
<button (click)="getOrders()">Обновить</button>
|
||||
<p-table [value]="orders">
|
||||
<ng-template pTemplate="header">
|
||||
<tr style="position:sticky !important; top: 0">
|
||||
<th>ID</th>
|
||||
<th>Статус</th>
|
||||
<!--<p-columnFilter type="text" field="Статус" display="menu"></p-columnFilter>-->
|
||||
<th>ID точки заказа</th>
|
||||
<th>Дата создания</th>
|
||||
<th>Дата самовывоза</th>
|
||||
<th>Внешний ID заказа</th>
|
||||
<th>Телефон клиента</th>
|
||||
<th>Тип оплаты</th>
|
||||
<th>Тип заказа</th>
|
||||
</tr>
|
||||
<tr style="position:sticky !important; top: 55px">
|
||||
<th><p-columnFilter type="text" field="id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="status_h" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="address.name" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th><p-columnFilter type="text" field="external_id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th><p-columnFilter type="text" field="phone" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th></th>
|
||||
<th><p-columnFilter field="type" matchMode="in" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
||||
<ng-template pTemplate="filter" let-value let-filter="filterCallback">
|
||||
<p-multiSelect [ngModel]="value" [options]="keysFromObject(orderTypes)" placeholder="Тип заказа"
|
||||
(onChange)="filter($event.value)" [label]="orderTypes[leadToTypeOrderType(value)]" [displaySelectedLabel]="false">
|
||||
<ng-template let-option pTemplate="item">
|
||||
<div class="p-multiselect-representative-option">
|
||||
<span class="p-ml-1">{{orderTypes[leadToTypeOrderType(option)]}}</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-multiSelect>
|
||||
</ng-template>
|
||||
</p-columnFilter></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-order>
|
||||
<!--*ngIf="color()" style="color: red" [ngClass]="{ui-button-danger: true}"-->
|
||||
<tr (click)="vievOrder(order.id)" #ordtable style="cursor: pointer">
|
||||
<td id="order">{{order.id}}</td>
|
||||
<td [ngClass]="{'red': order.item_style == 'red','orange': order.item_style == 'orange','green': order.item_style == 'green','grey': order.item_style == 'grey','yellow': order.item_style == 'yellow','blue': order.item_style == 'blue','lilac': order.item_style == 'lilac', 'pink': order.item_style == 'pink'}">{{order.status_h}}</td>
|
||||
<td>{{order.address.name}}</td>
|
||||
<td>{{order.date_created | date:'HH:mm dd.MM.yyyy'}}</td>
|
||||
<td>{{order.due_datetime | date:'HH:mm dd.MM.yyyy'}}</td>
|
||||
<td>{{order.external_id}}</td>
|
||||
<td>{{order.phone}}</td>
|
||||
<td *ngIf="order.payment[0]; else nd">{{order.payment[0].type}}</td>
|
||||
<td>{{orderTypes[leadToTypeOrderType(order.type)]}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #nd>
|
||||
<td>Нет данных</td>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #order_v>
|
||||
<div>
|
||||
<button (click)="listOrders()">К списку</button>
|
||||
<h1>Заказ: {{order[0]?.id}}</h1>
|
||||
<p-table [value]="order">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Внешний ID заказа</th>
|
||||
<th>Дата создания</th>
|
||||
<th>ID точки заказа</th>
|
||||
<th>Статус</th>
|
||||
<th>Тип заказа</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-ord>
|
||||
<tr>
|
||||
<td><input type="text" textarea disabled value="{{ord.external_id}}"></td>
|
||||
<td><input textarea disabled type="datetime-local" value="{{ord.date_created}}"></td>
|
||||
<td><input textarea disabled type="text" value="{{ord.address.id}}"></td>
|
||||
<td>
|
||||
<select [(ngModel)]="selectedStatus">
|
||||
<option>{{ord.status_h}}</option>
|
||||
<option>К готовке</option>
|
||||
<option>Готовится</option>
|
||||
<option>Готово</option>
|
||||
<option>Новый</option>
|
||||
<option>Выдан</option>
|
||||
<option>Напечатан чек</option>
|
||||
<option>Отменен</option>
|
||||
</select>
|
||||
<button (click)="saveStatus(ord.id)" [disabled]="!selectedStatus.length">Сохранить</button>
|
||||
</td>
|
||||
<td>{{orderTypes[leadToTypeOrderType(ord.type)]}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<h2>Состав заказа:</h2>
|
||||
<p-table [value]="order[0].products">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Товар</th>
|
||||
<th>Кол-во (факт.)</th>
|
||||
<th>Цена</th>
|
||||
<th>Кол-во (реал.)</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Модификаторы</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-ord>
|
||||
<tr>
|
||||
<td>{{ord.title}}</td>
|
||||
|
||||
<td>{{ord.requested_quantity}}</td>
|
||||
<td>-</td>
|
||||
<td>{{ord.stock_quantity}}</td>
|
||||
<td>-</td>
|
||||
<td>
|
||||
<tbody *ngFor="let mod of ord.modifiers">
|
||||
<tr>
|
||||
{{mod.group}}
|
||||
</tr>
|
||||
<tr>
|
||||
{{mod.title}}
|
||||
</tr>
|
||||
</tbody>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th width="15%">Комментарий:</th>
|
||||
<th width="85%" style="font-weight: normal">{{order[0].comment}}</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<h2>Оплата:</h2>
|
||||
<p-table [value]="order[0].payment">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Сумма оплаты</th>
|
||||
<th>Тип оплаты</th>
|
||||
<th *ngIf="order[0].payment[0]?.type?.toUpperCase() !== 'CASH'">Статус оплаты</th>
|
||||
<!-- <th *ngIf="['PAID', 'NOTIFIED', 'INTERNAL_ERROR', 'PROCESSING'].includes(order[0].payment[0]?.payload?.status || '') && order[0].payment[0]?.type !== 'CASH'">Отмена заказа</th> -->
|
||||
<th>Отмена заказа</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-pay>
|
||||
<tr>
|
||||
<td>{{pay.summ}}</td>
|
||||
<td>{{pay.type | paymentType}}</td>
|
||||
<td *ngIf="pay?.type?.toUpperCase() !== 'CASH'">{{pay?.payload?.status | paymentStatus}}</td>
|
||||
<!-- <td *ngIf="['PAID', 'NOTIFIED', 'INTERNAL_ERROR', 'PROCESSING'].includes(order[0].payment[0]?.payload?.status || '') && order[0].payment[0]?.type !== 'CASH'"> -->
|
||||
<td>
|
||||
<button (click)="cancelOrder(pay.payload?.id)" style="width: auto;">
|
||||
{{pay?.type?.toUpperCase() == 'SBP'? 'Отменить и вернуть ДС' : 'Отменить'}}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
<div *ngIf="paymentRefunds.length">
|
||||
<h2>Список возвратов:</h2>
|
||||
<p-table [value]="paymentRefunds">
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Сумма</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template pTemplate="body" let-paymentRefund>
|
||||
<tr>
|
||||
<td>{{paymentRefund.amount}}</td>
|
||||
<td>{{paymentRefund.status}}</td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<p-toast position="bottom-right" key="br" closable="false"></p-toast>
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined" [style]="{width: '30vw'}"></p-confirmDialog>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,56 +1,56 @@
|
||||
button:disabled {
|
||||
background-color: grey !important;
|
||||
opacity: 50%;
|
||||
cursor: default;
|
||||
}
|
||||
.red {
|
||||
color: red !important;
|
||||
background-color: pink;
|
||||
}
|
||||
|
||||
.orange {
|
||||
color: darkorange !important;
|
||||
background-color: wheat;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: green !important;
|
||||
background-color: lightgreen;
|
||||
}
|
||||
|
||||
.grey {
|
||||
color: grey !important;
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
.yellow {
|
||||
color: darkgoldenrod !important;
|
||||
background-color: lightgoldenrodyellow;
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: blue !important;
|
||||
background-color: lightblue;
|
||||
}
|
||||
|
||||
.lilac {
|
||||
color: #8b00ff !important;
|
||||
background-color: #ebc4eb;
|
||||
}
|
||||
|
||||
.pink {
|
||||
color: #ff00ff !important;
|
||||
background-color: #ffabe3;
|
||||
}
|
||||
|
||||
p-table {
|
||||
height: auto;
|
||||
overflow: scroll
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
background-color: grey !important;
|
||||
opacity: 50%;
|
||||
cursor: default;
|
||||
}
|
||||
.red {
|
||||
color: red !important;
|
||||
background-color: pink;
|
||||
}
|
||||
|
||||
.orange {
|
||||
color: darkorange !important;
|
||||
background-color: wheat;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: green !important;
|
||||
background-color: lightgreen;
|
||||
}
|
||||
|
||||
.grey {
|
||||
color: grey !important;
|
||||
background-color: lightgray;
|
||||
}
|
||||
|
||||
.yellow {
|
||||
color: darkgoldenrod !important;
|
||||
background-color: lightgoldenrodyellow;
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: blue !important;
|
||||
background-color: lightblue;
|
||||
}
|
||||
|
||||
.lilac {
|
||||
color: #8b00ff !important;
|
||||
background-color: #ebc4eb;
|
||||
}
|
||||
|
||||
.pink {
|
||||
color: #ff00ff !important;
|
||||
background-color: #ffabe3;
|
||||
}
|
||||
|
||||
p-table {
|
||||
height: auto;
|
||||
overflow: scroll
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,138 +1,138 @@
|
||||
<div>
|
||||
<h1>Терминалы</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
</div>
|
||||
<div *ngIf="new_ter;else new_Terminal">
|
||||
<button (click)="registerTerminal()">Добавить</button>
|
||||
|
||||
<p-table [value]="terminals">
|
||||
|
||||
<ng-template pTemplate="header" class="head">
|
||||
<tr>
|
||||
<th style="width: 16%">ID</th>
|
||||
<th style="width: 16%">ID кассы ККМ</th>
|
||||
<th style="width: 16%">ID точки заказа</th>
|
||||
<th style="width: 16%">ID зон доставок</th>
|
||||
<th style="width: 16%">Статус подключения</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr style="position:sticky !important; top: 55px">
|
||||
<th style="width: 16%"></th>
|
||||
<th style="width: 16%"><p-columnFilter type="text" field="public_id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th style="width: 16%"><p-columnFilter type="text" field="division_id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th style="width: 16%"></th>
|
||||
<th style="width: 16%"></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
<ng-template pTemplate="body" let-terminals>
|
||||
<tr>
|
||||
<td style="width: 16%" class="customer-badge status-unqualified">{{terminals.id}}</td>
|
||||
<td style="width: 16%">{{terminals.public_id}}</td>
|
||||
<td style="width: 16%">{{terminals.division_id}}</td>
|
||||
<td style="width: 16%">{{terminals.area_types}}</td>
|
||||
<td
|
||||
style="width: 16%"
|
||||
[ngClass]="{disconnected: terminals.connection_status == 'disconnected', connected: terminals.connection_status == 'connected'}"
|
||||
>{{terminals.connection_status}}</td>
|
||||
<td><button (click)="updateTerminal1(terminals.id, terminals.public_id, terminals.division_id, terminals.area_types)">Изменить</button></td>
|
||||
<td><button (click)="confirm(terminals.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_Terminal>
|
||||
<button (click)="getTerminals()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите внешний ID терминала:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Выберите точку заказа:</th>
|
||||
<th>
|
||||
<p-dropdown autoWidth="false" [options]="divisions" optionLabel="name" [(ngModel)]="selectedDivision"></p-dropdown>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Введите ID зон доставок:</th>
|
||||
<th>
|
||||
|
||||
<ul class="selectedAreasList" style="width: 400px; font-size:16px">
|
||||
<p-dropdown autoWidth="false" [options]="areas" optionLabel="name" (onChange)="addAreaToSelected($event)"></p-dropdown>
|
||||
<li *ngFor="let area of selectedAreas">
|
||||
<span>{{area.name}}</span>
|
||||
<button style="font-weight: bold" (click)="removeAreaFromSelected(area.id)">✖</button>
|
||||
<!-- <p-button (click)="removeAreaFromSelected(area.id)" icon="pi pi-times-circle"></p-button> -->
|
||||
</li>
|
||||
</ul>
|
||||
<!-- <p-chips [(ngModel)]="selectedAreas" [allowDuplicate]="false" inputId="chipInputField">
|
||||
<ng-template let-item pTemplate="item">
|
||||
{{item.name}} <i class="fa fa-close"></i>
|
||||
</ng-template>
|
||||
</p-chips> -->
|
||||
</th>
|
||||
|
||||
<!-- <th>
|
||||
<tbody *ngFor="let area of areas">
|
||||
<tr>
|
||||
<input type="checkbox" value="{{area.selected}}" id="ar" [(ngModel)]="area.selected">
|
||||
<span>Цех: {{area.name}}</span>
|
||||
</tr>
|
||||
</tbody>
|
||||
</th> -->
|
||||
|
||||
</tr>
|
||||
<tr *ngIf="terminal">
|
||||
<th>
|
||||
Статус:
|
||||
</th>
|
||||
<th>
|
||||
{{terminal.socket_data.connected ? 'Соединен' : 'Отключен'}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Обновлено:
|
||||
</th>
|
||||
<th *ngIf="terminal?.socket_data?.last_ping === null">
|
||||
Нет Данных
|
||||
</th>
|
||||
<th *ngIf="!(terminal?.socket_data?.last_ping === null)">
|
||||
{{terminal?.socket_data?.last_ping | date:'dd.MM.yy, HH:mm:ss'}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Закрыто:
|
||||
</th>
|
||||
<th *ngIf="terminal?.socket_data?.closed === null">
|
||||
Нет Данных
|
||||
</th>
|
||||
<th *ngIf="!(terminal?.socket_data?.closed === null)">
|
||||
{{terminal?.socket_data?.closed ? 'Да' : 'Нет'}}
|
||||
</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="registerTerminal2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="updateTerminal()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
<div>
|
||||
<h1>Терминалы</h1>
|
||||
|
||||
<h2 *ngIf="chooseName; else ClientNull">Выбран: {{chooseName}}</h2>
|
||||
<ng-template #ClientNull>
|
||||
<h2 style="color:red">Выберите клиента</h2>
|
||||
</ng-template>
|
||||
</div>
|
||||
<div *ngIf="new_ter;else new_Terminal">
|
||||
<button (click)="registerTerminal()">Добавить</button>
|
||||
|
||||
<p-table [value]="terminals">
|
||||
|
||||
<ng-template pTemplate="header" class="head">
|
||||
<tr>
|
||||
<th style="width: 16%">ID</th>
|
||||
<th style="width: 16%">ID кассы ККМ</th>
|
||||
<th style="width: 16%">ID точки заказа</th>
|
||||
<th style="width: 16%">ID зон доставок</th>
|
||||
<th style="width: 16%">Статус подключения</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr style="position:sticky !important; top: 55px">
|
||||
<th style="width: 16%"></th>
|
||||
<th style="width: 16%"><p-columnFilter type="text" field="public_id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th style="width: 16%"><p-columnFilter type="text" field="division_id" [matchModeOptions]="matchModeOptions" [matchMode]="'custom-contains'"></p-columnFilter></th>
|
||||
<th style="width: 16%"></th>
|
||||
<th style="width: 16%"></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
<ng-template pTemplate="body" let-terminals>
|
||||
<tr>
|
||||
<td style="width: 16%" class="customer-badge status-unqualified">{{terminals.id}}</td>
|
||||
<td style="width: 16%">{{terminals.public_id}}</td>
|
||||
<td style="width: 16%">{{terminals.division_id}}</td>
|
||||
<td style="width: 16%">{{terminals.area_types}}</td>
|
||||
<td
|
||||
style="width: 16%"
|
||||
[ngClass]="{disconnected: terminals.connection_status == 'disconnected', connected: terminals.connection_status == 'connected'}"
|
||||
>{{terminals.connection_status}}</td>
|
||||
<td><button (click)="updateTerminal1(terminals.id, terminals.public_id, terminals.division_id, terminals.area_types)">Изменить</button></td>
|
||||
<td><button (click)="confirm(terminals.id)">Удалить</button></td>
|
||||
</tr>
|
||||
</ng-template>
|
||||
|
||||
</p-table>
|
||||
</div>
|
||||
|
||||
<ng-template #new_Terminal>
|
||||
<button (click)="getTerminals()">К списку</button>
|
||||
<p-table>
|
||||
<ng-template pTemplate="header">
|
||||
<tr>
|
||||
<th>Введите внешний ID терминала:</th>
|
||||
<th><input type="text" style="width: 400px; height: 30px; font-size:20px"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Выберите точку заказа:</th>
|
||||
<th>
|
||||
<p-dropdown autoWidth="false" [options]="divisions" optionLabel="name" [(ngModel)]="selectedDivision"></p-dropdown>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Введите ID зон доставок:</th>
|
||||
<th>
|
||||
|
||||
<ul class="selectedAreasList" style="width: 400px; font-size:16px">
|
||||
<p-dropdown autoWidth="false" [options]="areas" optionLabel="name" (onChange)="addAreaToSelected($event)"></p-dropdown>
|
||||
<li *ngFor="let area of selectedAreas">
|
||||
<span>{{area.name}}</span>
|
||||
<button style="font-weight: bold" (click)="removeAreaFromSelected(area.id)">✖</button>
|
||||
<!-- <p-button (click)="removeAreaFromSelected(area.id)" icon="pi pi-times-circle"></p-button> -->
|
||||
</li>
|
||||
</ul>
|
||||
<!-- <p-chips [(ngModel)]="selectedAreas" [allowDuplicate]="false" inputId="chipInputField">
|
||||
<ng-template let-item pTemplate="item">
|
||||
{{item.name}} <i class="fa fa-close"></i>
|
||||
</ng-template>
|
||||
</p-chips> -->
|
||||
</th>
|
||||
|
||||
<!-- <th>
|
||||
<tbody *ngFor="let area of areas">
|
||||
<tr>
|
||||
<input type="checkbox" value="{{area.selected}}" id="ar" [(ngModel)]="area.selected">
|
||||
<span>Цех: {{area.name}}</span>
|
||||
</tr>
|
||||
</tbody>
|
||||
</th> -->
|
||||
|
||||
</tr>
|
||||
<tr *ngIf="terminal">
|
||||
<th>
|
||||
Статус:
|
||||
</th>
|
||||
<th>
|
||||
{{terminal.socket_data.connected ? 'Соединен' : 'Отключен'}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Обновлено:
|
||||
</th>
|
||||
<th *ngIf="terminal?.socket_data?.last_ping === null">
|
||||
Нет Данных
|
||||
</th>
|
||||
<th *ngIf="!(terminal?.socket_data?.last_ping === null)">
|
||||
{{terminal?.socket_data?.last_ping | date:'dd.MM.yy, HH:mm:ss'}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Закрыто:
|
||||
</th>
|
||||
<th *ngIf="terminal?.socket_data?.closed === null">
|
||||
Нет Данных
|
||||
</th>
|
||||
<th *ngIf="!(terminal?.socket_data?.closed === null)">
|
||||
{{terminal?.socket_data?.closed ? 'Да' : 'Нет'}}
|
||||
</th>
|
||||
</tr>
|
||||
</ng-template>
|
||||
</p-table>
|
||||
<div *ngIf="create; else change">
|
||||
<button (click)="registerTerminal2()">Создать</button>
|
||||
</div>
|
||||
<ng-template #change>
|
||||
<button (click)="updateTerminal()">Сохранить</button>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
|
||||
<p-confirmDialog header="Предупреждение" icon="pi pi-exclamation-triangle" defaultFocus="reject" rejectButtonStyleClass="p-button-outlined"></p-confirmDialog>
|
||||
|
||||
|
||||
@ -1,56 +1,56 @@
|
||||
span {
|
||||
padding: 0 5px !important;
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
#chipInputField {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.disconnected {
|
||||
background-color: rgb(255, 120, 120);;
|
||||
}
|
||||
|
||||
.connectede {
|
||||
background-color: rgb(120, 255, 143);;
|
||||
}
|
||||
|
||||
ul.selectedAreasList {
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
overflow-wrap: normal;
|
||||
|
||||
li {
|
||||
margin-left: 4px;
|
||||
margin-top: 2px;
|
||||
padding: 0 6px;
|
||||
width: fit-content;
|
||||
background-color: gray;
|
||||
text-align: center;
|
||||
color: white;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
button {
|
||||
width: fit-content;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
.ui-dropdown {
|
||||
width: 200px;
|
||||
height: 30px !important;
|
||||
font-size:20px;
|
||||
.p-dropdown {
|
||||
height: 30px !important;
|
||||
}
|
||||
}
|
||||
span {
|
||||
padding: 0 5px !important;
|
||||
}
|
||||
|
||||
tr {
|
||||
display: table;
|
||||
width: calc(100% - 5px);
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
#chipInputField {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.disconnected {
|
||||
background-color: rgb(255, 120, 120);;
|
||||
}
|
||||
|
||||
.connectede {
|
||||
background-color: rgb(120, 255, 143);;
|
||||
}
|
||||
|
||||
ul.selectedAreasList {
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
overflow-wrap: normal;
|
||||
|
||||
li {
|
||||
margin-left: 4px;
|
||||
margin-top: 2px;
|
||||
padding: 0 6px;
|
||||
width: fit-content;
|
||||
background-color: gray;
|
||||
text-align: center;
|
||||
color: white;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
button {
|
||||
width: fit-content;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
.ui-dropdown {
|
||||
width: 200px;
|
||||
height: 30px !important;
|
||||
font-size:20px;
|
||||
.p-dropdown {
|
||||
height: 30px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,307 +1,307 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Terminals, Areas, Divisions, TerminalDetails } from "src/app/interface/data";
|
||||
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
||||
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
||||
import { StringMapWithRename } from "@angular/compiler/src/compiler_facade_interface";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-terminals',
|
||||
templateUrl: './terminals.component.html',
|
||||
styleUrls: ['./terminals.component.scss']
|
||||
})
|
||||
export class TerminalsComponent implements OnInit {
|
||||
public terminals: Terminals[] = [];
|
||||
public terminal?: TerminalDetails;
|
||||
public new_ter = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
public areas: Areas[] = [];
|
||||
public divisions: Divisions[] = [];
|
||||
public selectedAreas: Areas[] = [];
|
||||
public selectedDivision?: Divisions;
|
||||
public matchModeOptions!: SelectItem[];
|
||||
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private filterService: FilterService
|
||||
|
||||
//readonly swPush: SwPush,
|
||||
//private newsletterService: NewsletterService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.choose) { this.getTerminals() };
|
||||
this.getAreas();
|
||||
this.getDivisions();
|
||||
|
||||
const customFilterName = "custom-contains";
|
||||
this.filterService.register(customFilterName, (value: any, filter: any): boolean => {
|
||||
if (filter === undefined || filter === null || filter.trim() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value === undefined || value === null) {
|
||||
return false;
|
||||
}
|
||||
let det = value.toString()
|
||||
let det2 = det.toLowerCase()
|
||||
return det2.includes(filter.toString()) || det.includes(filter.toString());
|
||||
|
||||
});
|
||||
|
||||
this.matchModeOptions = [
|
||||
{ label: 'Содержит', value: customFilterName },
|
||||
{ label: 'Равно', value: FilterMatchMode.EQUALS },
|
||||
{ label: 'Начинается с', value: FilterMatchMode.STARTS_WITH },
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
async getTerminals() {
|
||||
this.create = false;
|
||||
this.new_ter = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getTerminals',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.terminals = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 341px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
|
||||
}
|
||||
|
||||
async getTerminal(id: string) {
|
||||
await this.jsonRpcService.rpc({
|
||||
method: 'getTerminal',
|
||||
params: [this.choose, id]
|
||||
}, RpcService.authService, true)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.terminal = data;
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getAreas() {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'getAreas',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.areas = data;
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDivisions() {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'getDivisions',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.divisions = data;
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async updateTerminal1(id: any, public_id: any, division_id: any, area_types: any[]) {
|
||||
this.reset();
|
||||
this.new_ter = false;
|
||||
this.getTerminal(id);
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = public_id, 100);
|
||||
setTimeout(() => document.getElementsByTagName("input")[1].value = division_id, 100);
|
||||
this.jsonRpcService.changeId = id;
|
||||
|
||||
area_types.forEach(area_type => {
|
||||
const area = this.areas.find(area => area.id == area_type);
|
||||
if (area) {
|
||||
this.selectedAreas.push(area);
|
||||
}
|
||||
});
|
||||
|
||||
this.selectedDivision = this.divisions.find(divivsion => divivsion.id == division_id);
|
||||
}
|
||||
|
||||
addAreaToSelected(event: any) {
|
||||
const index = this.selectedAreas.findIndex(area => area.id == event.value.id);
|
||||
if (index == -1) {
|
||||
this.selectedAreas.push(event.value);
|
||||
}
|
||||
}
|
||||
|
||||
removeAreaFromSelected(areaId: string) {
|
||||
const index = this.selectedAreas.findIndex(area => area.id == areaId);
|
||||
if (index > -1) {
|
||||
this.selectedAreas.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.selectedAreas = [];
|
||||
this.selectedDivision = undefined;
|
||||
}
|
||||
|
||||
updateTerminal() {
|
||||
// this.chooseArea = [];
|
||||
let address = document.getElementsByTagName("input")[1].value
|
||||
// let areas = document.getElementsByTagName("input")[1].value
|
||||
let public_id = document.getElementsByTagName("input")[0].value
|
||||
for (let i = 0; i < this.areas.length; i++) {
|
||||
|
||||
if (this.areas[i].selected == true) {
|
||||
// this.chooseArea.push(this.areas[i].name)
|
||||
}
|
||||
}
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateTerminal',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"terminal_id": this.jsonRpcService.changeId,
|
||||
"address": this.selectedDivision?.id,
|
||||
"areas": this.selectedAreas.map(area => area.id),
|
||||
"public_id": public_id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_ter = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
setTimeout(() => this.getTerminals(), 100);
|
||||
}
|
||||
|
||||
deleteTerminal(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteTerminal',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"terminal_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getTerminals(), 100);
|
||||
}
|
||||
|
||||
|
||||
registerTerminal() {
|
||||
this.reset();
|
||||
this.new_ter = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
registerTerminal2() {
|
||||
let public_id = document.getElementsByTagName("input")[0].value;
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createTerminal',
|
||||
params: {
|
||||
"client_id": this.jsonRpcService.ClientChoose,
|
||||
"public_id": public_id,
|
||||
"address": this.selectedDivision?.id,
|
||||
"areas": this.selectedAreas.map(area => area.id),
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getTerminals(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteTerminal(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||
import { MessageService } from "primeng/api";
|
||||
import { Terminals, Areas, Divisions, TerminalDetails } from "src/app/interface/data";
|
||||
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
||||
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
||||
import { StringMapWithRename } from "@angular/compiler/src/compiler_facade_interface";
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-terminals',
|
||||
templateUrl: './terminals.component.html',
|
||||
styleUrls: ['./terminals.component.scss']
|
||||
})
|
||||
export class TerminalsComponent implements OnInit {
|
||||
public terminals: Terminals[] = [];
|
||||
public terminal?: TerminalDetails;
|
||||
public new_ter = true;
|
||||
public choose = this.jsonRpcService.ClientChoose;
|
||||
public create = false;
|
||||
public chooseName!: string;
|
||||
public areas: Areas[] = [];
|
||||
public divisions: Divisions[] = [];
|
||||
public selectedAreas: Areas[] = [];
|
||||
public selectedDivision?: Divisions;
|
||||
public matchModeOptions!: SelectItem[];
|
||||
|
||||
|
||||
constructor(
|
||||
private jsonRpcService: JsonrpcService,
|
||||
private messageService: MessageService,
|
||||
private confirmationService: ConfirmationService,
|
||||
private filterService: FilterService
|
||||
|
||||
//readonly swPush: SwPush,
|
||||
//private newsletterService: NewsletterService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.choose) { this.getTerminals() };
|
||||
this.getAreas();
|
||||
this.getDivisions();
|
||||
|
||||
const customFilterName = "custom-contains";
|
||||
this.filterService.register(customFilterName, (value: any, filter: any): boolean => {
|
||||
if (filter === undefined || filter === null || filter.trim() === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value === undefined || value === null) {
|
||||
return false;
|
||||
}
|
||||
let det = value.toString()
|
||||
let det2 = det.toLowerCase()
|
||||
return det2.includes(filter.toString()) || det.includes(filter.toString());
|
||||
|
||||
});
|
||||
|
||||
this.matchModeOptions = [
|
||||
{ label: 'Содержит', value: customFilterName },
|
||||
{ label: 'Равно', value: FilterMatchMode.EQUALS },
|
||||
{ label: 'Начинается с', value: FilterMatchMode.STARTS_WITH },
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
async getTerminals() {
|
||||
this.create = false;
|
||||
this.new_ter = true;
|
||||
await this.jsonRpcService.rpc2({
|
||||
method: 'getTerminals',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.terminals = data;
|
||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 341px)';
|
||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||
|
||||
}
|
||||
|
||||
async getTerminal(id: string) {
|
||||
await this.jsonRpcService.rpc({
|
||||
method: 'getTerminal',
|
||||
params: [this.choose, id]
|
||||
}, RpcService.authService, true)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.terminal = data;
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getAreas() {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'getAreas',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.areas = data;
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDivisions() {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'getDivisions',
|
||||
params: {
|
||||
"client_id": this.choose
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
this.divisions = data;
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async updateTerminal1(id: any, public_id: any, division_id: any, area_types: any[]) {
|
||||
this.reset();
|
||||
this.new_ter = false;
|
||||
this.getTerminal(id);
|
||||
setTimeout(() => document.getElementsByTagName("input")[0].value = public_id, 100);
|
||||
setTimeout(() => document.getElementsByTagName("input")[1].value = division_id, 100);
|
||||
this.jsonRpcService.changeId = id;
|
||||
|
||||
area_types.forEach(area_type => {
|
||||
const area = this.areas.find(area => area.id == area_type);
|
||||
if (area) {
|
||||
this.selectedAreas.push(area);
|
||||
}
|
||||
});
|
||||
|
||||
this.selectedDivision = this.divisions.find(divivsion => divivsion.id == division_id);
|
||||
}
|
||||
|
||||
addAreaToSelected(event: any) {
|
||||
const index = this.selectedAreas.findIndex(area => area.id == event.value.id);
|
||||
if (index == -1) {
|
||||
this.selectedAreas.push(event.value);
|
||||
}
|
||||
}
|
||||
|
||||
removeAreaFromSelected(areaId: string) {
|
||||
const index = this.selectedAreas.findIndex(area => area.id == areaId);
|
||||
if (index > -1) {
|
||||
this.selectedAreas.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.selectedAreas = [];
|
||||
this.selectedDivision = undefined;
|
||||
}
|
||||
|
||||
updateTerminal() {
|
||||
// this.chooseArea = [];
|
||||
let address = document.getElementsByTagName("input")[1].value
|
||||
// let areas = document.getElementsByTagName("input")[1].value
|
||||
let public_id = document.getElementsByTagName("input")[0].value
|
||||
for (let i = 0; i < this.areas.length; i++) {
|
||||
|
||||
if (this.areas[i].selected == true) {
|
||||
// this.chooseArea.push(this.areas[i].name)
|
||||
}
|
||||
}
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'updateTerminal',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"terminal_id": this.jsonRpcService.changeId,
|
||||
"address": this.selectedDivision?.id,
|
||||
"areas": this.selectedAreas.map(area => area.id),
|
||||
"public_id": public_id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
this.new_ter = true;
|
||||
this.jsonRpcService.changeId = "";
|
||||
setTimeout(() => this.getTerminals(), 100);
|
||||
}
|
||||
|
||||
deleteTerminal(id: any) {
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'deleteTerminal',
|
||||
params: {
|
||||
"client_id": this.choose,
|
||||
"terminal_id": id
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getTerminals(), 100);
|
||||
}
|
||||
|
||||
|
||||
registerTerminal() {
|
||||
this.reset();
|
||||
this.new_ter = false;
|
||||
this.create = true;
|
||||
}
|
||||
|
||||
registerTerminal2() {
|
||||
let public_id = document.getElementsByTagName("input")[0].value;
|
||||
this.jsonRpcService.rpc2({
|
||||
method: 'createTerminal',
|
||||
params: {
|
||||
"client_id": this.jsonRpcService.ClientChoose,
|
||||
"public_id": public_id,
|
||||
"address": this.selectedDivision?.id,
|
||||
"areas": this.selectedAreas.map(area => area.id),
|
||||
}
|
||||
}, RpcService.authService, false)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
let data = result.result;
|
||||
/*this.clients = data;*/
|
||||
},
|
||||
error: (err) => {
|
||||
console.log('ERROR: ', err)
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Произошла ошибка!',
|
||||
})
|
||||
}
|
||||
});
|
||||
setTimeout(() => this.getTerminals(), 100);
|
||||
|
||||
}
|
||||
|
||||
confirm(id: any) {
|
||||
this.confirmationService.confirm({
|
||||
message: 'Вы действительно хотите удалить элемент?',
|
||||
accept: () => {
|
||||
this.deleteTerminal(id)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,40 +1,40 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CookiesService {
|
||||
|
||||
constructor() {}
|
||||
|
||||
getItem(key: string): string|undefined {
|
||||
const matches = document.cookie.match(new RegExp(
|
||||
'(?:^|; )' + key.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)'
|
||||
));
|
||||
return matches ? decodeURIComponent(matches[1]) : undefined;
|
||||
}
|
||||
|
||||
setCookie(key: string, value: string, options: any = {}): void {
|
||||
options = { path: '/', ...options };
|
||||
|
||||
if (options.expires instanceof Date) {
|
||||
options.expires = options.expires.toUTCString();
|
||||
}
|
||||
|
||||
let updatedCookie = encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
|
||||
for (const optionKey of Object.keys(options)) {
|
||||
updatedCookie += '; ' + optionKey;
|
||||
const optionValue = options[optionKey];
|
||||
if (optionValue !== true) {
|
||||
updatedCookie += '=' + optionValue;
|
||||
}
|
||||
}
|
||||
|
||||
document.cookie = updatedCookie;
|
||||
}
|
||||
|
||||
deleteCookie(key: string): void {
|
||||
this.setCookie(key, '', { 'max-age': -1 });
|
||||
}
|
||||
}
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CookiesService {
|
||||
|
||||
constructor() {}
|
||||
|
||||
getItem(key: string): string|undefined {
|
||||
const matches = document.cookie.match(new RegExp(
|
||||
'(?:^|; )' + key.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + '=([^;]*)'
|
||||
));
|
||||
return matches ? decodeURIComponent(matches[1]) : undefined;
|
||||
}
|
||||
|
||||
setCookie(key: string, value: string, options: any = {}): void {
|
||||
options = { path: '/', ...options };
|
||||
|
||||
if (options.expires instanceof Date) {
|
||||
options.expires = options.expires.toUTCString();
|
||||
}
|
||||
|
||||
let updatedCookie = encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
|
||||
for (const optionKey of Object.keys(options)) {
|
||||
updatedCookie += '; ' + optionKey;
|
||||
const optionValue = options[optionKey];
|
||||
if (optionValue !== true) {
|
||||
updatedCookie += '=' + optionValue;
|
||||
}
|
||||
}
|
||||
|
||||
document.cookie = updatedCookie;
|
||||
}
|
||||
|
||||
deleteCookie(key: string): void {
|
||||
this.setCookie(key, '', { 'max-age': -1 });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,96 +1,96 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import {HttpClient, HttpErrorResponse, HttpHeaders} from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { CookiesService } from './cookies.service';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { Areas } from "src/app/interface/data";
|
||||
|
||||
|
||||
|
||||
export enum RpcService{
|
||||
authService,
|
||||
bonusService
|
||||
}
|
||||
|
||||
export interface JsonRpcBody {
|
||||
id: string;
|
||||
jsonrpc: string;
|
||||
method: string;
|
||||
params: any;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class JsonrpcService {
|
||||
|
||||
protected readonly api = environment.appSelfDeliveryEndPoint;
|
||||
private jsonrpc = '2.0';
|
||||
private body!: JsonRpcBody;
|
||||
public ClientChoose = "";
|
||||
public ClientChooseName = "";
|
||||
public changeId = "";
|
||||
public areas: Areas[] = [];
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private cookiesService: CookiesService
|
||||
) { }
|
||||
|
||||
rpc(data: {method: string, params: any}, service: RpcService, auth?: boolean): Observable<any> {
|
||||
let headers = new HttpHeaders();
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
|
||||
console.log(token);
|
||||
headers = headers.set('Content-Type', 'application/json');
|
||||
auth ? headers = headers.append('Authorization', token) : null;
|
||||
const options = {
|
||||
headers: headers,
|
||||
};
|
||||
this.body = {
|
||||
id: uuidv4(),
|
||||
jsonrpc: this.jsonrpc,
|
||||
method: data.method,
|
||||
params: [...data.params],
|
||||
};
|
||||
try {
|
||||
return this.http
|
||||
.post(environment.appSelfDeliveryEndPoint, this.body, options)
|
||||
.pipe(map((res: any) => res));
|
||||
} catch (error) {
|
||||
return new Observable()
|
||||
}
|
||||
}
|
||||
|
||||
rpc2(data: { method: string, params: any }, service: RpcService, auth = false, url: string = ''): Observable<any> {
|
||||
let headers = new HttpHeaders();
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': token
|
||||
},
|
||||
};
|
||||
this.body = {
|
||||
id: uuidv4(),
|
||||
jsonrpc: this.jsonrpc,
|
||||
method: data.method,
|
||||
params: data.params,
|
||||
};
|
||||
try {
|
||||
return this.http
|
||||
.post(url.length ? (url + "/api/payment") : (location.origin + "/api"), this.body, options)
|
||||
.pipe(map((res: any) => res));
|
||||
} catch (error) {
|
||||
return new Observable()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handleHttpError(error: HttpErrorResponse): void {
|
||||
console.log(error.message);
|
||||
}
|
||||
}
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import {HttpClient, HttpErrorResponse, HttpHeaders} from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { CookiesService } from './cookies.service';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { Areas } from "src/app/interface/data";
|
||||
|
||||
|
||||
|
||||
export enum RpcService{
|
||||
authService,
|
||||
bonusService
|
||||
}
|
||||
|
||||
export interface JsonRpcBody {
|
||||
id: string;
|
||||
jsonrpc: string;
|
||||
method: string;
|
||||
params: any;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class JsonrpcService {
|
||||
|
||||
protected readonly api = environment.appSelfDeliveryEndPoint;
|
||||
private jsonrpc = '2.0';
|
||||
private body!: JsonRpcBody;
|
||||
public ClientChoose = "";
|
||||
public ClientChooseName = "";
|
||||
public changeId = "";
|
||||
public areas: Areas[] = [];
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private cookiesService: CookiesService
|
||||
) { }
|
||||
|
||||
rpc(data: {method: string, params: any}, service: RpcService, auth?: boolean): Observable<any> {
|
||||
let headers = new HttpHeaders();
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
|
||||
console.log(token);
|
||||
headers = headers.set('Content-Type', 'application/json');
|
||||
auth ? headers = headers.append('Authorization', token) : null;
|
||||
const options = {
|
||||
headers: headers,
|
||||
};
|
||||
this.body = {
|
||||
id: uuidv4(),
|
||||
jsonrpc: this.jsonrpc,
|
||||
method: data.method,
|
||||
params: [...data.params],
|
||||
};
|
||||
try {
|
||||
return this.http
|
||||
.post(environment.appSelfDeliveryEndPoint, this.body, options)
|
||||
.pipe(map((res: any) => res));
|
||||
} catch (error) {
|
||||
return new Observable()
|
||||
}
|
||||
}
|
||||
|
||||
rpc2(data: { method: string, params: any }, service: RpcService, auth = false, url: string = ''): Observable<any> {
|
||||
let headers = new HttpHeaders();
|
||||
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': token
|
||||
},
|
||||
};
|
||||
this.body = {
|
||||
id: uuidv4(),
|
||||
jsonrpc: this.jsonrpc,
|
||||
method: data.method,
|
||||
params: data.params,
|
||||
};
|
||||
try {
|
||||
return this.http
|
||||
.post(url.length ? (url + "/api/payment") : (location.origin + "/api"), this.body, options)
|
||||
.pipe(map((res: any) => res));
|
||||
} catch (error) {
|
||||
return new Observable()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handleHttpError(error: HttpErrorResponse): void {
|
||||
console.log(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
appSelfDeliveryEndPoint: 'http://selfdelivery-pitsburg.mydatahosting.ru/admin_api',
|
||||
systemId: 'd0b89b219e1feb3d7',
|
||||
selfServiceSystemId: 'pFBpATH59mFJZbuuHw',
|
||||
};
|
||||
export const environment = {
|
||||
production: true,
|
||||
appSelfDeliveryEndPoint: 'http://selfdelivery-pitsburg.mydatahosting.ru/admin_api',
|
||||
systemId: 'd0b89b219e1feb3d7',
|
||||
selfServiceSystemId: 'pFBpATH59mFJZbuuHw',
|
||||
};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
appSelfDeliveryEndPoint: 'http://selfdelivery-pitsburg-test.mydatahosting.ru/api',
|
||||
systemId: 'dfe16ca16a3598b812',
|
||||
selfServiceSystemId: 'pFBpATH59mFJZbuuHw',
|
||||
};
|
||||
export const environment = {
|
||||
production: true,
|
||||
appSelfDeliveryEndPoint: 'http://selfdelivery-pitsburg-test.mydatahosting.ru/api',
|
||||
systemId: 'dfe16ca16a3598b812',
|
||||
selfServiceSystemId: 'pFBpATH59mFJZbuuHw',
|
||||
};
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
appSelfDeliveryEndPoint: 'http://localhost:4200/api',
|
||||
systemId: 'd0b89b219e1feb3d7',
|
||||
selfServiceSystemId: 'pFBpATH59mFJZbuuHw',
|
||||
};
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||
*
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
appSelfDeliveryEndPoint: 'http://localhost:4200/api',
|
||||
systemId: 'd0b89b219e1feb3d7',
|
||||
selfServiceSystemId: 'pFBpATH59mFJZbuuHw',
|
||||
};
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||
*
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>SelfdeliveryAdminPanel</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
</head>
|
||||
<body class="mat-typography">
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>SelfdeliveryAdminPanel</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
</head>
|
||||
<body class="mat-typography">
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
24
src/main.ts
24
src/main.ts
@ -1,12 +1,12 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
|
||||
106
src/polyfills.ts
106
src/polyfills.ts
@ -1,53 +1,53 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
||||
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||
* will put import in the top of bundle, so user need to create a separate file
|
||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||
* into that file, and then add the following code before importing zone.js.
|
||||
* import './zone-flags';
|
||||
*
|
||||
* The flags allowed in zone-flags.ts are listed here.
|
||||
*
|
||||
* The following flags will work for all browsers.
|
||||
*
|
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*
|
||||
* (window as any).__Zone_enable_cross_context_check = true;
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
||||
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||
* will put import in the top of bundle, so user need to create a separate file
|
||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||
* into that file, and then add the following code before importing zone.js.
|
||||
* import './zone-flags';
|
||||
*
|
||||
* The flags allowed in zone-flags.ts are listed here.
|
||||
*
|
||||
* The following flags will work for all browsers.
|
||||
*
|
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*
|
||||
* (window as any).__Zone_enable_cross_context_check = true;
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
|
||||
118
src/styles.scss
118
src/styles.scss
@ -1,59 +1,59 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
html, body {
|
||||
height: 98%;
|
||||
}
|
||||
body {
|
||||
margin: 15px 15px 15px 15px;
|
||||
font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||
}
|
||||
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
margin: 2px 2px 2px 2px;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
background-color: gray;
|
||||
/* box-shadow: 0 2px black;*/
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
appearance: none;
|
||||
touch-action: manipulation;
|
||||
vertical-align: top;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
background-color: forestgreen;
|
||||
opacity: 50%;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 15px 0px 15px 0px !important;
|
||||
}
|
||||
|
||||
#menu:hover {
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mat-sidenav {
|
||||
z-index: auto !important;
|
||||
}
|
||||
|
||||
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
html, body {
|
||||
height: 98%;
|
||||
}
|
||||
body {
|
||||
margin: 15px 15px 15px 15px;
|
||||
font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||
}
|
||||
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
margin: 2px 2px 2px 2px;
|
||||
outline: none;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
background-color: gray;
|
||||
/* box-shadow: 0 2px black;*/
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
appearance: none;
|
||||
touch-action: manipulation;
|
||||
vertical-align: top;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
background-color: forestgreen;
|
||||
opacity: 50%;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 15px 0px 15px 0px !important;
|
||||
}
|
||||
|
||||
#menu:hover {
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mat-sidenav {
|
||||
z-index: auto !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
52
src/test.ts
52
src/test.ts
@ -1,26 +1,26 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
<T>(id: string): T;
|
||||
keys(): string[];
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting(),
|
||||
);
|
||||
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
<T>(id: string): T;
|
||||
keys(): string[];
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting(),
|
||||
);
|
||||
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2017",
|
||||
"module": "es2020",
|
||||
"lib": [
|
||||
"es2020",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2017",
|
||||
"module": "es2020",
|
||||
"lib": [
|
||||
"es2020",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user