Last active
March 3, 2023 08:37
-
-
Save kingRayhan/5b983895f25ae691a219f2da2e648c9a to your computer and use it in GitHub Desktop.
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
private inviteVendor(vendor: OrganizationItem, contactPerson?: any) { | |
this.loading = true; | |
this.organizationService.getOrganizationById(this.clientInfo.itemId).subscribe({ | |
next: (res) => { | |
this.eventService | |
.inviteVendorToEvent({ | |
EventInviteVendorReference: [ | |
{ | |
EventInviteVendor: { | |
createDate: new Date(), | |
referenceItemId: "00000000-0000-0000-0000-000000000000", | |
eventRecordId: this.eventRecord.itemId, | |
vendorId: vendor.itemId, | |
vendor: { | |
...vendor, | |
...contactPerson, | |
}, | |
status: EventInviteVendorStatusEnum.Invite, | |
}, | |
DataContext: { | |
banner_image_url: | |
this.eventRecord.bannerUrl || "https://redlimecdn.blob.core.windows.net/production/Email_assets/event-invitation-email/hero.jpg", | |
eventName: this.eventRecord.name, | |
eventTime: | |
dayjs(this.eventRecord.startDate).format("DD MMM YYYY") + " " + formatTimeTwelveHour(this.eventRecord.eventSlots[0].startTime), | |
vendorName: vendor.name, | |
eventLocation: this.eventRecord.address.fullAddress, | |
eventLongLocation: this.eventRecord.address.fullAddress, | |
numberOfEmployee: res.payload.activeEmployeeCount, | |
expectedNumberOfEmployee: Math.floor((res.payload.activeEmployeeCount * 98) / 100), | |
notGoingLink: environment.BASE_URL + "/login?goings=false", | |
goingLink: environment.BASE_URL + "/login?goings=true", | |
insurance_plan_types: this.insurance_plan_Template.nativeElement.innerHTML, | |
map_image_url: getStaticMapUrl({ | |
zoom: 13, | |
width: 408, | |
height: 237, | |
markers: `icon:https://redlimecdn.blob.core.windows.net/production/map-proxy/pin.png|color:0xE57B3A|${this.eventInfo.address?.latitude},${this.eventInfo.address?.longitude}`, | |
center: `${this.eventInfo.address?.latitude},${this.eventInfo.address?.longitude}`, | |
}), | |
}, | |
}, | |
], | |
TemplateName: MailTemplateNameEnum.EventVendorInvitation, | |
subjectDataContext: { | |
eventName: this.eventRecord.name, | |
}, | |
}) | |
.subscribe({ | |
next: (res) => { | |
this.alertService.success("Vendor invited successfully"); | |
this.eventTriggerService.vendorInvitedSubject.next(true); | |
this.assignTagToVendor(vendor); | |
}, | |
error: ({ error }: { error: ServerError }) => { | |
this.loading = false; | |
this.alertService.error(formatServerErrorToString(error)); | |
}, | |
}); | |
}, | |
}); | |
} |
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
handleInviteVendor(vendor: OrganizationItem) { | |
this.templateVendorName = vendor?.name; | |
vendor.vendorType = vendor.type; | |
this.confirmationService | |
.confirm(this.confirmSendingInvitation, `Are you sure to proceed?`, "Confirm", "Reject") | |
.then((confirmed) => { | |
if (confirmed) { | |
this.organizationService; | |
this.organizationService.getContactPersonByOrganizationId(vendor.itemId).subscribe({ | |
next: (res) => { | |
this.inviteVendor(vendor, { | |
Department: res.payload.department, | |
Designation: null, | |
ReferenceItemId: res.payload.itemId, | |
FirstName: res.payload.firstName, | |
LastName: res.payload.lastName, | |
Phone: res.payload.phone, | |
CountryCode: res.payload.countryCode, | |
PersonalEmail: res.payload.personalEmail, | |
BusinessEmail: res.payload.businessEmail, | |
DateOfBirth: res.payload.dateOfBirth, | |
OrganizationId: vendor.itemId, | |
IsContactPerson: true, | |
TypeId: res.payload.typeId, | |
gender: res.payload.gender, | |
profilePicture: res.payload.profilePic, | |
}); | |
}, | |
error: ({ error }: { error: ServerError }) => {}, | |
}); | |
} | |
}) | |
.catch(() => { | |
console.log("catch"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment