Changeset 6fe77af


Ignore:
Timestamp:
02/06/22 18:15:51 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
571e0df
Parents:
76712b2
Message:

add location feature

Files:
46 added
1 deleted
34 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/@angular/cdk/stepper/index.d.ts

    r76712b2 r6fe77af  
    33 */
    44export * from './public-api';
     5
     6//# sourceMappingURL=index.d.ts.map
  • trip-planner-front/node_modules/@angular/cdk/stepper/package.json

    r76712b2 r6fe77af  
    22  "name": "@angular/cdk/stepper",
    33  "main": "../bundles/cdk-stepper.umd.js",
     4  "fesm2015_ivy_ngcc": "../__ivy_ngcc__/fesm2015/stepper.js",
    45  "fesm2015": "../fesm2015/stepper.js",
    56  "esm2015": "../esm2015/stepper/index.js",
    67  "typings": "./index.d.ts",
     8  "module_ivy_ngcc": "../__ivy_ngcc__/fesm2015/stepper.js",
    79  "module": "../fesm2015/stepper.js",
    8   "es2015": "../fesm2015/stepper.js"
     10  "es2015_ivy_ngcc": "../__ivy_ngcc__/fesm2015/stepper.js",
     11  "es2015": "../fesm2015/stepper.js",
     12  "__processed_by_ivy_ngcc__": {
     13    "es2015": "12.2.13",
     14    "fesm2015": "12.2.13",
     15    "module": "12.2.13",
     16    "typings": "12.2.13"
     17  },
     18  "scripts": {
     19    "prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by NGCC. This is not allowed.\\nPlease delete and rebuild the package, without compiling with NGCC, before attempting to publish.\\nNote that NGCC may have been run by importing this package into another project that is being built with Ivy enabled.\\n')\" && exit 1"
     20  }
    921}
  • trip-planner-front/node_modules/@angular/cdk/stepper/step-header.d.ts

    r76712b2 r6fe77af  
    88import { ElementRef } from '@angular/core';
    99import { FocusableOption } from '@angular/cdk/a11y';
     10import * as ɵngcc0 from '@angular/core';
    1011export declare class CdkStepHeader implements FocusableOption {
    1112    _elementRef: ElementRef<HTMLElement>;
     
    1314    /** Focuses the step header. */
    1415    focus(): void;
     16    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkStepHeader, never>;
     17    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<CdkStepHeader, "[cdkStepHeader]", never, {}, {}, never>;
    1518}
     19
     20//# sourceMappingURL=step-header.d.ts.map
  • trip-planner-front/node_modules/@angular/cdk/stepper/step-label.d.ts

    r76712b2 r6fe77af  
    77 */
    88import { TemplateRef } from '@angular/core';
     9import * as ɵngcc0 from '@angular/core';
    910export declare class CdkStepLabel {
    1011    template: TemplateRef<any>;
    1112    constructor(/** @docs-private */ template: TemplateRef<any>);
     13    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkStepLabel, never>;
     14    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<CdkStepLabel, "[cdkStepLabel]", never, {}, {}, never>;
    1215}
     16
     17//# sourceMappingURL=step-label.d.ts.map
  • trip-planner-front/node_modules/@angular/cdk/stepper/stepper-button.d.ts

    r76712b2 r6fe77af  
    88import { CdkStepper } from './stepper';
    99/** Button that moves to the next step in a stepper workflow. */
     10import * as ɵngcc0 from '@angular/core';
    1011export declare class CdkStepperNext {
    1112    _stepper: CdkStepper;
     
    1415    constructor(_stepper: CdkStepper);
    1516    _handleClick(): void;
     17    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkStepperNext, never>;
     18    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<CdkStepperNext, "button[cdkStepperNext]", never, { "type": "type"; }, {}, never>;
    1619}
    1720/** Button that moves to the previous step in a stepper workflow. */
     
    2225    constructor(_stepper: CdkStepper);
    2326    _handleClick(): void;
     27    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkStepperPrevious, never>;
     28    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<CdkStepperPrevious, "button[cdkStepperPrevious]", never, { "type": "type"; }, {}, never>;
    2429}
     30
     31//# sourceMappingURL=stepper-button.d.ts.map
  • trip-planner-front/node_modules/@angular/cdk/stepper/stepper-module.d.ts

    r76712b2 r6fe77af  
    66 * found in the LICENSE file at https://angular.io/license
    77 */
     8import * as ɵngcc0 from '@angular/core';
     9import * as ɵngcc1 from './stepper';
     10import * as ɵngcc2 from './step-header';
     11import * as ɵngcc3 from './step-label';
     12import * as ɵngcc4 from './stepper-button';
     13import * as ɵngcc5 from '@angular/cdk/bidi';
    814export declare class CdkStepperModule {
     15    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkStepperModule, never>;
     16    static ɵmod: ɵngcc0.ɵɵNgModuleDeclaration<CdkStepperModule, [typeof ɵngcc1.CdkStep, typeof ɵngcc1.CdkStepper, typeof ɵngcc2.CdkStepHeader, typeof ɵngcc3.CdkStepLabel, typeof ɵngcc4.CdkStepperNext, typeof ɵngcc4.CdkStepperPrevious], [typeof ɵngcc5.BidiModule], [typeof ɵngcc1.CdkStep, typeof ɵngcc1.CdkStepper, typeof ɵngcc2.CdkStepHeader, typeof ɵngcc3.CdkStepLabel, typeof ɵngcc4.CdkStepperNext, typeof ɵngcc4.CdkStepperPrevious]>;
     17    static ɵinj: ɵngcc0.ɵɵInjectorDeclaration<CdkStepperModule>;
    918}
     19
     20//# sourceMappingURL=stepper-module.d.ts.map
  • trip-planner-front/node_modules/@angular/cdk/stepper/stepper.d.ts

    r76712b2 r6fe77af  
    1616 * the content into correct position upon step selection change.
    1717 */
     18import * as ɵngcc0 from '@angular/core';
    1819export declare type StepContentPositionState = 'previous' | 'current' | 'next';
    1920/** Possible orientation of a stepper. */
     
    113114    static ngAcceptInputType_optional: BooleanInput;
    114115    static ngAcceptInputType_completed: BooleanInput;
     116    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkStep, [null, { optional: true; }]>;
     117    static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<CdkStep, "cdk-step", ["cdkStep"], { "editable": "editable"; "optional": "optional"; "completed": "completed"; "hasError": "hasError"; "stepControl": "stepControl"; "label": "label"; "errorMessage": "errorMessage"; "ariaLabel": "aria-label"; "ariaLabelledby": "aria-labelledby"; "state": "state"; }, { "interactedStream": "interacted"; }, ["stepLabel"], ["*"]>;
    115118}
    116119export declare class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
     
    197200    static ngAcceptInputType_linear: BooleanInput;
    198201    static ngAcceptInputType_selectedIndex: NumberInput;
     202    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkStepper, [{ optional: true; }, null, null, null]>;
     203    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<CdkStepper, "[cdkStepper]", ["cdkStepper"], { "linear": "linear"; "selectedIndex": "selectedIndex"; "selected": "selected"; "orientation": "orientation"; }, { "selectionChange": "selectionChange"; }, ["_steps", "_stepHeader"]>;
    199204}
    200205/**
     
    253258}
    254259export {};
     260
     261//# sourceMappingURL=stepper.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/index.d.ts

    r76712b2 r6fe77af  
    33 */
    44export * from './public-api';
     5
     6//# sourceMappingURL=index.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/package.json

    r76712b2 r6fe77af  
    22  "name": "@angular/material/stepper",
    33  "main": "../bundles/material-stepper.umd.js",
     4  "fesm2015_ivy_ngcc": "../__ivy_ngcc__/fesm2015/stepper.js",
    45  "fesm2015": "../fesm2015/stepper.js",
    56  "esm2015": "../esm2015/stepper/index.js",
    67  "typings": "./index.d.ts",
     8  "module_ivy_ngcc": "../__ivy_ngcc__/fesm2015/stepper.js",
    79  "module": "../fesm2015/stepper.js",
    8   "es2015": "../fesm2015/stepper.js"
     10  "es2015_ivy_ngcc": "../__ivy_ngcc__/fesm2015/stepper.js",
     11  "es2015": "../fesm2015/stepper.js",
     12  "__processed_by_ivy_ngcc__": {
     13    "es2015": "12.2.13",
     14    "fesm2015": "12.2.13",
     15    "module": "12.2.13",
     16    "typings": "12.2.13"
     17  },
     18  "scripts": {
     19    "prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by NGCC. This is not allowed.\\nPlease delete and rebuild the package, without compiling with NGCC, before attempting to publish.\\nNote that NGCC may have been run by importing this package into another project that is being built with Ivy enabled.\\n')\" && exit 1"
     20  }
    921}
  • trip-planner-front/node_modules/@angular/material/stepper/step-content.d.ts

    r76712b2 r6fe77af  
    1010 * Content for a `mat-step` that will be rendered lazily.
    1111 */
     12import * as ɵngcc0 from '@angular/core';
    1213export declare class MatStepContent {
    1314    _template: TemplateRef<any>;
    1415    constructor(_template: TemplateRef<any>);
     16    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepContent, never>;
     17    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatStepContent, "ng-template[matStepContent]", never, {}, {}, never>;
    1518}
     19
     20//# sourceMappingURL=step-content.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/step-header.d.ts

    r76712b2 r6fe77af  
    1414import { CanColor } from '@angular/material/core';
    1515/** @docs-private */
     16import * as ɵngcc0 from '@angular/core';
    1617declare const _MatStepHeaderBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanColor> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanColor> & {
    1718    new (elementRef: ElementRef): {
     
    5859    _getIconContext(): MatStepperIconContext;
    5960    _getDefaultTextForState(state: StepState): string;
     61    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepHeader, never>;
     62    static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatStepHeader, "mat-step-header", never, { "color": "color"; "state": "state"; "label": "label"; "errorMessage": "errorMessage"; "iconOverrides": "iconOverrides"; "index": "index"; "selected": "selected"; "active": "active"; "optional": "optional"; "disableRipple": "disableRipple"; }, {}, never, never>;
    6063}
    6164export {};
     65
     66//# sourceMappingURL=step-header.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/step-label.d.ts

    r76712b2 r6fe77af  
    77 */
    88import { CdkStepLabel } from '@angular/cdk/stepper';
     9import * as ɵngcc0 from '@angular/core';
    910export declare class MatStepLabel extends CdkStepLabel {
     11    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepLabel, never>;
     12    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatStepLabel, "[matStepLabel]", never, {}, {}, never>;
    1013}
     14
     15//# sourceMappingURL=step-label.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/stepper-button.d.ts

    r76712b2 r6fe77af  
    88import { CdkStepperNext, CdkStepperPrevious } from '@angular/cdk/stepper';
    99/** Button that moves to the next step in a stepper workflow. */
     10import * as ɵngcc0 from '@angular/core';
    1011export declare class MatStepperNext extends CdkStepperNext {
     12    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepperNext, never>;
     13    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatStepperNext, "button[matStepperNext]", never, { "type": "type"; }, {}, never>;
    1114}
    1215/** Button that moves to the previous step in a stepper workflow. */
    1316export declare class MatStepperPrevious extends CdkStepperPrevious {
     17    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepperPrevious, never>;
     18    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatStepperPrevious, "button[matStepperPrevious]", never, { "type": "type"; }, {}, never>;
    1419}
     20
     21//# sourceMappingURL=stepper-button.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/stepper-icon.d.ts

    r76712b2 r6fe77af  
    99import { StepState } from '@angular/cdk/stepper';
    1010/** Template context available to an attached `matStepperIcon`. */
     11import * as ɵngcc0 from '@angular/core';
    1112export interface MatStepperIconContext {
    1213    /** Index of the step. */
     
    2526    name: StepState;
    2627    constructor(templateRef: TemplateRef<MatStepperIconContext>);
     28    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepperIcon, never>;
     29    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatStepperIcon, "ng-template[matStepperIcon]", never, { "name": "matStepperIcon"; }, {}, never>;
    2730}
     31
     32//# sourceMappingURL=stepper-icon.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/stepper-intl.d.ts

    r76712b2 r6fe77af  
    99import { Subject } from 'rxjs';
    1010/** Stepper data that is required for internationalization. */
     11import * as ɵngcc0 from '@angular/core';
    1112export declare class MatStepperIntl {
    1213    /**
     
    2122    /** Label that is used to indicate step as editable to screen readers. */
    2223    editableLabel: string;
     24    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepperIntl, never>;
    2325}
    2426/** @docs-private */
     
    3032    useFactory: typeof MAT_STEPPER_INTL_PROVIDER_FACTORY;
    3133};
     34
     35//# sourceMappingURL=stepper-intl.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/stepper-module.d.ts

    r76712b2 r6fe77af  
    66 * found in the LICENSE file at https://angular.io/license
    77 */
     8import * as ɵngcc0 from '@angular/core';
     9import * as ɵngcc1 from './stepper';
     10import * as ɵngcc2 from './step-label';
     11import * as ɵngcc3 from './stepper-button';
     12import * as ɵngcc4 from './step-header';
     13import * as ɵngcc5 from './stepper-icon';
     14import * as ɵngcc6 from './step-content';
     15import * as ɵngcc7 from '@angular/material/core';
     16import * as ɵngcc8 from '@angular/common';
     17import * as ɵngcc9 from '@angular/cdk/portal';
     18import * as ɵngcc10 from '@angular/material/button';
     19import * as ɵngcc11 from '@angular/cdk/stepper';
     20import * as ɵngcc12 from '@angular/material/icon';
    821export declare class MatStepperModule {
     22    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepperModule, never>;
     23    static ɵmod: ɵngcc0.ɵɵNgModuleDeclaration<MatStepperModule, [typeof ɵngcc1.MatHorizontalStepper, typeof ɵngcc1.MatVerticalStepper, typeof ɵngcc1.MatStep, typeof ɵngcc2.MatStepLabel, typeof ɵngcc1.MatStepper, typeof ɵngcc3.MatStepperNext, typeof ɵngcc3.MatStepperPrevious, typeof ɵngcc4.MatStepHeader, typeof ɵngcc5.MatStepperIcon, typeof ɵngcc6.MatStepContent], [typeof ɵngcc7.MatCommonModule, typeof ɵngcc8.CommonModule, typeof ɵngcc9.PortalModule, typeof ɵngcc10.MatButtonModule, typeof ɵngcc11.CdkStepperModule, typeof ɵngcc12.MatIconModule, typeof ɵngcc7.MatRippleModule], [typeof ɵngcc7.MatCommonModule, typeof ɵngcc1.MatStep, typeof ɵngcc2.MatStepLabel, typeof ɵngcc1.MatStepper, typeof ɵngcc3.MatStepperNext, typeof ɵngcc3.MatStepperPrevious, typeof ɵngcc4.MatStepHeader, typeof ɵngcc5.MatStepperIcon, typeof ɵngcc6.MatStepContent]>;
     24    static ɵinj: ɵngcc0.ɵɵInjectorDeclaration<MatStepperModule>;
    925}
     26
     27//# sourceMappingURL=stepper-module.d.ts.map
  • trip-planner-front/node_modules/@angular/material/stepper/stepper.d.ts

    r76712b2 r6fe77af  
    1818import { MatStepperIcon, MatStepperIconContext } from './stepper-icon';
    1919import { MatStepContent } from './step-content';
     20import * as ɵngcc0 from '@angular/core';
    2021export declare class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentInit, OnDestroy {
    2122    private _errorStateMatcher;
     
    3536    /** Custom error state matcher that additionally checks for validity of interacted form. */
    3637    isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean;
     38    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStep, [null, { skipSelf: true; }, null, { optional: true; }]>;
     39    static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatStep, "mat-step", ["matStep"], { "color": "color"; }, {}, ["stepLabel", "_lazyContent"], ["*"]>;
    3740}
    3841/**
     
    5558 */
    5659export declare class MatHorizontalStepper extends _MatProxyStepperBase {
     60    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatHorizontalStepper, never>;
     61    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatHorizontalStepper, "mat-horizontal-stepper", never, {}, {}, never>;
    5762}
    5863/**
     
    6166 */
    6267export declare class MatVerticalStepper extends _MatProxyStepperBase {
     68    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatVerticalStepper, never>;
     69    static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatVerticalStepper, "mat-vertical-stepper", never, {}, {}, never>;
    6370}
    6471export declare class MatStepper extends CdkStepper implements AfterContentInit {
     
    8996    ngAfterContentInit(): void;
    9097    _stepIsNavigable(index: number, step: MatStep): boolean;
     98    static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatStepper, [{ optional: true; }, null, null, null]>;
     99    static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatStepper, "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", ["matStepper", "matVerticalStepper", "matHorizontalStepper"], { "selectedIndex": "selectedIndex"; "labelPosition": "labelPosition"; "disableRipple": "disableRipple"; "color": "color"; }, { "animationDone": "animationDone"; }, ["_steps", "_icons"], never>;
    91100}
    92101export {};
     102
     103//# sourceMappingURL=stepper.d.ts.map
  • trip-planner-front/src/app/_services/location.service.ts

    r76712b2 r6fe77af  
    1 import { HttpClient } from "@angular/common/http";
     1import { HttpClient, HttpHeaders } from "@angular/common/http";
    22import { Injectable } from "@angular/core";
    33import { Observable } from "rxjs";
     4import { LocationDto } from "../_models/dto/locationDto";
    45import { PlannerLocationDto } from "../_models/dto/plannerLocationDto";
    56import { Location } from "../_models/location";
     
    910})
    1011export class LocationService{
     12
     13    httpHeaders: HttpHeaders = new HttpHeaders({
     14        'Authorization': '' + sessionStorage.getItem("token"),
     15        'Accept': 'application/json',
     16        'Content-Type': 'application/json'
     17    });
     18
    1119    constructor(private httpClient : HttpClient){}
    1220
     
    6573        return this.httpClient.get<Location[]>(url + "?place=" + place);
    6674    }
     75
     76    save(locationDto : LocationDto) : Observable<Location>{
     77        let url = "http://localhost:8080/api/add";
     78        return this.httpClient.post<Location>(url, locationDto, {headers: this.httpHeaders});
     79    }
    6780}
  • trip-planner-front/src/app/app-routing.module.ts

    r76712b2 r6fe77af  
    55import { HomepageComponent } from './homepage/homepage.component';
    66import { LoginComponent } from './homepage/login/login.component';
     7import { AddLocationComponent } from './location/add-location/add-location.component';
    78import { LocationDetailsComponent } from './location/location-details/location-details.component';
    89import { LocationComponent } from './location/location.component';
     
    1011import { EditPlannerComponent } from './planner/edit-planner/edit-planner.component';
    1112import { PlannerComponent } from './planner/planner.component';
     13
    1214
    1315const routes: Routes = [
     
    2022  {path: 'location', component: LocationDetailsComponent},
    2123  {path: 'explore', component: ExploreComponent},
    22   {path: 'results', component: ExploreResultComponent}
     24  {path: 'results', component: ExploreResultComponent},
     25  {path: 'add-location', component: AddLocationComponent}
    2326];
    2427
  • trip-planner-front/src/app/app.module.ts

    r76712b2 r6fe77af  
    5252import { ExploreResultComponent } from './explore/explore-result/explore-result.component';
    5353import {RatingModule} from 'primeng/rating';
    54 import { CustomValidators } from './providers/CustomValidators';
     54import { AddLocationComponent } from './location/add-location/add-location.component';
     55import {StepsModule} from 'primeng/steps';
     56import {MatStepperModule} from '@angular/material/stepper';
     57import {FileUploadModule} from 'primeng/fileupload';
    5558
    5659@NgModule({
     
    6871    LoginComponent,
    6972    ExploreComponent,
    70     ExploreResultComponent
    71   ],
     73    ExploreResultComponent,
     74    AddLocationComponent
     75    ],
    7276  imports: [
    7377    BrowserModule,
     
    110114    CardModule,
    111115    AutoCompleteModule,
    112     RatingModule
    113   ],
     116    RatingModule,
     117    StepsModule,
     118    MatStepperModule,
     119    FileUploadModule
     120    ],
    114121
    115122
  • trip-planner-front/src/app/explore/explore-result/explore-result.component.html

    r76712b2 r6fe77af  
    1515
    1616  <main role="main">
    17     <h1 style="color: #F77D62; display: inline; ">Explore </h1>
     17    <h1 style="color: #F77D62; display: inline;">Explore</h1>
    1818    <h1 style=" display: inline;">{{place}}</h1>
    1919    <div class="lightbox" *ngFor="let l of allLocation">
     
    2525      </div>
    2626    </div>
     27
     28
     29   
    2730    <div class="container">
    2831      <li *ngFor="let location of allLocation">
  • trip-planner-front/src/app/explore/explore-result/explore-result.component.ts

    r76712b2 r6fe77af  
    1717  }
    1818
     19  responsiveOptions:any[] = [
     20    {
     21        breakpoint: '1024px',
     22        numVisible: 5
     23    },
     24    {
     25        breakpoint: '768px',
     26        numVisible: 3
     27    },
     28    {
     29        breakpoint: '560px',
     30        numVisible: 1
     31    }
     32];
    1933  ngOnInit(): void {
    2034    this.route.queryParams
     
    2539
    2640      this.locationService.getAllLocationsSearch(this.place).subscribe(
    27         data => {
    28           this.allLocation = data;
     41        res => {
     42          this.allLocation = res;
    2943        }
    3044    )
  • trip-planner-front/src/app/location/location-details/location-details.component.ts

    r76712b2 r6fe77af  
    11import { Component, OnInit } from '@angular/core';
    2 import { ActivatedRoute, Router } from '@angular/router';
     2import { ActivatedRoute } from '@angular/router';
    33import { Images } from 'src/app/_models/images';
    44import { Location } from 'src/app/_models/location';
     
    1717  images: Images[];
    1818
    19   constructor(private route: ActivatedRoute, private router: Router, private locationService: LocationService,
     19  constructor(private route: ActivatedRoute, private locationService: LocationService,
    2020    private imagesService: ImagesService) {
    2121    this.locationId = 1;
  • trip-planner-front/src/app/locations-form/locations-form.component.html

    r76712b2 r6fe77af  
    3535      <mat-label>Please select a region</mat-label>
    3636      <mat-select [(ngModel)]="regionId" placeholder="Select region" name="region">
    37         <mat-option [value]="region.id" *ngFor="let region of regions" [value]="region.id"> {{region.name}}
     37        <mat-option [value]="region.id" *ngFor="let region of regions"> {{region.name}}
    3838        </mat-option>
    3939      </mat-select>
  • trip-planner-front/src/app/planner/planner.component.html

    r76712b2 r6fe77af  
    1313</nav>
    1414
     15<button pButton pRipple type="button" label="Add location" class="p-button-help " (click)="onClickAddLocation()"></button>
    1516
    1617<br>
  • trip-planner-front/src/app/planner/planner.component.ts

    r76712b2 r6fe77af  
    9999    window.location.reload();
    100100  }
     101
     102  onClickAddLocation(){
     103    this.router.navigate(['add-location']);
     104  }
    101105}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/models/Location.java

    r76712b2 r6fe77af  
    1414@Entity
    1515@Table(name = "locations")
    16 @NoArgsConstructor
    1716@AllArgsConstructor
    1817@Getter
     
    6564    private List<Planner> plannerList;
    6665
     66    @ManyToOne
     67    @JsonBackReference
     68    @JoinColumn(name = "id_user")
     69    private User user;
    6770
    6871    @ManyToMany
     
    7477    private List<Category> categoryList;
    7578
    76 
    7779    @OneToMany(mappedBy = "location", cascade = CascadeType.REMOVE, orphanRemoval = true)
    7880    @JsonManagedReference
    7981    private List<Images> imagesList;
    8082
     83    public Location(String name, String description, String address, String priority, int duration, String trivia, byte[] photo, Region region, City city, User user) {
     84        this.name = name;
     85        this.description = description;
     86        this.address = address;
     87        this.priority = priority;
     88        this.duration = duration;
     89        this.trivia = trivia;
     90        this.photo = photo;
     91        this.region = region;
     92        this.city = city;
     93        this.user = user;
     94    }
    8195
     96    public Location() {
     97    }
    8298}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/models/User.java

    r76712b2 r6fe77af  
    22
    33import com.fasterxml.jackson.annotation.JsonIgnore;
     4import com.fasterxml.jackson.annotation.JsonManagedReference;
    45import lombok.AllArgsConstructor;
    56import lombok.Getter;
     
    4445    @JsonIgnore
    4546    private List<Planner> planners = new ArrayList<>();
     47
     48    @OneToMany(cascade = CascadeType.REFRESH, mappedBy = "user", orphanRemoval = true)
     49    @JsonIgnore
     50    private List<Location> locationList = new ArrayList<>();;
    4651
    4752    public User() {
  • trip-planner/src/main/java/finki/diplomska/tripplanner/security/SecurityConfig.java

    r76712b2 r6fe77af  
    8181                .antMatchers("/api/all").permitAll()
    8282                .antMatchers("/api/places").permitAll()
     83                .antMatchers("/create/planner").permitAll()
     84                .antMatchers("/create/planner/{id}").permitAll()
     85                .antMatchers("/create/locations").permitAll()
     86                .antMatchers("/create/trip/locations").permitAll()
     87                .antMatchers("/create").permitAll()
    8388                .anyRequest().authenticated();
    8489        http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java

    r76712b2 r6fe77af  
    44import finki.diplomska.tripplanner.models.Location;
    55import finki.diplomska.tripplanner.models.Planner;
     6import finki.diplomska.tripplanner.models.dto.LocationDto;
    67import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
    78import org.springframework.data.repository.query.Param;
     
    2627    List<Long> getAllLocationIdsForPlanner(Long plannerId);
    2728    List<Location> getAllLocations(String place);
     29    Optional<Location> save (LocationDto locationDto, String username);
    2830}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java

    r76712b2 r6fe77af  
    11package finki.diplomska.tripplanner.service.impl;
    22
    3 import finki.diplomska.tripplanner.models.Location;
    4 import finki.diplomska.tripplanner.models.Planner;
     3import finki.diplomska.tripplanner.models.*;
     4import finki.diplomska.tripplanner.models.dto.LocationDto;
    55import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
     6import finki.diplomska.tripplanner.models.exceptions.CityNotFoundException;
     7import finki.diplomska.tripplanner.models.exceptions.CompanionNotFoundException;
    68import finki.diplomska.tripplanner.models.exceptions.LocationNotFoundException;
    7 import finki.diplomska.tripplanner.repository.jpa.JpaLocationRepository;
    8 import finki.diplomska.tripplanner.repository.jpa.JpaPlannerRepository;
     9import finki.diplomska.tripplanner.models.exceptions.RegionNotFoundException;
     10import finki.diplomska.tripplanner.repository.jpa.*;
    911import finki.diplomska.tripplanner.service.LocationService;
    1012import org.springframework.stereotype.Service;
     
    1921    private final JpaLocationRepository locationRepository;
    2022    private final JpaPlannerRepository plannerRepository;
    21 
    22     public LocationServiceImpl(JpaLocationRepository locationRepository, JpaPlannerRepository plannerRepository) {
     23    private final JpaRegionRepository regionRepository;
     24    private final JpaCityRepository cityRepository;
     25    private final JpaUserRepository userRepository;
     26    private final JpaCategoryRepository categoryRepository;
     27    private final JpaCompanionRepository companionRepository;
     28
     29    public LocationServiceImpl(JpaLocationRepository locationRepository, JpaPlannerRepository plannerRepository, JpaRegionRepository regionRepository, JpaCityRepository cityRepository, JpaUserRepository userRepository, JpaCategoryRepository categoryRepository, JpaCompanionRepository companionRepository) {
    2330        this.locationRepository = locationRepository;
    2431        this.plannerRepository = plannerRepository;
     32        this.regionRepository = regionRepository;
     33        this.cityRepository = cityRepository;
     34        this.userRepository = userRepository;
     35        this.categoryRepository = categoryRepository;
     36        this.companionRepository = companionRepository;
    2537    }
    2638
     
    151163            }
    152164        }
    153 
    154165        return newList;
    155166    }
     
    189200    }
    190201
     202    @Override
     203    public Optional<Location> save(LocationDto locationDto, String username) {
     204        City city = new City();
     205        Region region = this.regionRepository.findById(locationDto.getRegion())
     206                .orElseThrow(() -> new RegionNotFoundException(locationDto.getRegion()));
     207        if(locationDto.getCity() != null){
     208             city = this.cityRepository.findById(locationDto.getCity())
     209                    .orElseThrow(() -> new CityNotFoundException(locationDto.getCity()));
     210        }else{
     211            city = null;
     212        }
     213        User user = this.userRepository.findByUsername(username);
     214        locationDto.setUser(user.getUsername());
     215        return Optional.of(this.locationRepository.save(new Location(locationDto.getName(), locationDto.getDescription(), locationDto.getAddress(), locationDto.getPriority(),
     216                locationDto.getDuration(), locationDto.getTrivia(), locationDto.getPhoto(), region, city, user)));
     217    }
    191218
    192219}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java

    r76712b2 r6fe77af  
    22
    33import finki.diplomska.tripplanner.models.Location;
     4import finki.diplomska.tripplanner.models.User;
     5import finki.diplomska.tripplanner.models.dto.LocationDto;
    46import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
    57import finki.diplomska.tripplanner.service.LocationService;
    68import finki.diplomska.tripplanner.service.PlannerService;
    79import org.springframework.http.ResponseEntity;
     10import org.springframework.security.core.Authentication;
    811import org.springframework.web.bind.annotation.*;
    912
     
    8285    }
    8386
     87    @PostMapping("/add")
     88    public ResponseEntity<Location> save(@RequestBody LocationDto locationDto, Authentication authentication) {
     89        User user = (User) authentication.getPrincipal();
     90        return this.locationService.save(locationDto, user.getUsername())
     91                .map(location -> ResponseEntity.ok().body(location))
     92                .orElseGet(() -> ResponseEntity.badRequest().build());
     93    }
    8494}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java

    r76712b2 r6fe77af  
    6969    @ResponseStatus(HttpStatus.CREATED)
    7070    public ResponseEntity<?> newPlanner(@Valid @RequestBody PlannerDto plannerDto, Authentication authentication)  {
    71 
    7271        User user = (User) authentication.getPrincipal();
    7372        return this.plannerService.newPlanner(plannerDto, user.getUsername())
  • trip-planner/src/test/api.http

    r76712b2 r6fe77af  
    117117GET http://localhost:8080/api/places
    118118Content-Type: application/json
     119
     120###
     121POST http://localhost:8080/api/add
     122Content-Type: application/json
Note: See TracChangeset for help on using the changeset viewer.