0

Scripting

Globale Funktionen

Im Bereich der globalen Funktionen sind diverse Skripte enthalten, die unter anderem eine effiziente Datenverwaltung und ansprechende Visualisierung ermöglichen.

employeeModule()

Diese Funktion dient dazu, Mitarbeiterinformationen aus der Datenbank abzurufen, die auf dem aktuell angemeldeten Benutzer basieren. Sie verwendet eine Cache-Struktur, um die Effizienz bei wiederholten Abfragen zu erhöhen.

function employeeModule() do
    cached(do as database '02 - Mitarbeiter(1)'
            first(select Mitarbeiter where user() = Nutzer)
        end)
end;

NXmetricWidget()

Diese Funktion erstellt ein Metriken-Widget für die Benutzeroberfläche. Sie akzeptiert verschiedene Parameter wie Titel, Metrik, Vergleichswerte und Beschreibungen, um ein anpassbares Widget zu erzeugen. Der Code innerhalb der Funktion definiert das Aussehen und Verhalten des Widgets, einschließlich der Interaktionsmöglichkeiten und der visuellen Stile, abhängig von den übergebenen Parametern.

function NXmetricWidget(title : text,metric : text,metricStyle : text,comparisonValueIcon : text,comparisonValue : text,comparisonValueStyle : text,description : text,widgetInteraction : text) do
    let interactionClass := "";
    switch widgetInteraction do
    case "interactive":
        (interactionClass := "NXmetricWidgetV2_interactive")
    default:
        (interactionClass := "NXmetricWidgetV2_readonly")
    end;
    let comparisonValueIconCode := "";
    switch comparisonValueIcon do
    case "increase":
        (comparisonValueIconCode := "↑")
    case "warning":
        (comparisonValueIconCode := "⚠")
    case "decrease":
        (comparisonValueIconCode := "↓")
    case "indeterminate":
        (comparisonValueIconCode := "↕")
    default:
        (comparisonValueIconCode := "")
    end;
    let metricStyleClass := "";
    switch metricStyle do
    case "positive":
        (metricStyleClass := "NXmetricWidgetV2_positive")
    case "warning":
        (metricStyleClass := "NXmetricWidgetV2_warning")
    case "negative":
        (metricStyleClass := "NXmetricWidgetV2_negative")
    default:
        (metricStyleClass := "")
    end;
    let comparisonValueStyleClass := "";
    switch comparisonValueStyle do
    case "positive":
        (comparisonValueStyleClass := "NXmetricWidgetV2_positive")
    case "warning":
        (comparisonValueStyleClass := "NXmetricWidgetV2_warning")
    case "negative":
        (comparisonValueStyleClass := "NXmetricWidgetV2_negative")
    default:
        (comparisonValueStyleClass := "")
    end;
    let htmlCode := "
        <div class='NXmetricWidgetV2 " +
        interactionClass +
        "'>
            <p title=" +
        title +
        " class='NXmetricWidgetV2_metric-title'>" +
        title +
        "</p>
            <p title=" +
        metric +
        " class='NXmetricWidgetV2_metric-value " +
        metricStyleClass +
        "'>" +
        metric +
        "</p>
    <p class='NXmetricWidgetV2_metric-details'><span title='" +
        comparisonValue +
        "' class='NXmetricWidgetV2_metric-comparisonValue " +
        comparisonValueStyleClass +
        "'>" +
        comparisonValueIconCode +
        " " +
        comparisonValue +
        "</span>&nbsp;<span title=" +
        description +
        " class='NXmetricWidgetV2_metric-description'>" +
        description +
        "</span></p>
        </div>
    <style>
        .NXmetricWidgetV2 {
            background-color: #fff;
            border-radius: 4px;
            padding: 16px;
            box-sizing: border-box;
            text-align: left;
        }
        .NXmetricWidgetV2_interactive {
            filter: drop-shadow(0px 2px 5px rgba(26, 36, 69, 0.15));
            cursor: pointer;
        }
        .NXmetricWidgetV2_readonly {
            border: 1px solid #EAECF3;
        }
        .NXmetricWidgetV2_metric-title {
            font-size: 20px;
            font-weight: 500;
            color: #9297A6 !important;
            margin-bottom: 6px !important;
            text-align: left;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .NXmetricWidgetV2_metric-value {
            font-size: 32px;
            line-height: 44px;
            color: #283050 !important;
            font-weight: bold;
            text-align: left;
            margin-bottom: 6px !important;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .NXmetricWidgetV2_metric-details {
            font-size: 16px;
            color: #9297A6 !important;
            text-align: left;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            margin-bottom: 0 !important;
        }
        .NXmetricWidgetV2_metric-comparisonValue {
            font-weight: bold;
            color: #283050;
        }

  .NXmetricWidgetV2_positive {
    color: rgb(76, 175, 80) !important;
  }

  .NXmetricWidgetV2_warning {
    color: #FF9619 !important;
  }

  .NXmetricWidgetV2_negative {
    color: #F25B3A !important;
  }
    </style>";
    html(htmlCode)
end;

NXmetricWidgetWithProgressBar()

Eine Erweiterung des einfachen Metriken-Widgets, die zusätzlich einen Fortschrittsbalken enthält. Diese Funktion ermöglicht es, den Fortschritt eines bestimmten Prozesses oder Ziels visuell darzustellen. Zusätzliche Parameter für den Fortschrittsbalken, wie Label und Prozentsatz, werden verwendet, um den Balken entsprechend zu konfigurieren.

function NXmetricWidgetWithProgressBar(title : text,metric : text,metricStyle : text,comparisonValueIcon : text,comparisonValue : text,comparisonValueStyle : text,description : text,progressBarLabel_left : text,progressBarLabel_right : text,percentage : number,progressBarStyle : text,progressBarAnimation : text) do
    let comparisonValueIconCode := "";
    switch comparisonValueIcon do
    case "increase":
        (comparisonValueIconCode := "&uarr;")
    case "warning":
        (comparisonValueIconCode := "&#x26A0;")
    case "decrease":
        (comparisonValueIconCode := "&darr;")
    case "indeterminate":
        (comparisonValueIconCode := "&#8597;")
    default:
        (comparisonValueIconCode := "")
    end;
    let metricStyleClass := "";
    switch metricStyle do
    case "positive":
        (metricStyleClass := "NXmetricWidget_positive")
    case "warning":
        (metricStyleClass := "NXmetricWidget_warning")
    case "negative":
        (metricStyleClass := "NXmetricWidget_negative")
    default:
        (metricStyleClass := "")
    end;
    let comparisonValueStyleClass := "";
    switch comparisonValueStyle do
    case "positive":
        (comparisonValueStyleClass := "NXmetricWidget_positive")
    case "warning":
        (comparisonValueStyleClass := "NXmetricWidget_warning")
    case "negative":
        (comparisonValueStyleClass := "NXmetricWidget_negative")
    default:
        (comparisonValueStyleClass := "")
    end;
    let NX_ProgressBar_AnimationClass := "";
    switch progressBarAnimation do
    case "animated":
        (NX_ProgressBar_AnimationClass := "NX_ProgressBar_progress-bar_animation_animated")
    case "loading":
        (NX_ProgressBar_AnimationClass := "NX_ProgressBar_progress-bar_animation_loading")
    default:
        (NX_ProgressBar_AnimationClass := "")
    end;
    let NX_ProgressBar_LoadingClass := "";
    let styleClass := "NX_ProgressBar_default";
    switch progressBarStyle do
    case "primaryblue":
        (styleClass := "NX_ProgressBar_primaryblue")
    case "green":
        (styleClass := "NX_ProgressBar_green")
    case "orange":
        (styleClass := "NX_ProgressBar_orange")
    case "red":
        (styleClass := "NX_ProgressBar_red")
    case "lightblue":
        (styleClass := "NX_ProgressBar_lightblue")
    case "violet":
        (styleClass := "NX_ProgressBar_violet")
    case "blue":
        (styleClass := "NX_ProgressBar_blue")
    case "darkblue":
        (styleClass := "NX_ProgressBar_darkblue")
    case "skylineserenity":
        (styleClass := "NX_ProgressBar_skylineserenity")
    case "purpledusk":
        (styleClass := "NX_ProgressBar_purpledusk")
    case "fierysunset":
        (styleClass := "NX_ProgressBar_fierysunset")
    case "aquafusion":
        (styleClass := "NX_ProgressBar_aquafusion")
    case "lavenderhaze":
        (styleClass := "NX_ProgressBar_lavenderhaze")
    case "seabreeze":
        (styleClass := "NX_ProgressBar_seabreeze")
    case "bluehorizon":
        (styleClass := "NX_ProgressBar_bluehorizon")
    case "serenewave":
        (styleClass := "NX_ProgressBar_serenewave")
    case "sunsetblaze":
        (styleClass := "NX_ProgressBar_sunsetblaze")
    case "oceanictwilight":
        (styleClass := "NX_ProgressBar_oceanictwilight")
    default:
        (styleClass := "NX_ProgressBar_default")
    end;
    let htmlCode := "
        <div class='NXmetricWidget'>
            <p title=" +
        title +
        " class='NXmetricWidget_metric-title'>" +
        title +
        "</p>
            <p title=" +
        metric +
        " class='NXmetricWidget_metric-value " +
        metricStyleClass +
        "'>" +
        metric +
        "</p>
    <p class='NXmetricWidget_metric-details'><span title='" +
        comparisonValue +
        "' class='NXmetricWidget_metric-comparisonValue " +
        comparisonValueStyleClass +
        "'>" +
        comparisonValueIconCode +
        " " +
        comparisonValue +
        "</span>&nbsp;<span title=" +
        description +
        " class='NXmetricWidget_metric-description'>" +
        description +
        "</span></p>
    <div class='NX_ProgressBar_Label_Left'>" +
        progressBarLabel_left +
        "</div>
<div class='NX_ProgressBar_Label_Right'>" +
        progressBarLabel_right +
        "</div>
    <div class='NX_ProgressBar_progress'>
    <div class='NX_ProgressBar_progress-bar " +
        styleClass +
        " " +
        NX_ProgressBar_AnimationClass +
        "' role='progressbar' aria-valuenow='" +
        percentage +
        "' aria-valuemin='0' aria-valuemax='100' style='width:" +
        percentage +
        "%;'>
    </div>
  </div>
        </div>
    <style>
        .NXmetricWidget {
            background-color: #fff;
            border-radius: 4px;
            padding: 16px;
            box-sizing: border-box;
            text-align: left;
            filter: drop-shadow(0px 2px 5px rgba(26, 36, 69, 0.15));
            cursor: pointer;
        }
        .NXmetricWidget_metric-title {
            font-size: 20px;
            font-weight: 500;
            color: #9297A6 !important;
            margin-bottom: 0px !important;
            text-align: left;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .NXmetricWidget_metric-value {
            font-size: 32px;
            line-height: 44px;
            color: #283050 !important;
            font-weight: bold;
            text-align: left;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .NXmetricWidget_metric-details {
            font-size: 16px;
            color: #9297A6 !important;
            text-align: left;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            margin-bottom: 8px !important;
        }
        .NXmetricWidget_metric-comparisonValue {
            font-weight: bold;
            color: #283050;
        }

  .NXmetricWidget_positive {
    color: rgb(76, 175, 80) !important;
  }

  .NXmetricWidget_warning {
    color: #FF9619 !important;
  }

  .NXmetricWidget_negative {
    color: #F25B3A !important;
  }
    .NX_ProgressBar_container{
  width:100%;
  display:block;
  margin:0;
    padding: 0;
    box-sizing: border-box;
    clear: both;
}
.NX_ProgressBar_progress {
  overflow: hidden;
  height: 16px;
  background: #EAECF3;
  border-radius: 50px;
  margin-bottom: 4px;
  text-align: center;
    clear: both;
}
.NX_ProgressBar_progress-bar {
  width: " +
        percentage +
        "%;
  height: 16px;
  linear-gradient(90deg, #4970FF 0%, #4970FF 100%);
  border-radius: 50px;
}

.NX_ProgressBar_progress-bar_animation_animated {
    animation: NX_ProgressBar_Animation_AnimateWidth 2s ease-in-out;
}

.NX_ProgressBar_progress-bar_animation_loading {
    animation: NX_ProgressBar_Animation_Loading 2s ease-in-out infinite;
}

@keyframes NX_ProgressBar_Animation_AnimateWidth {
  0% {
    width: 0;
  }
}
@keyframes NX_ProgressBar_Animation_Loading {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}


.NX_ProgressBar_Label_Left {
  font-family: NotoSans, sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  color: #9297A6 !important;

  float: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
    margin-bottom: 4px;
}
.NX_ProgressBar_Label_Right {
  font-family: NotoSans, sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  color: #9297A6 !important;
  float: right;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
        margin-bottom: 4px;
}
.NX_ProgressBar_primaryblue, .NX_ProgressBar_default {
  background: linear-gradient(90deg, #4970FF 0%, #4970FF 100%);
}
.NX_ProgressBar_green {
  background: linear-gradient(90deg, #52C2CC 0%, #52C2CC 100%);
}
.NX_ProgressBar_orange {
  background: linear-gradient(90deg, #FFB450 0%, #FFB450 100%);
}
.NX_ProgressBar_red {
  background: linear-gradient(90deg, #FF7F66 0%, #FF7F66 100%);
}
.NX_ProgressBar_lightblue {
  background: linear-gradient(90deg, #64C1FA 0%, #64C1FA 100%);
}
.NX_ProgressBar_violet {
  background: linear-gradient(90deg, #9485F2 0%, #9485F2 100%);
}
.NX_ProgressBar_blue {
  background: linear-gradient(90deg, #6691FF 0%, #6691FF 100%);
}
.NX_ProgressBar_darkblue {
  background: linear-gradient(90deg, #283050 0%, #283050 100%);
}
.NX_ProgressBar_skylineserenity {
  background: linear-gradient(90deg, #9485F2 0%, #64C1FA 100%);
}
.NX_ProgressBar_purpledusk {
  background: linear-gradient(90deg, #9485F2 0%, #FF7F66 100%);
}
.NX_ProgressBar_fierysunset {
  background: linear-gradient(90deg, #FFB450 0%, #FF7F66 100%);
}
.NX_ProgressBar_aquafusion {
  background: linear-gradient(90deg, #4970FF 0%, #52C2CC 100%);
}
.NX_ProgressBar_lavenderhaze {
  background: linear-gradient(90deg, #9485F2 0%, #52C2CC 100%);
}
.NX_ProgressBar_seabreeze {
  background: linear-gradient(90deg, #52C2CC 0%, #64C1FA 100%);
}
.NX_ProgressBar_bluehorizon {
  background: linear-gradient(90deg, #4970FF 0%, #64C1FA 100%);
}
.NX_ProgressBar_serenewave {
  background: linear-gradient(90deg, #4970FF 0%, #64C1FA 49.48%, #52C2CC 100%);
}
.NX_ProgressBar_sunsetblaze {
  background: linear-gradient(90deg, #52C2CC 0%, #FFB450 51.56%, #FF7F66 100%);
}
.NX_ProgressBar_oceanictwilight {
  background: linear-gradient(90deg, #283050 0%, #4970FF 49.48%, #64C1FA 100%);
}
    </style>";
    html(htmlCode)
end;

lostDialog()

Diese Funktion zeigt ein Dialogfenster für verlorene Opportunities an. Es ermöglicht dem Benutzer, Gründe für den Verlust einzugeben und diese Informationen zusammen mit einem optionalen Kommentar in der Datenbank zu speichern. Diese Interaktion ist für das Kundenbeziehungsmanagement wichtig, um Daten über verlorene Verkaufschancen zu sammeln und auszuwerten.

function lostDialog(me : Opportunities) do
    let script := ---
<script>
        var selectedRow = null;
        function rowClick(event) { "{" }
            var row = event.currentTarget;
            if (selectedRow !== null) { "{" }
                selectedRow.classList.remove("clicked");
            }
            if (selectedRow === row) { "{" }
                selectedRow = null;
            } else { "{" }
                row.classList.add("clicked");
                selectedRow = row;
              var id = row.dataset.id;
            writeToNinoxNumberField(id);
        }
    }
    function writeToNinoxTextField(value) { "{" }

        database.update("{ raw(me) }", "Y4", value);
    }
        function writeToNinoxNumberField(id) { "{" }
        database.update("{ raw(me) }", "H5", id);
    }
</script>
        ---;
    let style := " <style>
    table {border-collapse: collapse; width: 100%;}
    th, td {border: 0 ;padding: 8px;text-align: left;transition: background-color 0.3s ease;}
    tr:nth-child(odd) {background-color: #eff1f9;}
    tr:nth-child(even) {background-color: #ffffff;}
    tr:hover {background-color: #BFCFFF;}
    tr.clicked {background-color: #7F9FFF;}
    input[type=text] { width: 100%; padding: 12px 20px; margin: 8px 0; box-sizing: border-box;}
    </style>";
    let myArr := (select 'Verlustgründe').{
            id: number(Id),
            option: Verlustgrund
        };
    let myTable := "<table>" +
        join(for i in myArr do
            ---
    <tr onclick="rowClick(event)" data-id="{ i.id }">
            <td>{ i.option }</td>
        </tr>
            ---
        end, "
    ") +
        ---
</table><br><input type="text" id="myInput" placeholder="Kommentar eingeben" onblur="writeToNinoxTextField(this.value)">
        ---;
    let myChoice := ["Bestätigen", "Abbrechen"];
    let myD := dialog("Verlustgründe", html(script + style + myTable), myChoice);
    if myD = first(myChoice) then
        me.(Abschlussstatus := 2);
        let empl := employeeModule();
        me.(lostCommentVisible := false);
        let newHistory := (create History);
        newHistory.(
            Opportunities := me;
            Mitarbeiter := empl;
            'Aktivität' := "Deal verloren (" + me.'Verlustgründe'.Verlustgrund + ")"
        );
        let newNote := (create Notizen);
        newNote.(
            Opportunities := me;
            Mitarbeiter := empl;
            Datum := today();
            Uhrzeit := time(now());
            Notiz := "ich habe den Status auf Verloren gesetzt.
Grund: " +
                me.'Verlustgründe'.Verlustgrund +
                if me.Kommentar then
                    "
Kommentar: " +
                    me.Kommentar
                end
        );
        alert("Der Abschlussstatus wurde erfolgreich in ""Verloren"" geändert")
    else
        me.('Verlustgründe' := 0);
        me.(Kommentar := null)
    end
end;

icons()

Eine einfache Funktion, die spezifische SVG-Icons zurückgibt. Diese Icons können in verschiedenen Teilen der Anwendung wiederverwendet werden, um eine konsistente visuelle Sprache zu gewährleisten.

function icons() do
    {
        ninoxIcon: ---
<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.37469 0H7.5C11.3661 0 14.5 3.13388 14.5 7V13.1253C14.5 13.6076 14.1076 14 13.6253 14H7.5C3.63388 14.0025 0.5 10.8686 0.5 7V0.874687C0.5 0.39236 0.89236 0 1.37469 0ZM7.5 12.3356C10.4464 12.3356 12.8331 9.94645 12.8331 7.0025C12.8331 4.05855 10.4464 1.6669 7.5 1.6669C4.55355 1.6669 2.1669 4.05355 2.1669 7C2.1669 9.94645 4.55605 12.3356 7.5 12.3356ZM7.5 10.6687C5.47572 10.6687 3.83381 9.02678 3.83381 7.0025C3.83381 4.97822 5.47572 3.33631 7.5 3.33631C9.52428 3.33631 11.1662 4.97822 11.1662 7.0025C11.1662 9.02678 9.52678 10.6687 7.5 10.6687ZM7.5 8.62692C8.39718 8.62692 9.12442 7.89968 9.12442 7.0025C9.12442 6.10532 8.39718 5.37808 7.5 5.37808C6.60282 5.37808 5.87558 6.10532 5.87558 7.0025C5.87558 7.89968 6.60282 8.62692 7.5 8.62692Z" fill="white"/>
</svg>
        ---,
        noteIcon: ---
<svg width="16" height="13" viewBox="0 0 16 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.7685 9.05564L9.49656 9.05819L9.26337 9.1981L6.33343 10.9561V10.0556V9.05559L5.33342 9.0556L2.88902 9.0556C2.33699 9.05561 1.8894 8.60814 1.8894 8.0556V2.27783C1.8894 1.72555 2.33712 1.27783 2.8894 1.27783H13.1112C13.6634 1.27783 14.1112 1.72555 14.1112 2.27783L14.1112 8.03451C14.1112 8.58455 13.667 9.03144 13.1168 9.03467C11.7353 9.04277 10.0829 9.05269 9.7685 9.05564Z" stroke="white" stroke-width="2"/>
</svg>
        ---
    }
end;

historyStyles()

Diese Funktion definiert CSS-Stile für die Darstellung von Aktivitäts-Feeds oder Historien. Sie ist wichtig für die visuelle Konsistenz und Benutzerfreundlichkeit, da sie sicherstellt, dass alle Aktivitäts-Feeds einheitlich aussehen.

function historyStyles() do
    "<style>
    body {
  background: #F0F1F5; /* rgba(240, 241, 245, 1) */
  margin: 0;padding: 0;
}
.activity-feed {
  display: flex;flex-direction: column;gap: 24px;font-family: NotoSans,""Noto Sans"",sans-serif;font-size: 13px;margin: 0;padding: 16px;box-sizing: border-box;
}
.activity-item {
  display: flex;align-items: top;
}
activity-item::before {
  content: '';width: 1px;
  height: 100%;background-color: #D4D9E9; /* Same color as activity type circle */
  position: absolute;left: 44px; /* Position the line to connect to the next activity */z-index: 1;
}
.activity-type {
  width: 25px;
  height: 25px;
  min-width: 25px;
  border-radius: 50%;
  background-color: #9485F2; /* Adjust color as desired */
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
    z-index: 2;
}
.activity-details {
  flex: 1; /* Use all available horizontal space */
  display: flex;
  flex-direction: column;
  margin-left: 10px;
}
.activity-details {
  flex: 1; /* Use all available horizontal space */
  display: flex;
  flex-direction: column;
  margin-left: 10px;
}
.activity-user,
.activity-content {
  display: flex;
  align-items: center;
}
.user-avatar {
  width: 25px;
  height: 25px;
  min-width: 25px;
  border-radius: 50%;
  background-color: #ccc; /* Adjust color or use an image */
  margin-top: 0;
  margin-right: 8px;
}
.user-name {
  font-weight: bold;
}
.activity-details {
  display: flex;
  flex-direction: column;
  margin-left: 10px;
}
.activity-type-label {
  font-weight: bold;
}
.activity-comment {
  margin-top: 8px;
  max-width: calc(100%-29px);
}
.comment-card {
  background-color: #fff;
  padding: 16px;
  border-radius: 4px;

}
.user-name, .activity-type-object {
  font-weight: 600;
  color: #262F4D;
}
.activity-type-label, .activity-date {
  font-weight: 400;
  color: #9297A6;
  margin: 0 4px;
}
.activity-date::before {
  content: '\2022';
  width: 2em;
  height: 1em;
  position: inline-block;
  margin-right: 8px;
}
.activity-type-comment {

}
.activity-type-comment {
  background: #52C2CC;
    }
</style>"
end;

actionMenuStyles()

Ähnlich wie historyStyles(), aber speziell für Aktionsmenüs. Diese Funktion definiert die Stile für Menüs, die dem Benutzer verschiedene Aktionen zur Auswahl anbieten.

function actionMenuStyles() do
    "<style>
    table {border-collapse: collapse; width: 100%;}
    th, td {border: 0 ;padding: 8px;text-align: left;}
    tr:nth-child(odd) {background-color: #eff1f9;}
    tr:nth-child(even) {background-color: #ffffff;}
    tr:hover {background-color: #BFCFFF;}
    tr:focus {background-color: #7F9FFF;}
</style>"
end;

OpportunityActionMenuBody()

Diese Funktion generiert den Body eines Aktionsmenüs für Opportunities. Sie erstellt eine HTML-Tabelle, in der jede Zeile eine verfügbare Aktion für eine Opportunity darstellt. Benutzerinteraktionen mit diesen Optionen lösen bestimmte Aktionen aus, die mit der Opportunity verknüpft sind.

function OpportunityActionMenuBody(me : Opportunities, ob : any) do "<table>" + join(for i in ob.myArr do --- <tr tabindex="0"> <td onclick="database.update('{ raw(me) }', 'N8', { i.id } )" >{ i.option }</td> </tr> --- end, " ") + " </table>" end;

InboxActionMenuBody()

Diese Funktion ist ähnlich wie OpportunityActionMenuBody, aber für Inbox-Nachrichten. Sie generiert HTML-Inhalte für ein Aktionsmenü basierend auf den verfügbaren Aktionen für ein Inbox-Element. Diese Aktionen können beispielsweise das Archivieren oder das Zurückverschieben in die Inbox umfassen.

function InboxActionMenuBody(me : Inbox, ob : any) do
    "<table>" +
    join(for i in ob.myArr do
        ---
    <tr tabindex="0">
        <td onclick="database.update('{ raw(me) }', 'A3', { i.id } )"  >{ i.option }</td>
    </tr>
        ---
    end, "
") +
    "
</table>"
end;

OpportunityActionMenu()

Diese Funktion implementiert das Aktionsmenü für eine Opportunity. Es verarbeitet Benutzereingaben aus dem durch OpportunityActionMenuBody generierten Menü, führt die ausgewählte Aktion aus (wie z.B. die Konvertierung eines Leads in einen Deal) und aktualisiert entsprechend die Datenbank.

function OpportunityActionMenu(me : Opportunities) do
    let myEmpl := employeeModule();
    me.(actionId := 0);
    let myArr := [/* Array von Aktionen basierend auf der Opportunity-Logik */];
    myArr := for i in myArr do if i then i end end;
    let myOb := { myArr: myArr };
    let myDialog := dialog("Aktion auswählen", html(OpportunityActionMenuBody(me, myOb) + actionMenuStyles()), ["Ausführen", "Abbrechen"]);
    if myDialog = "Ausführen" then
        switch me.actionId do
        -- Implementierung der Logik für die ausgewählte Aktion
        end
    else
        me.(actionId := 0)
    end
end;

InboxActionMenu()

Diese Funktion steuert das Aktionsmenü für Inbox-Elemente und funktioniert ähnlich wie OpportunityActionMenu. Es verwendet InboxActionMenuBody, um Benutzereingaben zu erfassen, und führt dann die gewählte Aktion aus, wie z.B. das Konvertieren einer Inbox-Nachricht in einen Lead oder Deal.

function InboxActionMenu(me : Inbox) do
    me.(actionId := 0);
    let myArr := [/* Array von Aktionen basierend auf der Inbox-Nachrichten-Logik */];
    myArr := for i in myArr do if i then i end end;
    let myOb := { myArr: myArr };
    let myD := dialog("Aktion auswählen", html(InboxActionMenuBody(me, myOb) + actionMenuStyles()), ["Ausführen", "Abbrechen"]);
    if myD = "Ausführen" then
        switch me.actionId do
        -- Implementierung der Logik für die ausgewählte Aktion
        end
    else
        me.(actionId := 0)
    end
end;

cronJobMarketing()

Diese Funktion ist für die Automatisierung von Marketingkampagnen zuständig. Sie überprüft regelmäßig, ob Kampagnenschritte ausgeführt werden müssen, und sendet dann entsprechende E-Mails an die Zielgruppe. Dieser Prozess ist wichtig für die Durchführung von zeitgesteuerten Marketingaktivitäten.

function cronJobMarketing() do
    for i in select Kampagnenschritte
        where Kampagne.Status = 3 and number('Datum + Uhrzeit') < number(now()) + 30 * 60 * 1000 and
        number('Datum + Uhrzeit') > number(now()) - 30 * 60 * 1000 do
        for t in numbers(i.Kampagne.Ansprechpartner) do
            sendEmail({
                from: i.Kampagne.Verantwortlich.'E-Mail (dienstlich)',
                to: record(Ansprechpartner,t).'E-Mail',
                bcc: record(Einstellungen,1).Einstellungen.'Smart BCC',
                subject: i.Betreff,
                text: text(i.Inhalt),
                html: i.Inhalt
            })
        end;
        i.(Status := 2)
    end;
    "successful"
end;

jsonToHtml()

Die Funktion konvertiert JSON-Daten in HTML-Code. Diese Umwandlung ermöglicht es, dynamisch HTML-Inhalte basierend auf JSON-Datenstrukturen zu erzeugen, was besonders nützlich ist, wenn Daten aus einer API oder einer datenbasierten Anwendung in einer Webansicht dargestellt werden sollen.

function jsonToHtml(data : any) do
    let d := replace(formatXML(data, true), "<?xml version=""1.0"" encoding=""utf-8""?>", "");
    d := replace(d, "&quot;", """");
    d := replace(d, "&apos;", "'");
    d := replace(d, "&amp;", "&");
    d := replace(d, "</link>", "");
    d
end;

jsonToStyle()

Die Funktion verwandelt JSON-Daten in CSS-Code. Dies ist besonders hilfreich, wenn Stile dynamisch auf Basis von Daten definiert werden sollen. Durch das Übergeben von JSON, das Stilinformationen enthält, kann CSS generiert werden, das dann in einem Webdokument verwendet werden kann.

function jsonToStyle(data : any) do
    let br := "
";
    join(for key, value in data do
        key + " {" + br +
        join(for k, v in value do
            ---
{ k }: { v };{ br }
            ---
        end, "") +
        "}" +
        br
    end, br)
end

Widgets

Step Progress Widget

Antwort

null

Content aside

  • vor 4 MonatenZuletzt aktiv
  • 65Ansichten
  • 1 Folge bereits