Teso Business 2.0 angular source code
https://bacwaredev.barhendev.com/teso
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
3 years ago
|
import { Component, Inject, OnInit } from '@angular/core';
|
||
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||
|
import { ConfirmBoxEvokeService } from '@costlydeveloper/ngx-awesome-popup';
|
||
|
import { UserService } from 'app/core/user/user.service';
|
||
|
import { BusinessCategory, TesoBusinessDetail } from 'app/models/businessModel';
|
||
|
import { Subject } from 'rxjs';
|
||
|
import { takeUntil } from 'rxjs/operators';
|
||
|
import { ProfileService } from '../Profile/profile.service';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-temp-shop',
|
||
|
templateUrl: './temp-shop.component.html',
|
||
|
styleUrls: ['./temp-shop.component.scss']
|
||
|
})
|
||
|
export class TempShopComponent implements OnInit {
|
||
|
businessCategories: BusinessCategory[] = [];
|
||
|
selectedCategory: BusinessCategory;
|
||
|
newBusiness: TesoBusinessDetail = {
|
||
|
businessId: "",
|
||
|
Handle: "",
|
||
|
businessName: "",
|
||
|
businessEmail: "",
|
||
|
businessTin: "",
|
||
|
businessDescription: "",
|
||
|
businessCategory: "",
|
||
|
businessAddress: "",
|
||
|
businessContact: "",
|
||
|
businessLogo: "",
|
||
|
dateOfEst: new Date(),
|
||
|
businessDigitalAddress: "",
|
||
|
businessLatitude: "",
|
||
|
businessLongitude: "",
|
||
|
};
|
||
|
private _unsubscribeAll: Subject<any> = new Subject<any>();
|
||
|
constructor(public dialogRef: MatDialogRef<TempShopComponent>, private _profileService: ProfileService, private confirmBoxEvokeService: ConfirmBoxEvokeService,
|
||
|
private _userService: UserService) { }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
this._profileService.categories$.pipe(takeUntil(this._unsubscribeAll)).subscribe((d) => {
|
||
|
this.businessCategories = d;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
closeDialog() {
|
||
|
if (this.newBusiness.businessName != '' && this.newBusiness.businessContact != '' && this.newBusiness.businessDigitalAddress) {
|
||
|
this.confirmBoxEvokeService.info("Confirm Action", `Are you sure you would to add this business as a target for yor coupon ?`, "YES", "NO").subscribe(response => {
|
||
|
if (response.clickedButtonID == "yes") {
|
||
|
this.dialogRef.close(this.newBusiness);
|
||
|
}
|
||
|
});
|
||
|
}else{
|
||
|
this.confirmBoxEvokeService.info("Action Required", `To continue you should have the Business Name, Business Telephone and the digital address of the busines entered `, "OK")
|
||
|
.subscribe(response => {
|
||
|
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|