-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] #7836 admin edit all types of order comments #3489
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
547198c
provide ability to change all types of comments to admin
yuliiakaras 52b46e7
add comment popup on a big table
yuliiakaras 6c7e43a
Merge branch 'dev' into fix/#7836-admin-edit-all-comments
yuliiakaras 0deb99c
unable editing orders` comments in statuses done/cancelled/brought_it…
yuliiakaras fdb4c10
refactor tooltip for readonly and input cells
yuliiakaras fca9eca
add tests
yuliiakaras 683c987
fix tests
yuliiakaras 23b682d
fix sonar issues
yuliiakaras 95308df
improve code safety
yuliiakaras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...p/ubs/ubs-admin/components/shared/components/comment-pop-up/comment-pop-up.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="wrapper"> | ||
<div class="set_comment_container"> | ||
<h3>{{ header }}</h3> | ||
<div class="set_comment"> | ||
<form [formGroup]="commentForm"> | ||
<textarea formControlName="comment" placeholder="{{ 'order-edit.comment.placeholder' | translate }}" cols="50" rows="6"></textarea> | ||
</form> | ||
</div> | ||
<div class="comment_btns"> | ||
<button class="cancel" [mat-dialog-close]="false">{{ 'order-edit.btn.cancel' | translate }}</button> | ||
<button (click)="onSubmit()" class="save">{{ 'order-edit.btn.save' | translate }}</button> | ||
</div> | ||
</div> | ||
</div> |
56 changes: 56 additions & 0 deletions
56
...p/ubs/ubs-admin/components/shared/components/comment-pop-up/comment-pop-up.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
* { | ||
font-family: var(--ubs-quaternary-font); | ||
} | ||
|
||
.wrapper { | ||
.set_comment_container { | ||
border-radius: 10px; | ||
font-size: 16px; | ||
|
||
h3 { | ||
font-size: 20px; | ||
font-weight: 600; | ||
} | ||
|
||
.comment_btns { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
} | ||
|
||
.set_comment { | ||
padding-block: 20px; | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
textarea { | ||
padding: 10px; | ||
border: 1px solid var(--ubs-tertiary-grey); | ||
border-radius: 5px; | ||
resize: none; | ||
outline: none; | ||
} | ||
|
||
textarea:focus { | ||
border: 1px solid var(--ubs-tertiary-grey); | ||
} | ||
} | ||
} | ||
|
||
.cancel { | ||
background: white; | ||
border-radius: 5px; | ||
border: none; | ||
color: var(--ubs-primary-black); | ||
font-weight: 600; | ||
} | ||
|
||
.save { | ||
height: 43px; | ||
background: var(--ubs-button-light-green); | ||
border-radius: 5px; | ||
border: 1px solid var(--ubs-button-light-green); | ||
padding: 0 30px; | ||
color: var(--ubs-tertiary-dark-grey); | ||
font-weight: 600; | ||
} |
30 changes: 30 additions & 0 deletions
30
...bs/ubs-admin/components/shared/components/comment-pop-up/comment-pop-up.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CommentPopUpComponent } from './comment-pop-up.component'; | ||
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
|
||
describe('CommentPopUpComponent', () => { | ||
let component: CommentPopUpComponent; | ||
let fixture: ComponentFixture<CommentPopUpComponent>; | ||
|
||
const MatDialogRefMock = { | ||
close: () => {} | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [CommentPopUpComponent], | ||
imports: [MatDialogModule, ReactiveFormsModule, TranslateModule.forRoot()], | ||
providers: [{ provide: MatDialogRef, useValue: MatDialogRefMock }] | ||
}); | ||
fixture = TestBed.createComponent(CommentPopUpComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
...app/ubs/ubs-admin/components/shared/components/comment-pop-up/comment-pop-up.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; | ||
import { MatDialogRef } from '@angular/material/dialog'; | ||
|
||
@Component({ | ||
selector: 'app-comment-pop-up', | ||
templateUrl: './comment-pop-up.component.html', | ||
styleUrls: ['./comment-pop-up.component.scss'] | ||
}) | ||
export class CommentPopUpComponent implements OnInit { | ||
@Input() header: string; | ||
@Input() comment: string; | ||
|
||
commentForm: FormGroup; | ||
|
||
constructor( | ||
public fb: FormBuilder, | ||
private dialogRef: MatDialogRef<CommentPopUpComponent> | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.initForm(); | ||
} | ||
|
||
initForm(): void { | ||
this.commentForm = this.fb.group({ | ||
comment: [this.comment, [Validators.maxLength(255)]] | ||
}); | ||
} | ||
|
||
onSubmit(): void { | ||
const data = this.commentForm.get('comment').value; | ||
this.dialogRef.close(data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ubs/ubs-admin/components/ubs-admin-table/table-cell-input/table-cell-input.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div | ||
class="comments" | ||
#tooltip="matTooltip" | ||
matTooltip="{{ data }}" | ||
(mouseenter)="onMouseEnter($event, tooltip)" | ||
(mouseleave)="tooltip.hide()" | ||
> | ||
<span>{{ data }}</span> | ||
<span *ngIf="!isEditable && !isBlocked && !isUneditableStatus" class="pointer" (keydown.enter)="edit()" (click)="edit()">✎</span> | ||
<mat-spinner class="spinner" *ngIf="isBlocked" strokeWidth="3" diameter="20"></mat-spinner> | ||
</div> |
26 changes: 26 additions & 0 deletions
26
...ubs/ubs-admin/components/ubs-admin-table/table-cell-input/table-cell-input.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.comments { | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
padding: 0 10px; | ||
margin: 0 10px; | ||
cursor: default; | ||
position: relative; | ||
} | ||
|
||
.pointer { | ||
cursor: pointer; | ||
position: absolute; | ||
right: 0; | ||
} | ||
|
||
.spinner { | ||
position: absolute; | ||
right: 0; | ||
top: 20%; | ||
} | ||
|
||
div { | ||
width: 100%; | ||
height: 100%; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Font property font-family does not have generic default:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It`s defined in the variable declaration:
--ubs-quaternary-font: 'Lato', sans-serif;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason `var' doesn't work correctly for font-family,
okay, leave it as it is