Ver a proveniência

refactoring lists and folder structure

master
Daniel há 1 ano
ascendente
cometimento
b474d44f7c
100 ficheiros alterados com 561 adições e 315 eliminações
  1. +1
    -1
      matsen-tool/openapi.json
  2. +38
    -0
      matsen-tool/openapi.yaml
  3. +0
    -0
      matsen-tool/src/app/_components/layout/two-column/two-column.component.html
  4. +0
    -0
      matsen-tool/src/app/_components/layout/two-column/two-column.component.scss
  5. +0
    -0
      matsen-tool/src/app/_components/layout/two-column/two-column.component.spec.ts
  6. +0
    -0
      matsen-tool/src/app/_components/layout/two-column/two-column.component.ts
  7. +32
    -0
      matsen-tool/src/app/_components/list/list.component.ts
  8. +0
    -0
      matsen-tool/src/app/_views/account/account-routing.module.ts
  9. +0
    -0
      matsen-tool/src/app/_views/account/account.module.ts
  10. +0
    -0
      matsen-tool/src/app/_views/account/layout.component.html
  11. +0
    -0
      matsen-tool/src/app/_views/account/layout.component.ts
  12. +0
    -0
      matsen-tool/src/app/_views/account/login.component.html
  13. +0
    -0
      matsen-tool/src/app/_views/account/login.component.ts
  14. +0
    -0
      matsen-tool/src/app/_views/account/register.component.html
  15. +0
    -0
      matsen-tool/src/app/_views/account/register.component.ts
  16. +38
    -0
      matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.html
  17. +0
    -0
      matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.scss
  18. +23
    -0
      matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.spec.ts
  19. +97
    -0
      matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.ts
  20. +0
    -0
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html
  21. +0
    -0
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.scss
  22. +0
    -0
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.spec.ts
  23. +7
    -5
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts
  24. +0
    -0
      matsen-tool/src/app/_views/contacts/contacts.component.html
  25. +0
    -0
      matsen-tool/src/app/_views/contacts/contacts.component.scss
  26. +0
    -0
      matsen-tool/src/app/_views/contacts/contacts.component.spec.ts
  27. +0
    -0
      matsen-tool/src/app/_views/contacts/contacts.component.ts
  28. +0
    -0
      matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.html
  29. +0
    -0
      matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.scss
  30. +0
    -0
      matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.spec.ts
  31. +0
    -0
      matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.ts
  32. +0
    -0
      matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.html
  33. +0
    -0
      matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.scss
  34. +0
    -0
      matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.spec.ts
  35. +0
    -0
      matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.ts
  36. +0
    -0
      matsen-tool/src/app/_views/documents/documents.component.html
  37. +0
    -0
      matsen-tool/src/app/_views/documents/documents.component.scss
  38. +0
    -0
      matsen-tool/src/app/_views/documents/documents.component.spec.ts
  39. +2
    -2
      matsen-tool/src/app/_views/documents/documents.component.ts
  40. +0
    -0
      matsen-tool/src/app/_views/documents/new-document/new-document.component.html
  41. +0
    -0
      matsen-tool/src/app/_views/documents/new-document/new-document.component.scss
  42. +0
    -0
      matsen-tool/src/app/_views/documents/new-document/new-document.component.spec.ts
  43. +0
    -0
      matsen-tool/src/app/_views/documents/new-document/new-document.component.ts
  44. +0
    -0
      matsen-tool/src/app/_views/home/home.component.html
  45. +0
    -0
      matsen-tool/src/app/_views/home/home.component.scss
  46. +2
    -2
      matsen-tool/src/app/_views/home/home.component.ts
  47. +0
    -0
      matsen-tool/src/app/_views/home/index.ts
  48. +0
    -0
      matsen-tool/src/app/_views/partners/new-partner/new-partner.component.html
  49. +0
    -0
      matsen-tool/src/app/_views/partners/new-partner/new-partner.component.scss
  50. +0
    -0
      matsen-tool/src/app/_views/partners/new-partner/new-partner.component.spec.ts
  51. +0
    -0
      matsen-tool/src/app/_views/partners/new-partner/new-partner.component.ts
  52. +3
    -96
      matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.html
  53. +0
    -0
      matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.scss
  54. +0
    -0
      matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.spec.ts
  55. +22
    -189
      matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.ts
  56. +0
    -0
      matsen-tool/src/app/_views/partners/partners.component.html
  57. +0
    -0
      matsen-tool/src/app/_views/partners/partners.component.scss
  58. +0
    -0
      matsen-tool/src/app/_views/partners/partners.component.spec.ts
  59. +1
    -1
      matsen-tool/src/app/_views/partners/partners.component.ts
  60. +0
    -0
      matsen-tool/src/app/_views/posts/new-comment/new-comment.component.html
  61. +0
    -0
      matsen-tool/src/app/_views/posts/new-comment/new-comment.component.scss
  62. +0
    -0
      matsen-tool/src/app/_views/posts/new-comment/new-comment.component.spec.ts
  63. +0
    -0
      matsen-tool/src/app/_views/posts/new-comment/new-comment.component.ts
  64. +0
    -0
      matsen-tool/src/app/_views/posts/new-post/new-post.component.html
  65. +0
    -0
      matsen-tool/src/app/_views/posts/new-post/new-post.component.scss
  66. +23
    -0
      matsen-tool/src/app/_views/posts/new-post/new-post.component.spec.ts
  67. +4
    -4
      matsen-tool/src/app/_views/posts/new-post/new-post.component.ts
  68. +57
    -0
      matsen-tool/src/app/_views/posts/post-list/post-list.component.html
  69. +0
    -0
      matsen-tool/src/app/_views/posts/post-list/post-list.component.scss
  70. +23
    -0
      matsen-tool/src/app/_views/posts/post-list/post-list.component.spec.ts
  71. +161
    -0
      matsen-tool/src/app/_views/posts/post-list/post-list.component.ts
  72. +0
    -0
      matsen-tool/src/app/_views/posts/posts.component.html
  73. +0
    -0
      matsen-tool/src/app/_views/posts/posts.component.scss
  74. +5
    -5
      matsen-tool/src/app/_views/posts/posts.component.spec.ts
  75. +10
    -0
      matsen-tool/src/app/_views/posts/posts.component.ts
  76. +0
    -0
      matsen-tool/src/app/_views/products/new-product/new-product.component.html
  77. +0
    -0
      matsen-tool/src/app/_views/products/new-product/new-product.component.scss
  78. +0
    -0
      matsen-tool/src/app/_views/products/new-product/new-product.component.spec.ts
  79. +0
    -0
      matsen-tool/src/app/_views/products/new-product/new-product.component.ts
  80. +0
    -0
      matsen-tool/src/app/_views/products/products-detail/products-detail.component.html
  81. +0
    -0
      matsen-tool/src/app/_views/products/products-detail/products-detail.component.scss
  82. +0
    -0
      matsen-tool/src/app/_views/products/products-detail/products-detail.component.spec.ts
  83. +1
    -1
      matsen-tool/src/app/_views/products/products-detail/products-detail.component.ts
  84. +0
    -0
      matsen-tool/src/app/_views/products/products.component.html
  85. +0
    -0
      matsen-tool/src/app/_views/products/products.component.scss
  86. +0
    -0
      matsen-tool/src/app/_views/products/products.component.spec.ts
  87. +1
    -1
      matsen-tool/src/app/_views/products/products.component.ts
  88. +1
    -1
      matsen-tool/src/app/_views/profile/profile.component.html
  89. +0
    -0
      matsen-tool/src/app/_views/profile/profile.component.scss
  90. +0
    -0
      matsen-tool/src/app/_views/profile/profile.component.spec.ts
  91. +1
    -1
      matsen-tool/src/app/_views/profile/profile.component.ts
  92. +0
    -0
      matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html
  93. +0
    -0
      matsen-tool/src/app/_views/sales/new-sale/new-sale.component.scss
  94. +0
    -0
      matsen-tool/src/app/_views/sales/new-sale/new-sale.component.spec.ts
  95. +0
    -0
      matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts
  96. +0
    -0
      matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.html
  97. +0
    -0
      matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.scss
  98. +0
    -0
      matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.spec.ts
  99. +8
    -6
      matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.ts
  100. +0
    -0
      matsen-tool/src/app/_views/sales/sales.component.html

