From 16ddd2066627d9e0307537f7c432ec2f7dd12dd9 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 16 Dec 2023 23:22:19 -0500 Subject: [PATCH] Invite Relatives --- .../add-relatives.component.html | 118 +++++++++++++++++ .../add-relatives.component.scss | 0 .../add-relatives.component.spec.ts | 24 ++++ .../add-relatives/add-relatives.component.ts | 122 ++++++++++++++++++ .../familysettings/familysettings.module.ts | 3 +- .../familysettings/familysettings.page.html | 4 +- 6 files changed, 267 insertions(+), 4 deletions(-) create mode 100644 src/app/components/add-relatives/add-relatives.component.html create mode 100644 src/app/components/add-relatives/add-relatives.component.scss create mode 100644 src/app/components/add-relatives/add-relatives.component.spec.ts create mode 100644 src/app/components/add-relatives/add-relatives.component.ts diff --git a/src/app/components/add-relatives/add-relatives.component.html b/src/app/components/add-relatives/add-relatives.component.html new file mode 100644 index 0000000..65573db --- /dev/null +++ b/src/app/components/add-relatives/add-relatives.component.html @@ -0,0 +1,118 @@ +
+
+ Invite +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Close + + + + +
+ {{addFamilyResult}} + Send Invite +
+
+
+
+ +
+ + + +
\ No newline at end of file diff --git a/src/app/components/add-relatives/add-relatives.component.scss b/src/app/components/add-relatives/add-relatives.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/add-relatives/add-relatives.component.spec.ts b/src/app/components/add-relatives/add-relatives.component.spec.ts new file mode 100644 index 0000000..99e385e --- /dev/null +++ b/src/app/components/add-relatives/add-relatives.component.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { AddRelativesComponent } from './add-relatives.component'; + +describe('AddRelativesComponent', () => { + let component: AddRelativesComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ AddRelativesComponent ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(AddRelativesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/add-relatives/add-relatives.component.ts b/src/app/components/add-relatives/add-relatives.component.ts new file mode 100644 index 0000000..bdb9291 --- /dev/null +++ b/src/app/components/add-relatives/add-relatives.component.ts @@ -0,0 +1,122 @@ +import {Component, OnInit, ViewChild} from '@angular/core'; +import {SessionDataProviderService} from "../../store/session-data-provider.service"; +import {WrenchService} from "../../services/wrench.service"; +import {LoadingController} from "@ionic/angular"; + +@Component({ + selector: 'app-add-relatives', + templateUrl: './add-relatives.component.html', + styleUrls: ['./add-relatives.component.scss'], +}) +export class AddRelativesComponent implements OnInit { + isModalOpen:boolean = false; + isModalOpenBackdrop:boolean = false; + + @ViewChild('firstname') firstname; + @ViewChild('lastname') lastname; + @ViewChild('email') email; + + @ViewChild('month') month; + @ViewChild('year') year; + addFamilyResult:string=''; + + + constructor( + public sessionDataProviderService: SessionDataProviderService, + private wrenchService: WrenchService, + private loadingCtrl: LoadingController + ) { } + + regMonth:any; + regYear:any; + ngOnInit() { + this.regMonth=this.sessionDataProviderService.getMonths(); + this.regYear = this.sessionDataProviderService.getChildAddYears(); + //debugger; + } + + + addStart(){ + this.isModalOpen = true; + this.isModalOpenBackdrop= true; + } + + setCloseModal(){ + this.firstname=''; + this.lastname=''; + this.isModalOpen = false; + this.isModalOpenBackdrop= false; + dispatchEvent(new Event("family_refresh_list")); + + } + + isDisabled:boolean= true; + verifyEntry(){ + this.isDisabled= true; + if ( this.firstname.length> 1 && this.lastname.length> 1 && this.month> 0 && this.year> 0 ){ + this.isDisabled= false; + } + } + /* + 'member_id' => int 1 + 'sessionid' => string '9C780E24425EBE70E1AE3D385193E6FF0DF839A5CA62CD6A6DCE9A5065530968' (length=64) + 'uid' => string '3119b744-42ad-4834-bb83-b737588754ca' (length=36) + 'firstname' => string 'First406' (length=8) + 'lastname' => string 'Last151' (length=7) + 'year' => int 2002 + 'month' => int 8 + 'action' => int 22015 + */ + reqData: { + action:number, + member_id: number, + uid: string, + sessionid: string, + firstname:string, + lastname: string, + month: number, + year: number + }; + + createFamilyResult:any; + + async inviteFamily(){ + const loading = await this.loadingCtrl.create({ + message: 'Sending Invite...', + duration: 5000, + }); + + this.reqData={ + action:22015, + member_id: this.sessionDataProviderService.member_id, + uid: this.sessionDataProviderService.member_uid, + sessionid: this.sessionDataProviderService.session , + firstname: this.firstname, + lastname: this.lastname, + month: this.month, + year: this.year + } + loading.present(); +return; + this.wrenchService.familyAdd(this.reqData).subscribe( + createFamilyResult => { + loading.dismiss(); + this.createFamilyResult = createFamilyResult; + console.log("this.wrenchService.createFamilyResult RETURN DATA->", this.createFamilyResult); + if (this.createFamilyResult.internal_return> 0){ + this.firstname=''; + this.lastname=''; + + this.createFamilyResult = "Family Added"; + setTimeout(()=>{ + this.createFamilyResult=""; + this.setCloseModal(); + },3000); + } + } + ); + } + + + +} diff --git a/src/app/pages/familysettings/familysettings.module.ts b/src/app/pages/familysettings/familysettings.module.ts index f5ca706..63e6b05 100644 --- a/src/app/pages/familysettings/familysettings.module.ts +++ b/src/app/pages/familysettings/familysettings.module.ts @@ -8,6 +8,7 @@ import { FamilysettingsPageRoutingModule } from './familysettings-routing.module import { FamilysettingsPage } from './familysettings.page'; import {AddFamilyComponent} from "../../components/add-family/add-family.component"; +import {AddRelativesComponent} from "../../components/add-relatives/add-relatives.component"; @NgModule({ imports: [ @@ -16,6 +17,6 @@ import {AddFamilyComponent} from "../../components/add-family/add-family.compone IonicModule, FamilysettingsPageRoutingModule ], - declarations: [FamilysettingsPage,AddFamilyComponent] + declarations: [FamilysettingsPage,AddFamilyComponent,AddRelativesComponent] }) export class FamilysettingsPageModule {} diff --git a/src/app/pages/familysettings/familysettings.page.html b/src/app/pages/familysettings/familysettings.page.html index 1ca8f24..1e45fff 100644 --- a/src/app/pages/familysettings/familysettings.page.html +++ b/src/app/pages/familysettings/familysettings.page.html @@ -32,9 +32,7 @@ Parents & Community
- -Dev Goes here - +