| @@ -140,6 +140,7 @@ export const mediaObjectJsonldMediaObjectReadForm = new FormGroup({ | |||
| export const partnerForm = new FormGroup({ | |||
| name: new FormControl(null, [Validators.required]), | |||
| partnerType: new FormControl(null, [Validators.required]), | |||
| description: new FormControl(null, []), | |||
| street: new FormControl(null, []), | |||
| streetNo: new FormControl(null, []), | |||
| zip: new FormControl(null, []), | |||
| @@ -157,6 +158,7 @@ export const partnerJsonhalForm = new FormGroup({ | |||
| _links: new FormControl(null, []), | |||
| name: new FormControl(null, [Validators.required]), | |||
| partnerType: new FormControl(null, [Validators.required]), | |||
| description: new FormControl(null, []), | |||
| street: new FormControl(null, []), | |||
| streetNo: new FormControl(null, []), | |||
| zip: new FormControl(null, []), | |||
| @@ -173,6 +175,7 @@ export const partnerJsonhalForm = new FormGroup({ | |||
| export const partnerJsonldForm = new FormGroup({ | |||
| name: new FormControl(null, [Validators.required]), | |||
| partnerType: new FormControl(null, [Validators.required]), | |||
| description: new FormControl(null, []), | |||
| street: new FormControl(null, []), | |||
| streetNo: new FormControl(null, []), | |||
| zip: new FormControl(null, []), | |||
| @@ -307,6 +310,7 @@ export const saleForm = new FormGroup({ | |||
| owner: new FormControl(null, []), | |||
| ownerName: new FormControl(null, []), | |||
| partner: new FormControl(null, []), | |||
| partnerType: new FormControl(null, []), | |||
| partnerName: new FormControl(null, []), | |||
| product: new FormControl(null, []), | |||
| productName: new FormControl(null, []), | |||
| @@ -322,6 +326,7 @@ export const saleJsonhalForm = new FormGroup({ | |||
| owner: new FormControl(null, []), | |||
| ownerName: new FormControl(null, []), | |||
| partner: new FormControl(null, []), | |||
| partnerType: new FormControl(null, []), | |||
| partnerName: new FormControl(null, []), | |||
| product: new FormControl(null, []), | |||
| productName: new FormControl(null, []), | |||
| @@ -336,6 +341,7 @@ export const saleJsonldForm = new FormGroup({ | |||
| owner: new FormControl(null, []), | |||
| ownerName: new FormControl(null, []), | |||
| partner: new FormControl(null, []), | |||
| partnerType: new FormControl(null, []), | |||
| partnerName: new FormControl(null, []), | |||
| product: new FormControl(null, []), | |||
| productName: new FormControl(null, []), | |||
| @@ -11,10 +11,12 @@ export class ApiConverter { | |||
| return ""; | |||
| } | |||
| public static convertDate(dateString: string | null) { | |||
| public static convertDate(dateString: string | null, withTime = false) { | |||
| // number 10 for input date (2024-03-15) | |||
| // number 16 for input datetime-local (2024-04-28T03:22) | |||
| if (dateString !== null) { | |||
| const date = new Date(dateString); | |||
| return date.toISOString().slice(0, 16); | |||
| return date.toISOString().slice(0, withTime ? 16 : 10); | |||
| } | |||
| return ""; | |||
| } | |||
| @@ -34,7 +34,7 @@ | |||
| <div class="card"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>{{ post.createdAt | date:'dd.MM.YYYY HH:mm' }}</p> | |||
| <p>{{ post.createdAt | date:'dd.MM.YYYY' }}</p> | |||
| <p>{{ post.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| @@ -49,7 +49,7 @@ | |||
| <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 HH:mm' }}</p> | |||
| <p>{{ comment.createdAt | date:'dd.MM.YYYY' }}</p> | |||
| <p>{{ comment.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| @@ -1,6 +1,5 @@ | |||
| import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core'; | |||
| import {environment} from "@environments/environment"; | |||
| import {CommentJsonld, ContactJsonld, ContactService, PartnerJsonld, PostJsonld, PostService} from "@app/core/api/v1"; | |||
| import {CommentJsonld, ContactJsonld, ContactService, PostJsonld, PostService} from "@app/core/api/v1"; | |||
| import {Subscription} from "rxjs"; | |||
| import {ActivatedRoute} from "@angular/router"; | |||
| import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator"; | |||
| @@ -12,6 +11,7 @@ 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 {ApiConverter} from "@app/_helpers/api.converter"; | |||
| @Component({ | |||
| selector: 'app-contacts-detail', | |||
| @@ -23,9 +23,8 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { | |||
| protected user: User | null; | |||
| protected readonly environment = environment; | |||
| protected contact: ContactJsonld; | |||
| protected id: string; | |||
| protected contact: ContactJsonld; | |||
| protected contactSub: Subscription; | |||
| protected postsSub: Subscription; | |||
| @@ -52,7 +51,6 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { | |||
| this.id = ""; | |||
| this.contact = {} as ContactJsonld; | |||
| this.contactSub = new Subscription(); | |||
| this.postsSub = new Subscription(); | |||
| @@ -95,7 +93,12 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { | |||
| this.postsPageSize, | |||
| this.contact.partner + '', | |||
| [], | |||
| this.id | |||
| this.id, | |||
| undefined, | |||
| undefined, | |||
| undefined, | |||
| undefined, | |||
| false | |||
| ).subscribe( | |||
| data => { | |||
| this.posts = data["hydra:member"]; | |||
| @@ -167,11 +170,14 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { | |||
| } | |||
| openModalEditContact() { | |||
| const modalRef = this.modalService.open(NewContactComponent, this.modalOptions); | |||
| modalRef.componentInstance.contact = this.contact; | |||
| modalRef.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { | |||
| const modalRefContact = this.modalService.open(NewContactComponent, this.modalOptions); | |||
| modalRefContact.componentInstance.contact = this.contact; | |||
| if (this.contact.birthday !== undefined) { | |||
| modalRefContact.componentInstance.birthdayValue = ApiConverter.convertDate(this.contact.birthday); | |||
| } | |||
| modalRefContact.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { | |||
| if (modalStatus === ModalStatus.Submitted) { | |||
| modalRef.dismiss(); | |||
| modalRefContact.dismiss(); | |||
| this.getContactData(); | |||
| } | |||
| }); | |||
| @@ -20,7 +20,8 @@ | |||
| <div class="mb-3"> | |||
| <label for="birthday" class="form-label">{{'form.birthday' | translate}}:</label> | |||
| <input type="date" class="form-control" id="birthday" formControlName="birthday" /> | |||
| <input type="date" value="{{ birthdayValue }}" class="form-control" id="birthday" | |||
| (change)="onBirthdayChange($event)"/> | |||
| </div> | |||
| <div class="mb-3"> | |||
| @@ -15,7 +15,6 @@ import {ApiConverter} from "@app/_helpers/api.converter"; | |||
| styleUrl: './new-contact.component.scss' | |||
| }) | |||
| export class NewContactComponent implements OnInit { | |||
| @Input() public contact!: ContactJsonld; | |||
| @Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>(); | |||
| @@ -24,6 +23,8 @@ export class NewContactComponent implements OnInit { | |||
| protected contactSub: Subscription; | |||
| protected mediaSub: Subscription; | |||
| protected birthdayValue: string; | |||
| constructor( | |||
| private contactService: ContactService, | |||
| private mediaObjectService: MediaObjectService, | |||
| @@ -34,12 +35,23 @@ export class NewContactComponent implements OnInit { | |||
| this.contactSub = new Subscription(); | |||
| this.mediaSub = new Subscription(); | |||
| this.birthdayValue = ""; | |||
| } | |||
| ngOnInit(): void { | |||
| this.contactForm = FormGroupInitializer.initFormGroup(this.contactForm, this.contact); | |||
| } | |||
| protected onBirthdayChange(selectedItem: any) { | |||
| // Set T12:00 for correct string | |||
| let selectedItemValue = null; | |||
| if (selectedItem.target.value !== "") { | |||
| selectedItemValue = selectedItem.target.value + "T12:00"; | |||
| } | |||
| this.contactForm.get('birthday')?.setValue(selectedItemValue); | |||
| } | |||
| // On submit form: Check if image is set | |||
| onSubmit() { | |||
| if (this.selectedImage !== null) { | |||
| @@ -73,7 +73,7 @@ | |||
| aria-controls="collapseExample"> | |||
| <h3 class="m-0">{{task.partnerName}}</h3> | |||
| <span class="info d-flex position-absolute"> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY HH:mm':'GMT+0000' }}</span> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}</span> | |||
| <span class="importance" [attr.data-importance]="task.prio"></span> | |||
| </span> | |||
| <h2 class="m-0">{{task.headline}}</h2> | |||
| @@ -91,7 +91,7 @@ | |||
| <div class="card ms-5" *ngFor="let taskNote of task.taskNotes"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>{{ taskNote.createdAt | date:'dd.MM.YYYY HH:mm' }}</p> | |||
| <p>{{ taskNote.createdAt | date:'dd.MM.YYYY' }}</p> | |||
| <p>{{ taskNote.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| @@ -121,7 +121,7 @@ | |||
| aria-controls="collapseExample"> | |||
| <h3 class="m-0">{{ task.partnerName }}</h3> | |||
| <span class="info d-flex position-absolute"> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY HH:mm':'GMT+0000' }}</span> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}</span> | |||
| <span class="importance" [attr.data-importance]="task.prio"></span> | |||
| </span> | |||
| <h2 class="m-0">{{ task.headline }}</h2> | |||
| @@ -139,7 +139,7 @@ | |||
| <div class="card ms-5" *ngFor="let taskNote of task.taskNotes"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>{{ taskNote.createdAt | date:'dd.MM.YYYY HH:mm' }}</p> | |||
| <p>{{ taskNote.createdAt | date:'dd.MM.YYYY' }}</p> | |||
| <p>{{ taskNote.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| @@ -181,7 +181,7 @@ | |||
| <div class="card"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>{{ post.createdAt | date:'dd.MM.YYYY HH:mm' }}</p> | |||
| <p>{{ post.createdAt | date:'dd.MM.YYYY' }}</p> | |||
| <p>{{ post.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| @@ -197,7 +197,7 @@ | |||
| <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 HH:mm' }}</p> | |||
| <p>{{ comment.createdAt | date:'dd.MM.YYYY' }}</p> | |||
| <p>{{ comment.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| @@ -180,6 +180,8 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| undefined, | |||
| undefined, | |||
| undefined, | |||
| undefined, | |||
| undefined, | |||
| false | |||
| ).subscribe( | |||
| data => { | |||
| @@ -31,6 +31,11 @@ | |||
| <input type="number" class="form-control" id="profit" formControlName="profit" min="0" step="1" /> | |||
| </div> | |||
| <div class="mb-3"> | |||
| <label for="comment" class="form-label">{{ 'form.comment' | translate }}:</label> | |||
| <input type="text" class="form-control" id="comment" formControlName="comment" /> | |||
| </div> | |||
| <!-- <div class="mb-3">--> | |||
| <!-- <label for="street" class="form-label">{{ 'form.street' | translate }}:</label>--> | |||
| <!-- <input type="text" class="form-control" id="street" formControlName="street"/>--> | |||
| @@ -1 +1,81 @@ | |||
| <p>sales-detail works!</p> | |||
| <div class="spt-container"> | |||
| <div class="card"> | |||
| <div class="card-body row pb-5"> | |||
| <div class="col-8"> | |||
| <h1>{{'overview.sale-user' | translate }}: {{ sale.ownerName }}</h1> | |||
| <dl> | |||
| <dt *ngIf="sale.partnerName">{{'overview.partner' | translate}}:</dt> | |||
| <dd *ngIf="sale.partnerName">{{ sale.partnerName }}</dd> | |||
| <dt *ngIf="sale.productName">{{'overview.product' | translate}}:</dt> | |||
| <dd *ngIf="sale.productName">{{ sale.productName }}</dd> | |||
| <dt *ngIf="sale.turnover">{{'overview.turnover' | translate}}:</dt> | |||
| <dd *ngIf="sale.turnover">{{ sale.turnover }}</dd> | |||
| <dt *ngIf="sale.profit">{{'overview.profit' | translate}}:</dt> | |||
| <dd *ngIf="sale.profit">{{ sale.profit }}</dd> | |||
| <dt *ngIf="sale.comment">{{'overview.comment' | translate}}:</dt> | |||
| <dd *ngIf="sale.comment">{{ sale.comment }}</dd> | |||
| </dl> | |||
| </div> | |||
| <div class="col-4"></div> | |||
| <span class="position-absolute bi bi-pencil p-2" data-type="user-tool" data-action="edit" | |||
| (click)="openModalEditSale()"></span> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="spt-container"> | |||
| <div class="posts"> | |||
| <div class="d-flex justify-content-between align-items-start"> | |||
| <h2>{{'basic.posts' | translate}}</h2> | |||
| <button class="btn btn-primary" (click)="openModalNewPosting()">{{'basic.new-post' | translate}}</button> | |||
| </div> | |||
| <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 HH:mm' }}</p> | |||
| <p>{{ post.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| <h3>{{ post.headline }}</h3> | |||
| <p>{{ 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 HH:mm' }}</p> | |||
| <p>{{ comment.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| <p>{{ 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> | |||
| @@ -1,10 +1,188 @@ | |||
| import { Component } from '@angular/core'; | |||
| import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core'; | |||
| import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator"; | |||
| import {Subscription} from "rxjs"; | |||
| import {MatTableDataSource} from "@angular/material/table"; | |||
| import {CommentJsonld, ContactJsonld, PostJsonld, PostService, SaleJsonld, SaleService} from "@app/core/api/v1"; | |||
| 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 {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 {ActivatedRoute} from "@angular/router"; | |||
| @Component({ | |||
| selector: 'app-sales-detail', | |||
| templateUrl: './sales-detail.component.html', | |||
| styleUrl: './sales-detail.component.scss' | |||
| }) | |||
| export class SalesDetailComponent { | |||
| export class SalesDetailComponent implements OnInit, AfterViewInit { | |||
| @ViewChild(MatPaginator) postsPaginator: MatPaginator; | |||
| protected user: User | null; | |||
| protected id: string; | |||
| protected sale: SaleJsonld; | |||
| protected saleSub: Subscription; | |||
| protected postsSub: Subscription; | |||
| protected posts: Array<PostJsonld>; | |||
| 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 accountService: AccountService, | |||
| private saleService: SaleService, | |||
| private route: ActivatedRoute, | |||
| private postService: PostService, | |||
| private modalService: NgbModal | |||
| ) { | |||
| this.user = this.accountService.userValue; | |||
| this.id = ""; | |||
| this.sale = {} as SaleJsonld; | |||
| this.saleSub = new Subscription(); | |||
| 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() { | |||
| this.route.params.subscribe(params => { | |||
| this.id = params['id']; | |||
| }); | |||
| this.getSaleData(); | |||
| } | |||
| ngAfterViewInit() { | |||
| this.postsDataSource.paginator = this.postsPaginator; | |||
| } | |||
| getSaleData() { | |||
| console.log(this.id); | |||
| this.saleSub = this.saleService.salesIdGet( | |||
| this.id | |||
| ).subscribe( | |||
| data => { | |||
| this.sale = data; | |||
| } | |||
| ); | |||
| } | |||
| getPostsData() { | |||
| this.postsSub = this.postService.postsGetCollection( | |||
| this.postsPageIndex + 1, | |||
| this.postsPageSize, | |||
| this.sale.partner + '', | |||
| undefined, | |||
| undefined, | |||
| undefined, | |||
| this.id, | |||
| undefined, | |||
| 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); | |||
| } | |||
| }); | |||
| } | |||
| ); | |||
| } | |||
| postsHandlePageEvent(e: PageEvent) { | |||
| this.postsPageEvent = e; | |||
| this.postsLength = e.length; | |||
| this.postsPageIndex = e.pageIndex.valueOf(); | |||
| this.postsPageSize = e.pageSize.valueOf(); | |||
| this.getPostsData(); | |||
| } | |||
| openModalNewPosting() { | |||
| const modalRefPosting = this.modalService.open(NewPostingComponent, this.modalOptions); | |||
| let posting: PostJsonld = {} as PostJsonld; | |||
| posting.sale = this.sale.id ?? null; | |||
| posting.partner = this.sale.partner ?? 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(); | |||
| } | |||
| }); | |||
| } | |||
| 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(); | |||
| } | |||
| }); | |||
| } | |||
| openModalEditSale() { | |||
| const modalRefSale = this.modalService.open(NewSaleComponent, this.modalOptions); | |||
| modalRefSale.componentInstance.sale = this.sale; | |||
| modalRefSale.componentInstance.submit.subscribe((modalStatus: ModalStatus) => { | |||
| if (modalStatus === ModalStatus.Submitted) { | |||
| modalRefSale.dismiss(); | |||
| this.getSaleData(); | |||
| } | |||
| }); | |||
| } | |||
| showComments(post: PostJsonld) { | |||
| if (post.id) { | |||
| const currentVisibility = this.commentsVisibility.get(post.id); | |||
| this.commentsVisibility.set(post.id, !currentVisibility); | |||
| } | |||
| } | |||
| } | |||
| @@ -160,9 +160,8 @@ export class SalesComponent implements OnInit { | |||
| } | |||
| navigateToSaleDetails(element: any) { | |||
| console.log(element); | |||
| // const sale: SaleJsonld = element as SaleJsonld; | |||
| // this.router.navigate(['/sales', ApiConverter.extractId(sale.id)]); | |||
| const sale: SaleJsonld = element as SaleJsonld; | |||
| this.router.navigate(['/sales', ApiConverter.extractId(sale.id)]); | |||
| } | |||
| openModalNewSale() { | |||
| @@ -37,7 +37,7 @@ | |||
| <div class="mb-3"> | |||
| <label for="dueAtValue" class="form-label">{{ 'form.due-date' | translate }}:</label> | |||
| <input type="datetime-local" value="{{ dueAtValue }}" class="form-control" id="dueAtValue" | |||
| <input type="date" value="{{ dueAtValue }}" class="form-control" id="dueAtValue" | |||
| (change)="onDueAtChange($event)"/> | |||
| <div class="form-text" *ngIf="taskForm.get('dueAt')?.invalid && taskForm.get('dueAt')?.touched"> | |||
| {{ 'form.due-date' | translate }} {{ 'form.mandatory' | translate }}. | |||
| @@ -76,7 +76,9 @@ export class NewTaskComponent implements OnInit { | |||
| } | |||
| protected onDueAtChange(selectedItem: any) { | |||
| this.taskForm.get('dueAt')?.setValue(selectedItem.target.value); | |||
| // Set T12:00 for correct string | |||
| let selectedItemValue = selectedItem.target.value + "T12:00"; | |||
| this.taskForm.get('dueAt')?.setValue(selectedItemValue); | |||
| } | |||
| protected onSubmit() { | |||
| @@ -11,7 +11,7 @@ | |||
| aria-controls="collapseExample"> | |||
| <h3 class="m-0">{{task.partnerName}}</h3> | |||
| <span class="info d-flex position-absolute"> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY HH:mm':'GMT+0000' }}</span> | |||
| <span class="due-date">{{ task.dueAt | date:'dd.MM.YYYY':'GMT+0000' }}</span> | |||
| <span class="importance" [attr.data-importance]="task.prio"></span> | |||
| </span> | |||
| <h2 class="m-0">{{task.headline}}</h2> | |||
| @@ -78,6 +78,7 @@ | |||
| "details": "Details", | |||
| "turnover": "Umsatz", | |||
| "profit": "Gewinn", | |||
| "comment": "Kommentar", | |||
| "createdAt": "erstellt am" | |||
| }, | |||
| "form": | |||
| @@ -13,8 +13,13 @@ | |||
| font-size: 20px; | |||
| @include transition(); | |||
| &:hover { | |||
| background: $color-matsen; | |||
| &:not(.btn):hover { | |||
| color: $color-matsen; | |||
| } | |||
| &.btn { | |||
| &:hover { | |||
| background: $color-matsen; | |||
| } | |||
| } | |||
| } | |||