"use strict";(self.webpackChunkangular_material_template=self.webpackChunkangular_material_template||[]).push([[206],{1206:(at,R,l)=>{l.r(R),l.d(R,{FavoritesModule:()=>tt});var f=l(1368),u=l(2992),Y=l(3200),t=l(4496),k=l(6716),F=l(7048);let E=(()=>{class o{constructor(i){this.http=i,this.ServeurURL=k.O.ServeurURL,this.ApiURL=this.ServeurURL+"/api"}saveFavorite(i,n,a,r,e,v,y){return this.http.post(this.ApiURL+"/favorite/save",{lotInfo:i,saleInfo:n,picture:a,dateTime:r,buyProject:e,maxPrice:v,Note:y})}getAllFavorite(){return this.http.get(this.ApiURL+"/favorite/getAll")}static#t=this.\u0275fac=function(n){return new(n||o)(t.CoB(F.KK))};static#e=this.\u0275prov=t.wxM({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();var g=l(6504),d=l(2276),M=l(7816),m=l(2080),_=l(7536),h=l(1544),c=l(8818);function G(o,s){1&o&&(t.I0R(0,"th",15),t.OEk(1," Picture "),t.C$Y())}function S(o,s){if(1&o&&(t.I0R(0,"td",16),t.wR5(1,"img",17),t.C$Y()),2&o){const i=s.$implicit;t.yG2(),t.E7m("src",i.picture,t.K6U)}}function P(o,s){1&o&&(t.I0R(0,"th",15),t.OEk(1," Lot "),t.C$Y())}function N(o,s){if(1&o&&(t.I0R(0,"td",16),t.OEk(1),t.C$Y()),2&o){const i=s.$implicit;t.yG2(),t.oRS(" ",i.lotInfo.lotNumber," ")}}function w(o,s){1&o&&(t.I0R(0,"th",15),t.OEk(1," Title "),t.C$Y())}function x(o,s){if(1&o&&(t.I0R(0,"td",16),t.OEk(1),t.C$Y()),2&o){const i=s.$implicit;t.yG2(),t.oRS(" ",i.lotInfo.title," ")}}function T(o,s){1&o&&(t.I0R(0,"th",15),t.OEk(1," Estimate "),t.C$Y())}function L(o,s){if(1&o&&(t.I0R(0,"td",16),t.OEk(1),t.C$Y()),2&o){const i=s.$implicit;t.yG2(),t.CAO(" ",i.lotInfo.EstimateLow," - ",i.lotInfo.EstimateHigh," ")}}function b(o,s){1&o&&t.wR5(0,"tr",18)}function $(o,s){1&o&&t.wR5(0,"tr",19)}let H=(()=>{class o{constructor(i,n){this.router=i,this.apiFavoriteService=n,this.url="",this.displayedColumns=["picture","lot","title","estimate"],this.dataSource=[]}openDialog(){this.router.navigate(["favorites/new",this.url])}ngOnInit(){this.apiFavoriteService.getAllFavorite().subscribe(i=>{this.dataSource=i})}static#t=this.\u0275fac=function(n){return new(n||o)(t.GI1(u.E5),t.GI1(E))};static#e=this.\u0275cmp=t.In1({type:o,selectors:[["app-favorites-page"]],decls:35,vars:4,consts:[["fxLayout","row","fxLayoutAlign","center none",1,"container"],["fxFlex","95%"],["fxLayout","row","fxLayoutGap","5px"],["matInput","","placeholder","Ex. https://drouot.com/...","maxlength","255","st","",3,"ngModel","ngModelChange"],["mat-raised-button","","color","primary",3,"click"],[2,"margin-top","10px"],["mat-table","",1,"mat-elevation-z8",3,"dataSource"],["matColumnDef","picture"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","lot"],["matColumnDef","title"],["matColumnDef","estimate"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],["mat-cell",""],["alt","Picture",2,"width","50px",3,"src"],["mat-header-row",""],["mat-row",""]],template:function(n,a){1&n&&(t.I0R(0,"div",0)(1,"div",1)(2,"mat-card")(3,"mat-card-header")(4,"mat-card-title"),t.OEk(5,"New Lot"),t.C$Y()(),t.I0R(6,"mat-card-content")(7,"div",2)(8,"mat-form-field")(9,"mat-label"),t.OEk(10,"Url"),t.C$Y(),t.I0R(11,"input",3),t.iHE("ngModelChange",function(e){return t.kNx(a.url,e)||(a.url=e),e}),t.C$Y()(),t.I0R(12,"button",4),t.qCj("click",function(){return a.openDialog()}),t.OEk(13,"Add"),t.C$Y()()()(),t.I0R(14,"mat-card",5)(15,"mat-card-header")(16,"mat-card-title"),t.OEk(17,"Favorites"),t.C$Y()(),t.I0R(18,"mat-card-content")(19,"div",2)(20,"table",6),t.SAx(21,7),t.yuY(22,G,2,0,"th",8)(23,S,2,1,"td",9),t.k70(),t.SAx(24,10),t.yuY(25,P,2,0,"th",8)(26,N,2,1,"td",9),t.k70(),t.SAx(27,11),t.yuY(28,w,2,0,"th",8)(29,x,2,1,"td",9),t.k70(),t.SAx(30,12),t.yuY(31,T,2,0,"th",8)(32,L,2,2,"td",9),t.k70(),t.yuY(33,b,1,0,"tr",13)(34,$,1,0,"tr",14),t.C$Y()()()()()()),2&n&&(t.yG2(11),t.OKB("ngModel",a.url),t.yG2(9),t.E7m("dataSource",a.dataSource),t.yG2(13),t.E7m("matHeaderRowDef",a.displayedColumns),t.yG2(),t.E7m("matRowDefColumns",a.displayedColumns))},dependencies:[g.ot,g.ue,g.Mj,g._G,d.sZ,d.cZ,d.qG,d.CA,M.Gw,m.SM,m.WK,m.Uc,m.gp,_.yi,h.Up,h.w5,c.wL,c.ie,c.aG,c.Af,c.uc,c.gx,c.qC,c.cX,c.yC,c._I],styles:["mat-icon[_ngcontent-%COMP%]{color:#c80000}"]})}return o})();var p=l(2864),O=l(6232);function D(o,s){if(1&o){const i=t.KQA();t.I0R(0,"mat-grid-tile")(1,"div",2)(2,"img",3),t.qCj("click",function(){const r=t.usT(i).$implicit,e=t.GaO();return t.CGJ(e.onSelectImage(r))}),t.C$Y()()()}if(2&o){const i=s.$implicit;t.yG2(2),t._6D("src",i,t.K6U)}}let K=(()=>{class o{constructor(i,n){this.dialogRef=i,this.data=n,this.images=[]}ngOnInit(){this.images=this.data.images,console.log(this.images)}onSelectImage(i){this.dialogRef.close(i)}onNoClick(){this.dialogRef.close()}static#t=this.\u0275fac=function(n){return new(n||o)(t.GI1(p.yI),t.GI1(p.sR))};static#e=this.\u0275cmp=t.In1({type:o,selectors:[["change-image-dialog-dialog"]],decls:9,vars:1,consts:[["cols","2"],[4,"ngFor","ngForOf"],[2,"width","300px","height","300px"],[2,"width","100%","height","100%","object-fit","contain",3,"src","click"]],template:function(n,a){1&n&&(t.I0R(0,"mat-card")(1,"mat-card-header")(2,"mat-card-title"),t.OEk(3,"Picture"),t.C$Y(),t.I0R(4,"mat-card-subtitle"),t.OEk(5,"select the picture"),t.C$Y()(),t.I0R(6,"mat-card-content")(7,"mat-grid-list",0),t.yuY(8,D,3,1,"mat-grid-tile",1),t.C$Y()()()),2&n&&(t.yG2(8),t.E7m("ngForOf",a.images))},dependencies:[f.ay,O.ae,O.cn,m.SM,m.WK,m.Uc,m.uK,m.gp],styles:[".example-card[_ngcontent-%COMP%]{margin-bottom:8px}"]})}return o})();var C=l(2304),A=l(4440),B=l(8825),U=l(4104),j=l(1560),I=l(9120),W=l(3840),z=l(3892);function Q(o,s){1&o&&(t.I0R(0,"div"),t.wR5(1,"p-skeleton",27),t.C$Y())}function Z(o,s){if(1&o){const i=t.KQA();t.I0R(0,"div")(1,"img",28),t.qCj("click",function(){t.usT(i);const a=t.GaO();return t.CGJ(a.openChangeImage())}),t.C$Y()()}if(2&o){const i=t.GaO();t.yG2(),t.E7m("src",i.picture,t.K6U)}}const J=[{path:"",component:Y.Y,children:[{path:"",component:H},{path:"new/:url",component:(()=>{class o{constructor(i,n,a,r,e,v,y){this.dialog=i,this.ActivatedRoute=n,this.router=a,this.notificationService=r,this.apiLotService=e,this.apiSaleService=v,this.apiFavoriteService=y,this.url="",this.images=[],this.picture="",this.hour="",this.buyProject=!1,this.maxPrice=0,this.Note="",this.ActivatedRoute.params.subscribe(et=>{this.url=et.url}),this.lotInfo={idLotInterencheres:"",url:"",title:"",lotNumber:"",EstimateLow:0,EstimateHigh:0,Description:"",feesText:"",fees:"",saleInfo:{idSaleInterencheres:"",url:""}},this.SaleInfo={_id:"",idPlatform:"",platform:"",url:"",title:"",date:"",location:"",saleHouseName:"",status:""},this.date=new Date}ngOnInit(){console.log("url: "+this.url),this.apiLotService.getLotInfo(this.url).subscribe(i=>{console.log(i),this.lotInfo=i,this.apiSaleService.getSaleInfos(this.lotInfo.saleInfo.url).subscribe(n=>{console.log(n),this.SaleInfo=n,this.date=C(this.SaleInfo.date).tz("Europe/Paris").toDate(),this.hour=C(this.SaleInfo.date).tz("Europe/Paris").format("HH:mm"),this.notificationService.openSnackBar("Loaded: "+i.title)})}),this.apiLotService.getPictures(this.url).subscribe(i=>{this.images=i,this.picture=i[0]})}openChangeImage(){this.dialog.open(K,{width:"300px",data:{images:this.images}}).afterClosed().subscribe(n=>{n&&(this.picture=n)})}cancel(){this.router.navigate(["favorites"])}save(){let i=C.tz(`${this.date.toISOString().split("T")[0]}T${this.hour}`,"Europe/Paris").format();this.apiFavoriteService.saveFavorite(this.lotInfo,this.SaleInfo,this.picture,i,this.buyProject,this.maxPrice,this.Note).subscribe(n=>{this.notificationService.openSnackBar("Favorite saved"),this.router.navigate(["favorites"])})}static#t=this.\u0275fac=function(n){return new(n||o)(t.GI1(p.qW),t.GI1(u.gV),t.GI1(u.E5),t.GI1(A.g),t.GI1(B.g),t.GI1(U.o),t.GI1(E))};static#e=this.\u0275cmp=t.In1({type:o,selectors:[["app-new-favorites-page"]],decls:104,vars:19,consts:[[1,"dialog-card"],["fxLayout","row","fxLayoutGap","5px"],["fxLayout","column","fxLayoutGap","10px","fxFlex",""],[2,"width","100%"],["matInput","","maxlength","255",3,"ngModel","ngModelChange"],[2,"width","40%"],["matInput","","maxlength","30",3,"ngModel","ngModelChange"],["fxLayout","column","fxLayoutAlign","center center","fxFlex",""],[4,"ngIf"],["matInput","","maxlength","2",3,"ngModel","ngModelChange"],["matSuffix",""],[2,"width","50%"],["fxLayout","row"],["matInput","",2,"height","200px",3,"ngModel","ngModelChange"],["fxLayout","column","fxFlex","60"],["appearance","fill"],["matInput","",3,"matDatepicker","ngModel","ngModelChange"],["matSuffix","",3,"for"],["picker",""],["fxLayout","column","fxFlex","40"],["matInput","","type","time","maxlength","5",3,"ngModel","ngModelChange"],[3,"ngModel","ngModelChange"],[2,"width","30%"],["matInput","","maxlength","255","type","number",3,"ngModel","ngModelChange"],["matInput","",2,"height","100px",3,"ngModel","ngModelChange"],["mat-button","","color","warn",3,"click"],["mat-raised-button","","color","primary",3,"click"],["width","150px","height","150px"],[2,"width","150px","height","150px",3,"src","click"]],template:function(n,a){if(1&n&&(t.I0R(0,"mat-card",0)(1,"mat-card-header")(2,"mat-card-title"),t.OEk(3,"Lot"),t.C$Y(),t.I0R(4,"mat-card-subtitle"),t.OEk(5,"Lot information"),t.C$Y()(),t.I0R(6,"mat-card-content")(7,"div",1)(8,"div",2)(9,"mat-form-field",3)(10,"mat-label"),t.OEk(11,"Title"),t.C$Y(),t.I0R(12,"input",4),t.iHE("ngModelChange",function(e){return t.kNx(a.lotInfo.title,e)||(a.lotInfo.title=e),e}),t.C$Y()(),t.I0R(13,"mat-form-field",5)(14,"mat-label"),t.OEk(15,"Lot"),t.C$Y(),t.I0R(16,"input",6),t.iHE("ngModelChange",function(e){return t.kNx(a.lotInfo.lotNumber,e)||(a.lotInfo.lotNumber=e),e}),t.C$Y()()(),t.I0R(17,"div",7),t.yuY(18,Q,2,0,"div",8)(19,Z,2,1,"div",8),t.C$Y()(),t.I0R(20,"div",1)(21,"mat-form-field",5)(22,"mat-label"),t.OEk(23,"Fees"),t.C$Y(),t.I0R(24,"input",9),t.iHE("ngModelChange",function(e){return t.kNx(a.lotInfo.fees,e)||(a.lotInfo.fees=e),e}),t.C$Y(),t.I0R(25,"mat-icon",10),t.OEk(26,"percent"),t.C$Y()(),t.I0R(27,"p",3),t.OEk(28),t.C$Y()(),t.I0R(29,"div",1)(30,"mat-form-field",11)(31,"mat-label"),t.OEk(32,"Estimate Low"),t.C$Y(),t.I0R(33,"input",6),t.iHE("ngModelChange",function(e){return t.kNx(a.lotInfo.EstimateLow,e)||(a.lotInfo.EstimateLow=e),e}),t.C$Y()(),t.I0R(34,"mat-form-field",11)(35,"mat-label"),t.OEk(36,"Estimate High"),t.C$Y(),t.I0R(37,"input",6),t.iHE("ngModelChange",function(e){return t.kNx(a.lotInfo.EstimateHigh,e)||(a.lotInfo.EstimateHigh=e),e}),t.C$Y()()(),t.I0R(38,"div",12)(39,"mat-form-field",3)(40,"mat-label"),t.OEk(41,"Description"),t.C$Y(),t.I0R(42,"textarea",13),t.iHE("ngModelChange",function(e){return t.kNx(a.lotInfo.Description,e)||(a.lotInfo.Description=e),e}),t.C$Y()()()()(),t.I0R(43,"mat-card",0)(44,"mat-card-header")(45,"mat-card-title"),t.OEk(46,"Sale"),t.C$Y(),t.I0R(47,"mat-card-subtitle"),t.OEk(48,"Sale information"),t.C$Y()(),t.I0R(49,"mat-card-content")(50,"div",1)(51,"mat-form-field",3)(52,"mat-label"),t.OEk(53,"Title"),t.C$Y(),t.I0R(54,"input",4),t.iHE("ngModelChange",function(e){return t.kNx(a.SaleInfo.title,e)||(a.SaleInfo.title=e),e}),t.C$Y()()(),t.I0R(55,"div",1)(56,"div",14)(57,"mat-form-field",15)(58,"mat-label"),t.OEk(59,"Choose a date"),t.C$Y(),t.I0R(60,"input",16),t.iHE("ngModelChange",function(e){return t.kNx(a.date,e)||(a.date=e),e}),t.C$Y(),t.wR5(61,"mat-datepicker-toggle",17)(62,"mat-datepicker",null,18),t.C$Y()(),t.I0R(64,"div",19)(65,"mat-form-field")(66,"mat-label"),t.OEk(67,"Hour"),t.C$Y(),t.I0R(68,"input",20),t.iHE("ngModelChange",function(e){return t.kNx(a.hour,e)||(a.hour=e),e}),t.C$Y()()()(),t.I0R(69,"div",1)(70,"mat-form-field",11)(71,"mat-label"),t.OEk(72,"location"),t.C$Y(),t.I0R(73,"input",4),t.iHE("ngModelChange",function(e){return t.kNx(a.SaleInfo.location,e)||(a.SaleInfo.location=e),e}),t.C$Y()()(),t.I0R(74,"div",1)(75,"mat-form-field",3)(76,"mat-label"),t.OEk(77,"Sale House"),t.C$Y(),t.I0R(78,"input",4),t.iHE("ngModelChange",function(e){return t.kNx(a.SaleInfo.saleHouseName,e)||(a.SaleInfo.saleHouseName=e),e}),t.C$Y()()()()(),t.I0R(79,"mat-card",0)(80,"mat-card-header")(81,"mat-card-title"),t.OEk(82,"Perso"),t.C$Y()(),t.I0R(83,"mat-card-content")(84,"div",1)(85,"mat-checkbox",21),t.iHE("ngModelChange",function(e){return t.kNx(a.buyProject,e)||(a.buyProject=e),e}),t.OEk(86,"Buy Project"),t.C$Y()(),t.I0R(87,"div",1)(88,"mat-form-field",22)(89,"mat-label"),t.OEk(90,"Max price"),t.C$Y(),t.I0R(91,"input",23),t.iHE("ngModelChange",function(e){return t.kNx(a.maxPrice,e)||(a.maxPrice=e),e}),t.C$Y()()(),t.I0R(92,"div",12)(93,"mat-form-field",3)(94,"mat-label"),t.OEk(95,"Note"),t.C$Y(),t.I0R(96,"textarea",24),t.iHE("ngModelChange",function(e){return t.kNx(a.Note,e)||(a.Note=e),e}),t.C$Y()()()()(),t.I0R(97,"mat-card")(98,"mat-card-content")(99,"div",1)(100,"button",25),t.qCj("click",function(){return a.cancel()}),t.OEk(101,"Cancel"),t.C$Y(),t.I0R(102,"button",26),t.qCj("click",function(){return a.save()}),t.OEk(103,"Save"),t.C$Y()()()()),2&n){const r=t.Gew(63);t.yG2(12),t.OKB("ngModel",a.lotInfo.title),t.yG2(4),t.OKB("ngModel",a.lotInfo.lotNumber),t.yG2(2),t.E7m("ngIf",0==a.images.length),t.yG2(),t.E7m("ngIf",a.images.length>0),t.yG2(5),t.OKB("ngModel",a.lotInfo.fees),t.yG2(4),t.cNF(a.lotInfo.feesText),t.yG2(5),t.OKB("ngModel",a.lotInfo.EstimateLow),t.yG2(4),t.OKB("ngModel",a.lotInfo.EstimateHigh),t.yG2(5),t.OKB("ngModel",a.lotInfo.Description),t.yG2(12),t.OKB("ngModel",a.SaleInfo.title),t.yG2(6),t.E7m("matDatepicker",r),t.OKB("ngModel",a.date),t.yG2(),t.E7m("for",r),t.yG2(7),t.OKB("ngModel",a.hour),t.yG2(5),t.OKB("ngModel",a.SaleInfo.location),t.yG2(5),t.OKB("ngModel",a.SaleInfo.saleHouseName),t.yG2(7),t.OKB("ngModel",a.buyProject),t.yG2(6),t.OKB("ngModel",a.maxPrice),t.yG2(5),t.OKB("ngModel",a.Note)}},dependencies:[f.u_,g.ot,g.O4,g.ue,g.Mj,g._G,d.sZ,d.cZ,d.qG,d.CA,j.qL,M.Gw,m.SM,m.WK,m.Uc,m.uK,m.gp,_.yi,h.Up,h.w5,h.Gm,I.SU,I.Ul,I.yu,W.WK,z.W],styles:["mat-icon[_ngcontent-%COMP%]{color:#c80000}"]})}return o})()}]}];let V=(()=>{class o{static#t=this.\u0275fac=function(n){return new(n||o)};static#e=this.\u0275mod=t.a4G({type:o});static#a=this.\u0275inj=t.s3X({imports:[u.qQ.forChild(J),u.qQ]})}return o})();var q=l(9588);let tt=(()=>{class o{static#t=this.\u0275fac=function(n){return new(n||o)};static#e=this.\u0275mod=t.a4G({type:o});static#a=this.\u0275inj=t.s3X({imports:[f.MD,q.k,V]})}return o})()}}]);