import { Component, OnInit, ElementRef } from '@angular/core'; //import { NgxGalleryOptions, NgxGalleryImage, NgxGalleryAnimation } from 'ngx-gallery'; import { CfCoreComponent } from '../core/core.component'; import { CfButtonComponent } from '../button/button.component'; import { CfWeatherComponent } from '../weather/weather.component'; import { CfNewsComponent } from '../news/news.component'; import { CfWorldClockComponent } from '../world-clock/world-clock.component'; import { CfBpmListComponent } from '../bpm-list/bpm-list.component'; import { CfPassengersAlertComponent } from '../passengers-alert/passengers-alert.component'; //import { CfGalleryComponent } from '../gallery/gallery.component'; import { WeatherComponentModel } from '../../models/weather/weather-component.model'; import { NewsComponentModel } from '../../models/news-component.model'; import { BpmTaskListModel } from '../../models/bpm-task-list.model'; import { PageService } from '../../services/page-service/page.service'; import { ListModel } from '../../models/list/list.model'; import { ItemStylingModel } from '../../models/item/item-styling.model'; import { CfSendMessageEmailSettings, CfSendMessageModes, CfSendMessageSMSSettings, CfSendMessageSettings } from '../../models/send-message.model'; /** * This component refers to a Weather app. */ @Component({ selector: 'cf-page-1', template: "
", styles: [".cf-page-content-styles { background: grey URL(\"/assets/images/page_background.jpg\") no-repeat 0 0; background-size: 100% 100%; position: fixed; left: 0; top: 0; bottom: 0; right: 0; } .cf-page-content { left: 0; top: 75px; bottom: 75px; right: 0; position: absolute; } .cf-page-header { background: #03A9F4; color: #fff; position: fixed; left: 0; right: 0; top: 0; min-height: 50px; } .cf-page-header img { width: 113px; height: 34px; } .cf-page-footer { background: #03A9F4; color: #fff; position: fixed; left: 0; right: 0; bottom: 0; min-height: 50px; } .cf-page-footer span { padding-top: 14px; padding-left: 20px; padding-bottom: 15px; } .cf-page-header .cf-page-header-spacer { flex: 1 1 auto; } .cf-page-header a { color: #ffffff; } .buttonTreeBar { margin-right: 30px; background: #1E90FF; } .buttonSendMessage { background: #1E90FF; } .buttonAddComp { background: #1E90FF; } .buttonRemoveComp { background: #1E90FF; } /deep/ .normalItem { background-color: white; } /deep/ .selectedItem { background-color: lightgray; } "], entryComponents: [ CfButtonComponent, CfWeatherComponent, CfNewsComponent, CfWorldClockComponent, CfBpmListComponent, CfPassengersAlertComponent, //CfGalleryComponent, ] }) export class CfPage1 extends CfCoreComponent implements OnInit { // data for components to be used in page body weather = new WeatherComponentModel ({ defaultCity: 'Paris', showToolbar: true }); myList = new ListModel ({ title: 'List Component Demo' }); items: Object[] = []; itemsStyling: ItemStylingModel; passengersAlertAdded = false; pageGallery: Object; // Page Footer Functionality dynamicallyAddedComponents: any[] = []; componentsToAdd = [ 'CfPassengersAlertComponent', 'CfBpmListComponent', 'CfNewsComponent' ]; i = 0; constructor(public elementRef: ElementRef, public pageService: PageService) { super(elementRef); this.id = 'page1'; // have to set explicitly to get components form the storage } /** *

This method is called when initializing the component.

*/ ngOnInit() { super.ngOnInit(); // split up technical configuration settings and then 'user' settings (eg. toNumber vs authToken) const sendMessageSMSSettings: CfSendMessageSMSSettings = { toNumber: '+16318356587', fromNumber: '+16319047068', accountSid: 'ACb33c7f7db863dcc41d803f75d9758f98', authToken: 'c9ab414697e600b5cd34d61c6fafde7f', endpoint: 'http://localhost:8080/send_sms_message', }; const sendMessageEmailSettings: CfSendMessageEmailSettings = { toAddress: 'christophercarrick7@cedrusco.com', fromAddress: 'chris.carrick@cedrusco.com', endpoint: 'http://localhost:8080/send_email_message', smtpConfig: { host: 'smtp.gmail.com', port: 587, secure: false, auth: { user: 'chris.carrick@cedrusco.com', pass: 'leeesa7*' } } }; this.sendMessageSettings = { sms: sendMessageSMSSettings, email: sendMessageEmailSettings, }; this.pageService.loadComponents(this.id, this.dynamicallyAddedComponents); this.items = [ { name: 'Austin', city: 'London', avatar: 'http://wfarm2.dataknet.com/static/resources/icons/set3/c9f1cdf473a8.png' }, { name: 'Molly', city: 'Denver', avatar: 'http://findicons.com/files/icons/1072/face_avatars/300/fh04.png' }, { name: 'Peter', city: 'Tokyo', avatar: 'http://static.tumblr.com/c172fd03bf2bedb77e13107cb22cdcc1/3rxa3xq/asBo7l3wr/tumblr_static_6fbdkgohxjgoc4c8o8kwoso4k.png' } ]; this.itemsStyling = new ItemStylingModel({ item:{ class:"normalItem" }, selectedItem :{ class:"selectedItem" } }) this.pageGallery = { options: [ { imagePercent: 60, imageArrowsAutoHide: true, //imageAnimation: NgxGalleryAnimation.Zoom, thumbnailsPercent: 40, thumbnailsRows: 2, thumbnailMargin: 1, thumbnailsMargin: 1, thumbnailsArrowsAutoHide: true, previewFullscreen: true } ], images: [ { small: 'https://i1.wallpaperscraft.com/image/nature_waterfall_summer_lake_trees_90400_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/nature_waterfall_summer_lake_trees_90400_602x339.jpg', big: 'https://wallpaperscraft.com/image/nature_waterfall_summer_lake_trees_90400_1920x1080.jpg', description: 'nature_waterfall_summer_lake_trees' }, { small: 'https://i1.wallpaperscraft.com/image/summer_mountains_nature_lake_river_grass_93164_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/summer_mountains_nature_lake_river_grass_93164_602x339.jpg', big: 'https://wallpaperscraft.com/image/summer_mountains_nature_lake_river_grass_93164_1920x1080.jpg', description: 'summer_mountains_nature_lake_river_grass' }, { small: 'https://i1.wallpaperscraft.com/image/dawn_grass_sky_summer_light_87653_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/dawn_grass_sky_summer_light_87653_602x339.jpg', big: 'https://wallpaperscraft.com/image/dawn_grass_sky_summer_light_87653_1920x1080.jpg', description: 'dawn_grass_sky_summer_light' }, { small: 'https://i1.wallpaperscraft.com/image/sea_sand_palm_trees_surf_84649_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/sea_sand_palm_trees_surf_84649_602x339.jpg', big: 'https://wallpaperscraft.com/image/sea_sand_palm_trees_surf_84649_1920x1080.jpg', description: 'sea_sand_palm_trees_surf' }, { small: 'https://i1.wallpaperscraft.com/image/stones_tropical_ocean_sky_summer_92472_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/stones_tropical_ocean_sky_summer_92472_602x339.jpg', big: 'https://wallpaperscraft.com/image/stones_tropical_ocean_sky_summer_92472_1920x1080.jpg', description: 'stones_tropical_ocean_sky_summer' }, { small: 'https://i1.wallpaperscraft.com/image/mountains_nature_river_grass_beautiful_landscape_93282_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/mountains_nature_river_grass_beautiful_landscape_93282_602x339.jpg', big: 'https://wallpaperscraft.com/image/mountains_nature_river_grass_beautiful_landscape_93282_1920x1080.jpg', description: 'mountains_nature_river_grass_beautiful_landscape' }, { small: 'https://i1.wallpaperscraft.com/image/tree_sun_blue_lilac_krone_spring_flowering_from_below_light_53319_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/tree_sun_blue_lilac_krone_spring_flowering_from_below_light_53319_602x339.jpg', big: 'https://wallpaperscraft.com/image/tree_sun_blue_lilac_krone_spring_flowering_from_below_light_53319_1920x1080.jpg', description: 'tree_sun_blue_lilac_krone_spring_flowering_from_below_light' }, { small: 'https://i1.wallpaperscraft.com/image/lake_sunset_trees_landscape_beach_art_night_reflection_48159_300x168.jpg', medium: 'https://i1.wallpaperscraft.com/image/lake_sunset_trees_landscape_beach_art_night_reflection_48159_602x339.jpg', big: 'https://wallpaperscraft.com/image/lake_sunset_trees_landscape_beach_art_night_reflection_48159_1920x1080.jpg', description: 'lake_sunset_trees_landscape_beach_art_night_reflection' } ] } } sendMessageSettings: CfSendMessageSettings; sendMessageMode = CfSendMessageModes.SMS; setMessageType(type: string) { this.sendMessageMode = CfSendMessageModes[type]; } onSendMessage(response: any) { alert('Message Sent!'); } addComponent(): void { let componentToAdd = this.componentsToAdd[this.i]; if (componentToAdd === 'CfPassengersAlertComponent') { if (this.passengersAlertAdded) { } else { this.passengersAlertAdded = true; this.pageService.addComponent(componentToAdd, this.dynamicallyAddedComponents, this.id); } } else { this.pageService.addComponent(componentToAdd, this.dynamicallyAddedComponents, this.id); } this.i++; if (this.i === 3) { this.i = 0; } } removeComponent(): void { this.pageService.removeComponent(this.dynamicallyAddedComponents, this.id); } updateWeather() { this.weather.defaultCity = this.pageService.selectedCity; } }