1export const emitter = mitt(); 2 3export class global_params { 4 static regions = []; 5 static region_indexes = {}; 6 static region_boundaries = null; 7 static cities = []; 8 static city_indexes = {}; 9 static districts = []; 10 static district_indexes = {}; 11 static district_boundaries = null; 12 static ksa_geo_json = { 13 "type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-126.131845,-57.136239],[-126.131845,81.403423],[206.30569,81.403423],[206.30569,-57.136239],[-126.131845,-57.136239]], [[42.757433,16.405129],[42.767303,16.398015],[42.797653,16.394656],[42.831024,16.3743],[42.963409,16.397093],[42.949402,16.449783],[42.95668,16.491728],[42.998978,16.512993],[43.128754,16.516877],[43.153954,16.632771],[43.149765,16.659678],[43.22406,16.635863],[43.244797,16.638823],[43.237759,16.70549],[43.220387,16.70812],[43.238583,16.732846],[43.256916,16.732222],[43.284279,16.745932],[43.26622,16.763618],[43.263268,16.778772],[43.274117,16.797343],[43.254684,16.810654],[43.235287,16.812133],[43.225159,16.840526],[43.202843,16.857875],[43.18523,16.85873],[43.17881,16.872463],[43.157352,16.883896],[43.15052,16.902555],[43.144581,16.911457],[43.150383,16.92187],[43.173214,16.925877],[43.179943,16.933628],[43.198551,16.941149],[43.19965,16.958489],[43.184097,16.966305],[43.187565,16.983052],[43.18293,16.994018],[43.18499,17.009219],[43.202465,17.006035],[43.228111,17.005969],[43.244865,17.021793],[43.247818,17.041128],[43.230995,17.079824],[43.210361,17.086125],[43.188217,17.104666],[43.167618,17.097841],[43.166931,17.115166],[43.184921,17.128028],[43.176476,17.170708],[43.198792,17.186256],[43.224129,17.209575],[43.207031,17.242465],[43.208061,17.255613],[43.258564,17.272924],[43.271507,17.284988],[43.305642,17.28725],[43.316487,17.294101],[43.34203,17.299608],[43.33434,17.330549],[43.285725,17.359388],[43.237111,17.384814],[43.25359,17.400278],[43.232167,17.426485],[43.262379,17.456881],[43.249333,17.478954],[43.264439,17.485765],[43.354802,17.547579],[43.376225,17.536579],[43.419359,17.545451],[43.668749,17.34841],[43.803881,17.321143],[43.958788,17.311703],[44.202684,17.37777],[44.360887,17.400835],[44.564135,17.383012],[45.203539,17.39769],[45.390307,17.303312],[46.373583,17.195243],[46.73723,17.244564],[46.998705,16.909552],[47.183275,16.921114],[47.488695,17.093411],[47.632891,17.436476],[48.206652,18.146504],[49.128405,18.588071],[50.794756,18.764224],[52.008745,18.977338],[55.029488,19.955278],[55.694126,22.006976],[55.210728,22.74047],[55.122837,22.66547],[52.591587,22.95814],[51.607761,24.14149],[51.612156,24.267748],[51.464939,24.409889],[51.607761,24.569856],[51.603367,24.711656],[51.368259,24.649763],[51.291355,24.53588],[51.091404,24.511891],[50.933201,24.58784],[50.834324,24.773518],[50.611301,25.197237],[50.527805,25.476753],[50.193821,25.967675],[50.32291,26.301048],[50.265781,26.650159],[49.824131,27.02659],[49.761509,27.300279],[49.089146,27.785388],[48.548069,28.5563],[47.732883,28.571256],[47.496128,29.063612],[46.611729,29.126972],[46.421116,29.093377],[44.736912,29.224336],[42.093601,31.152883],[41.447605,31.40452],[40.421482,31.976629],[39.187717,32.174915],[38.987217,32.017159],[36.96793,31.518381],[37.961094,30.503354],[37.639195,30.352731],[37.483189,30.02844],[36.767429,29.898996],[36.374119,29.429312],[36.070896,29.214747],[34.900852,29.393901],[34.725071,28.652272],[34.534458,28.075615],[34.591587,27.988338],[35.099155,28.003859],[35.66605,27.268058],[36.226353,26.429015],[36.513645,25.95434],[36.794895,25.534759],[37.128879,25.105746],[37.133274,24.763542],[37.462864,24.223673],[37.93198,24.048721],[38.360447,23.747891],[38.707615,23.084533],[39.021824,22.385381],[38.800449,21.899475],[39.050938,21.188253],[39.413487,20.621731],[39.690891,20.27946],[40.209446,20.040192],[40.670872,19.572989],[40.92136,19.135568],[41.127388,18.507219],[41.762913,17.610254],[42.123264,17.377639],[42.428135,16.779035],[42.757433,16.405129]]]}}] 14 }; 15 static months = [ 16 "Jan", 17 "Feb", 18 "Mar", 19 "Apr", 20 "May", 21 "Jun", 22 "Jul", 23 "Aug", 24 "Sep", 25 "Oct", 26 "Nov", 27 "Dec", 28 ]; 29 static ages = { 30 1 : "New", 31 2 : "LessThanYear", 32 3 : "OneYear", 33 4 : "TwoYears", 34 5 : "ThreeYears", 35 6 : "FourYears", 36 7 : "FiveYears", 37 8 : "SixYears", 38 9 : "SevenYears", 39 10 : "EightYears", 40 11 : "NineYears", 41 12 : "TenYears", 42 13 : "MoreThenTenYears", 43 } 44 static legend_icons = { 45 "Apartment": "/assets/maalek/images/map-icons/apartment-icon-l.png", 46 "Studio": "/assets/maalek/images/map-icons/apartment-icon-l.png", 47 "Room": "/assets/maalek/images/map-icons/apartment-icon-l.png", 48 "Floor": "/assets/maalek/images/map-icons/floor-icon-l.png", 49 "Town House": "/assets/maalek/images/map-icons/floor-icon-l.png", 50 "Penthouse": "/assets/maalek/images/map-icons/floor-icon-l.png", 51 "Villa": "/assets/maalek/images/map-icons/villa-icon-l.png", 52 "School": "/assets/maalek/images/map-icons/villa-icon-l.png", 53 "HospitalOrHealthCenter": "/assets/maalek/images/map-icons/villa-icon-l.png", 54 "Building": "/assets/maalek/images/map-icons/building-icon-l.png", 55 "Compound": "/assets/maalek/images/map-icons/building-icon-l.png", 56 "Tower": "/assets/maalek/images/map-icons/building-icon-l.png", 57 "Hotel": "/assets/maalek/images/map-icons/building-icon-l.png", 58 "Chalet": "/assets/maalek/images/map-icons/chalet-icon-l.png", 59 "RestHouse": "/assets/maalek/images/map-icons/chalet-icon-l.png", 60 "Farm": "/assets/maalek/images/map-icons/farm-icon-l.png", 61 "Land": "/assets/maalek/images/map-icons/land-icon-l.png", 62 "TelecomTower": "/assets/maalek/images/map-icons/land-icon-l.png", 63 "ElectricityStation": "/assets/maalek/images/map-icons/land-icon-l.png", 64 "Teller": "/assets/maalek/images/map-icons/land-icon-l.png", 65 "Shop": "/assets/maalek/images/map-icons/shop-icon-l.png", 66 "Booth": "/assets/maalek/images/map-icons/shop-icon-l.png", 67 "RepairShop": "/assets/maalek/images/map-icons/shop-icon-l.png",
68 "Office": "/assets/maalek/images/map-icons/shop-icon-l.png", 69 "Warehouses": "/assets/maalek/images/map-icons/warehouse-icon-l.png", 70 "Station": "/assets/maalek/images/map-icons/warehouse-icon-l.png", 71 "Factory": "/assets/maalek/images/map-icons/warehouse-icon-l.png", 72 "CarParking": "/assets/maalek/images/map-icons/warehouse-icon-l.png", 73 "Cinema": "/assets/maalek/images/map-icons/warehouse-icon-l.png", 74 "Exhibition": "/assets/maalek/images/map-icons/warehouse-icon-l.png", 75 }; 76 static map_icons = { 77 "Mashro": "/assets/maalek/images/map-icons/default-icon-d.png", 78 "Default": { 79 "Rent": "/assets/maalek/images/map-icons/default-icon-g.png", 80 "Sale": "/assets/maalek/images/map-icons/default-icon-b.png", 81 "Auction": "/assets/maalek/images/map-icons/default-icon-o.png", 82 }, 83 "Apartment": { 84 "Rent": "/assets/maalek/images/map-icons/apartment-icon-g.png", 85 "Sale": "/assets/maalek/images/map-icons/apartment-icon-b.png", 86 "Auction": "/assets/maalek/images/map-icons/apartment-icon-o.png", 87 }, 88 "Studio": { 89 "Rent": "/assets/maalek/images/map-icons/apartment-icon-g.png", 90 "Sale": "/assets/maalek/images/map-icons/apartment-icon-b.png", 91 "Auction": "/assets/maalek/images/map-icons/apartment-icon-o.png", 92 }, 93 "Room": { 94 "Rent": "/assets/maalek/images/map-icons/apartment-icon-g.png", 95 "Sale": "/assets/maalek/images/map-icons/apartment-icon-b.png", 96 "Auction": "/assets/maalek/images/map-icons/apartment-icon-o.png", 97 }, 98 "Floor": { 99 "Rent": "/assets/maalek/images/map-icons/floor-icon-g.png", 100 "Sale": "/assets/maalek/images/map-icons/floor-icon-b.png", 101 "Auction": "/assets/maalek/images/map-icons/floor-icon-o.png", 102 }, 103 "Town House": { 104 "Rent": "/assets/maalek/images/map-icons/floor-icon-g.png", 105 "Sale": "/assets/maalek/images/map-icons/floor-icon-b.png", 106 "Auction": "/assets/maalek/images/map-icons/floor-icon-o.png", 107 }, 108 "Penthouse": { 109 "Rent": "/assets/maalek/images/map-icons/floor-icon-g.png", 110 "Sale": "/assets/maalek/images/map-icons/floor-icon-b.png", 111 "Auction": "/assets/maalek/images/map-icons/floor-icon-o.png", 112 }, 113 "Villa": { 114 "Rent": "/assets/maalek/images/map-icons/villa-icon-g.png", 115 "Sale": "/assets/maalek/images/map-icons/villa-icon-b.png", 116 "Auction": "/assets/maalek/images/map-icons/villa-icon-o.png", 117 }, 118 "School": { 119 "Rent": "/assets/maalek/images/map-icons/villa-icon-g.png", 120 "Sale": "/assets/maalek/images/map-icons/villa-icon-b.png", 121 "Auction": "/assets/maalek/images/map-icons/villa-icon-o.png", 122 }, 123 "HospitalOrHealthCenter": { 124 "Rent": "/assets/maalek/images/map-icons/villa-icon-g.png", 125 "Sale": "/assets/maalek/images/map-icons/villa-icon-b.png", 126 "Auction": "/assets/maalek/images/map-icons/villa-icon-o.png", 127 }, 128 "House": { 129 "Rent": "/assets/maalek/images/map-icons/house-icon-g.png", 130 "Sale": "/assets/maalek/images/map-icons/house-icon-b.png", 131 "Auction": "/assets/maalek/images/map-icons/house-icon-o.png", 132 }, 133 "Building": { 134 "Rent": "/assets/maalek/images/map-icons/building-icon-g.png", 135 "Sale": "/assets/maalek/images/map-icons/building-icon-b.png", 136 "Auction": "/assets/maalek/images/map-icons/building-icon-o.png", 137 }, 138 "Compound": { 139 "Rent": "/assets/maalek/images/map-icons/building-icon-g.png", 140 "Sale": "/assets/maalek/images/map-icons/building-icon-b.png", 141 "Auction": "/assets/maalek/images/map-icons/building-icon-o.png", 142 }, 143 "Tower": { 144 "Rent": "/assets/maalek/images/map-icons/building-icon-g.png", 145 "Sale": "/assets/maalek/images/map-icons/building-icon-b.png", 146 "Auction": "/assets/maalek/images/map-icons/building-icon-o.png", 147 }, 148 "Hotel": { 149 "Rent": "/assets/maalek/images/map-icons/building-icon-g.png", 150 "Sale": "/assets/maalek/images/map-icons/building-icon-b.png", 151 "Auction": "/assets/maalek/images/map-icons/building-icon-o.png", 152 }, 153 "Chalet": { 154 "Rent": "/assets/maalek/images/map-icons/chalet-icon-g.png", 155 "Sale": "/assets/maalek/images/map-icons/chalet-icon-b.png", 156 "Auction": "/assets/maalek/images/map-icons/chalet-icon-o.png", 157 }, 158 "RestHouse": { 159 "Rent": "/assets/maalek/images/map-icons/chalet-icon-g.png", 160 "Sale": "/assets/maalek/images/map-icons/chalet-icon-b.png", 161 "Auction": "/assets/maalek/images/map-icons/chalet-icon-o.png", 162 }, 163 "Camp": { 164 "Rent": "/assets/maalek/images/map-icons/camp-icon-g.png", 165 "Sale": "/assets/maalek/images/map-icons/camp-icon-b.png", 166 "Auction": "/assets/maalek/images/map-icons/camp-icon-o.png", 167 }, 168 "Farm": { 169 "Rent": "/assets/maalek/images/map-icons/farm-icon-g.png", 170 "Sale": "/assets/maalek/images/map-icons/farm-icon-b.png", 171 "Auction": "/assets/maalek/images/map-icons/farm-icon-o.png", 172 }, 173 "Land": { 174 "Rent": "/assets/maalek/images/map-icons/land-icon-g.png", 175 "Sale": "/assets/maalek/images/map-icons/land-icon-b.png", 176 "Auction": "/assets/maalek/images/map-icons/land-icon-o.png", 177 }, 178 "TelecomTower": { 179 "Rent": "/assets/maalek/images/map-icons/land-icon-g.png", 180 "Sale": "/assets/maalek/images/map-icons/land-icon-b.png", 181 "Auction": "/assets/maalek/images/map-icons/land-icon-o.png", 182 }, 183 "ElectricityStation": { 184 "Rent": "/assets/maalek/images/map-icons/land-icon-g.png", 185 "Sale": "/assets/maalek/images/map-icons/land-icon-b.png", 186 "Auction": "/assets/maalek/images/map-icons/land-icon-o.png", 187 }, 188 "Teller": { 189 "Rent": "/assets/maalek/images/map-icons/land-icon-g.png", 190 "Sale": "/assets/maalek/images/map-icons/land-icon-b.png", 191 "Auction": "/assets/maalek/images/map-icons/land-icon-o.png", 192 }, 193 "Shop": { 194 "Rent": "/assets/maalek/images/map-icons/shop-icon-g.png", 195 "Sale": "/assets/maalek/images/map-icons/shop-icon-b.png", 196 "Auction": "/assets/maalek/images/map-icons/shop-icon-o.png", 197 }, 198 "Booth": { 199 "Rent": "/assets/maalek/images/map-icons/shop-icon-g.png", 200 "Sale": "/assets/maalek/images/map-icons/shop-icon-b.png", 201 "Auction": "/assets/maalek/images/map-icons/shop-icon-o.png", 202 }, 203 "RepairShop": { 204 "Rent": "/assets/maalek/images/map-icons/shop-icon-g.png", 205 "Sale": "/assets/maalek/images/map-icons/shop-icon-b.png", 206 "Auction": "/assets/maalek/images/map-icons/shop-icon-o.png", 207 },
208 "Office": { 209 "Rent": "/assets/maalek/images/map-icons/shop-icon-g.png", 210 "Sale": "/assets/maalek/images/map-icons/shop-icon-b.png", 211 "Auction": "/assets/maalek/images/map-icons/shop-icon-o.png", 212 }, 213 "Warehouses": { 214 "Rent": "/assets/maalek/images/map-icons/warehouse-icon-g.png", 215 "Sale": "/assets/maalek/images/map-icons/warehouse-icon-b.png", 216 "Auction": "/assets/maalek/images/map-icons/warehouse-icon-o.png", 217 }, 218 "Station": { 219 "Rent": "/assets/maalek/images/map-icons/warehouse-icon-g.png", 220 "Sale": "/assets/maalek/images/map-icons/warehouse-icon-b.png", 221 "Auction": "/assets/maalek/images/map-icons/warehouse-icon-o.png", 222 }, 223 "Factory": { 224 "Rent": "/assets/maalek/images/map-icons/warehouse-icon-g.png", 225 "Sale": "/assets/maalek/images/map-icons/warehouse-icon-b.png", 226 "Auction": "/assets/maalek/images/map-icons/warehouse-icon-o.png", 227 }, 228 "CarParking": { 229 "Rent": "/assets/maalek/images/map-icons/warehouse-icon-g.png", 230 "Sale": "/assets/maalek/images/map-icons/warehouse-icon-b.png", 231 "Auction": "/assets/maalek/images/map-icons/warehouse-icon-o.png", 232 }, 233 "Cinema": { 234 "Rent": "/assets/maalek/images/map-icons/warehouse-icon-g.png", 235 "Sale": "/assets/maalek/images/map-icons/warehouse-icon-b.png", 236 "Auction": "/assets/maalek/images/map-icons/warehouse-icon-o.png", 237 }, 238 "Exhibition": { 239 "Rent": "/assets/maalek/images/map-icons/warehouse-icon-g.png", 240 "Sale": "/assets/maalek/images/map-icons/warehouse-icon-b.png", 241 "Auction": "/assets/maalek/images/map-icons/warehouse-icon-o.png", 242 }, 243 }; 244 static ad_type_colors = { 245 Rent: "#4CBB17", 246 Sale: "#4d89ff", 247 Auction: "#ff9000", 248 }; 249 250 constructor() {} 251 static async get_regions(with_bounds=true) { 252 if (global_params.regions.length > 0) return global_params.regions; 253 try { 254 emitter.emit("show-full-loading"); 255 let params = { 256 'with_bounds' : with_bounds 257 }; 258 let res = await $.ajax({
259 headers: { "X-Frappe-CSRF-Token": this.csrf_token }, 260 url: "/api/method/maalek.api.get_regions", 261 type: "GET", 262 data: params, //for GET request 263 // data: JSON.stringify(params) //for POST request 264 }); 265 for (let index = 0; index < res.message.length; index++) { 266 var region = res.message[index]; 267 global_params.regions.push(region); 268 global_params.region_indexes[region.region_id] = index; 269 } 270 // emitter.emit("update-property-form"); 271 emitter.emit("hide-full-loading"); 272 return global_params.regions; 273 } catch (error) { 274 console.log("error"); 275 console.log(error); 276 emitter.emit("hide-full-loading"); 277 return []; 278 } 279 } 280 static get_region(region_id) { 281 let region = global_params.regions[global_params.region_indexes[region_id]]; 282 if(region == undefined){ 283 region = global_params.regions[global_params.region_indexes["0"+region_id]]; 284 } 285 return region; 286 } 287 static async get_cities(region_id = null) { 288 // if(global_params.cities.length > 0) 289 // return global_params.cities 290 global_params.cities = []; 291 try { 292 emitter.emit("show-full-loading"); 293 let params = {}; 294 if (region_id) { 295 params["region_id"] = region_id; 296 } 297 let res = await $.ajax({
298 headers: { "X-Frappe-CSRF-Token": this.csrf_token }, 299 url: "/api/method/maalek.api.get_cities", 300 type: "GET", 301 data: params, //for GET request 302 // data: JSON.stringify(params) //for POST request 303 }); 304 for (let index = 0; index < res.message.length; index++) { 305 var city = res.message[index]; 306 global_params.cities.push(city); 307 global_params.city_indexes[city.city_id] = index; 308 } 309 // emitter.emit("update-property-form"); 310 emitter.emit("hide-full-loading"); 311 return global_params.cities; 312 } catch (error) { 313 console.log("error"); 314 console.log(error); 315 emitter.emit("hide-full-loading"); 316 return []; 317 } 318 } 319 static get_city(city_id) { 320 let city = global_params.cities[global_params.city_indexes[city_id]]; 321 return city; 322 } 323 static async get_districts(city_id) { 324 // if(global_params.districts.length > 0) 325 // return global_params.districts 326 global_params.districts = []; 327 try { 328 emitter.emit("show-full-loading"); 329 let params = {}; 330 let res = await $.ajax({
331 headers: { "X-Frappe-CSRF-Token": this.csrf_token }, 332 url: "/api/method/maalek.api.get_districts?city_id=" + city_id, 333 type: "GET", 334 data: params, //for GET request 335 // data: JSON.stringify(params) //for POST request 336 }); 337 for (let index = 0; index < res.message.length; index++) { 338 var district = res.message[index]; 339 global_params.districts.push(district); 340 global_params.district_indexes[district.district_id] = index; 341 // console.log(district.center); 342 } 343 // emitter.emit("update-property-form"); 344 emitter.emit("hide-full-loading"); 345 return global_params.districts; 346 } catch (error) { 347 console.log("error"); 348 console.log(error); 349 emitter.emit("hide-full-loading"); 350 return []; 351 } 352 } 353 static get_district(district_id) { 354 let district = 355 global_params.districts[global_params.district_indexes[district_id]]; 356 return district; 357 } 358 static async get_region_boundaries(region_id) { 359 global_params.region_boundaries = null; 360 try { 361 emitter.emit("show-full-loading"); 362 let params = {}; 363 let res = await $.ajax({
364 headers: { "X-Frappe-CSRF-Token": this.csrf_token }, 365 url: 366 "/api/method/maalek.api.get_region_boundaries?region_id=" + region_id, 367 type: "GET", 368 data: params, //for GET request 369 // data: JSON.stringify(params) //for POST request 370 }); 371 global_params.region_boundaries = res.message.boundaries; 372 emitter.emit("hide-full-loading"); 373 if (res.message == "") return null; 374 return res.message.boundaries; 375 } catch (error) { 376 console.log("error"); 377 console.log(error); 378 emitter.emit("hide-full-loading"); 379 return null; 380 } 381 } 382 static async get_district_boundaries(district_id) { 383 global_params.district_boundaries = null; 384 try { 385 emitter.emit("show-full-loading"); 386 let params = {}; 387 let res = await $.ajax({ 388 headers: { "X-Frappe-CSRF-Token": this.csrf_token }, 389 url: 390 "/api/method/maalek.api.get_district_boundaries?district_id=" + 391 district_id, 392 type: "GET", 393 data: params, //for GET request 394 // data: JSON.stringify(params) //for POST request 395 }); 396 global_params.district_boundaries = res.message.boundaries; 397 emitter.emit("hide-full-loading"); 398 if (res.message == "") return null; 399 return res.message.boundaries; 400 } catch (error) { 401 console.log("error"); 402 console.log(error); 403 emitter.emit("hide-full-loading"); 404 return null; 405 } 406 } 407} 408 409export class image_file { 410 data = null; 411 file = null; 412 link = null; 413 link_name = null; 414 constructor(options = {}) { 415 this.data = options.data || null; 416 this.file = options.file || null; 417 this.link = options.link || null; 418 this.link_name = options.link_name || null; 419 } 420} 421 422export class pdf_file { 423 data = null; 424 file = null; 425 link = null; 426 type = null; 427 link_name = null; 428 constructor(options = {}) { 429 this.data = options.data || null; 430 this.file = options.file || null; 431 this.link = options.link || null; 432 this.type = options.type || null; 433 this.link_name = options.link_name || null; 434 } 435} 436export const mashro_constants = { 437 mashro_guarantee_types:["Electrical","Plumbing","Doors","Lighting","Structural","Windows","Switches","Sanitary"], 438 mashro_property_types:[ "Land","Apartment","Villa","Floor","Building","Office","Chalet","Town House","Penthouse"] 439} 440// export const quick_cart = new cart_obj(); 441export const property_constants = { 442 property_keys: [ 443 "Land", 444 "Apartment", 445 "Villa", 446 "Shop", 447 "Floor", 448 "Building", 449 "Office", 450 "RestHouse", 451 "Chalet", 452 "Warehouses", 453 "Studio", 454 "Room", 455 "Compound", 456 "Tower", 457 "Exhibition", 458 "Booth", 459 "Cinema", 460 "Hotel", 461 "CarParking", 462 "RepairShop", 463 "Teller", 464 "Factory", 465 "School", 466 "HospitalOrHealthCenter", 467 "ElectricityStation", 468 "TelecomTower", 469 "Station", 470 "Farm", 471 ], 472 property_types: { 473 "Apartment": [ 474 "video", 475 "for_type", 476 "location", 477 "is_family", 478 "is_furnished", 479 "is_kitchen", 480 "is_rooftop", 481 "is_parking", 482 "is_elevator", 483 "is_air_conditioners", 484 "is_private_entrance", 485 "is_two_entrances", 486 "is_inside_villa", 487 "is_inside_building", 488 "allow_whatsapp", 489 "allow_call", 490 "publish", 491 "street_width", 492 "no_bed", 493 "size", 494 "front", 495 "side", 496 "no_living", 497 "no_bath", 498 "floor_num", 499 "age", 500 "price_sqr_meter", 501 "total_price", 502 "region", 503 "city", 504 "district", 505 "description", 506 ], 507 "Studio": [ 508 "video", 509 "for_type", 510 "location", 511 "is_family", 512 "is_furnished", 513 "is_kitchen", 514 "is_rooftop", 515 "is_parking", 516 "is_elevator", 517 "is_air_conditioners", 518 "is_private_entrance", 519 "is_two_entrances", 520 "is_inside_villa", 521 "is_inside_building", 522 "allow_whatsapp", 523 "allow_call", 524 "publish", 525 "street_width", 526 "no_bed", 527 "size", 528 "front", 529 "side", 530 "no_bath", 531 "floor_num", 532 "age", 533 "price_sqr_meter", 534 "total_price", 535 "region", 536 "city", 537 "district", 538 "description", 539 ], 540 "Room": [ 541 "video", 542 "for_type", 543 "location", 544 "is_family", 545 "is_furnished", 546 "is_kitchen", 547 "is_rooftop", 548 "is_parking", 549 "is_elevator", 550 "is_air_conditioners", 551 "is_private_entrance", 552 "is_two_entrances", 553 "is_inside_villa", 554 "is_inside_building", 555 "allow_whatsapp", 556 "allow_call", 557 "publish", 558 "street_width", 559 "size", 560 "front", 561 "side", 562 "floor_num", 563 "age", 564 "price_sqr_meter", 565 "total_price", 566 "region", 567 "city", 568 "district", 569 "description", 570 ], 571 "Floor": [ 572 "video", 573 "for_type", 574 "location", 575 "is_family", 576 "is_furnished", 577 "is_kitchen", 578 "is_rooftop", 579 "is_parking", 580 "is_elevator", 581 "is_air_conditioners", 582 "is_private_entrance", 583 "is_two_entrances", 584 "is_inside_villa", 585 "is_inside_building", 586 "allow_whatsapp", 587 "allow_call", 588 "publish", 589 "street_width", 590 "no_bed", 591 "size", 592 "front", 593 "side", 594 "no_living", 595 "no_bath", 596 "floor_num", 597 "age", 598 "price_sqr_meter", 599 "total_price", 600 "region", 601 "city", 602 "district", 603 "description", 604 ], 605 "Villa": [ 606 "video", 607 "location", 608 "is_furnished", 609 "is_kitchen", 610 "is_rooftop", 611 "is_parking", 612 "is_elevator", 613 "is_air_conditioners", 614 "is_internal_stairs", 615 "is_driver_room", 616 "is_maid_room", 617 "is_pool", 618 "is_fire_room", 619 "is_yard", 620 "is_basement", 621 "is_duplex", 622 "allow_whatsapp", 623 "allow_call", 624 "publish", 625 "street_width", 626 "no_bed", 627 "size", 628 "front", 629 "side", 630 "no_living", 631 "no_bath", 632 "age", 633 "price_sqr_meter", 634 "total_price", 635 "region", 636 "city", 637 "district", 638 "description" 639 ], 640 "School": [ 641 "video", 642 "location", 643 "is_furnished", 644 "is_kitchen", 645 "is_rooftop", 646 "is_parking", 647 "is_elevator", 648 "is_air_conditioners", 649 "is_internal_stairs", 650 "is_driver_room", 651 "is_maid_room", 652 "is_pool", 653 "is_fire_room", 654 "is_yard", 655 "is_basement", 656 "is_duplex", 657 "allow_whatsapp", 658 "allow_call", 659 "publish", 660 "street_width", 661 "no_bed", 662 "size", 663 "front", 664 "side", 665 "no_bath", 666 "age", 667 "price_sqr_meter", 668 "total_price", 669 "region", 670 "city", 671 "district", 672 "description" 673 ], 674 "HospitalOrHealthCenter": [ 675 "video", 676 "location", 677 "is_furnished", 678 "is_kitchen", 679 "is_rooftop", 680 "is_parking", 681 "is_elevator", 682 "is_air_conditioners", 683 "is_internal_stairs", 684 "is_driver_room", 685 "is_maid_room", 686 "is_pool", 687 "is_fire_room", 688 "is_yard", 689 "is_basement", 690 "is_duplex", 691 "allow_whatsapp", 692 "allow_call", 693 "publish", 694 "street_width", 695 "no_bed", 696 "size", 697 "front", 698 "side", 699 "no_bath", 700 "age", 701 "price_sqr_meter", 702 "total_price", 703 "region", 704 "city", 705 "district", 706 "description" 707 ], 708 "Building": [ 709 "video", 710 "location", 711 "is_furnished", 712 "allow_whatsapp", 713 "allow_call", 714 "publish", 715 "is_parking", 716 "is_elevator", 717 "is_air_conditioners", 718 "property_for", 719 "street_width", 720 "size", 721 "front", 722 "side", 723 "age", 724 "price_sqr_meter", 725 "total_price", 726 "region", 727 "city", 728 "district", 729 "description", 730 "no_apartment", 731 "no_shop", 732 ], 733 "Compound": [ 734 "video", 735 "location", 736 "is_furnished", 737 "allow_whatsapp", 738 "allow_call", 739 "publish", 740 "is_parking", 741 "property_for", 742 "street_width", 743 "size", 744 "front", 745 "side", 746 "age", 747 "price_sqr_meter", 748 "total_price", 749 "region", 750 "city", 751 "district", 752 "description", 753 ], 754 "Tower": [ 755 "video", 756 "location", 757 "is_furnished", 758 "allow_whatsapp", 759 "allow_call", 760 "publish", 761 "is_parking", 762 "is_elevator", 763 "is_air_conditioners", 764 "property_for", 765 "street_width", 766 "size", 767 "front", 768 "side", 769 "age", 770 "price_sqr_meter", 771 "total_price", 772 "region", 773 "city", 774 "district", 775 "description", 776 "no_apartment", 777 "no_shop", 778 ], 779 "Hotel": [ 780 "video", 781 "location", 782 "is_furnished", 783 "allow_whatsapp", 784 "allow_call", 785 "publish", 786 "is_parking", 787 "is_elevator", 788 "is_air_conditioners", 789 "property_for", 790 "street_width", 791 "size", 792 "front", 793 "side", 794 "age", 795 "price_sqr_meter", 796 "total_price", 797 "region", 798 "city", 799 "district", 800 "description", 801 "no_apartment", 802 "no_shop", 803 ], 804 "RestHouse": [ 805 "video", 806 "location", 807 "is_kitchen", 808 "is_pool", 809 "is_fire_room", 810 "is_football_area", 811 "is_volleyball_area", 812 "is_amusement_area", 813 "is_female_section", 814 "allow_whatsapp", 815 "allow_call", 816 "publish", 817 "street_width", 818 "no_bed", 819 "size", 820 "front", 821 "side", 822 "no_living", 823 "no_bath", 824 "age", 825 "price_sqr_meter", 826 "total_price", 827 "region", 828 "city", 829 "district", 830 "description", 831 ], 832 "Chalet": [ 833 "video", 834 "location", 835 "is_kitchen", 836 "is_pool", 837 "is_fire_room", 838 "is_football_area", 839 "is_volleyball_area", 840 "is_amusement_area", 841 "is_female_section", 842 "allow_whatsapp", 843 "allow_call", 844 "publish", 845 "street_width", 846 "no_bed", 847 "size", 848 "front", 849 "side", 850 "no_living", 851 "no_bath", 852 "age", 853 "price_sqr_meter", 854 "total_price", 855 "region", 856 "city", 857 "district", 858 "description", 859 ], 860 "Farm": [ 861 "video", 862 "location", 863 "allow_whatsapp", 864 "allow_call", 865 "publish", 866 "size", 867 "front", 868 "side", 869 "price_sqr_meter", 870 "total_price", 871 "region", 872 "city", 873 "district", 874 "description", 875 "age", 876 ], 877 "Land": [ 878 "video", 879 "location", 880 "allow_whatsapp", 881 "allow_call", 882 "publish", 883 "property_for", 884 "street_width", 885 "size", 886 "front", 887 "side", 888 "price_sqr_meter", 889 "total_price", 890 "region", 891 "city", 892 "district", 893 "description", 894 "age", 895 ], 896 "Teller": [ 897 "video", 898 "location", 899 "allow_whatsapp", 900 "allow_call", 901 "publish", 902 "property_for", 903 "street_width", 904 "size", 905 "front", 906 "side", 907 "price_sqr_meter", 908 "total_price", 909 "region", 910 "city", 911 "district", 912 "description", 913 "age", 914 ], 915 "ElectricityStation": [ 916 "video", 917 "location", 918 "allow_whatsapp", 919 "allow_call", 920 "publish", 921 "property_for", 922 "street_width", 923 "size", 924 "front", 925 "side", 926 "price_sqr_meter", 927 "total_price", 928 "region", 929 "city", 930 "district", 931 "description", 932 "age", 933 ], 934 "TelecomTower": [ 935 "video", 936 "location", 937 "allow_whatsapp", 938 "allow_call", 939 "publish", 940 "property_for", 941 "street_width", 942 "size", 943 "front", 944 "side", 945 "price_sqr_meter", 946 "total_price", 947 "region", 948 "city", 949 "district", 950 "description", 951 "age", 952 ], 953 "Shop": [ 954 "video", 955 "location", 956 "is_furnished", 957 "is_inside_building", 958 "allow_whatsapp", 959 "allow_call", 960 "publish", 961 "street_width", 962 "size", 963 "front", 964 "side", 965 "floor_num", 966 "age", 967 "price_sqr_meter", 968 "total_price", 969 "region", 970 "city", 971 "district", 972 "description", 973 ], 974 "Booth": [ 975 "video", 976 "location", 977 "is_furnished", 978 "is_inside_building", 979 "allow_whatsapp", 980 "allow_call", 981 "publish", 982 "street_width", 983 "size", 984 "front", 985 "side", 986 "floor_num", 987 "age", 988 "price_sqr_meter", 989 "total_price", 990 "region", 991 "city", 992 "district", 993 "description", 994 ], 995 "RepairShop": [ 996 "video", 997 "location", 998 "is_furnished", 999 "is_inside_building", 1000 "allow_whatsapp", 1001 "allow_call", 1002 "publish", 1003 "street_width", 1004 "size", 1005 "front", 1006 "side", 1007 "floor_num", 1008 "age", 1009 "price_sqr_meter", 1010 "total_price", 1011 "region", 1012 "city", 1013 "district", 1014 "description", 1015 ],
1016 "Office": [ 1017 "video", 1018 "no_bed", 1019 "location", 1020 "is_furnished", 1021 "is_inside_building", 1022 "allow_whatsapp", 1023 "allow_call", 1024 "publish", 1025 "street_width", 1026 "size", 1027 "front", 1028 "side", 1029 "floor_num", 1030 "age", 1031 "price_sqr_meter", 1032 "total_price", 1033 "region", 1034 "city", 1035 "district", 1036 "description", 1037 ], 1038 "Warehouses": [ 1039 "video", 1040 "location", 1041 "is_furnished", 1042 "allow_whatsapp", 1043 "allow_call", 1044 "publish", 1045 "street_width", 1046 "size", 1047 "front", 1048 "side", 1049 "floor_num", 1050 "age", 1051 "price_sqr_meter", 1052 "total_price", 1053 "region", 1054 "city", 1055 "district", 1056 "description", 1057 ], 1058 "Exhibition": [ 1059 "video", 1060 "location", 1061 "is_furnished", 1062 "allow_whatsapp", 1063 "allow_call", 1064 "publish", 1065 "street_width", 1066 "size", 1067 "front", 1068 "side", 1069 "floor_num", 1070 "age", 1071 "price_sqr_meter", 1072 "total_price", 1073 "region", 1074 "city", 1075 "district", 1076 "description", 1077 ], 1078 "Cinema": [ 1079 "video", 1080 "location", 1081 "is_furnished", 1082 "allow_whatsapp", 1083 "allow_call", 1084 "publish", 1085 "street_width", 1086 "size", 1087 "front", 1088 "side", 1089 "floor_num", 1090 "age", 1091 "price_sqr_meter", 1092 "total_price", 1093 "region", 1094 "city", 1095 "district", 1096 "description", 1097 ], 1098 "CarParking": [ 1099 "video", 1100 "location", 1101 "is_furnished", 1102 "allow_whatsapp", 1103 "allow_call", 1104 "publish", 1105 "street_width", 1106 "size", 1107 "front", 1108 "side", 1109 "floor_num", 1110 "age", 1111 "price_sqr_meter", 1112 "total_price", 1113 "region", 1114 "city", 1115 "district", 1116 "description", 1117 ], 1118 "Factory": [ 1119 "video", 1120 "location", 1121 "is_furnished", 1122 "allow_whatsapp", 1123 "allow_call", 1124 "publish", 1125 "street_width", 1126 "size", 1127 "front", 1128 "side", 1129 "floor_num", 1130 "age", 1131 "price_sqr_meter", 1132 "total_price", 1133 "region", 1134 "city", 1135 "district", 1136 "description", 1137 ], 1138 "Station": [ 1139 "video", 1140 "location", 1141 "is_furnished", 1142 "allow_whatsapp", 1143 "allow_call", 1144 "publish", 1145 "street_width", 1146 "size", 1147 "front", 1148 "side", 1149 "floor_num", 1150 "age", 1151 "price_sqr_meter", 1152 "total_price", 1153 "region", 1154 "city", 1155 "district", 1156 "description", 1157 ], 1158 }, 1159 ad_types: ["Rent", "Sale"], 1160 property_with_child: { 1161 Building: ["Apartment", "Shop / Office"], 1162 Villa: ["Apartment"], 1163 }, 1164 remove_field: { 1165 Rent: ["total_price"], 1166 Sale: ["rent_type"], 1167 Auction: ["rent_type"], 1168 }, 1169 remove_child_field: [ 1170 "is_sewage", 1171 "is_water", 1172 "is_power", 1173 "is_parking", 1174 "is_elevator", 1175 "is_internal_stairs", 1176 "is_football_area", 1177 "is_volleyball_area", 1178 "is_amusement_area", 1179 "is_private_entrance", 1180 "is_two_entrances", 1181 "is_inside_villa", 1182 "is_inside_building", 1183 "location", 1184 "floor_num", 1185 "street_width", 1186 "is_pool", 1187 "is_yard", 1188 "no_apartment", 1189 "no_shop", 1190 "age", 1191 "allow_whatsapp", 1192 "allow_call", 1193 "publish", 1194 ], 1195 remove_parent_field: [ 1196 "is_furnished", 1197 "is_kitchen", 1198 "is_rooftop", 1199 "is_air_conditioners", 1200 "is_driver_room", 1201 "is_maid_room", 1202 "is_pool", 1203 "is_fire_room", 1204 "is_yard", 1205 "is_basement", 1206 "is_duplex", 1207 "rent_type", 1208 "no_bed", 1209 "size", 1210 "front", 1211 "side", 1212 "no_living", 1213 "no_bath", 1214 "price_sqr_meter", 1215 "total_price", 1216 "no_apartment", 1217 "no_shop", 1218 ], 1219 rega_features: ["is_sewage", "is_water", "is_power", "is_fixed_phone","is_fiber_optics","is_flood_drainage",], 1220 section_features: [ 1221 "is_sewage", 1222 "is_water", 1223 "is_power", 1224 "is_fixed_phone", 1225 "is_fiber_optics", 1226 "is_flood_drainage", 1227 "is_family", 1228 "is_furnished", 1229 "is_kitchen", 1230 "is_rooftop", 1231 "is_parking", 1232 "is_elevator", 1233 "is_air_conditioners", 1234 "is_internal_stairs", 1235 "is_driver_room", 1236 "is_maid_room", 1237 "is_pool", 1238 "is_fire_room", 1239 "is_yard", 1240 "is_basement", 1241 "is_duplex", 1242 "is_football_area", 1243 "is_volleyball_area", 1244 "is_amusement_area", 1245 "is_female_section", 1246 "is_private_entrance", 1247 "is_two_entrances", 1248 "is_inside_villa", 1249 "is_inside_building", 1250 ], 1251 section_details: [ 1252 "street_width", 1253 "no_bed", 1254 "no_living", 1255 "no_bath", 1256 "age", 1257 "size", 1258 "front", 1259 "side", 1260 "no_apartment", 1261 "no_shop", 1262 ], 1263}; 1264 1265export class Floor { 1266 num = 0; 1267 title = ""; 1268 children = {}; 1269} 1270 1271export class MapProperty { 1272 property = null; 1273 dirty = false; 1274 marker = null; 1275 constructor(_property = null,_dirty = null,_marker = null) { 1276 this.property = _property; 1277 this.dirty = _dirty; 1278 this.marker = _marker; 1279 } 1280} 1281 1282export class Property { 1283 name = null; 1284 creation = null; 1285 property_type = ""; 1286 ad_type = ""; 1287 rega_data = ""; 1288 ad_license_number = ""; 1289 is_sewage = true; 1290 is_water = true; 1291 is_power = true; 1292 is_furnished = false; 1293 is_kitchen = false; 1294 is_rooftop = false; 1295 is_parking = false; 1296 is_elevator = false; 1297 is_air_conditioners = false; 1298 is_internal_stairs = false; 1299 is_driver_room = false; 1300 is_maid_room = false; 1301 is_pool = false; 1302 is_fire_room = false; 1303 is_yard = false; 1304 is_basement = false; 1305 is_duplex = false; 1306 is_football_area = false; 1307 is_volleyball_area = false; 1308 is_amusement_area = false; 1309 is_female_section = false; 1310 is_private_entrance = false; 1311 is_two_entrances = false; 1312 is_inside_villa = false; 1313 is_inside_building = false; 1314 is_fixed_phone = false; 1315 is_fiber_optics = false; 1316 is_flood_drainage = false; 1317 allow_whatsapp = true; 1318 allow_call = true; 1319 publish = true; 1320 for_type = "Both"; 1321 is_family = false; 1322 rent_type = "Annually"; 1323 property_for = "Both"; 1324 street_width = 4; 1325 creator_type = "Owner"; 1326 view_sides = []; 1327 no_bed = 1; 1328 no_apartment = 0; 1329 no_shop = 0; 1330 size = ""; 1331 front = ""; 1332 side = ""; 1333 no_living = 0; 1334 no_bath = 0; 1335 floor_num = 0; 1336 age = 0; 1337 price_sqr_meter = ""; 1338 total_price = ""; 1339 title = ""; 1340 // address = ""; 1341 lat = ""; 1342 lng = ""; 1343 region = ""; 1344 city = ""; 1345 district = ""; 1346 prv_region = ""; 1347 prv_city = ""; 1348 prv_district = ""; 1349 description = ""; 1350 // linked_images=[]; 1351 // linked_images_names=[]; 1352 video = null; 1353 images = []; 1354 main_image_index = 0; 1355 floors = []; //of object type Floor() 1356 errors = []; 1357 for_agency = 0; 1358 selected_agency = ""; 1359 for_children = false; 1360 1361 from_map(map_data, is_child = false) { 1362 if (!is_child && map_data.searchable == 0) { 1363 this.for_children = true; 1364 } 1365 this.name = map_data.name; 1366 this.rega_data = map_data.rega_data; 1367 this.creation = map_data.creation; 1368 this.property_type = map_data.property_type; 1369 this.ad_type = map_data.ad_type; 1370 this.ad_license_number = map_data.ad_license_number; 1371 this.is_family = map_data.is_family; 1372 this.is_sewage = map_data.is_sewage; 1373 this.is_water = map_data.is_water; 1374 this.is_power = map_data.is_power; 1375 this.is_furnished = map_data.is_furnished; 1376 this.is_kitchen = map_data.is_kitchen; 1377 this.is_rooftop = map_data.is_rooftop; 1378 this.is_parking = map_data.is_parking; 1379 this.is_elevator = map_data.is_elevator; 1380 this.is_fixed_phone = map_data.is_fixed_phone; 1381 this.is_fiber_optics = map_data.is_fiber_optics; 1382 this.is_flood_drainage = map_data.is_flood_drainage; 1383 this.is_air_conditioners = map_data.is_air_conditioners; 1384 this.is_internal_stairs = map_data.is_internal_stairs; 1385 this.is_driver_room = map_data.is_driver_room; 1386 this.is_maid_room = map_data.is_maid_room; 1387 this.is_pool = map_data.is_pool; 1388 this.is_fire_room = map_data.is_fire_room; 1389 this.is_yard = map_data.is_yard; 1390 this.is_basement = map_data.is_basement; 1391 this.is_duplex = map_data.is_duplex; 1392 this.is_football_area = map_data.is_football_area; 1393 this.is_volleyball_area = map_data.is_volleyball_area; 1394 this.is_amusement_area = map_data.is_amusement_area; 1395 this.is_female_section = map_data.is_female_section; 1396 this.is_private_entrance = map_data.is_private_entrance; 1397 this.is_two_entrances = map_data.is_two_entrances; 1398 this.is_inside_villa = map_data.is_inside_villa; 1399 this.is_inside_building = map_data.is_inside_building; 1400 this.allow_whatsapp = map_data.allow_whatsapp == 1 ? true : false; 1401 this.allow_call = map_data.allow_call == 1 ? true : false; 1402 this.publish = map_data.published == 1 ? true : false; 1403 this.rent_type = map_data.rent_type; 1404 this.for_type = map_data.for_type; 1405 this.is_family = 1406 this.for_type == "Family" || this.for_type == "Both" ? true : false; 1407 this.property_for = map_data.property_for; 1408 this.street_width = map_data.street_width; 1409 this.creator_type = map_data.creator_type; 1410 this.view_sides = map_data.view_sides; 1411 this.no_bed = map_data.no_bed; 1412 this.no_apartment = map_data.no_apartment; 1413 this.no_shop = map_data.no_shop; 1414 1415 this.size = map_data.size; 1416 this.front = map_data.front; 1417 this.side = map_data.side; 1418 1419 this.no_living = map_data.no_living; 1420 this.no_bath = map_data.no_bath; 1421 this.floor_num = map_data.floor_num; 1422 this.age = map_data.age; 1423 this.price_sqr_meter = map_data.price_sqr_meter; 1424 this.total_price = map_data.total_price; 1425 // this.address = ""; 1426 this.title = map_data.title; 1427 this.description = map_data.description; 1428 1429 this.lat = map_data.lat; 1430 this.lng = map_data.lng; 1431 1432 // this.region = map_data.region; 1433 // this.city = map_data.city; 1434 // this.district = map_data.district; 1435 1436 this.prv_region = map_data.region; 1437 this.prv_city = map_data.city; 1438 this.prv_district = map_data.district; 1439 1440 this.region = ""; 1441 this.city = ""; 1442 this.district = ""; 1443 1444 this.video = map_data.video; 1445 this.main_image_index = 0; 1446 this.images = []; 1447 for (let index = 0; index < map_data.images.length; index++) { 1448 if (map_data.images[index] == map_data.image) { 1449 this.main_image_index = index; 1450 } 1451 this.images.push( 1452 new image_file({ 1453 link: map_data.images[index], 1454 link_name: map_data.images_names[index], 1455 }) 1456 ); 1457 } 1458 this.floors = []; 1459 if (!is_child) { 1460 for (const floor_no in map_data.floors) { 1461 var tmp_floor = { 1462 children: {}, 1463 }; 1464 // tmp_floor.children = {}; 1465 for (const child_property_index in map_data.floors[floor_no].children) { 1466 var tmp_child_property = 1467 map_data.floors[floor_no].children[child_property_index]; 1468 if ( 1469 tmp_floor.children[tmp_child_property.property_type] == undefined 1470 ) { 1471 tmp_floor.children[tmp_child_property.property_type] = []; 1472 } 1473 var tmp_property = new Property(); 1474 tmp_property.from_map(tmp_child_property, true); 1475 tmp_floor.children[tmp_child_property.property_type].push( 1476 tmp_property 1477 ); 1478 } 1479 this.floors.push(tmp_floor); 1480 } 1481 } 1482 // for (let floor_index = 0; floor_index < map_data.floors.length; floor_index++) { 1483 // var data_floor = map_data.floors[floor_index]; 1484 // var tmp_floor = {} 1485 // tmp_floor.children = {}; //of object type Floor() 1486 // for (let property_type_index = 0; property_type_index < data_floor.children.property_types; property_type_index++) { 1487 // var property_type_str = data_floor.children.property_types[property_type_index]; 1488 // var tmp_property_type = []; 1489 // tmp_property_type = [] 1490 // for (let child_index = 0; child_index < data_floor.children.property_types[property_type_str]; child_index++) { 1491 // var tmp_child = new Property(); 1492 // tmp_child.from_map(data_floor.children.property_types[property_type_str][child_index]); 1493 // tmp_property_type[property_type_str].push(tmp_child); 1494 // } 1495 // tmp_floor.children[property_type_str] = ; 1496 // } 1497 // this.floors.push(tmp_floor); 1498 // } 1499 this.errors = []; 1500 1501 this.selected_agency = ""; 1502 this.for_agency = false; 1503 1504 // var tmp_child_property = new Property(); 1505 // tmp_child_property.from_map(this.edit_property); 1506 } 1507 1508 optimize_images(){ 1509 for (let index = 0; index < this.images.length; index++) { 1510 var image = this.images[index].data; 1511 var canvas=document.createElement("canvas"); 1512 var context=canvas.getContext("2d"); 1513 const width = 400; // set your width 1514 const scaleFactor = width / image.width; 1515 canvas.width = width; 1516 canvas.height = image.height * scaleFactor; 1517 context.drawImage(image, 0, 0, width, image.height * scaleFactor); 1518 var small_image = canvas.toDataURL("image/jpeg"); 1519 } 1520 } 1521 1522 change_location({ region_id = null, city_id = null, district_id = null }) { 1523 if (region_id != null) { 1524 this.prv_region = this.region; 1525 this.region = region_id; 1526 } 1527 if (city_id != null) { 1528 this.prv_city = this.city; 1529 this.city = city_id; 1530 } 1531 if (district_id != null) { 1532 this.prv_district = this.district; 1533 this.district = district_id; 1534 } 1535 this.propegate_fields(); 1536 } 1537 1538 propegate_fields() { 1539 for (const floor_no in this.floors) { 1540 for (const child_property_type in this.floors[floor_no].children) { 1541 for (const property_index in this.floors[floor_no].children[ 1542 child_property_type 1543 ]) { 1544 this.floors[floor_no].children[child_property_type][ 1545 property_index 1546 ].ad_type = this.ad_type; 1547 this.floors[floor_no].children[child_property_type][ 1548 property_index 1549 ].age = this.age; 1550 this.floors[floor_no].children[child_property_type][ 1551 property_index 1552 ].creator_type = this.creator_type; 1553 this.floors[floor_no].children[child_property_type][ 1554 property_index 1555 ].floor_num = floor_no; 1556 this.floors[floor_no].children[child_property_type][ 1557 property_index 1558 ].is_sewage = this.is_sewage; 1559 this.floors[floor_no].children[child_property_type][ 1560 property_index 1561 ].is_water = this.is_water; 1562 this.floors[floor_no].children[child_property_type][ 1563 property_index 1564 ].is_power = this.is_power; 1565 this.floors[floor_no].children[child_property_type][ 1566 property_index 1567 ].is_elevator = this.is_elevator; 1568 this.floors[floor_no].children[child_property_type][ 1569 property_index 1570 ].is_parking = this.is_parking; 1571 // this.floors[floor_no].children[child_property_type][property_index].address = this.address; 1572 this.floors[floor_no].children[child_property_type][ 1573 property_index 1574 ].lat = this.lat; 1575 this.floors[floor_no].children[child_property_type][ 1576 property_index 1577 ].lng = this.lng; 1578 this.floors[floor_no].children[child_property_type][ 1579 property_index 1580 ].region = this.region; 1581 this.floors[floor_no].children[child_property_type][ 1582 property_index 1583 ].city = this.city; 1584 this.floors[floor_no].children[child_property_type][ 1585 property_index 1586 ].district = this.district; 1587 this.floors[floor_no].children[child_property_type][ 1588 property_index 1589 ].allow_whatsapp = this.allow_whatsapp; 1590 this.floors[floor_no].children[child_property_type][ 1591 property_index 1592 ].allow_call = this.allow_call; 1593 this.floors[floor_no].children[child_property_type][ 1594 property_index 1595 ].publish = this.publish; 1596 } 1597 } 1598 } 1599 emitter.emit("update-pro
1599perty-form"); 1600 } 1601 clone_floor(floor_index) { 1602 var from_floor = this.floors[floor_index]; 1603 var new_floor = new Floor(); 1604 // new_floor.num = this.floors.length; 1605 for (const property_type in from_floor.children) { 1606 new_floor.children[property_type] = []; 1607 for (const child_property in from_floor.children[property_type]) { 1608 var property = from_floor.children[property_type][child_property]; 1609 var new_property_clone = Object.assign( 1610 Object.create(Object.getPrototypeOf(property)), 1611 property 1612 ); 1613 new_property_clone.main_image_index = 0; 1614 new_property_clone.title = property.title; 1615 new_property_clone.images = []; 1616 new_floor.children[property_type].push(new_property_clone); 1617 } 1618 } 1619 this.floors.push(new_floor); 1620 this.set_floors(); 1621 return new_floor; 1622 } 1623 move_floor(floor_index, is_up) { 1624 if (is_up && floor_index <= 0) return; 1625 if (!is_up && floor_index >= this.floors.length - 1) return; 1626 var move = 1; 1627 if (is_up) { 1628 move = -1; 1629 } 1630 var tmp_floor = this.floors[floor_index + move]; 1631 // var tmp_floor_num = tmp_floor.num; 1632 // tmp_floor.num = this.floors[floor_index].num; 1633 // this.floors[floor_index].num = tmp_floor_num; 1634 this.floors[floor_index + move] = this.floors[floor_index]; 1635 this.floors[floor_index] = tmp_floor; 1636 this.set_floors(); 1637 } 1638 set_floors() { 1639 for (const floor_no in this.floors) { 1640 var selected_floor = this.floors[floor_no]; 1641 selected_floor.num = floor_no; 1642 for (const property_type in selected_floor.children) { 1643 for (const child_property in selected_floor.children[property_type]) { 1644 selected_floor.children[property_type][child_property].floor_num = 1645 floor_no; 1646 } 1647 } 1648 } 1649 } 1650 delete_child_property(floor_index, property) { 1651 var property_type = property.property_type; 1652 var property_index = 1653 this.floors[floor_index].children[property_type].indexOf(property); 1654 if (property_index < 0) return; 1655 this.floors[floor_index].children[property_type].splice(property_index, 1); 1656 } 1657 duplicate_child_property(floor_index, property) { 1658 var property_type = property.property_type; 1659 var property_index = 1660 this.floors[floor_index].children[property_type].indexOf(property); 1661 var new_property = Object.assign( 1662 Object.create(Object.getPrototypeOf(property)), 1663 property 1664 ); 1665 new_property.images = []; 1666 this.floors[floor_index].children[property_type].push(new_property); 1667 } 1668 add_child_property(floor_index, property_type) { 1669 var floor = this.floors[floor_index]; 1670 if (floor.children[property_type] == undefined) 1671 floor.children[property_type] = []; 1672 let new_child_property = new Property(); 1673 new_child_property.property_type = property_type; 1674 new_child_property.ad_type = this.ad_type; 1675 floor.children[property_type].push(new_child_property); 1676 this.propegate_fields(); 1677 return new_child_property; 1678 } 1679 transfer_child_property(from_floor_index, to_floor_index, property) { 1680 var property_type = property.property_type; 1681 var property_index = 1682 this.floors[from_floor_index].children[property_type].indexOf(property); 1683 1684 if (this.floors[to_floor_index].children[property_type] == undefined) { 1685 this.floors[to_floor_index].children[property_type] = []; 1686 } 1687 this.floors[to_floor_index].children[property_type].push(property); 1688 this.floors[from_floor_index].children[property_type].splice( 1689 property_index, 1690 1 1691 ); 1692 property.floor_num = to_floor_index; 1693 } 1694 validate_property(property_to_test, is_child = false) { 1695 property_to_test.errors = []; 1696 // if (property_to_test.images.length == 0) 1697 // property_to_test.errors.push("main_image_index"); 1698 if (property_to_test.errors.length > 0) { 1699 return false; 1700 } 1701 return true; 1702 } 1703 validate() { 1704 var result = true; 1705 if (!this.validate_property(this)) { 1706 result = false; 1707 } 1708 return result; 1709 } 1710} 1711 1712export class Mashro { 1713 name = null; 1714 creation = null; 1715 title = null; 1716 ready_made = null; 1717 region = null; 1718 city = null; 1719 manual_doc = null; 1720 manual_file = null; 1721 video = null; 1722 to_member = null; 1723 for_agency = null; 1724 contact_email = null; 1725 contact_no = null; 1726 units = null; 1727 price_min = null; 1728 price_max = null; 1729 area_min = null; 1730 area_max = null; 1731 electricity = 5; 1732 water = 5; 1733 logo = null; 1734 manual = null; 1735 lat = null; 1736 lng = null; 1737 location = null; 1738 address = null; 1739 details = null; 1740 masjid = false; 1741 health = false; 1742 shopping = false; 1743 park = false; 1744 school_male = false; 1745 school_female = false; 1746 phone = true; 1747 whatsapp = true; 1748 email = true; 1749 images = []; 1750 main_image_index = 0; 1751 errors = []; 1752 guarantees = {}; 1753 property_types = {}; 1754 1755 constructor() { 1756 this.reset_data(); 1757 } 1758 1759 reset_data(){ 1760 for (let index = 0; index < mashro_constants.mashro_guarantee_types.length; index++) { 1761 const type = mashro_constants.mashro_guarantee_types[index]; 1762 this.guarantees[type] = 0; 1763 } 1764 for (let index = 0; index < mashro_constants.mashro_property_types.length; index++) { 1765 const type = mashro_constants.mashro_property_types[index]; 1766 this.property_types[type] = false; 1767 } 1768 } 1769 1770 from_map(map_data, is_edit = false) { 1771 if(is_edit){ 1772 this.for_agency = map_data.user; 1773 this.to_member = map_data.manager_user; 1774 } 1775 this.name = map_data.name; 1776 this.creation = map_data.creation; 1777 this.title = map_data.title; 1778 this.owner_fullname = map_data.owner_fullname; 1779 this.owned = map_data.owned; 1780 this.managed = map_data.managed; 1781 this.region = map_data.region; 1782 this.city = map_data.city; 1783 this.manual_doc = map_data.manual_doc; 1784 this.video = map_data.video; 1785 this.phone = map_data.phone; 1786 this.whatsapp = map_data.whatsapp; 1787 this.email = map_data.email; 1788 this.contact_no = "0"+map_data.contact_no.substring(4); 1789 this.contact_email = map_data.contact_email; 1790 this.manager_user = map_data.manager_user; 1791 this.manager_user_fullname = map_data.manager_user_fullname; 1792 this.units = map_data.units; 1793 this.price_min = map_data.price_min; 1794 this.price_max = map_data.price_max;
1795 this.area_min = map_data.area_min; 1796 this.area_max = map_data.area_max; 1797 this.electricity = map_data.electricity; 1798 this.water = map_data.water; 1799 this.lat = map_data.lat; 1800 this.lng = map_data.lng; 1801 this.location = map_data.location; 1802 this.address = map_data.address; 1803 this.details = map_data.details; 1804 this.ready_made = map_data.ready_made == 1 ? true : false; 1805 this.masjid = map_data.masjid == 1 ? true : false; 1806 this.health = map_data.health == 1 ? true : false; 1807 this.shopping = map_data.shopping == 1 ? true : false; 1808 this.park = map_data.park == 1 ? true : false; 1809 this.school_male = map_data.school_male == 1 ? true : false; 1810 this.school_female = map_data.school_female == 1 ? true : false; 1811 // console.log(map_data.property_types); 1812 // console.log(map_data.guarantees); 1813 // console.log(this.guarantees); 1814 1815 this.reset_data(); 1816 for (let index = 0; index < map_data.property_types.length; index++) { 1817 this.property_types[map_data.property_types[index]] = true; 1818 } 1819 for (let index = 0; index < map_data.guarantees.length; index++) { 1820 this.guarantees[map_data.guarantees[index].type] = map_data.guarantees[index].years; 1821 } 1822 1823 if(map_data.logo){ 1824 this.logo = new image_file({ 1825 link: map_data.logo, 1826 // link_name: map_data.images_names[index], 1827 }) 1828 } 1829 1830 this.main_image_index = 0; 1831 this.images = []; 1832 for (let index = 0; index < map_data.images.length; index++) { 1833 if (map_data.images[index] == map_data.image) { 1834 this.main_image_index = index; 1835 } 1836 this.images.push( 1837 new image_file({ 1838 link: map_data.images[index], 1839 link_name: map_data.images_names[index], 1840 }) 1841 ); 1842 } 1843 this.errors = []; 1844 } 1845 1846 optimize_images(){ 1847 for (let index = 0; index < this.images.length; index++) { 1848 var image = this.images[index].data; 1849 var canvas=document.createElement("canvas"); 1850 var context=canvas.getContext("2d"); 1851 const width = 400; // set your width 1852 const scaleFactor = width / image.width; 1853 canvas.width = width; 1854 canvas.height = image.height * scaleFactor; 1855 context.drawImage(image, 0, 0, width, image.height * scaleFactor); 1856 var small_image = canvas.toDataURL("image/jpeg"); 1857 } 1858 } 1859 1860 validate_mashro(mashro, is_child = false) { 1861 mashro.errors = []; 1862 if (mashro.ready_made == null && !mashro.name) 1863 mashro.errors.push("ready_made"); 1864 if (mashro.region == null && !mashro.name) 1865 mashro.errors.push("region"); 1866 if (mashro.city == null && !mashro.name) 1867 mashro.errors.push("city"); 1868 if (mashro.title == null || mashro.title.length < 3) 1869 mashro.errors.push("title"); 1870 if (mashro.units == null || mashro.units.length <= 0) 1871 mashro.errors.push("units"); 1872 if (mashro.price_min == null || mashro.price_min.length <= 0) 1873 mashro.errors.push("price_min"); 1874 if (mashro.price_max == null || mashro.price_max.length <= 0) 1875 mashro.errors.push("price_max"); 1876 if (mashro.area_min == null || mashro.area_min.length <= 0) 1877 mashro.errors.push("area_min"); 1878 if (mashro.area_max == null || mashro.area_max.length <= 0) 1879 mashro.errors.push("area_max"); 1880 if (mashro.images.length == 0) 1881 mashro.errors.push("main_image_index"); 1882 if (mashro.address == null|| mashro.address.length < 3) 1883 mashro.errors.push("address"); 1884 1885 if (mashro.errors.length > 0) { 1886 return false; 1887 } 1888 return true; 1889 } 1890 validate() { 1891 var result = true; 1892 if (!this.validate_mashro(this)) { 1893 result = false; 1894 } 1895 return result; 1896 } 1897} 1898 1899String.prototype.format = function (args) { 1900 let formatted = this; 1901 for (let i = 0; i < args.length; i++) { 1902 let regexp = new RegExp("\\{" + i + "\\}", "gi"); 1903 formatted = formatted.replace(regexp, t(args[i])); 1904 } 1905 return formatted; 1906}; 1907 1908export const search_filters = { 1909 agency: "", 1910 region: "", 1911 city: "", 1912 district: "", 1913 ad_type: "", 1914 property_type: "", 1915 min_price: 0, 1916 max_price: 100, 1917 price: [0, 0], 1918 capacity: [0, 0], 1919 age: [1,13], 1920 age_min: 1, 1921 age_max: 13, 1922 no_bath: 0, 1923 no_bed: 0, 1924 published: -1, 1925 locked: 0, 1926 liked: 0, 1927 status: null, 1928 sort_by: "", 1929 features: {}, 1930 location: null, 1931 managed: -1, 1932 search_str: "", 1933 search_type: "Property Id", 1934 // location: { 1935 // center: [26.34269026355592, 43.950194707533655], 1936 // zoom: 11, 1937 // }, 1938}; 1939 1940search_filters.features = {}; 1941for ( 1942 let index = 0; 1943 index < property_constants.section_features.length; 1944 index++ 1945) { 1946 search_filters.features[property_constants.section_features[index]] = false; 1947} 1948 1949export function reset_filters( 1950 selected_search_filters = null, 1951 only_features = false 1952) { 1953 if (selected_search_filters == null) { 1954 selected_search_filters = search_filters; 1955 } 1956 if (!only_features) { 1957 selected_search_filters.agency = ""; 1958 selected_search_filters.region = ""; 1959 selected_search_filters.city = ""; 1960 selected_search_filters.district = ""; 1961 selected_search_filters.ad_type = ""; 1962 selected_search_filters.property_type = ""; 1963 selected_search_filters.min_price = 0; 1964 selected_search_filters.max_price = 100; 1965 selected_search_filters.price = [0, 0]; 1966 selected_search_filters.age = [1, 13]; 1967 selected_search_filters.capacity = [0, 0]; 1968 selected_search_filters.no_bath = 0; 1969 selected_search_filters.no_bed = 0; 1970 selected_search_filters.published = -1; 1971 selected_search_filters.locked = 0; 1972 selected_search_filters.liked = 0; 1973 selected_search_filters.status = null; 1974 selected_search_filters.sort_by = ""; 1975 selected_search_filters.search_str = ""; 1976 selected_search_filters.search_type = "Property Id"; 1977 } 1978 selected_search_filters.features = {}; 1979 for ( 1980 let index = 0; 1981 index < property_constants.section_features.length; 1982 index++ 1983 ) { 1984 selected_search_filters.features[ 1985 property_constants.section_features[index]
1986 ] = false; 1987 } 1988} 1989 1990export function refresh_tooltips(){ 1991 setTimeout(()=>{ 1992 var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) 1993 var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 1994 delete tooltipTriggerEl.dataset.bsToggle 1995 return new bootstrap.Tooltip(tooltipTriggerEl) 1996 }); 1997 }, 500); 1998} 1999 2000 2001 2002export const search_projects_filters = { 2003 region: "", 2004 city: "", 2005 property_types: {}, 2006}; 2007 2008search_projects_filters.property_types = {}; 2009for ( 2010 let index = 0; 2011 index < mashro_constants.mashro_property_types.length; 2012 index++ 2013) { 2014 search_projects_filters.property_types[mashro_constants.mashro_property_types[index]] = false; 2015} 2016// for (let index = 0; index < mashro_constants.mashro_property_types.length; index++) { 2017// const type = mashro_constants.mashro_property_types[index]; 2018// this.property_types[type] = false; 2019// } 2020 2021export function reset_projects_filters( 2022 selected_search_projects_filters = null, 2023 only_features = false 2024) { 2025 if (selected_search_projects_filters == null) { 2026 selected_search_projects_filters = search_projects_filters; 2027 } 2028 if (!only_features) { 2029 selected_search_projects_filters.agency = ""; 2030 selected_search_projects_filters.region = ""; 2031 selected_search_projects_filters.city = ""; 2032 selected_search_projects_filters.district = ""; 2033 selected_search_projects_filters.ad_type = ""; 2034 selected_search_projects_filters.property_type = ""; 2035 selected_search_projects_filters.min_price = 0; 2036 selected_search_projects_filters.max_price = 100; 2037 selected_search_projects_filters.price = [0, 0]; 2038 selected_search_projects_filters.age = [1, 13]; 2039 selected_search_projects_filters.capacity = [0, 0]; 2040 selected_search_projects_filters.no_bath = 0; 2041 selected_search_projects_filters.no_bed = 0; 2042 selected_search_projects_filters.published = -1; 2043 selected_search_projects_filters.locked = 0; 2044 selected_search_projects_filters.liked = 0; 2045 selected_search_projects_filters.status = null; 2046 selected_search_projects_filters.sort_by = ""; 2047 selected_search_projects_filters.search_str = ""; 2048 selected_search_projects_filters.search_type = "Property Id"; 2049 } 2050 selected_search_projects_filters.features = {}; 2051 for ( 2052 let index = 0; 2053 index < mashro_constants.mashro_property_types.length; 2054 index++ 2055 ) { 2056 search_projects_filters.property_types[mashro_constants.mashro_property_types[index]] = false; 2057 } 2058}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.