Add business contact name

This commit is contained in:
Rene Vergara 2022-01-28 14:03:35 -06:00
parent 031c4f8a87
commit 5e5089af43
13 changed files with 70 additions and 4 deletions

View File

@ -8,6 +8,8 @@ const ownerSchema = mongoose.Schema({
taxValue: {type: Number },
vat: {type: Boolean, required:true, default: false},
vatValue: {type: Number },
first: {type: String, required:true},
last: {type: String, required:true},
email: {type: String, required:true},
street: {type: String, required:true},
city: {type: String, required: true},

View File

@ -15,6 +15,7 @@ import { MatListModule } from '@angular/material/list';
import { MatSelectModule } from '@angular/material/select';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatStepperModule } from '@angular/material/stepper';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@ -34,6 +35,7 @@ import { ScanComponent } from './scan/scan.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { BusinessComponent } from './business/business.component';
import { SearchOptionsPipe } from './searchoptions.pipe';
import { TermsComponent } from './terms/terms.component';
@NgModule({
declarations: [
@ -52,7 +54,8 @@ import { SearchOptionsPipe } from './searchoptions.pipe';
ScanComponent,
ListOrdersComponent,
BusinessComponent,
SearchOptionsPipe
SearchOptionsPipe,
TermsComponent
],
imports: [
BrowserModule,
@ -73,6 +76,7 @@ import { SearchOptionsPipe } from './searchoptions.pipe';
MatProgressBarModule,
MatStepperModule,
MatAutocompleteModule,
MatSlideToggleModule,
BrowserAnimationsModule
],
exports: [

View File

@ -9,3 +9,10 @@ mat-card.centercard{
::ng-deep .mat-step-label{
font-size: 13px;
}
::ng-deep .mat-slide-toggle-content{
font-family: 'Spartan', sans-serif;
font-size: 11px;
}
a.link{
text-decoration: underline;
}

View File

@ -10,6 +10,14 @@
<mat-label>Business Name</mat-label>
<input matInput placeholder="Business Name" formControlName="name">
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Contact First Name</mat-label>
<input matInput placeholder="First Name" formControlName="first">
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Contact Last Name</mat-label>
<input matInput placeholder="Last Name" formControlName="last">
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Address</mat-label>
<input matInput placeholder="Address" formControlName="street">
@ -43,8 +51,11 @@
<mat-label>Website</mat-label>
<input matInput placeholder="Website" formControlName="website">
</mat-form-field>
<mat-slide-toggle (change)="onChange($event)">
I accept the <a class="link" (click)="showTerms()">Terms of Use</a>
</mat-slide-toggle>
<mat-card-actions>
<button mat-raised-button color="primary" [disabled]="bizForm.invalid" (click)="save()">Save</button>
<button mat-raised-button color="primary" [disabled]="bizForm.invalid || !termsChecked" (click)="save()">Save</button>
</mat-card-actions>
</mat-card>

View File

@ -6,6 +6,7 @@ import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { filter, startWith, map, switchMap } from 'rxjs/operators';
import { MatStepper } from '@angular/material/stepper';
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { Country } from '../country.model';
import { Owner } from '../owner.model';
import { User } from '../user.model';
@ -13,6 +14,7 @@ import { UserService } from '../user.service';
import { FullnodeService } from '../fullnode.service';
import { SearchOptionsPipe } from '../searchoptions.pipe';
import { ScanComponent } from '../scan/scan.component';
import { TermsComponent } from '../terms/terms.component';
@Component({
selector: 'app-business',
@ -50,6 +52,8 @@ export class BusinessComponent implements OnInit {
vatValue: 0,
phone: '',
paid: false,
first: '',
last: '',
name: '',
street: '',
city: '',
@ -65,6 +69,7 @@ export class BusinessComponent implements OnInit {
public userUpdate: Observable<User>;
sessionId = '';
ownerKnown = false;
termsChecked = false;
constructor(
private fb: FormBuilder,
@ -85,13 +90,16 @@ export class BusinessComponent implements OnInit {
});
this.bizForm = fb.group({
name: ['', Validators.required],
first: ['', Validators.required],
last: ['', Validators.required],
street: ['', Validators.required],
city: ['', Validators.required],
state: ['', Validators.required],
postal: ['', Validators.required],
country: ['', Validators.required],
email: ['', [Validators.email, Validators.required]],
website: ['']
website: [''],
terms: [false]
});
this.payForm= fb.group({
session: ['', Validators.required]
@ -116,6 +124,22 @@ export class BusinessComponent implements OnInit {
});
}
onChange(ob: MatSlideToggleChange){
console.log(ob.checked);
this.termsChecked = ob.checked;
}
showTerms() {
const dialogConfig = new MatDialogConfig();
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
const dialogRef = this.dialog.open(TermsComponent, dialogConfig);
dialogRef.afterClosed().subscribe(val => {
console.log('Terms read');
});
}
save() {
this.owner = {
address: '',
@ -124,6 +148,8 @@ export class BusinessComponent implements OnInit {
taxValue: 0,
vat: false,
vatValue: 0,
first: '',
last: '',
phone: '',
paid: false,
name: this.bizForm.get('name')!.value,

View File

@ -31,6 +31,8 @@ export class FullnodeService{
taxValue: 0,
vat: false,
vatValue: 0,
first: '',
last: '',
email: '',
street: '',
city: '',

View File

@ -24,6 +24,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
taxValue: 0,
vat: false,
vatValue: 0,
first: '',
last: '',
email: '',
street: '',
city: '',

View File

@ -29,6 +29,8 @@ export class ItemListComponent implements OnInit{
taxValue: 0,
vat: false,
vatValue: 0,
first: '',
last: '',
email: '',
street: '',
city: '',

View File

@ -47,6 +47,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
taxValue:0,
vat: false,
vatValue: 0,
first: '',
last: '',
email: '',
street: '',
city: '',

View File

@ -31,6 +31,8 @@ export class OrderService {
taxValue: 0,
vat: false,
vatValue: 0,
first: '',
last: '',
email: '',
street: '',
city: '',

View File

@ -7,6 +7,8 @@ export interface Owner {
taxValue: number;
vat: boolean;
vatValue: number;
first: string;
last: string;
email: string;
street: string;
city: string;

View File

@ -27,6 +27,8 @@ export class UserService{
taxValue: 0,
vat: false,
vatValue: 0,
first: '',
last: '',
email: '',
street: '',
city: '',

View File

@ -37,6 +37,8 @@ export class ViewerComponent implements OnInit {
taxValue: 0,
vat: false,
vatValue: 0,
first: '',
last: '',
email: '',
street: '',
city: '',
@ -115,7 +117,7 @@ export class ViewerComponent implements OnInit {
loginCheck(){
var today = new Date().getTime() / 1000;
//console.log('User check', this.user.validated);
if (this.user.expiration < today || !this.user.validated) {
if (!this.owner.paid || !this.user.validated) {
console.log('Log in expired!');
this.router.navigate(['/login']);
}