Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d5b7e3f39 | |||
| d488f90f48 | |||
| 044f8efa0f | |||
| 24a3d210f0 | |||
| 2465b8966b | |||
| e87222d3c1 | |||
| 902ab9caed | |||
| 44acbcd4d0 | |||
| b4cf17b8ea | |||
| 226d2ebc1e | |||
| 0473f74241 | |||
| c9d94e973a | |||
| f9d9c6ad9e | |||
| 5dc893da38 | |||
| c471629c6d | |||
| 13fb3cd4b8 | |||
| d6768b3da9 | |||
| 7fdc87fb0b | |||
| 0b7e33612a | |||
| 8fba3aa832 | |||
| 214327031c | |||
| dc9adb151d | |||
| 747435bfba | |||
| 782c254a33 | |||
| df4e2b00e2 | |||
| 0684b9534f | |||
| e0ecea5af2 | |||
| 327aef0f21 | |||
| cb73daf863 | |||
| 08c53e2eb2 | |||
| 492c03c2be | |||
| f51a298227 | |||
| 474d7c63d5 | |||
| d2e5562602 | |||
| aff55c5433 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -48,6 +48,9 @@ public
|
|||||||
.env.test.local
|
.env.test.local
|
||||||
.env.production.local
|
.env.production.local
|
||||||
.env.local
|
.env.local
|
||||||
|
.env.prod
|
||||||
|
.env.dev
|
||||||
|
.env.test
|
||||||
|
|
||||||
# temp directory
|
# temp directory
|
||||||
.temp
|
.temp
|
||||||
@@ -62,7 +65,6 @@ pids
|
|||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
*.js
|
|
||||||
*.map
|
*.map
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
|
||||||
|
|||||||
25
bizmatch-server/.eslintrc.js
Normal file
25
bizmatch-server/.eslintrc.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
module.exports = {
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
project: 'tsconfig.json',
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||||
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
],
|
||||||
|
root: true,
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
jest: true,
|
||||||
|
},
|
||||||
|
ignorePatterns: ['.eslintrc.js'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/interface-name-prefix': 'off',
|
||||||
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
},
|
||||||
|
};
|
||||||
1
bizmatch-server/.gitignore
vendored
1
bizmatch-server/.gitignore
vendored
@@ -56,3 +56,4 @@ pids
|
|||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
pictures
|
pictures
|
||||||
|
pictures_base
|
||||||
38
bizmatch-server/.vscode/launch.json
vendored
38
bizmatch-server/.vscode/launch.json
vendored
@@ -6,17 +6,15 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug Nest Framework",
|
"name": "Debug Nest Framework",
|
||||||
"runtimeExecutable": "npm",
|
"runtimeExecutable": "npm",
|
||||||
"runtimeArgs": [
|
"runtimeArgs": ["run", "start:debug", "--", "--inspect-brk"],
|
||||||
"run",
|
|
||||||
"start:debug",
|
|
||||||
"--",
|
|
||||||
"--inspect-brk"
|
|
||||||
],
|
|
||||||
"autoAttachChildProcesses": true,
|
"autoAttachChildProcesses": true,
|
||||||
"restart": true,
|
"restart": true,
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"stopOnEntry": false,
|
"stopOnEntry": false,
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
|
"env": {
|
||||||
|
"HOST_NAME": "localhost"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
@@ -24,9 +22,7 @@
|
|||||||
"name": "Debug Current TS File",
|
"name": "Debug Current TS File",
|
||||||
"program": "${workspaceFolder}/dist/src/drizzle/${fileBasenameNoExtension}.js",
|
"program": "${workspaceFolder}/dist/src/drizzle/${fileBasenameNoExtension}.js",
|
||||||
"preLaunchTask": "tsc: build - tsconfig.json",
|
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||||
"outFiles": [
|
"outFiles": ["${workspaceFolder}/out/**/*.js"],
|
||||||
"${workspaceFolder}/out/**/*.js"
|
|
||||||
],
|
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"smartStep": true,
|
"smartStep": true,
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
@@ -35,31 +31,21 @@
|
|||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "generateDefs",
|
"name": "generateDefs",
|
||||||
"skipFiles": [
|
"skipFiles": ["<node_internals>/**"],
|
||||||
"<node_internals>/**"
|
|
||||||
],
|
|
||||||
"program": "${workspaceFolder}/dist/src/drizzle/generateDefs.js",
|
"program": "${workspaceFolder}/dist/src/drizzle/generateDefs.js",
|
||||||
"outFiles": [
|
"outFiles": ["${workspaceFolder}/dist/src/drizzle/**/*.js"],
|
||||||
"${workspaceFolder}/dist/src/drizzle/**/*.js"
|
|
||||||
],
|
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"smartStep": true,
|
"smartStep": true
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "generateTypes",
|
"name": "generateTypes",
|
||||||
"skipFiles": [
|
"skipFiles": ["<node_internals>/**"],
|
||||||
"<node_internals>/**"
|
|
||||||
],
|
|
||||||
"program": "${workspaceFolder}/dist/src/drizzle/generateTypes.js",
|
"program": "${workspaceFolder}/dist/src/drizzle/generateTypes.js",
|
||||||
"outFiles": [
|
"outFiles": ["${workspaceFolder}/dist/src/drizzle/**/*.js"],
|
||||||
"${workspaceFolder}/dist/src/drizzle/**/*.js"
|
|
||||||
],
|
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"smartStep": true,
|
"smartStep": true
|
||||||
|
}
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -9,10 +9,10 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "nest build",
|
"build": "nest build",
|
||||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
"start": "nest start",
|
"start": "HOST_NAME=localhost nest start",
|
||||||
"start:dev": "nest start --watch",
|
"start:dev": "HOST_NAME=dev.bizmatch.net nest start --watch",
|
||||||
"start:debug": "nest start --debug --watch",
|
"start:debug": "nest start --debug --watch",
|
||||||
"start:prod": "node dist/main",
|
"start:prod": "HOST_NAME=www.bizmatch.net node dist/main",
|
||||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
@@ -37,7 +37,9 @@
|
|||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"drizzle-orm": "^0.30.8",
|
"drizzle-orm": "^0.30.8",
|
||||||
|
"fs-extra": "^11.2.0",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.8",
|
||||||
|
"jwks-rsa": "^3.1.0",
|
||||||
"ky": "^1.2.0",
|
"ky": "^1.2.0",
|
||||||
"nest-winston": "^1.9.4",
|
"nest-winston": "^1.9.4",
|
||||||
"nodemailer": "^6.9.10",
|
"nodemailer": "^6.9.10",
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
|
||||||
import { AppService } from './app.service.js';
|
import { AppService } from './app.service.js';
|
||||||
|
import { AuthService } from './auth/auth.service.js';
|
||||||
|
import { JwtAuthGuard } from './jwt-auth/jwt-auth.guard.js';
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AppController {
|
export class AppController {
|
||||||
constructor(private readonly appService: AppService) {}
|
constructor(
|
||||||
|
private readonly appService: AppService,
|
||||||
|
private authService: AuthService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
@Get()
|
@Get()
|
||||||
getHello(): string {
|
getHello(@Request() req): string {
|
||||||
return this.appService.getHello();
|
return req.user;
|
||||||
|
//return 'dfgdf';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { MiddlewareConsumer, Module } from '@nestjs/common';
|
import { MiddlewareConsumer, Module } from '@nestjs/common';
|
||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
|
import { PassportModule } from '@nestjs/passport';
|
||||||
|
import * as dotenv from 'dotenv';
|
||||||
|
import fs from 'fs-extra';
|
||||||
import { WinstonModule, utilities as nestWinstonModuleUtilities } from 'nest-winston';
|
import { WinstonModule, utilities as nestWinstonModuleUtilities } from 'nest-winston';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
@@ -14,12 +17,37 @@ import { ListingsModule } from './listings/listings.module.js';
|
|||||||
import { MailModule } from './mail/mail.module.js';
|
import { MailModule } from './mail/mail.module.js';
|
||||||
import { RequestDurationMiddleware } from './request-duration/request-duration.middleware.js';
|
import { RequestDurationMiddleware } from './request-duration/request-duration.middleware.js';
|
||||||
import { SelectOptionsModule } from './select-options/select-options.module.js';
|
import { SelectOptionsModule } from './select-options/select-options.module.js';
|
||||||
import { SubscriptionsController } from './subscriptions/subscriptions.controller.js';
|
|
||||||
import { UserModule } from './user/user.module.js';
|
import { UserModule } from './user/user.module.js';
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
function loadEnvFiles() {
|
||||||
|
// Load the .env file
|
||||||
|
dotenv.config();
|
||||||
|
console.log('Loaded .env file');
|
||||||
|
|
||||||
|
// Determine which additional env file to load
|
||||||
|
let envFilePath = '';
|
||||||
|
const host = process.env.HOST_NAME || '';
|
||||||
|
|
||||||
|
if (host.includes('localhost')) {
|
||||||
|
envFilePath = '.env.local';
|
||||||
|
} else if (host.includes('dev.bizmatch.net')) {
|
||||||
|
envFilePath = '.env.dev';
|
||||||
|
} else if (host.includes('www.bizmatch.net') || host.includes('bizmatch.net')) {
|
||||||
|
envFilePath = '.env.prod';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the additional env file if it exists
|
||||||
|
if (fs.existsSync(envFilePath)) {
|
||||||
|
dotenv.config({ path: envFilePath });
|
||||||
|
console.log(`Loaded ${envFilePath} file`);
|
||||||
|
} else {
|
||||||
|
console.log(`No additional .env file found for HOST_NAME: ${host}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadEnvFiles();
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({ isGlobal: true }),
|
ConfigModule.forRoot({ isGlobal: true }),
|
||||||
@@ -46,8 +74,9 @@ const __dirname = path.dirname(__filename);
|
|||||||
ListingsModule,
|
ListingsModule,
|
||||||
SelectOptionsModule,
|
SelectOptionsModule,
|
||||||
ImageModule,
|
ImageModule,
|
||||||
|
PassportModule,
|
||||||
],
|
],
|
||||||
controllers: [AppController, SubscriptionsController],
|
controllers: [AppController],
|
||||||
providers: [AppService, FileService],
|
providers: [AppService, FileService],
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { MailerModule } from '@nestjs-modules/mailer';
|
import { PassportModule } from '@nestjs/passport';
|
||||||
import path, { join } from 'path';
|
import path from 'path';
|
||||||
import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter.js';
|
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { AuthService } from './auth.service.js';
|
import { JwtStrategy } from '../jwt.strategy.js';
|
||||||
import { AuthController } from './auth.controller.js';
|
import { AuthController } from './auth.controller.js';
|
||||||
|
import { AuthService } from './auth.service.js';
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [PassportModule],
|
||||||
],
|
providers: [AuthService, JwtStrategy],
|
||||||
providers: [AuthService],
|
|
||||||
controllers: [AuthController],
|
controllers: [AuthController],
|
||||||
exports:[AuthService]
|
exports: [AuthService],
|
||||||
})
|
})
|
||||||
export class AuthModule {}
|
export class AuthModule {}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
import 'dotenv/config';
|
import 'dotenv/config';
|
||||||
import { drizzle } from 'drizzle-orm/node-postgres';
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
||||||
import { existsSync, readFileSync, readdirSync, statSync, unlinkSync } from 'fs';
|
import { existsSync, readFileSync, readdirSync, statSync, unlinkSync } from 'fs';
|
||||||
|
import fs from 'fs-extra';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import pkg from 'pg';
|
import pkg from 'pg';
|
||||||
import { rimraf } from 'rimraf';
|
import { rimraf } from 'rimraf';
|
||||||
import sharp from 'sharp';
|
import sharp from 'sharp';
|
||||||
import { BusinessListing, CommercialPropertyListing, User } from 'src/models/db.model.js';
|
import { BusinessListing, CommercialPropertyListing, User, UserData } from 'src/models/db.model.js';
|
||||||
|
import { emailToDirName } from 'src/models/main.model.js';
|
||||||
import * as schema from './schema.js';
|
import * as schema from './schema.js';
|
||||||
const { Pool } = pkg;
|
const { Pool } = pkg;
|
||||||
|
|
||||||
@@ -22,9 +24,9 @@ await db.delete(schema.users);
|
|||||||
//Broker
|
//Broker
|
||||||
let filePath = `./data/broker.json`;
|
let filePath = `./data/broker.json`;
|
||||||
let data: string = readFileSync(filePath, 'utf8');
|
let data: string = readFileSync(filePath, 'utf8');
|
||||||
const userData: User[] = JSON.parse(data); // Erwartet ein Array von Objekten
|
const usersData: UserData[] = JSON.parse(data); // Erwartet ein Array von Objekten
|
||||||
const generatedUserData = [];
|
const generatedUserData = [];
|
||||||
console.log(userData.length);
|
console.log(usersData.length);
|
||||||
let i = 0,
|
let i = 0,
|
||||||
male = 0,
|
male = 0,
|
||||||
female = 0;
|
female = 0;
|
||||||
@@ -32,25 +34,52 @@ const targetPathProfile = `./pictures/profile`;
|
|||||||
deleteFilesOfDir(targetPathProfile);
|
deleteFilesOfDir(targetPathProfile);
|
||||||
const targetPathLogo = `./pictures/logo`;
|
const targetPathLogo = `./pictures/logo`;
|
||||||
deleteFilesOfDir(targetPathLogo);
|
deleteFilesOfDir(targetPathLogo);
|
||||||
for (const user of userData) {
|
const targetPathProperty = `./pictures/property`;
|
||||||
delete user.id;
|
deleteFilesOfDir(targetPathProperty);
|
||||||
user.licensedIn = user.licensedIn.map(l => `${l['name']}|${l['value']}`);
|
fs.ensureDirSync(`./pictures/logo`);
|
||||||
|
fs.ensureDirSync(`./pictures/profile`);
|
||||||
|
fs.ensureDirSync(`./pictures/property`);
|
||||||
|
for (const userData of usersData) {
|
||||||
|
const user: User = { firstname: '', lastname: '', email: '' };
|
||||||
|
user.licensedIn = [];
|
||||||
|
userData.licensedIn.forEach(l => {
|
||||||
|
console.log(l['value'], l['name']);
|
||||||
|
user.licensedIn.push({ registerNo: l['value'], state: l['name'] });
|
||||||
|
});
|
||||||
|
user.areasServed = [];
|
||||||
|
user.areasServed = userData.areasServed.map(l => {
|
||||||
|
return { county: l.split(',')[0].trim(), state: l.split(',')[1].trim() };
|
||||||
|
});
|
||||||
user.hasCompanyLogo = true;
|
user.hasCompanyLogo = true;
|
||||||
user.hasProfile = true;
|
user.hasProfile = true;
|
||||||
const u = await db.insert(schema.users).values(user).returning({ insertedId: schema.users.id, gender: schema.users.gender });
|
user.firstname = userData.firstname;
|
||||||
generatedUserData.push(u[0].insertedId);
|
user.lastname = userData.lastname;
|
||||||
|
user.email = userData.email;
|
||||||
|
user.phoneNumber = userData.phoneNumber;
|
||||||
|
user.description = userData.description;
|
||||||
|
user.companyName = userData.companyName;
|
||||||
|
user.companyOverview = userData.companyOverview;
|
||||||
|
user.companyWebsite = userData.companyWebsite;
|
||||||
|
user.companyLocation = userData.companyLocation;
|
||||||
|
user.offeredServices = userData.offeredServices;
|
||||||
|
user.gender = userData.gender;
|
||||||
|
user.created = new Date();
|
||||||
|
user.updated = new Date();
|
||||||
|
const u = await db.insert(schema.users).values(user).returning({ insertedId: schema.users.id, gender: schema.users.gender, email: schema.users.email });
|
||||||
|
generatedUserData.push(u[0]);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (u[0].gender === 'male') {
|
if (u[0].gender === 'male') {
|
||||||
male++;
|
male++;
|
||||||
const data = readFileSync(`./pictures/profile_base/Mann_${male}.jpg`);
|
const data = readFileSync(`./pictures_base/profile/Mann_${male}.jpg`);
|
||||||
await storeProfilePicture(data, u[0].insertedId);
|
await storeProfilePicture(data, emailToDirName(u[0].email));
|
||||||
} else {
|
} else {
|
||||||
female++;
|
female++;
|
||||||
const data = readFileSync(`./pictures/profile_base/Frau_${male}.jpg`);
|
const data = readFileSync(`./pictures_base/profile/Frau_${female}.jpg`);
|
||||||
await storeProfilePicture(data, u[0].insertedId);
|
await storeProfilePicture(data, emailToDirName(u[0].email));
|
||||||
}
|
}
|
||||||
const data = readFileSync(`./pictures/logos_base/${i}.jpg`);
|
const data = readFileSync(`./pictures_base/logo/${i}.jpg`);
|
||||||
await storeCompanyLogo(data, u[0].insertedId);
|
await storeCompanyLogo(data, emailToDirName(u[0].email));
|
||||||
}
|
}
|
||||||
//Business Listings
|
//Business Listings
|
||||||
filePath = `./data/businesses.json`;
|
filePath = `./data/businesses.json`;
|
||||||
@@ -60,7 +89,10 @@ const businessJsonData = JSON.parse(data) as BusinessListing[]; // Erwartet ein
|
|||||||
for (const business of businessJsonData) {
|
for (const business of businessJsonData) {
|
||||||
delete business.id;
|
delete business.id;
|
||||||
business.created = new Date(business.created);
|
business.created = new Date(business.created);
|
||||||
business.userId = getRandomItem(generatedUserData);
|
business.updated = new Date(business.created);
|
||||||
|
const user = getRandomItem(generatedUserData);
|
||||||
|
business.userId = user.insertedId;
|
||||||
|
business.imageName = emailToDirName(user.email);
|
||||||
await db.insert(schema.businesses).values(business);
|
await db.insert(schema.businesses).values(business);
|
||||||
}
|
}
|
||||||
//Corporate Listings
|
//Corporate Listings
|
||||||
@@ -70,12 +102,21 @@ const commercialJsonData = JSON.parse(data) as CommercialPropertyListing[]; // E
|
|||||||
for (const commercial of commercialJsonData) {
|
for (const commercial of commercialJsonData) {
|
||||||
const id = commercial.id;
|
const id = commercial.id;
|
||||||
delete commercial.id;
|
delete commercial.id;
|
||||||
|
const user = getRandomItem(generatedUserData);
|
||||||
commercial.imageOrder = getFilenames(id);
|
commercial.imageOrder = getFilenames(id);
|
||||||
commercial.imagePath = id;
|
commercial.imagePath = emailToDirName(user.email);
|
||||||
commercial.created = getRandomDateWithinLastYear();
|
const insertionDate = getRandomDateWithinLastYear();
|
||||||
commercial.userId = getRandomItem(generatedUserData);
|
commercial.created = insertionDate;
|
||||||
await db.insert(schema.commercials).values(commercial);
|
commercial.updated = insertionDate;
|
||||||
|
commercial.userId = user.insertedId;
|
||||||
|
commercial.draft = false;
|
||||||
|
const result = await db.insert(schema.commercials).values(commercial).returning();
|
||||||
|
//fs.ensureDirSync(`./pictures/property/${result[0].imagePath}/${result[0].serialId}`);
|
||||||
|
try {
|
||||||
|
fs.copySync(`./pictures_base/property/${id}`, `./pictures/property/${result[0].imagePath}/${result[0].serialId}`);
|
||||||
|
} catch (err) {
|
||||||
|
console.log(`----- No pictures available for ${id} ------`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//End
|
//End
|
||||||
@@ -91,7 +132,7 @@ function getRandomItem<T>(arr: T[]): T {
|
|||||||
}
|
}
|
||||||
function getFilenames(id: string): string[] {
|
function getFilenames(id: string): string[] {
|
||||||
try {
|
try {
|
||||||
let filePath = `./pictures/property/${id}`;
|
let filePath = `./pictures_base/property/${id}`;
|
||||||
return readdirSync(filePath);
|
return readdirSync(filePath);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
@@ -117,14 +158,14 @@ async function storeProfilePicture(buffer: Buffer, userId: string) {
|
|||||||
await sharp(output).toFile(`./pictures/profile/${userId}.avif`);
|
await sharp(output).toFile(`./pictures/profile/${userId}.avif`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function storeCompanyLogo(buffer: Buffer, userId: string) {
|
async function storeCompanyLogo(buffer: Buffer, adjustedEmail: string) {
|
||||||
let quality = 50;
|
let quality = 50;
|
||||||
const output = await sharp(buffer)
|
const output = await sharp(buffer)
|
||||||
.resize({ width: 300 })
|
.resize({ width: 300 })
|
||||||
.avif({ quality }) // Verwende AVIF
|
.avif({ quality }) // Verwende AVIF
|
||||||
//.webp({ quality }) // Verwende Webp
|
//.webp({ quality }) // Verwende Webp
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
await sharp(output).toFile(`./pictures/logo/${userId}.avif`); // Ersetze Dateierweiterung
|
await sharp(output).toFile(`./pictures/logo/${adjustedEmail}.avif`); // Ersetze Dateierweiterung
|
||||||
// await fs.outputFile(`./pictures/logo/${userId}`, file.buffer);
|
// await fs.outputFile(`./pictures/logo/${userId}`, file.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "gender" AS ENUM('male', 'female');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
CREATE TABLE IF NOT EXISTS "businesses" (
|
CREATE TABLE IF NOT EXISTS "businesses" (
|
||||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
"userId" uuid,
|
"userId" uuid,
|
||||||
@@ -22,6 +28,7 @@ CREATE TABLE IF NOT EXISTS "businesses" (
|
|||||||
"reasonForSale" varchar(255),
|
"reasonForSale" varchar(255),
|
||||||
"brokerLicencing" varchar(255),
|
"brokerLicencing" varchar(255),
|
||||||
"internals" text,
|
"internals" text,
|
||||||
|
"imagePath" varchar(200),
|
||||||
"created" timestamp,
|
"created" timestamp,
|
||||||
"updated" timestamp,
|
"updated" timestamp,
|
||||||
"visits" integer,
|
"visits" integer,
|
||||||
@@ -30,6 +37,7 @@ CREATE TABLE IF NOT EXISTS "businesses" (
|
|||||||
--> statement-breakpoint
|
--> statement-breakpoint
|
||||||
CREATE TABLE IF NOT EXISTS "commercials" (
|
CREATE TABLE IF NOT EXISTS "commercials" (
|
||||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||||
|
"serial_id" serial NOT NULL,
|
||||||
"userId" uuid,
|
"userId" uuid,
|
||||||
"type" integer,
|
"type" integer,
|
||||||
"title" varchar(255),
|
"title" varchar(255),
|
||||||
@@ -38,6 +46,7 @@ CREATE TABLE IF NOT EXISTS "commercials" (
|
|||||||
"state" char(2),
|
"state" char(2),
|
||||||
"price" double precision,
|
"price" double precision,
|
||||||
"favoritesForUser" varchar(30)[],
|
"favoritesForUser" varchar(30)[],
|
||||||
|
"listingsCategory" varchar(255),
|
||||||
"hideImage" boolean,
|
"hideImage" boolean,
|
||||||
"draft" boolean,
|
"draft" boolean,
|
||||||
"zipCode" integer,
|
"zipCode" integer,
|
||||||
@@ -45,8 +54,8 @@ CREATE TABLE IF NOT EXISTS "commercials" (
|
|||||||
"email" varchar(255),
|
"email" varchar(255),
|
||||||
"website" varchar(255),
|
"website" varchar(255),
|
||||||
"phoneNumber" varchar(255),
|
"phoneNumber" varchar(255),
|
||||||
"imageOrder" varchar(30)[],
|
"imageOrder" varchar(200)[],
|
||||||
"imagePath" varchar(50),
|
"imagePath" varchar(200),
|
||||||
"created" timestamp,
|
"created" timestamp,
|
||||||
"updated" timestamp,
|
"updated" timestamp,
|
||||||
"visits" integer,
|
"visits" integer,
|
||||||
@@ -65,10 +74,13 @@ CREATE TABLE IF NOT EXISTS "users" (
|
|||||||
"companyWebsite" varchar(255),
|
"companyWebsite" varchar(255),
|
||||||
"companyLocation" varchar(255),
|
"companyLocation" varchar(255),
|
||||||
"offeredServices" text,
|
"offeredServices" text,
|
||||||
"areasServed" varchar(100)[],
|
"areasServed" jsonb,
|
||||||
"hasProfile" boolean,
|
"hasProfile" boolean,
|
||||||
"hasCompanyLogo" boolean,
|
"hasCompanyLogo" boolean,
|
||||||
"licensedIn" varchar(50)[]
|
"licensedIn" jsonb,
|
||||||
|
"gender" "gender",
|
||||||
|
"created" timestamp,
|
||||||
|
"updated" timestamp
|
||||||
);
|
);
|
||||||
--> statement-breakpoint
|
--> statement-breakpoint
|
||||||
DO $$ BEGIN
|
DO $$ BEGIN
|
||||||
@@ -1 +0,0 @@
|
|||||||
ALTER TABLE "commercials" ALTER COLUMN "imageOrder" SET DATA TYPE varchar(200)[];
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
DO $$ BEGIN
|
||||||
|
CREATE TYPE "customerType" AS ENUM('buyer', 'broker', 'professional');
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "users" ADD COLUMN "customerType" "customerType";
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
DO $$ BEGIN
|
|
||||||
CREATE TYPE "gender" AS ENUM('male', 'female');
|
|
||||||
EXCEPTION
|
|
||||||
WHEN duplicate_object THEN null;
|
|
||||||
END $$;
|
|
||||||
--> statement-breakpoint
|
|
||||||
ALTER TABLE "users" ADD COLUMN "gender" "gender";
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ALTER TABLE "commercials" ADD COLUMN "listingsCategory" varchar(255);
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"id": "f6d421f9-2394-4a1c-9268-9e46285f0a41",
|
"id": "fc58c59b-ac5c-406e-8fdb-b05de40aed17",
|
||||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||||
"version": "5",
|
"version": "5",
|
||||||
"dialect": "pg",
|
"dialect": "pg",
|
||||||
@@ -147,6 +147,12 @@
|
|||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
|
"imagePath": {
|
||||||
|
"name": "imagePath",
|
||||||
|
"type": "varchar(200)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
"created": {
|
"created": {
|
||||||
"name": "created",
|
"name": "created",
|
||||||
"type": "timestamp",
|
"type": "timestamp",
|
||||||
@@ -202,6 +208,12 @@
|
|||||||
"notNull": true,
|
"notNull": true,
|
||||||
"default": "gen_random_uuid()"
|
"default": "gen_random_uuid()"
|
||||||
},
|
},
|
||||||
|
"serial_id": {
|
||||||
|
"name": "serial_id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
"userId": {
|
"userId": {
|
||||||
"name": "userId",
|
"name": "userId",
|
||||||
"type": "uuid",
|
"type": "uuid",
|
||||||
@@ -250,6 +262,12 @@
|
|||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
|
"listingsCategory": {
|
||||||
|
"name": "listingsCategory",
|
||||||
|
"type": "varchar(255)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
"hideImage": {
|
"hideImage": {
|
||||||
"name": "hideImage",
|
"name": "hideImage",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
@@ -294,13 +312,13 @@
|
|||||||
},
|
},
|
||||||
"imageOrder": {
|
"imageOrder": {
|
||||||
"name": "imageOrder",
|
"name": "imageOrder",
|
||||||
"type": "varchar(30)[]",
|
"type": "varchar(200)[]",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
"imagePath": {
|
"imagePath": {
|
||||||
"name": "imagePath",
|
"name": "imagePath",
|
||||||
"type": "varchar(50)",
|
"type": "varchar(200)",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
@@ -421,7 +439,7 @@
|
|||||||
},
|
},
|
||||||
"areasServed": {
|
"areasServed": {
|
||||||
"name": "areasServed",
|
"name": "areasServed",
|
||||||
"type": "varchar(100)[]",
|
"type": "jsonb",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
@@ -439,7 +457,25 @@
|
|||||||
},
|
},
|
||||||
"licensedIn": {
|
"licensedIn": {
|
||||||
"name": "licensedIn",
|
"name": "licensedIn",
|
||||||
"type": "varchar(50)[]",
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"gender": {
|
||||||
|
"name": "gender",
|
||||||
|
"type": "gender",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"name": "created",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"updated": {
|
||||||
|
"name": "updated",
|
||||||
|
"type": "timestamp",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
}
|
}
|
||||||
@@ -450,7 +486,15 @@
|
|||||||
"uniqueConstraints": {}
|
"uniqueConstraints": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enums": {},
|
"enums": {
|
||||||
|
"gender": {
|
||||||
|
"name": "gender",
|
||||||
|
"values": {
|
||||||
|
"male": "male",
|
||||||
|
"female": "female"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"schemas": {},
|
"schemas": {},
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"columns": {},
|
"columns": {},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "3e4b8c5f-4474-4877-abec-38283408ee34",
|
"id": "0bc02618-4414-4e90-8c44-808737611da7",
|
||||||
"prevId": "f6d421f9-2394-4a1c-9268-9e46285f0a41",
|
"prevId": "fc58c59b-ac5c-406e-8fdb-b05de40aed17",
|
||||||
"version": "5",
|
"version": "5",
|
||||||
"dialect": "pg",
|
"dialect": "pg",
|
||||||
"tables": {
|
"tables": {
|
||||||
@@ -147,6 +147,12 @@
|
|||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
|
"imagePath": {
|
||||||
|
"name": "imagePath",
|
||||||
|
"type": "varchar(200)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
"created": {
|
"created": {
|
||||||
"name": "created",
|
"name": "created",
|
||||||
"type": "timestamp",
|
"type": "timestamp",
|
||||||
@@ -202,6 +208,12 @@
|
|||||||
"notNull": true,
|
"notNull": true,
|
||||||
"default": "gen_random_uuid()"
|
"default": "gen_random_uuid()"
|
||||||
},
|
},
|
||||||
|
"serial_id": {
|
||||||
|
"name": "serial_id",
|
||||||
|
"type": "serial",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
"userId": {
|
"userId": {
|
||||||
"name": "userId",
|
"name": "userId",
|
||||||
"type": "uuid",
|
"type": "uuid",
|
||||||
@@ -250,6 +262,12 @@
|
|||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
|
"listingsCategory": {
|
||||||
|
"name": "listingsCategory",
|
||||||
|
"type": "varchar(255)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
"hideImage": {
|
"hideImage": {
|
||||||
"name": "hideImage",
|
"name": "hideImage",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
@@ -300,7 +318,7 @@
|
|||||||
},
|
},
|
||||||
"imagePath": {
|
"imagePath": {
|
||||||
"name": "imagePath",
|
"name": "imagePath",
|
||||||
"type": "varchar(50)",
|
"type": "varchar(200)",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
@@ -421,7 +439,7 @@
|
|||||||
},
|
},
|
||||||
"areasServed": {
|
"areasServed": {
|
||||||
"name": "areasServed",
|
"name": "areasServed",
|
||||||
"type": "varchar(100)[]",
|
"type": "jsonb",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
@@ -439,7 +457,31 @@
|
|||||||
},
|
},
|
||||||
"licensedIn": {
|
"licensedIn": {
|
||||||
"name": "licensedIn",
|
"name": "licensedIn",
|
||||||
"type": "varchar(50)[]",
|
"type": "jsonb",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"gender": {
|
||||||
|
"name": "gender",
|
||||||
|
"type": "gender",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"customerType": {
|
||||||
|
"name": "customerType",
|
||||||
|
"type": "customerType",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"name": "created",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"updated": {
|
||||||
|
"name": "updated",
|
||||||
|
"type": "timestamp",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false
|
"notNull": false
|
||||||
}
|
}
|
||||||
@@ -450,7 +492,23 @@
|
|||||||
"uniqueConstraints": {}
|
"uniqueConstraints": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enums": {},
|
"enums": {
|
||||||
|
"customerType": {
|
||||||
|
"name": "customerType",
|
||||||
|
"values": {
|
||||||
|
"buyer": "buyer",
|
||||||
|
"broker": "broker",
|
||||||
|
"professional": "professional"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gender": {
|
||||||
|
"name": "gender",
|
||||||
|
"values": {
|
||||||
|
"male": "male",
|
||||||
|
"female": "female"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"schemas": {},
|
"schemas": {},
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"columns": {},
|
"columns": {},
|
||||||
|
|||||||
@@ -1,474 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "ad48c6eb-2d04-442f-9242-b6765553c7c4",
|
|
||||||
"prevId": "3e4b8c5f-4474-4877-abec-38283408ee34",
|
|
||||||
"version": "5",
|
|
||||||
"dialect": "pg",
|
|
||||||
"tables": {
|
|
||||||
"businesses": {
|
|
||||||
"name": "businesses",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"userId": {
|
|
||||||
"name": "userId",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"realEstateIncluded": {
|
|
||||||
"name": "realEstateIncluded",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"leasedLocation": {
|
|
||||||
"name": "leasedLocation",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"franchiseResale": {
|
|
||||||
"name": "franchiseResale",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"salesRevenue": {
|
|
||||||
"name": "salesRevenue",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"cashFlow": {
|
|
||||||
"name": "cashFlow",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"supportAndTraining": {
|
|
||||||
"name": "supportAndTraining",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"employees": {
|
|
||||||
"name": "employees",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"established": {
|
|
||||||
"name": "established",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internalListingNumber": {
|
|
||||||
"name": "internalListingNumber",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"reasonForSale": {
|
|
||||||
"name": "reasonForSale",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"brokerLicencing": {
|
|
||||||
"name": "brokerLicencing",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internals": {
|
|
||||||
"name": "internals",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"businesses_userId_users_id_fk": {
|
|
||||||
"name": "businesses_userId_users_id_fk",
|
|
||||||
"tableFrom": "businesses",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"userId"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"commercials": {
|
|
||||||
"name": "commercials",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"userId": {
|
|
||||||
"name": "userId",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hideImage": {
|
|
||||||
"name": "hideImage",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"website": {
|
|
||||||
"name": "website",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"phoneNumber": {
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageOrder": {
|
|
||||||
"name": "imageOrder",
|
|
||||||
"type": "varchar(200)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imagePath": {
|
|
||||||
"name": "imagePath",
|
|
||||||
"type": "varchar(50)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"commercials_userId_users_id_fk": {
|
|
||||||
"name": "commercials_userId_users_id_fk",
|
|
||||||
"tableFrom": "commercials",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"userId"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"users": {
|
|
||||||
"name": "users",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"firstname": {
|
|
||||||
"name": "firstname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"lastname": {
|
|
||||||
"name": "lastname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"phoneNumber": {
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyName": {
|
|
||||||
"name": "companyName",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyOverview": {
|
|
||||||
"name": "companyOverview",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyWebsite": {
|
|
||||||
"name": "companyWebsite",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyLocation": {
|
|
||||||
"name": "companyLocation",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"offeredServices": {
|
|
||||||
"name": "offeredServices",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"areasServed": {
|
|
||||||
"name": "areasServed",
|
|
||||||
"type": "varchar(100)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasProfile": {
|
|
||||||
"name": "hasProfile",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasCompanyLogo": {
|
|
||||||
"name": "hasCompanyLogo",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"licensedIn": {
|
|
||||||
"name": "licensedIn",
|
|
||||||
"type": "varchar(50)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"type": "gender",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enums": {
|
|
||||||
"gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"values": {
|
|
||||||
"male": "male",
|
|
||||||
"female": "female"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"schemas": {},
|
|
||||||
"_meta": {
|
|
||||||
"columns": {},
|
|
||||||
"schemas": {},
|
|
||||||
"tables": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,480 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "da786c6a-fd5f-4629-bd5e-3ecd42ab1f2c",
|
|
||||||
"prevId": "ad48c6eb-2d04-442f-9242-b6765553c7c4",
|
|
||||||
"version": "5",
|
|
||||||
"dialect": "pg",
|
|
||||||
"tables": {
|
|
||||||
"businesses": {
|
|
||||||
"name": "businesses",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"userId": {
|
|
||||||
"name": "userId",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"realEstateIncluded": {
|
|
||||||
"name": "realEstateIncluded",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"leasedLocation": {
|
|
||||||
"name": "leasedLocation",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"franchiseResale": {
|
|
||||||
"name": "franchiseResale",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"salesRevenue": {
|
|
||||||
"name": "salesRevenue",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"cashFlow": {
|
|
||||||
"name": "cashFlow",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"supportAndTraining": {
|
|
||||||
"name": "supportAndTraining",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"employees": {
|
|
||||||
"name": "employees",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"established": {
|
|
||||||
"name": "established",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internalListingNumber": {
|
|
||||||
"name": "internalListingNumber",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"reasonForSale": {
|
|
||||||
"name": "reasonForSale",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"brokerLicencing": {
|
|
||||||
"name": "brokerLicencing",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"internals": {
|
|
||||||
"name": "internals",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"businesses_userId_users_id_fk": {
|
|
||||||
"name": "businesses_userId_users_id_fk",
|
|
||||||
"tableFrom": "businesses",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"userId"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"commercials": {
|
|
||||||
"name": "commercials",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"userId": {
|
|
||||||
"name": "userId",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
"name": "type",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"name": "title",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"city": {
|
|
||||||
"name": "city",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"state": {
|
|
||||||
"name": "state",
|
|
||||||
"type": "char(2)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"price": {
|
|
||||||
"name": "price",
|
|
||||||
"type": "double precision",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"favoritesForUser": {
|
|
||||||
"name": "favoritesForUser",
|
|
||||||
"type": "varchar(30)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"listingsCategory": {
|
|
||||||
"name": "listingsCategory",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hideImage": {
|
|
||||||
"name": "hideImage",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"draft": {
|
|
||||||
"name": "draft",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"zipCode": {
|
|
||||||
"name": "zipCode",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"county": {
|
|
||||||
"name": "county",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"website": {
|
|
||||||
"name": "website",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"phoneNumber": {
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imageOrder": {
|
|
||||||
"name": "imageOrder",
|
|
||||||
"type": "varchar(200)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"imagePath": {
|
|
||||||
"name": "imagePath",
|
|
||||||
"type": "varchar(50)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"created": {
|
|
||||||
"name": "created",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"updated": {
|
|
||||||
"name": "updated",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"visits": {
|
|
||||||
"name": "visits",
|
|
||||||
"type": "integer",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"lastVisit": {
|
|
||||||
"name": "lastVisit",
|
|
||||||
"type": "timestamp",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {
|
|
||||||
"commercials_userId_users_id_fk": {
|
|
||||||
"name": "commercials_userId_users_id_fk",
|
|
||||||
"tableFrom": "commercials",
|
|
||||||
"tableTo": "users",
|
|
||||||
"columnsFrom": [
|
|
||||||
"userId"
|
|
||||||
],
|
|
||||||
"columnsTo": [
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
"onDelete": "no action",
|
|
||||||
"onUpdate": "no action"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
},
|
|
||||||
"users": {
|
|
||||||
"name": "users",
|
|
||||||
"schema": "",
|
|
||||||
"columns": {
|
|
||||||
"id": {
|
|
||||||
"name": "id",
|
|
||||||
"type": "uuid",
|
|
||||||
"primaryKey": true,
|
|
||||||
"notNull": true,
|
|
||||||
"default": "gen_random_uuid()"
|
|
||||||
},
|
|
||||||
"firstname": {
|
|
||||||
"name": "firstname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"lastname": {
|
|
||||||
"name": "lastname",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"name": "email",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": true
|
|
||||||
},
|
|
||||||
"phoneNumber": {
|
|
||||||
"name": "phoneNumber",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"name": "description",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyName": {
|
|
||||||
"name": "companyName",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyOverview": {
|
|
||||||
"name": "companyOverview",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyWebsite": {
|
|
||||||
"name": "companyWebsite",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"companyLocation": {
|
|
||||||
"name": "companyLocation",
|
|
||||||
"type": "varchar(255)",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"offeredServices": {
|
|
||||||
"name": "offeredServices",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"areasServed": {
|
|
||||||
"name": "areasServed",
|
|
||||||
"type": "varchar(100)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasProfile": {
|
|
||||||
"name": "hasProfile",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"hasCompanyLogo": {
|
|
||||||
"name": "hasCompanyLogo",
|
|
||||||
"type": "boolean",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"licensedIn": {
|
|
||||||
"name": "licensedIn",
|
|
||||||
"type": "varchar(50)[]",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"type": "gender",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indexes": {},
|
|
||||||
"foreignKeys": {},
|
|
||||||
"compositePrimaryKeys": {},
|
|
||||||
"uniqueConstraints": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enums": {
|
|
||||||
"gender": {
|
|
||||||
"name": "gender",
|
|
||||||
"values": {
|
|
||||||
"male": "male",
|
|
||||||
"female": "female"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"schemas": {},
|
|
||||||
"_meta": {
|
|
||||||
"columns": {},
|
|
||||||
"schemas": {},
|
|
||||||
"tables": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,29 +5,15 @@
|
|||||||
{
|
{
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"version": "5",
|
"version": "5",
|
||||||
"when": 1714913766996,
|
"when": 1716495198537,
|
||||||
"tag": "0000_third_spacker_dave",
|
"tag": "0000_burly_bruce_banner",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"version": "5",
|
"version": "5",
|
||||||
"when": 1714981666488,
|
"when": 1717085220861,
|
||||||
"tag": "0001_rapid_daimon_hellstrom",
|
"tag": "0001_wet_mephistopheles",
|
||||||
"breakpoints": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idx": 2,
|
|
||||||
"version": "5",
|
|
||||||
"when": 1714982539265,
|
|
||||||
"tag": "0002_black_zaladane",
|
|
||||||
"breakpoints": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idx": 3,
|
|
||||||
"version": "5",
|
|
||||||
"when": 1715254754561,
|
|
||||||
"tag": "0003_tough_hobgoblin",
|
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { boolean, char, doublePrecision, integer, pgEnum, pgTable, text, timestamp, uuid, varchar } from 'drizzle-orm/pg-core';
|
import { boolean, char, doublePrecision, integer, jsonb, pgEnum, pgTable, serial, text, timestamp, uuid, varchar } from 'drizzle-orm/pg-core';
|
||||||
|
import { AreasServed, LicensedIn } from 'src/models/db.model';
|
||||||
|
|
||||||
export const PG_CONNECTION = 'PG_CONNECTION';
|
export const PG_CONNECTION = 'PG_CONNECTION';
|
||||||
export const genderEnum = pgEnum('gender', ['male', 'female']);
|
export const genderEnum = pgEnum('gender', ['male', 'female']);
|
||||||
|
export const customerTypeEnum = pgEnum('customerType', ['buyer', 'broker', 'professional']);
|
||||||
|
|
||||||
export const users = pgTable('users', {
|
export const users = pgTable('users', {
|
||||||
id: uuid('id').primaryKey().defaultRandom(),
|
id: uuid('id').primaryKey().defaultRandom(),
|
||||||
firstname: varchar('firstname', { length: 255 }).notNull(),
|
firstname: varchar('firstname', { length: 255 }).notNull(),
|
||||||
@@ -14,11 +17,14 @@ export const users = pgTable('users', {
|
|||||||
companyWebsite: varchar('companyWebsite', { length: 255 }),
|
companyWebsite: varchar('companyWebsite', { length: 255 }),
|
||||||
companyLocation: varchar('companyLocation', { length: 255 }),
|
companyLocation: varchar('companyLocation', { length: 255 }),
|
||||||
offeredServices: text('offeredServices'),
|
offeredServices: text('offeredServices'),
|
||||||
areasServed: varchar('areasServed', { length: 100 }).array(),
|
areasServed: jsonb('areasServed').$type<AreasServed[]>(),
|
||||||
hasProfile: boolean('hasProfile'),
|
hasProfile: boolean('hasProfile'),
|
||||||
hasCompanyLogo: boolean('hasCompanyLogo'),
|
hasCompanyLogo: boolean('hasCompanyLogo'),
|
||||||
licensedIn: varchar('licensedIn', { length: 50 }).array(),
|
licensedIn: jsonb('licensedIn').$type<LicensedIn[]>(),
|
||||||
gender: genderEnum('gender'),
|
gender: genderEnum('gender'),
|
||||||
|
customerType: customerTypeEnum('customerType'),
|
||||||
|
created: timestamp('created'),
|
||||||
|
updated: timestamp('updated'),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const businesses = pgTable('businesses', {
|
export const businesses = pgTable('businesses', {
|
||||||
@@ -45,6 +51,7 @@ export const businesses = pgTable('businesses', {
|
|||||||
reasonForSale: varchar('reasonForSale', { length: 255 }),
|
reasonForSale: varchar('reasonForSale', { length: 255 }),
|
||||||
brokerLicencing: varchar('brokerLicencing', { length: 255 }),
|
brokerLicencing: varchar('brokerLicencing', { length: 255 }),
|
||||||
internals: text('internals'),
|
internals: text('internals'),
|
||||||
|
imageName: varchar('imagePath', { length: 200 }),
|
||||||
created: timestamp('created'),
|
created: timestamp('created'),
|
||||||
updated: timestamp('updated'),
|
updated: timestamp('updated'),
|
||||||
visits: integer('visits'),
|
visits: integer('visits'),
|
||||||
@@ -53,6 +60,7 @@ export const businesses = pgTable('businesses', {
|
|||||||
|
|
||||||
export const commercials = pgTable('commercials', {
|
export const commercials = pgTable('commercials', {
|
||||||
id: uuid('id').primaryKey().defaultRandom(),
|
id: uuid('id').primaryKey().defaultRandom(),
|
||||||
|
serialId: serial('serial_id'),
|
||||||
userId: uuid('userId').references(() => users.id),
|
userId: uuid('userId').references(() => users.id),
|
||||||
type: integer('type'),
|
type: integer('type'),
|
||||||
title: varchar('title', { length: 255 }),
|
title: varchar('title', { length: 255 }),
|
||||||
@@ -70,7 +78,7 @@ export const commercials = pgTable('commercials', {
|
|||||||
website: varchar('website', { length: 255 }),
|
website: varchar('website', { length: 255 }),
|
||||||
phoneNumber: varchar('phoneNumber', { length: 255 }),
|
phoneNumber: varchar('phoneNumber', { length: 255 }),
|
||||||
imageOrder: varchar('imageOrder', { length: 200 }).array(),
|
imageOrder: varchar('imageOrder', { length: 200 }).array(),
|
||||||
imagePath: varchar('imagePath', { length: 50 }),
|
imagePath: varchar('imagePath', { length: 200 }),
|
||||||
created: timestamp('created'),
|
created: timestamp('created'),
|
||||||
updated: timestamp('updated'),
|
updated: timestamp('updated'),
|
||||||
visits: integer('visits'),
|
visits: integer('visits'),
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { fstat, readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import path from 'path';
|
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import { ImageProperty } from '../models/main.model.js';
|
|
||||||
import sharp from 'sharp';
|
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
|
import path, { join } from 'path';
|
||||||
|
import sharp from 'sharp';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
|
import { ImageProperty, Subscription } from '../models/main.model.js';
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
@@ -21,73 +20,86 @@ export class FileService {
|
|||||||
fs.ensureDirSync(`./pictures/logo`);
|
fs.ensureDirSync(`./pictures/logo`);
|
||||||
fs.ensureDirSync(`./pictures/property`);
|
fs.ensureDirSync(`./pictures/property`);
|
||||||
}
|
}
|
||||||
|
// ############
|
||||||
|
// Subscriptions
|
||||||
|
// ############
|
||||||
private loadSubscriptions(): void {
|
private loadSubscriptions(): void {
|
||||||
const filePath = join(__dirname, '../..', 'assets', 'subscriptions.json');
|
const filePath = join(__dirname, '../..', 'assets', 'subscriptions.json');
|
||||||
const rawData = readFileSync(filePath, 'utf8');
|
const rawData = readFileSync(filePath, 'utf8');
|
||||||
this.subscriptions = JSON.parse(rawData);
|
this.subscriptions = JSON.parse(rawData);
|
||||||
}
|
}
|
||||||
getSubscriptions() {
|
getSubscriptions(): Subscription[] {
|
||||||
return this.subscriptions
|
return this.subscriptions;
|
||||||
}
|
}
|
||||||
async storeProfilePicture(file: Express.Multer.File, userId: string) {
|
// ############
|
||||||
|
// Profile
|
||||||
|
// ############
|
||||||
|
async storeProfilePicture(file: Express.Multer.File, adjustedEmail: string) {
|
||||||
let quality = 50;
|
let quality = 50;
|
||||||
const output = await sharp(file.buffer)
|
const output = await sharp(file.buffer)
|
||||||
.resize({ width: 300 })
|
.resize({ width: 300 })
|
||||||
.avif({ quality }) // Verwende AVIF
|
.avif({ quality }) // Verwende AVIF
|
||||||
//.webp({ quality }) // Verwende Webp
|
//.webp({ quality }) // Verwende Webp
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
await sharp(output).toFile(`./pictures/profile/${userId}.avif`);
|
await sharp(output).toFile(`./pictures/profile/${adjustedEmail}.avif`);
|
||||||
}
|
}
|
||||||
hasProfile(userId: string){
|
hasProfile(adjustedEmail: string) {
|
||||||
return fs.existsSync(`./pictures/profile/${userId}.avif`)
|
return fs.existsSync(`./pictures/profile/${adjustedEmail}.avif`);
|
||||||
}
|
}
|
||||||
|
// ############
|
||||||
async storeCompanyLogo(file: Express.Multer.File, userId: string) {
|
// Logo
|
||||||
|
// ############
|
||||||
|
async storeCompanyLogo(file: Express.Multer.File, adjustedEmail: string) {
|
||||||
let quality = 50;
|
let quality = 50;
|
||||||
const output = await sharp(file.buffer)
|
const output = await sharp(file.buffer)
|
||||||
.resize({ width: 300 })
|
.resize({ width: 300 })
|
||||||
.avif({ quality }) // Verwende AVIF
|
.avif({ quality }) // Verwende AVIF
|
||||||
//.webp({ quality }) // Verwende Webp
|
//.webp({ quality }) // Verwende Webp
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
await sharp(output).toFile(`./pictures/logo/${userId}.avif`); // Ersetze Dateierweiterung
|
await sharp(output).toFile(`./pictures/logo/${adjustedEmail}.avif`); // Ersetze Dateierweiterung
|
||||||
// await fs.outputFile(`./pictures/logo/${userId}`, file.buffer);
|
// await fs.outputFile(`./pictures/logo/${userId}`, file.buffer);
|
||||||
}
|
}
|
||||||
hasCompanyLogo(userId: string){
|
hasCompanyLogo(adjustedEmail: string) {
|
||||||
return fs.existsSync(`./pictures/logo/${userId}.avif`)?true:false
|
return fs.existsSync(`./pictures/logo/${adjustedEmail}.avif`) ? true : false;
|
||||||
}
|
}
|
||||||
|
// ############
|
||||||
async getPropertyImages(listingId: string): Promise<string[]> {
|
// Property
|
||||||
const result: string[] = []
|
// ############
|
||||||
const directory = `./pictures/property/${listingId}`
|
async getPropertyImages(imagePath: string, serial: string): Promise<string[]> {
|
||||||
|
const result: string[] = [];
|
||||||
|
const directory = `./pictures/property/${imagePath}/${serial}`;
|
||||||
if (fs.existsSync(directory)) {
|
if (fs.existsSync(directory)) {
|
||||||
const files = await fs.readdir(directory);
|
const files = await fs.readdir(directory);
|
||||||
files.forEach(f => {
|
files.forEach(f => {
|
||||||
result.push(f)
|
result.push(f);
|
||||||
})
|
});
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
return []
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async hasPropertyImages(listingId: string): Promise<boolean> {
|
async hasPropertyImages(imagePath: string, serial: string): Promise<boolean> {
|
||||||
const result: ImageProperty[] = []
|
const result: ImageProperty[] = [];
|
||||||
const directory = `./pictures/property/${listingId}`
|
const directory = `./pictures/property/${imagePath}/${serial}`;
|
||||||
if (fs.existsSync(directory)) {
|
if (fs.existsSync(directory)) {
|
||||||
const files = await fs.readdir(directory);
|
const files = await fs.readdir(directory);
|
||||||
return files.length>0
|
return files.length > 0;
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async storePropertyPicture(file: Express.Multer.File, listingId: string) : Promise<string> {
|
async storePropertyPicture(file: Express.Multer.File, imagePath: string, serial: string): Promise<string> {
|
||||||
const suffix = file.mimetype.includes('png') ? 'png' : 'jpg'
|
const suffix = file.mimetype.includes('png') ? 'png' : 'jpg';
|
||||||
const directory = `./pictures/property/${listingId}`
|
const directory = `./pictures/property/${imagePath}/${serial}`;
|
||||||
fs.ensureDirSync(`${directory}`);
|
fs.ensureDirSync(`${directory}`);
|
||||||
const imageName = await this.getNextImageName(directory);
|
const imageName = await this.getNextImageName(directory);
|
||||||
//await fs.outputFile(`${directory}/${imageName}`, file.buffer);
|
//await fs.outputFile(`${directory}/${imageName}`, file.buffer);
|
||||||
await this.resizeImageToAVIF(file.buffer,150 * 1024,imageName,directory);
|
await this.resizeImageToAVIF(file.buffer, 150 * 1024, imageName, directory);
|
||||||
return `${imageName}.avif`
|
return `${imageName}.avif`;
|
||||||
}
|
}
|
||||||
|
// ############
|
||||||
|
// utils
|
||||||
|
// ############
|
||||||
async getNextImageName(directory) {
|
async getNextImageName(directory) {
|
||||||
try {
|
try {
|
||||||
const files = await fs.readdir(directory);
|
const files = await fs.readdir(directory);
|
||||||
@@ -103,7 +115,7 @@ export class FileService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async resizeImageToAVIF(buffer: Buffer, maxSize: number,imageName:string,directory:string) {
|
async resizeImageToAVIF(buffer: Buffer, maxSize: number, imageName: string, directory: string) {
|
||||||
let quality = 50; // AVIF kann mit niedrigeren Qualitätsstufen gute Ergebnisse erzielen
|
let quality = 50; // AVIF kann mit niedrigeren Qualitätsstufen gute Ergebnisse erzielen
|
||||||
let output;
|
let output;
|
||||||
let start = Date.now();
|
let start = Date.now();
|
||||||
@@ -114,26 +126,24 @@ export class FileService {
|
|||||||
.toBuffer();
|
.toBuffer();
|
||||||
await sharp(output).toFile(`${directory}/${imageName}.avif`); // Ersetze Dateierweiterung
|
await sharp(output).toFile(`${directory}/${imageName}.avif`); // Ersetze Dateierweiterung
|
||||||
let timeTaken = Date.now() - start;
|
let timeTaken = Date.now() - start;
|
||||||
this.logger.info(`Quality: ${quality} - Time: ${timeTaken} milliseconds`)
|
this.logger.info(`Quality: ${quality} - Time: ${timeTaken} milliseconds`);
|
||||||
}
|
}
|
||||||
getProfileImagesForUsers(userids:string){
|
deleteImage(path: string) {
|
||||||
const ids = userids.split(',');
|
|
||||||
let result = {};
|
|
||||||
for (const id of ids){
|
|
||||||
result = {...result,[id]:fs.existsSync(`./pictures/profile/${id}.avif`)}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
getCompanyLogosForUsers(userids:string){
|
|
||||||
const ids = userids.split(',');
|
|
||||||
let result = {};
|
|
||||||
for (const id of ids){
|
|
||||||
result = {...result,[id]:fs.existsSync(`./pictures/logo/${id}.avif`)}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
deleteImage(path:string){
|
|
||||||
fs.unlinkSync(path);
|
fs.unlinkSync(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteDirectoryIfExists(imagePath) {
|
||||||
|
const dirPath = `pictures/property/${imagePath}`;
|
||||||
|
try {
|
||||||
|
const exists = fs.pathExistsSync();
|
||||||
|
if (exists) {
|
||||||
|
fs.removeSync(dirPath);
|
||||||
|
console.log(`Directory ${dirPath} was deleted.`);
|
||||||
|
} else {
|
||||||
|
console.log(`Directory ${dirPath} does not exist.`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error while deleting ${dirPath}:`, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Controller, Delete, Get, Inject, Param, Post, UploadedFile, UseInterceptors } from '@nestjs/common';
|
import { Controller, Delete, Inject, Param, Post, UploadedFile, UseInterceptors } from '@nestjs/common';
|
||||||
import { FileInterceptor } from '@nestjs/platform-express';
|
import { FileInterceptor } from '@nestjs/platform-express';
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
@@ -6,9 +6,6 @@ import { FileService } from '../file/file.service.js';
|
|||||||
import { ListingsService } from '../listings/listings.service.js';
|
import { ListingsService } from '../listings/listings.service.js';
|
||||||
import { SelectOptionsService } from '../select-options/select-options.service.js';
|
import { SelectOptionsService } from '../select-options/select-options.service.js';
|
||||||
|
|
||||||
import { commercials } from 'src/drizzle/schema.js';
|
|
||||||
import { CommercialPropertyListing } from 'src/models/db.model.js';
|
|
||||||
|
|
||||||
@Controller('image')
|
@Controller('image')
|
||||||
export class ImageController {
|
export class ImageController {
|
||||||
constructor(
|
constructor(
|
||||||
@@ -17,58 +14,42 @@ export class ImageController {
|
|||||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
private selectOptions: SelectOptionsService,
|
private selectOptions: SelectOptionsService,
|
||||||
) {}
|
) {}
|
||||||
|
// ############
|
||||||
@Post('uploadPropertyPicture/:id')
|
// Property
|
||||||
|
// ############
|
||||||
|
@Post('uploadPropertyPicture/:imagePath/:serial')
|
||||||
@UseInterceptors(FileInterceptor('file'))
|
@UseInterceptors(FileInterceptor('file'))
|
||||||
async uploadPropertyPicture(@UploadedFile() file: Express.Multer.File, @Param('id') id: string) {
|
async uploadPropertyPicture(@UploadedFile() file: Express.Multer.File, @Param('imagePath') imagePath: string, @Param('serial') serial: string) {
|
||||||
const imagename = await this.fileService.storePropertyPicture(file, id);
|
const imagename = await this.fileService.storePropertyPicture(file, imagePath, serial);
|
||||||
await this.listingService.addImage(id, imagename);
|
await this.listingService.addImage(imagePath, serial, imagename);
|
||||||
}
|
}
|
||||||
|
@Delete('propertyPicture/:imagePath/:serial/:imagename')
|
||||||
@Post('uploadProfile/:id')
|
async deletePropertyImagesById(@Param('imagePath') imagePath: string, @Param('serial') serial: string, @Param('imagename') imagename: string): Promise<any> {
|
||||||
|
this.fileService.deleteImage(`pictures/property/${imagePath}/${serial}/${imagename}`);
|
||||||
|
await this.listingService.deleteImage(imagePath, serial, imagename);
|
||||||
|
}
|
||||||
|
// ############
|
||||||
|
// Profile
|
||||||
|
// ############
|
||||||
|
@Post('uploadProfile/:email')
|
||||||
@UseInterceptors(FileInterceptor('file'))
|
@UseInterceptors(FileInterceptor('file'))
|
||||||
async uploadProfile(@UploadedFile() file: Express.Multer.File, @Param('id') id: string) {
|
async uploadProfile(@UploadedFile() file: Express.Multer.File, @Param('email') adjustedEmail: string) {
|
||||||
await this.fileService.storeProfilePicture(file, id);
|
await this.fileService.storeProfilePicture(file, adjustedEmail);
|
||||||
}
|
}
|
||||||
|
@Delete('profile/:email/')
|
||||||
@Post('uploadCompanyLogo/:id')
|
async deleteProfileImagesById(@Param('email') email: string): Promise<any> {
|
||||||
|
this.fileService.deleteImage(`pictures/profile/${email}.avif`);
|
||||||
|
}
|
||||||
|
// ############
|
||||||
|
// Logo
|
||||||
|
// ############
|
||||||
|
@Post('uploadCompanyLogo/:email')
|
||||||
@UseInterceptors(FileInterceptor('file'))
|
@UseInterceptors(FileInterceptor('file'))
|
||||||
async uploadCompanyLogo(@UploadedFile() file: Express.Multer.File, @Param('id') id: string) {
|
async uploadCompanyLogo(@UploadedFile() file: Express.Multer.File, @Param('email') adjustedEmail: string) {
|
||||||
await this.fileService.storeCompanyLogo(file, id);
|
await this.fileService.storeCompanyLogo(file, adjustedEmail);
|
||||||
}
|
}
|
||||||
|
@Delete('logo/:email/')
|
||||||
@Get(':id')
|
async deleteLogoImagesById(@Param('email') adjustedEmail: string): Promise<any> {
|
||||||
async getPropertyImagesById(@Param('id') id: string): Promise<any> {
|
this.fileService.deleteImage(`pictures/logo/${adjustedEmail}.avif`);
|
||||||
const result = await this.listingService.findById(id, commercials);
|
|
||||||
const listing = result as CommercialPropertyListing;
|
|
||||||
if (listing.imageOrder) {
|
|
||||||
return listing.imageOrder;
|
|
||||||
} else {
|
|
||||||
const imageOrder = await this.fileService.getPropertyImages(id);
|
|
||||||
listing.imageOrder = imageOrder;
|
|
||||||
this.listingService.updateListing(listing.id, listing, commercials);
|
|
||||||
return imageOrder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Get('profileImages/:userids')
|
|
||||||
async getProfileImagesForUsers(@Param('userids') userids: string): Promise<any> {
|
|
||||||
return await this.fileService.getProfileImagesForUsers(userids);
|
|
||||||
}
|
|
||||||
@Get('companyLogos/:userids')
|
|
||||||
async getCompanyLogosForUsers(@Param('userids') userids: string): Promise<any> {
|
|
||||||
return await this.fileService.getCompanyLogosForUsers(userids);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Delete('propertyPicture/:listingid/:imagename')
|
|
||||||
async deletePropertyImagesById(@Param('listingid') listingid: string, @Param('imagename') imagename: string): Promise<any> {
|
|
||||||
this.fileService.deleteImage(`pictures/property/${listingid}/${imagename}`);
|
|
||||||
}
|
|
||||||
@Delete('logo/:userid/')
|
|
||||||
async deleteLogoImagesById(@Param('id') id: string): Promise<any> {
|
|
||||||
this.fileService.deleteImage(`pictures/property//${id}`);
|
|
||||||
}
|
|
||||||
@Delete('profile/:userid/')
|
|
||||||
async deleteProfileImagesById(@Param('id') id: string): Promise<any> {
|
|
||||||
this.fileService.deleteImage(`pictures/property//${id}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
bizmatch-server/src/jwt-auth/jwt-auth.guard.ts
Normal file
18
bizmatch-server/src/jwt-auth/jwt-auth.guard.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { CanActivate, ExecutionContext, Injectable, UnauthorizedException } from '@nestjs/common';
|
||||||
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class JwtAuthGuard extends AuthGuard('jwt') implements CanActivate {
|
||||||
|
canActivate(context: ExecutionContext) {
|
||||||
|
// Add your custom authentication logic here
|
||||||
|
// for example, call super.logIn(request) to establish a session.
|
||||||
|
return super.canActivate(context);
|
||||||
|
}
|
||||||
|
handleRequest(err, user, info) {
|
||||||
|
// You can throw an exception based on either "info" or "err" arguments
|
||||||
|
if (err || !user) {
|
||||||
|
throw err || new UnauthorizedException(info);
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
bizmatch-server/src/jwt-auth/optional-jwt-auth.guard.ts
Normal file
13
bizmatch-server/src/jwt-auth/optional-jwt-auth.guard.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class OptionalJwtAuthGuard extends AuthGuard('jwt') {
|
||||||
|
handleRequest(err, user, info) {
|
||||||
|
// Wenn der Benutzer nicht authentifiziert ist, aber kein Fehler vorliegt, geben Sie null zurück
|
||||||
|
if (err || !user) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
}
|
||||||
45
bizmatch-server/src/jwt.strategy.ts
Normal file
45
bizmatch-server/src/jwt.strategy.ts
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import { Inject, Injectable, UnauthorizedException } from '@nestjs/common';
|
||||||
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { PassportStrategy } from '@nestjs/passport';
|
||||||
|
import { passportJwtSecret } from 'jwks-rsa';
|
||||||
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
|
import { ExtractJwt, Strategy } from 'passport-jwt';
|
||||||
|
import { Logger } from 'winston';
|
||||||
|
import { JwtPayload, JwtUser } from './models/main.model';
|
||||||
|
@Injectable()
|
||||||
|
export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||||
|
constructor(
|
||||||
|
configService: ConfigService,
|
||||||
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
|
) {
|
||||||
|
const realm = configService.get<string>('REALM');
|
||||||
|
super({
|
||||||
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||||
|
ignoreExpiration: false,
|
||||||
|
secretOrKeyProvider: passportJwtSecret({
|
||||||
|
cache: true,
|
||||||
|
rateLimit: true,
|
||||||
|
jwksRequestsPerMinute: 5,
|
||||||
|
jwksUri: `https://auth.bizmatch.net/realms/${realm}/protocol/openid-connect/certs`,
|
||||||
|
}),
|
||||||
|
audience: 'account', // Keycloak Client ID
|
||||||
|
authorize: '',
|
||||||
|
issuer: `https://auth.bizmatch.net/realms/${realm}`,
|
||||||
|
algorithms: ['RS256'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async validate(payload: JwtPayload): Promise<JwtUser> {
|
||||||
|
if (!payload) {
|
||||||
|
this.logger.error('Invalid payload');
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
if (!payload.sub || !payload.preferred_username) {
|
||||||
|
this.logger.error('Missing required claims');
|
||||||
|
throw new UnauthorizedException();
|
||||||
|
}
|
||||||
|
const result = { userId: payload.sub, username: payload.preferred_username, roles: payload.realm_access?.roles };
|
||||||
|
this.logger.info(`JWT User: ${JSON.stringify(result)}`); // Debugging: JWT Payload anzeigen
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Body, Controller, Delete, Get, Inject, Param, Post, Put } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Request, UseGuards } from '@nestjs/common';
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
import { businesses } from '../drizzle/schema.js';
|
import { businesses } from '../drizzle/schema.js';
|
||||||
import { ListingCriteria } from '../models/main.model.js';
|
import { OptionalJwtAuthGuard } from '../jwt-auth/optional-jwt-auth.guard.js';
|
||||||
|
import { JwtUser, ListingCriteria } from '../models/main.model.js';
|
||||||
import { ListingsService } from './listings.service.js';
|
import { ListingsService } from './listings.service.js';
|
||||||
|
|
||||||
@Controller('listings/business')
|
@Controller('listings/business')
|
||||||
@@ -12,18 +13,22 @@ export class BusinessListingsController {
|
|||||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@UseGuards(OptionalJwtAuthGuard)
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
findById(@Param('id') id: string): any {
|
findById(@Request() req, @Param('id') id: string): any {
|
||||||
return this.listingsService.findById(id, businesses);
|
return this.listingsService.findBusinessesById(id, req.user as JwtUser);
|
||||||
}
|
|
||||||
@Get('user/:userid')
|
|
||||||
findByUserId(@Param('userid') userid: string): any {
|
|
||||||
return this.listingsService.findByUserId(userid, businesses);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UseGuards(OptionalJwtAuthGuard)
|
||||||
|
@Get('user/:userid')
|
||||||
|
findByUserId(@Request() req, @Param('userid') userid: string): any {
|
||||||
|
return this.listingsService.findBusinessesByEmail(userid, req.user as JwtUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@UseGuards(OptionalJwtAuthGuard)
|
||||||
@Post('search')
|
@Post('search')
|
||||||
find(@Body() criteria: ListingCriteria): any {
|
find(@Request() req, @Body() criteria: ListingCriteria): any {
|
||||||
return this.listingsService.findListingsByCriteria(criteria, businesses);
|
return this.listingsService.findBusinessListings(criteria, req.user as JwtUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
@@ -34,7 +39,7 @@ export class BusinessListingsController {
|
|||||||
@Put()
|
@Put()
|
||||||
update(@Body() listing: any) {
|
update(@Body() listing: any) {
|
||||||
this.logger.info(`Save Listing`);
|
this.logger.info(`Save Listing`);
|
||||||
return this.listingsService.updateListing(listing.id, listing, businesses);
|
return this.listingsService.updateBusinessListing(listing.id, listing);
|
||||||
}
|
}
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
deleteById(@Param('id') id: string) {
|
deleteById(@Param('id') id: string) {
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { Body, Controller, Delete, Get, Inject, Param, Post, Put } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Inject, Param, Post, Put, Request, UseGuards } from '@nestjs/common';
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
|
import { CommercialPropertyListing } from 'src/models/db.model.js';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
import { commercials } from '../drizzle/schema.js';
|
import { commercials } from '../drizzle/schema.js';
|
||||||
import { FileService } from '../file/file.service.js';
|
import { FileService } from '../file/file.service.js';
|
||||||
import { ListingCriteria } from '../models/main.model.js';
|
import { OptionalJwtAuthGuard } from '../jwt-auth/optional-jwt-auth.guard.js';
|
||||||
|
import { JwtUser, ListingCriteria } from '../models/main.model.js';
|
||||||
import { ListingsService } from './listings.service.js';
|
import { ListingsService } from './listings.service.js';
|
||||||
|
|
||||||
@Controller('listings/commercialProperty')
|
@Controller('listings/commercialProperty')
|
||||||
@@ -14,17 +16,21 @@ export class CommercialPropertyListingsController {
|
|||||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@UseGuards(OptionalJwtAuthGuard)
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
findById(@Param('id') id: string): any {
|
findById(@Request() req, @Param('id') id: string): any {
|
||||||
return this.listingsService.findById(id, commercials);
|
return this.listingsService.findCommercialPropertiesById(id, req.user as JwtUser);
|
||||||
}
|
}
|
||||||
@Get('user/:userid')
|
|
||||||
findByUserId(@Param('userid') userid: string): any {
|
@UseGuards(OptionalJwtAuthGuard)
|
||||||
return this.listingsService.findByUserId(userid, commercials);
|
@Get('user/:email')
|
||||||
|
findByEmail(@Request() req, @Param('email') email: string): Promise<CommercialPropertyListing[]> {
|
||||||
|
return this.listingsService.findCommercialPropertiesByEmail(email, req.user as JwtUser);
|
||||||
}
|
}
|
||||||
|
@UseGuards(OptionalJwtAuthGuard)
|
||||||
@Post('search')
|
@Post('search')
|
||||||
async find(@Body() criteria: ListingCriteria): Promise<any> {
|
async find(@Request() req, @Body() criteria: ListingCriteria): Promise<any> {
|
||||||
return await this.listingsService.findListingsByCriteria(criteria, commercials);
|
return await this.listingsService.findCommercialPropertyListings(criteria, req.user as JwtUser);
|
||||||
}
|
}
|
||||||
@Get('states/all')
|
@Get('states/all')
|
||||||
getStates(): any {
|
getStates(): any {
|
||||||
@@ -38,15 +44,11 @@ export class CommercialPropertyListingsController {
|
|||||||
@Put()
|
@Put()
|
||||||
async update(@Body() listing: any) {
|
async update(@Body() listing: any) {
|
||||||
this.logger.info(`Save Listing`);
|
this.logger.info(`Save Listing`);
|
||||||
return await this.listingsService.updateListing(listing.id, listing, commercials);
|
return await this.listingsService.updateCommercialPropertyListing(listing.id, listing);
|
||||||
}
|
}
|
||||||
@Delete(':id')
|
@Delete(':id/:imagePath')
|
||||||
deleteById(@Param('id') id: string) {
|
deleteById(@Param('id') id: string, @Param('imagePath') imagePath: string) {
|
||||||
this.listingsService.deleteListing(id, commercials);
|
this.listingsService.deleteListing(id, commercials);
|
||||||
}
|
this.fileService.deleteDirectoryIfExists(imagePath);
|
||||||
|
|
||||||
@Put('imageOrder/:id')
|
|
||||||
async changeImageOrder(@Param('id') id: string, @Body() imageOrder: string[]) {
|
|
||||||
this.listingsService.updateImageOrder(id, imageOrder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
|
import { AuthModule } from '../auth/auth.module.js';
|
||||||
import { DrizzleModule } from '../drizzle/drizzle.module.js';
|
import { DrizzleModule } from '../drizzle/drizzle.module.js';
|
||||||
import { FileService } from '../file/file.service.js';
|
import { FileService } from '../file/file.service.js';
|
||||||
import { UserService } from '../user/user.service.js';
|
import { UserService } from '../user/user.service.js';
|
||||||
@@ -9,7 +10,7 @@ import { ListingsService } from './listings.service.js';
|
|||||||
import { UnknownListingsController } from './unknown-listings.controller.js';
|
import { UnknownListingsController } from './unknown-listings.controller.js';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [DrizzleModule],
|
imports: [DrizzleModule, AuthModule],
|
||||||
controllers: [BusinessListingsController, CommercialPropertyListingsController, UnknownListingsController, BrokerListingsController],
|
controllers: [BusinessListingsController, CommercialPropertyListingsController, UnknownListingsController, BrokerListingsController],
|
||||||
providers: [ListingsService, FileService, UserService],
|
providers: [ListingsService, FileService, UserService],
|
||||||
exports: [ListingsService],
|
exports: [ListingsService],
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { and, eq, gte, ilike, lte, sql } from 'drizzle-orm';
|
import { and, eq, gte, ilike, lte, ne, or, sql } from 'drizzle-orm';
|
||||||
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
import { BusinessListing, CommercialPropertyListing } from 'src/models/db.model.js';
|
import { BusinessListing, CommercialPropertyListing } from 'src/models/db.model.js';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
import * as schema from '../drizzle/schema.js';
|
import * as schema from '../drizzle/schema.js';
|
||||||
import { PG_CONNECTION, businesses, commercials } from '../drizzle/schema.js';
|
import { PG_CONNECTION, businesses, commercials } from '../drizzle/schema.js';
|
||||||
import { ListingCriteria } from '../models/main.model.js';
|
import { FileService } from '../file/file.service.js';
|
||||||
|
import { JwtUser, ListingCriteria, emailToDirName } from '../models/main.model.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ListingsService {
|
export class ListingsService {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
@Inject(PG_CONNECTION) private conn: NodePgDatabase<typeof schema>,
|
@Inject(PG_CONNECTION) private conn: NodePgDatabase<typeof schema>,
|
||||||
|
private fileService: FileService,
|
||||||
) {}
|
) {}
|
||||||
private getConditions(criteria: ListingCriteria, table: typeof businesses | typeof commercials): any[] {
|
private getConditions(criteria: ListingCriteria, table: typeof businesses | typeof commercials, user: JwtUser): any[] {
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
if (criteria.type) {
|
if (criteria.type) {
|
||||||
conditions.push(eq(table.type, criteria.type));
|
conditions.push(eq(table.type, criteria.type));
|
||||||
@@ -39,56 +41,121 @@ export class ListingsService {
|
|||||||
// ##############################################################
|
// ##############################################################
|
||||||
// Listings general
|
// Listings general
|
||||||
// ##############################################################
|
// ##############################################################
|
||||||
async findListingsByCriteria(criteria: ListingCriteria, table: typeof businesses | typeof commercials): Promise<{ data: Record<string, any>[]; total: number }> {
|
|
||||||
|
async findCommercialPropertyListings(criteria: ListingCriteria, user: JwtUser): Promise<any> {
|
||||||
const start = criteria.start ? criteria.start : 0;
|
const start = criteria.start ? criteria.start : 0;
|
||||||
const length = criteria.length ? criteria.length : 12;
|
const length = criteria.length ? criteria.length : 12;
|
||||||
return await this.findListings(table, criteria, start, length);
|
const conditions = this.getConditions(criteria, commercials, user);
|
||||||
|
if (!user || (!user?.roles?.includes('ADMIN') ?? false)) {
|
||||||
|
conditions.push(or(eq(commercials.draft, false), eq(commercials.imagePath, emailToDirName(user?.username))));
|
||||||
}
|
}
|
||||||
private async findListings(table: typeof businesses | typeof commercials, criteria: ListingCriteria, start = 0, length = 12): Promise<any> {
|
|
||||||
const conditions = this.getConditions(criteria, table);
|
|
||||||
const [data, total] = await Promise.all([
|
const [data, total] = await Promise.all([
|
||||||
this.conn
|
this.conn
|
||||||
.select()
|
.select()
|
||||||
.from(table)
|
.from(commercials)
|
||||||
.where(and(...conditions))
|
.where(and(...conditions))
|
||||||
.offset(start)
|
.offset(start)
|
||||||
.limit(length),
|
.limit(length),
|
||||||
this.conn
|
this.conn
|
||||||
.select({ count: sql`count(*)` })
|
.select({ count: sql`count(*)` })
|
||||||
.from(table)
|
.from(commercials)
|
||||||
.where(and(...conditions))
|
.where(and(...conditions))
|
||||||
.then(result => Number(result[0].count)),
|
.then(result => Number(result[0].count)),
|
||||||
]);
|
]);
|
||||||
return { total, data };
|
return { total, data };
|
||||||
}
|
}
|
||||||
async findById(id: string, table: typeof businesses | typeof commercials): Promise<BusinessListing | CommercialPropertyListing> {
|
async findBusinessListings(criteria: ListingCriteria, user: JwtUser): Promise<any> {
|
||||||
|
const start = criteria.start ? criteria.start : 0;
|
||||||
|
const length = criteria.length ? criteria.length : 12;
|
||||||
|
const conditions = this.getConditions(criteria, businesses, user);
|
||||||
|
if (!user || (!user?.roles?.includes('ADMIN') ?? false)) {
|
||||||
|
conditions.push(or(eq(businesses.draft, false), eq(businesses.imageName, emailToDirName(user?.username))));
|
||||||
|
}
|
||||||
|
const [data, total] = await Promise.all([
|
||||||
|
this.conn
|
||||||
|
.select()
|
||||||
|
.from(businesses)
|
||||||
|
.where(and(...conditions))
|
||||||
|
.offset(start)
|
||||||
|
.limit(length),
|
||||||
|
this.conn
|
||||||
|
.select({ count: sql`count(*)` })
|
||||||
|
.from(businesses)
|
||||||
|
.where(and(...conditions))
|
||||||
|
.then(result => Number(result[0].count)),
|
||||||
|
]);
|
||||||
|
return { total, data };
|
||||||
|
}
|
||||||
|
async findCommercialPropertiesById(id: string, user: JwtUser): Promise<CommercialPropertyListing> {
|
||||||
|
let result = await this.conn
|
||||||
|
.select()
|
||||||
|
.from(commercials)
|
||||||
|
.where(and(sql`${commercials.id} = ${id}`));
|
||||||
|
result = result.filter(r => !r.draft || r.imagePath === emailToDirName(user?.username) || user?.roles.includes('ADMIN'));
|
||||||
|
return result[0] as CommercialPropertyListing;
|
||||||
|
}
|
||||||
|
async findBusinessesById(id: string, user: JwtUser): Promise<CommercialPropertyListing> {
|
||||||
|
let result = await this.conn
|
||||||
|
.select()
|
||||||
|
.from(businesses)
|
||||||
|
.where(and(sql`${businesses.id} = ${id}`));
|
||||||
|
result = result.filter(r => !r.draft || r.imageName === emailToDirName(user?.username) || user?.roles.includes('ADMIN'));
|
||||||
|
return result[0] as BusinessListing;
|
||||||
|
}
|
||||||
|
async findCommercialPropertiesByEmail(email: string, user: JwtUser): Promise<CommercialPropertyListing[]> {
|
||||||
|
const conditions = [];
|
||||||
|
conditions.push(eq(commercials.imagePath, emailToDirName(email)));
|
||||||
|
if (email !== user?.username && (!user?.roles?.includes('ADMIN') ?? false)) {
|
||||||
|
conditions.push(ne(commercials.draft, true));
|
||||||
|
}
|
||||||
|
return (await this.conn
|
||||||
|
.select()
|
||||||
|
.from(commercials)
|
||||||
|
.where(and(...conditions))) as CommercialPropertyListing[];
|
||||||
|
}
|
||||||
|
async findBusinessesByEmail(email: string, user: JwtUser): Promise<BusinessListing[]> {
|
||||||
|
const conditions = [];
|
||||||
|
conditions.push(eq(businesses.imageName, emailToDirName(email)));
|
||||||
|
if (email !== user?.username && (!user?.roles?.includes('ADMIN') ?? false)) {
|
||||||
|
conditions.push(ne(businesses.draft, true));
|
||||||
|
}
|
||||||
|
return (await this.conn
|
||||||
|
.select()
|
||||||
|
.from(businesses)
|
||||||
|
.where(and(...conditions))) as CommercialPropertyListing[];
|
||||||
|
}
|
||||||
|
async findByImagePath(imagePath: string, serial: string): Promise<CommercialPropertyListing> {
|
||||||
const result = await this.conn
|
const result = await this.conn
|
||||||
.select()
|
.select()
|
||||||
.from(table)
|
.from(commercials)
|
||||||
.where(sql`${table.id} = ${id}`);
|
.where(and(sql`${commercials.imagePath} = ${imagePath}`, sql`${commercials.serialId} = ${serial}`));
|
||||||
return result[0] as BusinessListing | CommercialPropertyListing;
|
return result[0] as CommercialPropertyListing;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findByUserId(userId: string, table: typeof businesses | typeof commercials): Promise<BusinessListing[] | CommercialPropertyListing[]> {
|
|
||||||
return (await this.conn.select().from(table).where(eq(table.userId, userId))) as BusinessListing[] | CommercialPropertyListing[];
|
|
||||||
}
|
|
||||||
|
|
||||||
async createListing(data: BusinessListing | CommercialPropertyListing, table: typeof businesses | typeof commercials): Promise<BusinessListing | CommercialPropertyListing> {
|
async createListing(data: BusinessListing | CommercialPropertyListing, table: typeof businesses | typeof commercials): Promise<BusinessListing | CommercialPropertyListing> {
|
||||||
data.created = new Date();
|
data.created = new Date();
|
||||||
data.updated = new Date();
|
data.updated = new Date();
|
||||||
data.visits = 0;
|
|
||||||
data.lastVisit = null;
|
|
||||||
const [createdListing] = await this.conn.insert(table).values(data).returning();
|
const [createdListing] = await this.conn.insert(table).values(data).returning();
|
||||||
return createdListing as BusinessListing | CommercialPropertyListing;
|
return createdListing as BusinessListing | CommercialPropertyListing;
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateListing(id: string, data: BusinessListing | CommercialPropertyListing, table: typeof businesses | typeof commercials): Promise<BusinessListing | CommercialPropertyListing> {
|
async updateCommercialPropertyListing(id: string, data: CommercialPropertyListing): Promise<BusinessListing | CommercialPropertyListing> {
|
||||||
data.updated = new Date();
|
data.updated = new Date();
|
||||||
data.created = new Date(data.created);
|
data.created = new Date(data.created);
|
||||||
const [updateListing] = await this.conn.update(table).set(data).where(eq(table.id, id)).returning();
|
const imageOrder = await this.fileService.getPropertyImages(data.imagePath, String(data.serialId));
|
||||||
|
let difference = imageOrder.filter(x => !data.imageOrder.includes(x)).concat(data.imageOrder.filter(x => !imageOrder.includes(x)));
|
||||||
|
if (difference.length > 0) {
|
||||||
|
this.logger.warn(`changes between image directory and imageOrder in listing ${data.serialId}: ${difference.join(',')}`);
|
||||||
|
data.imageOrder = imageOrder;
|
||||||
|
}
|
||||||
|
const [updateListing] = await this.conn.update(commercials).set(data).where(eq(commercials.id, id)).returning();
|
||||||
|
return updateListing as BusinessListing | CommercialPropertyListing;
|
||||||
|
}
|
||||||
|
async updateBusinessListing(id: string, data: BusinessListing): Promise<BusinessListing | CommercialPropertyListing> {
|
||||||
|
data.updated = new Date();
|
||||||
|
data.created = new Date(data.created);
|
||||||
|
const [updateListing] = await this.conn.update(businesses).set(data).where(eq(businesses.id, id)).returning();
|
||||||
return updateListing as BusinessListing | CommercialPropertyListing;
|
return updateListing as BusinessListing | CommercialPropertyListing;
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteListing(id: string, table: typeof businesses | typeof commercials): Promise<void> {
|
async deleteListing(id: string, table: typeof businesses | typeof commercials): Promise<void> {
|
||||||
await this.conn.delete(table).where(eq(table.id, id));
|
await this.conn.delete(table).where(eq(table.id, id));
|
||||||
}
|
}
|
||||||
@@ -102,24 +169,17 @@ export class ListingsService {
|
|||||||
// ##############################################################
|
// ##############################################################
|
||||||
// Images for commercial Properties
|
// Images for commercial Properties
|
||||||
// ##############################################################
|
// ##############################################################
|
||||||
|
async deleteImage(imagePath: string, serial: string, name: string) {
|
||||||
async updateImageOrder(id: string, imageOrder: string[]) {
|
const listing = (await this.findByImagePath(imagePath, serial)) as unknown as CommercialPropertyListing;
|
||||||
const listing = (await this.findById(id, commercials)) as unknown as CommercialPropertyListing;
|
|
||||||
listing.imageOrder = imageOrder;
|
|
||||||
await this.updateListing(listing.id, listing, commercials);
|
|
||||||
}
|
|
||||||
async deleteImage(id: string, name: string) {
|
|
||||||
const listing = (await this.findById(id, commercials)) as unknown as CommercialPropertyListing;
|
|
||||||
const index = listing.imageOrder.findIndex(im => im === name);
|
const index = listing.imageOrder.findIndex(im => im === name);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
listing.imageOrder.splice(index, 1);
|
listing.imageOrder.splice(index, 1);
|
||||||
await this.updateListing(listing.id, listing, commercials);
|
await this.updateCommercialPropertyListing(listing.id, listing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async addImage(id: string, imagename: string) {
|
async addImage(imagePath: string, serial: string, imagename: string) {
|
||||||
const listing = (await this.findById(id, commercials)) as unknown as CommercialPropertyListing;
|
const listing = (await this.findByImagePath(imagePath, serial)) as unknown as CommercialPropertyListing;
|
||||||
listing.imageOrder.push(imagename);
|
listing.imageOrder.push(imagename);
|
||||||
listing.imagePath = listing.id;
|
await this.updateCommercialPropertyListing(listing.id, listing);
|
||||||
await this.updateListing(listing.id, listing, commercials);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,22 @@
|
|||||||
import { Body, Controller, Delete, Get, Inject, Param, Post, Put } from '@nestjs/common';
|
import { Controller, Inject } from '@nestjs/common';
|
||||||
import { FileService } from '../file/file.service.js';
|
|
||||||
import { convertStringToNullUndefined } from '../utils.js';
|
|
||||||
import { ListingsService } from './listings.service.js';
|
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
import { businesses, commercials } from 'src/drizzle/schema.js';
|
import { ListingsService } from './listings.service.js';
|
||||||
|
|
||||||
|
|
||||||
@Controller('listings/undefined')
|
@Controller('listings/undefined')
|
||||||
export class UnknownListingsController {
|
export class UnknownListingsController {
|
||||||
|
constructor(
|
||||||
|
private readonly listingsService: ListingsService,
|
||||||
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
|
) {}
|
||||||
|
|
||||||
constructor(private readonly listingsService:ListingsService,@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {
|
// @Get(':id')
|
||||||
}
|
// async findById(@Param('id') id: string): Promise<any> {
|
||||||
|
// const result = await this.listingsService.findById(id, businesses);
|
||||||
@Get(':id')
|
// if (result) {
|
||||||
async findById(@Param('id') id:string): Promise<any> {
|
// return result;
|
||||||
const result = await this.listingsService.findById(id,businesses);
|
// } else {
|
||||||
if (result){
|
// return await this.listingsService.findById(id, commercials);
|
||||||
return result
|
// }
|
||||||
} else {
|
// }
|
||||||
return await this.listingsService.findById(id,commercials);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import { Body, Controller, Post } from '@nestjs/common';
|
import { Body, Controller, Post } from '@nestjs/common';
|
||||||
import { User } from 'src/models/db.model.js';
|
import { ErrorResponse, MailInfo } from 'src/models/main.model.js';
|
||||||
import { MailInfo } from 'src/models/main.model.js';
|
|
||||||
import { MailService } from './mail.service.js';
|
import { MailService } from './mail.service.js';
|
||||||
|
|
||||||
@Controller('mail')
|
@Controller('mail')
|
||||||
export class MailController {
|
export class MailController {
|
||||||
constructor(private mailService: MailService) {}
|
constructor(private mailService: MailService) {}
|
||||||
@Post()
|
@Post()
|
||||||
sendEMail(@Body() mailInfo: MailInfo): Promise<User> {
|
sendEMail(@Body() mailInfo: MailInfo): Promise<void | ErrorResponse> {
|
||||||
|
if (mailInfo.listing) {
|
||||||
return this.mailService.sendInquiry(mailInfo);
|
return this.mailService.sendInquiry(mailInfo);
|
||||||
|
} else {
|
||||||
|
return this.mailService.sendRequest(mailInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import { MailerService } from '@nestjs-modules/mailer';
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import path, { join } from 'path';
|
import path, { join } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { User } from '../models/db.model.js';
|
import { ErrorResponse, MailInfo, isEmpty } from '../models/main.model.js';
|
||||||
import { MailInfo } from '../models/main.model.js';
|
|
||||||
import { UserService } from '../user/user.service.js';
|
import { UserService } from '../user/user.service.js';
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
@@ -15,10 +14,13 @@ export class MailService {
|
|||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async sendInquiry(mailInfo: MailInfo): Promise<User> {
|
async sendInquiry(mailInfo: MailInfo): Promise<void | ErrorResponse> {
|
||||||
//const user = await this.authService.getUser(mailInfo.userId) as KeycloakUser;
|
//const user = await this.authService.getUser(mailInfo.userId) as KeycloakUser;
|
||||||
const user = await this.userService.getUserByMail(mailInfo.email);
|
const user = await this.userService.getUserByMail(mailInfo.email);
|
||||||
console.log(JSON.stringify(user));
|
console.log(JSON.stringify(user));
|
||||||
|
if (isEmpty(mailInfo.sender.name)) {
|
||||||
|
return { fields: [{ fieldname: 'name', message: 'Required' }] };
|
||||||
|
}
|
||||||
await this.mailerService.sendMail({
|
await this.mailerService.sendMail({
|
||||||
to: user.email,
|
to: user.email,
|
||||||
from: '"Bizmatch Team" <info@bizmatch.net>', // override default from
|
from: '"Bizmatch Team" <info@bizmatch.net>', // override default from
|
||||||
@@ -34,8 +36,28 @@ export class MailService {
|
|||||||
iname: mailInfo.sender.name,
|
iname: mailInfo.sender.name,
|
||||||
phone: mailInfo.sender.phoneNumber,
|
phone: mailInfo.sender.phoneNumber,
|
||||||
email: mailInfo.sender.email,
|
email: mailInfo.sender.email,
|
||||||
|
id: mailInfo.listing.id,
|
||||||
|
url: mailInfo.url,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async sendRequest(mailInfo: MailInfo): Promise<void | ErrorResponse> {
|
||||||
|
if (isEmpty(mailInfo.sender.name)) {
|
||||||
|
return { fields: [{ fieldname: 'name', message: 'Required' }] };
|
||||||
|
}
|
||||||
|
await this.mailerService.sendMail({
|
||||||
|
to: 'support@bizmatch.net',
|
||||||
|
from: `"Bizmatch Support Team" <info@bizmatch.net>`,
|
||||||
|
subject: `Support Request from ${mailInfo.sender.name}`,
|
||||||
|
//template: './inquiry', // `.hbs` extension is appended automatically
|
||||||
|
template: join(__dirname, '../..', 'mail/templates/request.hbs'),
|
||||||
|
context: {
|
||||||
|
// ✏️ filling curly brackets with content
|
||||||
|
request: mailInfo.sender.comments,
|
||||||
|
iname: mailInfo.sender.name,
|
||||||
|
phone: mailInfo.sender.phoneNumber,
|
||||||
|
email: mailInfo.sender.email,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return user;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,104 @@
|
|||||||
<p>Hey {{ name }},</p>
|
<!DOCTYPE html>
|
||||||
<p>You got an inquiry a</p>
|
<html lang="en">
|
||||||
<p>
|
<head>
|
||||||
{{inquiry}}
|
<meta charset="UTF-8">
|
||||||
</p>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Notification: New Buyer Lead</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
width: 80%;
|
||||||
|
margin: auto;
|
||||||
|
background-color: white;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.subheader {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
|
.section {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.section-title {
|
||||||
|
color: #1E90FF;
|
||||||
|
font-weight: bold;
|
||||||
|
border-bottom: 2px solid #1E90FF;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.info:nth-child(even) {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
.info-label {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.info-value {
|
||||||
|
margin-left: 10px;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">Notification: New buyer lead from the Bizmatch Network</div>
|
||||||
|
<div class="subheader">Dear {{name}},</div>
|
||||||
|
<p>You've received a message regarding your "{{title}}" listing.</p>
|
||||||
|
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">Buyer Information</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Contact Name:</span>
|
||||||
|
<span class="info-value">{{iname}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Contact Email:</span>
|
||||||
|
<span class="info-value">{{email}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Contact Phone:</span>
|
||||||
|
<span class="info-value">{{phone}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Comments:</span>
|
||||||
|
<span class="info-value">{{inquiry}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">Listing Information</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Headline:</span>
|
||||||
|
<span class="info-value">{{title}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Listing ID:</span>
|
||||||
|
<span class="info-value"><a href="{{url}}/listing/{{id}}">{{id}}</a></span>
|
||||||
|
</div>
|
||||||
|
{{#if internalListingNumber}}
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Ref ID:</span>
|
||||||
|
<span class="info-value">{{internalListingNumber}}</span>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
83
bizmatch-server/src/mail/templates/request.hbs
Normal file
83
bizmatch-server/src/mail/templates/request.hbs
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Notification: New User Request</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
width: 80%;
|
||||||
|
margin: auto;
|
||||||
|
background-color: white;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.subheader {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
|
.section {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.section-title {
|
||||||
|
color: #1E90FF;
|
||||||
|
font-weight: bold;
|
||||||
|
border-bottom: 2px solid #1E90FF;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.info:nth-child(even) {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
.info-label {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.info-value {
|
||||||
|
margin-left: 10px;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">Notification: New request from a user of the Bizmatch Network</div>
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">Requester Information</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Contact Name:</span>
|
||||||
|
<span class="info-value">{{iname}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Contact Email:</span>
|
||||||
|
<span class="info-value">{{email}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Contact Phone:</span>
|
||||||
|
<span class="info-value">{{phone}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info">
|
||||||
|
<span class="info-label">Question:</span>
|
||||||
|
<span class="info-value">{{request}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { AppModule } from './app.module.js';
|
import express from 'express';
|
||||||
import * as express from 'express';
|
import path from 'path';
|
||||||
import path, { join } from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
import { AppModule } from './app.module.js';
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
|
const server = express();
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
app.setGlobalPrefix('bizmatch');
|
app.setGlobalPrefix('bizmatch');
|
||||||
app.enableCors({
|
app.enableCors({
|
||||||
origin: '*',
|
origin: '*',
|
||||||
|
//origin: 'http://localhost:4200', // Die URL Ihrer Angular-App
|
||||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||||
allowedHeaders: 'Content-Type, Accept',
|
allowedHeaders: 'Content-Type, Accept, Authorization',
|
||||||
});
|
});
|
||||||
//origin: 'http://localhost:4200',
|
//origin: 'http://localhost:4200',
|
||||||
await app.listen(3000);
|
await app.listen(3000);
|
||||||
|
|||||||
@@ -1,4 +1,25 @@
|
|||||||
export interface User {
|
export interface User {
|
||||||
|
id?: string;
|
||||||
|
firstname: string;
|
||||||
|
lastname: string;
|
||||||
|
email: string;
|
||||||
|
phoneNumber?: string;
|
||||||
|
description?: string;
|
||||||
|
companyName?: string;
|
||||||
|
companyOverview?: string;
|
||||||
|
companyWebsite?: string;
|
||||||
|
companyLocation?: string;
|
||||||
|
offeredServices?: string;
|
||||||
|
areasServed?: AreasServed[];
|
||||||
|
hasProfile?: boolean;
|
||||||
|
hasCompanyLogo?: boolean;
|
||||||
|
licensedIn?: LicensedIn[];
|
||||||
|
gender?: 'male' | 'female';
|
||||||
|
customerType?: 'buyer' | 'broker' | 'professional';
|
||||||
|
created?: Date;
|
||||||
|
updated?: Date;
|
||||||
|
}
|
||||||
|
export interface UserData {
|
||||||
id?: string;
|
id?: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
@@ -14,8 +35,11 @@ export interface User {
|
|||||||
hasProfile?: boolean;
|
hasProfile?: boolean;
|
||||||
hasCompanyLogo?: boolean;
|
hasCompanyLogo?: boolean;
|
||||||
licensedIn?: string[];
|
licensedIn?: string[];
|
||||||
|
gender?: 'male' | 'female';
|
||||||
|
customerType?: 'buyer' | 'broker' | 'professional';
|
||||||
|
created?: Date;
|
||||||
|
updated?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BusinessListing {
|
export interface BusinessListing {
|
||||||
id: string;
|
id: string;
|
||||||
userId?: string;
|
userId?: string;
|
||||||
@@ -39,15 +63,17 @@ export interface BusinessListing {
|
|||||||
reasonForSale?: string;
|
reasonForSale?: string;
|
||||||
brokerLicencing?: string;
|
brokerLicencing?: string;
|
||||||
internals?: string;
|
internals?: string;
|
||||||
|
imageName?: string;
|
||||||
created?: Date;
|
created?: Date;
|
||||||
updated?: Date;
|
updated?: Date;
|
||||||
visits?: number;
|
visits?: number;
|
||||||
lastVisit?: Date;
|
lastVisit?: Date;
|
||||||
listingsCategory?: string;
|
listingsCategory?: 'commercialProperty' | 'business';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CommercialPropertyListing {
|
export interface CommercialPropertyListing {
|
||||||
id: string;
|
id: string;
|
||||||
|
serialId?: number;
|
||||||
userId?: string;
|
userId?: string;
|
||||||
type?: number;
|
type?: number;
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -69,5 +95,13 @@ export interface CommercialPropertyListing {
|
|||||||
updated?: Date;
|
updated?: Date;
|
||||||
visits?: number;
|
visits?: number;
|
||||||
lastVisit?: Date;
|
lastVisit?: Date;
|
||||||
listingsCategory?: string;
|
listingsCategory?: 'commercialProperty' | 'business';
|
||||||
|
}
|
||||||
|
export interface AreasServed {
|
||||||
|
county: string;
|
||||||
|
state: string;
|
||||||
|
}
|
||||||
|
export interface LicensedIn {
|
||||||
|
registerNo: string;
|
||||||
|
state: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,24 +64,29 @@ export interface ListingCriteria {
|
|||||||
maxPrice: number;
|
maxPrice: number;
|
||||||
realEstateChecked: boolean;
|
realEstateChecked: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
category: 'professional|broker';
|
category: 'professional' | 'broker';
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface KeycloakUser {
|
export interface KeycloakUser {
|
||||||
id: string;
|
id: string;
|
||||||
createdTimestamp: number;
|
createdTimestamp?: number;
|
||||||
username: string;
|
username?: string;
|
||||||
enabled: boolean;
|
enabled?: boolean;
|
||||||
totp: boolean;
|
totp?: boolean;
|
||||||
emailVerified: boolean;
|
emailVerified?: boolean;
|
||||||
firstName: string;
|
firstName: string;
|
||||||
lastName: string;
|
lastName: string;
|
||||||
email: string;
|
email: string;
|
||||||
disableableCredentialTypes: any[];
|
disableableCredentialTypes?: any[];
|
||||||
requiredActions: any[];
|
requiredActions?: any[];
|
||||||
notBefore: number;
|
notBefore?: number;
|
||||||
access: Access;
|
access?: Access;
|
||||||
|
}
|
||||||
|
export interface JwtUser {
|
||||||
|
userId: string;
|
||||||
|
username: string;
|
||||||
|
roles: string[];
|
||||||
}
|
}
|
||||||
export interface Access {
|
export interface Access {
|
||||||
manageGroupMembership: boolean;
|
manageGroupMembership: boolean;
|
||||||
@@ -130,6 +135,14 @@ export interface JwtToken {
|
|||||||
email: string;
|
email: string;
|
||||||
user_id: string;
|
user_id: string;
|
||||||
}
|
}
|
||||||
|
export interface JwtPayload {
|
||||||
|
sub: string;
|
||||||
|
preferred_username: string;
|
||||||
|
realm_access?: {
|
||||||
|
roles?: string[];
|
||||||
|
};
|
||||||
|
[key: string]: any; // für andere optionale Felder im JWT-Payload
|
||||||
|
}
|
||||||
interface Resourceaccess {
|
interface Resourceaccess {
|
||||||
account: Realmaccess;
|
account: Realmaccess;
|
||||||
}
|
}
|
||||||
@@ -150,6 +163,7 @@ export interface MailInfo {
|
|||||||
sender: Sender;
|
sender: Sender;
|
||||||
userId: string;
|
userId: string;
|
||||||
email: string;
|
email: string;
|
||||||
|
url: string;
|
||||||
listing?: BusinessListing;
|
listing?: BusinessListing;
|
||||||
}
|
}
|
||||||
export interface Sender {
|
export interface Sender {
|
||||||
@@ -164,3 +178,45 @@ export interface ImageProperty {
|
|||||||
code: string;
|
code: string;
|
||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
export interface ErrorResponse {
|
||||||
|
fields?: FieldError[];
|
||||||
|
general?: string[];
|
||||||
|
}
|
||||||
|
export interface FieldError {
|
||||||
|
fieldname: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
export function isEmpty(value: any): boolean {
|
||||||
|
// Check for undefined or null
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for empty string or string with only whitespace
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return value.trim().length === 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for number and NaN
|
||||||
|
if (typeof value === 'number') {
|
||||||
|
return isNaN(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's not a string or number, it's not considered empty by this function
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
export function emailToDirName(email: string): string {
|
||||||
|
if (email === undefined || email === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// Entferne ungültige Zeichen und ersetze sie durch Unterstriche
|
||||||
|
const sanitizedEmail = email.replace(/[^a-zA-Z0-9_-]/g, '_');
|
||||||
|
|
||||||
|
// Entferne führende und nachfolgende Unterstriche
|
||||||
|
const trimmedEmail = sanitizedEmail.replace(/^_+|_+$/g, '');
|
||||||
|
|
||||||
|
// Ersetze mehrfache aufeinanderfolgende Unterstriche durch einen einzelnen Unterstrich
|
||||||
|
const normalizedEmail = trimmedEmail.replace(/_+/g, '_');
|
||||||
|
|
||||||
|
return normalizedEmail;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable, NestMiddleware, Logger } from '@nestjs/common';
|
import { Injectable, Logger, NestMiddleware } from '@nestjs/common';
|
||||||
import { Request, Response, NextFunction } from 'express';
|
import { NextFunction, Request, Response } from 'express';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RequestDurationMiddleware implements NestMiddleware {
|
export class RequestDurationMiddleware implements NestMiddleware {
|
||||||
@@ -8,8 +8,17 @@ export class RequestDurationMiddleware implements NestMiddleware {
|
|||||||
use(req: Request, res: Response, next: NextFunction) {
|
use(req: Request, res: Response, next: NextFunction) {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
res.on('finish', () => {
|
res.on('finish', () => {
|
||||||
|
// const duration = Date.now() - start;
|
||||||
|
// this.logger.log(`${req.method} ${req.url} - ${duration}ms`);
|
||||||
const duration = Date.now() - start;
|
const duration = Date.now() - start;
|
||||||
this.logger.log(`${req.method} ${req.url} - ${duration}ms`);
|
let logMessage = `${req.method} ${req.url} - ${duration}ms`;
|
||||||
|
|
||||||
|
if (req.method === 'POST' || req.method === 'PUT') {
|
||||||
|
const body = JSON.stringify(req.body);
|
||||||
|
logMessage += ` - Body: ${body}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.log(logMessage);
|
||||||
});
|
});
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ import { SelectOptionsService } from './select-options.service.js';
|
|||||||
|
|
||||||
@Controller('select-options')
|
@Controller('select-options')
|
||||||
export class SelectOptionsController {
|
export class SelectOptionsController {
|
||||||
constructor(private selectOptionsService:SelectOptionsService){}
|
constructor(private selectOptionsService: SelectOptionsService) {}
|
||||||
@Get()
|
@Get()
|
||||||
getSelectOption():any{
|
getSelectOption(): any {
|
||||||
return {
|
return {
|
||||||
typesOfBusiness:this.selectOptionsService.typesOfBusiness,
|
typesOfBusiness: this.selectOptionsService.typesOfBusiness,
|
||||||
prices:this.selectOptionsService.prices,
|
prices: this.selectOptionsService.prices,
|
||||||
listingCategories:this.selectOptionsService.listingCategories,
|
listingCategories: this.selectOptionsService.listingCategories,
|
||||||
categories:this.selectOptionsService.categories,
|
customerTypes: this.selectOptionsService.customerTypes,
|
||||||
locations:this.selectOptionsService.locations,
|
locations: this.selectOptionsService.locations,
|
||||||
typesOfCommercialProperty:this.selectOptionsService.typesOfCommercialProperty,
|
typesOfCommercialProperty: this.selectOptionsService.typesOfCommercialProperty,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,14 @@ export class SelectOptionsService {
|
|||||||
{ name: 'Business', value: 'business' },
|
{ name: 'Business', value: 'business' },
|
||||||
{ name: 'Commercial Property', value: 'commercialProperty' },
|
{ name: 'Commercial Property', value: 'commercialProperty' },
|
||||||
];
|
];
|
||||||
public categories: Array<KeyValueStyle> = [
|
public customerTypes: Array<KeyValue> = [
|
||||||
{ name: 'Broker', value: 'broker', icon: 'pi-image', bgColorClass: 'bg-green-100', textColorClass: 'text-green-600' },
|
{ name: 'Buyer', value: 'buyer' },
|
||||||
{ name: 'Professional', value: 'professional', icon: 'pi-globe', bgColorClass: 'bg-yellow-100', textColorClass: 'text-yellow-600' },
|
{ name: 'Broker', value: 'broker' },
|
||||||
|
{ name: 'Professional', value: 'professional' },
|
||||||
|
];
|
||||||
|
public gender: Array<KeyValue> = [
|
||||||
|
{ name: 'Male', value: 'male' },
|
||||||
|
{ name: 'Female', value: 'female' },
|
||||||
];
|
];
|
||||||
public imageTypes: ImageType[] = [
|
public imageTypes: ImageType[] = [
|
||||||
{ name: 'propertyPicture', upload: 'uploadPropertyPicture', delete: 'propertyPicture' },
|
{ name: 'propertyPicture', upload: 'uploadPropertyPicture', delete: 'propertyPicture' },
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import { Controller, Get } from '@nestjs/common';
|
|
||||||
import { FileService } from '../file/file.service.js';
|
|
||||||
|
|
||||||
@Controller('subscriptions')
|
|
||||||
export class SubscriptionsController {
|
|
||||||
constructor(private readonly fileService: FileService){}
|
|
||||||
@Get()
|
|
||||||
findAll(): any {
|
|
||||||
return this.fileService.getSubscriptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
import { Body, Controller, Get, Inject, Param, Post, Put, Query, Req } from '@nestjs/common';
|
import { Body, Controller, Get, Inject, Param, Post, Query } from '@nestjs/common';
|
||||||
import { UserService } from './user.service.js';
|
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
import { Logger } from 'winston';
|
|
||||||
import { User } from 'src/models/db.model.js';
|
import { User } from 'src/models/db.model.js';
|
||||||
|
import { Logger } from 'winston';
|
||||||
|
import { FileService } from '../file/file.service.js';
|
||||||
|
import { Subscription } from '../models/main.model.js';
|
||||||
|
import { UserService } from './user.service.js';
|
||||||
|
|
||||||
@Controller('user')
|
@Controller('user')
|
||||||
export class UserController {
|
export class UserController {
|
||||||
|
constructor(
|
||||||
constructor(private userService: UserService, @Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger) {}
|
private userService: UserService,
|
||||||
|
private fileService: FileService,
|
||||||
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||||
|
) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
findByMail(@Query('mail') mail: string): any {
|
findByMail(@Query('mail') mail: string): any {
|
||||||
@@ -38,5 +43,23 @@ export class UserController {
|
|||||||
this.logger.info(`Found users: ${JSON.stringify(foundUsers)}`);
|
this.logger.info(`Found users: ${JSON.stringify(foundUsers)}`);
|
||||||
return foundUsers;
|
return foundUsers;
|
||||||
}
|
}
|
||||||
|
@Get('states/all')
|
||||||
|
async getStates(): Promise<any[]> {
|
||||||
|
this.logger.info(`Getting all states for users`);
|
||||||
|
const result = await this.userService.getStates();
|
||||||
|
this.logger.info(`Found ${result.length} entries`);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('subscriptions/:id')
|
||||||
|
async findSubscriptionsById(@Param('id') id: string): Promise<Subscription[]> {
|
||||||
|
const subscriptions = this.fileService.getSubscriptions();
|
||||||
|
const user = await this.userService.getUserById(id);
|
||||||
|
subscriptions.forEach(s => {
|
||||||
|
s.userId = user.id;
|
||||||
|
s.start = user.created;
|
||||||
|
s.modified = user.created;
|
||||||
|
});
|
||||||
|
return subscriptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import { Inject, Injectable } from '@nestjs/common';
|
|||||||
import { and, eq, ilike, or, sql } from 'drizzle-orm';
|
import { and, eq, ilike, or, sql } from 'drizzle-orm';
|
||||||
import { NodePgDatabase } from 'drizzle-orm/node-postgres/driver.js';
|
import { NodePgDatabase } from 'drizzle-orm/node-postgres/driver.js';
|
||||||
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
|
||||||
import { PG_CONNECTION } from 'src/drizzle/schema.js';
|
|
||||||
import { User } from 'src/models/db.model.js';
|
|
||||||
import { Logger } from 'winston';
|
import { Logger } from 'winston';
|
||||||
import * as schema from '../drizzle/schema.js';
|
import * as schema from '../drizzle/schema.js';
|
||||||
|
import { PG_CONNECTION } from '../drizzle/schema.js';
|
||||||
import { FileService } from '../file/file.service.js';
|
import { FileService } from '../file/file.service.js';
|
||||||
import { ListingCriteria } from '../models/main.model.js';
|
import { User } from '../models/db.model.js';
|
||||||
|
import { ListingCriteria, emailToDirName } from '../models/main.model.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserService {
|
export class UserService {
|
||||||
@@ -19,7 +19,8 @@ export class UserService {
|
|||||||
private getConditions(criteria: ListingCriteria): any[] {
|
private getConditions(criteria: ListingCriteria): any[] {
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
if (criteria.state) {
|
if (criteria.state) {
|
||||||
conditions.push(sql`EXISTS (SELECT 1 FROM unnest(users."areasServed") AS area WHERE area LIKE '%' || ${criteria.state} || '%')`);
|
//conditions.push(sql`EXISTS (SELECT 1 FROM unnest(users."areasServed") AS area WHERE area LIKE '%' || ${criteria.state} || '%')`);
|
||||||
|
conditions.push(sql`${schema.users.areasServed} @> ${JSON.stringify([{ state: criteria.state }])}`);
|
||||||
}
|
}
|
||||||
if (criteria.name) {
|
if (criteria.name) {
|
||||||
conditions.push(or(ilike(schema.users.firstname, `%${criteria.name}%`), ilike(schema.users.lastname, `%${criteria.name}%`)));
|
conditions.push(or(ilike(schema.users.firstname, `%${criteria.name}%`), ilike(schema.users.lastname, `%${criteria.name}%`)));
|
||||||
@@ -32,8 +33,8 @@ export class UserService {
|
|||||||
.from(schema.users)
|
.from(schema.users)
|
||||||
.where(sql`email = ${email}`)) as User[];
|
.where(sql`email = ${email}`)) as User[];
|
||||||
const user = users[0];
|
const user = users[0];
|
||||||
user.hasCompanyLogo = this.fileService.hasCompanyLogo(user.id);
|
user.hasCompanyLogo = this.fileService.hasCompanyLogo(emailToDirName(user.email));
|
||||||
user.hasProfile = this.fileService.hasProfile(user.id);
|
user.hasProfile = this.fileService.hasProfile(emailToDirName(user.email));
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
async getUserById(id: string) {
|
async getUserById(id: string) {
|
||||||
@@ -42,15 +43,19 @@ export class UserService {
|
|||||||
.from(schema.users)
|
.from(schema.users)
|
||||||
.where(sql`id = ${id}`)) as User[];
|
.where(sql`id = ${id}`)) as User[];
|
||||||
const user = users[0];
|
const user = users[0];
|
||||||
user.hasCompanyLogo = this.fileService.hasCompanyLogo(id);
|
user.hasCompanyLogo = this.fileService.hasCompanyLogo(emailToDirName(user.email));
|
||||||
user.hasProfile = this.fileService.hasProfile(id);
|
user.hasProfile = this.fileService.hasProfile(emailToDirName(user.email));
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
async saveUser(user: any): Promise<User> {
|
async saveUser(user: any): Promise<User> {
|
||||||
if (user.id) {
|
if (user.id) {
|
||||||
|
user.created = new Date(user.created);
|
||||||
|
user.updated = new Date();
|
||||||
const [updateUser] = await this.conn.update(schema.users).set(user).where(eq(schema.users.id, user.id)).returning();
|
const [updateUser] = await this.conn.update(schema.users).set(user).where(eq(schema.users.id, user.id)).returning();
|
||||||
return updateUser as User;
|
return updateUser as User;
|
||||||
} else {
|
} else {
|
||||||
|
user.created = new Date();
|
||||||
|
user.updated = new Date();
|
||||||
const [newUser] = await this.conn.insert(schema.users).values(user).returning();
|
const [newUser] = await this.conn.insert(schema.users).values(user).returning();
|
||||||
return newUser as User;
|
return newUser as User;
|
||||||
}
|
}
|
||||||
@@ -74,4 +79,9 @@ export class UserService {
|
|||||||
]);
|
]);
|
||||||
return { total, data };
|
return { total, data };
|
||||||
}
|
}
|
||||||
|
async getStates(): Promise<any[]> {
|
||||||
|
const query = sql`SELECT jsonb_array_elements(${schema.users.areasServed}) ->> 'state' AS state, COUNT(DISTINCT ${schema.users.id}) AS count FROM ${schema.users} GROUP BY state ORDER BY count DESC`;
|
||||||
|
const result = await this.conn.execute(query);
|
||||||
|
return result.rows;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve & http-server ../bizmatch-server",
|
"start": "ng serve & http-server ../bizmatch-server",
|
||||||
"build": "ng build",
|
"prebuild": "node version.js",
|
||||||
"build.dev": "ng build --configuration dev",
|
"build": "node version.js && ng build",
|
||||||
|
"build.dev": "node version.js && ng build --configuration dev --output-hashing=all",
|
||||||
"watch": "ng build --watch --configuration development",
|
"watch": "ng build --watch --configuration development",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"serve:ssr:bizmatch": "node dist/bizmatch/server/server.mjs"
|
"serve:ssr:bizmatch": "node dist/bizmatch/server/server.mjs"
|
||||||
@@ -33,14 +34,16 @@
|
|||||||
"angular-mixed-cdk-drag-drop": "^2.2.3",
|
"angular-mixed-cdk-drag-drop": "^2.2.3",
|
||||||
"browser-bunyan": "^1.8.0",
|
"browser-bunyan": "^1.8.0",
|
||||||
"cropperjs": "^1.6.1",
|
"cropperjs": "^1.6.1",
|
||||||
|
"dayjs": "^1.11.11",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"keycloak-js": "^23.0.7",
|
"keycloak-angular": "^15.2.1",
|
||||||
|
"keycloak-js": "^24.0.4",
|
||||||
"memoize-one": "^6.0.0",
|
"memoize-one": "^6.0.0",
|
||||||
"on-change": "^5.0.1",
|
"on-change": "^5.0.1",
|
||||||
"primeflex": "^3.3.1",
|
"primeflex": "^3.3.1",
|
||||||
"primeicons": "^6.0.1",
|
"primeicons": "^6.0.1",
|
||||||
"primeng": "^17.10.0",
|
"primeng": "^17.16.1",
|
||||||
"quill": "^1.3.7",
|
"quill": "^1.3.7",
|
||||||
"rxjs": "~7.8.1",
|
"rxjs": "~7.8.1",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
|||||||
@@ -6,18 +6,26 @@
|
|||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
</div>
|
</div>
|
||||||
<footer></footer>
|
<footer></footer>
|
||||||
|
<p-confirmDialog #cd>
|
||||||
|
<ng-template pTemplate="headless" let-message>
|
||||||
|
<div class="flex flex-column align-items-center p-5 surface-overlay border-round">
|
||||||
|
<span class="font-bold text-2xl block mb-2 mt-4">
|
||||||
|
{{ message.header }}
|
||||||
|
</span>
|
||||||
|
<p class="mb-0">{{ message.message }}</p>
|
||||||
|
<div class="flex align-items-center gap-2 mt-4">
|
||||||
|
<button pButton label="OK" (click)="cd.accept()" size="small"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
</p-confirmDialog>
|
||||||
</div>
|
</div>
|
||||||
<!-- @if (loadingService.isLoading$ | async) { -->
|
|
||||||
<!-- <div class="progress-spinner flex h-full align-items-center justify-content-center">
|
|
||||||
<div class="spinner-text">Please wait - we're processing your image...</div>
|
|
||||||
<p-progressSpinner></p-progressSpinner>
|
|
||||||
</div> -->
|
|
||||||
<!-- } -->
|
|
||||||
@if (loadingService.isLoading$ | async) {
|
@if (loadingService.isLoading$ | async) {
|
||||||
<div class="spinner-overlay">
|
<div class="spinner-overlay">
|
||||||
<div class="spinner-container">
|
<div class="spinner-container">
|
||||||
<p-progressSpinner></p-progressSpinner>
|
<p-progressSpinner></p-progressSpinner>
|
||||||
<div class="spinner-text" *ngIf="loadingService.loadingText$ | async as loadingText">{{loadingText}}</div>
|
<div class="spinner-text" *ngIf="loadingService.loadingText$ | async as loadingText">{{ loadingText }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,67 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { Component, ViewChild } from '@angular/core';
|
import { Component, HostListener } from '@angular/core';
|
||||||
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
||||||
import { HeaderComponent } from './components/header/header.component';
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { ProgressSpinnerModule } from 'primeng/progressspinner';
|
|
||||||
import { ToastModule } from 'primeng/toast';
|
|
||||||
import { LoadingService } from './services/loading.service';
|
|
||||||
import { HomeComponent } from './pages/home/home.component';
|
|
||||||
import { filter } from 'rxjs/operators';
|
|
||||||
import { FooterComponent } from './components/footer/footer.component';
|
|
||||||
import { KeycloakService } from './services/keycloak.service';
|
|
||||||
import { KeycloakEventType } from './models/keycloak-event';
|
|
||||||
import { createGenericObject } from './utils/utils';
|
|
||||||
import onChange from 'on-change';
|
import onChange from 'on-change';
|
||||||
|
import { ConfirmationService } from 'primeng/api';
|
||||||
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
||||||
|
import { ProgressSpinnerModule } from 'primeng/progressspinner';
|
||||||
|
import { filter } from 'rxjs/operators';
|
||||||
|
import { ListingCriteria } from '../../../bizmatch-server/src/models/main.model';
|
||||||
|
import build from '../build';
|
||||||
|
import { FooterComponent } from './components/footer/footer.component';
|
||||||
|
import { HeaderComponent } from './components/header/header.component';
|
||||||
|
import { LoadingService } from './services/loading.service';
|
||||||
import { UserService } from './services/user.service';
|
import { UserService } from './services/user.service';
|
||||||
import {ListingCriteria} from '../../../bizmatch-server/src/models/main.model'
|
import { createDefaultListingCriteria } from './utils/utils';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, RouterOutlet, HeaderComponent, ProgressSpinnerModule, FooterComponent],
|
imports: [CommonModule, RouterOutlet, HeaderComponent, ProgressSpinnerModule, FooterComponent, ConfirmDialogModule],
|
||||||
|
providers: [ConfirmationService],
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
styleUrl: './app.component.scss'
|
styleUrl: './app.component.scss',
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
build = build;
|
||||||
title = 'bizmatch';
|
title = 'bizmatch';
|
||||||
actualRoute ='';
|
actualRoute = '';
|
||||||
listingCriteria:ListingCriteria = onChange(createGenericObject<ListingCriteria>(),(path, value, previousValue, applyData)=>{
|
listingCriteria: ListingCriteria = onChange(createDefaultListingCriteria(), (path, value, previousValue, applyData) => {
|
||||||
sessionStorage.setItem('criteria',JSON.stringify(value));
|
sessionStorage.setItem('criteria', JSON.stringify(value));
|
||||||
});
|
});
|
||||||
public constructor(public loadingService: LoadingService, private router: Router,private activatedRoute: ActivatedRoute, private keycloakService:KeycloakService,private userService:UserService) {
|
public constructor(
|
||||||
this.router.events.pipe(
|
public loadingService: LoadingService,
|
||||||
filter(event => event instanceof NavigationEnd)
|
private router: Router,
|
||||||
).subscribe(() => {
|
private activatedRoute: ActivatedRoute,
|
||||||
|
private keycloakService: KeycloakService,
|
||||||
|
private userService: UserService,
|
||||||
|
private confirmationService: ConfirmationService,
|
||||||
|
) {
|
||||||
|
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
|
||||||
let currentRoute = this.activatedRoute.root;
|
let currentRoute = this.activatedRoute.root;
|
||||||
while (currentRoute.children[0] !== undefined) {
|
while (currentRoute.children[0] !== undefined) {
|
||||||
currentRoute = currentRoute.children[0];
|
currentRoute = currentRoute.children[0];
|
||||||
}
|
}
|
||||||
// Hier haben Sie Zugriff auf den aktuellen Route-Pfad
|
// Hier haben Sie Zugriff auf den aktuellen Route-Pfad
|
||||||
this.actualRoute=currentRoute.snapshot.url[0].path
|
this.actualRoute = currentRoute.snapshot.url[0].path;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ngOnInit(){
|
ngOnInit() {}
|
||||||
|
@HostListener('window:keydown', ['$event'])
|
||||||
|
handleKeyboardEvent(event: KeyboardEvent) {
|
||||||
|
if (event.shiftKey && event.ctrlKey && event.key === 'V') {
|
||||||
|
this.showVersionDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showVersionDialog() {
|
||||||
|
this.confirmationService.confirm({
|
||||||
|
target: event.target as EventTarget,
|
||||||
|
message: `App Version: ${this.build.timestamp}`,
|
||||||
|
header: 'Version Info',
|
||||||
|
icon: 'pi pi-info-circle',
|
||||||
|
accept: () => {},
|
||||||
|
reject: () => {},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
import { APP_INITIALIZER, ApplicationConfig, LOCALE_ID, importProvidersFrom } from '@angular/core';
|
import { APP_INITIALIZER, ApplicationConfig } from '@angular/core';
|
||||||
import { provideRouter } from '@angular/router';
|
import { provideRouter, withEnabledBlockingInitialNavigation, withInMemoryScrolling } from '@angular/router';
|
||||||
|
|
||||||
import { routes } from './app.routes';
|
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||||
import { provideClientHydration } from '@angular/platform-browser';
|
|
||||||
import { provideAnimations } from '@angular/platform-browser/animations';
|
import { provideAnimations } from '@angular/platform-browser/animations';
|
||||||
import { HTTP_INTERCEPTORS, provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi } from '@angular/common/http';
|
import { KeycloakBearerInterceptor, KeycloakService } from 'keycloak-angular';
|
||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
import { SelectOptionsService } from './services/select-options.service';
|
import { customKeycloakAdapter } from '../keycloak';
|
||||||
import { KeycloakService } from './services/keycloak.service';
|
import { routes } from './app.routes';
|
||||||
import { UserService } from './services/user.service';
|
|
||||||
import { LoadingInterceptor } from './interceptors/loading.interceptor';
|
import { LoadingInterceptor } from './interceptors/loading.interceptor';
|
||||||
|
import { KeycloakInitializerService } from './services/keycloak-initializer.service';
|
||||||
|
import { SelectOptionsService } from './services/select-options.service';
|
||||||
|
import { createLogger } from './utils/utils';
|
||||||
// provideClientHydration()
|
// provideClientHydration()
|
||||||
|
const logger = createLogger('ApplicationConfig');
|
||||||
export const appConfig: ApplicationConfig = {
|
export const appConfig: ApplicationConfig = {
|
||||||
providers: [
|
providers: [
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
{provide:KeycloakService},
|
{ provide: KeycloakService },
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: initializeKeycloak,
|
// useFactory: initializeKeycloak,
|
||||||
|
//useFactory: initializeKeycloak,
|
||||||
|
useFactory: initializeKeycloak3,
|
||||||
multi: true,
|
multi: true,
|
||||||
deps: [KeycloakService],
|
//deps: [KeycloakService],
|
||||||
|
deps: [KeycloakInitializerService],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
@@ -28,28 +33,58 @@ export const appConfig: ApplicationConfig = {
|
|||||||
deps: [SelectOptionsService],
|
deps: [SelectOptionsService],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide:HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass:LoadingInterceptor,
|
useClass: LoadingInterceptor,
|
||||||
multi:true
|
multi: true,
|
||||||
},
|
},
|
||||||
provideRouter(routes),provideAnimations(),
|
{
|
||||||
// {provide: LOCALE_ID, useValue: 'en-US' }
|
provide: HTTP_INTERCEPTORS,
|
||||||
]
|
useClass: KeycloakBearerInterceptor,
|
||||||
|
multi: true,
|
||||||
|
},
|
||||||
|
provideRouter(
|
||||||
|
routes,
|
||||||
|
withEnabledBlockingInitialNavigation(),
|
||||||
|
withInMemoryScrolling({
|
||||||
|
scrollPositionRestoration: 'enabled',
|
||||||
|
anchorScrolling: 'enabled',
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
provideAnimations(),
|
||||||
|
],
|
||||||
};
|
};
|
||||||
function initUserService(userService:UserService) {
|
function initServices(selectOptions: SelectOptionsService) {
|
||||||
return () => {
|
return async () => {
|
||||||
//selectOptions.init();
|
await selectOptions.init();
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
function initServices(selectOptions:SelectOptionsService) {
|
export function initializeKeycloak3(keycloak: KeycloakInitializerService) {
|
||||||
return () => {
|
return () => keycloak.initialize();
|
||||||
selectOptions.init();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function initializeKeycloak2(keycloak: KeycloakService): () => Promise<void> {
|
||||||
|
return async () => {
|
||||||
|
const { url, realm, clientId } = environment.keycloak;
|
||||||
|
const adapter = customKeycloakAdapter(() => keycloak.getKeycloakInstance(), {});
|
||||||
|
if (window.location.search.length > 0) {
|
||||||
|
sessionStorage.setItem('SEARCH', window.location.search);
|
||||||
|
}
|
||||||
|
const { host, hostname, href, origin, pathname, port, protocol, search } = window.location;
|
||||||
|
await keycloak.init({
|
||||||
|
config: { url, realm, clientId },
|
||||||
|
initOptions: {
|
||||||
|
onLoad: 'check-sso',
|
||||||
|
silentCheckSsoRedirectUri: window.location.hostname === 'localhost' ? `${window.location.origin}/assets/silent-check-sso.html` : `${window.location.origin}/dealerweb/assets/silent-check-sso.html`,
|
||||||
|
adapter,
|
||||||
|
redirectUri: `${origin}${pathname}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
function initializeKeycloak(keycloak: KeycloakService) {
|
function initializeKeycloak(keycloak: KeycloakService) {
|
||||||
return () =>
|
return async () => {
|
||||||
keycloak.init({
|
logger.info(`###>calling keycloakService init ...`);
|
||||||
|
const authenticated = await keycloak.init({
|
||||||
config: {
|
config: {
|
||||||
url: environment.keycloak.url,
|
url: environment.keycloak.url,
|
||||||
realm: environment.keycloak.realm,
|
realm: environment.keycloak.realm,
|
||||||
@@ -57,7 +92,13 @@ function initializeKeycloak(keycloak: KeycloakService) {
|
|||||||
},
|
},
|
||||||
initOptions: {
|
initOptions: {
|
||||||
onLoad: 'check-sso',
|
onLoad: 'check-sso',
|
||||||
silentCheckSsoRedirectUri: (<any>window).location.origin + '/assets/silent-check-sso.html'
|
silentCheckSsoRedirectUri: (<any>window).location.origin + '/assets/silent-check-sso.html',
|
||||||
|
},
|
||||||
|
bearerExcludedUrls: ['/assets'],
|
||||||
|
shouldUpdateToken(request) {
|
||||||
|
return !request.headers.get('token-update') === false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
logger.info(`+++>${authenticated}`);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
import { LogoutComponent } from './components/logout/logout.component';
|
import { LogoutComponent } from './components/logout/logout.component';
|
||||||
import { authGuard } from './guards/auth.guard';
|
import { NotFoundComponent } from './components/not-found/not-found.component';
|
||||||
|
|
||||||
|
import { AuthGuard } from './guards/auth.guard';
|
||||||
|
import { ListingCategoryGuard } from './guards/listing-category.guard';
|
||||||
import { DetailsBusinessListingComponent } from './pages/details/details-business-listing/details-business-listing.component';
|
import { DetailsBusinessListingComponent } from './pages/details/details-business-listing/details-business-listing.component';
|
||||||
import { DetailsCommercialPropertyListingComponent } from './pages/details/details-commercial-property-listing/details-commercial-property-listing.component';
|
import { DetailsCommercialPropertyListingComponent } from './pages/details/details-commercial-property-listing/details-commercial-property-listing.component';
|
||||||
import { DetailsUserComponent } from './pages/details/details-user/details-user.component';
|
import { DetailsUserComponent } from './pages/details/details-user/details-user.component';
|
||||||
@@ -46,6 +49,11 @@ export const routes: Routes = [
|
|||||||
path: 'details-commercial-property-listing/:id',
|
path: 'details-commercial-property-listing/:id',
|
||||||
component: DetailsCommercialPropertyListingComponent,
|
component: DetailsCommercialPropertyListingComponent,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'listing/:id',
|
||||||
|
canActivate: [ListingCategoryGuard],
|
||||||
|
component: NotFoundComponent, // Dummy-Komponente, wird nie angezeigt, da der Guard weiterleitet
|
||||||
|
},
|
||||||
// #########
|
// #########
|
||||||
// User Details
|
// User Details
|
||||||
{
|
{
|
||||||
@@ -57,57 +65,62 @@ export const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'account',
|
path: 'account',
|
||||||
component: AccountComponent,
|
component: AccountComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'account/:id',
|
||||||
|
component: AccountComponent,
|
||||||
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
// #########
|
// #########
|
||||||
// Create, Update Listings
|
// Create, Update Listings
|
||||||
{
|
{
|
||||||
path: 'editBusinessListing/:id',
|
path: 'editBusinessListing/:id',
|
||||||
component: EditBusinessListingComponent,
|
component: EditBusinessListingComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'createBusinessListing',
|
path: 'createBusinessListing',
|
||||||
component: EditBusinessListingComponent,
|
component: EditBusinessListingComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'editCommercialPropertyListing/:id',
|
path: 'editCommercialPropertyListing/:id',
|
||||||
component: EditCommercialPropertyListingComponent,
|
component: EditCommercialPropertyListingComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'createCommercialPropertyListing',
|
path: 'createCommercialPropertyListing',
|
||||||
component: EditCommercialPropertyListingComponent,
|
component: EditCommercialPropertyListingComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
// #########
|
// #########
|
||||||
// My Listings
|
// My Listings
|
||||||
{
|
{
|
||||||
path: 'myListings',
|
path: 'myListings',
|
||||||
component: MyListingComponent,
|
component: MyListingComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
// #########
|
// #########
|
||||||
// My Favorites
|
// My Favorites
|
||||||
{
|
{
|
||||||
path: 'myFavorites',
|
path: 'myFavorites',
|
||||||
component: FavoritesComponent,
|
component: FavoritesComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
// #########
|
// #########
|
||||||
// EMAil Us
|
// EMAil Us
|
||||||
{
|
{
|
||||||
path: 'emailUs',
|
path: 'emailUs',
|
||||||
component: EmailUsComponent,
|
component: EmailUsComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
// #########
|
// #########
|
||||||
// Logout
|
// Logout
|
||||||
{
|
{
|
||||||
path: 'logout',
|
path: 'logout',
|
||||||
component: LogoutComponent,
|
component: LogoutComponent,
|
||||||
canActivate: [authGuard],
|
canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
// #########
|
// #########
|
||||||
// Pricing
|
// Pricing
|
||||||
|
|||||||
@@ -1,26 +1,502 @@
|
|||||||
<div class="surface-0 px-4 py-4 md:px-6 lg:px-8">
|
<div class="surface-0 px-4 py-4 md:px-6 lg:px-8">
|
||||||
<div class="surface-0">
|
<div class="surface-0">
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="col-12 md:col-3 md:mb-0 mb-3">
|
<div class="col-12 md:col-3 md:mb-0 mb-3 cursor-pointer" routerLink="/home">
|
||||||
<img src="assets/images/header-logo.png" alt="footer sections" height="30" class="mr-3" />
|
<img src="assets/images/header-logo.png" alt="footer sections" height="30" class="mr-3" />
|
||||||
<div class="text-500">© 2024 Bizmatch All rights reserved.</div>
|
<div class="text-500">© 2024 Bizmatch All rights reserved.</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 md:col-3">
|
<div class="col-12 md:col-3">
|
||||||
<div class="text-black mb-4 flex flex-wrap" style="max-width: 290px">BizMatch, Inc., 1001 Blucher Street, Corpus Christi, Texas 78401</div>
|
<div class="text-black mb-4 flex flex-wrap" style="max-width: 290px">BizMatch, Inc., 1001 Blucher Street, Corpus Christi, Texas 78401</div>
|
||||||
<div class="text-black mb-3"><i class="text-white pi pi-phone surface-800 border-round p-1 mr-2"></i>1-800-840-6025</div>
|
<div class="text-black mb-3"><i class="text-white pi pi-phone surface-800 border-round p-1 mr-2"></i>1-800-840-6025</div>
|
||||||
<div class="text-black mb-3"><i class="text-white pi pi-inbox surface-800 border-round p-1 mr-2"></i>bizmatch@biz-match.com</div>
|
<div class="text-black mb-3"><i class="text-white pi pi-inbox surface-800 border-round p-1 mr-2"></i>info@bizmatch.net</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 md:col-3 text-500">
|
<div class="col-12 md:col-3 text-500">
|
||||||
<div class="text-black font-bold line-height-3 mb-3">Legal</div>
|
<div class="text-black font-bold line-height-3 mb-3">Legal</div>
|
||||||
<a class="line-height-3 block cursor-pointer mb-2">Terms of use</a>
|
<a class="line-height-3 block cursor-pointer mb-2" (click)="termsVisible = true">Terms of use</a>
|
||||||
<a class="line-height-3 block cursor-pointer mb-2">Privacy statement</a>
|
<a class="line-height-3 block cursor-pointer mb-2" (click)="privacyVisible = true">Privacy statement</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 md:col-3 text-500">
|
<div class="col-12 md:col-3 text-500">
|
||||||
<div class="text-black font-bold line-height-3 mb-3">Actions</div>
|
<div class="text-black font-bold line-height-3 mb-3">Actions</div>
|
||||||
<a *ngIf="!userService.isLoggedIn()" (click)="login()" class="text-500 line-height-3 block cursor-pointer mb-2 no-underline">Login</a>
|
<a *ngIf="!keycloakService.isLoggedIn()" (click)="login()" class="text-500 line-height-3 block cursor-pointer mb-2 no-underline">Login</a>
|
||||||
<a *ngIf="userService.isLoggedIn()" [routerLink]="['/account']" class="text-500 line-height-3 block cursor-pointer mb-2 no-underline">Account</a>
|
<a *ngIf="!keycloakService.isLoggedIn()" (click)="register()" class="text-500 line-height-3 block cursor-pointer mb-2 no-underline">Register</a>
|
||||||
<a *ngIf="userService.isLoggedIn()" class="text-500 line-height-3 block cursor-pointer mb-2 no-underline" (click)="userService.logout()">Log Out</a>
|
<a *ngIf="keycloakService.isLoggedIn()" [routerLink]="['/account']" class="text-500 line-height-3 block cursor-pointer mb-2 no-underline">Account</a>
|
||||||
|
<a *ngIf="keycloakService.isLoggedIn()" class="text-500 line-height-3 block cursor-pointer mb-2 no-underline" (click)="keycloakService.logout()">Log Out</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p-sidebar [(visible)]="privacyVisible" styleClass="w-30rem" position="right">
|
||||||
|
<ng-template pTemplate="header">
|
||||||
|
<span class="font-semibold text-xl">Privacy Statement</span>
|
||||||
|
</ng-template>
|
||||||
|
<section id="content" role="main">
|
||||||
|
<article id="post-2" class="post-2 page type-page status-publish hentry pmpro-has-access">
|
||||||
|
<section class="entry-content">
|
||||||
|
<div class="container" style="padding: 3.5% 0 3.75% 0 !important">
|
||||||
|
<p>
|
||||||
|
<strong>Privacy Policy</strong><br />
|
||||||
|
We are committed to protecting your privacy. We have established this statement as a testament to our commitment to your privacy.
|
||||||
|
</p>
|
||||||
|
<p>This Privacy Policy relates to the use of any personal information you provide to us through this websites.</p>
|
||||||
|
<p>
|
||||||
|
By accepting the Privacy Policy during registration or the sending of an enquiry, you expressly consent to our collection, storage, use and disclosure of your personal information as described in this Privacy
|
||||||
|
Policy.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We may update our Privacy Policy from time to time. Our Privacy Policy was last updated in Febuary 2018 and is effective upon acceptance for new users. By continuing to use our websites or otherwise
|
||||||
|
continuing to deal with us, you accept this Privacy Policy.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Collection of personal information</strong><br />
|
||||||
|
Anyone can browse our websites without revealing any personally identifiable information.
|
||||||
|
</p>
|
||||||
|
<p>However, should you wish to contact a business for sale, a franchise opportunity or an intermediary, we will require you to provide some personal information.</p>
|
||||||
|
<p>Should you wish to advertise your services, your business (es) or your franchise opportunity, we will require you to provide some personal information.</p>
|
||||||
|
<p>By providing personal information, you are consenting to the transfer and storage of that information on our servers located in the United States.</p>
|
||||||
|
<p>We may collect and store the following personal information:</p>
|
||||||
|
<p>
|
||||||
|
Your name, email address, physical address, telephone numbers, and (depending on the service used), your business information, financial information, such as credit / payment card details;<br />
|
||||||
|
transactional information based on your activities on the site; information that you disclose in a forum on any of our websites, feedback, correspondence through our websites, and correspondence sent to
|
||||||
|
us;<br />
|
||||||
|
other information from your interaction with our websites, services, content and advertising, including computer and connection information, statistics on page views, traffic to and from the sites, ad data,
|
||||||
|
IP address and standard web log information;<br />
|
||||||
|
supplemental information from third parties (for example, if you incur a debt, we will generally conduct a credit check by obtaining additional information about you from a credit bureau, as permitted by law;
|
||||||
|
or if the information you provide cannot be verified,<br />
|
||||||
|
we may ask you to send us additional information, or to answer additional questions online to help verify your information).
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>How we use your information</strong><br />
|
||||||
|
The primary reason we collect your personal information is to improve the services we deliver to you through our website. By registering or sending an enquiry through our website, you agree that we may use
|
||||||
|
your personal information to:<br />
|
||||||
|
provide the services and customer support you request;<br />
|
||||||
|
connect you with relevant parties:<br />
|
||||||
|
If you are a buyer we will pass some or all of your details on to the seller / intermediary along with any message you have typed. This allows the seller to contact you in order to pursue a possible sale of a
|
||||||
|
business;<br />
|
||||||
|
If you are a seller / intermediary, we will disclose your details where you have given us permission to do so;<br />
|
||||||
|
resolve disputes, collect fees, and troubleshoot problems;<br />
|
||||||
|
prevent potentially prohibited or illegal activities, and enforce our Terms and Conditions;<br />
|
||||||
|
customize, measure and improve our services, conduct internal market research, provide content and advertising;<br />
|
||||||
|
tell you about other Biz-Match products and services, target marketing, send you service updates, and promotional offers based on your communication preferences.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Our disclosure of your information</strong><br />
|
||||||
|
We may disclose personal information to respond to legal requirements, enforce our policies, respond to claims that a listing or other content infringes the rights of others, or protect anyone’s rights,
|
||||||
|
property, or safety.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We may also share your personal information with<br />
|
||||||
|
When you select to register an account as a business buyer, you provide your personal details and we will pass this on to a seller of a business or franchise when you request more information.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
When you select to register an account as a business broker or seller on the site, we provide a public platform on which to establish your business profile. This profile consists of pertinent facts about your
|
||||||
|
business along with your personal information; namely, the contact information you provide to facilitate contact between you and other users’ of the site. Direct email addresses and telephone numbers will not
|
||||||
|
be publicly displayed unless you specifically include it on your profile.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The information a user includes within the forums provided on the site is publicly available to other users’ of the site. Please be aware that any personal information you elect to provide in a public forum
|
||||||
|
may be used to send you unsolicited messages; we are not responsible for the personal information a user elects to disclose within their public profile, or in the private communications that users’ engage in
|
||||||
|
on the site.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We post testimonials on the site obtained from users’. These testimonials may include the name, city, state or region and business of the user. We obtain permission from our users’ prior to posting their
|
||||||
|
testimonials on the site. We are not responsible for any personal information a user selects to include within their testimonial.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
When you elect to email a friend about the site, or a particular business, we request the third party’s email address to send this one time email. We do not share this information with any third parties for
|
||||||
|
their promotional purposes and only store the information to gauge the effectiveness of our referral program.
|
||||||
|
</p>
|
||||||
|
<p>We may share your personal information with our service providers where necessary. We employ the services of a payment processor to fulfil payment for services purchased on the site.</p>
|
||||||
|
<p>
|
||||||
|
We works with a number of partners or affiliates, where we provide marketing services for these companies. These third party agents collect your personal information to facilitate your service request and the
|
||||||
|
information submitted here is governed by their privacy policy.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Masking Policy</strong><br />
|
||||||
|
In some cases, where the third party agent collects your information, the affiliate portal may appear within a BizMatch.net frame. It is presented as a BizMatch.net page for a streamlined user interface
|
||||||
|
however the data collected on such pages is governed by the third party agent’s privacy policy.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Legal Disclosure</strong><br />
|
||||||
|
In certain circumstances, we may be legally required to disclose information collected on the site to law enforcement, government agencies or other third parties. We reserve the right to disclose information
|
||||||
|
to our service providers and to law enforcement or government agencies where a formal request such as in response to a court order, subpoena or judicial proceeding is made. Where we believe in good faith that
|
||||||
|
disclosure of information is necessary to prevent imminent physical or financial harm, or loss, or in protecting against illegal activity on the site, we reserve to disclose information.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Should the company undergo the merger, acquisition or sale of some or all of its assets, your personal information may likely be a part of the transferred assets. In such an event, your personal information
|
||||||
|
on the site, would be governed by this privacy statement; any changes to the privacy practices governing your information as a result of transfer would be relayed to you by means of a prominent notice on the
|
||||||
|
Site, or by email.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Using information from BizMatch.net website</strong><br />
|
||||||
|
In certain cases, (where you are receiving contact details of buyers interested in your business opportunity or a business opportunity you represent), you must comply with data protection laws, and give other
|
||||||
|
users a chance to remove themselves from your database and a chance to review what information you have collected about them.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>You agree to use BizMatch.net user information only for:</strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
BizMatch.net transaction-related purposes that are not unsolicited commercial messages;<br />
|
||||||
|
using services offered through BizMatch.net, or<br />
|
||||||
|
other purposes that a user expressly chooses.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Marketing</strong><br />
|
||||||
|
We do not sell or rent your personal information to third parties for their marketing purposes without your explicit consent. Where you explicitly express your consent at the point of collection to receive
|
||||||
|
offers from third party partners or affiliates, we will communicate to you on their behalf. We will not pass your information on.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You will receive email marketing communications from us throughout the duration of your relationship with our websites. If you do not wish to receive marketing communications from us you may unsubscribe and /
|
||||||
|
or change your preferences at any time by following instructions included within a communication or emailing Customer Services.
|
||||||
|
</p>
|
||||||
|
<p>If you have an account with one of our websites you can also log in and click the email preferences link to unsubscribe and / or change your preferences.</p>
|
||||||
|
<p>
|
||||||
|
Please note that we reserve the right to send all website users notifications and administrative emails where necessary which are considered a part of the service. Given that these messages aren’t promotional
|
||||||
|
in nature, you will be unable to opt-out of them.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Cookies</strong><br />
|
||||||
|
A cookie is a small text file written to your hard drive that contains information about you. Cookies do not contain any personal information about users. Once you close your browser or log out of the
|
||||||
|
website, the cookie simply terminates. We use cookies so that we can personalise your experience of our websites.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
If you set up your browser to reject the cookie, you may still use the website however; doing so may interfere with your use of some aspects of our websites. Some of our business partners use cookies on our
|
||||||
|
site (for example, advertisers). We have no access to or control over these cookies.
|
||||||
|
</p>
|
||||||
|
<p>For more information about how BizMatch.net uses cookies please read our Cookie Policy.</p>
|
||||||
|
<p>
|
||||||
|
<strong>Spam, spyware or spoofing</strong><br />
|
||||||
|
We and our users do not tolerate spam. Make sure to set your email preferences so we can communicate with you, as you prefer. Please add us to your safe senders list. To report spam or spoof emails, please
|
||||||
|
contact us using the contact information provided in the Contact Us section of this privacy statement.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You may not use our communication tools to send spam or otherwise send content that would breach our Terms and Conditions. We automatically scan and may manually filter messages to check for spam, viruses,
|
||||||
|
phishing attacks and other malicious activity or illegal or prohibited content. We may also store these messages for back up purposes only.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
If you send an email to an email address that is not registered in our community, we do not permanently store that email or use that email address for any marketing purpose. We do not rent or sell these email
|
||||||
|
addresses.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Account protection</strong><br />
|
||||||
|
Your password is the key to your account. Make sure this is stored safely. Use unique numbers, letters and special characters, and do not disclose your password to anyone. If you do share your password or
|
||||||
|
your personal information with others, remember that you are responsible for all actions taken in the name of your account. If you lose control of your password, you may lose substantial control over your
|
||||||
|
personal information and may be subject to legally binding actions taken on your behalf. Therefore, if your password has been compromised for any reason, you should immediately notify us and change your
|
||||||
|
password.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Accessing, reviewing and changing your personal information</strong><br />
|
||||||
|
You can view and amend your personal information at any time by logging in to your account online. You must promptly update your personal information if it changes or is inaccurate.
|
||||||
|
</p>
|
||||||
|
<p>If at any time you wish to close your account, please contact Customer Services and instruct us to do so. We will process your request as soon as we can.</p>
|
||||||
|
<p>You may also contact us at any time to find out what information we hold about you, what we do with it and ask us to update it for you.</p>
|
||||||
|
<p>
|
||||||
|
We do retain personal information from closed accounts to comply with law, prevent fraud, collect any fees owed, resolve disputes, troubleshoot problems, assist with any investigations, enforce our Terms and
|
||||||
|
Conditions, and take other actions otherwise permitted by law.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Security</strong><br />
|
||||||
|
Your information is stored on our servers located in the USA. We treat data as an asset that must be protected and use a variety of tools (encryption, passwords, physical security, etc.) to protect your
|
||||||
|
personal information against unauthorized access and disclosure. However, no method of security is 100% effective and while we take every measure to protect your personal information, we make no guarantees of
|
||||||
|
its absolute security.
|
||||||
|
</p>
|
||||||
|
<p>We employ the use of SSL encryption during the transmission of sensitive data across our websites.</p>
|
||||||
|
<p>
|
||||||
|
<strong>Third parties</strong><br />
|
||||||
|
Except as otherwise expressly included in this Privacy Policy, this document addresses only the use and disclosure of information we collect from you. If you disclose your information to others, whether they
|
||||||
|
are buyers or sellers on our websites or other sites throughout the internet, different rules may apply to their use or disclosure of the information you disclose to them. Dynamis does not control the privacy
|
||||||
|
policies of third parties, and you are subject to the privacy policies of those third parties where applicable.
|
||||||
|
</p>
|
||||||
|
<p>We encourage you to ask questions before you disclose your personal information to others.</p>
|
||||||
|
<p>
|
||||||
|
<strong>General</strong><br />
|
||||||
|
We may change this Privacy Policy from time to time as we add new products and applications, as we improve our current offerings, and as technologies and laws change. You can determine when this Privacy
|
||||||
|
Policy was last revised by referring to the “Last Updated” legend at the top of this page.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Any changes will become effective upon our posting of the revised Privacy Policy on our affected websites. We will provide notice to you if these changes are material and, where required by applicable law, we
|
||||||
|
will obtain your consent. This notice may be provided by email, by posting notice of the changes on our affected websites or by other means, consistent with applicable laws.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Contact Us</strong><br />
|
||||||
|
If you have any questions or comments about our privacy policy, and you can’t find the answer to your question on our help pages, please contact us using this form or email support@bizmatch.net, or write
|
||||||
|
to us at BizMatch, 715 S. Tanahua, Corpus Christi, TX 78401.)
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
</p-sidebar>
|
||||||
|
|
||||||
|
<p-sidebar [(visible)]="termsVisible" styleClass="w-30rem" position="right">
|
||||||
|
<ng-template pTemplate="header">
|
||||||
|
<span class="font-semibold text-xl">Terms of use</span>
|
||||||
|
</ng-template>
|
||||||
|
<section id="content" role="main">
|
||||||
|
<article id="post-1" class="post-1 page type-page status-publish hentry pmpro-has-access">
|
||||||
|
<section class="entry-content">
|
||||||
|
<div class="container" style="padding: 3.5% 0 3.75% 0 !important">
|
||||||
|
<b><span>AGREEMENT BETWEEN USER AND BizMatch</span></b
|
||||||
|
><span
|
||||||
|
><p></p>
|
||||||
|
<p><span>The BizMatch Web Site is comprised of various Web pages operated by BizMatch.</span><span></span></p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>The BizMatch Web Site is offered to you conditioned on your acceptance without modification of the terms, conditions, and notices contained herein. Your use of the BizMatch Web Site constitutes your
|
||||||
|
agreement to all such terms, conditions, and notices.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b><span>MODIFICATION OF THESE TERMS OF USE</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>BizMatch reserves the right to change the terms, conditions, and notices under which the BizMatch Web Site is offered, including but not limited to the charges associated with the use of the BizMatch Web
|
||||||
|
Site.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b><span>LINKS TO THIRD PARTY SITES</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>The BizMatch Web Site may contain links to other Web Sites ("Linked Sites"). The Linked Sites are not under the control of BizMatch and BizMatch is not responsible for the contents of any Linked Site,
|
||||||
|
including without limitation any link contained in a Linked Site, or any changes or updates to a Linked Site. BizMatch is not responsible for webcasting or any other form of transmission received from any
|
||||||
|
Linked Site. BizMatch is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement by BizMatch of the site or any association with its operators.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b><span>NO UNLAWFUL OR PROHIBITED USE</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>As a condition of your use of the BizMatch Web Site, you warrant to BizMatch that you will not use the BizMatch Web Site for any purpose that is unlawful or prohibited by these terms, conditions, and
|
||||||
|
notices. You may not use the BizMatch Web Site in any manner which could damage, disable, overburden, or impair the BizMatch Web Site or interfere with any other party’s use and enjoyment of the BizMatch
|
||||||
|
Web Site. You may not obtain or attempt to obtain any materials or information through any means not intentionally made available or provided for through the BizMatch Web Sites.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b><span>USE OF COMMUNICATION SERVICES</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>The BizMatch Web Site may contain bulletin board services, chat areas, news groups, forums, communities, personal web pages, calendars, and/or other message or communication facilities designed to enable
|
||||||
|
you to communicate with the public at large or with a group (collectively, "Communication Services"), you agree to use the Communication Services only to post, send and receive messages and material that
|
||||||
|
are proper and related to the particular Communication Service. By way of example, and not as a limitation, you agree that when using a Communication Service, you will not:</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p> </p>
|
||||||
|
<p class="MsoNormal"><!--[if !supportLists]--></p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Defame, abuse, harass, stalk, threaten or otherwise violate the legal rights (such as rights of privacy and publicity) of others.</span><span></span>
|
||||||
|
</p>
|
||||||
|
<p> </p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Publish, post, upload, distribute or disseminate any inappropriate, profane, defamatory, infringing, obscene, indecent or unlawful topic, name, material or information.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span
|
||||||
|
>Upload files that contain software or other material protected by intellectual property laws (or by rights of privacy of publicity) unless you own or control the rights thereto or have received all
|
||||||
|
necessary consents.</span
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Upload files that contain viruses, corrupted files, or any other similar software or programs that may damage the operation of another’s computer.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Advertise or offer to sell or buy any goods or services for any business purpose, unless such Communication Service specifically allows such messages.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Conduct or forward surveys, contests, pyramid schemes or chain letters.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Download any file posted by another user of a Communication Service that you know, or reasonably should know, cannot be legally distributed in such manner.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span
|
||||||
|
>Falsify or delete any author attributions, legal or other proper notices or proprietary designations or labels of the origin or source of software or other material contained in a file that is
|
||||||
|
uploaded.</span
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Restrict or inhibit any other user from using and enjoying the Communication Services.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Violate any code of conduct or other guidelines which may be applicable for any particular Communication Service.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Harvest or otherwise collect information about others, including e-mail addresses, without their consent.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<!--[if !supportLists]--><span
|
||||||
|
><span>§<span> </span></span></span
|
||||||
|
><!--[endif]--><span>Violate any applicable laws or regulations.</span>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
<span
|
||||||
|
>BizMatch has no obligation to monitor the Communication Services. However, BizMatch reserves the right to review materials posted to a Communication Service and to remove any materials in its sole
|
||||||
|
discretion. BizMatch reserves the right to terminate your access to any or all of the Communication Services at any time without notice for any reason whatsoever.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>BizMatch reserves the right at all times to disclose any information as necessary to satisfy any applicable law, regulation, legal process or governmental request, or to edit, refuse to post or to remove
|
||||||
|
any information or materials, in whole or in part, in BizMatch’s sole discretion.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>Always use caution when giving out any personally identifying information about yourself or your children in any Communication Service. BizMatch does not control or endorse the content, messages or
|
||||||
|
information found in any Communication Service and, therefore, BizMatch specifically disclaims any liability with regard to the Communication Services and any actions resulting from your participation in
|
||||||
|
any Communication Service. Managers and hosts are not authorized BizMatch spokespersons, and their views do not necessarily reflect those of BizMatch.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>Materials uploaded to a Communication Service may be subject to posted limitations on usage, reproduction and/or dissemination. You are responsible for adhering to such limitations if you download the
|
||||||
|
materials.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b><span>MATERIALS PROVIDED TO BizMatch OR POSTED AT ANY BizMatch WEB SITE</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>BizMatch does not claim ownership of the materials you provide to BizMatch (including feedback and suggestions) or post, upload, input or submit to any BizMatch Web Site or its associated services
|
||||||
|
(collectively "Submissions"). However, by posting, uploading, inputting, providing or submitting your Submission you are granting BizMatch, its affiliated companies and necessary sublicensees permission
|
||||||
|
to use your Submission in connection with the operation of their Internet businesses including, without limitation, the rights to: copy, distribute, transmit, publicly display, publicly perform,
|
||||||
|
reproduce, edit, translate and reformat your Submission; and to publish your name in connection with your Submission.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>No compensation will be paid with respect to the use of your Submission, as provided herein. BizMatch is under no obligation to post or use any Submission you may provide and may remove any Submission at
|
||||||
|
any time in BizMatch’s sole discretion.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>By posting, uploading, inputting, providing or submitting your Submission you warrant and represent that you own or otherwise control all of the rights to your Submission as described in this section
|
||||||
|
including, without limitation, all the rights necessary for you to provide, post, upload, input or submit the Submissions.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b><span>LIABILITY DISCLAIMER</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>THE INFORMATION, SOFTWARE, PRODUCTS, AND SERVICES INCLUDED IN OR AVAILABLE THROUGH THE BizMatch WEB SITE MAY INCLUDE INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE
|
||||||
|
INFORMATION HEREIN. BizMatch AND/OR ITS SUPPLIERS MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE BizMatch WEB SITE AT ANY TIME. ADVICE RECEIVED VIA THE BizMatch WEB SITE SHOULD NOT BE RELIED UPON FOR
|
||||||
|
PERSONAL, MEDICAL, LEGAL OR FINANCIAL DECISIONS AND YOU SHOULD CONSULT AN APPROPRIATE PROFESSIONAL FOR SPECIFIC ADVICE TAILORED TO YOUR SITUATION.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>BizMatch AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, AVAILABILITY, TIMELINESS, AND ACCURACY OF THE INFORMATION, SOFTWARE, PRODUCTS, SERVICES AND RELATED GRAPHICS
|
||||||
|
CONTAINED ON THE BizMatch WEB SITE FOR ANY PURPOSE. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ALL SUCH INFORMATION, SOFTWARE, PRODUCTS, SERVICES AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT
|
||||||
|
WARRANTY OR CONDITION OF ANY KIND. BizMatch AND/OR ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION, SOFTWARE, PRODUCTS, SERVICES AND RELATED GRAPHICS, INCLUDING
|
||||||
|
ALL IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL BizMatch AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OR PERFORMANCE OF THE BizMatch WEB SITE, WITH THE DELAY OR INABILITY
|
||||||
|
TO USE THE BizMatch WEB SITE OR RELATED SERVICES, THE PROVISION OF OR FAILURE TO PROVIDE SERVICES, OR FOR ANY INFORMATION, SOFTWARE, PRODUCTS, SERVICES AND RELATED GRAPHICS OBTAINED THROUGH THE BizMatch
|
||||||
|
WEB SITE, OR OTHERWISE ARISING OUT OF THE USE OF THE BizMatch WEB SITE, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF BizMatch OR ANY OF ITS SUPPLIERS HAS BEEN
|
||||||
|
ADVISED OF THE POSSIBILITY OF DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY
|
||||||
|
TO YOU. IF YOU ARE DISSATISFIED WITH ANY PORTION OF THE BizMatch WEB SITE, OR WITH ANY OF THESE TERMS OF USE, YOUR SOLE AND EXCLUSIVE REMEDY IS TO DISCONTINUE USING THE BizMatch WEB SITE.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p><span>SERVICE CONTACT : info@bizmatch.net</span><span></span></p>
|
||||||
|
<p>
|
||||||
|
<b><span>TERMINATION/ACCESS RESTRICTION</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>BizMatch reserves the right, in its sole discretion, to terminate your access to the BizMatch Web Site and the related services or any portion thereof at any time, without notice. GENERAL To the maximum
|
||||||
|
extent permitted by law, this agreement is governed by the laws of the State of Washington, U.S.A. and you hereby consent to the exclusive jurisdiction and venue of courts in King County, Washington,
|
||||||
|
U.S.A. in all disputes arising out of or relating to the use of the BizMatch Web Site. Use of the BizMatch Web Site is unauthorized in any jurisdiction that does not give effect to all provisions of these
|
||||||
|
terms and conditions, including without limitation this paragraph. You agree that no joint venture, partnership, employment, or agency relationship exists between you and BizMatch as a result of this
|
||||||
|
agreement or use of the BizMatch Web Site. BizMatch’s performance of this agreement is subject to existing laws and legal process, and nothing contained in this agreement is in derogation of BizMatch’s
|
||||||
|
right to comply with governmental, court and law enforcement requests or requirements relating to your use of the BizMatch Web Site or information provided to or gathered by BizMatch with respect to such
|
||||||
|
use. If any part of this agreement is determined to be invalid or unenforceable pursuant to applicable law including, but not limited to, the warranty disclaimers and liability limitations set forth
|
||||||
|
above, then the invalid or unenforceable provision will be deemed superseded by a valid, enforceable provision that most closely matches the intent of the original provision and the remainder of the
|
||||||
|
agreement shall continue in effect. Unless otherwise specified herein, this agreement constitutes the entire agreement between the user and BizMatch with respect to the BizMatch Web Site and it supersedes
|
||||||
|
all prior or contemporaneous communications and proposals, whether electronic, oral or written, between the user and BizMatch with respect to the BizMatch Web Site. A printed version of this agreement and
|
||||||
|
of any notice given in electronic form shall be admissible in judicial or administrative proceedings based upon or relating to this agreement to the same extent an d subject to the same conditions as
|
||||||
|
other business documents and records originally generated and maintained in printed form. It is the express wish to the parties that this agreement and all related documents be drawn up in English.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b><span>COPYRIGHT AND TRADEMARK NOTICES:</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p><span>All contents of the BizMatch Web Site are: Copyright 2011 by Bizmatch Business Solutions and/or its suppliers. All rights reserved.</span><span></span></p>
|
||||||
|
<p>
|
||||||
|
<b><span>TRADEMARKS</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p><span>The names of actual companies and products mentioned herein may be the trademarks of their respective owners.</span><span></span></p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>The example companies, organizations, products, people and events depicted herein are fictitious. No association with any real company, organization, product, person, or event is intended or should be
|
||||||
|
inferred.</span
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p><span>Any rights not expressly granted herein are reserved.</span><span></span></p>
|
||||||
|
<p>
|
||||||
|
<b><span>NOTICES AND PROCEDURE FOR MAKING CLAIMS OF COPYRIGHT INFRINGEMENT</span></b
|
||||||
|
><span></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<span
|
||||||
|
>Pursuant to Title 17, United States Code, Section 512(c)(2), notifications of claimed copyright infringement under United States copyright law should be sent to Service Provider’s Designated Agent. ALL
|
||||||
|
INQUIRIES NOT RELEVANT TO THE FOLLOWING PROCEDURE WILL RECEIVE NO RESPONSE. See Notice and Procedure for Making Claims of Copyright Infringement.</span
|
||||||
|
><span
|
||||||
|
><br />
|
||||||
|
<!--[if !supportLineBreakNewLine]--></span
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
<p class="MsoNormal"> </p>
|
||||||
|
<p class="MsoNormal">
|
||||||
|
We reserve the right to update or revise these Terms of Use at any time without notice. Please check the Terms of Use periodically for changes. The revised terms will be effective immediately as
|
||||||
|
soon as they are posted on the WebSite and by continuing to use the Site you agree to be bound by the revised terms<span
|
||||||
|
><br />
|
||||||
|
<!--[endif]--></span
|
||||||
|
>
|
||||||
|
</p></span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
</p-sidebar>
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ButtonModule } from 'primeng/button';
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { CheckboxModule } from 'primeng/checkbox';
|
import { SidebarModule } from 'primeng/sidebar';
|
||||||
import { InputTextModule } from 'primeng/inputtext';
|
|
||||||
import {StyleClassModule} from 'primeng/styleclass';
|
|
||||||
import { DropdownModule } from 'primeng/dropdown';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
import { UserService } from '../../services/user.service';
|
|
||||||
import { SharedModule } from '../../shared/shared/shared.module';
|
import { SharedModule } from '../../shared/shared/shared.module';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'footer',
|
selector: 'footer',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [SharedModule],
|
imports: [SharedModule, SidebarModule],
|
||||||
templateUrl: './footer.component.html',
|
templateUrl: './footer.component.html',
|
||||||
styleUrl: './footer.component.scss'
|
styleUrl: './footer.component.scss',
|
||||||
})
|
})
|
||||||
export class FooterComponent {
|
export class FooterComponent {
|
||||||
constructor(public userService:UserService){}
|
privacyVisible = false;
|
||||||
login(){
|
termsVisible = false;
|
||||||
this.userService.login(window.location.href);
|
constructor(public keycloakService: KeycloakService) {}
|
||||||
|
login() {
|
||||||
|
this.keycloakService.login({
|
||||||
|
redirectUri: window.location.href,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
register() {
|
||||||
|
this.keycloakService.register({ redirectUri: `${window.location.origin}/account` });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="pl-3 flex align-items-center gap-2">
|
<div class="pl-3 flex align-items-center gap-2">
|
||||||
<a routerLink="/home"><img src="assets/images/header-logo.png" height="40" alt="bizmatch" /></a>
|
<a routerLink="/home"><img src="assets/images/header-logo.png" height="40" alt="bizmatch" /></a>
|
||||||
<p-tabMenu [model]="tabItems" ariaLabelledBy="label" styleClass="flex" [activeItem]="activeItem">
|
<p-tabMenu [model]="tabItems" ariaLabelledBy="label" styleClass="flex" [activeItem]="activeItem"> </p-tabMenu>
|
||||||
</p-tabMenu>
|
|
||||||
<p-menubar [model]="menuItems"></p-menubar>
|
<p-menubar [model]="menuItems"></p-menubar>
|
||||||
<div *ngIf="user$ | async as user else empty">Welcome, {{user.firstname}}</div>
|
<p-menubar [model]="loginItems"></p-menubar>
|
||||||
<ng-template #empty>
|
@if(user){
|
||||||
</ng-template>
|
<div>Welcome, {{ user.firstName }}</div>
|
||||||
|
}
|
||||||
|
<ng-template #empty> </ng-template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2,15 +2,16 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { faUserGear } from '@fortawesome/free-solid-svg-icons';
|
import { faUserGear } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { MenuItem } from 'primeng/api';
|
import { MenuItem } from 'primeng/api';
|
||||||
import { ButtonModule } from 'primeng/button';
|
import { ButtonModule } from 'primeng/button';
|
||||||
import { MenubarModule } from 'primeng/menubar';
|
import { MenubarModule } from 'primeng/menubar';
|
||||||
import { OverlayPanelModule } from 'primeng/overlaypanel';
|
import { OverlayPanelModule } from 'primeng/overlaypanel';
|
||||||
import { TabMenuModule } from 'primeng/tabmenu';
|
import { TabMenuModule } from 'primeng/tabmenu';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { User } from '../../../../../bizmatch-server/src/models/db.model';
|
import { KeycloakUser } from '../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
import { UserService } from '../../services/user.service';
|
import { map2User } from '../../utils/utils';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'header',
|
selector: 'header',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -20,18 +21,21 @@ import { UserService } from '../../services/user.service';
|
|||||||
})
|
})
|
||||||
export class HeaderComponent {
|
export class HeaderComponent {
|
||||||
public buildVersion = environment.buildVersion;
|
public buildVersion = environment.buildVersion;
|
||||||
user$: Observable<User>;
|
user$: Observable<KeycloakUser>;
|
||||||
user: User;
|
user: KeycloakUser;
|
||||||
public tabItems: MenuItem[];
|
public tabItems: MenuItem[];
|
||||||
|
public loginItems: MenuItem[];
|
||||||
public menuItems: MenuItem[];
|
public menuItems: MenuItem[];
|
||||||
activeItem;
|
activeItem;
|
||||||
faUserGear = faUserGear;
|
faUserGear = faUserGear;
|
||||||
constructor(public userService: UserService, private router: Router) {}
|
constructor(public keycloakService: KeycloakService, private router: Router) {}
|
||||||
|
|
||||||
ngOnInit() {
|
async ngOnInit() {
|
||||||
this.user$ = this.userService.getUserObservable();
|
const token = await this.keycloakService.getToken();
|
||||||
this.user$.subscribe(u => {
|
this.user = map2User(token);
|
||||||
this.user = u;
|
//this.user$ = this.keycloakService
|
||||||
|
// this.user$.subscribe(u => {
|
||||||
|
// this.user = u;
|
||||||
this.menuItems = [
|
this.menuItems = [
|
||||||
{
|
{
|
||||||
label: 'User Actions',
|
label: 'User Actions',
|
||||||
@@ -41,48 +45,48 @@ export class HeaderComponent {
|
|||||||
label: 'Account',
|
label: 'Account',
|
||||||
icon: 'pi pi-user',
|
icon: 'pi pi-user',
|
||||||
routerLink: `/account`,
|
routerLink: `/account`,
|
||||||
visible: this.isUserLogedIn(),
|
visible: this.keycloakService.isLoggedIn(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Create Listing',
|
label: 'Create Listing',
|
||||||
icon: 'pi pi-plus-circle',
|
icon: 'pi pi-plus-circle',
|
||||||
routerLink: '/createBusinessListing',
|
routerLink: '/createBusinessListing',
|
||||||
visible: this.isUserLogedIn(),
|
visible: this.keycloakService.isLoggedIn(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'My Listings',
|
label: 'My Listings',
|
||||||
icon: 'pi pi-list',
|
icon: 'pi pi-list',
|
||||||
routerLink: '/myListings',
|
routerLink: '/myListings',
|
||||||
visible: this.isUserLogedIn(),
|
visible: this.keycloakService.isLoggedIn(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'My Favorites',
|
label: 'My Favorites',
|
||||||
icon: 'pi pi-star',
|
icon: 'pi pi-star',
|
||||||
routerLink: '/myFavorites',
|
routerLink: '/myFavorites',
|
||||||
visible: this.isUserLogedIn(),
|
visible: this.keycloakService.isLoggedIn(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'EMail Us',
|
label: 'EMail Us',
|
||||||
icon: 'fa-regular fa-envelope',
|
icon: 'fa-regular fa-envelope',
|
||||||
routerLink: '/emailUs',
|
routerLink: '/emailUs',
|
||||||
visible: this.isUserLogedIn(),
|
visible: this.keycloakService.isLoggedIn(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Logout',
|
label: 'Logout',
|
||||||
icon: 'fa-solid fa-right-from-bracket',
|
icon: 'fa-solid fa-right-from-bracket',
|
||||||
routerLink: '/logout',
|
routerLink: '/logout',
|
||||||
visible: this.isUserLogedIn(),
|
visible: this.keycloakService.isLoggedIn(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Login',
|
label: 'Login',
|
||||||
icon: 'fa-solid fa-right-from-bracket',
|
icon: 'fa-solid fa-right-from-bracket',
|
||||||
command: () => this.login(),
|
command: () => this.login(),
|
||||||
visible: !this.isUserLogedIn(),
|
visible: !this.keycloakService.isLoggedIn(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
});
|
// });
|
||||||
this.tabItems = [
|
this.tabItems = [
|
||||||
{
|
{
|
||||||
label: 'Businesses for Sale',
|
label: 'Businesses for Sale',
|
||||||
@@ -100,16 +104,30 @@ export class HeaderComponent {
|
|||||||
state: {},
|
state: {},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
this.loginItems = [
|
||||||
|
{
|
||||||
|
label: 'Login',
|
||||||
|
command: () => this.login(),
|
||||||
|
visible: !this.keycloakService.isLoggedIn(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Register',
|
||||||
|
command: () => this.register(),
|
||||||
|
visible: !this.keycloakService.isLoggedIn(),
|
||||||
|
},
|
||||||
|
];
|
||||||
this.activeItem = this.tabItems[0];
|
this.activeItem = this.tabItems[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateWithState(dest: string, state: any) {
|
navigateWithState(dest: string, state: any) {
|
||||||
this.router.navigate([dest], { state: state });
|
this.router.navigate([dest], { state: state });
|
||||||
}
|
}
|
||||||
isUserLogedIn() {
|
|
||||||
return this.userService?.isLoggedIn();
|
|
||||||
}
|
|
||||||
login() {
|
login() {
|
||||||
this.userService.login(window.location.href);
|
this.keycloakService.login({
|
||||||
|
redirectUri: window.location.href,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
register() {
|
||||||
|
this.keycloakService.register({ redirectUri: `${window.location.origin}/account` });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
<div class="flex justify-content-between mt-3">
|
<div class="flex justify-content-between mt-3">
|
||||||
@if(ratioVariable){
|
@if(ratioVariable){
|
||||||
<div>
|
<div>
|
||||||
<p-selectButton [options]="stateOptions" [ngModel]="value" (ngModelChange)="changeAspectRation($event)"
|
<p-selectButton [options]="stateOptions" [ngModel]="value" (ngModelChange)="changeAspectRation($event)" optionLabel="label" optionValue="value" class="small"></p-selectButton>
|
||||||
optionLabel="label" optionValue="value"></p-selectButton>
|
|
||||||
</div>
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
<div></div>
|
<div></div>
|
||||||
}
|
}
|
||||||
<div>
|
<div class="flex justify-content-between">
|
||||||
<p-button icon="pi" (click)="cancelUpload()" label="Cancel" [outlined]="true"></p-button>
|
<p-button icon="pi" (click)="cancelUpload()" label="Cancel" [outlined]="true" size="small" class="mr-2"></p-button>
|
||||||
<p-button icon="pi pi-check" (click)="sendImage()" label="Finish" pAutoFocus [autofocus]="true"></p-button>
|
<p-button icon="pi pi-check" (click)="sendImage()" label="Finish" pAutoFocus [autofocus]="true" size="small"></p-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
::ng-deep p-selectbutton.small .p-button {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
padding: 0.65625rem 1.09375rem;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,67 +1,52 @@
|
|||||||
import { Component, ViewChild } from '@angular/core';
|
import { Component, ViewChild } from '@angular/core';
|
||||||
import { AngularCropperjsModule, CropperComponent } from 'angular-cropperjs';
|
import { AngularCropperjsModule, CropperComponent } from 'angular-cropperjs';
|
||||||
import { LoadingService } from '../../services/loading.service';
|
|
||||||
import { ImageService } from '../../services/image.service';
|
|
||||||
import { HttpEventType } from '@angular/common/http';
|
|
||||||
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
|
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
|
||||||
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
||||||
import { environment } from '../../../environments/environment';
|
|
||||||
import { User } from '../../../../../bizmatch-server/src/models/db.model';
|
|
||||||
import { SharedModule } from '../../shared/shared/shared.module';
|
|
||||||
import { SelectButtonModule } from 'primeng/selectbutton';
|
import { SelectButtonModule } from 'primeng/selectbutton';
|
||||||
import { KeyValueRatio } from '../../../../../bizmatch-server/src/models/main.model';
|
import { KeyValueRatio } from '../../../../../bizmatch-server/src/models/main.model';
|
||||||
export const stateOptions:KeyValueRatio[]=[
|
import { ImageService } from '../../services/image.service';
|
||||||
{label:'16/9',value:16/9},
|
import { LoadingService } from '../../services/loading.service';
|
||||||
{label:'1/1',value:1},
|
import { SharedModule } from '../../shared/shared/shared.module';
|
||||||
{label:'2/3',value:2/3},
|
export const stateOptions: KeyValueRatio[] = [
|
||||||
]
|
{ label: '16/9', value: 16 / 9 },
|
||||||
|
{ label: '1/1', value: 1 },
|
||||||
|
{ label: 'Free', value: NaN },
|
||||||
|
];
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-image-cropper',
|
selector: 'app-image-cropper',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [SharedModule,FileUploadModule,AngularCropperjsModule,SelectButtonModule],
|
imports: [SharedModule, FileUploadModule, AngularCropperjsModule, SelectButtonModule],
|
||||||
templateUrl: './image-cropper.component.html',
|
templateUrl: './image-cropper.component.html',
|
||||||
styleUrl: './image-cropper.component.scss'
|
styleUrl: './image-cropper.component.scss',
|
||||||
})
|
})
|
||||||
export class ImageCropperComponent {
|
export class ImageCropperComponent {
|
||||||
@ViewChild(CropperComponent) public angularCropper: CropperComponent;
|
@ViewChild(CropperComponent) public angularCropper: CropperComponent;
|
||||||
imageUrl:string; //wird im Template verwendet
|
imageUrl: string; //wird im Template verwendet
|
||||||
fileUpload:FileUpload
|
fileUpload: FileUpload;
|
||||||
value:number = stateOptions[0].value;
|
value: number = stateOptions[0].value;
|
||||||
cropperConfig={aspectRatio: this.value}
|
cropperConfig = { aspectRatio: this.value };
|
||||||
ratioVariable:boolean
|
ratioVariable: boolean;
|
||||||
stateOptions=stateOptions
|
stateOptions = stateOptions;
|
||||||
constructor(
|
constructor(private loadingService: LoadingService, private imageUploadService: ImageService, public config: DynamicDialogConfig, public ref: DynamicDialogRef) {}
|
||||||
private loadingService:LoadingService,
|
|
||||||
private imageUploadService: ImageService,
|
|
||||||
public config: DynamicDialogConfig,
|
|
||||||
public ref: DynamicDialogRef
|
|
||||||
){}
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (this.config.data) {
|
if (this.config.data) {
|
||||||
this.imageUrl = this.config.data.imageUrl;
|
this.imageUrl = this.config.data.imageUrl;
|
||||||
this.fileUpload = this.config.data.fileUpload;
|
this.fileUpload = this.config.data.fileUpload;
|
||||||
this.cropperConfig = this.config.data.config ? this.config.data.config: this.cropperConfig;
|
this.cropperConfig = this.config.data.config ? this.config.data.config : this.cropperConfig;
|
||||||
this.ratioVariable = this.config.data.ratioVariable;
|
this.ratioVariable = this.config.data.ratioVariable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendImage(){
|
sendImage() {
|
||||||
// setTimeout(()=>{
|
this.fileUpload.clear();
|
||||||
// this.angularCropper.cropper.getCroppedCanvas().toBlob(async(blob) => {
|
|
||||||
// this.ref.close(blob);
|
|
||||||
// this.fileUpload.clear()
|
|
||||||
// }, 'image/jpg');
|
|
||||||
// },0)
|
|
||||||
|
|
||||||
this.fileUpload.clear()
|
|
||||||
this.ref.close(this.angularCropper.cropper);
|
this.ref.close(this.angularCropper.cropper);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelUpload(){
|
cancelUpload() {
|
||||||
this.fileUpload.clear();
|
this.fileUpload.clear();
|
||||||
this.ref.close();
|
this.ref.close();
|
||||||
}
|
}
|
||||||
changeAspectRation(ratio:number){
|
changeAspectRation(ratio: number) {
|
||||||
this.cropperConfig={aspectRatio: ratio}
|
this.cropperConfig = { aspectRatio: ratio };
|
||||||
this.angularCropper.cropper.setAspectRatio(ratio);
|
this.angularCropper.cropper.setAspectRatio(ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import { UserService } from '../../services/user.service';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { Component } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'logout',
|
selector: 'logout',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule,RouterModule],
|
imports: [CommonModule, RouterModule],
|
||||||
template:``
|
template: ``,
|
||||||
})
|
})
|
||||||
export class LogoutComponent {
|
export class LogoutComponent {
|
||||||
constructor(private userService:UserService){
|
constructor(public keycloakService: KeycloakService) {
|
||||||
userService.logout();
|
sessionStorage.removeItem('USERID');
|
||||||
|
keycloakService.logout(window.location.origin + '/home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<p>not-found works!</p>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-not-found',
|
||||||
|
standalone: true,
|
||||||
|
template: '<h2>Page not found</h2>',
|
||||||
|
})
|
||||||
|
export class NotFoundComponent {}
|
||||||
@@ -1,38 +1,42 @@
|
|||||||
import { CanMatchFn, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
import { Injectable } from '@angular/core';
|
||||||
import { inject } from '@angular/core';
|
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
||||||
|
import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular';
|
||||||
// Services
|
import { KeycloakInitializerService } from '../services/keycloak-initializer.service';
|
||||||
import { UserService } from '../services/user.service';
|
import { createLogger } from '../utils/utils';
|
||||||
|
const logger = createLogger('AuthGuard');
|
||||||
export const authGuard: CanMatchFn = async (route, segments): Promise<boolean | UrlTree> => {
|
@Injectable({
|
||||||
const router = inject(Router);
|
providedIn: 'root',
|
||||||
const userService = inject(UserService);
|
})
|
||||||
|
export class AuthGuard extends KeycloakAuthGuard {
|
||||||
const authenticated: boolean = userService.isLoggedIn();
|
constructor(protected override readonly router: Router, protected readonly keycloak: KeycloakService, private keycloakInitializer: KeycloakInitializerService) {
|
||||||
if (!authenticated) {
|
super(router, keycloak);
|
||||||
console.log(window.location.origin)
|
|
||||||
console.log(window.location.href)
|
|
||||||
await userService.login(`${window.location.origin}${segments['url']}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the user Keycloak roles and the required from the route
|
async isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {
|
||||||
const roles: string[] = userService.getUserRoles();//keycloakService.getUserRoles(true);
|
logger.info(`--->AuthGuard`);
|
||||||
const requiredRoles = route.data?.['roles'];
|
while (!this.keycloakInitializer.initialized) {
|
||||||
|
logger.info(`Waiting 100 msec`);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100));
|
||||||
|
}
|
||||||
|
// Force the user to log in if currently unauthenticated.
|
||||||
|
const authenticated = this.keycloak.isLoggedIn();
|
||||||
|
//this.keycloak.isTokenExpired()
|
||||||
|
if (!this.authenticated && !authenticated) {
|
||||||
|
await this.keycloak.login({
|
||||||
|
redirectUri: window.location.origin + state.url,
|
||||||
|
});
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Allow the user to proceed if no additional roles are required to access the route
|
// Get the roles required from the route.
|
||||||
|
const requiredRoles = route.data['roles'];
|
||||||
|
|
||||||
|
// Allow the user to proceed if no additional roles are required to access the route.
|
||||||
if (!Array.isArray(requiredRoles) || requiredRoles.length === 0) {
|
if (!Array.isArray(requiredRoles) || requiredRoles.length === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the user to proceed if ALL of the required roles are present
|
// Allow the user to proceed if all the required roles are present.
|
||||||
const authorized = requiredRoles.every((role) => roles.includes(role));
|
return requiredRoles.every(role => this.roles.includes(role));
|
||||||
// Allow the user to proceed if ONE of the required roles is present
|
|
||||||
//const authorized = requiredRoles.some((role) => roles.includes(role));
|
|
||||||
|
|
||||||
if (authorized) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Display my custom HTTP 403 access denied page
|
|
||||||
return router.createUrlTree(['/access']);
|
|
||||||
};
|
|
||||||
|
|||||||
35
bizmatch/src/app/guards/listing-category.guard.ts
Normal file
35
bizmatch/src/app/guards/listing-category.guard.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
||||||
|
import { Observable, of } from 'rxjs';
|
||||||
|
import { catchError, map } from 'rxjs/operators';
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class ListingCategoryGuard implements CanActivate {
|
||||||
|
private apiBaseUrl = environment.apiBaseUrl;
|
||||||
|
constructor(private http: HttpClient, private router: Router) {}
|
||||||
|
|
||||||
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> {
|
||||||
|
const id = route.paramMap.get('id');
|
||||||
|
const url = `${this.apiBaseUrl}/bizmatch/listings/undefined/${id}`;
|
||||||
|
|
||||||
|
return this.http.get<any>(url).pipe(
|
||||||
|
map(response => {
|
||||||
|
const category = response.listingsCategory;
|
||||||
|
if (category === 'business') {
|
||||||
|
return this.router.createUrlTree([`/details-business-listing/${id}`]);
|
||||||
|
} else if (category === 'commercialProperty') {
|
||||||
|
return this.router.createUrlTree([`/details-commercial-property-listing/${id}`]);
|
||||||
|
} else {
|
||||||
|
return this.router.createUrlTree(['/not-found']);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
catchError(() => {
|
||||||
|
return of(this.router.createUrlTree(['/not-found']));
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
import { Injectable, inject } from '@angular/core';
|
|
||||||
import {
|
|
||||||
HttpInterceptor,
|
|
||||||
HttpRequest,
|
|
||||||
HttpHandler,
|
|
||||||
HttpEvent,
|
|
||||||
HttpInterceptorFn,
|
|
||||||
HttpHandlerFn,
|
|
||||||
} from '@angular/common/http';
|
|
||||||
|
|
||||||
import { Observable, combineLatest, from, of } from 'rxjs';
|
|
||||||
import { mergeMap } from 'rxjs/operators';
|
|
||||||
|
|
||||||
import { KeycloakService } from '../services/keycloak.service';
|
|
||||||
import { ExcludedUrlRegex } from '../models/keycloak-options';
|
|
||||||
|
|
||||||
export const keycloakBearerInterceptor: HttpInterceptorFn = (req, next) => {
|
|
||||||
//return next(req);
|
|
||||||
const keycloak = inject(KeycloakService);
|
|
||||||
const { enableBearerInterceptor, excludedUrls } = keycloak;
|
|
||||||
if (!enableBearerInterceptor) {
|
|
||||||
return next(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
const shallPass: boolean =
|
|
||||||
!keycloak.shouldAddToken(req) ||
|
|
||||||
excludedUrls.findIndex((item) => isUrlExcluded(req, item)) > -1;
|
|
||||||
if (shallPass) {
|
|
||||||
return next(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
return combineLatest([
|
|
||||||
from(conditionallyUpdateToken(req)),
|
|
||||||
of(keycloak.isLoggedIn()),
|
|
||||||
]).pipe(
|
|
||||||
mergeMap(([_, isLoggedIn]) =>
|
|
||||||
isLoggedIn ? handleRequestWithTokenHeader(req, next) : next(req)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
function isUrlExcluded(
|
|
||||||
{ method, url }: HttpRequest<unknown>,
|
|
||||||
{ urlPattern, httpMethods }: ExcludedUrlRegex
|
|
||||||
): boolean {
|
|
||||||
const httpTest =
|
|
||||||
httpMethods.length === 0 ||
|
|
||||||
httpMethods.join().indexOf(method.toUpperCase()) > -1;
|
|
||||||
|
|
||||||
const urlTest = urlPattern.test(url);
|
|
||||||
|
|
||||||
return httpTest && urlTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleRequestWithTokenHeader(
|
|
||||||
req: HttpRequest<unknown>,
|
|
||||||
next: HttpHandlerFn
|
|
||||||
): Observable<HttpEvent<unknown>> {
|
|
||||||
return this.keycloak.addTokenToHeader(req.headers).pipe(
|
|
||||||
mergeMap((headersWithBearer:string) => {
|
|
||||||
const kcReq = req.clone({
|
|
||||||
headers: req.headers.set('Authorization', headersWithBearer)
|
|
||||||
});//req.clone({ headers: headersWithBearer });
|
|
||||||
return next(kcReq);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function conditionallyUpdateToken(
|
|
||||||
req: HttpRequest<unknown>
|
|
||||||
): Promise<boolean> {
|
|
||||||
if (this.keycloak.shouldUpdateToken(req)) {
|
|
||||||
return await this.keycloak.updateToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,22 @@
|
|||||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';
|
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, tap } from 'rxjs';
|
import { Observable, tap } from 'rxjs';
|
||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
import { LoadingService } from '../services/loading.service';
|
import { LoadingService } from '../services/loading.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LoadingInterceptor implements HttpInterceptor {
|
export class LoadingInterceptor implements HttpInterceptor {
|
||||||
constructor(private loadingService:LoadingService) { }
|
constructor(private loadingService: LoadingService) {}
|
||||||
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||||
console.log("Intercepting Requests")
|
|
||||||
const requestId = `HTTP-${v4()}`;
|
const requestId = `HTTP-${v4()}`;
|
||||||
this.loadingService.startLoading(requestId,request.url);
|
this.loadingService.startLoading(requestId, request.url);
|
||||||
|
|
||||||
// return next.handle(request);
|
|
||||||
return next.handle(request).pipe(
|
return next.handle(request).pipe(
|
||||||
tap({
|
tap({
|
||||||
finalize: () => this.loadingService.stopLoading(requestId), // Stoppt den Ladevorgang, wenn die Anfrage abgeschlossen ist
|
finalize: () => this.loadingService.stopLoading(requestId), // Stoppt den Ladevorgang, wenn die Anfrage abgeschlossen ist
|
||||||
// Beachte, dass 'error' und 'complete' hier entfernt wurden, da 'finalize' in allen Fällen aufgerufen wird,
|
// Beachte, dass 'error' und 'complete' hier entfernt wurden, da 'finalize' in allen Fällen aufgerufen wird,
|
||||||
// egal ob die Anfrage erfolgreich war, einen Fehler geworfen hat oder abgeschlossen wurde.
|
// egal ob die Anfrage erfolgreich war, einen Fehler geworfen hat oder abgeschlossen wurde.
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
export enum KeycloakEventType {
|
|
||||||
/**
|
|
||||||
* Called if there was an error during authentication.
|
|
||||||
*/
|
|
||||||
OnAuthError,
|
|
||||||
/**
|
|
||||||
* Called if the user is logged out
|
|
||||||
* (will only be called if the session status iframe is enabled, or in Cordova mode).
|
|
||||||
*/
|
|
||||||
OnAuthLogout,
|
|
||||||
/**
|
|
||||||
* Called if there was an error while trying to refresh the token.
|
|
||||||
*/
|
|
||||||
OnAuthRefreshError,
|
|
||||||
/**
|
|
||||||
* Called when the token is refreshed.
|
|
||||||
*/
|
|
||||||
OnAuthRefreshSuccess,
|
|
||||||
/**
|
|
||||||
* Called when a user is successfully authenticated.
|
|
||||||
*/
|
|
||||||
OnAuthSuccess,
|
|
||||||
/**
|
|
||||||
* Called when the adapter is initialized.
|
|
||||||
*/
|
|
||||||
OnReady,
|
|
||||||
/**
|
|
||||||
* Called when the access token is expired. If a refresh token is available the token
|
|
||||||
* can be refreshed with updateToken, or in cases where it is not (that is, with implicit flow)
|
|
||||||
* you can redirect to login screen to obtain a new access token.
|
|
||||||
*/
|
|
||||||
OnTokenExpired,
|
|
||||||
/**
|
|
||||||
* Called when a AIA has been requested by the application.
|
|
||||||
*/
|
|
||||||
OnActionUpdate
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Structure of an event triggered by Keycloak, contains it's type
|
|
||||||
* and arguments (if any).
|
|
||||||
*/
|
|
||||||
export interface KeycloakEvent {
|
|
||||||
/**
|
|
||||||
* Event type as described at {@link KeycloakEventType}.
|
|
||||||
*/
|
|
||||||
type: KeycloakEventType;
|
|
||||||
/**
|
|
||||||
* Arguments from the keycloak-js event function.
|
|
||||||
*/
|
|
||||||
args?: unknown;
|
|
||||||
}
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright Mauricio Gemelli Vigolo and contributors.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a MIT-style license that can be
|
|
||||||
* found in the LICENSE file at https://github.com/mauriciovigolo/keycloak-angular/blob/main/LICENSE.md
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { HttpRequest } from '@angular/common/http';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP Methods
|
|
||||||
*/
|
|
||||||
export type HttpMethods =
|
|
||||||
| 'GET'
|
|
||||||
| 'POST'
|
|
||||||
| 'PUT'
|
|
||||||
| 'DELETE'
|
|
||||||
| 'OPTIONS'
|
|
||||||
| 'HEAD'
|
|
||||||
| 'PATCH';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ExcludedUrl type may be used to specify the url and the HTTP method that
|
|
||||||
* should not be intercepted by the KeycloakBearerInterceptor.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* const excludedUrl: ExcludedUrl[] = [
|
|
||||||
* {
|
|
||||||
* url: 'reports/public'
|
|
||||||
* httpMethods: ['GET']
|
|
||||||
* }
|
|
||||||
* ]
|
|
||||||
*
|
|
||||||
* In the example above for URL reports/public and HTTP Method GET the
|
|
||||||
* bearer will not be automatically added.
|
|
||||||
*
|
|
||||||
* If the url is informed but httpMethod is undefined, then the bearer
|
|
||||||
* will not be added for all HTTP Methods.
|
|
||||||
*/
|
|
||||||
export interface ExcludedUrl {
|
|
||||||
url: string;
|
|
||||||
httpMethods?: HttpMethods[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Similar to ExcludedUrl, contains the HTTP methods and a regex to
|
|
||||||
* include the url patterns.
|
|
||||||
* This interface is used internally by the KeycloakService.
|
|
||||||
*/
|
|
||||||
export interface ExcludedUrlRegex {
|
|
||||||
urlPattern: RegExp;
|
|
||||||
httpMethods?: HttpMethods[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* keycloak-angular initialization options.
|
|
||||||
*/
|
|
||||||
export interface KeycloakOptions {
|
|
||||||
/**
|
|
||||||
* Configs to init the keycloak-js library. If undefined, will look for a keycloak.json file
|
|
||||||
* at root of the project.
|
|
||||||
* If not undefined, can be a string meaning the url to the keycloak.json file or an object
|
|
||||||
* of {@link Keycloak.KeycloakConfig}. Use this configuration if you want to specify the keycloak server,
|
|
||||||
* realm, clientId. This is usefull if you have different configurations for production, stage
|
|
||||||
* and development environments. Hint: Make use of Angular environment configuration.
|
|
||||||
*/
|
|
||||||
config?: string | Keycloak.KeycloakConfig;
|
|
||||||
/**
|
|
||||||
* Options to initialize the Keycloak adapter, matches the options as provided by Keycloak itself.
|
|
||||||
*/
|
|
||||||
initOptions?: Keycloak.KeycloakInitOptions;
|
|
||||||
/**
|
|
||||||
* By default all requests made by Angular HttpClient will be intercepted in order to
|
|
||||||
* add the bearer in the Authorization Http Header. However, if this is a not desired
|
|
||||||
* feature, the enableBearerInterceptor must be false.
|
|
||||||
*
|
|
||||||
* Briefly, if enableBearerInterceptor === false, the bearer will not be added
|
|
||||||
* to the authorization header.
|
|
||||||
*
|
|
||||||
* The default value is true.
|
|
||||||
*/
|
|
||||||
enableBearerInterceptor?: boolean;
|
|
||||||
/**
|
|
||||||
* Forces the execution of loadUserProfile after the keycloak initialization considering that the
|
|
||||||
* user logged in.
|
|
||||||
* This option is recommended if is desirable to have the user details at the beginning,
|
|
||||||
* so after the login, the loadUserProfile function will be called and its value cached.
|
|
||||||
*
|
|
||||||
* The default value is true.
|
|
||||||
*/
|
|
||||||
loadUserProfileAtStartUp?: boolean;
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* String Array to exclude the urls that should not have the Authorization Header automatically
|
|
||||||
* added. This library makes use of Angular Http Interceptor, to automatically add the Bearer
|
|
||||||
* token to the request.
|
|
||||||
*/
|
|
||||||
bearerExcludedUrls?: (string | ExcludedUrl)[];
|
|
||||||
/**
|
|
||||||
* This value will be used as the Authorization Http Header name. The default value is
|
|
||||||
* **Authorization**. If the backend expects requests to have a token in a different header, you
|
|
||||||
* should change this value, i.e: **JWT-Authorization**. This will result in a Http Header
|
|
||||||
* Authorization as "JWT-Authorization: bearer <token>".
|
|
||||||
*/
|
|
||||||
authorizationHeaderName?: string;
|
|
||||||
/**
|
|
||||||
* This value will be included in the Authorization Http Header param. The default value is
|
|
||||||
* **Bearer**, which will result in a Http Header Authorization as "Authorization: Bearer <token>".
|
|
||||||
*
|
|
||||||
* If any other value is needed by the backend in the authorization header, you should change this
|
|
||||||
* value.
|
|
||||||
*
|
|
||||||
* Warning: this value must be in compliance with the keycloak server instance and the adapter.
|
|
||||||
*/
|
|
||||||
bearerPrefix?: string;
|
|
||||||
/**
|
|
||||||
* This value will be used to determine whether or not the token needs to be updated. If the token
|
|
||||||
* will expire is fewer seconds than the updateMinValidity value, then it will be updated.
|
|
||||||
*
|
|
||||||
* The default value is 20.
|
|
||||||
*/
|
|
||||||
updateMinValidity?: number;
|
|
||||||
/**
|
|
||||||
* A function that will tell the KeycloakBearerInterceptor whether to add the token to the request
|
|
||||||
* or to leave the request as it is. If the returned value is `true`, the request will have the token
|
|
||||||
* present on it. If it is `false`, the token will be left off the request.
|
|
||||||
*
|
|
||||||
* The default is a function that always returns `true`.
|
|
||||||
*/
|
|
||||||
shouldAddToken?: (request: HttpRequest<unknown>) => boolean;
|
|
||||||
/**
|
|
||||||
* A function that will tell the KeycloakBearerInterceptor if the token should be considered for
|
|
||||||
* updating as a part of the request being made. If the returned value is `true`, the request will
|
|
||||||
* check the token's expiry time and if it is less than the number of seconds configured by
|
|
||||||
* updateMinValidity then it will be updated before the request is made. If the returned value is
|
|
||||||
* false, the token will not be updated.
|
|
||||||
*
|
|
||||||
* The default is a function that always returns `true`.
|
|
||||||
*/
|
|
||||||
shouldUpdateToken?: (request: HttpRequest<unknown>) => boolean;
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,9 @@
|
|||||||
<div class="flex justify-content-between align-items-center align-content-center">
|
<div class="flex justify-content-between align-items-center align-content-center">
|
||||||
<div class="font-medium text-3xl text-900 mb-3">{{ listing?.title }}</div>
|
<div class="font-medium text-3xl text-900 mb-3">{{ listing?.title }}</div>
|
||||||
<!-- <button pButton pRipple type="button" label="Go back to listings" icon="pi pi-user-plus" class="mr-3 p-button-rounded"></button> -->
|
<!-- <button pButton pRipple type="button" label="Go back to listings" icon="pi pi-user-plus" class="mr-3 p-button-rounded"></button> -->
|
||||||
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="back()"></p-button>
|
@if(historyService.canGoBack){
|
||||||
|
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="historyService.goBack()"></p-button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="text-500 mb-5">Egestas sed tempus urna et pharetra pharetra massa massa ultricies.</div> -->
|
<!-- <div class="text-500 mb-5">Egestas sed tempus urna et pharetra pharetra massa massa ultricies.</div> -->
|
||||||
@if(listing){
|
@if(listing){
|
||||||
@@ -12,52 +14,72 @@
|
|||||||
<div class="col-12 md:col-6">
|
<div class="col-12 md:col-6">
|
||||||
<ul class="list-none p-0 m-0 border-top-1 border-300">
|
<ul class="list-none p-0 m-0 border-top-1 border-300">
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium flex align-self-start">Description</div>
|
<div class="text-500 w-full md:w-3 font-medium flex">Description</div>
|
||||||
<div class="text-900 w-full md:w-10 line-height-3" [innerHTML]="description"></div>
|
<div class="text-900 w-full md:w-9 line-height-3 flex flex-column" [innerHTML]="description"></div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Category</div>
|
<div class="text-500 w-full md:w-3 font-medium">Category</div>
|
||||||
<div class="text-900 w-full md:w-10">
|
<div class="text-900 w-full md:w-9">
|
||||||
<p-chip [label]="selectOptions.getBusiness(listing.type)"></p-chip>
|
<p-chip [label]="selectOptions.getBusiness(listing.type)"></p-chip>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Located in</div>
|
<div class="text-500 w-full md:w-3 font-medium">Located in</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ selectOptions.getState(listing.state) }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.city }}, {{ selectOptions.getState(listing.state) }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Asking Price</div>
|
<div class="text-500 w-full md:w-3 font-medium">Asking Price</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.price | currency }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.price | currency }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Real Estate Included</div>
|
<div class="text-500 w-full md:w-3 font-medium">Sales revenue</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.realEstateIncluded ? 'Yes' : 'No' }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.salesRevenue | currency }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Sales revenue</div>
|
<div class="text-500 w-full md:w-3 font-medium">Cash flow</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.salesRevenue | currency }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.cashFlow | currency }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Cash flow</div>
|
<div class="text-500 w-full md:w-3 font-medium">Type of Real Estate</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.cashFlow | currency }}</div>
|
<div class="text-900 w-full md:w-9">
|
||||||
|
@if (listing.realEstateIncluded){
|
||||||
|
<p-chip label="Real Estate Included"></p-chip>
|
||||||
|
} @if (listing.leasedLocation){
|
||||||
|
<p-chip label="Leased Location"></p-chip>
|
||||||
|
} @if (listing.franchiseResale){
|
||||||
|
<p-chip label="Franchise Re-Sale"></p-chip>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Employees</div>
|
<div class="text-500 w-full md:w-3 font-medium">Employees</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.employees }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.employees }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Broker licensing</div>
|
<div class="text-500 w-full md:w-3 font-medium">Established since</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.brokerLicencing }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.established }}</div>
|
||||||
|
</li>
|
||||||
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
|
<div class="text-500 w-full md:w-3 font-medium">Support & Training</div>
|
||||||
|
<div class="text-900 w-full md:w-9">{{ listing.supportAndTraining }}</div>
|
||||||
|
</li>
|
||||||
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
|
<div class="text-500 w-full md:w-3 font-medium">Reason for Sale</div>
|
||||||
|
<div class="text-900 w-full md:w-9">{{ listing.reasonForSale }}</div>
|
||||||
|
</li>
|
||||||
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
|
<div class="text-500 w-full md:w-3 font-medium">Broker licensing</div>
|
||||||
|
<div class="text-900 w-full md:w-9">{{ listing.brokerLicencing }}</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@if(listing && user && (user.id===listing?.userId || isAdmin())){
|
@if(listing && listingUser && (listingUser?.email===user?.email || isAdmin())){
|
||||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editBusinessListing', listing.id]"></button>
|
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editBusinessListing', listing.id]"></button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 md:col-6">
|
<div class="col-12 md:col-6">
|
||||||
<div class="surface-card p-4 border-round p-fluid">
|
<div class="surface-card p-4 border-round p-fluid">
|
||||||
<div class="font-medium text-xl text-primary text-900 mb-3">Contact The Author of This Listing</div>
|
<div class="font-medium text-xl text-primary text-900 mb-3">Contact the Author of this Listing</div>
|
||||||
<div class="font-italic text-sm text-900 mb-5">Please Include your contact info below:</div>
|
<div class="font-italic text-sm text-900 mb-5">Please include your contact info below</div>
|
||||||
<div class="grid formgrid p-fluid">
|
<div class="grid formgrid p-fluid">
|
||||||
<div class="field mb-4 col-12 md:col-6">
|
<div class="field mb-4 col-12 md:col-6">
|
||||||
<label for="name" class="font-medium text-900">Your Name</label>
|
<label for="name" class="font-medium text-900">Your Name</label>
|
||||||
@@ -69,7 +91,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field mb-4 col-12 md:col-6">
|
<div class="field mb-4 col-12 md:col-6">
|
||||||
<label for="phoneNumber" class="font-medium text-900">Phone Number</label>
|
<label for="phoneNumber" class="font-medium text-900">Phone Number</label>
|
||||||
<input id="phoneNumber" type="text" pInputText [(ngModel)]="mailinfo.sender.phoneNumber" />
|
<!-- <input id="phoneNumber" type="text" pInputText [(ngModel)]="mailinfo.sender.phoneNumber" /> -->
|
||||||
|
<p-inputMask mask="(999) 999-9999" placeholder="(123) 456-7890" [(ngModel)]="mailinfo.sender.phoneNumber"></p-inputMask>
|
||||||
</div>
|
</div>
|
||||||
<div class="field mb-4 col-12 md:col-6">
|
<div class="field mb-4 col-12 md:col-6">
|
||||||
<label for="state" class="font-medium text-900">Country/State</label>
|
<label for="state" class="font-medium text-900">Country/State</label>
|
||||||
@@ -80,7 +103,14 @@
|
|||||||
<label for="notes" class="font-medium text-900">Questions/Comments</label>
|
<label for="notes" class="font-medium text-900">Questions/Comments</label>
|
||||||
<textarea id="notes" pInputTextarea [autoResize]="true" [rows]="5" [(ngModel)]="mailinfo.sender.comments"></textarea>
|
<textarea id="notes" pInputTextarea [autoResize]="true" [rows]="5" [(ngModel)]="mailinfo.sender.comments"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="surface-border border-top-1 opacity-50 mb-4 col-12"></div>
|
@if(listingUser){
|
||||||
|
<div class="surface-border mb-4 col-12 flex align-items-center">
|
||||||
|
Listing by <a routerLink="/details-user/{{ listingUser.id }}" class="mr-2 font-semibold">{{ listingUser.firstname }} {{ listingUser.lastname }}</a>
|
||||||
|
@if(listingUser.hasCompanyLogo){
|
||||||
|
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}" class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<button pButton pRipple label="Submit" icon="pi pi-file" class="w-auto" (click)="mail()"></button>
|
<button pButton pRipple label="Submit" icon="pi pi-file" class="w-auto" (click)="mail()"></button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,25 +1,26 @@
|
|||||||
import { Location } from '@angular/common';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import onChange from 'on-change';
|
import onChange from 'on-change';
|
||||||
import { MessageService } from 'primeng/api';
|
import { MessageService } from 'primeng/api';
|
||||||
import { GalleriaModule } from 'primeng/galleria';
|
import { GalleriaModule } from 'primeng/galleria';
|
||||||
|
import { InputMaskModule } from 'primeng/inputmask';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import { BusinessListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { BusinessListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { KeycloakUser, ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
|
import { HistoryService } from '../../../services/history.service';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
import { MailService } from '../../../services/mail.service';
|
import { MailService } from '../../../services/mail.service';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||||
import { UserService } from '../../../services/user.service';
|
import { UserService } from '../../../services/user.service';
|
||||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||||
import { getCriteriaStateObject, getSessionStorageHandler } from '../../../utils/utils';
|
import { getCriteriaStateObject, getSessionStorageHandler, map2User } from '../../../utils/utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-details-business-listing',
|
selector: 'app-details-business-listing',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [SharedModule, GalleriaModule],
|
imports: [SharedModule, GalleriaModule, InputMaskModule],
|
||||||
providers: [MessageService],
|
providers: [MessageService],
|
||||||
templateUrl: './details-business-listing.component.html',
|
templateUrl: './details-business-listing.component.html',
|
||||||
styleUrl: './details-business-listing.component.scss',
|
styleUrl: './details-business-listing.component.scss',
|
||||||
@@ -48,8 +49,13 @@ export class DetailsBusinessListingComponent {
|
|||||||
criteria: ListingCriteria;
|
criteria: ListingCriteria;
|
||||||
mailinfo: MailInfo;
|
mailinfo: MailInfo;
|
||||||
environment = environment;
|
environment = environment;
|
||||||
|
keycloakUser: KeycloakUser;
|
||||||
user: User;
|
user: User;
|
||||||
|
listingUser: User;
|
||||||
description: SafeHtml;
|
description: SafeHtml;
|
||||||
|
private history: string[] = [];
|
||||||
|
ts = new Date().getTime();
|
||||||
|
env = environment;
|
||||||
constructor(
|
constructor(
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private listingsService: ListingsService,
|
private listingsService: ListingsService,
|
||||||
@@ -59,27 +65,35 @@ export class DetailsBusinessListingComponent {
|
|||||||
private mailService: MailService,
|
private mailService: MailService,
|
||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private location: Location,
|
public historyService: HistoryService,
|
||||||
|
public keycloakService: KeycloakService,
|
||||||
) {
|
) {
|
||||||
this.mailinfo = { sender: {}, userId: '', email: '' };
|
this.router.events.subscribe(event => {
|
||||||
this.userService.getUserObservable().subscribe(user => {
|
if (event instanceof NavigationEnd) {
|
||||||
this.user = user;
|
this.history.push(event.urlAfterRedirects);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
|
||||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
this.keycloakUser = map2User(token);
|
||||||
|
if (this.keycloakUser) {
|
||||||
|
this.user = await this.userService.getByMail(this.keycloakUser.email);
|
||||||
|
this.mailinfo.sender = { name: `${this.user.firstname} ${this.user.lastname}`, email: this.user.email, phoneNumber: this.user.phoneNumber, state: this.user.companyLocation };
|
||||||
|
}
|
||||||
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'business'));
|
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'business'));
|
||||||
|
this.listingUser = await this.userService.getById(this.listing.userId);
|
||||||
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
|
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
|
||||||
}
|
}
|
||||||
back() {
|
|
||||||
this.location.back();
|
|
||||||
}
|
|
||||||
isAdmin() {
|
isAdmin() {
|
||||||
return this.userService.hasAdminRole();
|
return this.keycloakService.getUserRoles(true).includes('ADMIN');
|
||||||
}
|
}
|
||||||
async mail() {
|
async mail() {
|
||||||
this.mailinfo.email = this.user.email;
|
this.mailinfo.email = this.listingUser.email;
|
||||||
this.mailinfo.userId = this.listing.userId;
|
this.mailinfo.userId = this.listing.userId;
|
||||||
this.mailinfo.listing = this.listing;
|
this.mailinfo.listing = this.listing;
|
||||||
await this.mailService.mail(this.mailinfo);
|
await this.mailService.mail(this.mailinfo);
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<div class="surface-ground h-full">
|
<div class="surface-ground h-full">
|
||||||
<div class="px-6 py-5">
|
<div class="px-6 py-5">
|
||||||
<div class="surface-card p-4 shadow-2 border-round">
|
<div class="surface-card p-4 shadow-2 border-round">
|
||||||
<div class="flex justify-content-between align-items-center align-content-center">
|
<div class="flex justify-content-between align-items-center align-content-center mb-2">
|
||||||
<div class="font-medium text-3xl text-900 mb-3">{{ listing?.title }}</div>
|
<div class="font-medium text-3xl text-900 mb-3">{{ listing?.title }}</div>
|
||||||
<!-- <button pButton pRipple type="button" label="Go back to listings" icon="pi pi-user-plus" class="mr-3 p-button-rounded"></button> -->
|
<!-- <button pButton pRipple type="button" label="Go back to listings" icon="pi pi-user-plus" class="mr-3 p-button-rounded"></button> -->
|
||||||
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="back()"></p-button>
|
@if(historyService.canGoBack){
|
||||||
|
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="historyService.goBack()"></p-button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="text-500 mb-5">Egestas sed tempus urna et pharetra pharetra massa massa ultricies.</div> -->
|
<!-- <div class="text-500 mb-5">Egestas sed tempus urna et pharetra pharetra massa massa ultricies.</div> -->
|
||||||
@if(listing){
|
@if(listing){
|
||||||
@@ -12,52 +14,54 @@
|
|||||||
<div class="col-12 md:col-6">
|
<div class="col-12 md:col-6">
|
||||||
<ul class="list-none p-0 m-0 border-top-1 border-300">
|
<ul class="list-none p-0 m-0 border-top-1 border-300">
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium flex align-self-start">Description</div>
|
<div class="text-500 w-full md:w-3 font-medium flex">Description</div>
|
||||||
<div class="text-900 w-full md:w-10 line-height-3" [innerHTML]="description"></div>
|
<div class="text-900 w-full md:w-9 line-height-3" [innerHTML]="description"></div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Property Category</div>
|
<div class="text-500 w-full md:w-3 font-medium">Property Category</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ selectOptions.getCommercialProperty(listing.type) }}</div>
|
<div class="text-900 w-full md:w-9">{{ selectOptions.getCommercialProperty(listing.type) }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Located in</div>
|
<div class="text-500 w-full md:w-3 font-medium">Located in</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ selectOptions.getState(listing.state) }}</div>
|
<div class="text-900 w-full md:w-9">{{ selectOptions.getState(listing.state) }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">City</div>
|
<div class="text-500 w-full md:w-3 font-medium">City</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.city }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.city }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Zip Code</div>
|
<div class="text-500 w-full md:w-3 font-medium">Zip Code</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.zipCode }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.zipCode }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">County</div>
|
<div class="text-500 w-full md:w-3 font-medium">County</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.county }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.county }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Asking Price:</div>
|
<div class="text-500 w-full md:w-3 font-medium">Asking Price:</div>
|
||||||
<div class="text-900 w-full md:w-10">{{ listing.price | currency }}</div>
|
<div class="text-900 w-full md:w-9">{{ listing.price | currency }}</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p-galleria [value]="propertyImages" [showIndicators]="true" [showThumbnails]="false" [responsiveOptions]="responsiveOptions" [containerStyle]="{ 'max-width': '640px' }" [numVisible]="5">
|
|
||||||
<ng-template pTemplate="item" let-item>
|
@if(listing && listingUser && (listingUser?.email===user?.email || isAdmin())){
|
||||||
<img src="pictures/property/{{ listing.imagePath }}/{{ item }}" style="width: 100%" />
|
|
||||||
</ng-template>
|
|
||||||
</p-galleria>
|
|
||||||
@if(listing && user && (user.id===listing?.userId || isAdmin())){
|
|
||||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
|
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@if (mailinfo){
|
|
||||||
<div class="col-12 md:col-6">
|
<div class="col-12 md:col-6">
|
||||||
|
<p-galleria [value]="listing.imageOrder" [showIndicators]="true" [showThumbnails]="false" [responsiveOptions]="responsiveOptions" [containerStyle]="{ 'max-width': '640px' }" [numVisible]="5">
|
||||||
|
<ng-template pTemplate="item" let-item>
|
||||||
|
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.serialId }}/{{ item }}" style="width: 100%" />
|
||||||
|
</ng-template>
|
||||||
|
</p-galleria>
|
||||||
|
@if (mailinfo){
|
||||||
<div class="surface-card p-4 border-round p-fluid">
|
<div class="surface-card p-4 border-round p-fluid">
|
||||||
<div class="font-medium text-xl text-primary text-900 mb-3">Contact The Author of This Listing</div>
|
<div class="font-medium text-xl text-primary text-900 mb-3">Contact the Author of this Listing</div>
|
||||||
<div class="font-italic text-sm text-900 mb-5">Please Include your contact info below:</div>
|
<div class="font-italic text-sm text-900 mb-5">Please include your contact info below</div>
|
||||||
<div class="grid formgrid p-fluid">
|
<div class="grid formgrid p-fluid">
|
||||||
<div class="field mb-4 col-12 md:col-6">
|
<div class="field mb-4 col-12 md:col-6">
|
||||||
<label for="name" class="font-medium text-900">Your Name</label>
|
<label for="name" class="font-medium text-900">Your Name</label>
|
||||||
<input id="name" type="text" pInputText [(ngModel)]="mailinfo.sender.name" />
|
<input [ngClass]="{ 'ng-invalid': containsError('name'), 'ng-dirty': containsError('name') }" id="name" type="text" pInputText [(ngModel)]="mailinfo.sender.name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="field mb-4 col-12 md:col-6">
|
<div class="field mb-4 col-12 md:col-6">
|
||||||
<label for="email" class="font-medium text-900">Your Email</label>
|
<label for="email" class="font-medium text-900">Your Email</label>
|
||||||
@@ -65,7 +69,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field mb-4 col-12 md:col-6">
|
<div class="field mb-4 col-12 md:col-6">
|
||||||
<label for="phoneNumber" class="font-medium text-900">Phone Number</label>
|
<label for="phoneNumber" class="font-medium text-900">Phone Number</label>
|
||||||
<input id="phoneNumber" type="text" pInputText [(ngModel)]="mailinfo.sender.phoneNumber" />
|
<!-- <input id="phoneNumber" type="text" pInputText [(ngModel)]="mailinfo.sender.phoneNumber" /> -->
|
||||||
|
<p-inputMask mask="(999) 999-9999" placeholder="(123) 456-7890" [(ngModel)]="mailinfo.sender.phoneNumber"></p-inputMask>
|
||||||
</div>
|
</div>
|
||||||
<div class="field mb-4 col-12 md:col-6">
|
<div class="field mb-4 col-12 md:col-6">
|
||||||
<label for="state" class="font-medium text-900">Country/State</label>
|
<label for="state" class="font-medium text-900">Country/State</label>
|
||||||
@@ -76,13 +81,20 @@
|
|||||||
<label for="notes" class="font-medium text-900">Questions/Comments</label>
|
<label for="notes" class="font-medium text-900">Questions/Comments</label>
|
||||||
<textarea id="notes" pInputTextarea [autoResize]="true" [rows]="5" [(ngModel)]="mailinfo.sender.comments"></textarea>
|
<textarea id="notes" pInputTextarea [autoResize]="true" [rows]="5" [(ngModel)]="mailinfo.sender.comments"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="surface-border border-top-1 opacity-50 mb-4 col-12"></div>
|
@if(listingUser){
|
||||||
|
<div class="surface-border mb-4 col-12 flex align-items-center">
|
||||||
|
Listing by <a routerLink="/details-user/{{ listingUser.id }}" class="mr-2 font-semibold">{{ listingUser.firstname }} {{ listingUser.lastname }}</a>
|
||||||
|
@if(listingUser.hasCompanyLogo){
|
||||||
|
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imagePath }}.avif?_ts={{ ts }}" class="mr-5 lg:mb-0" style="max-height: 30px; max-width: 100px" />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<button pButton pRipple label="Submit" icon="pi pi-file" class="w-auto" (click)="mail()"></button>
|
<button pButton pRipple label="Submit" icon="pi pi-file" class="w-auto" (click)="mail()"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,31 +1,33 @@
|
|||||||
import { Location } from '@angular/common';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import onChange from 'on-change';
|
import onChange from 'on-change';
|
||||||
import { MessageService } from 'primeng/api';
|
import { MessageService } from 'primeng/api';
|
||||||
import { GalleriaModule } from 'primeng/galleria';
|
import { GalleriaModule } from 'primeng/galleria';
|
||||||
|
import { InputMaskModule } from 'primeng/inputmask';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { ErrorResponse, KeycloakUser, ListingCriteria, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
|
import { HistoryService } from '../../../services/history.service';
|
||||||
|
import { ImageService } from '../../../services/image.service';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
import { MailService } from '../../../services/mail.service';
|
import { MailService } from '../../../services/mail.service';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||||
import { UserService } from '../../../services/user.service';
|
import { UserService } from '../../../services/user.service';
|
||||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||||
import { getCriteriaStateObject, getSessionStorageHandler } from '../../../utils/utils';
|
import { getCriteriaStateObject, getSessionStorageHandler, map2User } from '../../../utils/utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-details-commercial-property-listing',
|
selector: 'app-details-commercial-property-listing',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [SharedModule, GalleriaModule],
|
imports: [SharedModule, GalleriaModule, InputMaskModule],
|
||||||
providers: [MessageService],
|
providers: [MessageService],
|
||||||
templateUrl: './details-commercial-property-listing.component.html',
|
templateUrl: './details-commercial-property-listing.component.html',
|
||||||
styleUrl: './details-commercial-property-listing.component.scss',
|
styleUrl: './details-commercial-property-listing.component.scss',
|
||||||
})
|
})
|
||||||
export class DetailsCommercialPropertyListingComponent {
|
export class DetailsCommercialPropertyListingComponent {
|
||||||
// listings: Array<BusinessListing>;
|
|
||||||
responsiveOptions = [
|
responsiveOptions = [
|
||||||
{
|
{
|
||||||
breakpoint: '1199px',
|
breakpoint: '1199px',
|
||||||
@@ -47,10 +49,14 @@ export class DetailsCommercialPropertyListingComponent {
|
|||||||
listing: CommercialPropertyListing;
|
listing: CommercialPropertyListing;
|
||||||
criteria: ListingCriteria;
|
criteria: ListingCriteria;
|
||||||
mailinfo: MailInfo;
|
mailinfo: MailInfo;
|
||||||
propertyImages: string[] = [];
|
|
||||||
environment = environment;
|
environment = environment;
|
||||||
|
keycloakUser: KeycloakUser;
|
||||||
user: User;
|
user: User;
|
||||||
|
listingUser: User;
|
||||||
description: SafeHtml;
|
description: SafeHtml;
|
||||||
|
ts = new Date().getTime();
|
||||||
|
env = environment;
|
||||||
|
errorResponse: ErrorResponse;
|
||||||
constructor(
|
constructor(
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private listingsService: ListingsService,
|
private listingsService: ListingsService,
|
||||||
@@ -60,31 +66,42 @@ export class DetailsCommercialPropertyListingComponent {
|
|||||||
private mailService: MailService,
|
private mailService: MailService,
|
||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private location: Location,
|
public historyService: HistoryService,
|
||||||
|
public keycloakService: KeycloakService,
|
||||||
|
private imageService: ImageService,
|
||||||
) {
|
) {
|
||||||
this.mailinfo = { sender: {}, userId: '', email: '' };
|
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
|
||||||
this.userService.getUserObservable().subscribe(user => {
|
|
||||||
this.user = user;
|
|
||||||
});
|
|
||||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
this.keycloakUser = map2User(token);
|
||||||
|
if (this.keycloakUser) {
|
||||||
|
this.user = await this.userService.getByMail(this.keycloakUser.email);
|
||||||
|
this.mailinfo.sender = { name: `${this.user.firstname} ${this.user.lastname}`, email: this.user.email, phoneNumber: this.user.phoneNumber, state: this.user.companyLocation };
|
||||||
|
}
|
||||||
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
|
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
|
||||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
this.listingUser = await this.userService.getById(this.listing.userId);
|
||||||
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
|
this.description = this.sanitizer.bypassSecurityTrustHtml(this.listing.description);
|
||||||
}
|
}
|
||||||
back() {
|
|
||||||
this.location.back();
|
|
||||||
}
|
|
||||||
isAdmin() {
|
isAdmin() {
|
||||||
return this.userService.hasAdminRole();
|
return this.keycloakService.getUserRoles(true).includes('ADMIN');
|
||||||
}
|
}
|
||||||
async mail() {
|
async mail() {
|
||||||
this.mailinfo.email = this.user.email;
|
this.mailinfo.email = this.listingUser.email;
|
||||||
this.mailinfo.userId = this.listing.userId;
|
this.mailinfo.userId = this.listing.userId;
|
||||||
this.mailinfo.listing = this.listing;
|
this.mailinfo.listing = this.listing;
|
||||||
await this.mailService.mail(this.mailinfo);
|
const result = await this.mailService.mail(this.mailinfo);
|
||||||
|
if (result) {
|
||||||
|
this.errorResponse = result as ErrorResponse;
|
||||||
|
} else {
|
||||||
|
this.errorResponse = null;
|
||||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Your message has been sent to the creator of the listing', life: 3000 });
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Your message has been sent to the creator of the listing', life: 3000 });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
containsError(fieldname: string) {
|
||||||
|
return this.errorResponse?.fields.map(f => f.fieldname).includes(fieldname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,11 @@
|
|||||||
<div class="px-6 py-5">
|
<div class="px-6 py-5">
|
||||||
@if (user){
|
@if (user){
|
||||||
<div class="surface-card p-4 shadow-2 border-round">
|
<div class="surface-card p-4 shadow-2 border-round">
|
||||||
<!-- <div class="flex justify-content-between align-items-center align-content-center">
|
|
||||||
<div class="font-medium text-3xl text-900 mb-3">{{listing?.title}}</div>
|
|
||||||
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="back()"></p-button>
|
|
||||||
</div> -->
|
|
||||||
<div class="surface-section px-6 pt-5">
|
<div class="surface-section px-6 pt-5">
|
||||||
<div class="flex align-items-start flex-column lg:flex-row lg:justify-content-between">
|
<div class="flex align-items-start flex-column lg:flex-row lg:justify-content-between">
|
||||||
<div class="flex align-items-start flex-column md:flex-row">
|
<div class="flex align-items-start flex-column md:flex-row">
|
||||||
@if(user.hasProfile){
|
@if(user.hasProfile){
|
||||||
<img src="pictures//profile/{{ user.id }}.avif" class="mr-5 mb-3 lg:mb-0" style="width: 90px" />
|
<img src="{{ env.imageBaseUrl }}/pictures//profile/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="mr-5 mb-3 lg:mb-0" style="width: 90px" />
|
||||||
} @else {
|
} @else {
|
||||||
<img src="assets/images/person_placeholder.jpg" class="mr-5 mb-3 lg:mb-0" style="width: 90px" />
|
<img src="assets/images/person_placeholder.jpg" class="mr-5 mb-3 lg:mb-0" style="width: 90px" />
|
||||||
}
|
}
|
||||||
@@ -24,17 +20,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mr-5 mt-3">
|
<div class="mr-5 mt-3">
|
||||||
<span class="font-medium text-500">For Sale</span>
|
<span class="font-medium text-500">For Sale</span>
|
||||||
<div class="text-700 mt-2">12</div>
|
<div class="text-700 mt-2">{{ businessListings?.length + commercialPropListings?.length }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mr-5 mt-3">
|
<!-- <div class="mr-5 mt-3">
|
||||||
<span class="font-medium text-500">Sold</span>
|
<span class="font-medium text-500">Sold</span>
|
||||||
<div class="text-700 mt-2">8</div>
|
<div class="text-700 mt-2">8</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="flex align-items-center mt-3">
|
<div class="flex align-items-center mt-3">
|
||||||
<!-- <span class="font-medium text-500">Logo</span> -->
|
<!-- <span class="font-medium text-500">Logo</span> -->
|
||||||
<div>
|
<div>
|
||||||
@if(user.hasCompanyLogo){
|
@if(user.hasCompanyLogo){
|
||||||
<img src="pictures/logo/{{ user.id }}.avif" class="mr-5 lg:mb-0" style="height: 60px; max-width: 100px" />
|
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="mr-5 lg:mb-0" style="max-height: 60px; max-width: 100px" />
|
||||||
}
|
}
|
||||||
<!-- <img *ngIf="!user.hasCompanyLogo" src="assets/images/placeholder.png"
|
<!-- <img *ngIf="!user.hasCompanyLogo" src="assets/images/placeholder.png"
|
||||||
class="mr-5 lg:mb-0" style="height:60px;max-width:100px" /> -->
|
class="mr-5 lg:mb-0" style="height:60px;max-width:100px" /> -->
|
||||||
@@ -44,7 +40,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="back()"></p-button>
|
@if(historyService.canGoBack){
|
||||||
|
<p-button icon="pi pi-times" [rounded]="true" severity="danger" (click)="historyService.goBack()"></p-button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-2 text-700 line-height-3 text-l font-semibold">{{ user.description }}</p>
|
<p class="mt-2 text-700 line-height-3 text-l font-semibold">{{ user.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -59,7 +57,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Phone Number</div>
|
<div class="text-500 w-full md:w-2 font-medium">Phone Number</div>
|
||||||
<div class="text-900 w-full md:w-10 line-height-3">{{ user.phoneNumber }}</div>
|
<div class="text-900 w-full md:w-10 line-height-3">{{ formatPhoneNumber(user.phoneNumber) }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
<li class="flex align-items-center py-3 px-2 flex-wrap surface-ground">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">EMail Address</div>
|
<div class="text-500 w-full md:w-2 font-medium">EMail Address</div>
|
||||||
@@ -74,10 +72,10 @@
|
|||||||
<div class="text-900 w-full md:w-10" [innerHTML]="offeredServices"></div>
|
<div class="text-900 w-full md:w-10" [innerHTML]="offeredServices"></div>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Areas we serve</div>
|
<div class="text-500 w-full md:w-2 font-medium">Areas (Counties) we serve</div>
|
||||||
<div class="text-900 w-full md:w-10">
|
<div class="text-900 w-full md:w-10">
|
||||||
@for (area of user.areasServed; track area) {
|
@for (area of user.areasServed; track area) {
|
||||||
<p-tag styleClass="mr-2" [value]="area" [rounded]="true"></p-tag>
|
<p-tag styleClass="mr-2" value="{{ area.county }}-{{ area.state }}" [rounded]="true"></p-tag>
|
||||||
}
|
}
|
||||||
<!-- <p-tag styleClass="mr-2" severity="success" value="Javascript" [rounded]="true"></p-tag>
|
<!-- <p-tag styleClass="mr-2" severity="success" value="Javascript" [rounded]="true"></p-tag>
|
||||||
<p-tag styleClass="mr-2" severity="danger" value="Python" [rounded]="true"></p-tag>
|
<p-tag styleClass="mr-2" severity="danger" value="Python" [rounded]="true"></p-tag>
|
||||||
@@ -87,8 +85,8 @@
|
|||||||
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
<li class="flex align-items-center py-3 px-2 flex-wrap">
|
||||||
<div class="text-500 w-full md:w-2 font-medium">Licensed In</div>
|
<div class="text-500 w-full md:w-2 font-medium">Licensed In</div>
|
||||||
<div class="text-900 w-full md:w-10">
|
<div class="text-900 w-full md:w-10">
|
||||||
@for (license of userLicensedIn; track license) {
|
@for (license of user.licensedIn; track license) {
|
||||||
<div>{{ license.name }} : {{ license.value }}</div>
|
<p-tag styleClass="mr-2" value="{{ license.registerNo }}-{{ license.state }}" [rounded]="true" severity="success"></p-tag>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -123,7 +121,7 @@
|
|||||||
<div class="p-3 border-1 surface-border border-round surface-card">
|
<div class="p-3 border-1 surface-border border-round surface-card">
|
||||||
<div class="text-900 mb-2 flex align-items-center">
|
<div class="text-900 mb-2 flex align-items-center">
|
||||||
@if (listing.imageOrder?.length>0){
|
@if (listing.imageOrder?.length>0){
|
||||||
<img src="pictures/property/{{ listing.imagePath }}/{{ listing.imageOrder[0] }}" class="mr-3" style="width: 45px; height: 45px" />
|
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.serialId }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}" class="mr-3" style="width: 45px; height: 45px" />
|
||||||
} @else {
|
} @else {
|
||||||
<img src="assets/images/placeholder_properties.jpg" class="mr-3" style="width: 45px; height: 45px" />
|
<img src="assets/images/placeholder_properties.jpg" class="mr-3" style="width: 45px; height: 45px" />
|
||||||
}
|
}
|
||||||
@@ -140,8 +138,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if( user?.id===(user$| async)?.id || isAdmin()){
|
@if( user?.email===keycloakUser?.email || isAdmin()){
|
||||||
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/account']"></button>
|
<button pButton pRipple label="Edit" icon="pi pi-file-edit" class="w-auto" [routerLink]="['/account', user.id]"></button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
import { Location } from '@angular/common';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { MessageService } from 'primeng/api';
|
import { MessageService } from 'primeng/api';
|
||||||
import { GalleriaModule } from 'primeng/galleria';
|
import { GalleriaModule } from 'primeng/galleria';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { KeyValue, ListingCriteria } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { KeycloakUser, ListingCriteria, emailToDirName } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
|
import { HistoryService } from '../../../services/history.service';
|
||||||
import { ImageService } from '../../../services/image.service';
|
import { ImageService } from '../../../services/image.service';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||||
import { UserService } from '../../../services/user.service';
|
import { UserService } from '../../../services/user.service';
|
||||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||||
|
import { formatPhoneNumber, map2User } from '../../../utils/utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-details-user',
|
selector: 'app-details-user',
|
||||||
@@ -25,14 +27,18 @@ import { SharedModule } from '../../../shared/shared/shared.module';
|
|||||||
export class DetailsUserComponent {
|
export class DetailsUserComponent {
|
||||||
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
||||||
user: User;
|
user: User;
|
||||||
user$: Observable<User>;
|
user$: Observable<KeycloakUser>;
|
||||||
|
keycloakUser: KeycloakUser;
|
||||||
environment = environment;
|
environment = environment;
|
||||||
criteria: ListingCriteria;
|
criteria: ListingCriteria;
|
||||||
businessListings: BusinessListing[];
|
businessListings: BusinessListing[];
|
||||||
commercialPropListings: CommercialPropertyListing[];
|
commercialPropListings: CommercialPropertyListing[];
|
||||||
companyOverview: SafeHtml;
|
companyOverview: SafeHtml;
|
||||||
offeredServices: SafeHtml;
|
offeredServices: SafeHtml;
|
||||||
userLicensedIn: KeyValue[];
|
ts = new Date().getTime();
|
||||||
|
env = environment;
|
||||||
|
emailToDirName = emailToDirName;
|
||||||
|
formatPhoneNumber = formatPhoneNumber;
|
||||||
constructor(
|
constructor(
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@@ -42,26 +48,24 @@ export class DetailsUserComponent {
|
|||||||
public selectOptions: SelectOptionsService,
|
public selectOptions: SelectOptionsService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private imageService: ImageService,
|
private imageService: ImageService,
|
||||||
private location: Location,
|
public historyService: HistoryService,
|
||||||
|
public keycloakService: KeycloakService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.user = await this.userService.getById(this.id);
|
this.user = await this.userService.getById(this.id);
|
||||||
this.userLicensedIn = this.user.licensedIn.map(l => {
|
const results = await Promise.all([await this.listingsService.getListingsByEmail(this.user.email, 'business'), await this.listingsService.getListingsByEmail(this.user.email, 'commercialProperty')]);
|
||||||
return { name: l.split('|')[0], value: l.split('|')[1] };
|
|
||||||
});
|
|
||||||
const results = await Promise.all([await this.listingsService.getListingByUserId(this.id, 'business'), await this.listingsService.getListingByUserId(this.id, 'commercialProperty')]);
|
|
||||||
// Zuweisen der Ergebnisse zu den Member-Variablen der Klasse
|
// Zuweisen der Ergebnisse zu den Member-Variablen der Klasse
|
||||||
this.businessListings = results[0];
|
this.businessListings = results[0];
|
||||||
this.commercialPropListings = results[1];
|
this.commercialPropListings = results[1];
|
||||||
this.user$ = this.userService.getUserObservable();
|
//this.user$ = this.userService.getUserObservable();
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
this.keycloakUser = map2User(token);
|
||||||
this.companyOverview = this.sanitizer.bypassSecurityTrustHtml(this.user.companyOverview);
|
this.companyOverview = this.sanitizer.bypassSecurityTrustHtml(this.user.companyOverview);
|
||||||
this.offeredServices = this.sanitizer.bypassSecurityTrustHtml(this.user.offeredServices);
|
this.offeredServices = this.sanitizer.bypassSecurityTrustHtml(this.user.offeredServices);
|
||||||
}
|
}
|
||||||
back() {
|
|
||||||
this.location.back();
|
|
||||||
}
|
|
||||||
isAdmin() {
|
isAdmin() {
|
||||||
return this.userService.hasAdminRole();
|
return this.keycloakService.getUserRoles(true).includes('ADMIN');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,11 @@
|
|||||||
<div class="align-items-center flex-grow-1 justify-content-between hidden lg:flex absolute lg:static w-full left-0 top-100 px-6 lg:px-0 shadow-2 lg:shadow-none z-2">
|
<div class="align-items-center flex-grow-1 justify-content-between hidden lg:flex absolute lg:static w-full left-0 top-100 px-6 lg:px-0 shadow-2 lg:shadow-none z-2">
|
||||||
<section></section>
|
<section></section>
|
||||||
<div class="flex justify-content-between lg:block border-top-1 lg:border-top-none border-gray-800 py-3 lg:py-0 mt-3 lg:mt-0">
|
<div class="flex justify-content-between lg:block border-top-1 lg:border-top-none border-gray-800 py-3 lg:py-0 mt-3 lg:mt-0">
|
||||||
@if(userService.isLoggedIn()){
|
@if(keycloakService.isLoggedIn()){
|
||||||
<p-button label="Account" class="ml-3 font-bold" [outlined]="true" severity="secondary" [routerLink]="['/account']"></p-button>
|
<p-button label="Account" class="ml-3 font-bold" [outlined]="true" severity="secondary" [routerLink]="['/account']"></p-button>
|
||||||
} @else {
|
} @else {
|
||||||
<p-button label="Log In" class="ml-3 font-bold" [outlined]="true" severity="secondary" (click)="login()"></p-button>
|
<p-button label="Log In" class="ml-3 font-bold" [outlined]="true" severity="secondary" (click)="login()"></p-button>
|
||||||
|
<p-button label="Register" class="ml-3 font-bold" [outlined]="true" severity="secondary" (click)="register()"></p-button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,9 +46,29 @@
|
|||||||
</div>
|
</div>
|
||||||
<div [ngClass]="{ 'mt-5': activeTabAction === 'business', 'mt-11': activeTabAction === 'commercialProperty', 'mt-22': activeTabAction === 'broker' }">
|
<div [ngClass]="{ 'mt-5': activeTabAction === 'business', 'mt-11': activeTabAction === 'commercialProperty', 'mt-22': activeTabAction === 'broker' }">
|
||||||
<div class="flex flex-column align-items-right gap-3 px-2 py-3 my-3 surface-border">
|
<div class="flex flex-column align-items-right gap-3 px-2 py-3 my-3 surface-border">
|
||||||
<p-dropdown [options]="states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="State" [style]="{ width: '200px' }"></p-dropdown>
|
<p-dropdown
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
|
[options]="states"
|
||||||
|
[(ngModel)]="criteria.state"
|
||||||
|
optionLabel="name"
|
||||||
|
optionValue="value"
|
||||||
|
[showClear]="true"
|
||||||
|
placeholder="State"
|
||||||
|
[style]="{ width: '200px' }"
|
||||||
|
></p-dropdown>
|
||||||
@if(activeTabAction === 'business'){
|
@if(activeTabAction === 'business'){
|
||||||
<p-dropdown [options]="selectOptions.typesOfBusiness" [(ngModel)]="criteria.type" optionLabel="name" optionValue="value" [showClear]="true" placeholder="Category" [style]="{ width: '200px' }"></p-dropdown>
|
<p-dropdown
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
|
[options]="selectOptions.typesOfBusiness"
|
||||||
|
[(ngModel)]="criteria.type"
|
||||||
|
optionLabel="name"
|
||||||
|
optionValue="value"
|
||||||
|
[showClear]="true"
|
||||||
|
placeholder="Category"
|
||||||
|
[style]="{ width: '200px' }"
|
||||||
|
></p-dropdown>
|
||||||
} @if(activeTabAction === 'commercialProperty'){
|
} @if(activeTabAction === 'commercialProperty'){
|
||||||
<p-dropdown
|
<p-dropdown
|
||||||
[options]="selectOptions.typesOfCommercialProperty"
|
[options]="selectOptions.typesOfCommercialProperty"
|
||||||
@@ -73,7 +94,7 @@
|
|||||||
pRipple
|
pRipple
|
||||||
label="Create Your Listing"
|
label="Create Your Listing"
|
||||||
class="block mt-7 mb-7 lg:mb-0 p-button-rounded p-button-success p-button-lg font-medium"
|
class="block mt-7 mb-7 lg:mb-0 p-button-rounded p-button-success p-button-lg font-medium"
|
||||||
[routerLink]="userService.isLoggedIn() ? '/createBusinessListing' : '/pricing'"
|
[routerLink]="keycloakService.isLoggedIn() ? '/createBusinessListing' : '/pricing'"
|
||||||
></button>
|
></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,18 +2,16 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import onChange from 'on-change';
|
import onChange from 'on-change';
|
||||||
import { ButtonModule } from 'primeng/button';
|
import { ButtonModule } from 'primeng/button';
|
||||||
import { CheckboxModule } from 'primeng/checkbox';
|
import { CheckboxModule } from 'primeng/checkbox';
|
||||||
import { DropdownModule } from 'primeng/dropdown';
|
import { DropdownModule } from 'primeng/dropdown';
|
||||||
import { InputTextModule } from 'primeng/inputtext';
|
import { InputTextModule } from 'primeng/inputtext';
|
||||||
import { StyleClassModule } from 'primeng/styleclass';
|
import { StyleClassModule } from 'primeng/styleclass';
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { User } from '../../../../../bizmatch-server/src/models/db.model';
|
|
||||||
import { ListingCriteria } from '../../../../../bizmatch-server/src/models/main.model';
|
import { ListingCriteria } from '../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { ListingsService } from '../../services/listings.service';
|
import { ListingsService } from '../../services/listings.service';
|
||||||
import { SelectOptionsService } from '../../services/select-options.service';
|
import { SelectOptionsService } from '../../services/select-options.service';
|
||||||
import { UserService } from '../../services/user.service';
|
|
||||||
import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from '../../utils/utils';
|
import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from '../../utils/utils';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
@@ -28,14 +26,12 @@ export class HomeComponent {
|
|||||||
maxPrice: string;
|
maxPrice: string;
|
||||||
minPrice: string;
|
minPrice: string;
|
||||||
criteria: ListingCriteria;
|
criteria: ListingCriteria;
|
||||||
user$: Observable<User>;
|
|
||||||
states = [];
|
states = [];
|
||||||
public constructor(private router: Router, private activatedRoute: ActivatedRoute, public selectOptions: SelectOptionsService, public userService: UserService, private listingsService: ListingsService) {
|
public constructor(private router: Router, private activatedRoute: ActivatedRoute, public selectOptions: SelectOptionsService, public keycloakService: KeycloakService, private listingsService: ListingsService) {
|
||||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||||
resetCriteria(this.criteria);
|
resetCriteria(this.criteria);
|
||||||
}
|
}
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.user$ = this.userService.getUserObservable();
|
|
||||||
if (this.activeTabAction === 'business' || this.activeTabAction === 'commercialProperty') {
|
if (this.activeTabAction === 'business' || this.activeTabAction === 'commercialProperty') {
|
||||||
const statesResult = await this.listingsService.getAllStates(this.activeTabAction);
|
const statesResult = await this.listingsService.getAllStates(this.activeTabAction);
|
||||||
this.states = statesResult.map(s => s.state).map(ls => ({ name: this.selectOptions.getState(ls as string), value: ls }));
|
this.states = statesResult.map(s => s.state).map(ls => ({ name: this.selectOptions.getState(ls as string), value: ls }));
|
||||||
@@ -58,6 +54,11 @@ export class HomeComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
login() {
|
login() {
|
||||||
this.userService.login(window.location.href);
|
this.keycloakService.login({
|
||||||
|
redirectUri: window.location.href,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
register() {
|
||||||
|
this.keycloakService.register({ redirectUri: `${window.location.origin}/account` });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,20 +3,10 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="grid p-4 align-items-center">
|
<div class="grid p-4 align-items-center">
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<p-dropdown
|
<p-dropdown [filter]="true" filterBy="name" [options]="states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="Location" [style]="{ width: '100%' }">
|
||||||
[filter]="true"
|
|
||||||
filterBy="name"
|
|
||||||
[options]="selectOptions.states"
|
|
||||||
[(ngModel)]="criteria.state"
|
|
||||||
optionLabel="name"
|
|
||||||
optionValue="value"
|
|
||||||
[showClear]="true"
|
|
||||||
placeholder="Location"
|
|
||||||
[style]="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<ng-template let-state pTemplate="item">
|
<ng-template let-state pTemplate="item">
|
||||||
<div class="flex align-items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<div>{{ state.name }}</div>
|
<div>{{ state.name }} ({{ state.count }})</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-dropdown>
|
</p-dropdown>
|
||||||
@@ -42,7 +32,7 @@
|
|||||||
<div class="surface-card p-4 flex flex-column align-items-center md:flex-row md:align-items-stretch h-full">
|
<div class="surface-card p-4 flex flex-column align-items-center md:flex-row md:align-items-stretch h-full">
|
||||||
<span>
|
<span>
|
||||||
@if(user.hasProfile){
|
@if(user.hasProfile){
|
||||||
<img src="pictures/profile/{{ user.id }}.avif" class="w-5rem" />
|
<img src="{{ env.imageBaseUrl }}/pictures/profile/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="w-5rem" />
|
||||||
} @else {
|
} @else {
|
||||||
<img src="assets/images/person_placeholder.jpg" class="w-5rem" />
|
<img src="assets/images/person_placeholder.jpg" class="w-5rem" />
|
||||||
}
|
}
|
||||||
@@ -55,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="px-4 py-3 text-right flex justify-content-between align-items-center">
|
<div class="px-4 py-3 text-right flex justify-content-between align-items-center">
|
||||||
@if(user.hasCompanyLogo){
|
@if(user.hasCompanyLogo){
|
||||||
<img src="pictures/logo/{{ user.id }}.avif" class="rounded-image" />
|
<img src="{{ env.imageBaseUrl }}/pictures/logo/{{ emailToDirName(user.email) }}.avif?_ts={{ ts }}" class="rounded-image" />
|
||||||
} @else {
|
} @else {
|
||||||
<img src="assets/images/placeholder.png" class="rounded-image" />
|
<img src="assets/images/placeholder.png" class="rounded-image" />
|
||||||
}
|
}
|
||||||
@@ -65,7 +55,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2 surface-200 flex align-items-center justify-content-center">
|
<div class="mb-2 surface-200 flex align-items-center justify-content-center paginator-bar">
|
||||||
<div class="mx-1 text-color">Total number of Professionals/Brokers: {{ totalRecords }}</div>
|
<div class="mx-1 text-color">Total number of Professionals/Brokers: {{ totalRecords }}</div>
|
||||||
<p-paginator (onPageChange)="onPageChange($event)" [first]="first" [rows]="rows" [totalRecords]="totalRecords" [rowsPerPageOptions]="[12, 24, 48]"></p-paginator>
|
<p-paginator (onPageChange)="onPageChange($event)" [first]="first" [rows]="rows" [totalRecords]="totalRecords" [rowsPerPageOptions]="[12, 24, 48]"></p-paginator>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
margin-bottom: -1px;
|
margin-bottom: -1px;
|
||||||
}
|
}
|
||||||
.search{
|
.search {
|
||||||
background-color: #343F69;
|
background-color: #343f69;
|
||||||
}
|
}
|
||||||
::ng-deep p-paginator div {
|
::ng-deep p-paginator div {
|
||||||
background-color: var(--surface-200) !important;
|
background-color: var(--surface-200) !important;
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
// width: 100px;
|
// width: 100px;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
height: 45px;
|
max-height: 45px;
|
||||||
border: 1px solid rgba(0,0,0,0.2);
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||||
padding: 1px 1px;
|
padding: 1px 1px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ import { PaginatorModule } from 'primeng/paginator';
|
|||||||
import { StyleClassModule } from 'primeng/styleclass';
|
import { StyleClassModule } from 'primeng/styleclass';
|
||||||
import { ToggleButtonModule } from 'primeng/togglebutton';
|
import { ToggleButtonModule } from 'primeng/togglebutton';
|
||||||
import { BusinessListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { BusinessListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { ListingCriteria, ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { ListingCriteria, ListingType, emailToDirName } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
import { ImageService } from '../../../services/image.service';
|
import { ImageService } from '../../../services/image.service';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
@@ -39,7 +39,7 @@ import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from
|
|||||||
NgOptimizedImage,
|
NgOptimizedImage,
|
||||||
],
|
],
|
||||||
templateUrl: './broker-listings.component.html',
|
templateUrl: './broker-listings.component.html',
|
||||||
styleUrl: './broker-listings.component.scss',
|
styleUrls: ['./broker-listings.component.scss', '../../pages.scss'],
|
||||||
})
|
})
|
||||||
export class BrokerListingsComponent {
|
export class BrokerListingsComponent {
|
||||||
environment = environment;
|
environment = environment;
|
||||||
@@ -58,8 +58,9 @@ export class BrokerListingsComponent {
|
|||||||
rows: number = 12;
|
rows: number = 12;
|
||||||
totalRecords: number = 0;
|
totalRecords: number = 0;
|
||||||
ts = new Date().getTime();
|
ts = new Date().getTime();
|
||||||
|
env = environment;
|
||||||
public category: 'business' | 'commercialProperty' | 'professionals_brokers' | undefined;
|
public category: 'business' | 'commercialProperty' | 'professionals_brokers' | undefined;
|
||||||
|
emailToDirName = emailToDirName;
|
||||||
constructor(
|
constructor(
|
||||||
public selectOptions: SelectOptionsService,
|
public selectOptions: SelectOptionsService,
|
||||||
private listingsService: ListingsService,
|
private listingsService: ListingsService,
|
||||||
@@ -71,16 +72,18 @@ export class BrokerListingsComponent {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
) {
|
) {
|
||||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||||
this.criteria.type = undefined;
|
|
||||||
this.route.data.subscribe(async () => {
|
this.route.data.subscribe(async () => {
|
||||||
if (this.router.getCurrentNavigation().extras.state) {
|
if (this.router.getCurrentNavigation().extras.state) {
|
||||||
resetCriteria(this.criteria);
|
resetCriteria(this.criteria);
|
||||||
|
} else {
|
||||||
|
this.first = this.criteria.page * this.criteria.length;
|
||||||
|
this.rows = this.criteria.length;
|
||||||
}
|
}
|
||||||
this.init();
|
this.init();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
const statesResult = await this.listingsService.getAllStates('business');
|
const statesResult = await this.userService.getAllStates();
|
||||||
this.states = statesResult.map(ls => ({ name: this.selectOptions.getState(ls.state as string), value: ls.state, count: ls.count }));
|
this.states = statesResult.map(ls => ({ name: this.selectOptions.getState(ls.state as string), value: ls.state, count: ls.count }));
|
||||||
}
|
}
|
||||||
async init() {
|
async init() {
|
||||||
|
|||||||
@@ -3,18 +3,7 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="grid p-4 align-items-center">
|
<div class="grid p-4 align-items-center">
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<p-dropdown
|
<p-dropdown [filter]="true" filterBy="name" [options]="states" [(ngModel)]="criteria.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="State" [style]="{ width: '100%' }">
|
||||||
[filter]="true"
|
|
||||||
filterBy="name"
|
|
||||||
[options]="states"
|
|
||||||
[(ngModel)]="criteria.state"
|
|
||||||
optionLabel="criteria.location"
|
|
||||||
optionLabel="name"
|
|
||||||
optionValue="value"
|
|
||||||
[showClear]="true"
|
|
||||||
placeholder="State"
|
|
||||||
[style]="{ width: '100%' }"
|
|
||||||
>
|
|
||||||
<ng-template let-state pTemplate="item">
|
<ng-template let-state pTemplate="item">
|
||||||
<div class="flex align-items-center gap-2">
|
<div class="flex align-items-center gap-2">
|
||||||
<div>{{ state.name }} ({{ state.count }})</div>
|
<div>{{ state.name }} ({{ state.count }})</div>
|
||||||
@@ -48,7 +37,6 @@
|
|||||||
</p-inputGroup>
|
</p-inputGroup>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-1" pTooltip="Real Estate excluded/included" tooltipPosition="top">
|
<div class="col-1" pTooltip="Real Estate excluded/included" tooltipPosition="top">
|
||||||
<!-- <p-toggleButton [(ngModel)]="checked1" onLabel="Sustainable" offLabel="Unsustainable" onIcon="pi pi-check" offIcon="pi pi-times" styleClass="mb-3 lg:mt-0 mr-4 flex-shrink-0 w-12rem"></p-toggleButton> -->
|
|
||||||
<p-toggleButton [(ngModel)]="criteria.realEstateChecked" onLabel="RE incl." offLabel="RE excl."></p-toggleButton>
|
<p-toggleButton [(ngModel)]="criteria.realEstateChecked" onLabel="RE incl." offLabel="RE excl."></p-toggleButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
@@ -62,8 +50,8 @@
|
|||||||
<div class="grid">
|
<div class="grid">
|
||||||
@for (listing of listings; track listing.id) {
|
@for (listing of listings; track listing.id) {
|
||||||
<div class="col-12 lg:col-3 p-3">
|
<div class="col-12 lg:col-3 p-3">
|
||||||
<div class="shadow-2 border-round surface-card mb-3 h-full flex-column justify-content-between flex">
|
<div class="shadow-2 border-round surface-card h-full flex-column justify-content-between flex">
|
||||||
<div class="p-4 h-full flex flex-column">
|
<div class="p-4 flex flex-column relative h-full">
|
||||||
<div class="flex align-items-center">
|
<div class="flex align-items-center">
|
||||||
<span [class]="selectOptions.getBgColorType(listing.type)" class="inline-flex border-circle align-items-center justify-content-center mr-3" style="width: 38px; height: 38px">
|
<span [class]="selectOptions.getBgColorType(listing.type)" class="inline-flex border-circle align-items-center justify-content-center mr-3" style="width: 38px; height: 38px">
|
||||||
<i [class]="selectOptions.getIconAndTextColorType(listing.type)" class="pi text-xl"></i>
|
<i [class]="selectOptions.getIconAndTextColorType(listing.type)" class="pi text-xl"></i>
|
||||||
@@ -76,8 +64,10 @@
|
|||||||
<p class="mt-0 mb-1 text-700 line-height-3">Net profit: {{ listing.cashFlow | currency }}</p>
|
<p class="mt-0 mb-1 text-700 line-height-3">Net profit: {{ listing.cashFlow | currency }}</p>
|
||||||
<p class="mt-0 mb-1 text-700 line-height-3">Location: {{ selectOptions.getState(listing.state) }}</p>
|
<p class="mt-0 mb-1 text-700 line-height-3">Location: {{ selectOptions.getState(listing.state) }}</p>
|
||||||
<p class="mt-0 mb-1 text-700 line-height-3">Established: {{ listing.established }}</p>
|
<p class="mt-0 mb-1 text-700 line-height-3">Established: {{ listing.established }}</p>
|
||||||
<div class="mt-auto ml-auto">
|
<div class="icon-pos">
|
||||||
<img src="pictures/logo/{{ listing.userId }}.avif" (error)="imageErrorHandler(listing)" class="rounded-image" />
|
<a routerLink="/details-user/{{ listing.userId }}" class="mr-2"
|
||||||
|
><img src="{{ env.imageBaseUrl }}/pictures/logo/{{ listing.imageName }}.avif?_ts={{ ts }}" (error)="imageErrorHandler(listing)" class="rounded-image"
|
||||||
|
/></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="px-4 py-3 surface-100 text-left">
|
<div class="px-4 py-3 surface-100 text-left">
|
||||||
@@ -87,7 +77,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-2 surface-200 flex align-items-center justify-content-center">
|
<div class="mb-2 surface-200 flex align-items-center justify-content-center paginator-bar">
|
||||||
<div class="mx-1 text-color">Total number of Listings: {{ totalRecords }}</div>
|
<div class="mx-1 text-color">Total number of Listings: {{ totalRecords }}</div>
|
||||||
<p-paginator (onPageChange)="onPageChange($event)" [first]="first" [rows]="rows" [totalRecords]="totalRecords" [rowsPerPageOptions]="[12, 24, 48]"></p-paginator>
|
<p-paginator (onPageChange)="onPageChange($event)" [first]="first" [rows]="rows" [totalRecords]="totalRecords" [rowsPerPageOptions]="[12, 24, 48]"></p-paginator>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,13 +10,17 @@
|
|||||||
}
|
}
|
||||||
::ng-deep p-paginator div {
|
::ng-deep p-paginator div {
|
||||||
background-color: var(--surface-200) !important;
|
background-color: var(--surface-200) !important;
|
||||||
// background-color: var(--surface-400) !important;
|
}
|
||||||
|
.icon-pos {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 1.5rem; /* Gleich dem Padding des Containers */
|
||||||
|
right: 1.5rem; /* Gleich dem Padding des Containers */
|
||||||
}
|
}
|
||||||
.rounded-image {
|
.rounded-image {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
// width: 100px;
|
// width: 100px;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
height: 45px;
|
height: 35px;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||||
padding: 1px 1px;
|
padding: 1px 1px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { StyleClassModule } from 'primeng/styleclass';
|
|||||||
import { ToggleButtonModule } from 'primeng/togglebutton';
|
import { ToggleButtonModule } from 'primeng/togglebutton';
|
||||||
import { TooltipModule } from 'primeng/tooltip';
|
import { TooltipModule } from 'primeng/tooltip';
|
||||||
import { BusinessListing } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { BusinessListing } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { ListingCriteria, ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { ListingCriteria, ListingType, emailToDirName } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
import { ImageService } from '../../../services/image.service';
|
import { ImageService } from '../../../services/image.service';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
@@ -39,7 +39,7 @@ import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from
|
|||||||
TooltipModule,
|
TooltipModule,
|
||||||
],
|
],
|
||||||
templateUrl: './business-listings.component.html',
|
templateUrl: './business-listings.component.html',
|
||||||
styleUrl: './business-listings.component.scss',
|
styleUrls: ['./business-listings.component.scss', '../../pages.scss'],
|
||||||
})
|
})
|
||||||
export class BusinessListingsComponent {
|
export class BusinessListingsComponent {
|
||||||
environment = environment;
|
environment = environment;
|
||||||
@@ -56,8 +56,9 @@ export class BusinessListingsComponent {
|
|||||||
ts = new Date().getTime();
|
ts = new Date().getTime();
|
||||||
first: number = 0;
|
first: number = 0;
|
||||||
rows: number = 12;
|
rows: number = 12;
|
||||||
|
env = environment;
|
||||||
public category: 'business' | 'commercialProperty' | 'professionals_brokers' | undefined;
|
public category: 'business' | 'commercialProperty' | 'professionals_brokers' | undefined;
|
||||||
|
emailToDirName = emailToDirName;
|
||||||
constructor(
|
constructor(
|
||||||
public selectOptions: SelectOptionsService,
|
public selectOptions: SelectOptionsService,
|
||||||
private listingsService: ListingsService,
|
private listingsService: ListingsService,
|
||||||
@@ -68,10 +69,12 @@ export class BusinessListingsComponent {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
) {
|
) {
|
||||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||||
this.criteria.type = undefined;
|
|
||||||
this.route.data.subscribe(async () => {
|
this.route.data.subscribe(async () => {
|
||||||
if (this.router.getCurrentNavigation().extras.state) {
|
if (this.router.getCurrentNavigation().extras.state) {
|
||||||
resetCriteria(this.criteria);
|
resetCriteria(this.criteria);
|
||||||
|
} else {
|
||||||
|
this.first = this.criteria.page * this.criteria.length;
|
||||||
|
this.rows = this.criteria.length;
|
||||||
}
|
}
|
||||||
this.init();
|
this.init();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -51,7 +51,11 @@
|
|||||||
<article class="flex flex-column md:flex-row w-full gap-3 p-3 surface-card">
|
<article class="flex flex-column md:flex-row w-full gap-3 p-3 surface-card">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
@if (listing.imageOrder?.length>0){
|
@if (listing.imageOrder?.length>0){
|
||||||
<img src="pictures/property/{{ listing.imagePath }}/{{ listing.imageOrder[0] }}" alt="Image" class="border-round w-full h-full md:w-12rem md:h-9rem" />
|
<img
|
||||||
|
src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.serialId }}/{{ listing.imageOrder[0] }}?_ts={{ ts }}"
|
||||||
|
alt="Image"
|
||||||
|
class="border-round w-full h-full md:w-12rem md:h-9rem"
|
||||||
|
/>
|
||||||
} @else {
|
} @else {
|
||||||
<img src="assets/images/placeholder_properties.jpg" alt="Image" class="border-round w-full h-full md:w-12rem md:h-9rem" />
|
<img src="assets/images/placeholder_properties.jpg" alt="Image" class="border-round w-full h-full md:w-12rem md:h-9rem" />
|
||||||
}
|
}
|
||||||
@@ -91,7 +95,7 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-2 surface-200 flex align-items-center justify-content-center">
|
<div class="mb-2 surface-200 flex align-items-center justify-content-center paginator-bar">
|
||||||
<!-- @if(listings && listings.length>12){ -->
|
<!-- @if(listings && listings.length>12){ -->
|
||||||
<div class="mx-1 text-color">Total number of Listings: {{ totalRecords }}</div>
|
<div class="mx-1 text-color">Total number of Listings: {{ totalRecords }}</div>
|
||||||
<p-paginator (onPageChange)="onPageChange($event)" [first]="first" [rows]="rows" [totalRecords]="totalRecords" [rowsPerPageOptions]="[12, 24, 48]"></p-paginator>
|
<p-paginator (onPageChange)="onPageChange($event)" [first]="first" [rows]="rows" [totalRecords]="totalRecords" [rowsPerPageOptions]="[12, 24, 48]"></p-paginator>
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
margin-bottom: -1px;
|
margin-bottom: -1px;
|
||||||
}
|
}
|
||||||
.search{
|
.search {
|
||||||
background-color: #343F69;
|
background-color: #343f69;
|
||||||
}
|
}
|
||||||
::ng-deep p-paginator div {
|
::ng-deep p-paginator div {
|
||||||
background-color: var(--surface-200) !important;
|
background-color: var(--surface-200) !important;
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// width: 100px;
|
// width: 100px;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
border: 1px solid rgba(0,0,0,0.2);
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||||
padding: 1px 1px;
|
padding: 1px 1px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ import { getCriteriaStateObject, getSessionStorageHandler, resetCriteria } from
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, StyleClassModule, ButtonModule, CheckboxModule, InputTextModule, DropdownModule, FormsModule, StyleClassModule, ToggleButtonModule, RouterModule, PaginatorModule, InputGroupModule],
|
imports: [CommonModule, StyleClassModule, ButtonModule, CheckboxModule, InputTextModule, DropdownModule, FormsModule, StyleClassModule, ToggleButtonModule, RouterModule, PaginatorModule, InputGroupModule],
|
||||||
templateUrl: './commercial-property-listings.component.html',
|
templateUrl: './commercial-property-listings.component.html',
|
||||||
styleUrl: './commercial-property-listings.component.scss',
|
styleUrls: ['./commercial-property-listings.component.scss', '../../pages.scss'],
|
||||||
})
|
})
|
||||||
export class CommercialPropertyListingsComponent {
|
export class CommercialPropertyListingsComponent {
|
||||||
environment = environment;
|
environment = environment;
|
||||||
@@ -42,7 +42,7 @@ export class CommercialPropertyListingsComponent {
|
|||||||
state: string;
|
state: string;
|
||||||
totalRecords: number = 0;
|
totalRecords: number = 0;
|
||||||
ts = new Date().getTime();
|
ts = new Date().getTime();
|
||||||
|
env = environment;
|
||||||
constructor(
|
constructor(
|
||||||
public selectOptions: SelectOptionsService,
|
public selectOptions: SelectOptionsService,
|
||||||
private listingsService: ListingsService,
|
private listingsService: ListingsService,
|
||||||
@@ -53,10 +53,12 @@ export class CommercialPropertyListingsComponent {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
) {
|
) {
|
||||||
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
this.criteria = onChange(getCriteriaStateObject(), getSessionStorageHandler);
|
||||||
this.criteria.type = undefined;
|
|
||||||
this.route.data.subscribe(async () => {
|
this.route.data.subscribe(async () => {
|
||||||
if (this.router.getCurrentNavigation().extras.state) {
|
if (this.router.getCurrentNavigation().extras.state) {
|
||||||
resetCriteria(this.criteria);
|
resetCriteria(this.criteria);
|
||||||
|
} else {
|
||||||
|
this.first = this.criteria.page * this.criteria.length;
|
||||||
|
this.rows = this.criteria.length;
|
||||||
}
|
}
|
||||||
this.init();
|
this.init();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,12 +47,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a (click)="logout()" routerLinkActive="text-blue-500" pRipple class="flex align-items-center cursor-pointer p-3 border-round text-800 hover:surface-200 transition-duration-150 transition-colors no-underline">
|
||||||
(click)="userService.logout()"
|
|
||||||
routerLinkActive="text-blue-500"
|
|
||||||
pRipple
|
|
||||||
class="flex align-items-center cursor-pointer p-3 border-round text-800 hover:surface-200 transition-duration-150 transition-colors no-underline"
|
|
||||||
>
|
|
||||||
<fa-icon [icon]="faRightFromBracket" class="mr-2 flex"></fa-icon>
|
<fa-icon [icon]="faRightFromBracket" class="mr-2 flex"></fa-icon>
|
||||||
<span class="font-medium hidden md:block">Logout</span>
|
<span class="font-medium hidden md:block">Logout</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,37 +1,27 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import { ButtonModule } from 'primeng/button';
|
|
||||||
import { CheckboxModule } from 'primeng/checkbox';
|
|
||||||
import { InputTextModule } from 'primeng/inputtext';
|
|
||||||
import { StyleClassModule } from 'primeng/styleclass';
|
|
||||||
import { SelectOptionsService } from '../../services/select-options.service';
|
|
||||||
import { DropdownModule } from 'primeng/dropdown';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ToggleButtonModule } from 'primeng/togglebutton';
|
import { Component } from '@angular/core';
|
||||||
import { TagModule } from 'primeng/tag';
|
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||||
import data from '../../../assets/data/listings.json';
|
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||||
import { ActivatedRoute, NavigationEnd, Router, RouterModule } from '@angular/router';
|
|
||||||
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
||||||
import { ChipModule } from 'primeng/chip';
|
|
||||||
import { DividerModule } from 'primeng/divider';
|
|
||||||
import { RippleModule } from 'primeng/ripple';
|
|
||||||
import { faEnvelope } from '@fortawesome/free-regular-svg-icons';
|
import { faEnvelope } from '@fortawesome/free-regular-svg-icons';
|
||||||
import { faRightFromBracket } from '@fortawesome/free-solid-svg-icons';
|
import { faRightFromBracket } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { UserService } from '../../services/user.service';
|
import { ButtonModule } from 'primeng/button';
|
||||||
|
import { DividerModule } from 'primeng/divider';
|
||||||
|
import { RippleModule } from 'primeng/ripple';
|
||||||
|
import { StyleClassModule } from 'primeng/styleclass';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'menu-account',
|
selector: 'menu-account',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, StyleClassModule, ButtonModule, DividerModule, RouterModule, RippleModule, FontAwesomeModule ],
|
imports: [CommonModule, StyleClassModule, ButtonModule, DividerModule, RouterModule, RippleModule, FontAwesomeModule],
|
||||||
templateUrl: './menu-account.component.html',
|
templateUrl: './menu-account.component.html',
|
||||||
styleUrl: './menu-account.component.scss'
|
styleUrl: './menu-account.component.scss',
|
||||||
})
|
})
|
||||||
export class MenuAccountComponent {
|
export class MenuAccountComponent {
|
||||||
activeLink: string;
|
activeLink: string;
|
||||||
faEnvelope=faEnvelope;
|
faEnvelope = faEnvelope;
|
||||||
faRightFromBracket=faRightFromBracket;
|
faRightFromBracket = faRightFromBracket;
|
||||||
constructor(private router: Router,public userService:UserService) {
|
constructor(private router: Router, public keycloakService: KeycloakService) {
|
||||||
// Abonniere Router-Events, um den aktiven Link zu ermitteln
|
// Abonniere Router-Events, um den aktiven Link zu ermitteln
|
||||||
this.router.events.subscribe(event => {
|
this.router.events.subscribe(event => {
|
||||||
if (event instanceof NavigationEnd) {
|
if (event instanceof NavigationEnd) {
|
||||||
@@ -39,4 +29,8 @@ export class MenuAccountComponent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
logout() {
|
||||||
|
sessionStorage.removeItem('USERID');
|
||||||
|
this.keycloakService.logout(window.location.origin + '/home');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,3 +4,13 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
:host ::ng-deep .paginator-bar {
|
||||||
|
position: sticky;
|
||||||
|
bottom: 0px;
|
||||||
|
& > button {
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Schatten-/Unschärfe-Effekt */
|
||||||
|
}
|
||||||
|
& .p-paginator {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { SharedModule } from '../../shared/shared/shared.module';
|
import { SharedModule } from '../../shared/shared/shared.module';
|
||||||
import { UserService } from '../../services/user.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-pricing',
|
selector: 'app-pricing',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [SharedModule],
|
imports: [SharedModule],
|
||||||
templateUrl: './pricing.component.html',
|
templateUrl: './pricing.component.html',
|
||||||
styleUrl: './pricing.component.scss'
|
styleUrl: './pricing.component.scss',
|
||||||
})
|
})
|
||||||
export class PricingComponent {
|
export class PricingComponent {
|
||||||
constructor(private userService:UserService){}
|
constructor(public keycloakService: KeycloakService) {}
|
||||||
register(){
|
register() {
|
||||||
this.userService.register(`${window.location.origin}/account`);
|
this.keycloakService.register({ redirectUri: `${window.location.origin}/account` });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,354 +1,191 @@
|
|||||||
<section id="content" role="main">
|
<section id="content" role="main">
|
||||||
<article
|
<article id="post-2" class="post-2 page type-page status-publish hentry pmpro-has-access">
|
||||||
id="post-2"
|
|
||||||
class="post-2 page type-page status-publish hentry pmpro-has-access"
|
|
||||||
>
|
|
||||||
<section class="entry-content">
|
<section class="entry-content">
|
||||||
<div class="container" style="padding: 3.5% 0 3.75% 0 !important">
|
<div class="container" style="padding: 3.5% 0 3.75% 0 !important">
|
||||||
<p>
|
<p>
|
||||||
<strong>Privacy Policy</strong><br />
|
<strong>Privacy Policy</strong><br />
|
||||||
We are committed to protecting your privacy. We have established this
|
We are committed to protecting your privacy. We have established this statement as a testament to our commitment to your privacy.
|
||||||
statement as a testament to our commitment to your privacy.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>This Privacy Policy relates to the use of any personal information you provide to us through this websites.</p>
|
||||||
<p>
|
<p>
|
||||||
This Privacy Policy relates to the use of any personal information you
|
By accepting the Privacy Policy during registration or the sending of an enquiry, you expressly consent to our collection, storage, use and disclosure of your personal information as described in this Privacy
|
||||||
provide to us through this websites.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
By accepting the Privacy Policy during registration or the sending of
|
|
||||||
an enquiry, you expressly consent to our collection, storage, use and
|
|
||||||
disclosure of your personal information as described in this Privacy
|
|
||||||
Policy.
|
Policy.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
We may update our Privacy Policy from time to time. Our Privacy Policy
|
We may update our Privacy Policy from time to time. Our Privacy Policy was last updated in Febuary 2018 and is effective upon acceptance for new users. By continuing to use our websites or otherwise continuing
|
||||||
was last updated in Febuary 2018 and is effective upon acceptance for
|
|
||||||
new users. By continuing to use our websites or otherwise continuing
|
|
||||||
to deal with us, you accept this Privacy Policy.
|
to deal with us, you accept this Privacy Policy.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Collection of personal information</strong><br />
|
<strong>Collection of personal information</strong><br />
|
||||||
Anyone can browse our websites without revealing any personally
|
Anyone can browse our websites without revealing any personally identifiable information.
|
||||||
identifiable information.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
However, should you wish to contact a business for sale, a franchise
|
|
||||||
opportunity or an intermediary, we will require you to provide some
|
|
||||||
personal information.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Should you wish to advertise your services, your business (es) or your
|
|
||||||
franchise opportunity, we will require you to provide some personal
|
|
||||||
information.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
By providing personal information, you are consenting to the transfer
|
|
||||||
and storage of that information on our servers located in the United
|
|
||||||
States.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>However, should you wish to contact a business for sale, a franchise opportunity or an intermediary, we will require you to provide some personal information.</p>
|
||||||
|
<p>Should you wish to advertise your services, your business (es) or your franchise opportunity, we will require you to provide some personal information.</p>
|
||||||
|
<p>By providing personal information, you are consenting to the transfer and storage of that information on our servers located in the United States.</p>
|
||||||
<p>We may collect and store the following personal information:</p>
|
<p>We may collect and store the following personal information:</p>
|
||||||
<p>
|
<p>
|
||||||
Your name, email address, physical address, telephone numbers, and
|
Your name, email address, physical address, telephone numbers, and (depending on the service used), your business information, financial information, such as credit / payment card details;<br />
|
||||||
(depending on the service used), your business information, financial
|
transactional information based on your activities on the site; information that you disclose in a forum on any of our websites, feedback, correspondence through our websites, and correspondence sent to us;<br />
|
||||||
information, such as credit / payment card details;<br />
|
other information from your interaction with our websites, services, content and advertising, including computer and connection information, statistics on page views, traffic to and from the sites, ad data, IP
|
||||||
transactional information based on your activities on the site;
|
address and standard web log information;<br />
|
||||||
information that you disclose in a forum on any of our websites,
|
supplemental information from third parties (for example, if you incur a debt, we will generally conduct a credit check by obtaining additional information about you from a credit bureau, as permitted by law;
|
||||||
feedback, correspondence through our websites, and correspondence sent
|
or if the information you provide cannot be verified,<br />
|
||||||
to us;<br />
|
we may ask you to send us additional information, or to answer additional questions online to help verify your information).
|
||||||
other information from your interaction with our websites, services,
|
|
||||||
content and advertising, including computer and connection
|
|
||||||
information, statistics on page views, traffic to and from the sites,
|
|
||||||
ad data, IP address and standard web log information;<br />
|
|
||||||
supplemental information from third parties (for example, if you incur
|
|
||||||
a debt, we will generally conduct a credit check by obtaining
|
|
||||||
additional information about you from a credit bureau, as permitted by
|
|
||||||
law; or if the information you provide cannot be verified,<br />
|
|
||||||
we may ask you to send us additional information, or to answer
|
|
||||||
additional questions online to help verify your information).
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>How we use your information</strong><br />
|
<strong>How we use your information</strong><br />
|
||||||
The primary reason we collect your personal information is to improve
|
The primary reason we collect your personal information is to improve the services we deliver to you through our website. By registering or sending an enquiry through our website, you agree that we may use your
|
||||||
the services we deliver to you through our website. By registering or
|
|
||||||
sending an enquiry through our website, you agree that we may use your
|
|
||||||
personal information to:<br />
|
personal information to:<br />
|
||||||
provide the services and customer support you request;<br />
|
provide the services and customer support you request;<br />
|
||||||
connect you with relevant parties:<br />
|
connect you with relevant parties:<br />
|
||||||
If you are a buyer we will pass some or all of your details on to the
|
If you are a buyer we will pass some or all of your details on to the seller / intermediary along with any message you have typed. This allows the seller to contact you in order to pursue a possible sale of a
|
||||||
seller / intermediary along with any message you have typed. This
|
business;<br />
|
||||||
allows the seller to contact you in order to pursue a possible sale of
|
If you are a seller / intermediary, we will disclose your details where you have given us permission to do so;<br />
|
||||||
a business;<br />
|
|
||||||
If you are a seller / intermediary, we will disclose your details
|
|
||||||
where you have given us permission to do so;<br />
|
|
||||||
resolve disputes, collect fees, and troubleshoot problems;<br />
|
resolve disputes, collect fees, and troubleshoot problems;<br />
|
||||||
prevent potentially prohibited or illegal activities, and enforce our
|
prevent potentially prohibited or illegal activities, and enforce our Terms and Conditions;<br />
|
||||||
Terms and Conditions;<br />
|
customize, measure and improve our services, conduct internal market research, provide content and advertising;<br />
|
||||||
customize, measure and improve our services, conduct internal market
|
tell you about other Biz-Match products and services, target marketing, send you service updates, and promotional offers based on your communication preferences.
|
||||||
research, provide content and advertising;<br />
|
|
||||||
tell you about other Biz-Match products and services, target
|
|
||||||
marketing, send you service updates, and promotional offers based on
|
|
||||||
your communication preferences.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Our disclosure of your information</strong><br />
|
<strong>Our disclosure of your information</strong><br />
|
||||||
We may disclose personal information to respond to legal requirements,
|
We may disclose personal information to respond to legal requirements, enforce our policies, respond to claims that a listing or other content infringes the rights of others, or protect anyone’s rights,
|
||||||
enforce our policies, respond to claims that a listing or other
|
|
||||||
content infringes the rights of others, or protect anyone’s rights,
|
|
||||||
property, or safety.
|
property, or safety.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
We may also share your personal information with<br />
|
We may also share your personal information with<br />
|
||||||
When you select to register an account as a business buyer, you
|
When you select to register an account as a business buyer, you provide your personal details and we will pass this on to a seller of a business or franchise when you request more information.
|
||||||
provide your personal details and we will pass this on to a seller of
|
|
||||||
a business or franchise when you request more information.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
When you select to register an account as a business broker or seller
|
When you select to register an account as a business broker or seller on the site, we provide a public platform on which to establish your business profile. This profile consists of pertinent facts about your
|
||||||
on the site, we provide a public platform on which to establish your
|
business along with your personal information; namely, the contact information you provide to facilitate contact between you and other users’ of the site. Direct email addresses and telephone numbers will not
|
||||||
business profile. This profile consists of pertinent facts about your
|
be publicly displayed unless you specifically include it on your profile.
|
||||||
business along with your personal information; namely, the contact
|
|
||||||
information you provide to facilitate contact between you and other
|
|
||||||
users’ of the site. Direct email addresses and telephone numbers will
|
|
||||||
not be publicly displayed unless you specifically include it on your
|
|
||||||
profile.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The information a user includes within the forums provided on the site
|
The information a user includes within the forums provided on the site is publicly available to other users’ of the site. Please be aware that any personal information you elect to provide in a public forum may
|
||||||
is publicly available to other users’ of the site. Please be aware
|
be used to send you unsolicited messages; we are not responsible for the personal information a user elects to disclose within their public profile, or in the private communications that users’ engage in on the
|
||||||
that any personal information you elect to provide in a public forum
|
site.
|
||||||
may be used to send you unsolicited messages; we are not responsible
|
|
||||||
for the personal information a user elects to disclose within their
|
|
||||||
public profile, or in the private communications that users’ engage in
|
|
||||||
on the site.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
We post testimonials on the site obtained from users’. These
|
We post testimonials on the site obtained from users’. These testimonials may include the name, city, state or region and business of the user. We obtain permission from our users’ prior to posting their
|
||||||
testimonials may include the name, city, state or region and business
|
testimonials on the site. We are not responsible for any personal information a user selects to include within their testimonial.
|
||||||
of the user. We obtain permission from our users’ prior to posting
|
|
||||||
their testimonials on the site. We are not responsible for any
|
|
||||||
personal information a user selects to include within their
|
|
||||||
testimonial.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
When you elect to email a friend about the site, or a particular
|
When you elect to email a friend about the site, or a particular business, we request the third party’s email address to send this one time email. We do not share this information with any third parties for
|
||||||
business, we request the third party’s email address to send this one
|
their promotional purposes and only store the information to gauge the effectiveness of our referral program.
|
||||||
time email. We do not share this information with any third parties
|
|
||||||
for their promotional purposes and only store the information to gauge
|
|
||||||
the effectiveness of our referral program.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>We may share your personal information with our service providers where necessary. We employ the services of a payment processor to fulfil payment for services purchased on the site.</p>
|
||||||
<p>
|
<p>
|
||||||
We may share your personal information with our service providers
|
We works with a number of partners or affiliates, where we provide marketing services for these companies. These third party agents collect your personal information to facilitate your service request and the
|
||||||
where necessary. We employ the services of a payment processor to
|
information submitted here is governed by their privacy policy.
|
||||||
fulfil payment for services purchased on the site.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
We works with a number of partners or affiliates, where we provide
|
|
||||||
marketing services for these companies. These third party agents
|
|
||||||
collect your personal information to facilitate your service request
|
|
||||||
and the information submitted here is governed by their privacy
|
|
||||||
policy.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Masking Policy</strong><br />
|
<strong>Masking Policy</strong><br />
|
||||||
In some cases, where the third party agent collects your information,
|
In some cases, where the third party agent collects your information, the affiliate portal may appear within a BizMatch.net frame. It is presented as a BizMatch.net page for a streamlined user interface however
|
||||||
the affiliate portal may appear within a BizMatch.net frame. It is
|
the data collected on such pages is governed by the third party agent’s privacy policy.
|
||||||
presented as a BizMatch.net page for a streamlined user interface
|
|
||||||
however the data collected on such pages is governed by the third
|
|
||||||
party agent’s privacy policy.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Legal Disclosure</strong><br />
|
<strong>Legal Disclosure</strong><br />
|
||||||
In certain circumstances, we may be legally required to disclose
|
In certain circumstances, we may be legally required to disclose information collected on the site to law enforcement, government agencies or other third parties. We reserve the right to disclose information to
|
||||||
information collected on the site to law enforcement, government
|
our service providers and to law enforcement or government agencies where a formal request such as in response to a court order, subpoena or judicial proceeding is made. Where we believe in good faith that
|
||||||
agencies or other third parties. We reserve the right to disclose
|
disclosure of information is necessary to prevent imminent physical or financial harm, or loss, or in protecting against illegal activity on the site, we reserve to disclose information.
|
||||||
information to our service providers and to law enforcement or
|
|
||||||
government agencies where a formal request such as in response to a
|
|
||||||
court order, subpoena or judicial proceeding is made. Where we believe
|
|
||||||
in good faith that disclosure of information is necessary to prevent
|
|
||||||
imminent physical or financial harm, or loss, or in protecting against
|
|
||||||
illegal activity on the site, we reserve to disclose information.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Should the company undergo the merger, acquisition or sale of some or
|
Should the company undergo the merger, acquisition or sale of some or all of its assets, your personal information may likely be a part of the transferred assets. In such an event, your personal information on
|
||||||
all of its assets, your personal information may likely be a part of
|
the site, would be governed by this privacy statement; any changes to the privacy practices governing your information as a result of transfer would be relayed to you by means of a prominent notice on the Site,
|
||||||
the transferred assets. In such an event, your personal information on
|
or by email.
|
||||||
the site, would be governed by this privacy statement; any changes to
|
|
||||||
the privacy practices governing your information as a result of
|
|
||||||
transfer would be relayed to you by means of a prominent notice on the
|
|
||||||
Site, or by email.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Using information from BizMatch.net website</strong><br />
|
<strong>Using information from BizMatch.net website</strong><br />
|
||||||
In certain cases, (where you are receiving contact details of buyers
|
In certain cases, (where you are receiving contact details of buyers interested in your business opportunity or a business opportunity you represent), you must comply with data protection laws, and give other
|
||||||
interested in your business opportunity or a business opportunity you
|
users a chance to remove themselves from your database and a chance to review what information you have collected about them.
|
||||||
represent), you must comply with data protection laws, and give other
|
|
||||||
users a chance to remove themselves from your database and a chance to
|
|
||||||
review what information you have collected about them.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong
|
<strong>You agree to use BizMatch.net user information only for:</strong>
|
||||||
>You agree to use BizMatch.net user information only for:</strong
|
|
||||||
>
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
BizMatch.net transaction-related purposes that are not unsolicited
|
BizMatch.net transaction-related purposes that are not unsolicited commercial messages;<br />
|
||||||
commercial messages;<br />
|
|
||||||
using services offered through BizMatch.net, or<br />
|
using services offered through BizMatch.net, or<br />
|
||||||
other purposes that a user expressly chooses.
|
other purposes that a user expressly chooses.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Marketing</strong><br />
|
<strong>Marketing</strong><br />
|
||||||
We do not sell or rent your personal information to third parties for
|
We do not sell or rent your personal information to third parties for their marketing purposes without your explicit consent. Where you explicitly express your consent at the point of collection to receive
|
||||||
their marketing purposes without your explicit consent. Where you
|
offers from third party partners or affiliates, we will communicate to you on their behalf. We will not pass your information on.
|
||||||
explicitly express your consent at the point of collection to receive
|
|
||||||
offers from third party partners or affiliates, we will communicate to
|
|
||||||
you on their behalf. We will not pass your information on.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
You will receive email marketing communications from us throughout the
|
You will receive email marketing communications from us throughout the duration of your relationship with our websites. If you do not wish to receive marketing communications from us you may unsubscribe and /
|
||||||
duration of your relationship with our websites. If you do not wish to
|
or change your preferences at any time by following instructions included within a communication or emailing Customer Services.
|
||||||
receive marketing communications from us you may unsubscribe and / or
|
|
||||||
change your preferences at any time by following instructions included
|
|
||||||
within a communication or emailing Customer Services.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>If you have an account with one of our websites you can also log in and click the email preferences link to unsubscribe and / or change your preferences.</p>
|
||||||
<p>
|
<p>
|
||||||
If you have an account with one of our websites you can also log in
|
Please note that we reserve the right to send all website users notifications and administrative emails where necessary which are considered a part of the service. Given that these messages aren’t promotional
|
||||||
and click the email preferences link to unsubscribe and / or change
|
in nature, you will be unable to opt-out of them.
|
||||||
your preferences.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Please note that we reserve the right to send all website users
|
|
||||||
notifications and administrative emails where necessary which are
|
|
||||||
considered a part of the service. Given that these messages aren’t
|
|
||||||
promotional in nature, you will be unable to opt-out of them.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Cookies</strong><br />
|
<strong>Cookies</strong><br />
|
||||||
A cookie is a small text file written to your hard drive that contains
|
A cookie is a small text file written to your hard drive that contains information about you. Cookies do not contain any personal information about users. Once you close your browser or log out of the website,
|
||||||
information about you. Cookies do not contain any personal information
|
the cookie simply terminates. We use cookies so that we can personalise your experience of our websites.
|
||||||
about users. Once you close your browser or log out of the website,
|
|
||||||
the cookie simply terminates. We use cookies so that we can
|
|
||||||
personalise your experience of our websites.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
If you set up your browser to reject the cookie, you may still use the
|
If you set up your browser to reject the cookie, you may still use the website however; doing so may interfere with your use of some aspects of our websites. Some of our business partners use cookies on our
|
||||||
website however; doing so may interfere with your use of some aspects
|
site (for example, advertisers). We have no access to or control over these cookies.
|
||||||
of our websites. Some of our business partners use cookies on our site
|
|
||||||
(for example, advertisers). We have no access to or control over these
|
|
||||||
cookies.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
For more information about how BizMatch.net uses cookies please read
|
|
||||||
our Cookie Policy.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>For more information about how BizMatch.net uses cookies please read our Cookie Policy.</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Spam, spyware or spoofing</strong><br />
|
<strong>Spam, spyware or spoofing</strong><br />
|
||||||
We and our users do not tolerate spam. Make sure to set your email
|
We and our users do not tolerate spam. Make sure to set your email preferences so we can communicate with you, as you prefer. Please add us to your safe senders list. To report spam or spoof emails, please
|
||||||
preferences so we can communicate with you, as you prefer. Please add
|
contact us using the contact information provided in the Contact Us section of this privacy statement.
|
||||||
us to your safe senders list. To report spam or spoof emails, please
|
|
||||||
contact us using the contact information provided in the Contact Us
|
|
||||||
section of this privacy statement.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
You may not use our communication tools to send spam or otherwise send
|
You may not use our communication tools to send spam or otherwise send content that would breach our Terms and Conditions. We automatically scan and may manually filter messages to check for spam, viruses,
|
||||||
content that would breach our Terms and Conditions. We automatically
|
phishing attacks and other malicious activity or illegal or prohibited content. We may also store these messages for back up purposes only.
|
||||||
scan and may manually filter messages to check for spam, viruses,
|
|
||||||
phishing attacks and other malicious activity or illegal or prohibited
|
|
||||||
content. We may also store these messages for back up purposes only.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
If you send an email to an email address that is not registered in our
|
If you send an email to an email address that is not registered in our community, we do not permanently store that email or use that email address for any marketing purpose. We do not rent or sell these email
|
||||||
community, we do not permanently store that email or use that email
|
|
||||||
address for any marketing purpose. We do not rent or sell these email
|
|
||||||
addresses.
|
addresses.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Account protection</strong><br />
|
<strong>Account protection</strong><br />
|
||||||
Your password is the key to your account. Make sure this is stored
|
Your password is the key to your account. Make sure this is stored safely. Use unique numbers, letters and special characters, and do not disclose your password to anyone. If you do share your password or your
|
||||||
safely. Use unique numbers, letters and special characters, and do not
|
personal information with others, remember that you are responsible for all actions taken in the name of your account. If you lose control of your password, you may lose substantial control over your personal
|
||||||
disclose your password to anyone. If you do share your password or
|
information and may be subject to legally binding actions taken on your behalf. Therefore, if your password has been compromised for any reason, you should immediately notify us and change your password.
|
||||||
your personal information with others, remember that you are
|
|
||||||
responsible for all actions taken in the name of your account. If you
|
|
||||||
lose control of your password, you may lose substantial control over
|
|
||||||
your personal information and may be subject to legally binding
|
|
||||||
actions taken on your behalf. Therefore, if your password has been
|
|
||||||
compromised for any reason, you should immediately notify us and
|
|
||||||
change your password.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong
|
<strong>Accessing, reviewing and changing your personal information</strong><br />
|
||||||
>Accessing, reviewing and changing your personal information</strong
|
You can view and amend your personal information at any time by logging in to your account online. You must promptly update your personal information if it changes or is inaccurate.
|
||||||
><br />
|
|
||||||
You can view and amend your personal information at any time by
|
|
||||||
logging in to your account online. You must promptly update your
|
|
||||||
personal information if it changes or is inaccurate.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>If at any time you wish to close your account, please contact Customer Services and instruct us to do so. We will process your request as soon as we can.</p>
|
||||||
|
<p>You may also contact us at any time to find out what information we hold about you, what we do with it and ask us to update it for you.</p>
|
||||||
<p>
|
<p>
|
||||||
If at any time you wish to close your account, please contact Customer
|
We do retain personal information from closed accounts to comply with law, prevent fraud, collect any fees owed, resolve disputes, troubleshoot problems, assist with any investigations, enforce our Terms and
|
||||||
Services and instruct us to do so. We will process your request as
|
Conditions, and take other actions otherwise permitted by law.
|
||||||
soon as we can.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
You may also contact us at any time to find out what information we
|
|
||||||
hold about you, what we do with it and ask us to update it for you.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
We do retain personal information from closed accounts to comply with
|
|
||||||
law, prevent fraud, collect any fees owed, resolve disputes,
|
|
||||||
troubleshoot problems, assist with any investigations, enforce our
|
|
||||||
Terms and Conditions, and take other actions otherwise permitted by
|
|
||||||
law.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Security</strong><br />
|
<strong>Security</strong><br />
|
||||||
Your information is stored on our servers located in the USA. We treat
|
Your information is stored on our servers located in the USA. We treat data as an asset that must be protected and use a variety of tools (encryption, passwords, physical security, etc.) to protect your
|
||||||
data as an asset that must be protected and use a variety of tools
|
personal information against unauthorized access and disclosure. However, no method of security is 100% effective and while we take every measure to protect your personal information, we make no guarantees of
|
||||||
(encryption, passwords, physical security, etc.) to protect your
|
its absolute security.
|
||||||
personal information against unauthorized access and disclosure.
|
|
||||||
However, no method of security is 100% effective and while we take
|
|
||||||
every measure to protect your personal information, we make no
|
|
||||||
guarantees of its absolute security.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
We employ the use of SSL encryption during the transmission of
|
|
||||||
sensitive data across our websites.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>We employ the use of SSL encryption during the transmission of sensitive data across our websites.</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Third parties</strong><br />
|
<strong>Third parties</strong><br />
|
||||||
Except as otherwise expressly included in this Privacy Policy, this
|
Except as otherwise expressly included in this Privacy Policy, this document addresses only the use and disclosure of information we collect from you. If you disclose your information to others, whether they
|
||||||
document addresses only the use and disclosure of information we
|
are buyers or sellers on our websites or other sites throughout the internet, different rules may apply to their use or disclosure of the information you disclose to them. Dynamis does not control the privacy
|
||||||
collect from you. If you disclose your information to others, whether
|
policies of third parties, and you are subject to the privacy policies of those third parties where applicable.
|
||||||
they are buyers or sellers on our websites or other sites throughout
|
|
||||||
the internet, different rules may apply to their use or disclosure of
|
|
||||||
the information you disclose to them. Dynamis does not control the
|
|
||||||
privacy policies of third parties, and you are subject to the privacy
|
|
||||||
policies of those third parties where applicable.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
We encourage you to ask questions before you disclose your personal
|
|
||||||
information to others.
|
|
||||||
</p>
|
</p>
|
||||||
|
<p>We encourage you to ask questions before you disclose your personal information to others.</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>General</strong><br />
|
<strong>General</strong><br />
|
||||||
We may change this Privacy Policy from time to time as we add new
|
We may change this Privacy Policy from time to time as we add new products and applications, as we improve our current offerings, and as technologies and laws change. You can determine when this Privacy Policy
|
||||||
products and applications, as we improve our current offerings, and as
|
was last revised by referring to the “Last Updated” legend at the top of this page.
|
||||||
technologies and laws change. You can determine when this Privacy
|
|
||||||
Policy was last revised by referring to the “Last Updated” legend at
|
|
||||||
the top of this page.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Any changes will become effective upon our posting of the revised
|
Any changes will become effective upon our posting of the revised Privacy Policy on our affected websites. We will provide notice to you if these changes are material and, where required by applicable law, we
|
||||||
Privacy Policy on our affected websites. We will provide notice to you
|
will obtain your consent. This notice may be provided by email, by posting notice of the changes on our affected websites or by other means, consistent with applicable laws.
|
||||||
if these changes are material and, where required by applicable law,
|
|
||||||
we will obtain your consent. This notice may be provided by email, by
|
|
||||||
posting notice of the changes on our affected websites or by other
|
|
||||||
means, consistent with applicable laws.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Contact Us</strong><br />
|
<strong>Contact Us</strong><br />
|
||||||
If you have any questions or comments about our privacy policy, and
|
If you have any questions or comments about our privacy policy, and you can’t find the answer to your question on our help pages, please contact us using this form or email support@bizmatch.net, or write to
|
||||||
you can’t find the answer to your question on our help pages, please
|
|
||||||
contact us using this form or email support@bizmatch.net, or write to
|
|
||||||
us at BizMatch, 715 S. Tanahua, Corpus Christi, TX 78401.)
|
us at BizMatch, 715 S. Tanahua, Corpus Christi, TX 78401.)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,10 +8,16 @@
|
|||||||
<div class="flex gap-5 flex-column-reverse md:flex-row">
|
<div class="flex gap-5 flex-column-reverse md:flex-row">
|
||||||
<div class="flex-auto p-fluid">
|
<div class="flex-auto p-fluid">
|
||||||
@if (user){
|
@if (user){
|
||||||
<div class="mb-4">
|
<div class="grid">
|
||||||
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="state" class="block font-medium text-900 mb-2">E-mail (required)</label>
|
<label for="state" class="block font-medium text-900 mb-2">E-mail (required)</label>
|
||||||
<input id="state" type="text" [disabled]="true" pInputText [(ngModel)]="user.email" />
|
<input id="state" type="text" [disabled]="true" pInputText [(ngModel)]="user.email" />
|
||||||
<p class="font-italic text-sm line-height-1">You can only modify your email by contacting us at support@bizmatch.net</p>
|
<p class="font-italic text-xs line-height-1">You can only modify your email by contacting us at support@bizmatch.net</p>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4 col-12 md:col-6">
|
||||||
|
<label for="customerType" class="block font-medium text-900 mb-2">Customer Type</label>
|
||||||
|
<p-dropdown id="customerType" [options]="selectOptions?.customerTypes" [(ngModel)]="user.customerType" optionLabel="name" optionValue="value" placeholder="State" [style]="{ width: '100%' }"></p-dropdown>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
@@ -23,6 +29,7 @@
|
|||||||
<input id="lastname" type="text" pInputText [(ngModel)]="user.lastname" />
|
<input id="lastname" type="text" pInputText [(ngModel)]="user.lastname" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@if (isProfessional){
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="firstname" class="block font-medium text-900 mb-2">Company Name</label>
|
<label for="firstname" class="block font-medium text-900 mb-2">Company Name</label>
|
||||||
@@ -33,10 +40,11 @@
|
|||||||
<input id="lastname" type="text" pInputText [(ngModel)]="user.description" />
|
<input id="lastname" type="text" pInputText [(ngModel)]="user.description" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
} @if (isProfessional){
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-4">
|
<div class="mb-4 col-12 md:col-4">
|
||||||
<label for="phoneNumber" class="block font-medium text-900 mb-2">Your Phone Number</label>
|
<label for="phoneNumber" class="block font-medium text-900 mb-2">Your Phone Number</label>
|
||||||
<input id="phoneNumber" type="text" pInputText [(ngModel)]="user.phoneNumber" />
|
<p-inputMask mask="(999) 999-9999" placeholder="(123) 456-7890" [(ngModel)]="user.phoneNumber"></p-inputMask>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 col-12 md:col-4">
|
<div class="mb-4 col-12 md:col-4">
|
||||||
<label for="companyWebsite" class="block font-medium text-900 mb-2">Company Website</label>
|
<label for="companyWebsite" class="block font-medium text-900 mb-2">Company Website</label>
|
||||||
@@ -47,6 +55,14 @@
|
|||||||
<p-autoComplete [(ngModel)]="user.companyLocation" [suggestions]="suggestions" (completeMethod)="search($event)"></p-autoComplete>
|
<p-autoComplete [(ngModel)]="user.companyLocation" [suggestions]="suggestions" (completeMethod)="search($event)"></p-autoComplete>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="grid">
|
||||||
|
<div class="mb-4 col-12 md:col-6">
|
||||||
|
<label for="phoneNumber" class="block font-medium text-900 mb-2">Your Phone Number</label>
|
||||||
|
<p-inputMask mask="(999) 999-9999" placeholder="(123) 456-7890" [(ngModel)]="user.phoneNumber"></p-inputMask>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
} @if (isProfessional){
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="companyOverview" class="block font-medium text-900 mb-2">Company Overview</label>
|
<label for="companyOverview" class="block font-medium text-900 mb-2">Company Overview</label>
|
||||||
<p-editor [(ngModel)]="user.companyOverview" [style]="{ height: '320px' }" [modules]="editorModules">
|
<p-editor [(ngModel)]="user.companyOverview" [style]="{ height: '320px' }" [modules]="editorModules">
|
||||||
@@ -59,29 +75,54 @@
|
|||||||
<ng-template pTemplate="header"></ng-template>
|
<ng-template pTemplate="header"></ng-template>
|
||||||
</p-editor>
|
</p-editor>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="areasServed" class="block font-medium text-900 mb-2">Areas We Serve</label>
|
<label for="areasServed" class="block font-medium text-900 mb-2">Areas We Serve</label>
|
||||||
<textarea id="areasServed" type="text" pInputTextarea rows="5" [autoResize]="true" [(ngModel)]="user.areasServed"></textarea>
|
@for (areasServed of user.areasServed; track areasServed){
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="companyOverview" class="block font-medium text-900 mb-2">Licensed In</label>
|
|
||||||
@for (licensedIn of userLicensedIn; track licensedIn.value){
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="flex col-12 md:col-6">
|
<div class="flex col-12 md:col-6">
|
||||||
<p-dropdown
|
<p-dropdown
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
id="states"
|
id="states"
|
||||||
[options]="selectOptions?.states"
|
[options]="selectOptions?.states"
|
||||||
[(ngModel)]="licensedIn.name"
|
[(ngModel)]="areasServed.state"
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
[showClear]="true"
|
|
||||||
placeholder="State"
|
placeholder="State"
|
||||||
[ngStyle]="{ width: '100%' }"
|
[ngStyle]="{ width: '100%' }"
|
||||||
></p-dropdown>
|
></p-dropdown>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex col-12 md:col-6">
|
<div class="flex col-12 md:col-6">
|
||||||
<input id="companyWebsite" type="text" pInputText [(ngModel)]="licensedIn.value" placeholder="Licence Number" />
|
<input id="county" type="text" pInputText [(ngModel)]="areasServed.county" placeholder="Area/County Served" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="field mb-5 col-12 md:col-6 flex align-items-center">
|
||||||
|
<p-button class="mr-1" icon="pi pi-plus" severity="success" (click)="addArea()"></p-button>
|
||||||
|
<p-button icon="pi pi-minus" severity="danger" (click)="removeArea()" [disabled]="user.areasServed?.length < 2"></p-button>
|
||||||
|
<span class="text-xs"> (Add more Areas or remove existing ones.)</span>
|
||||||
|
<!-- <button pButton pRipple label="Add Licence" class="w-auto" (click)="addLicence()"></button> -->
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="companyOverview" class="block font-medium text-900 mb-2">Licensed In</label>
|
||||||
|
@for (licensedIn of user.licensedIn; track licensedIn){
|
||||||
|
<div class="grid">
|
||||||
|
<div class="flex col-12 md:col-6">
|
||||||
|
<p-dropdown
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
|
id="states"
|
||||||
|
[options]="selectOptions?.states"
|
||||||
|
[(ngModel)]="licensedIn.state"
|
||||||
|
optionLabel="name"
|
||||||
|
optionValue="value"
|
||||||
|
placeholder="State"
|
||||||
|
[ngStyle]="{ width: '100%' }"
|
||||||
|
></p-dropdown>
|
||||||
|
</div>
|
||||||
|
<div class="flex col-12 md:col-6">
|
||||||
|
<input id="registerNo" type="text" pInputText [(ngModel)]="licensedIn.registerNo" placeholder="Licence Number" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -92,17 +133,21 @@
|
|||||||
<span class="text-xs"> (Add more licenses or remove existing ones.)</span>
|
<span class="text-xs"> (Add more licenses or remove existing ones.)</span>
|
||||||
<!-- <button pButton pRipple label="Add Licence" class="w-auto" (click)="addLicence()"></button> -->
|
<!-- <button pButton pRipple label="Add Licence" class="w-auto" (click)="addLicence()"></button> -->
|
||||||
</div>
|
</div>
|
||||||
}
|
} }
|
||||||
<div>
|
<div>
|
||||||
<button pButton pRipple label="Update Profile" class="w-auto" (click)="updateProfile(user)"></button>
|
<button pButton pRipple label="Update Profile" class="w-auto" (click)="updateProfile(user)"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@if (isProfessional){
|
||||||
<div>
|
<div>
|
||||||
<div class="flex flex-column align-items-center flex-or mb-8">
|
<div class="flex flex-column align-items-center flex-or mb-8">
|
||||||
<span class="font-medium text-900 mb-2">Company Logo</span>
|
<span class="font-medium text-900 mb-2">Company Logo</span>
|
||||||
<span class="font-medium text-xs mb-2">(is shown in every offer)</span>
|
<span class="font-medium text-xs mb-2">(is shown in every offer)</span>
|
||||||
@if(user?.hasCompanyLogo){
|
@if(user?.hasCompanyLogo){
|
||||||
|
<div class="image-wrap">
|
||||||
<img src="{{ companyLogoUrl }}" class="rounded-profile" />
|
<img src="{{ companyLogoUrl }}" class="rounded-profile" />
|
||||||
|
<fa-icon [icon]="faTrash" (click)="deleteConfirm('logo')"></fa-icon>
|
||||||
|
</div>
|
||||||
<!-- <img src="profile/{{ user.id }}.avif" class="rounded-profile" /> -->
|
<!-- <img src="profile/{{ user.id }}.avif" class="rounded-profile" /> -->
|
||||||
} @else {
|
} @else {
|
||||||
<img src="assets/images/placeholder.png" class="rounded-profile" />
|
<img src="assets/images/placeholder.png" class="rounded-profile" />
|
||||||
@@ -123,7 +168,10 @@
|
|||||||
<div class="flex flex-column align-items-center flex-or">
|
<div class="flex flex-column align-items-center flex-or">
|
||||||
<span class="font-medium text-900 mb-2">Your Profile Picture</span>
|
<span class="font-medium text-900 mb-2">Your Profile Picture</span>
|
||||||
@if(user?.hasProfile){
|
@if(user?.hasProfile){
|
||||||
|
<div class="image-wrap">
|
||||||
<img src="{{ profileUrl }}" class="rounded-profile" />
|
<img src="{{ profileUrl }}" class="rounded-profile" />
|
||||||
|
<fa-icon [icon]="faTrash" (click)="deleteConfirm('profile')"></fa-icon>
|
||||||
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
<img src="assets/images/person_placeholder.jpg" class="rounded-profile" />
|
<img src="assets/images/person_placeholder.jpg" class="rounded-profile" />
|
||||||
}
|
}
|
||||||
@@ -140,6 +188,7 @@
|
|||||||
></p-fileUpload>
|
></p-fileUpload>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-900 font-semibold text-lg mt-3">Membership Level</div>
|
<div class="text-900 font-semibold text-lg mt-3">Membership Level</div>
|
||||||
<p-divider></p-divider>
|
<p-divider></p-divider>
|
||||||
@@ -202,3 +251,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p-confirmDialog></p-confirmDialog>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
border: 1px solid #6b7280;
|
border: 1px solid #6b7280;
|
||||||
padding: 1px 1px;
|
padding: 1px 1px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
.rounded-profile {
|
.rounded-profile {
|
||||||
// @extend .rounded-logo;
|
// @extend .rounded-logo;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
@@ -15,6 +15,22 @@
|
|||||||
padding: 1px 1px;
|
padding: 1px 1px;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
.wfull{
|
.wfull {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.image-wrap {
|
||||||
|
position: relative; /* Ermöglicht die absolute Positionierung des Icons bezogen auf diesen Container */
|
||||||
|
display: inline-block; /* Erlaubt die Inline-Anordnung, falls mehrere Bilder vorhanden sind */
|
||||||
|
}
|
||||||
|
/* Stil für das FontAwesome Icon */
|
||||||
|
.image-wrap fa-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: -5px; /* Positioniert das Icon am oberen Rand des Bildes */
|
||||||
|
right: -18px; /* Positioniert das Icon am rechten Rand des Bildes */
|
||||||
|
color: #fff; /* Weiße Farbe für das Icon */
|
||||||
|
background-color: rgba(0, 0, 0, 0.5); /* Halbtransparenter Hintergrund für bessere Sichtbarkeit */
|
||||||
|
padding: 5px; /* Ein wenig Platz um das Icon */
|
||||||
|
cursor: pointer; /* Verwandelt den Cursor in eine Hand, um Interaktivität anzudeuten */
|
||||||
|
border-radius: 8px; /* Optional: Abrunden der linken unteren Ecke für ästhetische Zwecke */
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
import { HttpEventType } from '@angular/common/http';
|
import { HttpEventType } from '@angular/common/http';
|
||||||
import { ChangeDetectorRef, Component, ViewChild } from '@angular/core';
|
import { ChangeDetectorRef, Component, ViewChild } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { AngularCropperjsModule } from 'angular-cropperjs';
|
import { AngularCropperjsModule } from 'angular-cropperjs';
|
||||||
import { MessageService } from 'primeng/api';
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
|
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||||
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
||||||
import { DialogModule } from 'primeng/dialog';
|
import { DialogModule } from 'primeng/dialog';
|
||||||
import { DialogService, DynamicDialogModule, DynamicDialogRef } from 'primeng/dynamicdialog';
|
import { DialogService, DynamicDialogModule, DynamicDialogRef } from 'primeng/dynamicdialog';
|
||||||
import { EditorModule } from 'primeng/editor';
|
import { EditorModule } from 'primeng/editor';
|
||||||
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
||||||
|
import { InputMaskModule } from 'primeng/inputmask';
|
||||||
import { SelectButtonModule } from 'primeng/selectbutton';
|
import { SelectButtonModule } from 'primeng/selectbutton';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { AutoCompleteCompleteEvent, Invoice, KeyValue, Subscription } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { AutoCompleteCompleteEvent, Invoice, Subscription, emailToDirName } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
import { ImageCropperComponent, stateOptions } from '../../../components/image-cropper/image-cropper.component';
|
import { ImageCropperComponent, stateOptions } from '../../../components/image-cropper/image-cropper.component';
|
||||||
import { GeoService } from '../../../services/geo.service';
|
import { GeoService } from '../../../services/geo.service';
|
||||||
@@ -20,12 +24,13 @@ import { SelectOptionsService } from '../../../services/select-options.service';
|
|||||||
import { SubscriptionsService } from '../../../services/subscriptions.service';
|
import { SubscriptionsService } from '../../../services/subscriptions.service';
|
||||||
import { UserService } from '../../../services/user.service';
|
import { UserService } from '../../../services/user.service';
|
||||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||||
|
import { getDialogWidth, getImageDimensions, map2User } from '../../../utils/utils';
|
||||||
import { TOOLBAR_OPTIONS } from '../../utils/defaults';
|
import { TOOLBAR_OPTIONS } from '../../utils/defaults';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-account',
|
selector: 'app-account',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [SharedModule, FileUploadModule, EditorModule, AngularCropperjsModule, DialogModule, SelectButtonModule, DynamicDialogModule],
|
imports: [SharedModule, FileUploadModule, EditorModule, AngularCropperjsModule, DialogModule, SelectButtonModule, DynamicDialogModule, ConfirmDialogModule, InputMaskModule],
|
||||||
providers: [MessageService, DialogService],
|
providers: [MessageService, DialogService, ConfirmationService],
|
||||||
templateUrl: './account.component.html',
|
templateUrl: './account.component.html',
|
||||||
styleUrl: './account.component.scss',
|
styleUrl: './account.component.scss',
|
||||||
})
|
})
|
||||||
@@ -36,14 +41,15 @@ export class AccountComponent {
|
|||||||
user: User;
|
user: User;
|
||||||
subscriptions: Array<Subscription>;
|
subscriptions: Array<Subscription>;
|
||||||
userSubscriptions: Array<Subscription> = [];
|
userSubscriptions: Array<Subscription> = [];
|
||||||
maxFileSize = 1000000;
|
maxFileSize = 15000000;
|
||||||
companyLogoUrl: string;
|
companyLogoUrl: string;
|
||||||
profileUrl: string;
|
profileUrl: string;
|
||||||
type: 'company' | 'profile';
|
type: 'company' | 'profile';
|
||||||
dialogRef: DynamicDialogRef | undefined;
|
dialogRef: DynamicDialogRef | undefined;
|
||||||
environment = environment;
|
environment = environment;
|
||||||
editorModules = TOOLBAR_OPTIONS;
|
editorModules = TOOLBAR_OPTIONS;
|
||||||
userLicensedIn: KeyValue[];
|
env = environment;
|
||||||
|
faTrash = faTrash;
|
||||||
constructor(
|
constructor(
|
||||||
public userService: UserService,
|
public userService: UserService,
|
||||||
private subscriptionService: SubscriptionsService,
|
private subscriptionService: SubscriptionsService,
|
||||||
@@ -55,43 +61,43 @@ export class AccountComponent {
|
|||||||
private loadingService: LoadingService,
|
private loadingService: LoadingService,
|
||||||
private imageUploadService: ImageService,
|
private imageUploadService: ImageService,
|
||||||
public dialogService: DialogService,
|
public dialogService: DialogService,
|
||||||
|
private confirmationService: ConfirmationService,
|
||||||
|
private imageService: ImageService,
|
||||||
|
private keycloakService: KeycloakService,
|
||||||
) {}
|
) {}
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
const keycloakUser = this.userService.getKeycloakUser();
|
if (this.id) {
|
||||||
|
this.user = await this.userService.getById(this.id);
|
||||||
|
} else {
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
const keycloakUser = map2User(token);
|
||||||
const email = keycloakUser.email;
|
const email = keycloakUser.email;
|
||||||
try {
|
try {
|
||||||
this.user = await this.userService.getByMail(email);
|
this.user = await this.userService.getByMail(email);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.user = { email, firstname: keycloakUser.firstname, lastname: keycloakUser.lastname };
|
this.user = { email, firstname: keycloakUser.firstName, lastname: keycloakUser.lastName, areasServed: [], licensedIn: [], companyOverview: '', offeredServices: '', customerType: 'broker' };
|
||||||
this.user = await this.userService.save(this.user);
|
this.user = await this.userService.save(this.user);
|
||||||
}
|
}
|
||||||
this.userLicensedIn = this.user.licensedIn
|
|
||||||
? this.user.licensedIn.map(l => {
|
|
||||||
return { name: l.split('|')[0], value: l.split('|')[1] };
|
|
||||||
})
|
|
||||||
: [];
|
|
||||||
this.userSubscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions());
|
|
||||||
if (!this.user.licensedIn || this.user.licensedIn?.length === 0) {
|
|
||||||
this.user.licensedIn = [''];
|
|
||||||
}
|
}
|
||||||
this.profileUrl = this.user.hasProfile ? `pictures/profile/${this.user.id}.avif` : `/assets/images/placeholder.png`;
|
|
||||||
this.companyLogoUrl = this.user.hasCompanyLogo ? `pictures/logo/${this.user.id}.avif` : `/assets/images/placeholder.png`;
|
this.userSubscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(this.user.id));
|
||||||
|
this.profileUrl = this.user.hasProfile ? `${this.env.imageBaseUrl}/pictures/profile/${emailToDirName(this.user.email)}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||||
|
this.companyLogoUrl = this.user.hasCompanyLogo ? `${this.env.imageBaseUrl}/pictures/logo/${emailToDirName(this.user.email)}.avif?_ts=${new Date().getTime()}` : `/assets/images/placeholder.png`;
|
||||||
}
|
}
|
||||||
printInvoice(invoice: Invoice) {}
|
printInvoice(invoice: Invoice) {}
|
||||||
|
|
||||||
async updateProfile(user: User) {
|
async updateProfile(user: User) {
|
||||||
this.user.licensedIn = this.userLicensedIn.map(l => `${l.name}|${l.value}`);
|
|
||||||
await this.userService.save(this.user);
|
await this.userService.save(this.user);
|
||||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Acount changes have been persisted', life: 3000 });
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Account changes have been persisted', life: 3000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
onUploadCompanyLogo(event: any) {
|
onUploadCompanyLogo(event: any) {
|
||||||
const uniqueSuffix = '?_ts=' + new Date().getTime();
|
const uniqueSuffix = '?_ts=' + new Date().getTime();
|
||||||
this.companyLogoUrl = `pictures/logo/${this.user.id}${uniqueSuffix}`;
|
this.companyLogoUrl = `${this.env.imageBaseUrl}/pictures/logo/${emailToDirName(this.user.email)}${uniqueSuffix}`;
|
||||||
}
|
}
|
||||||
onUploadProfilePicture(event: any) {
|
onUploadProfilePicture(event: any) {
|
||||||
const uniqueSuffix = '?_ts=' + new Date().getTime();
|
const uniqueSuffix = '?_ts=' + new Date().getTime();
|
||||||
this.profileUrl = `pictures/profile/${this.user.id}${uniqueSuffix}`;
|
this.profileUrl = `${this.env.imageBaseUrl}/pictures/profile/${emailToDirName(this.user.email)}${uniqueSuffix}`;
|
||||||
}
|
}
|
||||||
setImageToFallback(event: Event) {
|
setImageToFallback(event: Event) {
|
||||||
(event.target as HTMLImageElement).src = `/assets/images/placeholder.png`; // Pfad zum Platzhalterbild
|
(event.target as HTMLImageElement).src = `/assets/images/placeholder.png`; // Pfad zum Platzhalterbild
|
||||||
@@ -104,16 +110,27 @@ export class AccountComponent {
|
|||||||
this.suggestions = result.map(r => `${r.city} - ${r.state_code}`).slice(0, 5);
|
this.suggestions = result.map(r => `${r.city} - ${r.state_code}`).slice(0, 5);
|
||||||
}
|
}
|
||||||
addLicence() {
|
addLicence() {
|
||||||
this.userLicensedIn.push({ name: '', value: '' });
|
this.user.licensedIn.push({ registerNo: '', state: '' });
|
||||||
}
|
}
|
||||||
removeLicence() {
|
removeLicence() {
|
||||||
this.userLicensedIn.splice(this.user.licensedIn.length - 2, 1);
|
this.user.licensedIn.splice(this.user.licensedIn.length - 1, 1);
|
||||||
|
}
|
||||||
|
addArea() {
|
||||||
|
this.user.areasServed.push({ county: '', state: '' });
|
||||||
|
}
|
||||||
|
removeArea() {
|
||||||
|
this.user.areasServed.splice(this.user.areasServed.length - 1, 1);
|
||||||
|
}
|
||||||
|
get isProfessional() {
|
||||||
|
return this.user.customerType === 'broker' || this.user.customerType === 'professional';
|
||||||
}
|
}
|
||||||
|
|
||||||
select(event: any, type: 'company' | 'profile') {
|
select(event: any, type: 'company' | 'profile') {
|
||||||
const imageUrl = URL.createObjectURL(event.files[0]);
|
const imageUrl = URL.createObjectURL(event.files[0]);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
const config = { aspectRatio: type === 'company' ? stateOptions[0].value : stateOptions[2].value };
|
const config = { aspectRatio: type === 'company' ? stateOptions[0].value : stateOptions[2].value };
|
||||||
|
getImageDimensions(imageUrl).then(dimensions => {
|
||||||
|
const dialogWidth = getDialogWidth(dimensions);
|
||||||
|
|
||||||
this.dialogRef = this.dialogService.open(ImageCropperComponent, {
|
this.dialogRef = this.dialogService.open(ImageCropperComponent, {
|
||||||
data: {
|
data: {
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
@@ -122,31 +139,28 @@ export class AccountComponent {
|
|||||||
ratioVariable: type === 'company' ? true : false,
|
ratioVariable: type === 'company' ? true : false,
|
||||||
},
|
},
|
||||||
header: 'Edit Image',
|
header: 'Edit Image',
|
||||||
width: '50vw',
|
width: dialogWidth,
|
||||||
modal: true,
|
modal: true,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
keepInViewport: true,
|
keepInViewport: true,
|
||||||
closable: false,
|
closable: false,
|
||||||
breakpoints: {
|
|
||||||
'960px': '75vw',
|
|
||||||
'640px': '90vw',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
this.dialogRef.onClose.subscribe(cropper => {
|
this.dialogRef.onClose.subscribe(cropper => {
|
||||||
if (cropper) {
|
if (cropper) {
|
||||||
this.loadingService.startLoading('uploadImage');
|
this.loadingService.startLoading('uploadImage');
|
||||||
cropper.getCroppedCanvas().toBlob(async blob => {
|
cropper.getCroppedCanvas().toBlob(async blob => {
|
||||||
this.imageUploadService.uploadImage(blob, type === 'company' ? 'uploadCompanyLogo' : 'uploadProfile', this.user.id).subscribe(
|
this.imageUploadService.uploadImage(blob, type === 'company' ? 'uploadCompanyLogo' : 'uploadProfile', emailToDirName(this.user.email)).subscribe(
|
||||||
async event => {
|
async event => {
|
||||||
if (event.type === HttpEventType.Response) {
|
if (event.type === HttpEventType.Response) {
|
||||||
this.loadingService.stopLoading('uploadImage');
|
this.loadingService.stopLoading('uploadImage');
|
||||||
if (this.type === 'company') {
|
if (this.type === 'company') {
|
||||||
this.user.hasCompanyLogo = true; //
|
this.user.hasCompanyLogo = true; //
|
||||||
this.companyLogoUrl = `${environment.apiBaseUrl}/logo/${this.user.id}.avif?_ts=${new Date().getTime()}`;
|
this.companyLogoUrl = `${this.env.imageBaseUrl}/pictures/logo/${emailToDirName(this.user.email)}.avif?_ts=${new Date().getTime()}`;
|
||||||
} else {
|
} else {
|
||||||
this.user.hasProfile = true;
|
this.user.hasProfile = true;
|
||||||
this.profileUrl = `${environment.apiBaseUrl}/profile/${this.user.id}.avif?_ts=${new Date().getTime()}`;
|
this.profileUrl = `${this.env.imageBaseUrl}/pictures/profile/${emailToDirName(this.user.email)}.avif?_ts=${new Date().getTime()}`;
|
||||||
}
|
}
|
||||||
|
await this.userService.save(this.user);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => console.error('Fehler beim Upload:', error),
|
error => console.error('Fehler beim Upload:', error),
|
||||||
@@ -154,5 +168,33 @@ export class AccountComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
deleteConfirm(type: 'profile' | 'logo') {
|
||||||
|
this.confirmationService.confirm({
|
||||||
|
target: event.target as EventTarget,
|
||||||
|
message: `Do you want to delete your ${type === 'logo' ? 'Logo' : 'Profile'} image`,
|
||||||
|
header: 'Delete Confirmation',
|
||||||
|
icon: 'pi pi-info-circle',
|
||||||
|
acceptButtonStyleClass: 'p-button-danger p-button-text',
|
||||||
|
rejectButtonStyleClass: 'p-button-text p-button-text',
|
||||||
|
acceptIcon: 'none',
|
||||||
|
rejectIcon: 'none',
|
||||||
|
|
||||||
|
accept: async () => {
|
||||||
|
if (type === 'profile') {
|
||||||
|
this.user.hasProfile = false;
|
||||||
|
await Promise.all([this.imageService.deleteProfileImagesById(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)]);
|
||||||
|
}
|
||||||
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Image deleted' });
|
||||||
|
this.user = await this.userService.getById(this.user.id);
|
||||||
|
},
|
||||||
|
reject: () => {
|
||||||
|
console.log('deny');
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="description" class="block font-medium text-900 mb-2">Description</label>
|
<label for="description" class="block font-medium text-900 mb-2">Description</label>
|
||||||
<!-- <textarea id="description" type="text" pInputTextarea rows="5" [autoResize]="true" [(ngModel)]="listing.description"></textarea> -->
|
|
||||||
<p-editor [(ngModel)]="listing.description" [style]="{ height: '320px' }" [modules]="editorModules">
|
<p-editor [(ngModel)]="listing.description" [style]="{ height: '320px' }" [modules]="editorModules">
|
||||||
<ng-template pTemplate="header"></ng-template>
|
<ng-template pTemplate="header"></ng-template>
|
||||||
</p-editor>
|
</p-editor>
|
||||||
@@ -36,13 +35,26 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="type" class="block font-medium text-900 mb-2">Type of business</label>
|
<label for="type" class="block font-medium text-900 mb-2">Type of business</label>
|
||||||
<p-dropdown id="type" [options]="typesOfBusiness" [(ngModel)]="listing.type" optionLabel="name" optionValue="value" [showClear]="true" placeholder="Type of business" [style]="{ width: '100%' }"></p-dropdown>
|
<p-dropdown
|
||||||
|
id="type"
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
|
[options]="typesOfBusiness"
|
||||||
|
[(ngModel)]="listing.type"
|
||||||
|
optionLabel="name"
|
||||||
|
optionValue="value"
|
||||||
|
[showClear]="true"
|
||||||
|
placeholder="Type of business"
|
||||||
|
[style]="{ width: '100%' }"
|
||||||
|
></p-dropdown>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="listingCategory" class="block font-medium text-900 mb-2">State</label>
|
<label for="listingCategory" class="block font-medium text-900 mb-2">State</label>
|
||||||
<p-dropdown
|
<p-dropdown
|
||||||
id="listingCategory"
|
id="listingCategory"
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
[options]="selectOptions?.states"
|
[options]="selectOptions?.states"
|
||||||
[(ngModel)]="listing.state"
|
[(ngModel)]="listing.state"
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
@@ -66,27 +78,27 @@
|
|||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="price" class="block font-medium text-900 mb-2">Price</label>
|
<label for="price" class="block font-medium text-900 mb-2">Price</label>
|
||||||
<!-- <p-inputNumber mode="currency" currency="USD" locale="en-US" inputId="price" [(ngModel)]="listing.price" ></p-inputNumber> -->
|
<!-- <p-inputNumber mode="currency" currency="USD" locale="en-US" inputId="price" [(ngModel)]="listing.price" ></p-inputNumber> -->
|
||||||
<app-inputNumber mode="currency" currency="USD" locale="en-US" inputId="price" [(ngModel)]="listing.price"></app-inputNumber>
|
<p-inputNumber mode="currency" currency="USD" locale="en-US" inputId="price" [(ngModel)]="listing.price"></p-inputNumber>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="salesRevenue" class="block font-medium text-900 mb-2">Sales Revenue</label>
|
<label for="salesRevenue" class="block font-medium text-900 mb-2">Sales Revenue</label>
|
||||||
<app-inputNumber mode="currency" currency="USD" inputId="salesRevenue" [(ngModel)]="listing.salesRevenue"></app-inputNumber>
|
<p-inputNumber mode="currency" currency="USD" inputId="salesRevenue" [(ngModel)]="listing.salesRevenue"></p-inputNumber>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="cashFlow" class="block font-medium text-900 mb-2">Cash Flow</label>
|
<label for="cashFlow" class="block font-medium text-900 mb-2">Cash Flow</label>
|
||||||
<app-inputNumber mode="currency" currency="USD" inputId="cashFlow" [(ngModel)]="listing.cashFlow"></app-inputNumber>
|
<p-inputNumber mode="currency" currency="USD" inputId="cashFlow" [(ngModel)]="listing.cashFlow"></p-inputNumber>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="employees" class="block font-medium text-900 mb-2">Years Established Since</label>
|
<label for="established" class="block font-medium text-900 mb-2">Years Established Since</label>
|
||||||
<app-inputNumber mode="decimal" inputId="established" [(ngModel)]="listing.established"></app-inputNumber>
|
<p-inputNumber mode="decimal" inputId="established" [(ngModel)]="listing.established" [useGrouping]="false"></p-inputNumber>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="employees" class="block font-medium text-900 mb-2">Employees</label>
|
<label for="employees" class="block font-medium text-900 mb-2">Employees</label>
|
||||||
<app-inputNumber mode="decimal" inputId="employees" [(ngModel)]="listing.employees"></app-inputNumber>
|
<p-inputNumber mode="decimal" inputId="employees" [(ngModel)]="listing.employees" [useGrouping]="false"></p-inputNumber>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
@@ -119,7 +131,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="internalListingNumber" class="block font-medium text-900 mb-2">Internal Listing Number</label>
|
<label for="internalListingNumber" class="block font-medium text-900 mb-2">Internal Listing Number</label>
|
||||||
<app-inputNumber mode="decimal" inputId="internalListingNumber" type="text" [(ngModel)]="listing.internalListingNumber"></app-inputNumber>
|
<p-inputNumber mode="decimal" inputId="internalListingNumber" type="text" [(ngModel)]="listing.internalListingNumber" [useGrouping]="false"></p-inputNumber>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||||
import { createGenericObject, getListingType, routeListingWithState } from '../../../utils/utils';
|
import { createDefaultBusinessListing, map2User, routeListingWithState } from '../../../utils/utils';
|
||||||
|
|
||||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { AngularCropperjsModule } from 'angular-cropperjs';
|
import { AngularCropperjsModule } from 'angular-cropperjs';
|
||||||
import { MixedCdkDragDropModule } from 'angular-mixed-cdk-drag-drop';
|
import { MixedCdkDragDropModule } from 'angular-mixed-cdk-drag-drop';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||||
import { CarouselModule } from 'primeng/carousel';
|
import { CarouselModule } from 'primeng/carousel';
|
||||||
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
||||||
@@ -17,7 +18,7 @@ import { DialogService, DynamicDialogModule, DynamicDialogRef } from 'primeng/dy
|
|||||||
import { EditorModule } from 'primeng/editor';
|
import { EditorModule } from 'primeng/editor';
|
||||||
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
||||||
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { AutoCompleteCompleteEvent, ImageProperty } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { AutoCompleteCompleteEvent, ImageProperty, emailToDirName } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
import { InputNumberModule } from '../../../components/inputnumber/inputnumber.component';
|
import { InputNumberModule } from '../../../components/inputnumber/inputnumber.component';
|
||||||
import { ArrayToStringPipe } from '../../../pipes/array-to-string.pipe';
|
import { ArrayToStringPipe } from '../../../pipes/array-to-string.pipe';
|
||||||
@@ -59,9 +60,7 @@ export class EditBusinessListingComponent {
|
|||||||
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
||||||
user: User;
|
user: User;
|
||||||
maxFileSize = 3000000;
|
maxFileSize = 3000000;
|
||||||
uploadUrl: string;
|
|
||||||
environment = environment;
|
environment = environment;
|
||||||
propertyImages: string[];
|
|
||||||
responsiveOptions = [
|
responsiveOptions = [
|
||||||
{
|
{
|
||||||
breakpoint: '1199px',
|
breakpoint: '1199px',
|
||||||
@@ -99,6 +98,7 @@ export class EditBusinessListingComponent {
|
|||||||
public dialogService: DialogService,
|
public dialogService: DialogService,
|
||||||
private confirmationService: ConfirmationService,
|
private confirmationService: ConfirmationService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
private keycloakService: KeycloakService,
|
||||||
) {
|
) {
|
||||||
this.router.events.subscribe(event => {
|
this.router.events.subscribe(event => {
|
||||||
if (event instanceof NavigationEnd) {
|
if (event instanceof NavigationEnd) {
|
||||||
@@ -115,21 +115,24 @@ export class EditBusinessListingComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
const keycloakUser = map2User(token);
|
||||||
if (this.mode === 'edit') {
|
if (this.mode === 'edit') {
|
||||||
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'business'));
|
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'business'));
|
||||||
} else {
|
} else {
|
||||||
this.listing = createGenericObject<BusinessListing>();
|
this.listing = createDefaultBusinessListing();
|
||||||
this.listing.listingsCategory = 'business';
|
const listingUser = await this.userService.getByMail(keycloakUser.email);
|
||||||
this.listing.userId = await this.userService.getId();
|
this.listing.userId = listingUser.id;
|
||||||
|
this.listing.imageName = emailToDirName(keycloakUser.email);
|
||||||
|
if (this.data) {
|
||||||
this.listing.title = this.data?.title;
|
this.listing.title = this.data?.title;
|
||||||
this.listing.description = this.data?.description;
|
this.listing.description = this.data?.description;
|
||||||
}
|
}
|
||||||
this.uploadUrl = `${environment.apiBaseUrl}/bizmatch/image/uploadPropertyPicture/${this.listing.id}`;
|
}
|
||||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
this.listing = await this.listingsService.save(this.listing, getListingType(this.listing));
|
this.listing = await this.listingsService.save(this.listing, this.listing.listingsCategory);
|
||||||
this.router.navigate(['editBusinessListing', this.listing.id]);
|
this.router.navigate(['editBusinessListing', this.listing.id]);
|
||||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing changes have been persisted', life: 3000 });
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing changes have been persisted', life: 3000 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
<label for="type" class="block font-medium text-900 mb-2">Property Category</label>
|
<label for="type" class="block font-medium text-900 mb-2">Property Category</label>
|
||||||
<p-dropdown
|
<p-dropdown
|
||||||
id="type"
|
id="type"
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
[options]="typesOfCommercialProperty"
|
[options]="typesOfCommercialProperty"
|
||||||
[(ngModel)]="listing.type"
|
[(ngModel)]="listing.type"
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
@@ -50,7 +52,18 @@
|
|||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="states" class="block font-medium text-900 mb-2">State</label>
|
<label for="states" class="block font-medium text-900 mb-2">State</label>
|
||||||
<p-dropdown id="states" [options]="selectOptions?.states" [(ngModel)]="listing.state" optionLabel="name" optionValue="value" [showClear]="true" placeholder="State" [style]="{ width: '100%' }"></p-dropdown>
|
<p-dropdown
|
||||||
|
[filter]="true"
|
||||||
|
filterBy="name"
|
||||||
|
id="states"
|
||||||
|
[options]="selectOptions?.states"
|
||||||
|
[(ngModel)]="listing.state"
|
||||||
|
optionLabel="name"
|
||||||
|
optionValue="value"
|
||||||
|
[showClear]="true"
|
||||||
|
placeholder="State"
|
||||||
|
[style]="{ width: '100%' }"
|
||||||
|
></p-dropdown>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="city" class="block font-medium text-900 mb-2">City</label>
|
<label for="city" class="block font-medium text-900 mb-2">City</label>
|
||||||
@@ -69,6 +82,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid">
|
||||||
|
<div class="mb-4 col-12 md:col-6">
|
||||||
|
<p-inputSwitch inputId="draft" [(ngModel)]="listing.draft"></p-inputSwitch>
|
||||||
|
<span class="ml-2 text-900 absolute translate-y-5">Draft Mode (Will not be shown as public listing)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<p-divider></p-divider>
|
<p-divider></p-divider>
|
||||||
<div class="flex gap-5 flex-column-reverse md:flex-row">
|
<div class="flex gap-5 flex-column-reverse md:flex-row">
|
||||||
<div class="flex-auto p-fluid">
|
<div class="flex-auto p-fluid">
|
||||||
@@ -98,12 +118,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if (propertyImages?.length>0){
|
@if (listing && listing.imageOrder?.length>0){
|
||||||
<div class="p-2 border-1 surface-border border-round mb-4 image-container" cdkDropListGroup mixedCdkDragDrop (dropped)="onDrop($event)" cdkDropListOrientation="horizontal">
|
<div class="p-2 border-1 surface-border border-round mb-4 image-container" cdkDropListGroup mixedCdkDragDrop (dropped)="onDrop($event)" cdkDropListOrientation="horizontal">
|
||||||
@for (image of propertyImages; track image) {
|
@for (image of listing.imageOrder; track listing.imageOrder) {
|
||||||
<span cdkDropList mixedCdkDropList>
|
<span cdkDropList mixedCdkDropList>
|
||||||
<div cdkDrag mixedCdkDragSizeHelper class="image-wrap">
|
<div cdkDrag mixedCdkDragSizeHelper class="image-wrap">
|
||||||
<img src="pictures/property/{{ listing.imagePath }}/{{ image }}" [alt]="image" class="shadow-2" cdkDrag />
|
<img src="{{ env.imageBaseUrl }}/pictures/property/{{ listing.imagePath }}/{{ listing.serialId }}/{{ image }}?_ts={{ ts }}" [alt]="image" class="shadow-2" cdkDrag />
|
||||||
<fa-icon [icon]="faTrash" (click)="deleteConfirm(image)"></fa-icon>
|
<fa-icon [icon]="faTrash" (click)="deleteConfirm(image)"></fa-icon>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
@@ -121,6 +141,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<p-toast></p-toast>
|
||||||
|
<p-confirmDialog></p-confirmDialog>
|
||||||
</div>
|
</div>
|
||||||
<p-toast></p-toast>
|
|
||||||
<p-confirmDialog></p-confirmDialog>
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
justify-content: flex-start; /* Startet die Anordnung der Elemente am Anfang des Containers */
|
justify-content: flex-start; /* Startet die Anordnung der Elemente am Anfang des Containers */
|
||||||
align-items: flex-start; /* Ausrichtung der Elemente am Anfang der Querachse */
|
align-items: flex-start; /* Ausrichtung der Elemente am Anfang der Querachse */
|
||||||
padding: 10px; /* Abstand zwischen den Inhalten des Containers und dessen Rand */
|
padding: 10px; /* Abstand zwischen den Inhalten des Containers und dessen Rand */
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-container span {
|
.image-container span {
|
||||||
flex-flow: row;
|
flex-flow: row;
|
||||||
@@ -32,26 +32,26 @@
|
|||||||
// cursor: pointer; /* Verwandelt den Cursor in eine Hand, um Interaktivität anzudeuten */
|
// cursor: pointer; /* Verwandelt den Cursor in eine Hand, um Interaktivität anzudeuten */
|
||||||
// }
|
// }
|
||||||
|
|
||||||
.image-wrap {
|
.image-wrap {
|
||||||
position: relative; /* Ermöglicht die absolute Positionierung des Icons bezogen auf diesen Container */
|
position: relative; /* Ermöglicht die absolute Positionierung des Icons bezogen auf diesen Container */
|
||||||
display: inline-block; /* Erlaubt die Inline-Anordnung, falls mehrere Bilder vorhanden sind */
|
display: inline-block; /* Erlaubt die Inline-Anordnung, falls mehrere Bilder vorhanden sind */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stil für das Bild */
|
/* Stil für das Bild */
|
||||||
.image-wrap img {
|
.image-wrap img {
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
width: auto;
|
width: auto;
|
||||||
display: block; /* Verhindert unerwünschten Abstand unter dem Bild */
|
display: block; /* Verhindert unerwünschten Abstand unter dem Bild */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stil für das FontAwesome Icon */
|
/* Stil für das FontAwesome Icon */
|
||||||
.image-wrap fa-icon {
|
.image-wrap fa-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 15px; /* Positioniert das Icon am oberen Rand des Bildes */
|
top: 15px; /* Positioniert das Icon am oberen Rand des Bildes */
|
||||||
right: 15px; /* Positioniert das Icon am rechten Rand des Bildes */
|
right: 15px; /* Positioniert das Icon am rechten Rand des Bildes */
|
||||||
color: #fff; /* Weiße Farbe für das Icon */
|
color: #fff; /* Weiße Farbe für das Icon */
|
||||||
background-color: rgba(0,0,0,0.5); /* Halbtransparenter Hintergrund für bessere Sichtbarkeit */
|
background-color: rgba(0, 0, 0, 0.5); /* Halbtransparenter Hintergrund für bessere Sichtbarkeit */
|
||||||
padding: 5px; /* Ein wenig Platz um das Icon */
|
padding: 5px; /* Ein wenig Platz um das Icon */
|
||||||
cursor: pointer; /* Verwandelt den Cursor in eine Hand, um Interaktivität anzudeuten */
|
cursor: pointer; /* Verwandelt den Cursor in eine Hand, um Interaktivität anzudeuten */
|
||||||
border-radius: 8px; /* Optional: Abrunden der linken unteren Ecke für ästhetische Zwecke */
|
border-radius: 8px; /* Optional: Abrunden der linken unteren Ecke für ästhetische Zwecke */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||||
import { createGenericObject, getListingType, routeListingWithState } from '../../../utils/utils';
|
import { createDefaultCommercialPropertyListing, getDialogWidth, getImageDimensions, map2User, routeListingWithState } from '../../../utils/utils';
|
||||||
|
|
||||||
import { DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
|
import { DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||||
import { HttpEventType } from '@angular/common/http';
|
import { HttpEventType } from '@angular/common/http';
|
||||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { AngularCropperjsModule } from 'angular-cropperjs';
|
import { AngularCropperjsModule } from 'angular-cropperjs';
|
||||||
import { MixedCdkDragDropModule } from 'angular-mixed-cdk-drag-drop';
|
import { MixedCdkDragDropModule } from 'angular-mixed-cdk-drag-drop';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||||
import { CarouselModule } from 'primeng/carousel';
|
import { CarouselModule } from 'primeng/carousel';
|
||||||
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
||||||
@@ -18,7 +19,7 @@ import { DialogService, DynamicDialogModule, DynamicDialogRef } from 'primeng/dy
|
|||||||
import { EditorModule } from 'primeng/editor';
|
import { EditorModule } from 'primeng/editor';
|
||||||
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
import { FileUpload, FileUploadModule } from 'primeng/fileupload';
|
||||||
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { BusinessListing, CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { AutoCompleteCompleteEvent, ImageProperty } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { AutoCompleteCompleteEvent, ImageProperty, emailToDirName } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../../../environments/environment';
|
import { environment } from '../../../../environments/environment';
|
||||||
import { ImageCropperComponent } from '../../../components/image-cropper/image-cropper.component';
|
import { ImageCropperComponent } from '../../../components/image-cropper/image-cropper.component';
|
||||||
import { InputNumberModule } from '../../../components/inputnumber/inputnumber.component';
|
import { InputNumberModule } from '../../../components/inputnumber/inputnumber.component';
|
||||||
@@ -61,9 +62,7 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
||||||
user: User;
|
user: User;
|
||||||
maxFileSize = 3000000;
|
maxFileSize = 3000000;
|
||||||
uploadUrl: string;
|
|
||||||
environment = environment;
|
environment = environment;
|
||||||
propertyImages: string[];
|
|
||||||
responsiveOptions = [
|
responsiveOptions = [
|
||||||
{
|
{
|
||||||
breakpoint: '1199px',
|
breakpoint: '1199px',
|
||||||
@@ -90,6 +89,8 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
data: BusinessListing;
|
data: BusinessListing;
|
||||||
userId: string;
|
userId: string;
|
||||||
typesOfCommercialProperty = [];
|
typesOfCommercialProperty = [];
|
||||||
|
env = environment;
|
||||||
|
ts = new Date().getTime();
|
||||||
constructor(
|
constructor(
|
||||||
public selectOptions: SelectOptionsService,
|
public selectOptions: SelectOptionsService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@@ -103,6 +104,7 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
public dialogService: DialogService,
|
public dialogService: DialogService,
|
||||||
private confirmationService: ConfirmationService,
|
private confirmationService: ConfirmationService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
private keycloakService: KeycloakService,
|
||||||
) {
|
) {
|
||||||
// Abonniere Router-Events, um den aktiven Link zu ermitteln
|
// Abonniere Router-Events, um den aktiven Link zu ermitteln
|
||||||
this.router.events.subscribe(event => {
|
this.router.events.subscribe(event => {
|
||||||
@@ -120,20 +122,24 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
const keycloakUser = map2User(token);
|
||||||
if (this.mode === 'edit') {
|
if (this.mode === 'edit') {
|
||||||
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
|
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
|
||||||
} else {
|
} else {
|
||||||
this.listing = createGenericObject<CommercialPropertyListing>();
|
this.listing = createDefaultCommercialPropertyListing();
|
||||||
this.listing.userId = await this.userService.getId();
|
const listingUser = await this.userService.getByMail(keycloakUser.email);
|
||||||
|
this.listing.userId = listingUser.id;
|
||||||
|
this.listing.imagePath = `${emailToDirName(keycloakUser.email)}`;
|
||||||
|
if (this.data) {
|
||||||
this.listing.title = this.data?.title;
|
this.listing.title = this.data?.title;
|
||||||
this.listing.description = this.data?.description;
|
this.listing.description = this.data?.description;
|
||||||
}
|
}
|
||||||
this.uploadUrl = `${environment.apiBaseUrl}/bizmatch/image/uploadPropertyPicture/${this.listing.id}`;
|
}
|
||||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
this.listing = await this.listingsService.save(this.listing, getListingType(this.listing));
|
this.listing = await this.listingsService.save(this.listing, this.listing.listingsCategory);
|
||||||
this.router.navigate(['editCommercialPropertyListing', this.listing.id]);
|
this.router.navigate(['editCommercialPropertyListing', this.listing.id]);
|
||||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing changes have been persisted', life: 3000 });
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Listing changes have been persisted', life: 3000 });
|
||||||
}
|
}
|
||||||
@@ -145,6 +151,8 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
|
|
||||||
select(event: any) {
|
select(event: any) {
|
||||||
const imageUrl = URL.createObjectURL(event.files[0]);
|
const imageUrl = URL.createObjectURL(event.files[0]);
|
||||||
|
getImageDimensions(imageUrl).then(dimensions => {
|
||||||
|
const dialogWidth = getDialogWidth(dimensions);
|
||||||
this.dialogRef = this.dialogService.open(ImageCropperComponent, {
|
this.dialogRef = this.dialogService.open(ImageCropperComponent, {
|
||||||
data: {
|
data: {
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
@@ -152,7 +160,7 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
ratioVariable: false,
|
ratioVariable: false,
|
||||||
},
|
},
|
||||||
header: 'Edit Image',
|
header: 'Edit Image',
|
||||||
width: '50vw',
|
width: dialogWidth,
|
||||||
modal: true,
|
modal: true,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
keepInViewport: true,
|
keepInViewport: true,
|
||||||
@@ -166,12 +174,13 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
if (cropper) {
|
if (cropper) {
|
||||||
this.loadingService.startLoading('uploadImage');
|
this.loadingService.startLoading('uploadImage');
|
||||||
cropper.getCroppedCanvas().toBlob(async blob => {
|
cropper.getCroppedCanvas().toBlob(async blob => {
|
||||||
this.imageService.uploadImage(blob, 'uploadPropertyPicture', this.listing.id).subscribe(
|
this.imageService.uploadImage(blob, 'uploadPropertyPicture', this.listing.imagePath, this.listing.serialId).subscribe(
|
||||||
async event => {
|
async event => {
|
||||||
if (event.type === HttpEventType.Response) {
|
if (event.type === HttpEventType.Response) {
|
||||||
|
this.ts = new Date().getTime();
|
||||||
console.log('Upload abgeschlossen', event.body);
|
console.log('Upload abgeschlossen', event.body);
|
||||||
this.loadingService.stopLoading('uploadImage');
|
this.loadingService.stopLoading('uploadImage');
|
||||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
this.listing = await lastValueFrom(this.listingsService.getListingById(this.id, 'commercialProperty'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => console.error('Fehler beim Upload:', error),
|
error => console.error('Fehler beim Upload:', error),
|
||||||
@@ -180,6 +189,7 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
cropper.destroy();
|
cropper.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteConfirm(imageName: string) {
|
deleteConfirm(imageName: string) {
|
||||||
@@ -194,9 +204,9 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
rejectIcon: 'none',
|
rejectIcon: 'none',
|
||||||
|
|
||||||
accept: async () => {
|
accept: async () => {
|
||||||
await this.imageService.deleteListingImage(this.listing.id, imageName);
|
this.listing.imageOrder = this.listing.imageOrder.filter(item => item !== imageName);
|
||||||
|
await Promise.all([this.imageService.deleteListingImage(this.listing.imagePath, this.listing.serialId, imageName), this.listingsService.save(this.listing, 'commercialProperty')]);
|
||||||
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Image deleted' });
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Image deleted' });
|
||||||
this.propertyImages = await this.listingsService.getPropertyImages(this.listing.id);
|
|
||||||
},
|
},
|
||||||
reject: () => {
|
reject: () => {
|
||||||
// this.messageService.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected' });
|
// this.messageService.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected' });
|
||||||
@@ -206,8 +216,7 @@ export class EditCommercialPropertyListingComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDrop(event: { previousIndex: number; currentIndex: number }) {
|
onDrop(event: { previousIndex: number; currentIndex: number }) {
|
||||||
moveItemInArray(this.propertyImages, event.previousIndex, event.currentIndex);
|
moveItemInArray(this.listing.imageOrder, event.previousIndex, event.currentIndex);
|
||||||
this.listingsService.changeImageOrder(this.listing.id, this.propertyImages);
|
|
||||||
}
|
}
|
||||||
changeListingCategory(value: 'business' | 'commercialProperty') {
|
changeListingCategory(value: 'business' | 'commercialProperty') {
|
||||||
routeListingWithState(this.router, value, this.listing);
|
routeListingWithState(this.router, value, this.listing);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<div class="surface-ground px-4 py-8 md:px-6 lg:px-8 h-full">
|
<div class="surface-ground px-4 py-8 md:px-6 lg:px-8 h-full">
|
||||||
<div class="p-fluid flex flex-column lg:flex-row">
|
<div class="p-fluid flex flex-column lg:flex-row">
|
||||||
<menu-account></menu-account>
|
<menu-account></menu-account>
|
||||||
@@ -6,27 +5,27 @@
|
|||||||
<div class="text-900 font-semibold text-lg mt-3">Contact Us</div>
|
<div class="text-900 font-semibold text-lg mt-3">Contact Us</div>
|
||||||
<p-divider></p-divider>
|
<p-divider></p-divider>
|
||||||
<div class="flex gap-5 flex-column-reverse md:flex-row">
|
<div class="flex gap-5 flex-column-reverse md:flex-row">
|
||||||
<div class="flex-auto p-fluid">
|
<div class="flex-auto p-fluid formgrid">
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="name" class="block font-medium text-900 mb-2">Your name</label>
|
<label for="name" class="block font-medium text-900 mb-2">Your name</label>
|
||||||
<input id="name" type="text" pInputText>
|
<input [ngClass]="{ 'ng-invalid': containsError('name'), 'ng-dirty': containsError('name') }" name="name" type="text" pInputText [(ngModel)]="mailinfo.sender.name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4 col-12 md:col-6">
|
<div class="mb-4 col-12 md:col-6">
|
||||||
<label for="email" class="block font-medium text-900 mb-2">Your Email</label>
|
<label for="email" class="block font-medium text-900 mb-2">Your Email</label>
|
||||||
<input id="email" type="text" pInputText>
|
<input name="email" type="text" pInputText [(ngModel)]="mailinfo.sender.email" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="phone" class="block font-medium text-900 mb-2">Your Phone</label>
|
<label for="phoneNumber" class="block font-medium text-900 mb-2">Your Phone</label>
|
||||||
<input id="phone" type="text" pInputText>
|
<p-inputMask id="phoneNumber" name="phoneNumber" mask="(999) 999-9999" placeholder="(123) 456-7890" [(ngModel)]="mailinfo.sender.phoneNumber"></p-inputMask>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label for="help" class="block font-medium text-900 mb-2">How can we help you ?</label>
|
<label for="help" class="block font-medium text-900 mb-2">How can we help you ?</label>
|
||||||
<textarea id="help" type="text" pInputTextarea rows="5" [autoResize]="true"></textarea>
|
<textarea name="help" type="text" pInputTextarea rows="5" [autoResize]="true" [(ngModel)]="mailinfo.sender.comments"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button pButton pRipple label="Submit" class="w-auto"></button>
|
<button pButton pRipple label="Submit" class="w-auto" (click)="mail()"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,28 +1,50 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ButtonModule } from 'primeng/button';
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { CheckboxModule } from 'primeng/checkbox';
|
|
||||||
import { InputTextModule } from 'primeng/inputtext';
|
import { MessageService } from 'primeng/api';
|
||||||
import { StyleClassModule } from 'primeng/styleclass';
|
import { InputMaskModule } from 'primeng/inputmask';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { DropdownModule } from 'primeng/dropdown';
|
import { ErrorResponse, KeycloakUser, MailInfo } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { environment } from '../../../../environments/environment';
|
||||||
import { CommonModule } from '@angular/common';
|
import { MailService } from '../../../services/mail.service';
|
||||||
import { ToggleButtonModule } from 'primeng/togglebutton';
|
import { UserService } from '../../../services/user.service';
|
||||||
import { TagModule } from 'primeng/tag';
|
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||||
import data from '../../../../assets/data/user.json';
|
import { map2User } from '../../../utils/utils';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
|
||||||
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
||||||
import { ChipModule } from 'primeng/chip';
|
|
||||||
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
|
|
||||||
import { DividerModule } from 'primeng/divider';
|
|
||||||
import { TableModule } from 'primeng/table';
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-email-us',
|
selector: 'app-email-us',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, StyleClassModule, MenuAccountComponent, DividerModule,ButtonModule, CheckboxModule, InputTextModule, DropdownModule, FormsModule, ChipModule,InputTextareaModule],
|
imports: [SharedModule, InputMaskModule],
|
||||||
|
providers: [MessageService],
|
||||||
templateUrl: './email-us.component.html',
|
templateUrl: './email-us.component.html',
|
||||||
styleUrl: './email-us.component.scss'
|
styleUrl: './email-us.component.scss',
|
||||||
})
|
})
|
||||||
export class EmailUsComponent {
|
export class EmailUsComponent {
|
||||||
|
mailinfo: MailInfo;
|
||||||
|
keycloakUser: KeycloakUser;
|
||||||
|
user: User;
|
||||||
|
errorResponse: ErrorResponse;
|
||||||
|
constructor(private mailService: MailService, private userService: UserService, public keycloakService: KeycloakService, private messageService: MessageService) {
|
||||||
|
this.mailinfo = { sender: {}, userId: '', email: '', url: environment.mailinfoUrl };
|
||||||
|
}
|
||||||
|
async ngOnInit() {
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
this.keycloakUser = map2User(token);
|
||||||
|
if (this.keycloakUser) {
|
||||||
|
this.user = await this.userService.getByMail(this.keycloakUser.email);
|
||||||
|
this.mailinfo.sender = { name: `${this.user.firstname} ${this.user.lastname}`, email: this.user.email, phoneNumber: this.user.phoneNumber, state: this.user.companyLocation };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async mail() {
|
||||||
|
this.mailinfo.email = 'support@bizmatch.net';
|
||||||
|
const result = await this.mailService.mail(this.mailinfo);
|
||||||
|
if (result) {
|
||||||
|
this.errorResponse = result as ErrorResponse;
|
||||||
|
} else {
|
||||||
|
this.errorResponse = null;
|
||||||
|
this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'Your request has been forwarded to the support team of bizmatch.', life: 3000 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
containsError(fieldname: string) {
|
||||||
|
return this.errorResponse?.fields.map(f => f.fieldname).includes(fieldname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { KeycloakUser, ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||||
import { UserService } from '../../../services/user.service';
|
|
||||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||||
|
import { map2User } from '../../../utils/utils';
|
||||||
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
|
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -15,14 +15,13 @@ import { MenuAccountComponent } from '../../menu-account/menu-account.component'
|
|||||||
styleUrl: './favorites.component.scss',
|
styleUrl: './favorites.component.scss',
|
||||||
})
|
})
|
||||||
export class FavoritesComponent {
|
export class FavoritesComponent {
|
||||||
user: User;
|
user: KeycloakUser;
|
||||||
listings: Array<ListingType> = []; //= dataListings as unknown as Array<BusinessListing>;
|
listings: Array<ListingType> = []; //= dataListings as unknown as Array<BusinessListing>;
|
||||||
favorites: Array<ListingType>;
|
favorites: Array<ListingType>;
|
||||||
constructor(public userService: UserService, private listingsService: ListingsService, public selectOptions: SelectOptionsService) {
|
constructor(public keycloakService: KeycloakService, private listingsService: ListingsService, public selectOptions: SelectOptionsService) {}
|
||||||
this.user = this.userService.getKeycloakUser();
|
|
||||||
}
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
// this.listings=await lastValueFrom(this.listingsService.getAllListings());
|
const token = await this.keycloakService.getToken();
|
||||||
|
this.user = map2User(token);
|
||||||
this.favorites = this.listings.filter(l => l.favoritesForUser?.includes(this.user.id));
|
this.favorites = this.listings.filter(l => l.favoritesForUser?.includes(this.user.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
<td>{{ selectOptions.getListingsCategory(listing.listingsCategory) }}</td>
|
<td>{{ selectOptions.getListingsCategory(listing.listingsCategory) }}</td>
|
||||||
<td>{{ selectOptions.getState(listing.state) }}</td>
|
<td>{{ selectOptions.getState(listing.state) }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if(isBusinessListing(listing)){
|
@if(listing.listingsCategory==='business'){
|
||||||
<button pButton pRipple icon="pi pi-pencil" class="p-button-rounded p-button-success mr-2" [routerLink]="['/editBusinessListing', listing.id]"></button>
|
<button pButton pRipple icon="pi pi-pencil" class="p-button-rounded p-button-success mr-2" [routerLink]="['/editBusinessListing', listing.id]"></button>
|
||||||
} @if(isCommercialPropertyListing(listing)){
|
} @if(listing.listingsCategory==='commercialProperty'){
|
||||||
<button pButton pRipple icon="pi pi-pencil" class="p-button-rounded p-button-success mr-2" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
|
<button pButton pRipple icon="pi pi-pencil" class="p-button-rounded p-button-success mr-2" [routerLink]="['/editCommercialPropertyListing', listing.id]"></button>
|
||||||
}
|
}
|
||||||
<button pButton pRipple icon="pi pi-trash" class="p-button-rounded p-button-warning" (click)="confirm($event, listing)"></button>
|
<button pButton pRipple icon="pi pi-trash" class="p-button-rounded p-button-warning" (click)="confirm($event, listing)"></button>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { ChangeDetectorRef, Component } from '@angular/core';
|
import { ChangeDetectorRef, Component } from '@angular/core';
|
||||||
|
import { KeycloakService } from 'keycloak-angular';
|
||||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { CommercialPropertyListing, User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
import { ListingType } from '../../../../../../bizmatch-server/src/models/main.model';
|
||||||
import { ListingsService } from '../../../services/listings.service';
|
import { ListingsService } from '../../../services/listings.service';
|
||||||
import { SelectOptionsService } from '../../../services/select-options.service';
|
import { SelectOptionsService } from '../../../services/select-options.service';
|
||||||
import { UserService } from '../../../services/user.service';
|
import { UserService } from '../../../services/user.service';
|
||||||
import { SharedModule } from '../../../shared/shared/shared.module';
|
import { SharedModule } from '../../../shared/shared/shared.module';
|
||||||
import { getListingType, isBusinessListing, isCommercialPropertyListing } from '../../../utils/utils';
|
import { map2User } from '../../../utils/utils';
|
||||||
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
|
import { MenuAccountComponent } from '../../menu-account/menu-account.component';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-my-listing',
|
selector: 'app-my-listing',
|
||||||
@@ -20,10 +21,9 @@ export class MyListingComponent {
|
|||||||
listings: Array<ListingType> = []; //dataListings as unknown as Array<BusinessListing>;
|
listings: Array<ListingType> = []; //dataListings as unknown as Array<BusinessListing>;
|
||||||
myListings: Array<ListingType>;
|
myListings: Array<ListingType>;
|
||||||
user: User;
|
user: User;
|
||||||
isBusinessListing = isBusinessListing;
|
|
||||||
isCommercialPropertyListing = isCommercialPropertyListing;
|
|
||||||
constructor(
|
constructor(
|
||||||
public userService: UserService,
|
public userService: UserService,
|
||||||
|
public keycloakService: KeycloakService,
|
||||||
private listingsService: ListingsService,
|
private listingsService: ListingsService,
|
||||||
private cdRef: ChangeDetectorRef,
|
private cdRef: ChangeDetectorRef,
|
||||||
public selectOptions: SelectOptionsService,
|
public selectOptions: SelectOptionsService,
|
||||||
@@ -31,16 +31,22 @@ export class MyListingComponent {
|
|||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
) {}
|
) {}
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
const keycloakUser = this.userService.getKeycloakUser();
|
// const keycloakUser = this.userService.getKeycloakUser();
|
||||||
|
const token = await this.keycloakService.getToken();
|
||||||
|
const keycloakUser = map2User(token);
|
||||||
const email = keycloakUser.email;
|
const email = keycloakUser.email;
|
||||||
this.user = await this.userService.getByMail(email);
|
this.user = await this.userService.getByMail(email);
|
||||||
const result = await Promise.all([await this.listingsService.getListingByUserId(this.user.id, 'business'), await this.listingsService.getListingByUserId(this.user.id, 'commercialProperty')]);
|
const result = await Promise.all([await this.listingsService.getListingsByEmail(this.user.email, 'business'), await this.listingsService.getListingsByEmail(this.user.email, 'commercialProperty')]);
|
||||||
this.myListings = [...result[0], ...result[1]];
|
this.myListings = [...result[0], ...result[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteListing(listing: ListingType) {
|
async deleteListing(listing: ListingType) {
|
||||||
await this.listingsService.deleteListing(listing.id, getListingType(listing));
|
if (listing.listingsCategory === 'business') {
|
||||||
const result = await Promise.all([await this.listingsService.getListingByUserId(this.user.id, 'business'), await this.listingsService.getListingByUserId(this.user.id, 'commercialProperty')]);
|
await this.listingsService.deleteBusinessListing(listing.id);
|
||||||
|
} else {
|
||||||
|
await this.listingsService.deleteCommercialPropertyListing(listing.id, (<CommercialPropertyListing>listing).imagePath);
|
||||||
|
}
|
||||||
|
const result = await Promise.all([await this.listingsService.getListingsByEmail(this.user.email, 'business'), await this.listingsService.getListingsByEmail(this.user.email, 'commercialProperty')]);
|
||||||
this.myListings = [...result[0], ...result[1]];
|
this.myListings = [...result[0], ...result[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user