diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
    -
  • +
      +
    • -
      +
      -

      Restaurante ǵpuls

      +

      {{site!.name}}

      - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
    • diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
        -
      • +
          +
        • -
          +
          -

          Restaurante ǵpuls

          +

          {{site!.name}}

          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
            -
          • +
              +
            • -
              +
              -

              Restaurante ǵpuls

              +

              {{site!.name}}

              - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
            • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                -
              • +
                  +
                • -
                  +
                  -

                  Restaurante ǵpuls

                  +

                  {{site!.name}}

                  - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                    -
                  • +
                      +
                    • -
                      +
                      -

                      Restaurante ǵpuls

                      +

                      {{site!.name}}

                      - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                    • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                        -
                      • +
                          +
                        • -
                          +
                          -

                          Restaurante ǵpuls

                          +

                          {{site!.name}}

                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                            -
                          • +
                              +
                            • -
                              +
                              -

                              Restaurante ǵpuls

                              +

                              {{site!.name}}

                              - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                            • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" > diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                -
                              • +
                                  +
                                • -
                                  +
                                  -

                                  Restaurante ǵpuls

                                  +

                                  {{site!.name}}

                                  - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                  - +
                                  - +
                                  diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                    -
                                  • +
                                      +
                                    • -
                                      +
                                      -

                                      Restaurante ǵpuls

                                      +

                                      {{site!.name}}

                                      - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                    • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/shared/components/search/search.component.spec.ts b/src/app/shared/components/search/search.component.spec.ts deleted file mode 100644 index 918ce70..0000000 --- a/src/app/shared/components/search/search.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchComponent } from './search.component'; - -describe('SearchComponent', () => { - let component: SearchComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SearchComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SearchComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/shared/components/search/search.component.spec.ts b/src/app/shared/components/search/search.component.spec.ts deleted file mode 100644 index 918ce70..0000000 --- a/src/app/shared/components/search/search.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchComponent } from './search.component'; - -describe('SearchComponent', () => { - let component: SearchComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SearchComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SearchComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/assets/markers/bluemarker.png b/src/assets/markers/bluemarker.png new file mode 100644 index 0000000..e62dec6 --- /dev/null +++ b/src/assets/markers/bluemarker.png Binary files differ diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/shared/components/search/search.component.spec.ts b/src/app/shared/components/search/search.component.spec.ts deleted file mode 100644 index 918ce70..0000000 --- a/src/app/shared/components/search/search.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchComponent } from './search.component'; - -describe('SearchComponent', () => { - let component: SearchComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SearchComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SearchComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/assets/markers/bluemarker.png b/src/assets/markers/bluemarker.png new file mode 100644 index 0000000..e62dec6 --- /dev/null +++ b/src/assets/markers/bluemarker.png Binary files differ diff --git a/src/assets/markers/greenmarker.png b/src/assets/markers/greenmarker.png new file mode 100644 index 0000000..b391d9a --- /dev/null +++ b/src/assets/markers/greenmarker.png Binary files differ diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/shared/components/search/search.component.spec.ts b/src/app/shared/components/search/search.component.spec.ts deleted file mode 100644 index 918ce70..0000000 --- a/src/app/shared/components/search/search.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchComponent } from './search.component'; - -describe('SearchComponent', () => { - let component: SearchComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SearchComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SearchComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/assets/markers/bluemarker.png b/src/assets/markers/bluemarker.png new file mode 100644 index 0000000..e62dec6 --- /dev/null +++ b/src/assets/markers/bluemarker.png Binary files differ diff --git a/src/assets/markers/greenmarker.png b/src/assets/markers/greenmarker.png new file mode 100644 index 0000000..b391d9a --- /dev/null +++ b/src/assets/markers/greenmarker.png Binary files differ diff --git a/src/assets/markers/redmarker.png b/src/assets/markers/redmarker.png new file mode 100644 index 0000000..6ef956a --- /dev/null +++ b/src/assets/markers/redmarker.png Binary files differ diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/shared/components/search/search.component.spec.ts b/src/app/shared/components/search/search.component.spec.ts deleted file mode 100644 index 918ce70..0000000 --- a/src/app/shared/components/search/search.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchComponent } from './search.component'; - -describe('SearchComponent', () => { - let component: SearchComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SearchComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SearchComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/assets/markers/bluemarker.png b/src/assets/markers/bluemarker.png new file mode 100644 index 0000000..e62dec6 --- /dev/null +++ b/src/assets/markers/bluemarker.png Binary files differ diff --git a/src/assets/markers/greenmarker.png b/src/assets/markers/greenmarker.png new file mode 100644 index 0000000..b391d9a --- /dev/null +++ b/src/assets/markers/greenmarker.png Binary files differ diff --git a/src/assets/markers/redmarker.png b/src/assets/markers/redmarker.png new file mode 100644 index 0000000..6ef956a --- /dev/null +++ b/src/assets/markers/redmarker.png Binary files differ diff --git a/src/assets/markers/redmarker.svg b/src/assets/markers/redmarker.svg new file mode 100644 index 0000000..b0e928d --- /dev/null +++ b/src/assets/markers/redmarker.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/shared/components/search/search.component.spec.ts b/src/app/shared/components/search/search.component.spec.ts deleted file mode 100644 index 918ce70..0000000 --- a/src/app/shared/components/search/search.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchComponent } from './search.component'; - -describe('SearchComponent', () => { - let component: SearchComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SearchComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SearchComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/assets/markers/bluemarker.png b/src/assets/markers/bluemarker.png new file mode 100644 index 0000000..e62dec6 --- /dev/null +++ b/src/assets/markers/bluemarker.png Binary files differ diff --git a/src/assets/markers/greenmarker.png b/src/assets/markers/greenmarker.png new file mode 100644 index 0000000..b391d9a --- /dev/null +++ b/src/assets/markers/greenmarker.png Binary files differ diff --git a/src/assets/markers/redmarker.png b/src/assets/markers/redmarker.png new file mode 100644 index 0000000..6ef956a --- /dev/null +++ b/src/assets/markers/redmarker.png Binary files differ diff --git a/src/assets/markers/redmarker.svg b/src/assets/markers/redmarker.svg new file mode 100644 index 0000000..b0e928d --- /dev/null +++ b/src/assets/markers/redmarker.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/markers/yellowmarker.png b/src/assets/markers/yellowmarker.png new file mode 100644 index 0000000..e0c2a0b --- /dev/null +++ b/src/assets/markers/yellowmarker.png Binary files differ diff --git a/src/app/core/interfaces/site/site.ts b/src/app/core/interfaces/site/site.ts index 97f2724..a3cf479 100644 --- a/src/app/core/interfaces/site/site.ts +++ b/src/app/core/interfaces/site/site.ts @@ -6,7 +6,7 @@ import { Schedule } from './schedule/schedule'; export interface Site { - id: string; + id: number; name: string; owner?: Owner; galery?: Galery; diff --git a/src/app/core/interfaces/utils/forms/filters.ts b/src/app/core/interfaces/utils/forms/filters.ts new file mode 100644 index 0000000..c5a2269 --- /dev/null +++ b/src/app/core/interfaces/utils/forms/filters.ts @@ -0,0 +1,8 @@ +export interface Ffilter { + search: string, + lat: number, + lng: number, + location: string, + category: string; + zoom: number; +} diff --git a/src/app/core/mocks/data.ts b/src/app/core/mocks/data.ts index 8e279e5..343649b 100644 --- a/src/app/core/mocks/data.ts +++ b/src/app/core/mocks/data.ts @@ -2,30 +2,47 @@ export const SITES: Site[] = [ { - id: "f", + id: 0, name: "El recuerdo", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.3734021386687365, length: -72.64797890311478 - } + }, + email: "Recuerdo-@gmail.com" }, { - id: "f", + id: 0, name: "Deposito", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", - latitude: 7.372737130482743, + latitude: 7.372737130482743, length: -72.6485850825132 - } + }, + email: "Deposito-@gmail.com" }, { - id: "f", + id: 0, name: "Leoporinos", + phone_number: "380-121-303", address: { direction: "Calle 3 Barrio la esperanza", latitude: 7.373793162733723, length: -72.64887476144403 - } + }, + email: "Leoporinos-@gmail.com" + }, + { + id: 0, + name: "Restaurante ǵpuls", + phone_number: "380-121-303", + address: { + direction: "Calle 3 Barrio la esperanza", + latitude: 7.373793162733723, + length: -73.64887476144403 + }, + email: "Restaurantegpuls@gmail.com" } -] \ No newline at end of file +] diff --git a/src/app/core/services/query/query.service.ts b/src/app/core/services/query/query.service.ts new file mode 100644 index 0000000..8c7599b --- /dev/null +++ b/src/app/core/services/query/query.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class QueryService { + + constructor(private http: HttpClient) { } + + query(url: string, method: string, params?:any) { + switch(method){ + case 'GET': + return this.http.get(url, params); + break; + case 'POST': + return this.http.post(url, params); + break + } + return null; + } +} diff --git a/src/app/core/services/site/site.service.ts b/src/app/core/services/site/site.service.ts index 98d0ba7..aa87fb1 100644 --- a/src/app/core/services/site/site.service.ts +++ b/src/app/core/services/site/site.service.ts @@ -10,17 +10,12 @@ }) export class SiteService { - BASE_URL_API = environment.BASE_URL_API + "/sites" + BASE_URL_API = environment.BASE_URL_API + "/allys/" constructor(private http: HttpClient) { } getSites(): Observable { - return this.http.get(this.BASE_URL_API, { - headers: { - "Access-Control-Request-Headers": "*", - "Access-Control-Request-Method": "*" - } - }); + return this.http.get(this.BASE_URL_API); } getSite(id: string): Observable { diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.html b/src/app/modules/public/discover/components/list-sites/list-sites.component.html index 15c0366..8fc386a 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.html +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.html @@ -1,11 +1,11 @@ -
                                        -
                                      • +
                                          +
                                        • -
                                          +
                                          -

                                          Restaurante ǵpuls

                                          +

                                          {{site!.name}}

                                          - 380-121-303 + {{site!.phone_number}} - Panaderia-@gmail.com + {{site!.email}}
                                        • diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss index 6837eb3..8576961 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.scss +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.scss @@ -17,7 +17,7 @@ } .img-container { - + } .img-container div { @@ -31,3 +31,7 @@ .info-container{ width: 60%; } + +.list__gap{ + gap: 1rem; +} diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts deleted file mode 100644 index 1597a3b..0000000 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { ListSitesComponent } from './list-sites.component'; - -describe('ListSitesComponent', () => { - let component: ListSitesComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ListSitesComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ListSitesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts index f5f3f1c..bca2daa 100644 --- a/src/app/modules/public/discover/components/list-sites/list-sites.component.ts +++ b/src/app/modules/public/discover/components/list-sites/list-sites.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ selector: 'app-list-sites', @@ -7,43 +8,16 @@ }) export class ListSitesComponent implements OnInit { + @Input() sites!: Site[]; + @Output() emitAllyId = new EventEmitter(); + constructor() { } ngOnInit() { } - customOptions: OwlOptions = { - loop: true, - mouseDrag: true, - autoplay: false, - autoplayTimeout: 2000, - autoplayHoverPause:true, - touchDrag: false, - pullDrag: false, - dots: false, - margin:1, - navSpeed: 700, - navText : ['',''], - nav: true, - /* responsive: { - 0: { - items: 1, - nav: true - }, - 600: { - items: 1, - nav: true - }, - 1000: { - items: 2, - nav: true, - loop: true - }, - 1500: { - items: 4, - nav: true, - loop: true - } - } */ + handlePatternAllyId($event: number) { + this.emitAllyId.emit($event); } + } diff --git a/src/app/modules/public/discover/components/map/map.component.html b/src/app/modules/public/discover/components/map/map.component.html index f39d0d3..cb3e3bb 100644 --- a/src/app/modules/public/discover/components/map/map.component.html +++ b/src/app/modules/public/discover/components/map/map.component.html @@ -6,13 +6,15 @@ [center]="position" [options]="options" [zoom]="zoom" - (mapClick)="closeInfoWindow()"> + (mapClick)="closeInfoWindow()" + (mapDragend)="mapIsDragged()"> { this.markers.push({ @@ -103,18 +103,11 @@ lat: site.address!.latitude, lng: site.address!.length }, - label: { - color: '', - text: site.name, - }, title: site.name, info: { ...site }, - icon: svgMarker - /* icon: { - url: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/How_to_use_icon.svg/2214px-How_to_use_icon.svg.png" - } */ + icon: image }) }) } @@ -128,4 +121,11 @@ this.info_window.close() } + mapIsDragged() { + this.form.lat = this.map.googleMap?.getCenter().lat() || 0 + this.form.lng = this.map.googleMap?.getCenter().lat() || 0 + this.form.zoom = parseInt(this.map.googleMap?.getZoom().toPrecision() || '17') || 17 + console.log(this.form) + } + } diff --git a/src/app/modules/public/discover/components/modal-site/modal-site.component.html b/src/app/modules/public/discover/components/modal-site/modal-site.component.html index 09c04fd..298553d 100644 --- a/src/app/modules/public/discover/components/modal-site/modal-site.component.html +++ b/src/app/modules/public/discover/components/modal-site/modal-site.component.html @@ -6,6 +6,7 @@ tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true" + role="dialog" >
                                          - +
                                          - +
                                      diff --git a/src/app/modules/public/discover/components/sites/sites.component.ts b/src/app/modules/public/discover/components/sites/sites.component.ts index d24891f..dab1d99 100644 --- a/src/app/modules/public/discover/components/sites/sites.component.ts +++ b/src/app/modules/public/discover/components/sites/sites.component.ts @@ -1,4 +1,8 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { SITES } from './../../../../../core/mocks/data'; +import { Site } from 'src/app/core/interfaces/site/site'; +import { environment } from './../../../../../../environments/environment'; +import { QueryService } from './../../../../../core/services/query/query.service'; +import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-sites', @@ -7,10 +11,25 @@ }) export class SitesComponent implements OnInit { + + @Output() emitAllyId = new EventEmitter(); @Input() is_slide_mode: boolean = true; + icon_border_all = faBorderAll; - constructor() { } + url = environment.BASE_URL_API; + sites: Site[] = SITES; + + constructor(private queryService: QueryService) { } + ngOnInit() { + this.queryService.query(`${this.url}/allys/`, 'GET')?.subscribe( + (data) => { + console.log("This is data",data) + }, + (error) => { + console.log(error) + } + ) } changeModeList(){ @@ -21,4 +40,8 @@ this.is_slide_mode=false; } + handlePatternAllyId($event: any) { + this.emitAllyId.emit($event); + } + } diff --git a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts index 518e2f7..9d935b5 100644 --- a/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts +++ b/src/app/modules/public/discover/components/slide-sites/slide-sites.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core'; import { faChevronCircleUp } from '@fortawesome/free-solid-svg-icons'; import { OwlOptions } from 'ngx-owl-carousel-o'; @Component({ @@ -10,6 +10,8 @@ icon_chevron_up = faChevronCircleUp; @ViewChild('album-rotator-holder') albumRotator: any; + @Output() emitAllyId = new EventEmitter(); + customOptions: OwlOptions = { loop: true, mouseDrag: true, @@ -48,4 +50,9 @@ constructor() {} ngOnInit() {} + + handlePatternAllyId(allyId: number){ + this.emitAllyId.emit(allyId); + } + } diff --git a/src/app/modules/public/discover/discover.component.html b/src/app/modules/public/discover/discover.component.html index e16b75c..396cbd0 100644 --- a/src/app/modules/public/discover/discover.component.html +++ b/src/app/modules/public/discover/discover.component.html @@ -1,10 +1,10 @@
                                      - +
                                      - +
                                      diff --git a/src/app/modules/public/discover/discover.component.ts b/src/app/modules/public/discover/discover.component.ts index ab2819d..3801492 100644 --- a/src/app/modules/public/discover/discover.component.ts +++ b/src/app/modules/public/discover/discover.component.ts @@ -1,4 +1,5 @@ -import { Component, OnInit } from '@angular/core'; +import { Ffilter } from './../../../core/interfaces/utils/forms/filters'; +import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { faBorderAll } from '@fortawesome/free-solid-svg-icons'; import { Site } from 'src/app/core/interfaces/site/site'; @@ -10,19 +11,30 @@ templateUrl: './discover.component.html', styleUrls: ['./discover.component.scss'] }) -export class DiscoverComponent implements OnInit { +export class DiscoverComponent implements OnInit, AfterViewInit { + + @ViewChild('modalSiteComponent') modal: any; icon_border_all = faBorderAll; + allyId: number = -1; sites: Site[] = SITES; search: string = ''; + form: Ffilter = { + search: '', + lat: 7.376362792514798, + lng: -72.65115193327162, + location: '', + category: '', + zoom: 2, + } constructor(private site_service: SiteService, private title: Title, private activeRoute: ActivatedRoute) { } ngOnInit(): void { this.setTitle("Discover | Camara de comercio|"); - /* this.site_service.getSites().subscribe( + /* this.site_service.getSites().subscribe( (sites) => { - console.log(sites) + console.log("this is sites",sites) this.sites = sites }, (error) => { @@ -32,6 +44,10 @@ this.getQueryParams(); } + ngAfterViewInit() { + + } + public setTitle(newTitle: string) { this.title.setTitle(newTitle); } @@ -39,17 +55,21 @@ public getQueryParams(){ this.activeRoute.queryParams.subscribe( (data) => { - console.log("This is data search ",data); if(data.search){ - this.search = data.search; + this.form.search = data.search; } } ) } handlePatternSearch($event: any) { - console.log("Parametro de busqueda",$event) - this.search = $event; + this.form.search = $event; + } + + handlePatternAllyId($event: any) { + console.log(this.modal); + document.getElementById('staticBackdrop')?.classList.remove('fade') + this.allyId = $event; } } diff --git a/src/app/shared/components/search/search.component.spec.ts b/src/app/shared/components/search/search.component.spec.ts deleted file mode 100644 index 918ce70..0000000 --- a/src/app/shared/components/search/search.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SearchComponent } from './search.component'; - -describe('SearchComponent', () => { - let component: SearchComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ SearchComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(SearchComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/assets/markers/bluemarker.png b/src/assets/markers/bluemarker.png new file mode 100644 index 0000000..e62dec6 --- /dev/null +++ b/src/assets/markers/bluemarker.png Binary files differ diff --git a/src/assets/markers/greenmarker.png b/src/assets/markers/greenmarker.png new file mode 100644 index 0000000..b391d9a --- /dev/null +++ b/src/assets/markers/greenmarker.png Binary files differ diff --git a/src/assets/markers/redmarker.png b/src/assets/markers/redmarker.png new file mode 100644 index 0000000..6ef956a --- /dev/null +++ b/src/assets/markers/redmarker.png Binary files differ diff --git a/src/assets/markers/redmarker.svg b/src/assets/markers/redmarker.svg new file mode 100644 index 0000000..b0e928d --- /dev/null +++ b/src/assets/markers/redmarker.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/markers/yellowmarker.png b/src/assets/markers/yellowmarker.png new file mode 100644 index 0000000..e0c2a0b --- /dev/null +++ b/src/assets/markers/yellowmarker.png Binary files differ diff --git a/src/environments/environment.ts b/src/environments/environment.ts index ca044d3..7faeaff 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - BASE_URL_API: "http://127.0.0.1:5000" + BASE_URL_API: "http://127.0.0.1:8000" }; /*