+ 1
- 1
matsen-tool/openapi.json
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande
Ver ficheiro


+ 38
- 0
matsen-tool/openapi.yaml Ver ficheiro

@@ -1633,6 +1633,18 @@ paths:
style: form
explode: true
allowReserved: false
-
name: product.name
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
deprecated: false
post:
operationId: api_partner_products_post
@@ -2185,6 +2197,32 @@ paths:
style: form
explode: true
allowReserved: false
-
name: owner
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: string
style: form
explode: false
allowReserved: false
-
name: 'owner[]'
in: query
description: ''
required: false
deprecated: false
allowEmptyValue: true
schema:
type: array
items:
type: string
style: form
explode: true
allowReserved: false
-
name: 'exists[contact]'
in: query


matsen-tool/src/app/layout/two-column/two-column.component.html → matsen-tool/src/app/_components/layout/two-column/two-column.component.html Ver ficheiro


matsen-tool/src/app/layout/two-column/two-column.component.scss → matsen-tool/src/app/_components/layout/two-column/two-column.component.scss Ver ficheiro


matsen-tool/src/app/layout/two-column/two-column.component.spec.ts → matsen-tool/src/app/_components/layout/two-column/two-column.component.spec.ts Ver ficheiro


matsen-tool/src/app/layout/two-column/two-column.component.ts → matsen-tool/src/app/_components/layout/two-column/two-column.component.ts Ver ficheiro


+ 32
- 0
matsen-tool/src/app/_components/list/list.component.ts Ver ficheiro

@@ -0,0 +1,32 @@
import {PageEvent} from "@angular/material/paginator";
import {error} from "@angular/compiler-cli/src/transformers/util";

export class ListComponent{

protected dataLength: number;
protected pageEvent: PageEvent;
protected pageSize: number;
protected pageIndex: number;
protected pageSizeOptions: number[];


constructor() {
this.dataLength = 0;
this.pageEvent = new PageEvent();
this.pageSize = 10;
this.pageIndex = 0;
this.pageSizeOptions = [10,20.30];
}

getData() {
error('implement in child class');
}

handlePageEvent(e: PageEvent) {
this.pageEvent = e;
this.dataLength = e.length;
this.pageIndex = e.pageIndex.valueOf();
this.pageSize = e.pageSize.valueOf();
this.getData();
}
}

matsen-tool/src/app/account/account-routing.module.ts → matsen-tool/src/app/_views/account/account-routing.module.ts Ver ficheiro


matsen-tool/src/app/account/account.module.ts → matsen-tool/src/app/_views/account/account.module.ts Ver ficheiro


matsen-tool/src/app/account/layout.component.html → matsen-tool/src/app/_views/account/layout.component.html Ver ficheiro


matsen-tool/src/app/account/layout.component.ts → matsen-tool/src/app/_views/account/layout.component.ts Ver ficheiro


matsen-tool/src/app/account/login.component.html → matsen-tool/src/app/_views/account/login.component.html Ver ficheiro


matsen-tool/src/app/account/login.component.ts → matsen-tool/src/app/_views/account/login.component.ts Ver ficheiro


matsen-tool/src/app/account/register.component.html → matsen-tool/src/app/_views/account/register.component.html Ver ficheiro


matsen-tool/src/app/account/register.component.ts → matsen-tool/src/app/_views/account/register.component.ts Ver ficheiro


+ 38
- 0
matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.html Ver ficheiro

@@ -0,0 +1,38 @@
<div class="spt-container">
<div class="contacts position-relative">
<button class="btn btn-primary toggle-btn" (click)="openModalNewContact()">{{ 'basic.new-contact' | translate }}
</button>
<div class="row">
<div class="col-4" *ngFor="let contact of contacts">
<div class="card">
<div class="card-body row">
<div class="col-8">
<h2>{{ contact.firstName }} {{ contact.lastName }}</h2>
<p><a href="mailto:{{contact.email}}">{{ contact.email }}</a><br/>
{{ contact.phone }}<br/>
{{ contact.position }}</p>
</div>
<div class="col-4">
<img *ngIf="contact.imageUrl !== null && contact.imageUrl !== undefined"
ngSrc="{{contact.imageUrl}}" width="247" height="94"
alt="{{contact.firstName}} {{contact.lastName}}"
title="{{contact.firstName}} {{contact.lastName}}"/>
</div>
</div>
</div>
<div class="d-flex justify-content-end mt-1 mb-4">
<span role="button" (click)="navigateToContactDetails(contact)"
class="badge bg-secondary p-2">{{ 'basic.details' | translate }}</span>
</div>
</div>
</div>
<mat-paginator *ngIf="contactsLength > 0" class="rounded-1"
[pageSizeOptions]="[6,12,18]"
[length]="contactsLength"
(page)="contactsHandlePageEvent($event)"
[pageSize]="contactsPageSize"
[pageIndex]="contactsPageIndex"
showFirstLastButtons>
</mat-paginator>
</div>
</div>

matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.scss → matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.scss Ver ficheiro


+ 23
- 0
matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.spec.ts Ver ficheiro

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ContactListComponent } from './contact-list.component';

describe('ContactsComponent', () => {
let component: ContactListComponent;
let fixture: ComponentFixture<ContactListComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ContactListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ContactListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 97
- 0
matsen-tool/src/app/_views/contacts/contact-list/contact-list.component.ts Ver ficheiro

@@ -0,0 +1,97 @@
import {ChangeDetectorRef, Component, Input, OnInit, ViewChild} from '@angular/core';
import {Subscription} from "rxjs";
import {ContactJsonld, ContactService, PartnerJsonld} from "@app/core/api/v1";
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
import {MatTableDataSource} from "@angular/material/table";
import {NewContactComponent} from "@app/_views/contacts/new-contact/new-contact.component";
import {ModalStatus} from "@app/_helpers/modal.states";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {Router} from "@angular/router";
import {ApiConverter} from "@app/_helpers/api.converter";

@Component({
selector: 'app-contact-list',
templateUrl: './contact-list.component.html',
styleUrl: './contact-list.component.scss'
})
export class ContactListComponent implements OnInit {

@Input() public partner!: PartnerJsonld;

@ViewChild(MatPaginator) contactsPaginator: MatPaginator;

protected contactsSub: Subscription;
protected contacts: Array<ContactJsonld>;
protected contactsDataSource;
protected contactsLength: number;
protected contactsPageEvent: PageEvent;
protected contactsPageSize: number;
protected contactsPageIndex: number;

protected modalOptions: NgbModalOptions = {
centered: true
};

constructor(
private router: Router,
private modalService: NgbModal,
private contactService: ContactService,
protected apiConverter: ApiConverter
) {
this.contactsSub = new Subscription();
this.contacts = [];
this.contactsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
this.contactsDataSource = new MatTableDataSource<ContactJsonld>(this.contacts);
this.contactsLength = 0;
this.contactsPageEvent = new PageEvent();
this.contactsPageSize = 6;
this.contactsPageIndex = 0;
}

ngOnInit() {
this.getContactsData();
}

getContactsData() {
this.contactsSub = this.contactService.contactsGetCollection(
this.contactsPageIndex + 1,
this.contactsPageSize,
this.partner.id
).subscribe(
data => {
this.contacts = data["hydra:member"];
this.contactsLength = Number(data["hydra:totalItems"]);
if (this.contactsPaginator !== undefined) {
this.contactsPaginator.length = this.contactsLength;
}
console.log('getPartnerProducts done');
}
);
}

openModalNewContact() {
const modalRefContact = this.modalService.open(NewContactComponent, this.modalOptions);
let contact: ContactJsonld = {} as ContactJsonld;
contact.partner = this.partner.id ?? null;
modalRefContact.componentInstance.contact = contact;
modalRefContact.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefContact.dismiss();
this.getContactsData();
}
});
}

