new contact edit function: new contact
This commit is contained in:
parent
809a9766d0
commit
e85283c8db
15 changed files with 40 additions and 22 deletions
|
|
@ -11,7 +11,14 @@
|
||||||
</div>
|
</div>
|
||||||
<app-sidebar-mobile></app-sidebar-mobile>
|
<app-sidebar-mobile></app-sidebar-mobile>
|
||||||
</div>
|
</div>
|
||||||
@if (sharedService.isEditContactDialogOpen) {
|
@if (sharedService.isNewContactDialogOpen) {
|
||||||
|
<app-contact-edit
|
||||||
|
[ngClass]="{
|
||||||
|
'blur-background': sharedService.isDeleteContactDialogOpen,
|
||||||
|
'd-none': sharedService.isDeleteContactDialogOpen
|
||||||
|
}"
|
||||||
|
></app-contact-edit>
|
||||||
|
} @if (sharedService.isEditContactDialogOpen) {
|
||||||
<app-contact-edit
|
<app-contact-edit
|
||||||
[currentUserId]="sharedService.currentUserId"
|
[currentUserId]="sharedService.currentUserId"
|
||||||
[ngClass]="{
|
[ngClass]="{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { HeaderComponent } from './shared/components/header/header.component';
|
||||||
import { SidebarComponent } from './shared/components/sidebar/sidebar.component';
|
import { SidebarComponent } from './shared/components/sidebar/sidebar.component';
|
||||||
import { LanguageService } from './services/language.service';
|
import { LanguageService } from './services/language.service';
|
||||||
import { SidebarMobileComponent } from './shared/components/sidebar/sidebar-mobile/sidebar-mobile.component';
|
import { SidebarMobileComponent } from './shared/components/sidebar/sidebar-mobile/sidebar-mobile.component';
|
||||||
import { ContactEditComponent } from './components/contacts/contact-edit/contact-edit.component';
|
import { ContactEditNewComponent } from './components/contacts/contact-edit-new/contact-edit.component';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { SharedService } from './services/shared.service';
|
import { SharedService } from './services/shared.service';
|
||||||
import { ContactDeleteComponent } from './components/contacts/contact-delete/contact-delete.component';
|
import { ContactDeleteComponent } from './components/contacts/contact-delete/contact-delete.component';
|
||||||
|
|
@ -19,7 +19,7 @@ import { FirebaseService } from './services/firebase.service';
|
||||||
HeaderComponent,
|
HeaderComponent,
|
||||||
SidebarComponent,
|
SidebarComponent,
|
||||||
SidebarMobileComponent,
|
SidebarMobileComponent,
|
||||||
ContactEditComponent,
|
ContactEditNewComponent,
|
||||||
ContactDeleteComponent,
|
ContactDeleteComponent,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
OverlayComponent,
|
OverlayComponent,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { Component, HostListener, Input } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ContactsComponent } from '../contacts.component';
|
import { ContactsComponent } from '../contacts.component';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { ContactEditComponent } from '../contact-edit/contact-edit.component';
|
import { ContactEditNewComponent } from '../contact-edit-new/contact-edit.component';
|
||||||
import { SharedService } from '../../../services/shared.service';
|
import { SharedService } from '../../../services/shared.service';
|
||||||
import { ContactNavComponent } from '../contact-nav/contact-nav.component';
|
import { ContactNavComponent } from '../contact-nav/contact-nav.component';
|
||||||
import { FirebaseService } from '../../../services/firebase.service';
|
import { FirebaseService } from '../../../services/firebase.service';
|
||||||
|
|
@ -14,7 +14,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
ContactsComponent,
|
ContactsComponent,
|
||||||
ContactEditComponent,
|
ContactEditNewComponent,
|
||||||
ContactNavComponent,
|
ContactNavComponent,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
],
|
],
|
||||||
|
|
@ -22,7 +22,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||||
styleUrl: './contact-detail.component.scss',
|
styleUrl: './contact-detail.component.scss',
|
||||||
})
|
})
|
||||||
export class ContactDetailComponent {
|
export class ContactDetailComponent {
|
||||||
@Input() currentUserId!: string | undefined;
|
@Input() currentUserId: string | undefined;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
|
@ -131,6 +131,9 @@ export class ContactDetailComponent {
|
||||||
if (targetElement.closest('.btn-edit')) {
|
if (targetElement.closest('.btn-edit')) {
|
||||||
this.sharedService.isAnyDialogOpen = true;
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
this.sharedService.isEditContactDialogOpen = true;
|
this.sharedService.isEditContactDialogOpen = true;
|
||||||
|
} else if (targetElement.closest('.btn-new')) {
|
||||||
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
|
this.sharedService.isNewContactDialogOpen = true;
|
||||||
} else if (targetElement.closest('.btn-delete')) {
|
} else if (targetElement.closest('.btn-delete')) {
|
||||||
this.sharedService.isAnyDialogOpen = true;
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
this.sharedService.isDeleteContactDialogOpen = true;
|
this.sharedService.isDeleteContactDialogOpen = true;
|
||||||
|
|
@ -138,6 +141,7 @@ export class ContactDetailComponent {
|
||||||
this.sharedService.isAnyDialogOpen = false;
|
this.sharedService.isAnyDialogOpen = false;
|
||||||
this.sharedService.isEditContactDialogOpen = false;
|
this.sharedService.isEditContactDialogOpen = false;
|
||||||
this.sharedService.isDeleteContactDialogOpen = false;
|
this.sharedService.isDeleteContactDialogOpen = false;
|
||||||
|
this.sharedService.isNewContactDialogOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
@if (currentUserId) {
|
||||||
<section>
|
<section>
|
||||||
<div class="dialog">
|
<div class="dialog">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
|
@ -27,3 +28,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
}
|
||||||
|
|
@ -1,18 +1,17 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ContactEditComponent } from './contact-edit.component';
|
import { ContactEditNewComponent } from './contact-edit.component';
|
||||||
|
|
||||||
describe('ContactEditComponent', () => {
|
describe('ContactEditComponent', () => {
|
||||||
let component: ContactEditComponent;
|
let component: ContactEditNewComponent;
|
||||||
let fixture: ComponentFixture<ContactEditComponent>;
|
let fixture: ComponentFixture<ContactEditNewComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [ContactEditComponent]
|
imports: [ContactEditNewComponent],
|
||||||
})
|
}).compileComponents();
|
||||||
.compileComponents();
|
|
||||||
|
fixture = TestBed.createComponent(ContactEditNewComponent);
|
||||||
fixture = TestBed.createComponent(ContactEditComponent);
|
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { ContactFormComponent } from '../contact-form/contact-form.component';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { BtnCloseComponent } from '../../../shared/components/buttons/btn-close/btn-close.component';
|
import { BtnCloseComponent } from '../../../shared/components/buttons/btn-close/btn-close.component';
|
||||||
import { FirebaseService } from '../../../services/firebase.service';
|
import { FirebaseService } from '../../../services/firebase.service';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { ContactFormComponent } from './contact-form/contact-form.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-contact-edit',
|
selector: 'app-contact-edit',
|
||||||
|
|
@ -17,8 +17,8 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||||
templateUrl: './contact-edit.component.html',
|
templateUrl: './contact-edit.component.html',
|
||||||
styleUrl: './contact-edit.component.scss',
|
styleUrl: './contact-edit.component.scss',
|
||||||
})
|
})
|
||||||
export class ContactEditComponent {
|
export class ContactEditNewComponent {
|
||||||
@Input() currentUserId!: string;
|
@Input() currentUserId: string | undefined;
|
||||||
|
|
||||||
constructor(public firebaseService: FirebaseService) {}
|
constructor(public firebaseService: FirebaseService) {}
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { FormsModule, NgForm } from '@angular/forms';
|
import { FormsModule, NgForm } from '@angular/forms';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { SharedService } from '../../../services/shared.service';
|
import { SharedService } from '../../../../services/shared.service';
|
||||||
import { FirebaseService } from '../../../services/firebase.service';
|
import { FirebaseService } from '../../../../services/firebase.service';
|
||||||
import { FormBtnComponent } from '../../../shared/components/buttons/form-btn/form-btn.component';
|
import { FormBtnComponent } from '../../../../shared/components/buttons/form-btn/form-btn.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-contact-form',
|
selector: 'app-contact-form',
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
class="left-frame"
|
class="left-frame"
|
||||||
[ngClass]="{ 'd-none': !showAllUsers && currentUserId != undefined }"
|
[ngClass]="{ 'd-none': !showAllUsers && currentUserId != undefined }"
|
||||||
>
|
>
|
||||||
<button class="btn" type="submit">
|
<button class="btn-new" type="submit" (click)="openNewContactDialog()">
|
||||||
<div class="btn-inside">
|
<div class="btn-inside">
|
||||||
<span>{{ "contacts.btnNew" | translate }}</span>
|
<span>{{ "contacts.btnNew" | translate }}</span>
|
||||||
<img src="./../../../assets/img/contact/add.svg" alt="check" />
|
<img src="./../../../assets/img/contact/add.svg" alt="check" />
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn-new {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
|
|
@ -71,4 +71,9 @@ export class ContactsComponent {
|
||||||
);
|
);
|
||||||
return usersFirstLetter;
|
return usersFirstLetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openNewContactDialog() {
|
||||||
|
this.sharedService.isAnyDialogOpen = true;
|
||||||
|
this.sharedService.isNewContactDialogOpen = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ export class SharedService {
|
||||||
isBtnDisabled: boolean = false;
|
isBtnDisabled: boolean = false;
|
||||||
isAnyDialogOpen: boolean = false;
|
isAnyDialogOpen: boolean = false;
|
||||||
isMobileNavbarOpen: boolean = false;
|
isMobileNavbarOpen: boolean = false;
|
||||||
|
isNewContactDialogOpen: boolean = false;
|
||||||
isEditContactDialogOpen: boolean = false;
|
isEditContactDialogOpen: boolean = false;
|
||||||
isDeleteContactDialogOpen: boolean = false;
|
isDeleteContactDialogOpen: boolean = false;
|
||||||
isPageViewMedia: boolean = window.innerWidth <= 650;
|
isPageViewMedia: boolean = window.innerWidth <= 650;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue