Triforcia.github.io

image

TRIFORCIA CRUISE TRAVEL AGENCY APP PROJECT

1. General:

2. Company Information:

3. Requirements:

4. Solutions:

5. Attachments:

Attachment 1:

(Back to Solutions)

image

image

image

image

image

image

image

image

Attachment 2:

(Back to Solutions)

image

image

image

image

image

Ship Map

<apex:page showHeader="false">
  <apex:iframe src="https://www.cruisemapper.com/"/>
</apex:page>

Hospital Map

<apex:page >
  <apex:iframe src="https://maps.google.com/maps?q=Florida%20hospitals&t=&z=7&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="true" id="theIframe"/>
</apex:page>

Weather Map

HTML
<template>
  <lightning-card title={getCityName}>
      <lightning-layout>
          <lightning-layout-item size="6" medium-device-size="4" padding="around-small">
              <lightning-combobox name="cities"
                  label="Cities"
                  value={value}
                  placeholder="--Select--"
                  options={options}
                  onchange={handleChange} >
              </lightning-combobox>
          </lightning-layout-item>
      </lightning-layout>
      <lightning-layout>
              <lightning-layout-item size="3" medium-device-size="4" padding="around-small">
                  <lightning-card icon-name="standard:topic" title="Current Temperature">
                      <div class="slds-align_absolute-center color-blue">
                          <template if:true={result}>
                              {getConvertedTemp}
                          </template>
                      </div>
                  </lightning-card>
              </lightning-layout-item>
              <lightning-layout-item size="3" medium-device-size="4" padding="around-small">
                  <lightning-card icon-name="utility:flow" title="Current Wind Speed">
                      <div class="slds-align_absolute-center color-grey">
                          <template if:true={result}>
                              {getCurrentWindSpeed}
                          </template>
                      </div>
                  </lightning-card>
              </lightning-layout-item>
              <lightning-layout-item size="3" medium-device-size="4" padding="around-small">
                  <lightning-card icon-name="standard:calibration" title="Precipitation">
                      <div class="slds-align_absolute-center color-green">
                          <template if:true={result}>
                              {getCurrentPrecip}
                          </template>
                      </div>
                  </lightning-card>
              </lightning-layout-item>
          </lightning-layout>
      <lightning-map
          map-markers={mapMarkers}
          zoom-level={zoomLevel}>
      </lightning-map>
  </lightning-card>
</template>
CSS
.color-blue {
  background-color: #08a7da;
  height: 100px;
  color: white;
  font-family: Tahoma;
  font-size: 30px;
  font-weight: 500;
  border-radius: 25px;
}
 
.color-grey {
  background-color: rgb(11, 236, 74);
  height: 100px;
  color: white;
  font-family: Tahoma;
  font-size: 30px;
  font-weight: 500;
  border-radius: 25px;
}
 
.color-green {
  background-color:red;
  height: 100px;
  color: white;
  font-family: Tahoma;
  font-size: 30px;
  font-weight: 500;
  border-radius: 25px;
}
JS
import { LightningElement } from 'lwc';
import performCallout from '@salesforce/apex/WebServiceLWC.performCallout';

export default class WeatherLWC extends LightningElement {

lat;
long;

mapMarkers = [];
zoomLevel = 10;
result;
value;

connectedCallback() {
    performCallout({location: 'Norfolk,VA'}).then(data => {
        this.mapMarkers = [{
            location: {
                Latitude: data['cityLat'],
                Longitude: data['cityLong']
            },
            title: data['cityName'] + ', ' + data['state'],
        }];
        this.result = data;
    }).catch(err => console.log(err));

}

get getCityName() {
    if (this.result) {
        return this.result.cityName + ' Information';
    } else {
        return '---'
    }
}

get getConvertedTemp() {
    if (this.result) {
        return Math.round((this.result.cityTemp * (9/5)) + 32) + ' deg';
    } else {
        return '--'
    }
}

get getCurrentWindSpeed() {
    if (this.result) {
        return this.result.cityWindSpeed + ' mph';
    } else {
        return '--'
    }
}

get getCurrentPrecip() {
    if (this.result) {
        return this.result.cityPrecip + " in"
    } else {
        return '--'
    }
}

get options() {
    return [
        { label: 'Arvada, CO', value: 'Arvada,CO' },
        { label: 'Austin, TX', value: 'Austin,TX' },
        { label: 'Sacramento, CA', value: 'Sacramento,CA' },
        { label: 'Raleigh, NC', value: 'Raleigh,NC' },
        { label: 'Chesapeake, VA', value: 'Chesapeake,VA' }
    ];
}

handleChange(event) {
    this.value = event.detail.value;
    performCallout({location: this.value}).then(data => {
        this.mapMarkers = [{
            location: {
                Latitude: data['cityLat'],
                Longitude: data['cityLong']
            },
            title: data['cityName'] + ', ' + data['state'],
        }];
        this.result = data;
    }).catch(err => console.log(err));
}   }
META XML
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>55.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordPage</target>
    </targets>
</LightningComponentBundle>

Attachment 3:

(Back to Solutions)

image

Attachment 4:

(Back to Solutions)

image

Attachment 5:

(Back to Solutions)

Family and Company Record Types for Guest (Account) Object

image

