repare login

add search in sale detail
add refresh button in sale detail
This commit is contained in:
Cyril Rouillon 2024-11-26 15:10:38 +01:00
parent 848fc4909e
commit 23dbfff014
41 changed files with 192 additions and 127 deletions

0
backend/config.js Executable file
View File

View File

@ -4,43 +4,71 @@ const { LotDb } = require("../services/lotDb");
const lotDb = new LotDb();
const { SaleDb } = require("../services/saleDb");
const saleDb = new SaleDb();
const {Agent} = require('../services/agent');
const agent = new Agent();
const ApiURL = "http://host.docker.internal:3020/api";
// scrapping
// exports.getInfos = asyncHandler(async (req, res, next) => {
// let url = req.params.url
// url = encodeURIComponent(url);
// fetch(ApiURL+'/lot/getInfos/'+url)
// .then(response => response.json())
// .then(data => {
// res.json(data);
// })
// .catch(error => {
// console.error(error);
// res.json({error: error});
// });
// });
exports.getInfos = asyncHandler(async (req, res, next) => {
let url = req.params.url
url = encodeURIComponent(url);
fetch(ApiURL+'/lot/getInfos/'+url)
.then(response => response.json())
let url = req.params.url
url = encodeURIComponent(url);
agent.getLotInfos(url)
.then(data => {
res.json(data);
return res.status(200).json(data);
})
.catch(error => {
console.error(error);
res.json({error: error});
});
return res.status(500).send({error: error});
});
});
// exports.getPictures = asyncHandler(async (req, res, next) => {
// let url = req.params.url
// url = encodeURIComponent(url);
// fetch(ApiURL+'/lot/getPictures/'+url)
// .then(response => response.json())
// .then(data => {
// res.json(data);
// })
// .catch(error => {
// console.error(error);
// res.json({error: error});
// });
// });
exports.getPictures = asyncHandler(async (req, res, next) => {
let url = req.params.url
url = encodeURIComponent(url);
fetch(ApiURL+'/lot/getPictures/'+url)
.then(response => response.json())
.then(data => {
res.json(data);
})
.catch(error => {
console.error(error);
res.json({error: error});
});
agent.getPictures(url)
.then(data => {
return res.status(200).json(data);
})
.catch(error => {
console.error(error);
return res.status(500).send({error: error});
});
});
exports.getLotsBySale = asyncHandler(async (req, res, next) => {
let id = req.params.id

View File

@ -40,7 +40,6 @@ app.use(session({
const passport = require('passport');
app.use(passport.initialize());
app.use(passport.session());
app.use('/', require('./routes/auth'));

View File

@ -99,6 +99,33 @@ const Agent = class
});
}
async getLotInfos(url){
return new Promise((resolve, reject) => {
url = encodeURIComponent(url);
this.request(this.ApiAgentURL+'/lot/getInfos/'+url, 'GET')
.then(data => {
resolve(data);
})
.catch(error => {
reject(error);
});
});
}
async getPictures(url){
return new Promise((resolve, reject) => {
url = encodeURIComponent(url);
this.request(this.ApiAgentURL+'/lot/getPictures/'+url, 'GET')
.then(data => {
resolve(data);
})
.catch(error => {
reject(error);
});
});
}
}
module.exports = {Agent};

View File

@ -68,7 +68,7 @@
},
"defaultConfiguration": "production"
},
"serve": {
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -169,31 +169,6 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ngx-logger
MIT
The MIT License
Copyright (c) 2018 David Fannin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
primeng
MIT
@ -418,17 +393,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
vlq
MIT
Copyright (c) 2017 [these people](https://github.com/Rich-Harris/vlq/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
zone.js
MIT
The MIT License

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(()=>{"use strict";var e,g={},_={};function r(e){var n=_[e];if(void 0!==n)return n.exports;var t=_[e]={id:e,loaded:!1,exports:{}};return g[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=g,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],u=!0,c=0;c<t.length;c++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[c]))?t.splice(c--,1):(u=!1,o<a&&(a=o));if(u){e.splice(i--,1);var l=f();void 0!==l&&(n=l)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},(()=>{var n,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;r.t=function(t,f){if(1&f&&(t=this(t)),8&f||"object"==typeof t&&t&&(4&f&&t.__esModule||16&f&&"function"==typeof t.then))return t;var o=Object.create(null);r.r(o);var i={};n=n||[null,e({}),e([]),e(e)];for(var a=2&f&&t;"object"==typeof a&&!~n.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(u=>i[u]=()=>t[u]);return i.default=()=>t,r.d(o,i),o}})(),r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{40:"830a305ce078c093",136:"7ec3fccbaab9da95",168:"23cd0d474d0816c1",180:"2cd83d3a045b34ec",184:"76d8d415636f0a06",206:"df318e426aa62a63",228:"09b3735f8b2791e2",556:"23addb1698bab6ce",640:"ea69207168bc4f5e",852:"38e77b9083937542",968:"71f956b042a479cb",982:"b8ef64041e16e14b"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="angular-material-template:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,u;if(void 0!==o)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var d=c[l];if(d.getAttribute("src")==t||d.getAttribute("data-webpack")==n+o){a=d;break}}a||(u=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var s=(v,b)=>{a.onerror=a.onload=null,clearTimeout(p);var m=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),m&&m.forEach(h=>h(b)),v)return v(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),u&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={688:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(688!=f){var a=new Promise((d,s)=>i=e[f]=[d,s]);o.push(i[2]=a);var u=r.p+r.u(f),c=new Error;r.l(u,d=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=d&&("load"===d.type?"missing":d.type),p=d&&d.target&&d.target.src;c.message="Loading chunk "+f+" failed.\n("+s+": "+p+")",c.name="ChunkLoadError",c.type=s,c.request=p,i[1](c)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var c,l,[i,a,u]=o,d=0;if(i.some(p=>0!==e[p])){for(c in a)r.o(a,c)&&(r.m[c]=a[c]);if(u)var s=u(r)}for(f&&f(o);d<i.length;d++)r.o(e,l=i[d])&&e[l]&&e[l][0](),e[l]=0;return r.O(s)},t=self.webpackChunkangular_material_template=self.webpackChunkangular_material_template||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();
(()=>{"use strict";var e,g={},_={};function r(e){var n=_[e];if(void 0!==n)return n.exports;var t=_[e]={id:e,loaded:!1,exports:{}};return g[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=g,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],u=!0,d=0;d<t.length;d++)(!1&o||a>=o)&&Object.keys(r.O).every(p=>r.O[p](t[d]))?t.splice(d--,1):(u=!1,o<a&&(a=o));if(u){e.splice(i--,1);var l=f();void 0!==l&&(n=l)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},(()=>{var n,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;r.t=function(t,f){if(1&f&&(t=this(t)),8&f||"object"==typeof t&&t&&(4&f&&t.__esModule||16&f&&"function"==typeof t.then))return t;var o=Object.create(null);r.r(o);var i={};n=n||[null,e({}),e([]),e(e)];for(var a=2&f&&t;"object"==typeof a&&!~n.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(u=>i[u]=()=>t[u]);return i.default=()=>t,r.d(o,i),o}})(),r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{40:"0e13af05d78d5691",136:"8c914bf99cf12c1c",168:"b2b470dd58e8115f",180:"a8c46ad68cf84c5c",184:"f2561c662a3b6776",206:"908b4ebd758170f6",228:"d6e857ac56777d70",556:"4884683b51327f64",640:"f5afe46ed7b82502",852:"e5b8d93dc01c8a44",968:"ea5d530378b38ab9",982:"1532e6ce0fb7b57a"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="angular-material-template:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,u;if(void 0!==o)for(var d=document.getElementsByTagName("script"),l=0;l<d.length;l++){var c=d[l];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==n+o){a=c;break}}a||(u=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var s=(v,p)=>{a.onerror=a.onload=null,clearTimeout(b);var m=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),m&&m.forEach(h=>h(p)),v)return v(p)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),u&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={688:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(688!=f){var a=new Promise((c,s)=>i=e[f]=[c,s]);o.push(i[2]=a);var u=r.p+r.u(f),d=new Error;r.l(u,c=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;d.message="Loading chunk "+f+" failed.\n("+s+": "+b+")",d.name="ChunkLoadError",d.type=s,d.request=b,i[1](d)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var d,l,[i,a,u]=o,c=0;if(i.some(b=>0!==e[b])){for(d in a)r.o(a,d)&&(r.m[d]=a[d]);if(u)var s=u(r)}for(f&&f(o);c<i.length;c++)r.o(e,l=i[c])&&e[l]&&e[l][0](),e[l]=0;return r.O(s)},t=self.webpackChunkangular_material_template=self.webpackChunkangular_material_template||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();

View File

@ -20,6 +20,18 @@ server {
try_files $uri $uri/ /index.html =404;
}
location /api {
proxy_pass https://jucundus-api.saucisse.ninja;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization';
}
location /healthcheck {
access_log off;
add_header 'Content-Type' 'text/plain';

View File

@ -7,7 +7,7 @@ import { CoreModule } from './core/core.module';
import { SharedModule } from './shared/shared.module';
import { CustomMaterialModule } from './custom-material/custom-material.module';
import { AppRoutingModule } from './app-routing.module';
import { LoggerModule } from 'ngx-logger';
//import { LoggerModule } from 'ngx-logger';
import { environment } from '../environments/environment';
@NgModule({
@ -21,11 +21,11 @@ import { environment } from '../environments/environment';
SharedModule,
CustomMaterialModule.forRoot(),
AppRoutingModule,
LoggerModule.forRoot({
serverLoggingUrl: `http://my-api/logs`,
level: environment.logLevel,
serverLogLevel: environment.serverLogLevel
})
// LoggerModule.forRoot({
// serverLoggingUrl: `http://my-api/logs`,
// level: environment.logLevel,
// serverLogLevel: environment.serverLogLevel
// })
],
bootstrap: [AppComponent]
})

View File

@ -2,7 +2,7 @@ import { NgModule, Optional, SkipSelf, ErrorHandler } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { MediaMatcher } from '@angular/cdk/layout';
import { NGXLogger } from 'ngx-logger';
//import { NGXLogger } from 'ngx-logger';
import { AuthInterceptor } from './interceptors/auth.interceptor';
import { SpinnerInterceptor } from './interceptors/spinner.interceptor';
@ -36,7 +36,7 @@ import { AdminGuard } from './guards/admin.guard';
provide: ErrorHandler,
useClass: GlobalErrorHandler
},
{ provide: NGXLogger, useClass: NGXLogger },
//{ provide: NGXLogger, useClass: NGXLogger },
{ provide: 'LOCALSTORAGE', useValue: window.localStorage }
],
exports: [

View File

@ -1,5 +1,5 @@
import { ErrorHandler, Injectable, Injector } from '@angular/core';
import { NGXLogger } from 'ngx-logger';
//import { NGXLogger } from 'ngx-logger';
@Injectable()
export class GlobalErrorHandler implements ErrorHandler {
@ -11,7 +11,7 @@ export class GlobalErrorHandler implements ErrorHandler {
// Obtain dependencies at the time of the error
// This is because the GlobalErrorHandler is registered first
// which prevents constructor dependency injection
const logger = this.injector.get(NGXLogger);
//const logger = this.injector.get(NGXLogger);
const err = {
message: error.message ? error.message : error.toString(),
@ -19,7 +19,7 @@ export class GlobalErrorHandler implements ErrorHandler {
};
// Log the error
logger.error(err);
//logger.error(err);
// Re-throw the error
throw error;

View File

@ -1,6 +1,6 @@
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { Component, OnInit } from '@angular/core';
import { NGXLogger } from 'ngx-logger';
//import { NGXLogger } from 'ngx-logger';
import { AuthenticationService } from 'src/app/core/services/auth.service';
import { NotificationService } from 'src/app/core/services/notification.service';
import { SpinnerService } from 'src/app/core/services/spinner.service';
@ -22,7 +22,7 @@ export class ChangePasswordComponent implements OnInit {
disableSubmit!: boolean;
constructor(private authService: AuthenticationService,
private logger: NGXLogger,
//private logger: NGXLogger,
private spinnerService: SpinnerService,
private notificationService: NotificationService) {
@ -63,7 +63,7 @@ export class ChangePasswordComponent implements OnInit {
this.authService.changePassword(email, this.currentPassword, this.newPassword)
.subscribe(
data => {
this.logger.info(`User ${email} changed password.`);
//this.logger.info(`User ${email} changed password.`);
this.form.reset();
this.notificationService.openSnackBar('Your password has been changed.');
},

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { tap, catchError } from 'rxjs/operators';
import { of } from 'rxjs';
import { Router } from '@angular/router';
import { UntypedFormControl, Validators, UntypedFormGroup } from '@angular/forms';
import { Title } from '@angular/platform-browser';
@ -15,7 +17,8 @@ export class LoginComponent implements OnInit {
loginForm!: UntypedFormGroup;
loading!: boolean;
constructor(private router: Router,
constructor(
private router: Router,
private titleService: Title,
private notificationService: NotificationService,
private authenticationService: AuthenticationService) {
@ -45,23 +48,26 @@ export class LoginComponent implements OnInit {
this.loading = true;
this.authenticationService
.login(email.toLowerCase(), password)
.subscribe(
data => {
if (rememberMe) {
localStorage.setItem('savedUserEmail', email);
} else {
localStorage.removeItem('savedUserEmail');
}
this.router.navigate(['dashboard']);
},
error => {
this.notificationService.openSnackBar(error.error.message);
this.loading = false;
}
);
.pipe(
tap(data => {
if (rememberMe) {
localStorage.setItem('savedUserEmail', email);
} else {
localStorage.removeItem('savedUserEmail');
}
setTimeout(() => {
this.router.navigate(['sales'])
},100);
}),
catchError(error => {
this.notificationService.openSnackBar(error.error.message);
this.loading = false;
return of(null); // Return an observable to complete the stream
})
)
.subscribe();
}
resetPassword() {
this.router.navigate(['/auth/password-reset-request']);
}

View File

@ -1,7 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { NGXLogger } from 'ngx-logger';
//import { NGXLogger } from 'ngx-logger';
import { Title } from '@angular/platform-browser';
import { NotificationService } from 'src/app/core/services/notification.service';
@ -38,14 +38,14 @@ export class CustomerListComponent implements OnInit {
sort: MatSort = new MatSort;
constructor(
private logger: NGXLogger,
//private logger: NGXLogger,
private notificationService: NotificationService,
private titleService: Title
) { }
ngOnInit() {
this.titleService.setTitle('Jucundus - Customers');
this.logger.log('Customers loaded');
//this.logger.log('Customers loaded');
this.notificationService.openSnackBar('Customers loaded');
this.dataSource.sort = this.sort;

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { NotificationService } from 'src/app/core/services/notification.service';
import { Title } from '@angular/platform-browser';
import { NGXLogger } from 'ngx-logger';
//import { NGXLogger } from 'ngx-logger';
import { AuthenticationService } from 'src/app/core/services/auth.service';
@Component({
@ -15,13 +15,14 @@ export class DashboardHomeComponent implements OnInit {
constructor(private notificationService: NotificationService,
private authService: AuthenticationService,
private titleService: Title,
private logger: NGXLogger) {
//private logger: NGXLogger
) {
}
ngOnInit() {
this.currentUser = this.authService.getCurrentUser();
this.titleService.setTitle('Jucundus - Dashboard');
this.logger.log('Dashboard loaded');
//this.logger.log('Dashboard loaded');
setTimeout(() => {
this.notificationService.openSnackBar('Welcome!');

View File

@ -32,6 +32,7 @@
</div>
</div>
<div fxLayout="row" fxLayoutGap="2px">
<button mat-raised-button color="primary" (click)="refresh()">Refresh</button>
<button mat-raised-button color="primary" (click)="downloadExcelStatsFile(id)">Excel</button>
</div>
</mat-card-content>
@ -47,7 +48,14 @@
<ng-template mat-tab-label>
Lots
</ng-template>
<div fxLayout="row" fxLayoutGap="5px">
<mat-form-field>
<mat-label>Search</mat-label>
<input matInput placeholder="Search..." maxlength="255" st [(ngModel)]="searchText" (input)="filterLots()" >
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="5px">
<table mat-table [dataSource]="lotList" matSort class="mat-elevation-z8">
<!--- Note that these columns can be defined in any order.

View File

@ -27,10 +27,15 @@ import { Lot } from 'src/app/core/services/model/lot.interface';
export class SaleDetailPageComponent implements OnInit, AfterViewInit {
id: any = '';
Sale: Sale;
Sale: Sale;
searchText: string = '';
originalLots: Lot[] = [];
lotList: MatTableDataSource<Lot> = new MatTableDataSource<Lot>();
displayedColumns: string[] = ['lotNum', 'picture', 'title', 'estimateLow', 'estimateHigh', 'price', 'nbrBids', 'duration', 'percentageAboveUnderLow', 'percentageAboveUnderHigh'];
lotList: MatTableDataSource<Lot> = new MatTableDataSource<Lot>();
@ViewChild(MatPaginator) paginator?: MatPaginator;
@ViewChild(MatSort) sort?: MatSort;
@ -88,6 +93,10 @@ export class SaleDetailPageComponent implements OnInit, AfterViewInit {
});
}
refresh(): void {
this.getLotList();
}
getLotList(){
this.apiLotService.getLotsBySale(this.id).subscribe((lotList: Lot[]) => {
@ -134,6 +143,7 @@ export class SaleDetailPageComponent implements OnInit, AfterViewInit {
});
console.log(lotList);
this.originalLots = lotList;
this.lotList = new MatTableDataSource(lotList);
this.lotList.paginator = this.paginator ?? null;
this.lotList.sort = this.sort ?? null;
@ -169,6 +179,14 @@ export class SaleDetailPageComponent implements OnInit, AfterViewInit {
return `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`;
}
filterLots(): void {
const filteredData = this.originalLots.filter(lot =>
lot.title?.toLowerCase().includes(this.searchText.toLowerCase()) ||
lot.description?.toLowerCase().includes(this.searchText.toLowerCase())
);
this.lotList.data = filteredData;
}
openDetailLot(idLot: string): void {
this.dialog.open(LotDetailDialogComponent, {
width: '80%',

View File

@ -1,7 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { NGXLogger } from 'ngx-logger';
//import { NGXLogger } from 'ngx-logger';
import { NotificationService } from 'src/app/core/services/notification.service';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
@ -23,7 +23,7 @@ export class UserListComponent implements OnInit {
@ViewChild(MatSort) sort?: MatSort;
constructor(
private logger: NGXLogger,
//private logger: NGXLogger,
private notificationService: NotificationService,
private titleService: Title,
private router: Router,
@ -32,7 +32,7 @@ export class UserListComponent implements OnInit {
ngOnInit() {
this.titleService.setTitle('Jucundus - Users');
this.logger.log('Users loaded');
//this.logger.log('Users loaded');
this.refreshUsers()
}

View File

@ -1,8 +1,9 @@
import { NgxLoggerLevel } from 'ngx-logger';
//import { NgxLoggerLevel } from 'ngx-logger';
export const environment = {
production: true,
logLevel: NgxLoggerLevel.OFF,
serverLogLevel: NgxLoggerLevel.ERROR,
//logLevel: NgxLoggerLevel.OFF,
//serverLogLevel: NgxLoggerLevel.ERROR,
//ServeurURL: "https://jucundus.saucisse.ninja"
ServeurURL: "https://jucundus-api.saucisse.ninja"
};

View File

@ -1,4 +1,4 @@
import { NgxLoggerLevel } from 'ngx-logger';
//import { NgxLoggerLevel } from 'ngx-logger';
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
@ -7,7 +7,7 @@ import { NgxLoggerLevel } from 'ngx-logger';
export const environment = {
production: false,
logLevel: NgxLoggerLevel.TRACE,
serverLogLevel: NgxLoggerLevel.OFF,
//logLevel: NgxLoggerLevel.TRACE,
//serverLogLevel: NgxLoggerLevel.OFF,
ServeurURL: "http://localhost:3000"
};

View File

@ -27,10 +27,11 @@ services:
- backend-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`jucundus-api.saucisse.ninja`)"
- "traefik.http.routers.backend.entrypoints=websecure"
- "traefik.http.routers.backend.tls=true"
- "traefik.http.routers.backend.tls.certresolver=myresolver"
- "traefik.http.routers.jucundus-api.rule=Host(`jucundus-api.saucisse.ninja`)"
- "traefik.http.routers.jucundus-api.entrypoints=websecure"
- "traefik.http.routers.jucundus-api.tls=true"
- "traefik.http.routers.jucundus-api.tls.certresolver=myresolver"
- "traefik.http.services.jucundus-api.loadbalancer.server.port=3000"
client:
image: nginx:latest
@ -55,7 +56,7 @@ services:
- "traefik.http.routers.jucundus.tls=true"
- "traefik.http.routers.jucundus.tls.certresolver=myresolver"
- "traefik.http.routers.jucundus.tls.domains[0].main=jucundus.saucisse.ninja"
- "traefik.http.services.scrapper.loadbalancer.server.port=80"
- "traefik.http.services.jucundus.loadbalancer.server.port=80"
networks:
backend-network: