From 91bae5fd6d22c04cbb74f981f0dada36e5a9ca49 Mon Sep 17 00:00:00 2001 From: Aruzhan Kordasheva <70699245+Aruq@users.noreply.github.com> Date: Tue, 15 Nov 2022 09:56:43 +0600 Subject: [PATCH 1/3] s --- angular.json | 1 + package.json | 2 +- src/app/app-routing.module.ts | 5 + src/app/app.module.ts | 3 + src/app/core/http/http.service.spec.ts | 0 src/app/core/http/http.service.ts | 17 +++ src/app/core/services/auth.service.ts | 12 +- .../features/auth/login/login.component.html | 2 +- .../broker-list/broker-list.component.css | 0 .../broker-list/broker-list.component.html | 51 +++++++ .../broker-list/broker-list.component.ts | 143 ++++++++++++++++++ .../features/brokers/broker-routing.module.ts | 21 +++ src/app/features/brokers/broker.module.ts | 17 +++ .../customer-list.component.html | 36 ++--- .../customer-list/customer-list.component.ts | 95 +++++++----- .../users/user-list/user-list.component.html | 41 ++++- .../users/user-list/user-list.component.ts | 77 ++++++++-- .../shared/layout/assets/images/kase-logo.svg | 8 + src/app/shared/layout/layout.component.css | 29 +++- src/app/shared/layout/layout.component.html | 29 ++-- src/app/shared/layout/layout.component.ts | 13 +- src/app/shared/shared.module.ts | 1 + src/assets/images/kase-logo.svg | 8 + src/proxy.conf.json | 8 + 24 files changed, 526 insertions(+), 93 deletions(-) create mode 100644 src/app/core/http/http.service.spec.ts create mode 100644 src/app/core/http/http.service.ts create mode 100644 src/app/features/brokers/broker-list/broker-list.component.css create mode 100644 src/app/features/brokers/broker-list/broker-list.component.html create mode 100644 src/app/features/brokers/broker-list/broker-list.component.ts create mode 100644 src/app/features/brokers/broker-routing.module.ts create mode 100644 src/app/features/brokers/broker.module.ts create mode 100644 src/app/shared/layout/assets/images/kase-logo.svg create mode 100644 src/assets/images/kase-logo.svg create mode 100644 src/proxy.conf.json diff --git a/angular.json b/angular.json index eedcb61..30d7834 100644 --- a/angular.json +++ b/angular.json @@ -112,6 +112,7 @@ } }, "cli": { + "analytics": "173eaed1-7bb5-40f9-98fd-6a7163045565", "schematicCollections": [ "@angular-eslint/schematics" ] diff --git a/package.json b/package.json index e290ca7..bc63ae1 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,10 @@ "private": true, "dependencies": { "@angular/animations": "^14.2.1", + "@angular/cdk": "^14.2.1", "@angular/common": "^14.2.1", "@angular/compiler": "^14.2.1", "@angular/core": "^14.2.1", - "@angular/cdk": "^14.2.1", "@angular/flex-layout": "^14.0.0-beta.40", "@angular/forms": "^14.2.1", "@angular/material": "^14.2.1", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index ef223db..4811aa3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -23,6 +23,11 @@ const appRoutes: Routes = [ loadChildren: () => import('./features/users/users.module').then(m => m.UsersModule), canActivate: [AuthGuard] }, + { + path: 'brokers', + loadChildren: () => import('./features/brokers/broker.module').then(m => m.BrokersModule), + canActivate: [AuthGuard] + }, { path: 'account', loadChildren: () => import('./features/account/account.module').then(m => m.AccountModule), diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 027530c..9c2f3aa 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -9,6 +9,7 @@ import { CustomMaterialModule } from './custom-material/custom-material.module'; import { AppRoutingModule } from './app-routing.module'; import { LoggerModule } from 'ngx-logger'; import { environment } from '../environments/environment'; +import { HttpClientModule } from '@angular/common/http'; @NgModule({ declarations: [ @@ -20,7 +21,9 @@ import { environment } from '../environments/environment'; CoreModule, SharedModule, CustomMaterialModule.forRoot(), + AppRoutingModule, + HttpClientModule, LoggerModule.forRoot({ serverLoggingUrl: `http://my-api/logs`, level: environment.logLevel, diff --git a/src/app/core/http/http.service.spec.ts b/src/app/core/http/http.service.spec.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/app/core/http/http.service.ts b/src/app/core/http/http.service.ts new file mode 100644 index 0000000..b0f2fde --- /dev/null +++ b/src/app/core/http/http.service.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from "@angular/common/http"; +import {catchError, map, Observable} from "rxjs"; +import {environment} from "../../../environments/environment"; + +@Injectable({ + providedIn: 'root' +}) +export class HttpService { + + constructor(private http: HttpClient) { } + + getData(user: string){ + return this.http.get('http://192.168.4.18:8086/kase.kz/role?role=' + user) + } + +} diff --git a/src/app/core/services/auth.service.ts b/src/app/core/services/auth.service.ts index a26e264..0fb8416 100644 --- a/src/app/core/services/auth.service.ts +++ b/src/app/core/services/auth.service.ts @@ -27,11 +27,11 @@ export class AuthenticationService { this.localStorage.setItem('currentUser', JSON.stringify({ token: 'aisdnaksjdn,axmnczm', isAdmin: true, - email: 'john.doe@gmail.com', + email: 'roman@mail.ru', id: '12312323232', - alias: 'john.doe@gmail.com'.split('@')[0], + alias: 'roman@mail.ru'.split('@')[0], expiration: moment().add(1, 'days').toDate(), - fullName: 'John Doe' + fullName: 'Roman Dubrovskiy' })); return true; @@ -49,11 +49,11 @@ export class AuthenticationService { return { token: 'aisdnaksjdn,axmnczm', isAdmin: true, - email: 'john.doe@gmail.com', + email: 'roman@mail.ru', id: '12312323232', - alias: 'john.doe@gmail.com'.split('@')[0], + alias: 'roman@mail.ru'.split('@')[0], expiration: moment().add(1, 'days').toDate(), - fullName: 'John Doe' + fullName: 'Roman Dubrovskiy' }; } diff --git a/src/app/features/auth/login/login.component.html b/src/app/features/auth/login/login.component.html index 29058af..9b67329 100644 --- a/src/app/features/auth/login/login.component.html +++ b/src/app/features/auth/login/login.component.html @@ -1,7 +1,7 @@
- angular-material-template + Services Log in to your account diff --git a/src/app/features/brokers/broker-list/broker-list.component.css b/src/app/features/brokers/broker-list/broker-list.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/features/brokers/broker-list/broker-list.component.html b/src/app/features/brokers/broker-list/broker-list.component.html new file mode 100644 index 0000000..bc35c76 --- /dev/null +++ b/src/app/features/brokers/broker-list/broker-list.component.html @@ -0,0 +1,51 @@ +
+
+ + + +

Брокеры +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
No. {{i+1}} Брокеры {{myData$.role}} Услуга + +
+
+ {{r}} +
+ + +
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/app/features/brokers/broker-list/broker-list.component.ts b/src/app/features/brokers/broker-list/broker-list.component.ts new file mode 100644 index 0000000..b295456 --- /dev/null +++ b/src/app/features/brokers/broker-list/broker-list.component.ts @@ -0,0 +1,143 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; +import { NGXLogger } from 'ngx-logger'; +import { Title } from '@angular/platform-browser'; +import { NotificationService } from 'src/app/core/services/notification.service'; +import { HttpService } from 'src/app/core/http/http.service'; + + + + +export interface PeriodicElement { + name: string; + position: number; + weight: number; + + } + + const ELEMENT_DATA: PeriodicElement[] = [ + + + ]; +export interface roles{ +roles:any +} +export interface test{ + id: number; + role: any; + service: any; + + +} +let i:number + +@Component({ + selector: 'app-broker-list', + templateUrl: './broker-list.component.html', + styleUrls: ['./broker-list.component.css'] +}) +export class BrokerListComponent implements OnInit { + displayedColumns: string[] = ['position', 'name', 'weight']; + dataSource: any; + + +myData:any +myData$:any[] = []; + constructor( + private logger: NGXLogger, + private notificationService: NotificationService, + private titleService: Title, + private myDataService:HttpService + ) { } + + ngOnInit() { + this.titleService.setTitle('angular-material-template - Customers'); + this.logger.log('Customers loaded'); + this.notificationService.openSnackBar('Customers loaded'); + + this.myDataService.getData('BROKER').subscribe((next: any) =>{ + //@ts-ignore + + const ob: roles = { + roles: undefined + }; + // for(let i=0; i<5;i++){ + // next.forEach((element: any)=> { + // console.log(element) + // // obj.role = next.roles[0] + + // obj.role = element.services[i].company; + + + + // const c: any[]=[] + // element.services[0].services.forEach((element2: any) =>{ + // console.log('---') + // console.log(element2.service_name ) + // b.push(element2.service_name); + // }) + + // obj.service = b + + + + // }); + + + + + + + // const a= this.myData$.push(obj) + // console.log(obj)} + + + + + + next.forEach((element:any) =>{ + //console.log(element) + element.services.forEach((el:any)=>{ + + //@ts-ignore + let obj: test = {} + let b: any[] = []; + obj.role = el.company + obj.id = el.id; + console.log(el.id) + //@ts-ignore + //b = []; + el.services.forEach((element2: any) =>{ + + // console.log(element2.service_name) + b.push(element2.service_name); + obj.service = []; + obj.service = b; + }) + + + + // console.log(obj) + this.myData$.push(obj) + }) + + + + }) + + + + console.log(this.myData$) + this.dataSource = new MatTableDataSource(this.myData$) + } + + + ); + + + + + } +} +; \ No newline at end of file diff --git a/src/app/features/brokers/broker-routing.module.ts b/src/app/features/brokers/broker-routing.module.ts new file mode 100644 index 0000000..18e9560 --- /dev/null +++ b/src/app/features/brokers/broker-routing.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { LayoutComponent } from 'src/app/shared/layout/layout.component'; + +import {BrokerListComponent } from './broker-list/broker-list.component'; + +const routes: Routes = [ + { + path: '', + component: LayoutComponent, + children: [ + { path: '', component: BrokerListComponent }, + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class BrokerRoutingModule { } diff --git a/src/app/features/brokers/broker.module.ts b/src/app/features/brokers/broker.module.ts new file mode 100644 index 0000000..f47fd1e --- /dev/null +++ b/src/app/features/brokers/broker.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { BrokerRoutingModule } from './broker-routing.module'; +import { SharedModule } from 'src/app/shared/shared.module'; +import { BrokerListComponent } from './broker-list/broker-list.component'; + +@NgModule({ + imports: [ + CommonModule, + BrokerRoutingModule, + SharedModule + ], + declarations: [ + BrokerListComponent + ] +}) +export class BrokersModule { } diff --git a/src/app/features/customers/customer-list/customer-list.component.html b/src/app/features/customers/customer-list/customer-list.component.html index b6039cf..6df46bb 100644 --- a/src/app/features/customers/customer-list/customer-list.component.html +++ b/src/app/features/customers/customer-list/customer-list.component.html @@ -3,38 +3,40 @@ -

Customers

- - - +

Эмитенты +

+
+ - + - - - + + + - - - - - - - - + + +
No. {{element.position}} {{i+1}} Name {{element.name}} Эмитенты {{myData$.role}} Weight {{element.weight}} Symbol {{element.symbol}} Услуга + +
+
+ {{r}} +
+ + +
-
diff --git a/src/app/features/customers/customer-list/customer-list.component.ts b/src/app/features/customers/customer-list/customer-list.component.ts index 80a00f9..11b2196 100644 --- a/src/app/features/customers/customer-list/customer-list.component.ts +++ b/src/app/features/customers/customer-list/customer-list.component.ts @@ -1,53 +1,78 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { MatSort } from '@angular/material/sort'; -import { MatTableDataSource } from '@angular/material/table'; import { NGXLogger } from 'ngx-logger'; import { Title } from '@angular/platform-browser'; import { NotificationService } from 'src/app/core/services/notification.service'; - -export interface PeriodicElement { - name: string; - position: number; - weight: number; - symbol: string; -} - -const ELEMENT_DATA: PeriodicElement[] = [ - { position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H' }, - { position: 2, name: 'Helium', weight: 4.0026, symbol: 'He' }, - { position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li' }, - { position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be' }, - { position: 5, name: 'Boron', weight: 10.811, symbol: 'B' }, - { position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C' }, - { position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N' }, - { position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O' }, - { position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F' }, - { position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne' }, -]; - +import { HttpService } from 'src/app/core/http/http.service'; +import { MatTableDataSource } from '@angular/material/table'; @Component({ selector: 'app-customer-list', templateUrl: './customer-list.component.html', styleUrls: ['./customer-list.component.css'] }) export class CustomerListComponent implements OnInit { - displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; - dataSource = new MatTableDataSource(ELEMENT_DATA); - - @ViewChild(MatSort, { static: true }) - sort: MatSort = new MatSort; - + displayedColumns: string[] = ['position', 'name', 'weight']; + dataSource: any; + +myData:any +myData$:any[] = []; constructor( private logger: NGXLogger, private notificationService: NotificationService, - private titleService: Title + private titleService: Title, + private myDataService:HttpService ) { } - ngOnInit() { - this.titleService.setTitle('angular-material-template - Customers'); - this.logger.log('Customers loaded'); - this.notificationService.openSnackBar('Customers loaded'); - this.dataSource.sort = this.sort; + this.titleService.setTitle('draft - Issuers'); + this.logger.log('Issuers loaded'); + this.notificationService.openSnackBar('Issuers loaded'); + this.myDataService.getData('ISSUER').subscribe((next: any) =>{ + //@ts-ignore + + - } + next.forEach((element:any) =>{ + //console.log(element) + element.services.forEach((el:any)=>{ + + //@ts-ignore + let obj: test = {} + let b: any[] = []; + obj.role = el.company + obj.id = el.id; + console.log(el.id) + //@ts-ignore + //b = []; + el.services.forEach((element2: any) =>{ + + // console.log(element2.service_name) + b.push(element2.service_name); + obj.service = []; + obj.service = b; + }) + + + + // console.log(obj) + this.myData$.push(obj) + }) + + + + }) + + + + console.log(this.myData$) + this.dataSource = new MatTableDataSource(this.myData$) + } + + + ); + + + + +} } +; \ No newline at end of file diff --git a/src/app/features/users/user-list/user-list.component.html b/src/app/features/users/user-list/user-list.component.html index 88cb815..0a88771 100644 --- a/src/app/features/users/user-list/user-list.component.html +++ b/src/app/features/users/user-list/user-list.component.html @@ -3,17 +3,42 @@ -

Users

+

Пользователи +

+ + + + + + + + + + + + + + + + + + + + + + + +
No. {{i+1}} Пользователи {{myData$.role}} Услуга + +
+
+ {{r}} +
-
-
- people_outline -

No users exist.

-
- -
+
+
diff --git a/src/app/features/users/user-list/user-list.component.ts b/src/app/features/users/user-list/user-list.component.ts index 3e0b1fb..fae6ccc 100644 --- a/src/app/features/users/user-list/user-list.component.ts +++ b/src/app/features/users/user-list/user-list.component.ts @@ -1,24 +1,83 @@ -import { Component, OnInit } from '@angular/core'; -import { Title } from '@angular/platform-browser'; - +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; import { NGXLogger } from 'ngx-logger'; +import { Title } from '@angular/platform-browser'; import { NotificationService } from 'src/app/core/services/notification.service'; - +import { HttpService } from 'src/app/core/http/http.service'; +import { tap } from 'rxjs'; +export interface test{ + role: string; + service: any; + id:number +} @Component({ selector: 'app-user-list', templateUrl: './user-list.component.html', styleUrls: ['./user-list.component.css'] }) export class UserListComponent implements OnInit { - + displayedColumns: string[] = ['position', 'name', 'weight']; + dataSource:any; +myData:any +myData$:any[] = []; constructor( private logger: NGXLogger, private notificationService: NotificationService, - private titleService: Title + private titleService: Title, + private myDataService:HttpService ) { } - ngOnInit() { - this.titleService.setTitle('angular-material-template - Users'); + this.titleService.setTitle('draft-User'); this.logger.log('Users loaded'); - } + this.notificationService.openSnackBar('Users loaded'); + this.myDataService.getData('KASE').subscribe((next: any) =>{ + //@ts-ignore + + + + next.forEach((element:any) =>{ + //console.log(element) + element.services.forEach((el:any)=>{ + + //@ts-ignore + let obj: test = {} + let b: any[] = []; + obj.role = el.company + obj.id = el.id; + console.log(el.id) + //@ts-ignore + //b = []; + el.services.forEach((element2: any) =>{ + + // console.log(element2.service_name) + b.push(element2.service_name); + obj.service = []; + obj.service = b; + }) + + + + // console.log(obj) + this.myData$.push(obj) + }) + + + + }) + + + + console.log(this.myData$) + this.dataSource = new MatTableDataSource(this.myData$) + } + + + ); + + + + +} } +; \ No newline at end of file diff --git a/src/app/shared/layout/assets/images/kase-logo.svg b/src/app/shared/layout/assets/images/kase-logo.svg new file mode 100644 index 0000000..9426de8 --- /dev/null +++ b/src/app/shared/layout/assets/images/kase-logo.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/app/shared/layout/layout.component.css b/src/app/shared/layout/layout.component.css index 970e18a..c146cf7 100644 --- a/src/app/shared/layout/layout.component.css +++ b/src/app/shared/layout/layout.component.css @@ -4,13 +4,18 @@ .navbar { z-index: 2; -} - + background: rgba(22, 33, 25, 0.37); +gap:12px;} .navbar-brand { text-decoration: none; - color: white; -} + display:flex; + +} +.myImage{ + background-image: url("/assets/images/kase-logo.svg"); + +} .navbar-container { display: flex; flex-direction: column; @@ -61,4 +66,18 @@ a.mat-list-item.active { #push-bottom { position: absolute; bottom: 0; -} \ No newline at end of file +} +.header_inner-left { + display: flex; + gap: 16px; +} +.date{ + display:flex; + flex-direction: column; + font-size:13px +} + + h1{ + padding: 12px 0px 10px 10px + } + diff --git a/src/app/shared/layout/layout.component.html b/src/app/shared/layout/layout.component.html index a5cdab0..24959ab 100644 --- a/src/app/shared/layout/layout.component.html +++ b/src/app/shared/layout/layout.component.html @@ -1,17 +1,22 @@