image

Family and Company Record Types for Lead Object

image

image

Ship Owner and Passenger Record Types for Contract Object

image

image

Cruise, Gulet and Yacth Record Types for Ship Object

image

image

Attachment 6:

(Back to Solutions)

Family and Company Custom Layouts for Guest (Account) Object

image

Family and Company Custom Layouts for Lead Object

image

Ship Owner and Passenger Custom Layouts for Contract Object

image

Cruise, Gulet and Yacth Custom Layouts for Ship Object

image

Attachment 7:

(Back to Solutions)

Commision Formula Field on Deal Object

image

Attachment 8:

(Back to Solutions)

Custom Picklists on Lead Object

image

Custom Picklists on Cabin Object

image

Attachment 9:

(Back to Solutions)

image

Attachment 10:

(Back to Solutions)

image

Campaigns with Leads Report

image

Expenses with Opportunity Report

image

Incomes with Opportunity Report

image

New Guest Custom Report Report

image

New Members & Guests Report

image

Joined Reports

image

Attachment 11:

(Back to Solutions)

image

image

image

image

image

image

Attachment 12:

(Back to Solutions)

image

Attachment 13:

(Back to Solutions)

image

image

Attachment 14:

(Back to Solutions)

image

image

image

image

Attachment 15:

(Back to Solutions)

image

image

image

Attachment 16:

(Back to Solutions)

image

Attachment 17:

(Back to Solutions)

API Connection of Weather LWC Component on Emergency Page

global class WebServiceLWC {
    @AuraEnabled(cacheable=true)
    global static WeatherData performCallout(String location) {

        Http http = new Http();

        HttpRequest req = new HttpRequest();
        req.setEndpoint('callout:WeatherAPI?city=' + location + '&key=96ef390b59d74ccca1145468858df082');
        req.setMethod('GET');


        HttpResponse res = new HttpResponse();
        res = http.send(req);
        JSONParser parser = JSON.createParser(res.getBody());


        WeatherData weather = new WeatherData();

        while (parser.nextToken() != null) {
            parser.nextValue();
            if (parser.getCurrentName() == 'temp') {
                weather.cityTemp = Decimal.valueOf(parser.getText());
            }else if(parser.getCurrentName() == 'city_name'){
                weather.cityName = parser.getText();
            }else if(parser.getCurrentName() == 'state_code'){
                weather.state = parser.getText();
            }else if(parser.getCurrentName() == 'timezone'){
                weather.cityTimeZone = parser.getText();
            }else if(parser.getCurrentName() == 'wind_spd'){
                weather.cityWindSpeed = Decimal.valueOf(parser.getText());
            }else if(parser.getCurrentName() == 'lat'){
                weather.cityLat = parser.getText();
            }else if(parser.getCurrentName() == 'lon'){
                weather.cityLong = parser.getText();
            }else if(parser.getCurrentName() == 'precip'){
                weather.cityPrecip = Decimal.valueOf(parser.getText());
            }
        }
        return weather;
    }
    global class WeatherData {
        @AuraEnabled public String cityName;
        @AuraEnabled public String cityTimeZone;
        @AuraEnabled public Decimal cityTemp;
        @AuraEnabled public String state;
        @AuraEnabled public Decimal cityWindSpeed;
        @AuraEnabled public String cityLat;
        @AuraEnabled public String cityLong;
        @AuraEnabled public Decimal cityPrecip;
    }
}

Attachment 18:

(Back to Solutions)

trigger taskTrigger on Task (before insert){        
      for(Task t : Trigger.New){
          if(t.Subject == 'Emergency'){
             t.Priority = 'High';

             Set<String> recipinetsIds = new Set<String>();
             recipinetsIds.add('005IY000000LSUVYA4');

             CustomNotificationFromApex.notifyUsers(recipinetsIds, '000000000000000AAA');

          }

    }

}

Attachment 19:

(Back to Solutions)

Emergency Task Manager Notification Trigger Apex Helper Class

public class CustomNotificationFromApex {
    public static void notifyUsers(Set<String> recipientsIds, String targetId){

        CustomNotificationType notificationType = [SELECT Id, DeveloperName FROM CustomNotificationType WHERE DeveloperName = 'Emergency_Notification'];


        Messaging.CustomNotification notification = new Messaging.CustomNotification();
        notification.setTitle('Emergency Notification');
        notification.setBody('An Emergency Task has been raised!');
        notification.setNotificationTypeId(notificationType.Id);
        notification.setTargetId(targetId);

        notification.send(recipientsIds);

    }
}

Attachment 20:

(Back to Solutions)

trigger cabinUpdateTrigger on OpportunityLineItem (after insert, after update) {

    List<cabin__c> newCabinList = new List<cabin__c>();

    for(OpportunityLineItem oppLine : Trigger.New){
        if(oppLine.Cabin__c != null){

            Cabin__c cabin = [SELECT Id, Occupied__c FROM Cabin__c WHERE Id =: oppLine.Cabin__c];
            cabin.Occupied__c = true;
            newCabinList.add(cabin);
        }
    }
    update newCabinList; 
}

Attachment 21:

(Back to Solutions)

image

image

Attachment 22:

(Back to Solutions)

image

image

Attachment 23:

(Back to Solutions)

image