| @@ -1,35 +1,37 @@ | |||||
| <h2 *ngIf="!product.id">{{'basic.new-product' | translate}}</h2> | |||||
| <h2 *ngIf="product.id">{{'basic.edit-product' | translate}}</h2> | |||||
| <h2 *ngIf="!product.id">{{ 'basic.new-product' | translate }}</h2> | |||||
| <h2 *ngIf="product.id">{{ 'basic.edit-product' | translate }}</h2> | |||||
| <div class="spt-form"> | <div class="spt-form"> | ||||
| <form [formGroup]="productForm" (ngSubmit)="onSubmit()"> | <form [formGroup]="productForm" (ngSubmit)="onSubmit()"> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="name" class="form-label">{{'form.name' | translate}}:</label> | |||||
| <input type="text" class="form-control" id="name" formControlName="name" /> | |||||
| <label for="name" class="form-label">{{ 'form.name' | translate }}:</label> | |||||
| <input type="text" class="form-control" id="name" formControlName="name"/> | |||||
| <div class="form-text" *ngIf="productForm.get('name')?.invalid && productForm.get('name')?.touched"> | <div class="form-text" *ngIf="productForm.get('name')?.invalid && productForm.get('name')?.touched"> | ||||
| {{'form.name' | translate}} {{'form.mandatory' | translate}}. | |||||
| {{ 'form.name' | translate }} {{ 'form.mandatory' | translate }}. | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="description" class="form-label">{{'form.description' | translate}}:</label> | |||||
| <input type="text" class="form-control" id="description" formControlName="description" /> | |||||
| <div class="form-text" *ngIf="productForm.get('description')?.invalid && productForm.get('description')?.touched"> | |||||
| {{'form.description' | translate}} {{'form.mandatory' | translate}}. | |||||
| <label for="description" class="form-label">{{ 'form.description' | translate }}:</label> | |||||
| <input type="text" class="form-control" id="description" formControlName="description"/> | |||||
| <div class="form-text" | |||||
| *ngIf="productForm.get('description')?.invalid && productForm.get('description')?.touched"> | |||||
| {{ 'form.description' | translate }} {{ 'form.mandatory' | translate }}. | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="mb-3" *ngIf="productForm.get('imageUrl')?.value === null"> | <div class="mb-3" *ngIf="productForm.get('imageUrl')?.value === null"> | ||||
| <label for="image" class="form-label">{{'form.upload-image' | translate}}:</label> | |||||
| <input type="file" class="form-control" id="image" (change)="onFileSelected($event)" accept="image/*" /> | |||||
| <label for="image" class="form-label">{{ 'form.upload-image' | translate }}:</label> | |||||
| <input type="file" class="form-control" id="image" (change)="onFileSelected($event)" accept="image/*"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3" *ngIf="productForm.get('imageUrl')?.value !== null"> | <div class="mb-3" *ngIf="productForm.get('imageUrl')?.value !== null"> | ||||
| <div class="delete-image" (click)="onDeleteImage()"> | <div class="delete-image" (click)="onDeleteImage()"> | ||||
| <img src="{{product.imageUrl}}" width="40" height="40" /> | |||||
| <p class="mb-0 ms-3">{{'system.delete-image' | translate}}</p> | |||||
| <img src="{{product.imageUrl}}" width="40" height="40" alt="{{product.name}}" /> | |||||
| <p class="mb-0 ms-3">{{ 'system.delete-image' | translate }}</p> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <button type="submit" class="btn btn-primary" [disabled]="productForm.invalid">{{'form.send' | translate}}</button> | |||||
| <button type="submit" class="btn btn-primary" [disabled]="productForm.invalid">{{ 'form.send' | translate }} | |||||
| </button> | |||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| @@ -2,7 +2,6 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; | |||||
| import {MediaObjectService, ProductJsonld, ProductService} from "@app/core/api/v1"; | import {MediaObjectService, ProductJsonld, ProductService} from "@app/core/api/v1"; | ||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | import {ModalStatus} from "@app/_helpers/modal.states"; | ||||
| import {FormGroup} from "@angular/forms"; | import {FormGroup} from "@angular/forms"; | ||||
| import {Subscription} from "rxjs"; | |||||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | ||||
| import {productForm} from "@app/_forms/apiForms"; | import {productForm} from "@app/_forms/apiForms"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| @@ -18,10 +17,7 @@ export class NewProductComponent implements OnInit { | |||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| protected productForm: FormGroup; | protected productForm: FormGroup; | ||||
| protected productSub: Subscription; | |||||
| protected selectedImage: File | null; | protected selectedImage: File | null; | ||||
| protected mediaSub: Subscription; | |||||
| constructor( | constructor( | ||||
| private productService: ProductService, | private productService: ProductService, | ||||
| @@ -30,10 +26,7 @@ export class NewProductComponent implements OnInit { | |||||
| protected appHelperService: AppHelperService, | protected appHelperService: AppHelperService, | ||||
| ) { | ) { | ||||
| this.productForm = productForm; | this.productForm = productForm; | ||||
| this.productSub = new Subscription(); | |||||
| this.selectedImage = null; | this.selectedImage = null; | ||||
| this.mediaSub = new Subscription(); | |||||
| } | } | ||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| @@ -42,7 +35,7 @@ export class NewProductComponent implements OnInit { | |||||
| onSubmit() { | onSubmit() { | ||||
| if (this.selectedImage !== null) { | if (this.selectedImage !== null) { | ||||
| this.mediaSub = this.mediaObjectService.mediaObjectsPost( | |||||
| this.mediaObjectService.mediaObjectsPost( | |||||
| this.selectedImage | this.selectedImage | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -59,7 +52,7 @@ export class NewProductComponent implements OnInit { | |||||
| if (this.productForm.valid) { | if (this.productForm.valid) { | ||||
| if (this.product.id === null || this.product.id === undefined) { | if (this.product.id === null || this.product.id === undefined) { | ||||
| // Create new product | // Create new product | ||||
| this.productSub = this.productService.productsPost( | |||||
| this.productService.productsPost( | |||||
| this.productForm.value as ProductJsonld | this.productForm.value as ProductJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -69,7 +62,7 @@ export class NewProductComponent implements OnInit { | |||||
| ); | ); | ||||
| } else { | } else { | ||||
| // Edit product | // Edit product | ||||
| this.productSub = this.productService.productsIdPatch( | |||||
| this.productService.productsIdPatch( | |||||
| this.appHelperService.extractId(this.product.id), | this.appHelperService.extractId(this.product.id), | ||||
| this.productForm.value as ProductJsonld | this.productForm.value as ProductJsonld | ||||
| ).subscribe( | ).subscribe( | ||||
| @@ -1,13 +1,17 @@ | |||||
| <div class="spt-container"> | <div class="spt-container"> | ||||
| <div *ngIf="!this.user" class="top-btn"> | <div *ngIf="!this.user" class="top-btn"> | ||||
| <button *ngIf="bShowNewProductButton" class="btn btn-primary" (click)="openModalNewProduct()">+ {{ 'basic.new-product' | translate }}</button> | |||||
| <button *ngIf="!bShowNewProductButton" class="btn btn-primary" (click)="openModalAssignProduct()">+ {{ 'basic.assign-product' | translate }}</button> | |||||
| <button *ngIf="bShowNewProductButton" class="btn btn-primary" (click)="openModalNewProduct()"> | |||||
| + {{ 'basic.new-product' | translate }} | |||||
| </button> | |||||
| <button *ngIf="!bShowNewProductButton" class="btn btn-primary" (click)="openModalAssignProduct()"> | |||||
| + {{ 'basic.assign-product' | translate }} | |||||
| </button> | |||||
| </div> | </div> | ||||
| <app-list #listComponent | <app-list #listComponent | ||||
| [getDataFunction]="getDataFunction" | |||||
| [onNavigateToDetailsFunction]="navigateToProductDetails" | |||||
| [onRemoveItemFunction]="unassignProduct" | |||||
| [onSortFunction]="onSortChange" | |||||
| [listColDefinitions]="listColDefinitions" | |||||
| [getDataFunction]="getDataFunction" | |||||
| [onNavigateToDetailsFunction]="navigateToProductDetails" | |||||
| [onRemoveItemFunction]="unassignProduct" | |||||
| [onSortFunction]="onSortChange" | |||||
| [listColDefinitions]="listColDefinitions" | |||||
| ></app-list> | ></app-list> | ||||
| </div> | |||||
| </div> | |||||
| @@ -21,16 +21,16 @@ import {ListComponent} from "@app/_components/list/list.component"; | |||||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | ||||
| @Component({ | @Component({ | ||||
| selector: 'app-product-list', | |||||
| templateUrl: './product-list.component.html', | |||||
| styleUrl: './product-list.component.scss' | |||||
| selector: 'app-product-list', | |||||
| templateUrl: './product-list.component.html', | |||||
| styleUrl: './product-list.component.scss' | |||||
| }) | }) | ||||
| export class ProductListComponent implements OnInit, AfterViewInit { | export class ProductListComponent implements OnInit, AfterViewInit { | ||||
| @Input() public user!: UserJsonld; | @Input() public user!: UserJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | @Input() public partner!: PartnerJsonld; | ||||
| @Input() public contact!: ContactJsonld; | @Input() public contact!: ContactJsonld; | ||||
| @ViewChild("listComponent", { static: false }) listComponent!: ListComponent; | |||||
| @ViewChild("listComponent", {static: false}) listComponent!: ListComponent; | |||||
| protected bShowNewProductButton: boolean; | protected bShowNewProductButton: boolean; | ||||
| protected nameOrderFilter: OrderFilter; | protected nameOrderFilter: OrderFilter; | ||||
| @@ -50,7 +50,7 @@ export class ProductListComponent implements OnInit, AfterViewInit { | |||||
| this.nameOrderFilter = OrderFilter.Asc; | this.nameOrderFilter = OrderFilter.Asc; | ||||
| } | } | ||||
| ngOnInit(){ | |||||
| ngOnInit() { | |||||
| this.listColDefinitions = []; | this.listColDefinitions = []; | ||||
| let withSubResource: boolean = (this.partner !== undefined || this.contact !== undefined || this.user !== undefined); | let withSubResource: boolean = (this.partner !== undefined || this.contact !== undefined || this.user !== undefined); | ||||
| this.listColDefinitions = [ | this.listColDefinitions = [ | ||||
| @@ -99,7 +99,7 @@ export class ProductListComponent implements OnInit, AfterViewInit { | |||||
| this.listComponent.getData(); | this.listComponent.getData(); | ||||
| } | } | ||||
| getProducts: ListGetDataFunctionType = (index: number, pageSize: number, term?: string): Observable<any> => { | |||||
| getProducts: ListGetDataFunctionType = (index: number, pageSize: number, term?: string): Observable<any> => { | |||||
| return this.productService.productsGetCollection( | return this.productService.productsGetCollection( | ||||
| index, | index, | ||||
| pageSize, | pageSize, | ||||
| @@ -159,7 +159,7 @@ export class ProductListComponent implements OnInit, AfterViewInit { | |||||
| this.listComponent.getData(); | this.listComponent.getData(); | ||||
| } | } | ||||
| navigateToProductDetails = (element: any, column?: any)=> { | |||||
| navigateToProductDetails = (element: any, column?: any) => { | |||||
| let product: ProductJsonld; | let product: ProductJsonld; | ||||
| if (this.user !== undefined || this.partner !== undefined || this.contact !== undefined) { | if (this.user !== undefined || this.partner !== undefined || this.contact !== undefined) { | ||||
| product = element['product']; | product = element['product']; | ||||
| @@ -171,14 +171,14 @@ export class ProductListComponent implements OnInit, AfterViewInit { | |||||
| openModalNewProduct() { | openModalNewProduct() { | ||||
| let product: ProductJsonld = {} as ProductJsonld; | let product: ProductJsonld = {} as ProductJsonld; | ||||
| this.appHelperService.openModal(NewProductComponent, { 'product': product }, this.listComponent.getData); | |||||
| this.appHelperService.openModal(NewProductComponent, {'product': product}, this.listComponent.getData); | |||||
| } | } | ||||
| openModalAssignProduct() { | openModalAssignProduct() { | ||||
| if (this.user !== undefined) { | if (this.user !== undefined) { | ||||
| this.appHelperService.openModal( | this.appHelperService.openModal( | ||||
| AssignProductComponent, | AssignProductComponent, | ||||
| { 'user' : this.user }, | |||||
| {'user': this.user}, | |||||
| this.listComponent.getData | this.listComponent.getData | ||||
| ); | ); | ||||
| } else if (this.partner !== undefined) { | } else if (this.partner !== undefined) { | ||||
| @@ -186,7 +186,7 @@ export class ProductListComponent implements OnInit, AfterViewInit { | |||||
| partnerProduct.partnerIri = this.partner.id!; | partnerProduct.partnerIri = this.partner.id!; | ||||
| this.appHelperService.openModal( | this.appHelperService.openModal( | ||||
| AssignProductComponent, | AssignProductComponent, | ||||
| { 'partnerProduct' : partnerProduct }, | |||||
| {'partnerProduct': partnerProduct}, | |||||
| this.listComponent.getData | this.listComponent.getData | ||||
| ); | ); | ||||
| } else if (this.contact !== undefined) { | } else if (this.contact !== undefined) { | ||||
| @@ -194,7 +194,7 @@ export class ProductListComponent implements OnInit, AfterViewInit { | |||||
| contactPartnerProduct.contactIri = this.contact.id!; | contactPartnerProduct.contactIri = this.contact.id!; | ||||
| this.appHelperService.openModal( | this.appHelperService.openModal( | ||||
| AssignProductComponent, | AssignProductComponent, | ||||
| { 'contactPartnerProduct' : contactPartnerProduct, 'partnerIri' : this.contact.partnerIri }, | |||||
| {'contactPartnerProduct': contactPartnerProduct, 'partnerIri': this.contact.partnerIri}, | |||||
| this.listComponent.getData | this.listComponent.getData | ||||
| ); | ); | ||||
| } else { | } else { | ||||
| @@ -202,7 +202,7 @@ export class ProductListComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| } | } | ||||
| unassignProduct = (element: any)=> { | |||||
| unassignProduct = (element: any) => { | |||||
| let confirmMessage = ""; | let confirmMessage = ""; | ||||
| this.translateService.get('system.confirm-unassign').subscribe((translation: string) => { | this.translateService.get('system.confirm-unassign').subscribe((translation: string) => { | ||||
| confirmMessage = translation; | confirmMessage = translation; | ||||
| @@ -60,13 +60,13 @@ | |||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleSales [headline]="'basic.sales' | translate"> | <app-toggle #toggleSales [headline]="'basic.sales' | translate"> | ||||
| <app-sale-list *ngIf="toggleSales.isOpened" #salesListComponent | <app-sale-list *ngIf="toggleSales.isOpened" #salesListComponent | ||||
| [product]="product" | |||||
| [product]="product" | |||||
| > | > | ||||
| </app-sale-list> | </app-sale-list> | ||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleDocuments [headline]="'basic.documents' | translate"> | <app-toggle #toggleDocuments [headline]="'basic.documents' | translate"> | ||||
| <app-document-list *ngIf="toggleDocuments.isOpened" #documentsListComponent | |||||
| <app-document-list *ngIf="toggleDocuments.isOpened" | |||||
| [product]="product" | [product]="product" | ||||
| > | > | ||||
| </app-document-list> | </app-document-list> | ||||
| </app-toggle> | |||||
| </app-toggle> | |||||
| @@ -1,20 +1,17 @@ | |||||
| import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; | ||||
| import {environment} from "@environments/environment"; | import {environment} from "@environments/environment"; | ||||
| import {ActivatedRoute} from "@angular/router"; | import {ActivatedRoute} from "@angular/router"; | ||||
| import {Subscription, switchMap} from "rxjs"; | |||||
| import {switchMap} from "rxjs"; | |||||
| import { | import { | ||||
| ProductJsonld, | ProductJsonld, | ||||
| ProductService, | ProductService, | ||||
| UserProductJsonld, | UserProductJsonld, | ||||
| UserProductService | UserProductService | ||||
| } from "@app/core/api/v1"; | } from "@app/core/api/v1"; | ||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||||
| import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap"; | |||||
| import {NewProductComponent} from "@app/_views/products/new-product/new-product.component"; | import {NewProductComponent} from "@app/_views/products/new-product/new-product.component"; | ||||
| import {User} from "@app/_models"; | import {User} from "@app/_models"; | ||||
| import {AccountService} from "@app/_services"; | import {AccountService} from "@app/_services"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {NewSaleComponent} from "@app/_views/sales/new-sale/new-sale.component"; | |||||
| import {ToggleComponent} from "@app/_components/toggle/toggle.component"; | import {ToggleComponent} from "@app/_components/toggle/toggle.component"; | ||||
| import {PartnerListComponent} from "@app/_views/partners/partner-list/partner-list.component"; | import {PartnerListComponent} from "@app/_views/partners/partner-list/partner-list.component"; | ||||
| import {SaleListComponent} from "@app/_views/sales/sale-list/sale-list.component"; | import {SaleListComponent} from "@app/_views/sales/sale-list/sale-list.component"; | ||||
| @@ -26,21 +23,19 @@ import {SaleListComponent} from "@app/_views/sales/sale-list/sale-list.component | |||||
| }) | }) | ||||
| export class ProductsDetailComponent implements OnInit, AfterViewInit { | export class ProductsDetailComponent implements OnInit, AfterViewInit { | ||||
| @ViewChild("toggleCustomers", { static: true }) toggleCustomers!: ToggleComponent; | |||||
| @ViewChild("customerListComponent", { static: false }) customerListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleSuppliers", { static: true }) toggleSuppliers!: ToggleComponent; | |||||
| @ViewChild("suppliersListComponent", { static: false }) suppliersListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleServices", { static: true }) toggleServices!: ToggleComponent; | |||||
| @ViewChild("servicesListComponent", { static: false }) servicesListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleSales", { static: true }) toggleSales!: ToggleComponent; | |||||
| @ViewChild("salesListComponent", { static: false }) salesListComponent!: SaleListComponent; | |||||
| @ViewChild("toggleCustomers", {static: true}) toggleCustomers!: ToggleComponent; | |||||
| @ViewChild("customerListComponent", {static: false}) customerListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleSuppliers", {static: true}) toggleSuppliers!: ToggleComponent; | |||||
| @ViewChild("suppliersListComponent", {static: false}) suppliersListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleServices", {static: true}) toggleServices!: ToggleComponent; | |||||
| @ViewChild("servicesListComponent", {static: false}) servicesListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleSales", {static: true}) toggleSales!: ToggleComponent; | |||||
| @ViewChild("salesListComponent", {static: false}) salesListComponent!: SaleListComponent; | |||||
| protected readonly environment = environment; | protected readonly environment = environment; | ||||
| protected productId: string; | protected productId: string; | ||||
| protected productDetailSub: Subscription; | |||||
| protected product: ProductJsonld; | protected product: ProductJsonld; | ||||
| protected userProductSub: Subscription; | |||||
| protected userProduct: UserProductJsonld | null; | protected userProduct: UserProductJsonld | null; | ||||
| protected user: User | null; | protected user: User | null; | ||||
| @@ -53,10 +48,8 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||||
| ) { | ) { | ||||
| this.productId = ""; | this.productId = ""; | ||||
| this.user = this.accountService.userValue; | this.user = this.accountService.userValue; | ||||
| this.productDetailSub = new Subscription(); | |||||
| this.product = {} as ProductJsonld; | this.product = {} as ProductJsonld; | ||||
| this.userProductSub = new Subscription(); | |||||
| this.userProduct = null; | this.userProduct = null; | ||||
| } | } | ||||
| @@ -73,7 +66,7 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| getData = () => { | getData = () => { | ||||
| this.productDetailSub = this.productService.productsIdGet( | |||||
| this.productService.productsIdGet( | |||||
| this.productId | this.productId | ||||
| ).pipe( | ).pipe( | ||||
| switchMap(data => { | switchMap(data => { | ||||
| @@ -98,7 +91,7 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||||
| followProduct(event: any) { | followProduct(event: any) { | ||||
| if (this.userProduct === null) { | if (this.userProduct === null) { | ||||
| this.userProductSub = this.userProductService.userProductsPost( | |||||
| this.userProductService.userProductsPost( | |||||
| { | { | ||||
| user: this.user?.id, | user: this.user?.id, | ||||
| productIri: this.product.id, | productIri: this.product.id, | ||||
| @@ -109,7 +102,7 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| ); | ); | ||||
| } else { | } else { | ||||
| this.userProductSub = this.userProductService.userProductsIdDelete( | |||||
| this.userProductService.userProductsIdDelete( | |||||
| this.appHelperService.extractId(this.userProduct.id) | this.appHelperService.extractId(this.userProduct.id) | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -120,6 +113,6 @@ export class ProductsDetailComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| openModalEditProduct() { | openModalEditProduct() { | ||||
| this.appHelperService.openModal(NewProductComponent, { 'product': this.product }, this.getData); | |||||
| this.appHelperService.openModal(NewProductComponent, {'product': this.product}, this.getData); | |||||
| } | } | ||||
| } | } | ||||
| @@ -2,7 +2,5 @@ | |||||
| <div class="d-flex justify-content-between align-items-start"> | <div class="d-flex justify-content-between align-items-start"> | ||||
| <h2>{{ 'basic.products' | translate }}</h2> | <h2>{{ 'basic.products' | translate }}</h2> | ||||
| </div> | </div> | ||||
| <app-product-list #productList | |||||
| ></app-product-list> | |||||
| <app-product-list #productList></app-product-list> | |||||
| </div> | </div> | ||||
| @@ -19,6 +19,4 @@ export class ProductsComponent implements OnInit, AfterViewInit { | |||||
| ngAfterViewInit(): void { | ngAfterViewInit(): void { | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,3 +1,3 @@ | |||||
| <app-user-detail *ngIf="user" | <app-user-detail *ngIf="user" | ||||
| [user]="user" | |||||
| [user]="user" | |||||
| ></app-user-detail> | ></app-user-detail> | ||||
| @@ -5,13 +5,13 @@ import {UserDetailComponent} from "@app/_views/user/user-detail/user-detail.comp | |||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| @Component({ | @Component({ | ||||
| selector: 'app-profile', | |||||
| templateUrl: './profile.component.html', | |||||
| styleUrl: './profile.component.scss' | |||||
| selector: 'app-profile', | |||||
| templateUrl: './profile.component.html', | |||||
| styleUrl: './profile.component.scss' | |||||
| }) | }) | ||||
| export class ProfileComponent implements OnInit, AfterViewInit { | export class ProfileComponent implements OnInit, AfterViewInit { | ||||
| @ViewChild("userDetailComponent", { static: false }) userDetailComponent!: UserDetailComponent; | |||||
| @ViewChild("userDetailComponent", {static: false}) userDetailComponent!: UserDetailComponent; | |||||
| protected user!: UserJsonld; | protected user!: UserJsonld; | ||||
| @@ -40,5 +40,4 @@ export class ProfileComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,12 +6,12 @@ | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="partnerIri" class="form-label">{{ 'form.partner' | translate }}:</label> | <label for="partnerIri" class="form-label">{{ 'form.partner' | translate }}:</label> | ||||
| <app-search-select #partnerSearchSelect id="partnerIri" | <app-search-select #partnerSearchSelect id="partnerIri" | ||||
| [formId]="'partnerIri'" | |||||
| [formLabelLangKey]="'form.partner'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getPartners" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| [formId]="'partnerIri'" | |||||
| [formLabelLangKey]="'form.partner'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getPartners" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()" | |||||
| > | > | ||||
| </app-search-select> | </app-search-select> | ||||
| <input type="hidden" formControlName="partnerIri"/> | <input type="hidden" formControlName="partnerIri"/> | ||||
| @@ -20,12 +20,12 @@ | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label> | <label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label> | ||||
| <app-search-select #productSearchSelect id="productIri" | <app-search-select #productSearchSelect id="productIri" | ||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| [formId]="'productIri'" | |||||
| [formLabelLangKey]="'form.product'" | |||||
| [documentForm]="saleForm" | |||||
| [getDataFunction]="getProducts" | |||||
| [displayedDataField]="'name'" | |||||
| [listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()" | |||||
| > | > | ||||
| </app-search-select> | </app-search-select> | ||||
| <input type="hidden" formControlName="productIri"/> | <input type="hidden" formControlName="productIri"/> | ||||
| @@ -33,7 +33,7 @@ | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="turnover" class="form-label">{{ 'form.turnover' | translate }}:</label> | <label for="turnover" class="form-label">{{ 'form.turnover' | translate }}:</label> | ||||
| <input type="number" class="form-control" id="turnover" formControlName="turnover" min="0" step="1" /> | |||||
| <input type="number" class="form-control" id="turnover" formControlName="turnover" min="0" step="1"/> | |||||
| <div class="form-text" *ngIf="saleForm.get('turnover')?.invalid && saleForm.get('turnover')?.touched"> | <div class="form-text" *ngIf="saleForm.get('turnover')?.invalid && saleForm.get('turnover')?.touched"> | ||||
| {{ 'form.turnover' | translate }} {{ 'form.mandatory' | translate }}. | {{ 'form.turnover' | translate }} {{ 'form.mandatory' | translate }}. | ||||
| </div> | </div> | ||||
| @@ -41,12 +41,12 @@ | |||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="profit" class="form-label">{{ 'form.profit' | translate }}:</label> | <label for="profit" class="form-label">{{ 'form.profit' | translate }}:</label> | ||||
| <input type="number" class="form-control" id="profit" formControlName="profit" min="0" step="1" /> | |||||
| <input type="number" class="form-control" id="profit" formControlName="profit" min="0" step="1"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| <label for="quantity" class="form-label">{{ 'form.quantity' | translate }}:</label> | <label for="quantity" class="form-label">{{ 'form.quantity' | translate }}:</label> | ||||
| <input type="number" class="form-control" id="quantity" formControlName="quantity" min="0" step="1" /> | |||||
| <input type="number" class="form-control" id="quantity" formControlName="quantity" min="0" step="1"/> | |||||
| </div> | </div> | ||||
| <div class="mb-3"> | <div class="mb-3"> | ||||
| @@ -58,4 +58,3 @@ | |||||
| </button> | </button> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| @@ -1,23 +1,19 @@ | |||||
| import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | ||||
| import { | import { | ||||
| PartnerJsonld, | PartnerJsonld, | ||||
| PartnerService, ProductJsonld, | |||||
| PartnerService, | |||||
| ProductService, | ProductService, | ||||
| SaleJsonld, | SaleJsonld, | ||||
| SaleService | SaleService | ||||
| } from "@app/core/api/v1"; | } from "@app/core/api/v1"; | ||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | import {ModalStatus} from "@app/_helpers/modal.states"; | ||||
| import {FormGroup} from "@angular/forms"; | import {FormGroup} from "@angular/forms"; | ||||
| import {Observable, Subscription} from "rxjs"; | |||||
| import {Observable} from "rxjs"; | |||||
| import {TranslateService} from "@ngx-translate/core"; | import {TranslateService} from "@ngx-translate/core"; | ||||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | ||||
| import {saleForm} from "@app/_forms/apiForms"; | import {saleForm} from "@app/_forms/apiForms"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | ||||
| import {MatTableDataSource} from "@angular/material/table"; | |||||
| import {SearchInputColDef} from "@app/_components/search-input/search-input-col-def"; | |||||
| import {ListComponent} from "@app/_components/list/list.component"; | |||||
| import {ListColDefinition} from "@app/_components/list/list-col-definition"; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-new-sale', | selector: 'app-new-sale', | ||||
| @@ -28,8 +24,8 @@ export class NewSaleComponent implements OnInit, AfterViewInit { | |||||
| @Input() public sale!: SaleJsonld; | @Input() public sale!: SaleJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | @Input() public partner!: PartnerJsonld; | ||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| @ViewChild('partnerSearchSelect', { static: false }) partnerSearchSelect!: SearchSelectComponent; | |||||
| @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent; | |||||
| @ViewChild('partnerSearchSelect', {static: false}) partnerSearchSelect!: SearchSelectComponent; | |||||
| @ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent; | |||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected saleForm: FormGroup; | protected saleForm: FormGroup; | ||||
| @@ -1,6 +1,8 @@ | |||||
| <div class="spt-container"> | <div class="spt-container"> | ||||
| <div class="top-btn"> | <div class="top-btn"> | ||||
| <button *ngIf="!this.user" class="btn btn-primary" (click)="openModalNewSale()">+ {{ 'basic.new-sale' | translate }}</button> | |||||
| <button *ngIf="!this.user" class="btn btn-primary" (click)="openModalNewSale()"> | |||||
| + {{ 'basic.new-sale' | translate }} | |||||
| </button> | |||||
| </div> | </div> | ||||
| <app-list #listComponent | <app-list #listComponent | ||||
| [getDataFunction]="getData" | [getDataFunction]="getData" | ||||
| @@ -8,4 +10,4 @@ | |||||
| [onSortFunction]="onSortChange" | [onSortFunction]="onSortChange" | ||||
| [listColDefinitions]="listColDefinitions" | [listColDefinitions]="listColDefinitions" | ||||
| ></app-list> | ></app-list> | ||||
| </div> | |||||
| </div> | |||||
| @@ -1,12 +1,8 @@ | |||||
| import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core'; | ||||
| import {Subscription} from "rxjs"; | |||||
| import {PartnerJsonld, ProductJsonld, SaleJsonld, SaleService, SaleSummaryJsonld, UserJsonld} from "@app/core/api/v1"; | |||||
| import {TranslateService} from "@ngx-translate/core"; | |||||
| import {PartnerJsonld, ProductJsonld, SaleJsonld, SaleService, UserJsonld} from "@app/core/api/v1"; | |||||
| import {Router} from "@angular/router"; | import {Router} from "@angular/router"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {MatSort, Sort} from "@angular/material/sort"; | |||||
| import {MatTableDataSource} from "@angular/material/table"; | |||||
| import {PagingComponent} from "@app/_components/paging/paging.component"; | |||||
| import {Sort} from "@angular/material/sort"; | |||||
| import {NewSaleComponent} from "@app/_views/sales/new-sale/new-sale.component"; | import {NewSaleComponent} from "@app/_views/sales/new-sale/new-sale.component"; | ||||
| import {OrderFilter} from "@app/_models/orderFilter"; | import {OrderFilter} from "@app/_models/orderFilter"; | ||||
| import {AccountService} from "@app/_services"; | import {AccountService} from "@app/_services"; | ||||
| @@ -14,16 +10,16 @@ import {ListComponent} from "@app/_components/list/list.component"; | |||||
| import {ListColDefinition} from "@app/_components/list/list-col-definition"; | import {ListColDefinition} from "@app/_components/list/list-col-definition"; | ||||
| @Component({ | @Component({ | ||||
| selector: 'app-sale-list', | |||||
| templateUrl: './sale-list.component.html', | |||||
| styleUrl: './sale-list.component.scss' | |||||
| selector: 'app-sale-list', | |||||
| templateUrl: './sale-list.component.html', | |||||
| styleUrl: './sale-list.component.scss' | |||||
| }) | }) | ||||
| export class SaleListComponent implements OnInit, AfterViewInit { | export class SaleListComponent implements OnInit, AfterViewInit { | ||||
| @Input() public user!: UserJsonld; | @Input() public user!: UserJsonld; | ||||
| @Input() public product!: ProductJsonld; | @Input() public product!: ProductJsonld; | ||||
| @Input() public partner!: PartnerJsonld; | @Input() public partner!: PartnerJsonld; | ||||
| @ViewChild("listComponent", { static: false }) listComponent!: ListComponent; | |||||
| @ViewChild("listComponent", {static: false}) listComponent!: ListComponent; | |||||
| protected listColDefinitions!: ListColDefinition[]; | protected listColDefinitions!: ListColDefinition[]; | ||||
| @@ -101,7 +97,7 @@ export class SaleListComponent implements OnInit, AfterViewInit { | |||||
| ); | ); | ||||
| } | } | ||||
| onSortChange = (sortState: Sort)=> { | |||||
| onSortChange = (sortState: Sort) => { | |||||
| // Reset page index to first page | // Reset page index to first page | ||||
| let order: OrderFilter; | let order: OrderFilter; | ||||
| if (sortState.direction === "") { | if (sortState.direction === "") { | ||||
| @@ -120,7 +116,10 @@ export class SaleListComponent implements OnInit, AfterViewInit { | |||||
| openModalNewSale() { | openModalNewSale() { | ||||
| let sale: SaleJsonld = {} as SaleJsonld; | let sale: SaleJsonld = {} as SaleJsonld; | ||||
| this.appHelperService.openModal(NewSaleComponent, { 'sale': sale, 'partner': this.partner }, this.listComponent.getData); | |||||
| this.appHelperService.openModal(NewSaleComponent, { | |||||
| 'sale': sale, | |||||
| 'partner': this.partner | |||||
| }, this.listComponent.getData); | |||||
| } | } | ||||
| } | |||||
| } | |||||
| @@ -1,5 +1,7 @@ | |||||
| <div class="sales-summary-container mb-4" *ngFor="let saleSummary of saleSummaries"> | <div class="sales-summary-container mb-4" *ngFor="let saleSummary of saleSummaries"> | ||||
| <p><strong><a [routerLink]="['/user', appHelperService.extractId(saleSummary.owner?.id)]">{{ saleSummary.owner?.fullName }}</a></strong></p> | |||||
| <p><strong><a | |||||
| [routerLink]="['/user', appHelperService.extractId(saleSummary.owner?.id)]">{{ saleSummary.owner?.fullName }}</a></strong> | |||||
| </p> | |||||
| <div class="sales-summary-bar"> | <div class="sales-summary-bar"> | ||||
| <div> | <div> | ||||
| <span class="sales-summary-turnover" | <span class="sales-summary-turnover" | ||||
| @@ -16,4 +18,4 @@ | |||||
| </span> | </span> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | |||||
| </div> | |||||
| @@ -1,15 +1,14 @@ | |||||
| import {AfterViewInit, Component, Input, OnInit} from '@angular/core'; | import {AfterViewInit, Component, Input, OnInit} from '@angular/core'; | ||||
| import {Subscription} from "rxjs"; | import {Subscription} from "rxjs"; | ||||
| import {SaleJsonld, SaleSummaryJsonld, SaleSummaryService, UserJsonld} from "@app/core/api/v1"; | |||||
| import {SaleSummaryJsonld, SaleSummaryService, UserJsonld} from "@app/core/api/v1"; | |||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {Router} from "@angular/router"; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-sale-summary', | |||||
| templateUrl: './sale-summary.component.html', | |||||
| styleUrl: './sale-summary.component.scss' | |||||
| selector: 'app-sale-summary', | |||||
| templateUrl: './sale-summary.component.html', | |||||
| styleUrl: './sale-summary.component.scss' | |||||
| }) | }) | ||||
| export class SaleSummaryComponent implements OnInit, AfterViewInit { | |||||
| export class SaleSummaryComponent implements OnInit, AfterViewInit { | |||||
| @Input() public user!: UserJsonld; | @Input() public user!: UserJsonld; | ||||
| @@ -68,4 +67,4 @@ export class SaleSummaryComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | |||||
| } | |||||
| @@ -1,18 +1,15 @@ | |||||
| import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core'; | |||||
| import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; | |||||
| import {Subscription} from "rxjs"; | import {Subscription} from "rxjs"; | ||||
| import {MatTableDataSource} from "@angular/material/table"; | import {MatTableDataSource} from "@angular/material/table"; | ||||
| import {CommentJsonld, PostJsonld, PostService, SaleJsonld, SaleService} from "@app/core/api/v1"; | import {CommentJsonld, PostJsonld, PostService, SaleJsonld, SaleService} from "@app/core/api/v1"; | ||||
| import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap"; | |||||
| import {User} from "@app/_models"; | import {User} from "@app/_models"; | ||||
| import {AccountService} from "@app/_services"; | import {AccountService} from "@app/_services"; | ||||
| import {NewPostComponent} from "@app/_views/posts/new-post/new-post.component"; | import {NewPostComponent} from "@app/_views/posts/new-post/new-post.component"; | ||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | |||||
| import {NewCommentComponent} from "@app/_views/posts/new-comment/new-comment.component"; | import {NewCommentComponent} from "@app/_views/posts/new-comment/new-comment.component"; | ||||
| import {NewSaleComponent} from "@app/_views/sales/new-sale/new-sale.component"; | import {NewSaleComponent} from "@app/_views/sales/new-sale/new-sale.component"; | ||||
| import {ActivatedRoute} from "@angular/router"; | import {ActivatedRoute} from "@angular/router"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {PagingComponent} from "@app/_components/paging/paging.component"; | import {PagingComponent} from "@app/_components/paging/paging.component"; | ||||
| import {NewTaskComponent} from "@app/_views/tasks/new-task/new-task.component"; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-sales-detail', | selector: 'app-sales-detail', | ||||
| @@ -132,5 +129,4 @@ export class SalesDetailComponent implements OnInit, AfterViewInit { | |||||
| this.commentsVisibility.set(post.id, !currentVisibility); | this.commentsVisibility.set(post.id, !currentVisibility); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } | |||||
| @@ -18,11 +18,10 @@ registerLocaleData(localeDe); | |||||
| ], | ], | ||||
| }) | }) | ||||
| export class SalesComponent implements OnInit, AfterViewInit { | export class SalesComponent implements OnInit, AfterViewInit { | ||||
| @ViewChild("saleSummary", { static: false }) saleSummary!: SaleSummaryComponent; | |||||
| @ViewChild("saleList", { static: false }) saleList!: SaleListComponent; | |||||
| @ViewChild("saleSummary", {static: false}) saleSummary!: SaleSummaryComponent; | |||||
| @ViewChild("saleList", {static: false}) saleList!: SaleListComponent; | |||||
| constructor( | |||||
| ) { | |||||
| constructor() { | |||||
| } | } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| @@ -28,7 +28,8 @@ | |||||
| <p class="form-label">{{ 'form.contact-type' | translate }}:</p> | <p class="form-label">{{ 'form.contact-type' | translate }}:</p> | ||||
| <div class="d-flex mb-3"> | <div class="d-flex mb-3"> | ||||
| <div class="form-check me-3" *ngFor="let type of contactTypes; let i = index"> | <div class="form-check me-3" *ngFor="let type of contactTypes; let i = index"> | ||||
| <input type="radio" class="form-check-input" id="radio-{{ type }}" formControlName="contactType" [value]="type" /> | |||||
| <input type="radio" class="form-check-input" id="radio-{{ type }}" formControlName="contactType" | |||||
| [value]="type"/> | |||||
| <label for="radio-{{ type }}" class="form-check-label bi" [class.bi-people]="type === 'personal'" | <label for="radio-{{ type }}" class="form-check-label bi" [class.bi-people]="type === 'personal'" | ||||
| [class.bi-telephone]="type === 'phone'" | [class.bi-telephone]="type === 'phone'" | ||||
| [class.bi-envelope]="type === 'email'"> | [class.bi-envelope]="type === 'email'"> | ||||
| @@ -36,9 +37,7 @@ | |||||
| </label> | </label> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <button type="submit" class="btn btn-primary" [disabled]="taskNoteForm.invalid">{{ 'form.send' | translate }} | <button type="submit" class="btn btn-primary" [disabled]="taskNoteForm.invalid">{{ 'form.send' | translate }} | ||||
| </button> | </button> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| @@ -1,6 +1,5 @@ | |||||
| import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | ||||
| import { | import { | ||||
| ContactJsonld, | |||||
| ContactService, | ContactService, | ||||
| TaskJsonld, | TaskJsonld, | ||||
| TaskNoteJsonld, | TaskNoteJsonld, | ||||
| @@ -8,13 +7,10 @@ import { | |||||
| } from "@app/core/api/v1"; | } from "@app/core/api/v1"; | ||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | import {ModalStatus} from "@app/_helpers/modal.states"; | ||||
| import {FormGroup} from "@angular/forms"; | import {FormGroup} from "@angular/forms"; | ||||
| import {Subscription} from "rxjs"; | |||||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {taskNoteForm} from "@app/_forms/apiForms"; | import {taskNoteForm} from "@app/_forms/apiForms"; | ||||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | ||||
| import {MatTableDataSource} from "@angular/material/table"; | |||||
| import {SearchInputColDef} from "@app/_components/search-input/search-input-col-def"; | |||||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | ||||
| @Component({ | @Component({ | ||||
| @@ -26,7 +22,7 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit { | |||||
| @Input() public task!: TaskJsonld; | @Input() public task!: TaskJsonld; | ||||
| @Input() public taskNote!: TaskNoteJsonld; | @Input() public taskNote!: TaskNoteJsonld; | ||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| @ViewChild('contactSearchSelect', { static: false }) contactSearchSelect!: SearchSelectComponent; | |||||
| @ViewChild('contactSearchSelect', {static: false}) contactSearchSelect!: SearchSelectComponent; | |||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected taskNoteForm: FormGroup; | protected taskNoteForm: FormGroup; | ||||
| @@ -1,23 +1,16 @@ | |||||
| import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core'; | ||||
| import { | import { | ||||
| PartnerService, | |||||
| ProductJsonld, | |||||
| ProductService, | ProductService, | ||||
| TaskJsonld, | TaskJsonld, | ||||
| TaskService, | TaskService, | ||||
| UserJsonld, | |||||
| UserService | UserService | ||||
| } from "@app/core/api/v1"; | } from "@app/core/api/v1"; | ||||
| import {ModalStatus} from "@app/_helpers/modal.states"; | import {ModalStatus} from "@app/_helpers/modal.states"; | ||||
| import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer"; | ||||
| import {FormGroup} from "@angular/forms"; | import {FormGroup} from "@angular/forms"; | ||||
| import {debounceTime, distinctUntilChanged, Observable, OperatorFunction, Subscription, switchMap} from "rxjs"; | |||||
| import {taskForm} from "@app/_forms/apiForms"; | import {taskForm} from "@app/_forms/apiForms"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {filter, map} from "rxjs/operators"; | |||||
| import {MatTableDataSource} from "@angular/material/table"; | |||||
| import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | import {SearchSelectComponent} from "@app/_components/search-select/search-select.component"; | ||||
| import {SearchInputColDef} from "@app/_components/search-input/search-input-col-def"; | |||||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | ||||
| @Component({ | @Component({ | ||||
| @@ -28,8 +21,8 @@ import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-funct | |||||
| export class NewTaskComponent implements OnInit, AfterViewInit { | export class NewTaskComponent implements OnInit, AfterViewInit { | ||||
| @Input() public task!: TaskJsonld; | @Input() public task!: TaskJsonld; | ||||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | ||||
| @ViewChild('userSearchSelect', { static: false }) userSearchSelect!: SearchSelectComponent; | |||||
| @ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent; | |||||
| @ViewChild('userSearchSelect', {static: false}) userSearchSelect!: SearchSelectComponent; | |||||
| @ViewChild('productSearchSelect', {static: false}) productSearchSelect!: SearchSelectComponent; | |||||
| protected readonly SearchSelectComponent = SearchSelectComponent; | protected readonly SearchSelectComponent = SearchSelectComponent; | ||||
| protected taskForm: FormGroup; | protected taskForm: FormGroup; | ||||
| @@ -20,11 +20,13 @@ | |||||
| <ng-container *ngFor="let task of tasks"> | <ng-container *ngFor="let task of tasks"> | ||||
| <ng-container *ngIf="!task.completed || showCompletedTasks"> | <ng-container *ngIf="!task.completed || showCompletedTasks"> | ||||
| <div class="tasks pb-1"> | <div class="tasks pb-1"> | ||||
| <div class="card ps-3 pe-3 pt-3" [ngClass]="{'task-completed': task.completed}" *ngIf="taskCompactMode"> | |||||
| <div class="card ps-3 pe-3 pt-3" [ngClass]="{'task-completed': task.completed}" | |||||
| *ngIf="taskCompactMode"> | |||||
| <div class="row pb-1"> | <div class="row pb-1"> | ||||
| <div class="col-12"> | <div class="col-12"> | ||||
| <div class="info-box"> | <div class="info-box"> | ||||
| <span *ngIf="currentUser?.userResource?.id == appHelperService.extractId(task.assignedToIri)" class="position-absolute bi bi-pencil p-2" | |||||
| <span *ngIf="currentUser?.userResource?.id == appHelperService.extractId(task.assignedToIri)" | |||||
| class="position-absolute bi bi-pencil p-2" | |||||
| data-type="user-tool" | data-type="user-tool" | ||||
| data-action="edit" | data-action="edit" | ||||
| (click)="openModalEditTask(task)" | (click)="openModalEditTask(task)" | ||||
| @@ -71,7 +73,8 @@ | |||||
| <div class="card p-3" [ngClass]="{'task-completed': task.completed}" *ngIf="!taskCompactMode"> | <div class="card p-3" [ngClass]="{'task-completed': task.completed}" *ngIf="!taskCompactMode"> | ||||
| <div class="row"> | <div class="row"> | ||||
| <div class="col-12 col-sm-6 col-lg-4"> | <div class="col-12 col-sm-6 col-lg-4"> | ||||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY - HH:mm':'GMT+0000' }} Uhr</span> | |||||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY - HH:mm':'GMT+0000' }} | |||||
| Uhr</span> | |||||
| <h3 class="m-0" *ngIf="task.partner"> | <h3 class="m-0" *ngIf="task.partner"> | ||||
| <app-linked-label [partner]="task.partner"></app-linked-label> | <app-linked-label [partner]="task.partner"></app-linked-label> | ||||
| </h3> | </h3> | ||||
| @@ -86,8 +89,10 @@ | |||||
| <span class="importance" [attr.data-importance]="task.prio"></span> | <span class="importance" [attr.data-importance]="task.prio"></span> | ||||
| <h2 class="m-0">{{ task.headline }}</h2> | <h2 class="m-0">{{ task.headline }}</h2> | ||||
| <p class="m-0" [innerHTML]="appHelperService.getSafeLongtext(task.description)"></p> | <p class="m-0" [innerHTML]="appHelperService.getSafeLongtext(task.description)"></p> | ||||
| <span *ngIf="task.createdBy?.id === currentUser?.id" class="position-absolute bi bi-pencil p-2" | |||||
| data-type="user-tool" data-action="edit" (click)="openModalEditTask(task)"></span> | |||||
| <span *ngIf="task.createdBy?.id === currentUser?.id" | |||||
| class="position-absolute bi bi-pencil p-2" | |||||
| data-type="user-tool" data-action="edit" | |||||
| (click)="openModalEditTask(task)"></span> | |||||
| <div class="spt-comments-box d-flex justify-content-end mt-1 position-absolute"> | <div class="spt-comments-box d-flex justify-content-end mt-1 position-absolute"> | ||||
| <span *ngIf="task.numTaskNotes !== undefined && task.numTaskNotes !== null && task.numTaskNotes > 0" | <span *ngIf="task.numTaskNotes !== undefined && task.numTaskNotes !== null && task.numTaskNotes > 0" | ||||
| role="button" class="spt-btn-low badge bg-secondary p-2 me-2" | role="button" class="spt-btn-low badge bg-secondary p-2 me-2" | ||||
| @@ -108,12 +113,15 @@ | |||||
| <div class="card spt-comments" *ngFor="let taskNote of taskNotes.get(task.id)"> | <div class="card spt-comments" *ngFor="let taskNote of taskNotes.get(task.id)"> | ||||
| <div class="card-body"> | <div class="card-body"> | ||||
| <div class="d-flex justify-content-between align-items-center"> | <div class="d-flex justify-content-between align-items-center"> | ||||
| <p *ngIf="taskNote.owner !== undefined"><app-linked-label [user]="taskNote.owner"></app-linked-label> - | |||||
| <p *ngIf="taskNote.owner !== undefined"> | |||||
| <app-linked-label [user]="taskNote.owner"></app-linked-label> | |||||
| - | |||||
| <span class="bi" [class.bi-people]="taskNote.contactType === 'personal'" | <span class="bi" [class.bi-people]="taskNote.contactType === 'personal'" | ||||
| [class.bi-telephone]="taskNote.contactType === 'phone'" | [class.bi-telephone]="taskNote.contactType === 'phone'" | ||||
| [class.bi-envelope]="taskNote.contactType === 'email'"></span> | [class.bi-envelope]="taskNote.contactType === 'email'"></span> | ||||
| <ng-container *ngIf="taskNote.contact"> | <ng-container *ngIf="taskNote.contact"> | ||||
| mit <app-linked-label [contact]="taskNote.contact"></app-linked-label> | |||||
| mit | |||||
| <app-linked-label [contact]="taskNote.contact"></app-linked-label> | |||||
| </ng-container> | </ng-container> | ||||
| </p> | </p> | ||||
| <p>{{ taskNote.createdAt | date:'dd.MM.YYYY - HH:mm':'GMT+0000' }} Uhr</p> | <p>{{ taskNote.createdAt | date:'dd.MM.YYYY - HH:mm':'GMT+0000' }} Uhr</p> | ||||
| @@ -121,7 +129,8 @@ | |||||
| <div> | <div> | ||||
| <p [innerHTML]="appHelperService.getSafeLongtext(taskNote.message)"></p> | <p [innerHTML]="appHelperService.getSafeLongtext(taskNote.message)"></p> | ||||
| </div> | </div> | ||||
| <span *ngIf="taskNote.owner?.id === currentUser?.id" class="position-absolute bi bi-pencil p-2" | |||||
| <span *ngIf="taskNote.owner?.id === currentUser?.id" | |||||
| class="position-absolute bi bi-pencil p-2" | |||||
| data-type="user-tool" data-action="edit" | data-type="user-tool" data-action="edit" | ||||
| (click)="openModalEditTaskNote(taskNote, task)"></span> | (click)="openModalEditTaskNote(taskNote, task)"></span> | ||||
| </div> | </div> | ||||
| @@ -132,4 +141,4 @@ | |||||
| </ng-container> | </ng-container> | ||||
| </div> | </div> | ||||
| </app-paging> | </app-paging> | ||||
| </div> | |||||
| </div> | |||||
| @@ -17,15 +17,15 @@ import {AccountService} from "@app/_services"; | |||||
| import {User} from "@app/_models"; | import {User} from "@app/_models"; | ||||
| @Component({ | @Component({ | ||||
| selector: 'app-task-list', | |||||
| templateUrl: './task-list.component.html', | |||||
| styleUrl: './task-list.component.scss' | |||||
| selector: 'app-task-list', | |||||
| templateUrl: './task-list.component.html', | |||||
| styleUrl: './task-list.component.scss' | |||||
| }) | }) | ||||
| export class TaskListComponent implements OnInit, AfterViewInit { | export class TaskListComponent implements OnInit, AfterViewInit { | ||||
| @Input() public partner!: PartnerJsonld; | @Input() public partner!: PartnerJsonld; | ||||
| @Input() public user!: UserJsonld | undefined; | @Input() public user!: UserJsonld | undefined; | ||||
| @ViewChild("pagingComponent", { static: false }) pagingComponent!: PagingComponent; | |||||
| @ViewChild("pagingComponent", {static: false}) pagingComponent!: PagingComponent; | |||||
| protected currentUser: User | null; | protected currentUser: User | null; | ||||
| protected tasks: Array<TaskJsonld>; | protected tasks: Array<TaskJsonld>; | ||||
| @@ -138,24 +138,24 @@ export class TaskListComponent implements OnInit, AfterViewInit { | |||||
| let task: TaskJsonld = {} as TaskJsonld; | let task: TaskJsonld = {} as TaskJsonld; | ||||
| task.partnerIri = this.partner.id; | task.partnerIri = this.partner.id; | ||||
| task.completed = false; | task.completed = false; | ||||
| this.appHelperService.openModal(NewTaskComponent, { 'task': task }, this.getTasksData); | |||||
| this.appHelperService.openModal(NewTaskComponent, {'task': task}, this.getTasksData); | |||||
| } | } | ||||
| openModalEditTask(task: TaskJsonld) { | openModalEditTask(task: TaskJsonld) { | ||||
| this.appHelperService.openModal(NewTaskComponent, { 'task': task }, this.getTasksData); | |||||
| this.appHelperService.openModal(NewTaskComponent, {'task': task}, this.getTasksData); | |||||
| } | } | ||||
| openModalNewTaskNote(task: TaskJsonld) { | openModalNewTaskNote(task: TaskJsonld) { | ||||
| let taskNote: TaskNoteJsonld = {} as TaskNoteJsonld; | let taskNote: TaskNoteJsonld = {} as TaskNoteJsonld; | ||||
| taskNote.taskIri = task.id ?? null; | taskNote.taskIri = task.id ?? null; | ||||
| this.appHelperService.openModal( | this.appHelperService.openModal( | ||||
| NewTaskNoteComponent, { 'taskNote': taskNote, 'task': task }, this.afterCommentCreation, task.id | |||||
| NewTaskNoteComponent, {'taskNote': taskNote, 'task': task}, this.afterCommentCreation, task.id | |||||
| ); | ); | ||||
| } | } | ||||
| openModalEditTaskNote(taskNote: TaskNoteJsonld, task: TaskJsonld) { | openModalEditTaskNote(taskNote: TaskNoteJsonld, task: TaskJsonld) { | ||||
| this.appHelperService.openModal( | this.appHelperService.openModal( | ||||
| NewTaskNoteComponent, { 'taskNote': taskNote, 'task': task }, this.afterCommentCreation, task.id | |||||
| NewTaskNoteComponent, {'taskNote': taskNote, 'task': task}, this.afterCommentCreation, task.id | |||||
| ); | ); | ||||
| } | } | ||||
| @@ -1,6 +1,6 @@ | |||||
| <div class="spt-container"> | <div class="spt-container"> | ||||
| <div class="d-flex justify-content-between align-items-start"> | <div class="d-flex justify-content-between align-items-start"> | ||||
| <h2>{{'basic.tasks' | translate}}</h2> | |||||
| <h2>{{ 'basic.tasks' | translate }}</h2> | |||||
| </div> | </div> | ||||
| <app-task-list #taskListComponent></app-task-list> | <app-task-list #taskListComponent></app-task-list> | ||||
| </div> | |||||
| </div> | |||||
| @@ -10,7 +10,7 @@ import {TaskListComponent} from "@app/_views/tasks/task-list/task-list.component | |||||
| styleUrl: './tasks.component.scss' | styleUrl: './tasks.component.scss' | ||||
| }) | }) | ||||
| export class TasksComponent implements OnInit, AfterViewInit { | export class TasksComponent implements OnInit, AfterViewInit { | ||||
| @ViewChild("taskListComponent", { static: false }) taskListComponent!: TaskListComponent; | |||||
| @ViewChild("taskListComponent", {static: false}) taskListComponent!: TaskListComponent; | |||||
| protected user: User | null; | protected user: User | null; | ||||
| @@ -27,6 +27,4 @@ export class TasksComponent implements OnInit, AfterViewInit { | |||||
| ngAfterViewInit() { | ngAfterViewInit() { | ||||
| } | } | ||||
| } | } | ||||
| @@ -4,73 +4,80 @@ | |||||
| <div class="spt-col col-12 col-sm-6 col-lg-8"> | <div class="spt-col col-12 col-sm-6 col-lg-8"> | ||||
| <h1>{{ user.firstName }} {{ user.lastName }}</h1> | <h1>{{ user.firstName }} {{ user.lastName }}</h1> | ||||
| <dl> | <dl> | ||||
| <dt>{{('user.email' | translate)}}</dt> | |||||
| <dt>{{ ('user.email' | translate) }}</dt> | |||||
| <dd><a href="mailto:{{ user.email }}">{{ user.email }}</a></dd> | <dd><a href="mailto:{{ user.email }}">{{ user.email }}</a></dd> | ||||
| <dt>{{('user.goals' | translate)}}</dt> | |||||
| <dt>{{ ('user.goals' | translate) }}</dt> | |||||
| <dd>{{ user.goals }}</dd> | <dd>{{ user.goals }}</dd> | ||||
| </dl> | </dl> | ||||
| </div> | </div> | ||||
| <div class="col-12 col-sm-6 col-lg-4 has-image"> | <div class="col-12 col-sm-6 col-lg-4 has-image"> | ||||
| <img *ngIf="user.imageUrl !== null && user.imageUrl !== undefined" | <img *ngIf="user.imageUrl !== null && user.imageUrl !== undefined" | ||||
| src="{{user.imageUrl}}" width="247" height="94" | src="{{user.imageUrl}}" width="247" height="94" | ||||
| alt="{{user.firstName}} {{user.lastName}}" title="{{user.firstName}} {{user.lastName}}" /> | |||||
| alt="{{user.firstName}} {{user.lastName}}" title="{{user.firstName}} {{user.lastName}}"/> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <ng-container *ngIf="user"> | <ng-container *ngIf="user"> | ||||
| <app-toggle #togglePosts [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.posts' | translate)"> | |||||
| <app-post-list *ngIf="togglePosts.isOpened" #postListComponent | |||||
| <app-toggle #togglePosts | |||||
| [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.posts' | translate)"> | |||||
| <app-post-list *ngIf="togglePosts.isOpened" #postListComponent | |||||
| [user]="user" | [user]="user" | ||||
| > | > | ||||
| </app-post-list> | </app-post-list> | ||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleTasks [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.tasks' | translate)"> | |||||
| <app-toggle #toggleTasks | |||||
| [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.tasks' | translate)"> | |||||
| <app-task-list *ngIf="toggleTasks.isOpened" #taskListComponent | <app-task-list *ngIf="toggleTasks.isOpened" #taskListComponent | ||||
| [user]="user" | |||||
| [user]="user" | |||||
| > | > | ||||
| </app-task-list> | </app-task-list> | ||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleSales [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.sales' | translate)"> | |||||
| <app-toggle #toggleSales | |||||
| [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.sales' | translate)"> | |||||
| <app-sale-list *ngIf="toggleSales.isOpened" #saleListComponent | <app-sale-list *ngIf="toggleSales.isOpened" #saleListComponent | ||||
| [user]="user" | |||||
| [user]="user" | |||||
| > | > | ||||
| </app-sale-list> | </app-sale-list> | ||||
| <app-sale-summary *ngIf="toggleSales.isOpened" #saleSummaryComponent | <app-sale-summary *ngIf="toggleSales.isOpened" #saleSummaryComponent | ||||
| [user]="user" | |||||
| [user]="user" | |||||
| > | > | ||||
| </app-sale-summary> | </app-sale-summary> | ||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleProducts [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.products' | translate)"> | |||||
| <app-toggle #toggleProducts | |||||
| [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.products' | translate)"> | |||||
| <app-product-list *ngIf="toggleProducts.isOpened" #productListComponent | <app-product-list *ngIf="toggleProducts.isOpened" #productListComponent | ||||
| [user]="user"> | |||||
| [user]="user"> | |||||
| </app-product-list> | </app-product-list> | ||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleCustomers [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.customer' | translate)"> | |||||
| <app-toggle #toggleCustomers | |||||
| [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.customer' | translate)"> | |||||
| <app-partner-list *ngIf="toggleCustomers.isOpened" #customerListComponent | <app-partner-list *ngIf="toggleCustomers.isOpened" #customerListComponent | ||||
| [user]="user" | |||||
| [partnerType]="'customer'" | |||||
| [user]="user" | |||||
| [partnerType]="'customer'" | |||||
| > | > | ||||
| </app-partner-list> | </app-partner-list> | ||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleSuppliers [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.supplier' | translate)"> | |||||
| <app-toggle #toggleSuppliers | |||||
| [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.supplier' | translate)"> | |||||
| <app-partner-list *ngIf="toggleSuppliers.isOpened" #suppliersListComponent | <app-partner-list *ngIf="toggleSuppliers.isOpened" #suppliersListComponent | ||||
| [user]="user" | |||||
| [partnerType]="'supplier'" | |||||
| [user]="user" | |||||
| [partnerType]="'supplier'" | |||||
| > | > | ||||
| </app-partner-list> | </app-partner-list> | ||||
| </app-toggle> | </app-toggle> | ||||
| <app-toggle #toggleServices [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.service' | translate)"> | |||||
| <app-toggle #toggleServices | |||||
| [headline]="(isCurrentUser ? (('user.my' | translate) + ' ') : '') + ('basic.service' | translate)"> | |||||
| <app-partner-list *ngIf="toggleServices.isOpened" #servicesListComponent | <app-partner-list *ngIf="toggleServices.isOpened" #servicesListComponent | ||||
| [user]="user" | |||||
| [partnerType]="'service'" | |||||
| [user]="user" | |||||
| [partnerType]="'service'" | |||||
| > | > | ||||
| </app-partner-list> | </app-partner-list> | ||||
| </app-toggle> | </app-toggle> | ||||
| </ng-container> | |||||
| </ng-container> | |||||
| @@ -3,7 +3,6 @@ import {UserJsonld, UserService} from "@app/core/api/v1"; | |||||
| import {Subscription} from "rxjs"; | import {Subscription} from "rxjs"; | ||||
| import {AccountService} from "@app/_services"; | import {AccountService} from "@app/_services"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {UsersComponent} from "@app/_views/user/users.component"; | |||||
| import {ToggleComponent} from "@app/_components/toggle/toggle.component"; | import {ToggleComponent} from "@app/_components/toggle/toggle.component"; | ||||
| import {TaskListComponent} from "@app/_views/tasks/task-list/task-list.component"; | import {TaskListComponent} from "@app/_views/tasks/task-list/task-list.component"; | ||||
| import {SaleListComponent} from "@app/_views/sales/sale-list/sale-list.component"; | import {SaleListComponent} from "@app/_views/sales/sale-list/sale-list.component"; | ||||
| @@ -14,29 +13,28 @@ import {SaleSummaryComponent} from "@app/_views/sales/sale-summary/sale-summary. | |||||
| import {ActivatedRoute} from "@angular/router"; | import {ActivatedRoute} from "@angular/router"; | ||||
| @Component({ | @Component({ | ||||
| selector: 'app-user-detail', | |||||
| templateUrl: './user-detail.component.html', | |||||
| styleUrl: './user-detail.component.scss' | |||||
| selector: 'app-user-detail', | |||||
| templateUrl: './user-detail.component.html', | |||||
| styleUrl: './user-detail.component.scss' | |||||
| }) | }) | ||||
| export class UserDetailComponent implements OnInit, AfterViewInit { | export class UserDetailComponent implements OnInit, AfterViewInit { | ||||
| @Input() public user!: UserJsonld; | @Input() public user!: UserJsonld; | ||||
| @ViewChild("togglePosts", { static: true }) togglePosts!: ToggleComponent; | |||||
| @ViewChild("postListComponent", { static: false }) postsComponent!: PostListComponent; | |||||
| @ViewChild("toggleTasks", { static: true }) toggleTasks!: ToggleComponent; | |||||
| @ViewChild("taskListComponent", { static: false }) taskListComponent!: TaskListComponent; | |||||
| @ViewChild("toggleSales", { static: true }) toggleSales!: ToggleComponent; | |||||
| @ViewChild("saleSummaryComponent", { static: false }) saleSummaryComponent!: SaleSummaryComponent; | |||||
| @ViewChild("saleListComponent", { static: false }) saleListComponent!: SaleListComponent; | |||||
| @ViewChild("toggleProducts", { static: true }) toggleProducts!: ToggleComponent; | |||||
| @ViewChild("productListComponent", { static: false }) productListComponent!: ProductListComponent; | |||||
| @ViewChild("toggleCustomers", { static: true }) toggleCustomers!: ToggleComponent; | |||||
| @ViewChild("customerListComponent", { static: false }) customerListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleSuppliers", { static: true }) toggleSuppliers!: ToggleComponent; | |||||
| @ViewChild("suppliersListComponent", { static: false }) suppliersListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleServices", { static: true }) toggleServices!: ToggleComponent; | |||||
| @ViewChild("servicesListComponent", { static: false }) servicesListComponent!: PartnerListComponent; | |||||
| @ViewChild("togglePosts", {static: true}) togglePosts!: ToggleComponent; | |||||
| @ViewChild("postListComponent", {static: false}) postsComponent!: PostListComponent; | |||||
| @ViewChild("toggleTasks", {static: true}) toggleTasks!: ToggleComponent; | |||||
| @ViewChild("taskListComponent", {static: false}) taskListComponent!: TaskListComponent; | |||||
| @ViewChild("toggleSales", {static: true}) toggleSales!: ToggleComponent; | |||||
| @ViewChild("saleSummaryComponent", {static: false}) saleSummaryComponent!: SaleSummaryComponent; | |||||
| @ViewChild("saleListComponent", {static: false}) saleListComponent!: SaleListComponent; | |||||
| @ViewChild("toggleProducts", {static: true}) toggleProducts!: ToggleComponent; | |||||
| @ViewChild("productListComponent", {static: false}) productListComponent!: ProductListComponent; | |||||
| @ViewChild("toggleCustomers", {static: true}) toggleCustomers!: ToggleComponent; | |||||
| @ViewChild("customerListComponent", {static: false}) customerListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleSuppliers", {static: true}) toggleSuppliers!: ToggleComponent; | |||||
| @ViewChild("suppliersListComponent", {static: false}) suppliersListComponent!: PartnerListComponent; | |||||
| @ViewChild("toggleServices", {static: true}) toggleServices!: ToggleComponent; | |||||
| @ViewChild("servicesListComponent", {static: false}) servicesListComponent!: PartnerListComponent; | |||||
| protected userSub: Subscription; | |||||
| protected isCurrentUser: boolean; | protected isCurrentUser: boolean; | ||||
| constructor( | constructor( | ||||
| @@ -45,7 +43,6 @@ export class UserDetailComponent implements OnInit, AfterViewInit { | |||||
| protected appHelperService: AppHelperService, | protected appHelperService: AppHelperService, | ||||
| private route: ActivatedRoute, | private route: ActivatedRoute, | ||||
| ) { | ) { | ||||
| this.userSub = new Subscription(); | |||||
| this.isCurrentUser = false; | this.isCurrentUser = false; | ||||
| } | } | ||||
| @@ -64,7 +61,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit { | |||||
| } | } | ||||
| getUserData(userId: string) { | getUserData(userId: string) { | ||||
| this.userSub = this.userService.usersIdGet( | |||||
| this.userService.usersIdGet( | |||||
| userId | userId | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -5,4 +5,4 @@ | |||||
| [onSortFunction]="onSortChange" | [onSortFunction]="onSortChange" | ||||
| [listColDefinitions]="listColDefinitions" | [listColDefinitions]="listColDefinitions" | ||||
| ></app-list> | ></app-list> | ||||
| </div> | |||||
| </div> | |||||
| @@ -1,25 +1,21 @@ | |||||
| import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; | import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; | ||||
| import {MatSort, Sort} from "@angular/material/sort"; | |||||
| import {PagingComponent} from "@app/_components/paging/paging.component"; | |||||
| import {Subscription} from "rxjs"; | |||||
| import {Sort} from "@angular/material/sort"; | |||||
| import {UserJsonld, UserService} from "@app/core/api/v1"; | import {UserJsonld, UserService} from "@app/core/api/v1"; | ||||
| import {MatTableDataSource} from "@angular/material/table"; | |||||
| import {OrderFilter} from "@app/_models/orderFilter"; | import {OrderFilter} from "@app/_models/orderFilter"; | ||||
| import {Router} from "@angular/router"; | import {Router} from "@angular/router"; | ||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| import {ListComponent} from "@app/_components/list/list.component"; | import {ListComponent} from "@app/_components/list/list.component"; | ||||
| import {ListColDefinition} from "@app/_components/list/list-col-definition"; | import {ListColDefinition} from "@app/_components/list/list-col-definition"; | ||||
| import {ListColTypeAddress} from "@app/_components/list/list-col-type-address"; | |||||
| import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type"; | ||||
| @Component({ | @Component({ | ||||
| selector: 'app-user-list', | |||||
| templateUrl: './user-list.component.html', | |||||
| styleUrl: './user-list.component.scss' | |||||
| selector: 'app-user-list', | |||||
| templateUrl: './user-list.component.html', | |||||
| styleUrl: './user-list.component.scss' | |||||
| }) | }) | ||||
| export class UserListComponent implements OnInit, AfterViewInit { | export class UserListComponent implements OnInit, AfterViewInit { | ||||
| @ViewChild("listComponent", { static: false }) listComponent!: ListComponent; | |||||
| @ViewChild("listComponent", {static: false}) listComponent!: ListComponent; | |||||
| protected listColDefinitions!: ListColDefinition[]; | protected listColDefinitions!: ListColDefinition[]; | ||||
| @@ -5,21 +5,19 @@ import {AccountService} from "@app/_services"; | |||||
| import {AppHelperService} from "@app/_helpers/app-helper.service"; | import {AppHelperService} from "@app/_helpers/app-helper.service"; | ||||
| @Component({ | @Component({ | ||||
| selector: 'app-users', | |||||
| templateUrl: './users.component.html', | |||||
| styleUrl: './users.component.scss' | |||||
| selector: 'app-users', | |||||
| templateUrl: './users.component.html', | |||||
| styleUrl: './users.component.scss' | |||||
| }) | }) | ||||
| export class UsersComponent implements OnInit, AfterViewInit { | export class UsersComponent implements OnInit, AfterViewInit { | ||||
| @Input() public user!: UserJsonld; | @Input() public user!: UserJsonld; | ||||
| protected userSub: Subscription; | |||||
| constructor( | constructor( | ||||
| private accountService: AccountService, | private accountService: AccountService, | ||||
| private userService: UserService, | private userService: UserService, | ||||
| protected appHelperService: AppHelperService | protected appHelperService: AppHelperService | ||||
| ) { | ) { | ||||
| this.userSub = new Subscription(); | |||||
| } | } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| @@ -33,7 +31,7 @@ export class UsersComponent implements OnInit, AfterViewInit { | |||||
| getData() { | getData() { | ||||
| const user = this.accountService.userValue; | const user = this.accountService.userValue; | ||||
| if (user?.id !== null && user?.id !== undefined) { | if (user?.id !== null && user?.id !== undefined) { | ||||
| this.userSub = this.userService.usersIdGet( | |||||
| this.userService.usersIdGet( | |||||
| this.appHelperService.extractId(user.id) | this.appHelperService.extractId(user.id) | ||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| @@ -4,8 +4,8 @@ | |||||
| <div class="navbar-nav"> | <div class="navbar-nav"> | ||||
| <a class="nav-item nav-link" routerLink="/" routerLinkActive="active" | <a class="nav-item nav-link" routerLink="/" routerLinkActive="active" | ||||
| [routerLinkActiveOptions]="{exact: true}"> | [routerLinkActiveOptions]="{exact: true}"> | ||||
| <img src="./assets/images/specific/matsen_logo.svg" width="210" height="80" | |||||
| alt="{{'basic.company-name' | translate}}" /> | |||||
| <img src="./assets/images/specific/matsen_logo.svg" width="210" height="80" | |||||
| alt="{{'basic.company-name' | translate}}"/> | |||||
| </a> | </a> | ||||
| </div> | </div> | ||||
| <div class="navbar-nav align-items-center"> | <div class="navbar-nav align-items-center"> | ||||
| @@ -1,10 +1,10 @@ | |||||
| import { ApplicationConfig } from '@angular/core'; | |||||
| import { provideRouter } from '@angular/router'; | |||||
| import {ApplicationConfig} from '@angular/core'; | |||||
| import {provideRouter} from '@angular/router'; | |||||
| import { routes } from './app.routes'; | |||||
| import { provideClientHydration } from '@angular/platform-browser'; | |||||
| import { provideAnimations } from '@angular/platform-browser/animations'; | |||||
| import {routes} from './app.routes'; | |||||
| import {provideClientHydration} from '@angular/platform-browser'; | |||||
| import {provideAnimations} from '@angular/platform-browser/animations'; | |||||
| export const appConfig: ApplicationConfig = { | export const appConfig: ApplicationConfig = { | ||||
| providers: [provideRouter(routes), provideClientHydration(), provideAnimations()] | |||||
| providers: [provideRouter(routes), provideClientHydration(), provideAnimations()] | |||||
| }; | }; | ||||