navigateToContactDetails(element: any) {
const contact: ContactJsonld = element as ContactJsonld;
this.router.navigate(['/contacts', this.apiConverter.extractId(contact.id)]);
}

contactsHandlePageEvent(e: PageEvent) {
this.contactsPageEvent = e;
this.contactsLength = e.length;
this.contactsPageIndex = e.pageIndex.valueOf();
this.contactsPageSize = e.pageSize.valueOf();
this.getContactsData();
}
}

matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.html → matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html Ver ficheiro


matsen-tool/src/app/contacts/contacts.component.scss → matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.scss Ver ficheiro


matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.spec.ts → matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.spec.ts Ver ficheiro


matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.ts → matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts Ver ficheiro

@@ -4,13 +4,13 @@ import {Subscription} from "rxjs";
import {ActivatedRoute} from "@angular/router";
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
import {MatTableDataSource} from "@angular/material/table";
import {NewPostingComponent} from "@app/postings/new-posting/new-posting.component";
import {NewPostComponent} from "@app/_views/posts/new-post/new-post.component";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {NewContactComponent} from "@app/contacts/new-contact/new-contact.component";
import {NewContactComponent} from "@app/_views/contacts/new-contact/new-contact.component";
import {ModalStatus} from "@app/_helpers/modal.states";
import {User} from "@app/_models";
import {AccountService} from "@app/_services";
import {NewCommentComponent} from "@app/postings/new-comment/new-comment.component";
import {NewCommentComponent} from "@app/_views/posts/new-comment/new-comment.component";
import {ApiConverter} from "@app/_helpers/api.converter";
import {constructorParametersDownlevelTransform} from "@angular/compiler-cli";

