added & design contact delete dialog
This commit is contained in:
parent
70422d87be
commit
acb7e8ee7a
13 changed files with 192 additions and 11 deletions
|
|
@ -10,8 +10,16 @@
|
||||||
</div>
|
</div>
|
||||||
<app-sidebar-mobile></app-sidebar-mobile>
|
<app-sidebar-mobile></app-sidebar-mobile>
|
||||||
</div>
|
</div>
|
||||||
@if (sharedService.isEditDialogOpen) {
|
@if (sharedService.isEditContactDialogOpen) {
|
||||||
<app-contact-edit
|
<app-contact-edit
|
||||||
[currentUserId]="sharedService.currentUserId"
|
[currentUserId]="sharedService.currentUserId"
|
||||||
|
[ngClass]="{
|
||||||
|
'blur-background': sharedService.isDeleteContactDialogOpen,
|
||||||
|
'd-none': sharedService.isDeleteContactDialogOpen
|
||||||
|
}"
|
||||||
></app-contact-edit>
|
></app-contact-edit>
|
||||||
|
} @if (sharedService.isDeleteContactDialogOpen) {
|
||||||
|
<app-contact-delete
|
||||||
|
[currentUserId]="sharedService.currentUserId"
|
||||||
|
></app-contact-delete>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { ContactEditComponent } from './components/contacts/contact-edit/contact
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { SharedService } from './services/shared.service';
|
import { SharedService } from './services/shared.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { ContactDeleteComponent } from './components/contacts/contact-delete/contact-delete.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
|
|
@ -18,6 +19,7 @@ import { Observable } from 'rxjs';
|
||||||
SidebarComponent,
|
SidebarComponent,
|
||||||
SidebarMobileComponent,
|
SidebarMobileComponent,
|
||||||
ContactEditComponent,
|
ContactEditComponent,
|
||||||
|
ContactDeleteComponent,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
],
|
],
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<section>
|
||||||
|
<div class="dialog">
|
||||||
|
<p>Do you really want to delete the contact?</p>
|
||||||
|
<div class="btns">
|
||||||
|
<div class="btn">
|
||||||
|
<div class="btn-cancle" (click)="deleteCancle()">
|
||||||
|
{{ "contact-delete-dialog.btn-cancle" | translate }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="btn">
|
||||||
|
<div class="btn-delete" (click)="deleteContact()">
|
||||||
|
{{ "contact-delete-dialog.btn-delete" | translate }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
section {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: var(--white);
|
||||||
|
width: 600px;
|
||||||
|
height: 170px;
|
||||||
|
border-radius: 26px;
|
||||||
|
border: 2px solid rgba($color: #000000, $alpha: 0.1);
|
||||||
|
p {
|
||||||
|
font-size: 27px;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btns {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
width: 111px;
|
||||||
|
height: 57px;
|
||||||
|
margin: 0 24px;
|
||||||
|
font-size: 21px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancle {
|
||||||
|
padding: 12px;
|
||||||
|
margin: 12px 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border-color: var(--black);
|
||||||
|
background-color: var(--dark-blue);
|
||||||
|
color: var(--white);
|
||||||
|
font-size: 23px;
|
||||||
|
font-weight: 400;
|
||||||
|
transition: 125ms ease-in-out;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--light-blue);
|
||||||
|
box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-delete {
|
||||||
|
padding: 12px;
|
||||||
|
margin: 12px 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
color: var(--red);
|
||||||
|
background-color: var(--white);
|
||||||
|
border: 1px solid var(--red);
|
||||||
|
font-size: 23px;
|
||||||
|
font-weight: 400;
|
||||||
|
transition: 125ms ease-in-out;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: var(--white);
|
||||||
|
background-color: var(--red);
|
||||||
|
border-color: var(--black);
|
||||||
|
box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ContactDeleteComponent } from './contact-delete.component';
|
||||||
|
|
||||||
|
describe('ContactDeleteComponent', () => {
|
||||||
|
let component: ContactDeleteComponent;
|
||||||
|
let fixture: ComponentFixture<ContactDeleteComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ContactDeleteComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ContactDeleteComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
import { SharedService } from '../../../services/shared.service';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-contact-delete',
|
||||||
|
standalone: true,
|
||||||
|
imports: [TranslateModule],
|
||||||
|
templateUrl: './contact-delete.component.html',
|
||||||
|
styleUrl: './contact-delete.component.scss',
|
||||||
|
})
|
||||||
|
export class ContactDeleteComponent {
|
||||||
|
@Input() currentUserId!: string;
|
||||||
|
|
||||||
|
constructor(private sharedService: SharedService) {}
|
||||||
|
|
||||||
|
deleteContact() {
|
||||||
|
console.log('Contact deleted');
|
||||||
|
this.sharedService.isDeleteContactDialogOpen = false;
|
||||||
|
this.sharedService.isAnyDialogOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteCancle() {
|
||||||
|
this.sharedService.isDeleteContactDialogOpen = false;
|
||||||
|
if (!this.sharedService.isEditContactDialogOpen) {
|
||||||
|
this.sharedService.isAnyDialogOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -38,9 +38,9 @@
|
||||||
<img src="./../../../../assets/img/contact/edit.svg" alt="" />
|
<img src="./../../../../assets/img/contact/edit.svg" alt="" />
|
||||||
<p (click)="openEditDialog()">edit</p>
|
<p (click)="openEditDialog()">edit</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn">
|
<div class="btn btn-delete">
|
||||||
<img src="./../../../../assets/img/contact/delete.svg" alt="" />
|
<img src="./../../../../assets/img/contact/delete.svg" alt="" />
|
||||||
<p>delete</p>
|
<p (click)="deleteContact()">delete</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,13 @@ export class ContactDetailComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditDialog() {
|
openEditDialog() {
|
||||||
this.sharedService.isEditDialogOpen = !this.sharedService.isEditDialogOpen;
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
|
this.sharedService.isEditContactDialogOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteContact() {
|
||||||
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
|
this.sharedService.isDeleteContactDialogOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('document:click', ['$event'])
|
@HostListener('document:click', ['$event'])
|
||||||
|
|
@ -35,10 +41,14 @@ export class ContactDetailComponent {
|
||||||
const targetElement = event.target as HTMLElement;
|
const targetElement = event.target as HTMLElement;
|
||||||
if (targetElement.closest('.btn-edit')) {
|
if (targetElement.closest('.btn-edit')) {
|
||||||
this.sharedService.isAnyDialogOpen = true;
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
this.sharedService.isEditDialogOpen = true;
|
this.sharedService.isEditContactDialogOpen = true;
|
||||||
|
} else if (targetElement.closest('.btn-delete')) {
|
||||||
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
|
this.sharedService.isDeleteContactDialogOpen = true;
|
||||||
} else if (!targetElement.closest('.dialog')) {
|
} else if (!targetElement.closest('.dialog')) {
|
||||||
this.sharedService.isAnyDialogOpen = false;
|
this.sharedService.isAnyDialogOpen = false;
|
||||||
this.sharedService.isEditDialogOpen = false;
|
this.sharedService.isEditContactDialogOpen = false;
|
||||||
|
this.sharedService.isDeleteContactDialogOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,9 @@
|
||||||
<span>{{ "form.invalid-msg" | translate }}</span>
|
<span>{{ "form.invalid-msg" | translate }}</span>
|
||||||
}
|
}
|
||||||
<div class="btns">
|
<div class="btns">
|
||||||
<div class="btn" (click)="deleteContact()">
|
<div class="btn">
|
||||||
<input
|
<input
|
||||||
|
(click)="deleteContact()"
|
||||||
class="btn-delete"
|
class="btn-delete"
|
||||||
type="button"
|
type="button"
|
||||||
value="{{ 'form.btn-delete' | translate }}"
|
value="{{ 'form.btn-delete' | translate }}"
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,13 @@ span {
|
||||||
border: 1px solid var(--red);
|
border: 1px solid var(--red);
|
||||||
font-size: 23px;
|
font-size: 23px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
transition: 125ms ease-in-out;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--white);
|
color: var(--white);
|
||||||
background-color: var(--red);
|
background-color: var(--red);
|
||||||
border-color: var(--black);
|
border-color: var(--black);
|
||||||
|
box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
|
|
@ -79,8 +81,9 @@ span {
|
||||||
background-color: var(--light-gray);
|
background-color: var(--light-gray);
|
||||||
font-size: 23px;
|
font-size: 23px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
transition: 200ms ease-in-out;
|
transition: 125ms ease-in-out;
|
||||||
&:hover:not(:disabled) {
|
&:hover:not(:disabled) {
|
||||||
|
box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.3);
|
||||||
background-color: var(--light-blue) !important;
|
background-color: var(--light-blue) !important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,12 @@ export class ContactFormComponent implements OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteContact() {
|
deleteContact() {
|
||||||
this.closeEditDialog();
|
this.sharedService.isDeleteContactDialogOpen = true;
|
||||||
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
closeEditDialog() {
|
closeEditDialog() {
|
||||||
this.sharedService.isEditDialogOpen = false;
|
this.sharedService.isEditContactDialogOpen = false;
|
||||||
this.sharedService.isAnyDialogOpen = false;
|
this.sharedService.isAnyDialogOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ import { Injectable } from '@angular/core';
|
||||||
})
|
})
|
||||||
export class SharedService {
|
export class SharedService {
|
||||||
isAnyDialogOpen: boolean = false;
|
isAnyDialogOpen: boolean = false;
|
||||||
isEditDialogOpen: boolean = false;
|
isEditContactDialogOpen: boolean = false;
|
||||||
|
isDeleteContactDialogOpen: boolean = false;
|
||||||
currentUserId: string = '';
|
currentUserId: string = '';
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@
|
||||||
"msg-send0": "Your message has been sent successfully.",
|
"msg-send0": "Your message has been sent successfully.",
|
||||||
"msg-send1": "I will contact you shortly."
|
"msg-send1": "I will contact you shortly."
|
||||||
},
|
},
|
||||||
|
"contact-delete-dialog": {
|
||||||
|
"btn-cancle": "Cancle",
|
||||||
|
"btn-delete": "Delete"
|
||||||
|
},
|
||||||
"summary": {
|
"summary": {
|
||||||
"headlineDescription": "Key Metrics at a Glance",
|
"headlineDescription": "Key Metrics at a Glance",
|
||||||
"morning": "Good Morning",
|
"morning": "Good Morning",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue