App Plan Suggestion

by Hugo Carneiro

HTML

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<div class="container">
  <div class="form-holder mt-4 mb-5">
    <h1>
      Answer the following questions:
    </h1>
    <form>
      <div class="mb-3">
        <label for="appUsers" class="form-label">Number of app users</label>
        <input type="number" class="form-control" id="appUsers" required>
      </div>
      <div class="mb-3">
        <label for="apps" class="form-label">Number of apps</label>
        <input type="number" class="form-control" id="apps" required>
      </div>
      <div class="mb-3">
        <label class="form-label">Plan type</label>
        <select class="form-select" id="planType" required>
          <option value="">-- Select one</option>
          <option value="Public">Public</option>
          <option value="Private">Private</option>
        </select>
      </div>
      <div class="mb-3">
        <label class="form-label">Additional features</label>
        <div class="form-check">
          <input class="form-check-input" type="checkbox" value="appStoreLaunch" id="appStoreLaunch">
          <label class="form-check-label" for="appStoreLaunch">
            Launch my app to the Apple or Google app store
          </label>
        </div>
        <div class="form-check">
          <input class="form-check-input" type="checkbox" value="enhancedSecurity" id="enhancedSecurity">
          <label class="form-check-label" for="enhancedSecurity">
            Enhanced security beyond standard security features
          </label>
        </div>
        <div class="form-check">
          <input class="form-check-input" type="checkbox" value="prioritySupport" id="prioritySupport">
          <label class="form-check-label" for="prioritySupport">
            Priority support including phone
          </label>
        </div>
        <div class="form-check">
          <input class="form-check-input" type="checkbox" value="sla" id="sla">
     ...

JavaScript

function findAppropriatePlan(userInput) {
  // Maps the plans to its features
  var plans = {
    'Enterprise': {
      appUsers: 'Any',
      apps: 'Any',
      planType: ['Private', 'Public'],
      additionalFeatures: {
        appStoreLaunch: true,
        enhancedSecurity: true,
        prioritySupport: true,
        sla: true,
        expertAssistance: true,
        ongoingTraining: true
      },
      integrationFeatures: {
        sso: true,
        mdm: true,
        microsoftSQLServerIntegration: true,
        onPremiseSystems: true,
        restAPI: true
      }
    },
    'Private Plus': {
      appUsers: 200,
      apps: 10,
      planType: ['Private'],
      additionalFeatures: {
        appStoreLaunch: true,
        enhancedSecurity: true,
        prioritySupport: true,
        sla: true,
        expertAssistance: true
      },
      integrationFeatures: {
        sso: true,
        mdm: true,
        microsoftSQLServerIntegration: true,
        onPremiseSystems: true,
        restAPI: true
      }
    },
    'Private': {
      appUsers: 350,
      apps: 10,
      planType: ['Private'],
      additionalFeatures: {
        appStoreLaunch: true,
        expertAssistance: true
      }
    },
    'Public Plus': {
      appUsers: 1000,
      apps: 10,
      planType: ['Public'],
      additionalFeatures: {
        appStoreLaunch: true,
        prioritySupport: true,
        expertAssistance: true
      },
      integrationFeatures: {
        microsoftSQLServerIntegration: true,
        onPremiseSystems: true,
        restAPI: true
      }
    },
    'Public': {
      appUsers: 2000,
      apps: 10,
      planType: ['Public'],
      additionalFeatures: {
        appStoreLaunch: true,
        expertAssistance: true
      }
    },
    'Free': {
      appUsers: 25,
      apps: 1,
      planType: ['Private', 'Public']
    },
  };

  // Variable to save the results
  var eligiblePlans = [];

  // Loops the plans to find the ones that match
  for (var plan in...