@@ -100,6 +100,8 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
undefined,
undefined,
undefined,
undefined,
undefined,
false
).subscribe(
data => {
@@ -123,7 +125,7 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
}

openModalNewPosting() {
const modalRefPosting = this.modalService.open(NewPostingComponent, this.modalOptions);
const modalRefPosting = this.modalService.open(NewPostComponent, this.modalOptions);
let posting: PostJsonld = {} as PostJsonld;
posting.contact = this.contact.id ?? null;
posting.partner = this.contact.partner ?? null;
@@ -152,7 +154,7 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
}

openModalEditPosting(post: PostJsonld) {
const modalRefPostingEdit = this.modalService.open(NewPostingComponent, this.modalOptions);
const modalRefPostingEdit = this.modalService.open(NewPostComponent, this.modalOptions);
modalRefPostingEdit.componentInstance.posting = post;
modalRefPostingEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {

matsen-tool/src/app/contacts/contacts.component.html → matsen-tool/src/app/_views/contacts/contacts.component.html Ver ficheiro


matsen-tool/src/app/contacts/new-contact/new-contact.component.scss → matsen-tool/src/app/_views/contacts/contacts.component.scss Ver ficheiro


matsen-tool/src/app/contacts/contacts.component.spec.ts → matsen-tool/src/app/_views/contacts/contacts.component.spec.ts Ver ficheiro


matsen-tool/src/app/contacts/contacts.component.ts → matsen-tool/src/app/_views/contacts/contacts.component.ts Ver ficheiro


matsen-tool/src/app/contacts/new-contact/new-contact.component.html → matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.html Ver ficheiro


matsen-tool/src/app/documents/documents-detail/documents-detail.component.scss → matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.scss Ver ficheiro


matsen-tool/src/app/contacts/new-contact/new-contact.component.spec.ts → matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.spec.ts Ver ficheiro


matsen-tool/src/app/contacts/new-contact/new-contact.component.ts → matsen-tool/src/app/_views/contacts/new-contact/new-contact.component.ts Ver ficheiro


matsen-tool/src/app/documents/documents-detail/documents-detail.component.html → matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.html Ver ficheiro


matsen-tool/src/app/documents/documents.component.scss → matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.scss Ver ficheiro


matsen-tool/src/app/documents/documents-detail/documents-detail.component.spec.ts → matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.spec.ts Ver ficheiro


matsen-tool/src/app/documents/documents-detail/documents-detail.component.ts → matsen-tool/src/app/_views/documents/documents-detail/documents-detail.component.ts Ver ficheiro


matsen-tool/src/app/documents/documents.component.html → matsen-tool/src/app/_views/documents/documents.component.html Ver ficheiro


matsen-tool/src/app/documents/new-document/new-document.component.scss → matsen-tool/src/app/_views/documents/documents.component.scss Ver ficheiro


matsen-tool/src/app/documents/documents.component.spec.ts → matsen-tool/src/app/_views/documents/documents.component.spec.ts Ver ficheiro


matsen-tool/src/app/documents/documents.component.ts → matsen-tool/src/app/_views/documents/documents.component.ts Ver ficheiro

@@ -8,10 +8,10 @@ import {MatTableDataSource, MatTableModule} from "@angular/material/table";
import {OrderFilter} from "@app/_models/orderFilter";
import {DatePipe, NgIf} from "@angular/common";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {NewDocumentComponent} from "@app/documents/new-document/new-document.component";
import {NewDocumentComponent} from "@app/_views/documents/new-document/new-document.component";
import {TranslateModule} from "@ngx-translate/core";
import {ModalStatus} from "@app/_helpers/modal.states";
import {NewCommentComponent} from "@app/postings/new-comment/new-comment.component";
import {NewCommentComponent} from "@app/_views/posts/new-comment/new-comment.component";
import {ApiConverter} from "@app/_helpers/api.converter";

@Component({

matsen-tool/src/app/documents/new-document/new-document.component.html → matsen-tool/src/app/_views/documents/new-document/new-document.component.html Ver ficheiro


matsen-tool/src/app/partners/new-partner/new-partner.component.scss → matsen-tool/src/app/_views/documents/new-document/new-document.component.scss Ver ficheiro


matsen-tool/src/app/documents/new-document/new-document.component.spec.ts → matsen-tool/src/app/_views/documents/new-document/new-document.component.spec.ts Ver ficheiro


matsen-tool/src/app/documents/new-document/new-document.component.ts → matsen-tool/src/app/_views/documents/new-document/new-document.component.ts Ver ficheiro


matsen-tool/src/app/home/home.component.html → matsen-tool/src/app/_views/home/home.component.html Ver ficheiro


matsen-tool/src/app/home/home.component.scss → matsen-tool/src/app/_views/home/home.component.scss Ver ficheiro


matsen-tool/src/app/home/home.component.ts → matsen-tool/src/app/_views/home/home.component.ts Ver ficheiro

@@ -15,9 +15,9 @@ import {
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {MatTableDataSource} from "@angular/material/table";
import {NewTaskComponent} from "@app/tasks/new-task/new-task.component";
import {NewTaskComponent} from "@app/_views/tasks/new-task/new-task.component";
import {ModalStatus} from "@app/_helpers/modal.states";
import {NewTaskNoteComponent} from "@app/tasks/new-task-note/new-task-note.component";
import {NewTaskNoteComponent} from "@app/_views/tasks/new-task-note/new-task-note.component";
import {ApiConverter} from "@app/_helpers/api.converter";

@Component({

matsen-tool/src/app/home/index.ts → matsen-tool/src/app/_views/home/index.ts Ver ficheiro


matsen-tool/src/app/partners/new-partner/new-partner.component.html → matsen-tool/src/app/_views/partners/new-partner/new-partner.component.html Ver ficheiro


matsen-tool/src/app/partners/partners-detail/partners-detail.component.scss → matsen-tool/src/app/_views/partners/new-partner/new-partner.component.scss Ver ficheiro


matsen-tool/src/app/partners/new-partner/new-partner.component.spec.ts → matsen-tool/src/app/_views/partners/new-partner/new-partner.component.spec.ts Ver ficheiro


matsen-tool/src/app/partners/new-partner/new-partner.component.ts → matsen-tool/src/app/_views/partners/new-partner/new-partner.component.ts Ver ficheiro


matsen-tool/src/app/partners/partners-detail/partners-detail.component.html → matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.html Ver ficheiro

@@ -1,5 +1,5 @@
<div class="spt-container">
<div class="card">
<div *ngIf="partner" class="card">
<div class="card-body row">
<div class="col-4">
<h1>{{ partner.name }}</h1>
@@ -55,44 +55,7 @@
</div>
</div>
<app-toggle #toggleContacts [headline]="'basic.contacts' | translate">
<div class="spt-container">
<div class="contacts position-relative">
<button class="btn btn-primary toggle-btn" (click)="openModalNewContact()">{{ 'basic.new-contact' | translate }}
</button>
<div class="row">
<div class="col-4" *ngFor="let contact of contacts">
<div class="card">
<div class="card-body row">
<div class="col-8">
<h2>{{ contact.firstName }} {{ contact.lastName }}</h2>
<p><a href="mailto:{{contact.email}}">{{ contact.email }}</a><br/>
{{ contact.phone }}<br/>
{{ contact.position }}</p>
</div>
<div class="col-4">
<img *ngIf="contact.imageUrl !== null && contact.imageUrl !== undefined"
ngSrc="{{contact.imageUrl}}" width="247" height="94"
alt="{{contact.firstName}} {{contact.lastName}}"
title="{{contact.firstName}} {{contact.lastName}}"/>
</div>
</div>
</div>
<div class="d-flex justify-content-end mt-1 mb-4">
<span role="button" (click)="navigateToContactDetails(contact)"
class="badge bg-secondary p-2">{{ 'basic.details' | translate }}</span>
</div>
</div>
</div>
<mat-paginator *ngIf="contacts.length > 0" class="rounded-1"
[pageSizeOptions]="[6,12,18]"
[length]="contactsLength"
(page)="contactsHandlePageEvent($event)"
[pageSize]="contactsPageSize"
[pageIndex]="contactsPageIndex"
showFirstLastButtons>
</mat-paginator>
</div>
</div>
<app-contact-list *ngIf="partner" #contactsComponent [partner]="partner"></app-contact-list>
</app-toggle>

<app-toggle #toggleTasks [headline]="'basic.tasks' | translate">
@@ -156,61 +119,5 @@
</div>
</app-toggle>
<app-toggle #togglePosts [headline]="'basic.posts' | translate">
<div class="spt-container">
<div class="posts position-relative">
<button class="btn btn-primary toggle-btn" (click)="openModalNewPosting()">{{ 'basic.new-post' | translate }}</button>
<div class="post mb-3" *ngFor="let post of posts">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<p>{{ post.createdAt | date:'dd.MM.YYYY' }}</p>
<p>{{ post.ownerName }}</p>
</div>
<div>
<h3>{{ post.headline }}</h3>
<p class="m-0" [innerHTML]="apiConverter.getSafeLongtext(post.message)"></p>
</div>
<span *ngIf="post.owner === user?.id" class="position-absolute bi bi-pencil p-2"
data-type="user-tool"
data-action="edit" (click)="openModalEditPosting(post)"></span>
</div>
</div>
<div *ngIf="post.id && commentsVisibility.get(post.id)">
<div class="card ms-5" *ngFor="let comment of post.comments">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<p>{{ comment.createdAt | date:'dd.MM.YYYY' }}</p>
<p>{{ comment.ownerName }}</p>
</div>
<div>
<p class="m-0" [innerHTML]="apiConverter.getSafeLongtext(comment.message)"></p>
</div>
<span *ngIf="comment.owner === user?.id" class="position-absolute bi bi-pencil p-2"
data-type="user-tool" data-action="edit" (click)="openModalEditComment(comment)"></span>
</div>
</div>
</div>

<div class="d-flex justify-content-end mt-1">
<span *ngIf="post.comments?.length !== 0" role="button" class="badge bg-secondary p-2 me-2"
(click)="showComments(post)">
<ng-container
*ngIf="post.id && commentsVisibility.get(post.id)">{{ 'basic.hide-comments' | translate }}</ng-container>
<ng-container
*ngIf="post.id && !commentsVisibility.get(post.id)">{{ 'basic.show-comments' | translate }}</ng-container>
</span>
<span role="button" class="badge bg-secondary p-2"
(click)="openModalNewComment(post)">{{ 'basic.comment-it' | translate }}</span>
</div>
</div>
<mat-paginator *ngIf="posts.length > 0" class="rounded-1"
[pageSizeOptions]="[10,20,30]"
[length]="postsLength"
(page)="postsHandlePageEvent($event)"
[pageSize]="postsPageSize"
[pageIndex]="postsPageIndex"
showFirstLastButtons>
</mat-paginator>
</div>
</div>
<app-post-list *ngIf="partner" #postsComponent [partner]="partner" [existsContact]="false" [existsSale]="false"></app-post-list>
</app-toggle>

matsen-tool/src/app/partners/partners.component.scss → matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.scss Ver ficheiro


matsen-tool/src/app/partners/partners-detail/partners-detail.component.spec.ts → matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.spec.ts Ver ficheiro


matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts → matsen-tool/src/app/_views/partners/partners-detail/partners-detail.component.ts Ver ficheiro

@@ -1,30 +1,25 @@
import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {NewContactComponent} from "@app/contacts/new-contact/new-contact.component";
import {ActivatedRoute, Router} from "@angular/router";
import {
CommentJsonld,
ContactJsonld,
ContactService, PartnerFollowJsonld, PartnerFollowService,
PartnerFollowJsonld, PartnerFollowService,
PartnerJsonld, PartnerProductJsonld, PartnerProductService,
PartnerService,
PostJsonld,
PostService, TaskJsonld, TaskNoteJsonld, TaskService
PartnerService, TaskJsonld, TaskNoteJsonld, TaskService
} from "@app/core/api/v1";
import {Subscription} from "rxjs";
import {environment} from "@environments/environment";
import {ApiConverter} from "@app/_helpers/api.converter";
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
import {MatTableDataSource} from "@angular/material/table";
import {NewPostingComponent} from "@app/postings/new-posting/new-posting.component";
import {NewTaskComponent} from "@app/tasks/new-task/new-task.component";
import {NewTaskComponent} from "@app/_views/tasks/new-task/new-task.component";
import {ModalStatus} from "@app/_helpers/modal.states";
import {AccountService} from "@app/_services";
import {User} from "@app/_models";
import {NewCommentComponent} from "@app/postings/new-comment/new-comment.component";
import {NewPartnerComponent} from "@app/partners/new-partner/new-partner.component";
import {NewTaskNoteComponent} from "@app/tasks/new-task-note/new-task-note.component";
import {NewPartnerComponent} from "@app/_views/partners/new-partner/new-partner.component";
import {NewTaskNoteComponent} from "@app/_views/tasks/new-task-note/new-task-note.component";
import {ToggleComponent} from "@app/_components/toggle/toggle.component";
import {PostListComponent} from "@app/_views/posts/post-list/post-list.component";
import {ContactListComponent} from "@app/_views/contacts/contact-list/contact-list.component";

@Component({
selector: 'app-partners-detail',
@@ -33,11 +28,14 @@ import {ToggleComponent} from "@app/_components/toggle/toggle.component";
})
export class PartnersDetailComponent implements OnInit, AfterViewInit {
@ViewChild("toggleContacts", { static: true }) toggleContacts: ToggleComponent = new ToggleComponent();
@ViewChild("contactsComponent", { static: false }) contactsComponent!: ContactListComponent;

@ViewChild("toggleTasks", { static: true }) toggleTasks: ToggleComponent = new ToggleComponent();

@ViewChild("togglePosts", { static: true }) togglePosts: ToggleComponent = new ToggleComponent();
@ViewChild(MatPaginator) contactsPaginator: MatPaginator;
@ViewChild("postsComponent", { static: false }) postsComponent!: PostListComponent;

@ViewChild(MatPaginator) tasksPaginator: MatPaginator;
@ViewChild(MatPaginator) postsPaginator: MatPaginator;

protected user: User | null;

@@ -45,7 +43,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
protected id: string;

protected partnerDetailSub: Subscription;
protected partner: PartnerJsonld;
protected partner!: PartnerJsonld;

protected partnerProductSub: Subscription;
protected partnerProducts: Array<PartnerProductJsonld>;
@@ -53,14 +51,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
protected partnerFollowSub: Subscription;
protected partnerFollow: PartnerFollowJsonld | null;

protected contactsSub: Subscription;
protected contacts: Array<ContactJsonld>;
protected contactsDataSource;
protected contactsLength: number;
protected contactsPageEvent: PageEvent;
protected contactsPageSize: number;
protected contactsPageIndex: number;

protected tasksSub: Subscription;
protected tasks: Array<TaskJsonld>;
protected tasksDataSource;
@@ -70,15 +60,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
protected tasksPageIndex: number;

protected taskNotesVisibility: Map<string, boolean>;
protected commentsVisibility: Map<string, boolean>;

protected postsSub: Subscription;
protected posts: Array<PostJsonld>;
protected postsDataSource;
protected postsLength: number;
protected postsPageEvent: PageEvent;
protected postsPageSize: number;
protected postsPageIndex: number;

protected modalOptions: NgbModalOptions = {
centered: true
@@ -92,14 +73,12 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
private partnerService: PartnerService,
private partnerProductService: PartnerProductService,
private partnerFollowService: PartnerFollowService,
private contactService: ContactService,
private postService: PostService,
private taskService: TaskService,
protected apiConverter: ApiConverter
) {
this.id = "";
this.partnerDetailSub = new Subscription();
this.partner = {} as PartnerJsonld;
//this.partner = {} as PartnerJsonld;

this.partnerProductSub = new Subscription();
this.partnerProducts = [];
@@ -109,15 +88,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {

this.user = this.accountService.userValue;

this.contactsSub = new Subscription();
this.contacts = [];
this.contactsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
this.contactsDataSource = new MatTableDataSource<ContactJsonld>(this.contacts);
this.contactsLength = 0;
this.contactsPageEvent = new PageEvent();
this.contactsPageSize = 6;
this.contactsPageIndex = 0;

this.tasksSub = new Subscription();
this.tasks = [];
this.tasksPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
@@ -127,16 +97,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
this.tasksPageSize = 10;
this.tasksPageIndex = 0;
this.taskNotesVisibility = new Map<string, boolean>();

this.postsSub = new Subscription();
this.posts = [];
this.postsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
this.postsDataSource = new MatTableDataSource<PostJsonld>(this.posts);
this.postsLength = 0;
this.postsPageEvent = new PageEvent();
this.postsPageSize = 10;
this.postsPageIndex = 0;
this.commentsVisibility = new Map<string, boolean>();
}

ngOnInit() {
@@ -145,16 +105,15 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
});
this.getPartnerData();
this.getPartnerProducts();
this.getContactsData();
this.getPostsData();
this.getTasksData();
this.getPartnerFollowedStatus();

console.log('ng init done');
}

ngAfterViewInit() {
this.contactsDataSource.paginator = this.contactsPaginator;
console.log('ng after view init');
this.tasksDataSource.paginator = this.tasksPaginator;
this.postsDataSource.paginator = this.postsPaginator;
}

getPartnerData() {
@@ -163,59 +122,20 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
).subscribe(
data => {
this.partner = data;
console.log('getPartnerData done');
}
);
}

getPartnerProducts() {
this.partnerProductSub = this.partnerProductService.partnerProductsGetCollection(
this.contactsPageIndex + 1,
this.contactsPageSize,
1,
50,
this.id
).subscribe(
data => {
this.partnerProducts = data["hydra:member"];
}
);
}

getContactsData() {
this.contactsSub = this.contactService.contactsGetCollection(
this.contactsPageIndex + 1,
this.contactsPageSize,
this.id
).subscribe(
data => {
this.contacts = data["hydra:member"];
this.contactsLength = Number(data["hydra:totalItems"]);
if (this.contactsPaginator !== undefined) {
this.contactsPaginator.length = this.contactsLength;
}
}
);
}

getPostsData() {
this.postsSub = this.postService.postsGetCollection(
this.postsPageIndex + 1,
this.postsPageSize,
this.id,
undefined,
undefined,
undefined,
undefined,
undefined,
false,
false
).subscribe(
data => {
this.posts = data["hydra:member"];
this.postsLength = Number(data["hydra:totalItems"]);
this.posts.forEach(posts => {
if (posts.id) {
this.commentsVisibility.set(posts.id, false);
}
});
console.log('getPartnerProducts done');
}
);
}
@@ -237,18 +157,11 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
this.taskNotesVisibility.set(task.id, false);
}
});
console.log('getTasksData done');
}
);
}

contactsHandlePageEvent(e: PageEvent) {
this.contactsPageEvent = e;
this.contactsLength = e.length;
this.contactsPageIndex = e.pageIndex.valueOf();
this.contactsPageSize = e.pageSize.valueOf();
this.getContactsData();
}

tasksHandlePageEvent(e: PageEvent) {
this.tasksPageEvent = e;
this.tasksLength = e.length;
@@ -257,31 +170,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
this.getTasksData();
}

postsHandlePageEvent(e: PageEvent) {
this.postsPageEvent = e;
this.postsLength = e.length;
this.postsPageIndex = e.pageIndex.valueOf();
this.postsPageSize = e.pageSize.valueOf();
this.getPostsData();
}

navigateToContactDetails(element: any) {
const contact: ContactJsonld = element as ContactJsonld;
this.router.navigate(['/contacts', this.apiConverter.extractId(contact.id)]);
}

openModalNewContact() {
const modalRefContact = this.modalService.open(NewContactComponent, this.modalOptions);
let contact: ContactJsonld = {} as ContactJsonld;
contact.partner = this.partner.id ?? null;
modalRefContact.componentInstance.contact = contact;
modalRefContact.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefContact.dismiss();
this.getContactsData();
}
});
}

