aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/base/workflow/book_a_pod.html
blob: 7448dc5da09ea1ff6214ee550ab91f8b426d75f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
{% extends "base.html" %}
{% load staticfiles %}
{% load bootstrap4 %}
{% block extrahead %}
<script src="/static/js/workflows/common-models.js"></script>
<script src="/static/js/workflows/workflow.js"></script>
<script src="/static/js/workflows/book-a-pod.js"></script>
{% endblock %}
{% block content %}
<body>
<div class="workflow-container">
    <div id="prev" class="row w-100 m-0">
        <button class="btn btn-workflow-nav stretched-link m-0 p-0 mt-3" onclick="workflow.goPrev()" id="workflow-prev">
          <div class="arrow arrow-up"></div>
        </button>
      </div>
    
      <div id="next" class="row w-100 m-0">
        <button class="btn btn-workflow-nav stretched-link m-0 p-0 mb-3" onclick="workflow.goNext()" id="workflow-next">
          <div class="arrow arrow-down"></div>
        </button>
      </div>

    <div class="scroll-container w-100 h-100 p-0">
        <div class="scroll-area pt-5 mx-5" id="select_template">
            <h1 class="mt-4"><u>Book a Pod</u></h1>
            <h2 class="mt-4 mb-3">Select Host Or Template:</h2>
            <div class="card-deck align-items-center">
      
              <div class="col-12" id="template_list">
      
                <div class="my-5" id="select_template_tab_content">
                    <ul id="default_templates_list" class="p-0 m-0 row">
                    </ul>
                </div>
      
              </div>
            </div>
        </div>

        <div class="scroll-area pt-5 mx-5" id="cloud_init">
            <h2 class="mt-4 mb-3">Global Cloud Init Override</h2>
            <div class="d-flex align-items-center">
              <textarea name="ci-textarea" id="ci-textarea" rows="15" class="w-50"></textarea>
            </div>
        </div>

        <div class="scroll-area pt-5 mx-5" id="booking_details">
            <h2 class="mt-4 mb-3">Booking Details</h2>
            <div class="form-group mb-0">
              <div class="row align-items-center my-4">
                <div class="col-xl-6 col-md-8 col-11">
                  <input id="input_project" class="form-control form-control-lg border border-dark p-5" type="text" placeholder="Project">
                </div>
              </div>
              <div class="row align-items-center my-4">
                <div class="col-xl-6 col-md-8 col-11">
                  <input id="input_purpose" class="form-control form-control-lg border border-dark p-5" type="text" placeholder = "Purpose">
                </div>
              </div>
              <div class="row align-items-center my-4">
                <span id="booking_details_error" class="text-danger col-xl-6 col-md-8 col-11"></span>
              </div>
              <div class="row align-items-center my-4">
                <span id="booking_details_day_counter" class="col-md-1 col-2 p-0">Days: 1</span>
                <input id="input_length" type="range" min="1" max="21" value="1" class="form-control form-control-lg col-xl-5 col-9 p-0" placeholder="Length" oninput="workflow.onchangeDays()">
              </div>
            </div>
        </div>

        <div class="scroll-area pt-5 mx-5" id="add_collabs">
            <h2 class="mt-4 mb-3">Add Collaborators:</h2>
            <div class="row">
              <div class="col-xl-6 col-md-8 col-11 p-0 border border-dark">
                {% bootstrap_field form.users label="Collaborators" %}
              </div>
            </div>
        </div>

        <div class="scroll-area pt-5 mx-5" id="booking_summary">
            <h2 class="mt-4 mb-3">Booking Summary</h2>
            <div class="row align-items-center">
              <div class="card col-xl-6 col-md-8 col-11 border-0">
                <ul class="list-group">
                  <li class="list-group-item">Booking Details
                    <ul id="booking_summary_booking_details">
                    </ul>
                  </li>
                  <li class="list-group-item">Collaborators
                    <ul id="booking_summary_collaborators">
                    </ul>
                  </li>
                  <li class="list-group-item">Hosts
                    <ul id="booking_summary_hosts">
                    </ul>
                  </li>
                </ul>
              </div>
            </div>
            <div class="row align-items-center mt-5">
              <!-- <button class="btn btn-danger cancel-book-button p-0 mr-2 col-xl-2 col-md-3 col-5" onclick="workflow.onclickCancel()">Cancel</button> -->
              <button class="btn btn-success cancel-book-button p-0 ml-2 col-xl-2 col-md-3 col-5" onclick="workflow.onclickConfirm()">Book</button>
            </div>
          </div>
        
    </div>
</div> 

<div class="hidden_form d-none">
  <form id="token">
      {% csrf_token %}
  </form>
</div>

<div class="modal fade" id="ipa-modal" tabindex="-1">
  <div class="modal-dialog modal-xl">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Welcome to LaaS 3.0</h5>
        <button class="close" onclick="window.location.href = '../../'"><span aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body" id="add_resource_modal_body">
          <p>Please update your information before creating a booking.</p>
          <form action="{{prereq_validator.action}}" method="post">
              {% csrf_token %}
              {{ prereq_validator.form }}
              <div class="form-group">
                  <input class="btn btn-success" name="submitButton" type="submit" value="Save">
              </div>
          </form>
      </div>
    </div>
  </div>
</div>

<!-- Alert Modal -->
<div class="modal fade" id="alert_modal" tabindex="-1">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body text-center">
        <h5 id="alert_modal_message"></h5>
      </div>
      <div class="modal-footer d-flex justify-content-center">
        <button class="btn btn-success" data-dismiss="modal" id="alert-modal-submit" onclick="">Confirm</button>
      </div>
    </div>
  </div>
</div>
</body>

<script>
  let user;
  let workflow;
  $(window).on('load', function() {
    if ({{prereq_validator.exists}}) {
        $('#ipa-modal').modal({backdrop: 'static', keyboard: false});
        $('#ipa-modal').modal('show');
    } else {
      user = "{{user}}"
      workflow = new BookingWorkflow();
      workflow.startWorkflow();
    }
    });


  </script>
{% endblock %}