Fehlerbehebung & Start Vector Search

This commit is contained in:
2024-07-11 17:09:35 +02:00
parent 7bd5e1aaf8
commit b4644ea295
20 changed files with 381 additions and 245 deletions

View File

@@ -9,6 +9,7 @@
<input type="email" id="email" name="email" [(ngModel)]="user.email" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" />
<p class="text-xs text-gray-500 mt-1">You can only modify your email by contacting us at support&#64;bizwatch.net</p>
</div>
@if (isProfessional){
<div class="flex flex-row items-center justify-around md:space-x-4">
<div class="flex h-full justify-between flex-col">
<p class="text-sm font-medium text-gray-700 mb-1">Company Logo</p>
@@ -55,6 +56,7 @@
</button>
</div>
</div>
}
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
@@ -75,14 +77,16 @@
<option *ngFor="let type of customerTypes" [value]="type">{{ type | titlecase }}</option>
</select>
</div>
@if (isProfessional){
<div>
<label for="customerSubType" class="block text-sm font-medium text-gray-700">Professional Type</label>
<select id="customerSubType" name="customerSubType" [(ngModel)]="user.customerSubType" required class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
<option *ngFor="let subType of customerSubTypes" [value]="subType">{{ subType | titlecase }}</option>
</select>
</div>
}
</div>
@if (isProfessional){
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="companyName" class="block text-sm font-medium text-gray-700">Company Name</label>
@@ -178,7 +182,7 @@
<span class="text-sm text-gray-500 ml-2">[Add more licenses or remove existing ones.]</span>
</div>
</div>
}
<div class="flex justify-start">
<button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" (click)="updateProfile(user)">
Update Profile
@@ -263,7 +267,6 @@
<!-- @if(showModal){ -->
<app-image-crop-and-upload [uploadParams]="uploadParams" (uploadFinished)="uploadFinished($event)"></app-image-crop-and-upload>
<app-confirmation></app-confirmation>
<app-message></app-message>
<!-- } -->
<!-- <div class="surface-ground px-4 py-8 md:px-6 lg:px-8">
<div class="p-fluid flex flex-column lg:flex-row">

View File

@@ -23,7 +23,7 @@ import { SharedService } from '../../../services/shared.service';
import { SubscriptionsService } from '../../../services/subscriptions.service';
import { UserService } from '../../../services/user.service';
import { SharedModule } from '../../../shared/shared/shared.module';
import { map2User } from '../../../utils/utils';
import { createDefaultUser, map2User } from '../../../utils/utils';
import { TOOLBAR_OPTIONS } from '../../utils/defaults';
@Component({
selector: 'app-account',
@@ -34,13 +34,10 @@ import { TOOLBAR_OPTIONS } from '../../utils/defaults';
styleUrl: './account.component.scss',
})
export class AccountComponent {
// @ViewChild('companyUpload') public companyUpload: FileUpload;
// @ViewChild('profileUpload') public profileUpload: FileUpload;
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
user: User;
subscriptions: Array<Subscription>;
userSubscriptions: Array<Subscription> = [];
maxFileSize = 15000000;
companyLogoUrl: string;
profileUrl: string;
type: 'company' | 'profile';
@@ -101,8 +98,16 @@ export class AccountComponent {
printInvoice(invoice: Invoice) {}
async updateProfile(user: User) {
if (this.user.customerType === 'buyer') {
const id = this.user.id;
this.user = createDefaultUser(this.user.email, this.user.firstname, this.user.lastname);
this.user.customerType = 'buyer';
this.user.id = id;
this.imageService.deleteLogoImagesByMail(this.user.email);
this.imageService.deleteProfileImagesByMail(this.user.email);
}
await this.userService.save(this.user);
// this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Account changes have been persisted', life: 3000 });
this.messageService.addMessage({ severity: 'success', text: 'Account changes have been persisted', duration: 3000 });
}
onUploadCompanyLogo(event: any) {
@@ -162,13 +167,18 @@ export class AccountComponent {
if (confirmed) {
if (type === 'profile') {
this.user.hasProfile = false;
await Promise.all([this.imageService.deleteProfileImagesById(this.user.email), this.userService.save(this.user)]);
await Promise.all([this.imageService.deleteProfileImagesByMail(this.user.email), this.userService.save(this.user)]);
} else {
this.user.hasCompanyLogo = false;
await Promise.all([this.imageService.deleteLogoImagesById(this.user.email), this.userService.save(this.user)]);
await Promise.all([this.imageService.deleteLogoImagesByMail(this.user.email), this.userService.save(this.user)]);
}
this.user = await this.userService.getById(this.user.id);
this.messageService.showMessage('Image deleted');
// this.messageService.showMessage('Image deleted');
this.messageService.addMessage({
severity: 'success',
text: 'Image deleted.',
duration: 3000, // 3 seconds
});
}
}
// select(event: any, type: 'company' | 'profile') {