openModalNewTask() {
const modalRefTask = this.modalService.open(NewTaskComponent, this.modalOptions);
@@ -310,32 +198,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
});
}

openModalNewPosting() {
const modalRefPosting = this.modalService.open(NewPostingComponent, this.modalOptions);
let posting: PostJsonld = {} as PostJsonld;
posting.partner = this.partner.id ?? null;
modalRefPosting.componentInstance.posting = posting;
modalRefPosting.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefPosting.dismiss();
this.getPostsData();
}
});
}

openModalNewComment(post: PostJsonld) {
const modalRefComment = this.modalService.open(NewCommentComponent, this.modalOptions);
let comment: CommentJsonld = {} as CommentJsonld;
comment.post = post.id ?? null;
modalRefComment.componentInstance.comment = comment;
modalRefComment.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefComment.dismiss();
this.getPostsData();
}
});
}

openModalEditTask(task: TaskJsonld) {
const modalRefTaskEdit = this.modalService.open(NewTaskComponent, this.modalOptions);
modalRefTaskEdit.componentInstance.task = task;
@@ -359,28 +221,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
});
}

openModalEditPosting(post: PostJsonld) {
const modalRefPostingEdit = this.modalService.open(NewPostingComponent, this.modalOptions);
modalRefPostingEdit.componentInstance.posting = post;
modalRefPostingEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefPostingEdit.dismiss();
this.getPostsData();
}
});
}

