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 }, taxValue: {type: Number },
vat: {type: Boolean, required:true, default: false}, vat: {type: Boolean, required:true, default: false},
vatValue: {type: Number }, vatValue: {type: Number },
first: {type: String, required:true},
last: {type: String, required:true},
email: {type: String, required:true}, email: {type: String, required:true},
street: {type: String, required:true}, street: {type: String, required:true},
city: {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 { MatSelectModule } from '@angular/material/select';
import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatStepperModule } from '@angular/material/stepper'; import { MatStepperModule } from '@angular/material/stepper';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -34,6 +35,7 @@ import { ScanComponent } from './scan/scan.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { BusinessComponent } from './business/business.component'; import { BusinessComponent } from './business/business.component';
import { SearchOptionsPipe } from './searchoptions.pipe'; import { SearchOptionsPipe } from './searchoptions.pipe';
import { TermsComponent } from './terms/terms.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -52,7 +54,8 @@ import { SearchOptionsPipe } from './searchoptions.pipe';
ScanComponent, ScanComponent,
ListOrdersComponent, ListOrdersComponent,
BusinessComponent, BusinessComponent,
SearchOptionsPipe SearchOptionsPipe,
TermsComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -73,6 +76,7 @@ import { SearchOptionsPipe } from './searchoptions.pipe';
MatProgressBarModule, MatProgressBarModule,
MatStepperModule, MatStepperModule,
MatAutocompleteModule, MatAutocompleteModule,
MatSlideToggleModule,
BrowserAnimationsModule BrowserAnimationsModule
], ],
exports: [ exports: [

View file

@ -9,3 +9,10 @@ mat-card.centercard{
::ng-deep .mat-step-label{ ::ng-deep .mat-step-label{
font-size: 13px; 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> <mat-label>Business Name</mat-label>
<input matInput placeholder="Business Name" formControlName="name"> <input matInput placeholder="Business Name" formControlName="name">
</mat-form-field> </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-form-field appearance="outline">
<mat-label>Address</mat-label> <mat-label>Address</mat-label>
<input matInput placeholder="Address" formControlName="street"> <input matInput placeholder="Address" formControlName="street">
@ -43,8 +51,11 @@
<mat-label>Website</mat-label> <mat-label>Website</mat-label>
<input matInput placeholder="Website" formControlName="website"> <input matInput placeholder="Website" formControlName="website">
</mat-form-field> </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> <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-actions>
</mat-card> </mat-card>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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