#*
 * Copyright 2018 LinkedIn Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
*#

<!DOCTYPE html>
<html>
  <head>
    <title>Reportal</title>
    <link href="${context}/reportal/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="${context}/js/jquery/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="${context}/js/jqueryui/jquery-ui-1.10.1.custom.js"></script>
    <script type="text/javascript">
      var contextURL = "${context}";
    </script>
    <script type="text/javascript" src="${context}/reportal/js/reportal.js"></script>
    <script type="text/javascript" src="${context}/reportal/js/reportal-run.js"></script>
    <link href="${context}/reportal/css/reportal.css" rel="stylesheet">
  </head>
  <body>
#set($current_page="$viewerName")
#if(!$hideNavigation)
  #parse("azkaban/webapp/servlet/velocity/nav.vm")
#end

#parse("azkaban/viewer/reportal/reportalnavigation.vm")

    <div class="content" style="margin-top: 41px;">
      <div id="box-error">
  #if($errorMsg)
        <div class="box-error-message">$errorMsg</div>
  #else
    #if($error_message != "null")
        <div class="box-error-message">$error_message</div>
    #elseif($success_message != "null")
        <div class="box-success-message">$success_message</div>
    #end
  #end
      </div>
      <div>&nbsp;</div>
      <div style="text-align: center;">
        <a class="btn btn-info" href="${context}/reportal">Reportal Home</a>
#if($projectId)
        <a class="btn btn-primary" href="${context}/reportal?view&amp;id=$projectId">Report History</a>
        <a class="btn btn-warning" href="${context}/reportal?edit&amp;id=$projectId">Edit</a>
#end
      </div>
#if($projectId)
      <div>&nbsp;</div>
      <div class="container">
        <div>
          <form method="post" class="form-horizontal">
            <input type="hidden" name="id" value="$projectId">
            <fieldset>
              <legend>Report</legend>
              <div class="control-group">
                <label class="control-label">Title</label>
                <div class="controls" style="padding-top:5px;">${title}</div>
              </div>
              <div class="control-group">
                <label class="control-label">Description</label>
                <div class="controls" style="padding-top:5px;">${description}</div>
              </div>
            </fieldset>
  #if($variables)
            <legend>Variables</legend>
            <fieldset>
    #foreach($variable in $variables)
      #set($num = $velocityCount - 1)
              <div class="control-group">
                <label class="control-label">${variable.title}</label>
                <div class="controls"><input type="text" name="variable${num}" value=""></div>
              </div>
    #end
            </fieldset>
  #end
            <div class="form-actions">
              <input id="run-button" type="submit" class="btn btn-primary" value="Run">
              <input id="test-run-button" type="submit" class="btn btn-info" value="Test Run (only email executor)">
              <a href="${context}/reportal" class="btn">Cancel</a>
            </div>
          <form>
        </div>
      </div>
#end
    </div>
  </body>
</html>