openModalEditComment(comment: CommentJsonld) {
const modalRefComment = this.modalService.open(NewCommentComponent, this.modalOptions);
modalRefComment.componentInstance.comment = comment;
modalRefComment.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefComment.dismiss();
this.getPostsData();
}
});
}

openModalEditPartner() {
const modalRef = this.modalService.open(NewPartnerComponent, this.modalOptions);
modalRef.componentInstance.partner = this.partner;
@@ -399,13 +239,6 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit {
}
}

showComments(post: PostJsonld) {
if (post.id) {
const currentVisibility = this.commentsVisibility.get(post.id);
this.commentsVisibility.set(post.id, !currentVisibility);
}
}

getPartnerFollowedStatus() {
this.partnerFollowSub = this.partnerFollowService.partnerFollowsGetCollection(
1,

matsen-tool/src/app/partners/partners.component.html → matsen-tool/src/app/_views/partners/partners.component.html Ver ficheiro


matsen-tool/src/app/postings/new-comment/new-comment.component.scss → matsen-tool/src/app/_views/partners/partners.component.scss Ver ficheiro


matsen-tool/src/app/partners/partners.component.spec.ts → matsen-tool/src/app/_views/partners/partners.component.spec.ts Ver ficheiro


matsen-tool/src/app/partners/partners.component.ts → matsen-tool/src/app/_views/partners/partners.component.ts Ver ficheiro

@@ -9,7 +9,7 @@ import {OrderFilter} from "@app/_models/orderFilter";
import {ApiConverter} from "@app/_helpers/api.converter";
import {NgIf} from "@angular/common";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {NewPartnerComponent} from "@app/partners/new-partner/new-partner.component";
import {NewPartnerComponent} from "@app/_views/partners/new-partner/new-partner.component";
import {TranslateModule, TranslateService} from "@ngx-translate/core";
import {ModalStatus} from "@app/_helpers/modal.states";
import TypeEnum = PartnerJsonld.PartnerTypeEnum;

matsen-tool/src/app/postings/new-comment/new-comment.component.html → matsen-tool/src/app/_views/posts/new-comment/new-comment.component.html Ver ficheiro


matsen-tool/src/app/postings/new-posting/new-posting.component.scss → matsen-tool/src/app/_views/posts/new-comment/new-comment.component.scss Ver ficheiro


matsen-tool/src/app/postings/new-comment/new-comment.component.spec.ts → matsen-tool/src/app/_views/posts/new-comment/new-comment.component.spec.ts Ver ficheiro


matsen-tool/src/app/postings/new-comment/new-comment.component.ts → matsen-tool/src/app/_views/posts/new-comment/new-comment.component.ts Ver ficheiro


matsen-tool/src/app/postings/new-posting/new-posting.component.html → matsen-tool/src/app/_views/posts/new-post/new-post.component.html Ver ficheiro


matsen-tool/src/app/postings/postings.component.scss → matsen-tool/src/app/_views/posts/new-post/new-post.component.scss Ver ficheiro


+ 23
- 0
matsen-tool/src/app/_views/posts/new-post/new-post.component.spec.ts Ver ficheiro

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { NewPostComponent } from './new-post.component';

describe('NewPostComponent', () => {
let component: NewPostComponent;
let fixture: ComponentFixture<NewPostComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [NewPostComponent]
})
.compileComponents();
fixture = TestBed.createComponent(NewPostComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

matsen-tool/src/app/postings/new-posting/new-posting.component.ts → matsen-tool/src/app/_views/posts/new-post/new-post.component.ts Ver ficheiro

@@ -8,11 +8,11 @@ import {ApiConverter} from "@app/_helpers/api.converter";
import {Subscription} from "rxjs";

@Component({
selector: 'app-new-posting',
templateUrl: './new-posting.component.html',
styleUrl: './new-posting.component.scss'
selector: 'app-new-post',
templateUrl: './new-post.component.html',
styleUrl: './new-post.component.scss'
})
export class NewPostingComponent implements OnInit {
export class NewPostComponent implements OnInit {
@Input() public posting!: PostJsonld;
@Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>();


+ 57
- 0
matsen-tool/src/app/_views/posts/post-list/post-list.component.html Ver ficheiro

@@ -0,0 +1,57 @@
<div class="spt-container">
<div class="posts position-relative">
<button class="btn btn-primary toggle-btn" (click)="openModalNewPosting()">{{ 'basic.new-post' | translate }}</button>
<div class="post mb-3" *ngFor="let post of posts">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<p>{{ post.createdAt | date:'dd.MM.YYYY' }}</p>
<p>{{ post.ownerName }}</p>
</div>
<div>
<h3>{{ post.headline }}</h3>
<p class="m-0" [innerHTML]="apiConverter.getSafeLongtext(post.message)"></p>
</div>
<span *ngIf="post.owner === user?.id" class="position-absolute bi bi-pencil p-2"
data-type="user-tool"
data-action="edit" (click)="openModalEditPosting(post)"></span>
</div>
</div>
<div *ngIf="post.id && commentsVisibility.get(post.id)">
<div class="card ms-5" *ngFor="let comment of post.comments">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<p>{{ comment.createdAt | date:'dd.MM.YYYY' }}</p>
<p>{{ comment.ownerName }}</p>
</div>
<div>
<p class="m-0" [innerHTML]="apiConverter.getSafeLongtext(comment.message)"></p>
</div>
<span *ngIf="comment.owner === user?.id" class="position-absolute bi bi-pencil p-2"
data-type="user-tool" data-action="edit" (click)="openModalEditComment(comment)"></span>
</div>
</div>
</div>

<div class="d-flex justify-content-end mt-1">
<span *ngIf="post.comments?.length !== 0" role="button" class="badge bg-secondary p-2 me-2"
(click)="showComments(post)">
<ng-container
*ngIf="post.id && commentsVisibility.get(post.id)">{{ 'basic.hide-comments' | translate }}</ng-container>
<ng-container
*ngIf="post.id && !commentsVisibility.get(post.id)">{{ 'basic.show-comments' | translate }}</ng-container>
</span>
<span role="button" class="badge bg-secondary p-2"
(click)="openModalNewComment(post)">{{ 'basic.comment-it' | translate }}</span>
</div>
</div>
<mat-paginator *ngIf="posts.length > 0" class="rounded-1"
[pageSizeOptions]="this.pageSizeOptions"
[length]="dataLength"
(page)="handlePageEvent($event)"
[pageSize]="pageSize"
[pageIndex]="pageIndex"
showFirstLastButtons>
</mat-paginator>
</div>
</div>

matsen-tool/src/app/products/new-product/new-product.component.scss → matsen-tool/src/app/_views/posts/post-list/post-list.component.scss Ver ficheiro


+ 23
- 0
matsen-tool/src/app/_views/posts/post-list/post-list.component.spec.ts Ver ficheiro

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { PostListComponent } from './post-list.component';

describe('PostsComponent', () => {
let component: PostListComponent;
let fixture: ComponentFixture<PostListComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PostListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(PostListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 161
- 0
matsen-tool/src/app/_views/posts/post-list/post-list.component.ts Ver ficheiro

@@ -0,0 +1,161 @@
import {AfterViewInit, ChangeDetectorRef, Component, Input, OnInit, ViewChild} from '@angular/core';
import {Subscription} from "rxjs";
import {
CommentJsonld,
ContactJsonld,
PartnerJsonld,
PartnerProductJsonld, PartnerProductService,
PostJsonld,
PostService,
SaleJsonld, UserJsonld
} from "@app/core/api/v1";
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
import {MatTableDataSource} from "@angular/material/table";
import {NewPostComponent} from "@app/_views/posts/new-post/new-post.component";
import {ModalStatus} from "@app/_helpers/modal.states";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {ApiConverter} from "@app/_helpers/api.converter";
import {NewCommentComponent} from "@app/_views/posts/new-comment/new-comment.component";
import {ListComponent} from "@app/_components/list/list.component";

@Component({
selector: 'app-post-list',
templateUrl: './post-list.component.html',
styleUrl: './post-list.component.scss'
})
export class PostListComponent extends ListComponent implements OnInit, AfterViewInit {

@Input() public partner!: PartnerJsonld;
@Input() public contact!: ContactJsonld;
@Input() public sale!: SaleJsonld;
@Input() public user!: UserJsonld;
@Input() public existsContact!: boolean;
@Input() public existsSale!: boolean;

@ViewChild(MatPaginator) postsPaginator: MatPaginator;

protected postsSub: Subscription;
protected posts: Array<PostJsonld>;
protected partnerProductsSub: Subscription;
protected partnerProducts: Array<PartnerProductJsonld>;
protected postsDataSource;
protected postsLength: number;
protected postsPageEvent: PageEvent;
protected postsPageSize: number;
protected postsPageIndex: number;
protected commentsVisibility: Map<string, boolean>;

protected modalOptions: NgbModalOptions = {
centered: true
};

constructor(
private postService: PostService,
private partnerProductService: PartnerProductService,
private modalService: NgbModal,
protected apiConverter: ApiConverter
) {
super();
this.postsSub = new Subscription();
this.posts = [];
this.partnerProductsSub = new Subscription();
this.partnerProducts = [];
this.postsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype);
this.postsDataSource = new MatTableDataSource<PostJsonld>(this.posts);
this.postsLength = 0;
this.postsPageEvent = new PageEvent();
this.postsPageSize = 10;
this.postsPageIndex = 0;
this.commentsVisibility = new Map<string, boolean>();
}

ngOnInit() {
this.getData();
}

ngAfterViewInit() {
this.postsDataSource.paginator = this.postsPaginator;
}

override getData() {
this.postsSub = this.postService.postsGetCollection(
this.postsPageIndex + 1,
this.postsPageSize,
this.partner !== undefined ? this.partner.id : undefined,
undefined,
this.contact !== undefined ? this.contact.id : undefined,
undefined,
this.sale !== undefined ? this.sale.id : undefined,
undefined,
this.user !== undefined ? this.user.id : undefined,
undefined,
this.existsContact !== undefined ? this.existsContact : undefined,
this.existsSale !== undefined ? this.existsContact : undefined
).subscribe(
data => {
this.posts = data["hydra:member"];
this.postsLength = Number(data["hydra:totalItems"]);
this.posts.forEach(posts => {
if (posts.id) {
this.commentsVisibility.set(posts.id, false);
}
});
}
);
}

showComments(post: PostJsonld) {
if (post.id) {
const currentVisibility = this.commentsVisibility.get(post.id);
this.commentsVisibility.set(post.id, !currentVisibility);
}
}

openModalNewPosting() {
const modalRefPosting = this.modalService.open(NewPostComponent, this.modalOptions);
let posting: PostJsonld = {} as PostJsonld;
posting.partner = this.partner.id ?? null;
modalRefPosting.componentInstance.posting = posting;
modalRefPosting.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefPosting.dismiss();
this.getData();
}
});
}

openModalEditPosting(post: PostJsonld) {
const modalRefPostingEdit = this.modalService.open(NewPostComponent, this.modalOptions);
modalRefPostingEdit.componentInstance.posting = post;
modalRefPostingEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefPostingEdit.dismiss();
this.getData();
}
});
}

openModalEditComment(comment: CommentJsonld) {
const modalRefComment = this.modalService.open(NewCommentComponent, this.modalOptions);
modalRefComment.componentInstance.comment = comment;
modalRefComment.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefComment.dismiss();
this.getData();
}
});
}

