From 9030bcbe7a21ab33af9ac3a55d8251832d226ca0 Mon Sep 17 00:00:00 2001 From: vikwato Date: Sun, 15 Jul 2018 14:48:33 +0200 Subject: [PATCH 01/11] changed app name --- server/app/Http/Controllers/Auth/LoginController.php | 2 +- server/app/Http/Controllers/Auth/RegisterController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/app/Http/Controllers/Auth/LoginController.php b/server/app/Http/Controllers/Auth/LoginController.php index e066d5c..7419ce3 100644 --- a/server/app/Http/Controllers/Auth/LoginController.php +++ b/server/app/Http/Controllers/Auth/LoginController.php @@ -27,7 +27,7 @@ public function login(){ 'password' => request('password') ])){ $user = Auth::user(); - $success['token'] = $user->createToken('GPZ-Booking-System')->accessToken; + $success['token'] = $user->createToken('agora-booking-system')->accessToken; $success['username'] = $user->username; $response = [ diff --git a/server/app/Http/Controllers/Auth/RegisterController.php b/server/app/Http/Controllers/Auth/RegisterController.php index ab02c3e..14b0ee1 100644 --- a/server/app/Http/Controllers/Auth/RegisterController.php +++ b/server/app/Http/Controllers/Auth/RegisterController.php @@ -37,7 +37,7 @@ public function register(Request $request){ $input = $request->all(); $input['password'] = bcrypt($input['password']); $user = User::create($input); - $success['token'] = $user->createToken('GPZ-Booking-System')->accessToken; + $success['token'] = $user->createToken('agora-booking-system')->accessToken; $success['username'] = $user->username; $response = [ From 3280135eeecd2a0edd166ba37073f430a6457c56 Mon Sep 17 00:00:00 2001 From: vikwato Date: Mon, 23 Jul 2018 20:55:19 +0200 Subject: [PATCH 02/11] Passport install --- server/composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/composer.json b/server/composer.json index 3a9759a..e1a6fa5 100644 --- a/server/composer.json +++ b/server/composer.json @@ -53,7 +53,8 @@ "post-install-cmd": [ "Illuminate\\Foundation\\ComposerScripts::postInstall", - "php artisan migrate --force" + "php artisan migrate --force", + "php artisan passport:install" ] }, "config": { From 8d11f9622a462b7f62244870dbdb683a96fa6286 Mon Sep 17 00:00:00 2001 From: Chingaipe Date: Sun, 6 Jan 2019 11:50:57 +0200 Subject: [PATCH 03/11] Calendar module added with test data. TODO: Make data input dynamic --- client/package-lock.json | 36 +++++----- client/package.json | 2 +- .../calendar/calendar.component.html | 28 +++++++- .../components/calendar/calendar.component.ts | 71 +++++++++---------- .../dashboard/dashboard.component.html | 5 +- .../components/footer/footer.component.css | 16 +++++ .../components/footer/footer.component.html | 13 ++++ .../footer/footer.component.spec.ts | 25 +++++++ .../app/components/footer/footer.component.ts | 15 ++++ 9 files changed, 147 insertions(+), 64 deletions(-) create mode 100644 client/src/app/components/footer/footer.component.css create mode 100644 client/src/app/components/footer/footer.component.html create mode 100644 client/src/app/components/footer/footer.component.spec.ts create mode 100644 client/src/app/components/footer/footer.component.ts diff --git a/client/package-lock.json b/client/package-lock.json index 20353f1..5cb7224 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -496,33 +496,29 @@ "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" }, "angular-calendar": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/angular-calendar/-/angular-calendar-0.25.2.tgz", - "integrity": "sha512-sFzqwioLIEbRIpFcZq6Ap0tW8n8NNApwbbbs0DTmjnQjr6N1VZArlkKCecfqkYYG6dE496t7V616Ak7gTBa4QA==", + "version": "0.24.1", + "resolved": "https://registry.npmjs.org/angular-calendar/-/angular-calendar-0.24.1.tgz", + "integrity": "sha512-26KnxZHU0jhFxbjimvdbiyHBbuHt7ZNpbfJ79PKhF8pT8yOUqp8GZV/1HeQAJeP/zvh548lPRMzbyopzLKfofA==", "requires": { - "angular-draggable-droppable": "3.0.1", - "angular-resizable-element": "3.2.0", + "angular-draggable-droppable": "2.0.0", + "angular-resizable-element": "2.0.0", "calendar-utils": "0.1.2", "date-fns": "1.29.0", "positioning": "1.4.0", "tslib": "1.9.0" + }, + "dependencies": { + "angular-resizable-element": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/angular-resizable-element/-/angular-resizable-element-2.0.0.tgz", + "integrity": "sha512-Jsa818fxtAtBA3Fp1u4mWV9tcpakM+bNYFFbB/AjKig2BtzZkeyLx3vjcBCfwPmXkK10kX2QKR8RDALk1w209A==" + } } }, "angular-draggable-droppable": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/angular-draggable-droppable/-/angular-draggable-droppable-3.0.1.tgz", - "integrity": "sha512-+GYYq4U5rPcoNwaCdoY3sNBBKd80JT7+R8n4QINJKvtToisyGpsXmX68SkKfHsNtXyTzoxX/h/37XJgE0y8KLw==", - "requires": { - "tslib": "1.9.0" - } - }, - "angular-resizable-element": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/angular-resizable-element/-/angular-resizable-element-3.2.0.tgz", - "integrity": "sha512-JxRRuqSsC7h2zidbC8cnY3elWJkS2tYFd6+GCetw2s9i2UwwkhOJSGROimotNzuf2GA76VG2vvh+YMkKWmMABw==", - "requires": { - "tslib": "1.9.0" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/angular-draggable-droppable/-/angular-draggable-droppable-2.0.0.tgz", + "integrity": "sha512-/b8LIGamjOKnDI2uG1jRUErTIHeQ3w2WqHn4cbeiUTy+6eNHjkQI32DNhvxl0nVxr2gF5QluECNB4uWjMMyzQg==" }, "angular2-jwt": { "version": "0.2.3", @@ -1295,7 +1291,7 @@ }, "calendar-utils": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/calendar-utils/-/calendar-utils-0.1.2.tgz", + "resolved": "http://registry.npmjs.org/calendar-utils/-/calendar-utils-0.1.2.tgz", "integrity": "sha512-9j4Zd1itopNYTSWzFU4MqD2IDHMqznfxsGr8UWGh7hWv+lKzjRJz0LS29iAg5rHtP6+6x3ikQnhoMGqFUzoD2Q==" }, "callsite": { diff --git a/client/package.json b/client/package.json index b75227a..6d215c2 100644 --- a/client/package.json +++ b/client/package.json @@ -24,7 +24,7 @@ "@angular/platform-browser-dynamic": "5.2.9", "@angular/router": "5.2.9", "@ng-bootstrap/ng-bootstrap": "^1.0.2", - "angular-calendar": "^0.25.2", + "angular-calendar": "^0.24.1", "angular2-jwt": "^0.2.3", "bootstrap": "^4.0.0", "core-js": "^2.4.1", diff --git a/client/src/app/components/calendar/calendar.component.html b/client/src/app/components/calendar/calendar.component.html index 9f1f7a1..18f4ab6 100644 --- a/client/src/app/components/calendar/calendar.component.html +++ b/client/src/app/components/calendar/calendar.component.html @@ -1,3 +1,25 @@ + + + + + +
@@ -51,13 +73,14 @@

{{ viewDate | calendarDate:(view + 'ViewTitle'):'en' }}

+
+
{{ viewDate | calendarDate:(view + 'ViewTitle'):'en' }} (eventClicked)="handleEvent('Clicked', $event.event)" (eventTimesChanged)="eventTimesChanged($event)"> -

-
\ No newline at end of file + diff --git a/client/src/app/components/calendar/calendar.component.ts b/client/src/app/components/calendar/calendar.component.ts index 422bdf4..a96a5a2 100644 --- a/client/src/app/components/calendar/calendar.component.ts +++ b/client/src/app/components/calendar/calendar.component.ts @@ -1,9 +1,6 @@ -import { Component, - ChangeDetectionStrategy, - OnInit -} from '@angular/core'; - -import { startOfDay, +import { Component, ChangeDetectionStrategy, ViewChild, TemplateRef } from '@angular/core'; +import { + startOfDay, endOfDay, subDays, addDays, @@ -12,14 +9,13 @@ import { startOfDay, isSameMonth, addHours } from 'date-fns'; +import { Subject } from 'rxjs/Subject'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap/modal/modal.module'; +import { CalendarEvent, CalendarEventAction, CalendarEventTimesChangedEvent } from 'angular-calendar'; -import { Subject } from 'rxjs'; -import { - CalendarEvent, - CalendarEventAction, - CalendarEventTimesChangedEvent -} from 'angular-calendar'; - +/** + * Color indicators + */ const colors: any = { red: { primary: '#ad2121', @@ -38,31 +34,33 @@ const colors: any = { @Component({ selector: 'app-calendar', changeDetection: ChangeDetectionStrategy.OnPush, - templateUrl: './calendar.component.html', - styleUrls: ['./calendar.component.css'] - + styleUrls: ['./calendar.component.css'], + templateUrl: './calendar.component.html' }) +export class CalendarComponent { + @ViewChild('modalContent') modalContent: TemplateRef; - -export class CalendarComponent implements OnInit { - - - view: string = 'month'; + view = 'month'; viewDate: Date = new Date(); + modalData: { + action: string; + event: CalendarEvent; + }; + actions: CalendarEventAction[] = [ { label: '', onClick: ({ event }: { event: CalendarEvent }): void => { - /* this.handleEvent('Edited', event); */ + this.handleEvent('Edited', event); } }, { label: '', onClick: ({ event }: { event: CalendarEvent }): void => { this.events = this.events.filter(iEvent => iEvent !== event); - /* this.handleEvent('Deleted', event); */ + this.handleEvent('Deleted', event); } } ]; @@ -94,22 +92,17 @@ export class CalendarComponent implements OnInit { end: new Date(), title: 'A draggable and resizable event', color: colors.yellow, - actions: this.actions, - resizable: { - beforeStart: true, - afterEnd: true - }, - draggable: true + actions: this.actions } ]; - activeDayIsOpen: boolean = true; + activeDayIsOpen = true; - constructor() {} - ngOnInit() {} + constructor(private modal: NgbModal) {} dayClicked({ date, events }: { date: Date; events: CalendarEvent[] }): void { if (isSameMonth(date, this.viewDate)) { + this.viewDate = date; if ( (isSameDay(this.viewDate, date) && this.activeDayIsOpen === true) || events.length === 0 @@ -117,7 +110,6 @@ export class CalendarComponent implements OnInit { this.activeDayIsOpen = false; } else { this.activeDayIsOpen = true; - this.viewDate = date; } } } @@ -129,20 +121,21 @@ export class CalendarComponent implements OnInit { }: CalendarEventTimesChangedEvent): void { event.start = newStart; event.end = newEnd; + this.handleEvent('Dropped or resized', event); this.refresh.next(); } + handleEvent(action: string, event: CalendarEvent): void { + this.modalData = { event, action }; + this.modal.open(this.modalContent, { size: 'lg' }); + } + addEvent(): void { this.events.push({ title: 'New event', start: startOfDay(new Date()), end: endOfDay(new Date()), - color: colors.red, - draggable: true, - resizable: { - beforeStart: true, - afterEnd: true - } + color: colors.red }); this.refresh.next(); } diff --git a/client/src/app/components/dashboard/dashboard.component.html b/client/src/app/components/dashboard/dashboard.component.html index afdea36..dcadae2 100644 --- a/client/src/app/components/dashboard/dashboard.component.html +++ b/client/src/app/components/dashboard/dashboard.component.html @@ -40,5 +40,8 @@
Create a new booking
- + +
+ +
diff --git a/client/src/app/components/footer/footer.component.css b/client/src/app/components/footer/footer.component.css new file mode 100644 index 0000000..b5f5954 --- /dev/null +++ b/client/src/app/components/footer/footer.component.css @@ -0,0 +1,16 @@ +.footer { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + height: 64px; + align-items: center; + background-color: rgba(0, 0, 0, .25); +} + +.text { + color: #fff; + text-align: center; + font-size: 16px; + font-weight: 500; +} diff --git a/client/src/app/components/footer/footer.component.html b/client/src/app/components/footer/footer.component.html new file mode 100644 index 0000000..fa013d3 --- /dev/null +++ b/client/src/app/components/footer/footer.component.html @@ -0,0 +1,13 @@ + +
+ + +
+

+ © 2018 Copyright, Profile Template +

+
+ + +
+ \ No newline at end of file diff --git a/client/src/app/components/footer/footer.component.spec.ts b/client/src/app/components/footer/footer.component.spec.ts new file mode 100644 index 0000000..2ca6c45 --- /dev/null +++ b/client/src/app/components/footer/footer.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FooterComponent } from './footer.component'; + +describe('FooterComponent', () => { + let component: FooterComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FooterComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FooterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/client/src/app/components/footer/footer.component.ts b/client/src/app/components/footer/footer.component.ts new file mode 100644 index 0000000..67f1378 --- /dev/null +++ b/client/src/app/components/footer/footer.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-footer', + templateUrl: './footer.component.html', + styleUrls: ['./footer.component.css'] +}) +export class FooterComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} From 2c68727a884d10df26c33c3362f7bcbaa12ff125 Mon Sep 17 00:00:00 2001 From: vikwato Date: Sat, 19 Jan 2019 10:46:12 +0200 Subject: [PATCH 04/11] Started working on booking conflicts --- .../Http/Controllers/BookingController.php | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/server/app/Http/Controllers/BookingController.php b/server/app/Http/Controllers/BookingController.php index 386081f..33f9364 100644 --- a/server/app/Http/Controllers/BookingController.php +++ b/server/app/Http/Controllers/BookingController.php @@ -5,6 +5,7 @@ use App\Booking; use Illuminate\Http\Request; use Validator; +use Illuminate\Support\Facades\DB; class BookingController extends Controller { @@ -18,10 +19,10 @@ class BookingController extends Controller public function store(Request $request) { $validator = Validator::make($request->all(), [ - 'start_time' => 'required', - 'end_time' => 'required', - 'start_date' => 'required | date', - 'end_date' => 'required | date', + 'start_time' => 'required | before:end_time', + 'end_time' => 'required | after:start_time', + 'start_date' => 'required | date | before_or_equal:end_date', + 'end_date' => 'required | date | after_or_equal:start_date', 'event_id' => 'required|exists:events,id', 'rooms' => 'required|exists:rooms,id' ]); @@ -32,15 +33,38 @@ public function store(Request $request) $input = $request->all(); - $booking = new Booking($input); - $booking->save(); - $booking->rooms()->attach($request->rooms); + $existing_bookings = DB::table('bookings') + ->join('booking_room', 'bookings.id', '=', 'booking_room.booking_id') + ->select('booking_room.room_id', 'bookings.start_date', 'bookings.end_date', + 'bookings.start_time', 'bookings.end_time') + ->get(); - $response = [ - 'booking' => $booking - ]; + foreach ($request->rooms as $room){ + foreach ($existing_bookings as $existing_booking){ + if ($existing_booking->room_id == $room){ + + $response = [ + 'This booking clashes with another booking', + ]; - return response()->json($response, 201); + return response()->json($response, 500); + } + + else{ + $booking = new Booking($input); + $booking->save(); + $booking->rooms()->attach($request->rooms); + + $response = [ + 'booking' => $booking, + 'existing_room' => $existing_booking->room_id, + 'room' => $room + ]; + + return response()->json($response, 201); + } + } + } } /** From 1d1062becc2107047915934640a014be3e2aa2e5 Mon Sep 17 00:00:00 2001 From: Chingaipe Date: Mon, 21 Jan 2019 22:42:18 +0200 Subject: [PATCH 05/11] Calendar module working with minor glitches --- .../book-form/book-form.component.html | 32 ++++++++- .../calendar/calendar.component.html | 17 ++--- .../components/calendar/calendar.component.ts | 71 ++++++++++--------- .../dashboard/dashboard.component.html | 14 +++- .../dashboard/dashboard.component.ts | 43 ++++++++++- 5 files changed, 132 insertions(+), 45 deletions(-) diff --git a/client/src/app/components/book-form/book-form.component.html b/client/src/app/components/book-form/book-form.component.html index 13222b0..2e194ae 100644 --- a/client/src/app/components/book-form/book-form.component.html +++ b/client/src/app/components/book-form/book-form.component.html @@ -27,7 +27,37 @@

Add a Booking

- + + + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+
+
diff --git a/client/src/app/components/calendar/calendar.component.html b/client/src/app/components/calendar/calendar.component.html index 18f4ab6..3c02ca3 100644 --- a/client/src/app/components/calendar/calendar.component.html +++ b/client/src/app/components/calendar/calendar.component.html @@ -1,24 +1,25 @@ +
@@ -75,7 +76,7 @@

{{ viewDate | calendarDate:(view + 'ViewTitle'):'en' }}


- +
; view = 'month'; @@ -67,38 +68,43 @@ export class CalendarComponent { refresh: Subject = new Subject(); - events: CalendarEvent[] = [ - { - start: subDays(startOfDay(new Date()), 1), - end: addDays(new Date(), 1), - title: 'A 3 day event', - color: colors.red, - actions: this.actions - }, - { - start: startOfDay(new Date()), - title: 'An event with no end date', - color: colors.yellow, - actions: this.actions - }, - { - start: subDays(endOfMonth(new Date()), 3), - end: addDays(endOfMonth(new Date()), 3), - title: 'A long event that spans 2 months', - color: colors.blue - }, - { - start: addHours(startOfDay(new Date()), 2), - end: new Date(), - title: 'A draggable and resizable event', - color: colors.yellow, - actions: this.actions - } - ]; + events: CalendarEvent[] = []; // events array of CAlendarEvent activeDayIsOpen = true; - constructor(private modal: NgbModal) {} + constructor( + private modal: NgbModal, + private eventService: EventServiceService + ) {} + + ngOnInit() { + // Fetch the events from the DB + this.eventService.getAllEvents().subscribe( + data => { + const evnt = data['events']; + + // foreach element in $evnt create a structured object and push it to $events array + evnt.forEach(element => { + const obj = { + start: this.toDate(element.bookings[0]['start_date']), // convert to javascript date + end: this.toDate(element.bookings[0]['end_date']), + title: element.name + }; + this.events.push(obj); // pushs structured obj to events Array + // info.push(obj); + }); + + this.refresh.next(); + }, + // handle error + error => { console.error(error); } + ); + } + + // Converts a string date to JS Date Object + toDate(date) { + return new Date(date); + } dayClicked({ date, events }: { date: Date; events: CalendarEvent[] }): void { if (isSameMonth(date, this.viewDate)) { @@ -125,9 +131,10 @@ export class CalendarComponent { this.refresh.next(); } + // Opens that event modal handleEvent(action: string, event: CalendarEvent): void { this.modalData = { event, action }; - this.modal.open(this.modalContent, { size: 'lg' }); + this.modal.open(this.modalContent, { size: 'sm' }); } addEvent(): void { diff --git a/client/src/app/components/dashboard/dashboard.component.html b/client/src/app/components/dashboard/dashboard.component.html index dcadae2..dd92159 100644 --- a/client/src/app/components/dashboard/dashboard.component.html +++ b/client/src/app/components/dashboard/dashboard.component.html @@ -41,7 +41,15 @@
Create a new booking
-
- -
+
diff --git a/client/src/app/components/dashboard/dashboard.component.ts b/client/src/app/components/dashboard/dashboard.component.ts index 6b7ea0d..d82e256 100644 --- a/client/src/app/components/dashboard/dashboard.component.ts +++ b/client/src/app/components/dashboard/dashboard.component.ts @@ -1,6 +1,21 @@ import { Component, OnInit } from '@angular/core'; + +import { + startOfDay, + endOfDay, + subDays, + addDays, + endOfMonth, + isSameDay, + isSameMonth, + addHours +} from 'date-fns'; + +import { CalendarEvent } from 'angular-calendar'; + import { BookingServiceService } from '../../services/booking-service.service'; import { UtilsService } from '../../services/utils.service'; +import { EventServiceService } from '../../services/event-service.service'; @Component({ selector: 'app-dashboard', @@ -9,9 +24,35 @@ import { UtilsService } from '../../services/utils.service'; }) export class DashboardComponent implements OnInit { + viewDate = Date.now(); + activeDayIsOpen = true; + + events: CalendarEvent[] = [ + { + start: subDays(startOfDay(new Date()), 1), + end: addDays(new Date(), 1), + title: 'A 3 day event' + }, + { + start: startOfDay(new Date()), + title: 'An event with no end date', + }, + { + start: subDays(endOfMonth(new Date()), 3), + end: addDays(endOfMonth(new Date()), 3), + title: 'A long event that spans 2 months' + }, + { + start: addHours(startOfDay(new Date()), 2), + end: new Date(), + title: 'A draggable and resizable event' + } + ]; + constructor( private bookinService: BookingServiceService, - private utilService: UtilsService + private utilService: UtilsService, + private evntService: EventServiceService ) { } ngOnInit() { From bd1e143bd3fc029d5e8f78fc698494f6f17c0047 Mon Sep 17 00:00:00 2001 From: vikwato Date: Tue, 29 Jan 2019 11:01:20 +0200 Subject: [PATCH 06/11] fixed booking on same day conflict bug --- .../Http/Controllers/BookingController.php | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/server/app/Http/Controllers/BookingController.php b/server/app/Http/Controllers/BookingController.php index 33f9364..6eaef78 100644 --- a/server/app/Http/Controllers/BookingController.php +++ b/server/app/Http/Controllers/BookingController.php @@ -18,6 +18,8 @@ class BookingController extends Controller */ public function store(Request $request) { + $booking_conflicts = 0; + $validator = Validator::make($request->all(), [ 'start_time' => 'required | before:end_time', 'end_time' => 'required | after:start_time', @@ -35,35 +37,41 @@ public function store(Request $request) $existing_bookings = DB::table('bookings') ->join('booking_room', 'bookings.id', '=', 'booking_room.booking_id') - ->select('booking_room.room_id', 'bookings.start_date', 'bookings.end_date', - 'bookings.start_time', 'bookings.end_time') + ->select('booking_room.room_id', 'bookings.start_time', 'bookings.end_time', + 'bookings.start_date', 'bookings.end_date') ->get(); - foreach ($request->rooms as $room){ - foreach ($existing_bookings as $existing_booking){ - if ($existing_booking->room_id == $room){ - - $response = [ - 'This booking clashes with another booking', - ]; + foreach ($existing_bookings as $existing_booking){ + foreach ($request->rooms as $room){ + if ($existing_booking->room_id == $room + && ($request->end_time >= $existing_booking->start_time + && $request->start_time <= $existing_booking->end_time) + && ($request->start_date >= $existing_booking->end_date + && $request->end_date <= $existing_booking->start_date)){ - return response()->json($response, 500); + $booking_conflicts += 1; } + } + } - else{ - $booking = new Booking($input); - $booking->save(); - $booking->rooms()->attach($request->rooms); + if ($booking_conflicts > 0){ + $response = [ + 'This booking clashes with another booking', + ]; - $response = [ - 'booking' => $booking, - 'existing_room' => $existing_booking->room_id, - 'room' => $room - ]; + return response()->json($response, 500); + } + else { - return response()->json($response, 201); - } - } + $booking = new Booking($input); + $booking->save(); + $booking->rooms()->attach($request->rooms); + + $response = [ + 'booking' => $booking, + ]; + + return response()->json($response, 201); } } From ffc63e626fff0a2498cf14fc897704a2ea0028a5 Mon Sep 17 00:00:00 2001 From: vikwato Date: Sun, 3 Feb 2019 18:10:27 +0200 Subject: [PATCH 07/11] added organizations to the events --- server/app/Event.php | 10 +- .../app/Http/Controllers/EventController.php | 1 + .../Controllers/OrganizationController.php | 116 ++++++++++++++++++ server/app/Organization.php | 24 ++++ ...2_02_141944_create_organizations_table.php | 34 +++++ ...reate_events_organizations_foreign_key.php | 36 ++++++ server/routes/api.php | 10 ++ 7 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 server/app/Http/Controllers/OrganizationController.php create mode 100644 server/app/Organization.php create mode 100644 server/database/migrations/2019_02_02_141944_create_organizations_table.php create mode 100644 server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php diff --git a/server/app/Event.php b/server/app/Event.php index 2005904..af59745 100644 --- a/server/app/Event.php +++ b/server/app/Event.php @@ -12,7 +12,8 @@ class Event extends Model * @var array */ protected $fillable = [ - 'name' + 'name', + 'organization_id' ]; /** @@ -21,4 +22,11 @@ class Event extends Model public function bookings(){ return $this->hasMany('App\Booking'); } + + /** + * Assign the event to an organization. + */ + public function organization(){ + return $this->belongsTo('App\Organization'); + } } diff --git a/server/app/Http/Controllers/EventController.php b/server/app/Http/Controllers/EventController.php index a06a834..8c4684c 100644 --- a/server/app/Http/Controllers/EventController.php +++ b/server/app/Http/Controllers/EventController.php @@ -18,6 +18,7 @@ public function store(Request $request) { $validator = Validator::make($request->all(), [ 'name' => 'required', + 'organization_id' => 'required|exists:organizations,id' ]); if($validator->fails()){ diff --git a/server/app/Http/Controllers/OrganizationController.php b/server/app/Http/Controllers/OrganizationController.php new file mode 100644 index 0000000..ffaf61b --- /dev/null +++ b/server/app/Http/Controllers/OrganizationController.php @@ -0,0 +1,116 @@ +all(), [ + 'name' => 'required', + ]); + + if($validator->fails()){ + return response()->json(['error'=>$validator->errors()], 401); + } + + $input = $request->all(); + + $organization = new Organization($input); + $organization->save(); + + $response = [ + 'organization' => $organization + ]; + + return response()->json($response, 201); + } + + /** + * Display a listing of the resource. + * + * @return \Illuminate\Http\Response + */ + public function index() + { + // $events = Event::all(); + + // query to retreive organization and its events + $organization = Organization::with(['events' => function($query) { + $query->latest(); // orders the events in desc order(most rest first) + }])->orderBy('created_at', 'desc')->get(); + + $response = [ + 'organization' => $organization + ]; + return response()->json($response, 200); + } + + /** + * Display the specified resource. + * + * @param Organization $organization + * @return \Illuminate\Http\Response + * @internal param int $id + */ + public function select(Organization $organization) + { + $events = $organization->events()->get(); + $response = [ + 'organization' => $organization, + 'events' => $events + ]; + + return response($response, 200); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param Organization $organization + * @return \Illuminate\Http\Response + * @internal param int $id + */ + public function update(Request $request, Organization $organization) + { + if(!$organization) + throw new NotFoundHttpException; + + $organization->update($request->all()); + $response = [ + 'event' => $organization + ]; + + return response()->json($response, 200); + } + + /** + * Remove the specified resource from storage. + * + * @param Organization $organization + * @return \Illuminate\Http\Response + * @throws \Exception + * @internal param int $id + */ + public function destroy(Organization $organization) + { + if(!$organization) + throw new NotFoundHttpException; + + if($organization->delete()) + return response()->json(null, 204); + else + return response()->json(['error' => 'Could not delete organization'], 500); + } +} diff --git a/server/app/Organization.php b/server/app/Organization.php new file mode 100644 index 0000000..d1c9777 --- /dev/null +++ b/server/app/Organization.php @@ -0,0 +1,24 @@ +hasMany('App\Event'); + } +} diff --git a/server/database/migrations/2019_02_02_141944_create_organizations_table.php b/server/database/migrations/2019_02_02_141944_create_organizations_table.php new file mode 100644 index 0000000..0bda524 --- /dev/null +++ b/server/database/migrations/2019_02_02_141944_create_organizations_table.php @@ -0,0 +1,34 @@ +increments('id'); + $table->string('name'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('organizations', function (Blueprint $table) { + // + }); + } +} diff --git a/server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php b/server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php new file mode 100644 index 0000000..e4682bb --- /dev/null +++ b/server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php @@ -0,0 +1,36 @@ +integer('organization_id')->unsigned(); + + $table->foreign('organization_id') + ->references('id')->on('organizations') + ->onDelete('cascade')->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function (Blueprint $table) { + // + }); + } +} diff --git a/server/routes/api.php b/server/routes/api.php index c83b3c6..a3ed7e8 100644 --- a/server/routes/api.php +++ b/server/routes/api.php @@ -33,6 +33,16 @@ }); }); +Route::group(['prefix' => 'organizations'], function () { + Route::group(['middleware' => 'auth:api'], function () { + Route::get('all', 'OrganizationController@index'); + Route::get('{organization}', 'OrganizationController@select'); + Route::post('', 'OrganizationController@store'); + Route::put('{organization}', 'OrganizationController@update'); + Route::delete('{organization}', 'OrganizationController@destroy'); + }); +}); + Route::group(['prefix' => 'bookings'], function () { Route::group(['middleware' => 'auth:api'], function () { Route::post('', 'BookingController@store'); From d7fbd63a39218cdea76baa967e944eb06608fa26 Mon Sep 17 00:00:00 2001 From: vikwato Date: Sun, 3 Feb 2019 18:24:09 +0200 Subject: [PATCH 08/11] fixed organization addition to DB --- ...019_02_02_143557_create_events_organizations_foreign_key.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php b/server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php index e4682bb..04e8593 100644 --- a/server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php +++ b/server/database/migrations/2019_02_02_143557_create_events_organizations_foreign_key.php @@ -14,7 +14,7 @@ class CreateEventsOrganizationsForeignKey extends Migration public function up() { Schema::table('events', function (Blueprint $table) { - $table->integer('organization_id')->unsigned(); + $table->integer('organization_id')->unsigned()->nullable(); $table->foreign('organization_id') ->references('id')->on('organizations') From 1cc12ce8416f079b594c17d5973dad4ddf062716 Mon Sep 17 00:00:00 2001 From: Chingaipe Date: Thu, 7 Feb 2019 22:42:53 +0200 Subject: [PATCH 09/11] added more feilds to the organizations table and organization creation form is working --- client/src/app/app.module.ts | 5 +- .../book-form/book-form.component.html | 73 +++++++++++-------- .../book-form/book-form.component.ts | 49 +++++++++++++ .../calendar/calendar.component.html | 2 +- .../sidemenu/sidemenu.component.html | 4 +- .../src/app/services/auth-service.service.ts | 4 +- .../app/services/booking-service.service.ts | 8 +- .../src/app/services/event-service.service.ts | 5 +- .../app/services/organisation.service.spec.ts | 15 ++++ .../src/app/services/organisation.service.ts | 54 ++++++++++++++ client/src/app/services/rooms.service.ts | 4 +- .../Controllers/OrganizationController.php | 3 + server/app/Organization.php | 5 +- ...2_02_141944_create_organizations_table.php | 3 + 14 files changed, 187 insertions(+), 47 deletions(-) create mode 100644 client/src/app/services/organisation.service.spec.ts create mode 100644 client/src/app/services/organisation.service.ts diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index e3e8fb2..ea3b2a5 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -21,6 +21,7 @@ import { BookFormComponent } from './components/book-form/book-form.component'; import { EventServiceService } from './services/event-service.service'; import { BookingServiceService } from './services/booking-service.service'; +import { OrganisationService } from './services/organisation.service'; import { EditBookingComponent } from './components/edit-booking/edit-booking.component'; import { ViewDetailsComponent } from './components/view-details/view-details.component'; import { LoadingSpinnerComponent } from './components/loading-spinner/loading-spinner.component'; @@ -61,7 +62,8 @@ const appRoutes: Routes = [ { path: 'view-details/:id', component: ViewDetailsComponent, canActivate: [AuthGuard] }, { path: 'new-bookin/:evnt_id', component: AddBookinComponent, canActivate: [AuthGuard] }, { path: 'rooms', component: RoomsComponent, canActivate: [AuthGuard] }, - { path: 'register', component: SignupComponent } + { path: 'register', component: SignupComponent }, + { path: 'calendar', component: CalendarComponent } ] } ]; // ends routes @@ -103,6 +105,7 @@ const appRoutes: Routes = [ AuthServiceService, AuthGuard, RoomsService, + OrganisationService, { provide: HTTP_INTERCEPTORS, useClass: InterceptorService, diff --git a/client/src/app/components/book-form/book-form.component.html b/client/src/app/components/book-form/book-form.component.html index 2e194ae..4613958 100644 --- a/client/src/app/components/book-form/book-form.component.html +++ b/client/src/app/components/book-form/book-form.component.html @@ -5,8 +5,42 @@

Add a Booking

+ + + +
+

NB: Create an Organisation/Co-ordinator of an event that is being booked.
+ * + If the organisation was previously created, just select it when creating an event. +

+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+
- +
@@ -15,6 +49,13 @@

Add a Booking

+
+ + +
- - -
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
- -
-
-
diff --git a/client/src/app/components/book-form/book-form.component.ts b/client/src/app/components/book-form/book-form.component.ts index 1dfb05b..4ffa66a 100644 --- a/client/src/app/components/book-form/book-form.component.ts +++ b/client/src/app/components/book-form/book-form.component.ts @@ -4,6 +4,7 @@ import { EventServiceService } from './../../services/event-service.service'; import { Router } from '@angular/router'; import { FlashMessagesService } from 'ngx-flash-messages'; import { UtilsService } from '../../services/utils.service'; +import { OrganisationService } from './../../services/organisation.service'; @Component({ selector: 'app-book-form', @@ -15,12 +16,14 @@ export class BookFormComponent implements OnInit { @ViewChild('t') t; // selects the component eith the variale #t rooms: any; // store the rooms from the db event: any; // full object of created event + orgs: any; // full object of create organistation formattedDate: string; formattedTime: string; constructor( private bservice: BookingServiceService, private evntService: EventServiceService, + private orgService: OrganisationService, private flashMessagesService: FlashMessagesService, private utilService: UtilsService, private router: Router @@ -28,6 +31,8 @@ export class BookFormComponent implements OnInit { ngOnInit() { this.initRooms(); + + this.getOrgs(); } /** @@ -37,6 +42,50 @@ export class BookFormComponent implements OnInit { this.rooms = this.utilService.loadRooms(); } + /** + * Gets all organization from the DB + */ + getOrgs() { + // get orgs from db + this.orgService.getAllOrganizations().subscribe( + data => { + this.orgs = data['organization']; + }, + error => { console.error(error); } + ); + } + + /** + * Stores an organisation data + * @param org the organisation form data + */ + onOrgSubmit(org) { + const req = { + 'name': org.orgName, + 'email': org.email, + 'phone_number': org.phone, + 'description': org.description + }; + + this.orgService.storeOrg(req).subscribe( + data => { + // success message + if (data) { + this.flashMessagesService.show('Organisation created succussfully.', { + classes: ['alert', 'alert-success'], + timeout: 2500 + }); + } + + this.getOrgs(); + }, + error => { console.error(error); } // err handling (poor, I know) + ); + + this.t.select('Event'); // selects the event tab after posting + console.log(req); + } + /** * Stores the event data first and moves to next tab * @param evnt the event data from the form diff --git a/client/src/app/components/calendar/calendar.component.html b/client/src/app/components/calendar/calendar.component.html index 3c02ca3..d03aa68 100644 --- a/client/src/app/components/calendar/calendar.component.html +++ b/client/src/app/components/calendar/calendar.component.html @@ -10,7 +10,7 @@ Quick summary
Title: {{ modalData?.event.title }}
-
Start date: {{ modalData?.event.start | date:'mediumDAte'}}
+
Start date: {{ modalData?.event.start | date:'mediumDate'}}
End date: {{ modalData?.event.end | date:'mediumDate'}}
diff --git a/client/src/app/components/sidemenu/sidemenu.component.html b/client/src/app/components/sidemenu/sidemenu.component.html index ac77eed..eb0cd27 100644 --- a/client/src/app/components/sidemenu/sidemenu.component.html +++ b/client/src/app/components/sidemenu/sidemenu.component.html @@ -31,12 +31,12 @@
{{ getUsername() }}
Rooms/ Spaces - + +

*NB: If the organization is not on this list, please create in in the before moving on.

- + -
+
-
+
-

These are the bookings created under this event.

+

Bookings under {{evnt.name}}.

diff --git a/client/src/app/components/view-orgs/view-orgs.component.css b/client/src/app/components/view-orgs/view-orgs.component.css new file mode 100644 index 0000000..f4d245a --- /dev/null +++ b/client/src/app/components/view-orgs/view-orgs.component.css @@ -0,0 +1,16 @@ +.name { + color: #007bff; + font-weight: 500; +} + +.name:hover { + color: gray; + cursor: pointer; +} + +app-loading-spinner { + width: 150px; + position: absolute; + top: 50%; + left: 40%; +} diff --git a/client/src/app/components/view-orgs/view-orgs.component.html b/client/src/app/components/view-orgs/view-orgs.component.html new file mode 100644 index 0000000..f47538b --- /dev/null +++ b/client/src/app/components/view-orgs/view-orgs.component.html @@ -0,0 +1,111 @@ +
+

Organizations

+
+ +
Registered Organization
+
+ + + + + + + + + + + + + + + + + + + + + + +
#OrganizationContactsActions
{{i}} + {{ org.name }} + + + + + + + + + {{org.phone_number}} | {{org.email}} + + + | + + + + + + + + +
+ + + + + + + + +
diff --git a/client/src/app/components/view-orgs/view-orgs.component.spec.ts b/client/src/app/components/view-orgs/view-orgs.component.spec.ts new file mode 100644 index 0000000..29f0f05 --- /dev/null +++ b/client/src/app/components/view-orgs/view-orgs.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ViewOrgsComponent } from './view-orgs.component'; + +describe('ViewOrgsComponent', () => { + let component: ViewOrgsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewOrgsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewOrgsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/client/src/app/components/view-orgs/view-orgs.component.ts b/client/src/app/components/view-orgs/view-orgs.component.ts new file mode 100644 index 0000000..e521409 --- /dev/null +++ b/client/src/app/components/view-orgs/view-orgs.component.ts @@ -0,0 +1,136 @@ +import { Component, OnInit } from '@angular/core'; +import { OrganisationService } from '../../services/organisation.service'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { FlashMessagesService } from 'ngx-flash-messages'; + +@Component({ + selector: 'app-view-orgs', + templateUrl: './view-orgs.component.html', + styleUrls: ['./view-orgs.component.css'] +}) +export class ViewOrgsComponent implements OnInit { + + orgs: any; + showSpinner = true; + + // form variables + name: string; + email: string; + phone_number: number; + description: string; + + constructor( + private orgService: OrganisationService, + private modalService: NgbModal, + private flashmessages: FlashMessagesService + ) { } + + ngOnInit() { + this.getOrgs(); // gets the orgs on init + } + + getOrgs() { + this.orgService.getAllOrganizations().subscribe( + data => { + this.orgs = data['organization']; // store in variable + this.showSpinner = false; // disable load spinner + }, + error => { + // show success alert message + this.flashmessages.show('An error occurred, plpease refresh the page.', { + classes: ['alert', 'alert-warning'], + timeout: 3000 + }); + console.log(error); + } + ); + } + + /** + * Opens and displays the details modal + * @param details modal template of modal + */ + view(details) { + this.modalService.open(details).result.then((result) => { + console.log(result); + }); + } + + openEdit(content, org) { + this.modalService.open(content).result.then((result) => { + if (result !== undefined) { + this.updateOrg(org.id, result); + } else { + console.log('canceled'); + } + }); + + // initializing update form + this.name = org.name; + this.email = org.email; + this.phone_number = org.phone_number; + this.description = org.description; + } + + /** + * Opens and displays the delete modal + * @param content this is the template reference variable of the delete modal + */ + open(content) { + this.modalService.open(content).result.then((result) => { + // call delete method here + this.deleteOrg(result); + }); + } + + /** + * Updates the organization details in DB + * @param id of organization being update + * @param org data from the submitted form + */ + updateOrg(id, org) { + this.orgService.updateOrg(id, org).subscribe( + data => { + this.flashmessages.show('Organization Details have been successfully updated.', { + classes: ['alert', 'alert-success'], + timeout: 3000 + }); + + // TODO: find better implementation for updating UI on update + this.getOrgs(); // poorman's refresh + }, + err => { + this.flashmessages.show('An error occurred, please try again.', { + classes: ['alert', 'alert-warning'], + timeout: 3000 + }); + } + ); + } + + /** + * Deletes an organization from the system + * @param id of the organization to be deleted + */ + deleteOrg(id) { + this.orgService.deleteOrg(id).subscribe(data => { + if (data === null) { + // show success alert message + this.flashmessages.show('Organization record was successfully deleted', { + classes: ['alert', 'alert-success'], + timeout: 3000 + }); + // updates view + this.getOrgs(); + + } else { + // error message + this.flashmessages.show('Oops! Something went wrong, could not delete the record. Try again later.', { + classes: ['alert', 'alert-warning'], + timeout: 3000 + }); + } + }); + } + +} diff --git a/client/src/app/services/organisation.service.ts b/client/src/app/services/organisation.service.ts index 7a5858e..9a92d36 100644 --- a/client/src/app/services/organisation.service.ts +++ b/client/src/app/services/organisation.service.ts @@ -39,7 +39,7 @@ export class OrganisationService { * @param org_id orginzation id to be updated * @param data the updated input data */ - updateEvent(org_id, data) { + updateOrg(org_id, data) { return this.http.put(this.baseURL + org_id, data, {headers: this.contentHeaders}); } @@ -47,7 +47,7 @@ export class OrganisationService { * Deletes an organization * @param org_id the organization's id */ - deleteEvent(org_id) { + deleteOrg(org_id) { return this.http.delete(this.baseURL + org_id); } From 03d7c658ea717a8177fa3346e6b632eeb730d5d9 Mon Sep 17 00:00:00 2001 From: Chingaipe Date: Sun, 10 Feb 2019 19:00:53 +0200 Subject: [PATCH 11/11] Preparation for deployment. Solving issues #20 and #21 --- client/src/app/services/auth-service.service.ts | 4 ++-- client/src/app/services/booking-service.service.ts | 8 ++++---- client/src/app/services/event-service.service.ts | 4 ++-- client/src/app/services/organisation.service.ts | 4 ++-- client/src/app/services/rooms.service.ts | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/src/app/services/auth-service.service.ts b/client/src/app/services/auth-service.service.ts index a8246f6..78abcdc 100644 --- a/client/src/app/services/auth-service.service.ts +++ b/client/src/app/services/auth-service.service.ts @@ -6,8 +6,8 @@ import { tokenNotExpired } from 'angular2-jwt'; export class AuthServiceService { // server request variables - // baseUrl = 'https://agora-booking-system.herokuapp.com/api/auth'; - baseUrl = 'http://127.0.0.1:8000/api/auth'; + baseUrl = 'https://agora-booking-system.herokuapp.com/api/auth'; + // baseUrl = 'http://127.0.0.1:8000/api/auth'; contentHeaders = new HttpHeaders({ 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' // <- enables us to get validation messages from the API diff --git a/client/src/app/services/booking-service.service.ts b/client/src/app/services/booking-service.service.ts index d793c9f..6fde67f 100644 --- a/client/src/app/services/booking-service.service.ts +++ b/client/src/app/services/booking-service.service.ts @@ -6,8 +6,8 @@ import { AuthServiceService } from './auth-service.service'; export class BookingServiceService { // variables - // baseURL = 'https://agora-booking-system.herokuapp.com/api/bookings/'; - baseURL = 'http://127.0.0.1:8000/api/bookings/'; + baseURL = 'https://agora-booking-system.herokuapp.com/api/bookings/'; + // baseURL = 'http://127.0.0.1:8000/api/bookings/'; contentHeaders = new HttpHeaders({'Content-Type': 'application/json'}); constructor( @@ -18,8 +18,8 @@ export class BookingServiceService { // gets the rooms from the db // TODO: Cache rooms so we dont have to query the server all the time getRooms() { - return this.http.get('http://127.0.0.1:8000/api/rooms/all'); // for local - // return this.http.get('https://agora-booking-system.herokuapp.com/api/rooms/all'); // for production + // return this.http.get('http://127.0.0.1:8000/api/rooms/all'); // for local + return this.http.get('https://agora-booking-system.herokuapp.com/api/rooms/all'); // for production } /** diff --git a/client/src/app/services/event-service.service.ts b/client/src/app/services/event-service.service.ts index 8b05909..3e66a3e 100644 --- a/client/src/app/services/event-service.service.ts +++ b/client/src/app/services/event-service.service.ts @@ -4,8 +4,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; @Injectable() export class EventServiceService { - // baseURL = 'https://agora-booking-system.herokuapp.com/api/events/'; - baseURL = 'http://127.0.0.1:8000/api/events/'; + baseURL = 'https://agora-booking-system.herokuapp.com/api/events/'; + // baseURL = 'http://127.0.0.1:8000/api/events/'; contentHeaders = new HttpHeaders({'Content-Type': 'application/json'}); constructor( diff --git a/client/src/app/services/organisation.service.ts b/client/src/app/services/organisation.service.ts index 9a92d36..df53a6b 100644 --- a/client/src/app/services/organisation.service.ts +++ b/client/src/app/services/organisation.service.ts @@ -4,8 +4,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; @Injectable() export class OrganisationService { - // baseURL = 'https://agora-booking-system.herokuapp.com/api/organization/'; - baseURL = 'http://127.0.0.1:8000/api/organizations/'; + baseURL = 'https://agora-booking-system.herokuapp.com/api/organizations/'; + // baseURL = 'http://127.0.0.1:8000/api/organizations/'; contentHeaders = new HttpHeaders({'Content-Type': 'application/json'}); constructor( diff --git a/client/src/app/services/rooms.service.ts b/client/src/app/services/rooms.service.ts index ef72c64..b110f84 100644 --- a/client/src/app/services/rooms.service.ts +++ b/client/src/app/services/rooms.service.ts @@ -4,8 +4,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; @Injectable() export class RoomsService { - // baseURL = 'https://agora-booking-system.herokuapp.com/api/rooms/'; - baseURL = 'http://127.0.0.1:8000/api/rooms/'; + baseURL = 'https://agora-booking-system.herokuapp.com/api/rooms/'; + // baseURL = 'http://127.0.0.1:8000/api/rooms/'; contentHeaders = new HttpHeaders({'Content-Type': 'application/json'}); constructor(