This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="columns"> | |
<div class="column is-two-thirds"> | |
<h2 class="subtitle"><i class="fas fa-car"></i> Spots</h2> | |
<div> | |
<app-spotlist [spots] = "spots"></app-spotlist> | |
</div> | |
</div> | |
<div class="column"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"ng": "ng", | |
"start": "echo START && npm install && node server.js", | |
"build": "NODE_ENV=production && ng build --aot --prod && ", | |
"preinstall": "echo PREINSTALL", | |
"postinstall": "HOME=/ ./node_modules/@angular/cli/bin/ng build --prod --aot" | |
}, | |
"engines": { | |
"node": "9.4.0", | |
"npm": "5.6.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server.js | |
const express = require('express'); | |
const app = express(); | |
// Run the app by serving the static files | |
// in the dist directory | |
app.use(express.static(__dirname + '/dist')); | |
// Start the app by listening on the default | |
// Heroku port | |
app.listen(process.env.PORT || 5000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
canBeDeleted():boolean{ | |
return this.selectedSpot.cleanings.length == 0 && | |
this.selectedSpot.maintenances.length == 0 && | |
this.selectedSpot.payments.length == 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
removeSpot(spot: Spot) { | |
return this.removeEntity(spot).map((response: Response) => response.json()); | |
} | |
removeEvent(event: SpotEvent) { | |
return this.removeEntity(event).map((response: Response) => response.json()); | |
} | |
removeEntity(entity: Entity) { | |
let apiEndPoint = this.settings.ApiEndPoint + "objects/" + entity.slug; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saveSpot(spot: Spot): Observable<any> { | |
let apiEndPoint = this.settings.ApiEndPoint + "add-object"; | |
let payload = { | |
"write_key": this.settings.ApiWriteKey, | |
"title": spot.title, | |
"type_slug": "spots", | |
"content": spot.content, | |
"metafields": [ | |
{ | |
"key": "type", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button class="button is-danger" *ngIf="canBeDeleted(); else deleteWarning" (click)="remove(selectedSpot)">Delete</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tbody> | |
<tr *ngFor="let spot of spots"> | |
<td class="has-text-grey">{{ spot.floor }}</td> | |
<td><a routerLink="/spots/{{ spot.slug }}">{{ spot.title }}</a></td> | |
<td>{{ spot.type }}</td> | |
<td class="has-text-right">{{ spot.payments.length }}</td> | |
<td class="has-text-right">{{ spot.maintenances.length }}</td> | |
<td class="has-text-right">{{ spot.cleanings.length }}</td> | |
<td> | |
<a class="button is-primary is-small" routerLink="/spots/{{ spot.slug }}/addevent" title="Add event"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getSpotData(): Observable<any> { | |
let apiEndPoint = this.settings.ApiEndPoint + "object-type/spots" + "?read_key=" + this.settings.ApiReadKey; | |
return this.http.get(apiEndPoint).map((response: Response) => response.json().objects); | |
} | |
getSpotEvents(): Observable<any> { | |
let apiEndPoint = this.settings.ApiEndPoint + "object-type/spotevents" + "?read_key=" + this.settings.ApiReadKey; | |
return this.http.get(apiEndPoint).map((response: Response) => response.json().objects); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="section"> | |
<div class="container"> | |
<router-outlet></router-outlet> | |
</div> | |
</section> |
NewerOlder