openModalNewComment(post: PostJsonld) {
const modalRefComment = this.modalService.open(NewCommentComponent, this.modalOptions);
let comment: CommentJsonld = {} as CommentJsonld;
comment.post = post.id ?? null;
modalRefComment.componentInstance.comment = comment;
modalRefComment.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {
modalRefComment.dismiss();
this.getData();
}
});
}
}

matsen-tool/src/app/postings/postings.component.html → matsen-tool/src/app/_views/posts/posts.component.html Ver ficheiro


matsen-tool/src/app/products/products-detail/products-detail.component.scss → matsen-tool/src/app/_views/posts/posts.component.scss Ver ficheiro


matsen-tool/src/app/postings/postings.component.spec.ts → matsen-tool/src/app/_views/posts/posts.component.spec.ts Ver ficheiro

@@ -1,18 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { PostingsComponent } from './postings.component';
import { PostsComponent } from './posts.component';

describe('PostingsComponent', () => {
let component: PostingsComponent;
let fixture: ComponentFixture<PostingsComponent>;
let component: PostsComponent;
let fixture: ComponentFixture<PostsComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PostingsComponent]
declarations: [PostsComponent]
})
.compileComponents();
fixture = TestBed.createComponent(PostingsComponent);
fixture = TestBed.createComponent(PostsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

+ 10
- 0
matsen-tool/src/app/_views/posts/posts.component.ts Ver ficheiro

@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-posts',
templateUrl: './posts.component.html',
styleUrl: './posts.component.scss'
})
export class PostsComponent {

}

matsen-tool/src/app/products/new-product/new-product.component.html → matsen-tool/src/app/_views/products/new-product/new-product.component.html Ver ficheiro


matsen-tool/src/app/products/products.component.scss → matsen-tool/src/app/_views/products/new-product/new-product.component.scss Ver ficheiro


matsen-tool/src/app/products/new-product/new-product.component.spec.ts → matsen-tool/src/app/_views/products/new-product/new-product.component.spec.ts Ver ficheiro


matsen-tool/src/app/products/new-product/new-product.component.ts → matsen-tool/src/app/_views/products/new-product/new-product.component.ts Ver ficheiro


matsen-tool/src/app/products/products-detail/products-detail.component.html → matsen-tool/src/app/_views/products/products-detail/products-detail.component.html Ver ficheiro


matsen-tool/src/app/profile/profile.component.scss → matsen-tool/src/app/_views/products/products-detail/products-detail.component.scss Ver ficheiro


matsen-tool/src/app/products/products-detail/products-detail.component.spec.ts → matsen-tool/src/app/_views/products/products-detail/products-detail.component.spec.ts Ver ficheiro


matsen-tool/src/app/products/products-detail/products-detail.component.ts → matsen-tool/src/app/_views/products/products-detail/products-detail.component.ts Ver ficheiro

@@ -10,7 +10,7 @@ import {
} from "@app/core/api/v1";
import {ModalStatus} from "@app/_helpers/modal.states";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {NewProductComponent} from "@app/products/new-product/new-product.component";
import {NewProductComponent} from "@app/_views/products/new-product/new-product.component";
import {User} from "@app/_models";
import {AccountService} from "@app/_services";
import {ApiConverter} from "@app/_helpers/api.converter";

matsen-tool/src/app/products/products.component.html → matsen-tool/src/app/_views/products/products.component.html Ver ficheiro


matsen-tool/src/app/sales/new-sale/new-sale.component.scss → matsen-tool/src/app/_views/products/products.component.scss Ver ficheiro


matsen-tool/src/app/products/products.component.spec.ts → matsen-tool/src/app/_views/products/products.component.spec.ts Ver ficheiro


matsen-tool/src/app/products/products.component.ts → matsen-tool/src/app/_views/products/products.component.ts Ver ficheiro

@@ -9,7 +9,7 @@ import {Router, RouterLink, RouterLinkActive} from "@angular/router";
import {NgIf} from "@angular/common";
import {Subscription} from "rxjs";
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {NewProductComponent} from "@app/products/new-product/new-product.component";
import {NewProductComponent} from "@app/_views/products/new-product/new-product.component";
import {ModalStatus} from "@app/_helpers/modal.states";
import {TranslateModule} from "@ngx-translate/core";


matsen-tool/src/app/profile/profile.component.html → matsen-tool/src/app/_views/profile/profile.component.html Ver ficheiro

@@ -10,4 +10,4 @@
</div>
</div>
</div>
</div>
</div>

matsen-tool/src/app/sales/sales-detail/sales-detail.component.scss → matsen-tool/src/app/_views/profile/profile.component.scss Ver ficheiro


matsen-tool/src/app/profile/profile.component.spec.ts → matsen-tool/src/app/_views/profile/profile.component.spec.ts Ver ficheiro


matsen-tool/src/app/profile/profile.component.ts → matsen-tool/src/app/_views/profile/profile.component.ts Ver ficheiro


matsen-tool/src/app/sales/new-sale/new-sale.component.html → matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html Ver ficheiro


matsen-tool/src/app/sales/sales.component.scss → matsen-tool/src/app/_views/sales/new-sale/new-sale.component.scss Ver ficheiro


matsen-tool/src/app/sales/new-sale/new-sale.component.spec.ts → matsen-tool/src/app/_views/sales/new-sale/new-sale.component.spec.ts Ver ficheiro


matsen-tool/src/app/sales/new-sale/new-sale.component.ts → matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts Ver ficheiro


matsen-tool/src/app/sales/sales-detail/sales-detail.component.html → matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.html Ver ficheiro


matsen-tool/src/app/tasks/new-task-note/new-task-note.component.scss → matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.scss Ver ficheiro


matsen-tool/src/app/sales/sales-detail/sales-detail.component.spec.ts → matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.spec.ts Ver ficheiro


matsen-tool/src/app/sales/sales-detail/sales-detail.component.ts → matsen-tool/src/app/_views/sales/sales-detail/sales-detail.component.ts Ver ficheiro

@@ -6,11 +6,11 @@ import {CommentJsonld, ContactJsonld, PostJsonld, PostService, SaleJsonld, SaleS
import {NgbModal, NgbModalOptions} from "@ng-bootstrap/ng-bootstrap";
import {User} from "@app/_models";
import {AccountService} from "@app/_services";
import {NewPostingComponent} from "@app/postings/new-posting/new-posting.component";
import {NewPostComponent} from "@app/_views/posts/new-post/new-post.component";
import {ModalStatus} from "@app/_helpers/modal.states";
import {NewCommentComponent} from "@app/postings/new-comment/new-comment.component";
import {NewContactComponent} from "@app/contacts/new-contact/new-contact.component";
import {NewSaleComponent} from "@app/sales/new-sale/new-sale.component";
import {NewCommentComponent} from "@app/_views/posts/new-comment/new-comment.component";
import {NewContactComponent} from "@app/_views/contacts/new-contact/new-contact.component";
import {NewSaleComponent} from "@app/_views/sales/new-sale/new-sale.component";
import {ActivatedRoute} from "@angular/router";
import {ApiConverter} from "@app/_helpers/api.converter";

@@ -100,6 +100,8 @@ export class SalesDetailComponent implements OnInit, AfterViewInit {
this.id,
undefined,
undefined,
undefined,
undefined,
true
).subscribe(
data => {
@@ -124,7 +126,7 @@ export class SalesDetailComponent implements OnInit, AfterViewInit {
}

openModalNewPosting() {
const modalRefPosting = this.modalService.open(NewPostingComponent, this.modalOptions);
const modalRefPosting = this.modalService.open(NewPostComponent, this.modalOptions);
let posting: PostJsonld = {} as PostJsonld;
posting.sale = this.sale.id ?? null;
posting.partner = this.sale.partner ?? null;
@@ -152,7 +154,7 @@ export class SalesDetailComponent implements OnInit, AfterViewInit {
}

openModalEditPosting(post: PostJsonld) {
const modalRefPostingEdit = this.modalService.open(NewPostingComponent, this.modalOptions);
const modalRefPostingEdit = this.modalService.open(NewPostComponent, this.modalOptions);
modalRefPostingEdit.componentInstance.posting = post;
modalRefPostingEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
if (modalStatus === ModalStatus.Submitted) {

matsen-tool/src/app/sales/sales.component.html → matsen-tool/src/app/_views/sales/sales.component.html Ver ficheiro


Alguns ficheiros não foram mostrados porque foram alterados demasiados ficheiros neste diff

Carregando…
Cancelar
Guardar