summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/create_batch.html
blob: 86c6555230395927b98546b343b3913d13475bea (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
{% extends "ndf/base.html" %}
{% load pagination_tags %}
{% load i18n %}
{% load ndf_tags %}
{% block title %} {{title}} {% endblock %}

{% block style %}

.divider-line { font-size: xx-large; color:lightgray; }
.line-height-2 { line-height:2; }
.line-height-2pt5 { line-height:2.5; }
.fontsize-x-large { font-size: x-large; }

.margin-0 { margin: 0 !important ;}

.resource-drawer { 
border-color: #D3D3D3; border-style: solid; 
padding: 0 !important; 
overflow-y: auto;
}

.resource-drawer li.bullet-item:hover{
background-color: #ecf0f1; cursor:pointer;
}

.posted-by{ color: #808080; font-size: small; }

.selected-resource { background-color:lightgray !important ; }

.resource-type-image {
height:40px; 		
background-repeat:no-repeat; background-size: 48px 48px
}
{% endblock %}

{% block script %}

function set_drawer_value(group_id)
{
 $('#collection_set_drawer1').html("");
 $('#collection_set_drawer2').html("");
 $('#collection_set_drawer1').html('<li class="price"><input type="text" placeholder="Type here to search in the resources" id="\
collection_set_search" class="margin-0"></li>');
  var _id = '{{batch.pk}}'
  if (_id != "")
  {
  var url = '/{{groupid}}/ajax/get_data_for_user_drawer/?st_batch_id='+st_batch_id+'&'+'_id='+_id;
  }
  else
  {
  var url = '/{{groupid}}/ajax/get_data_for_user_drawer/?st_batch_id='+st_batch_id;
  }
  $.getJSON( url, function( data ) {
  $.each(data ,function(index , drawer_elements){
   if(index == 0)
    {
     $.each(drawer_elements.drawer1, function(index, element) {
        $('#collection_set_drawer1').append("<li id='"+element.id+"' class='bullet-item text-left'>"+element.name+"</li>");
      });
   }
   if(index == 1)
    {
    $.each(drawer_elements.drawer2, function(index, element) {
        $('#collection_set_drawer2').append("<li id='"+element.id+"' class='bullet-item text-left'>"+element.name+"</li>");
      });
    }
  });
   });
}

var group_id = '{{group_id}}'
var st_batch_id = '{{st_batch_id}}'
set_drawer_value(group_id, st_batch_id);


$("#save-node").click(function() {
   cn_arr = []   
   $.each($('#collection_set_drawer2 li'),function(index,item){
         cn_arr.push(item.id);
         });
$("#collection_set_list").val(cn_arr)
});

<!-- script for making batch name -->
$('#sel_course').change(function () {
     var optionSelected = $(this).find("option:selected");
     var textSelected   = optionSelected.text();
     var  batch_name = textSelected + "-Batch-" + '{{batch_count}}'
   
     if(textSelected == "--select--")
     {
         $('#txt_batch_name').val(" ")
     }
     else
     {
         $('#txt_batch_name').val(batch_name)
     }
   
 });
<!-- end-->

{% endblock %}


{% block body_content %}
<form data-abide id="form-create-batch" method="POST" action="{% url 'save' groupid %}">{% csrf_token %}
  <div class="row">
    <div class="large-9 columns">
      <label>select course
	<select name="courses" id="sel_course">
	  <option value="">--select--</option>
	  {% for each in fc_courses %}
	  {% if each.name == course_name %}
          <option selected value="{{each.pk}}">{{each.name}}</option>
	  {% else %}
	  <option  value="{{each.pk}}">{{each.name}}</option>
	  {% endif %}
          {% endfor %}
	</select>
      </label>
    </div>
  </div>
   <div class="row">
    <div class="large-9 columns">
      <label>{% trans "Enter Batch Name" %}
	<input type="text" placeholder="Batch Name" id="txt_batch_name" name="batch_name" value="{{batch.name}}" />
	<input type="hidden" name="batch_count" value="{{batch_count}}"/>
	<input type="hidden" name="node_id" value="{{batch.pk}}"/>
      </label>
    </div>
  </div>
  <div class="row">
    <div class="large-11 columns" >
      <label><h3>{% trans "Choose users" %}</h3>
	<div id="user_drawer" >
	  {% include "ndf/drawer_widget.html" with widget_for="collection_set" %}
	</div>
      </label>
    </div>
  </div><br/><br/>
  <div class="row">
    <div class="large-11 columns" >
      {% if batch_count == 1 %}
      <input type="submit" class="button expand" id="save-node" value="Save & Finish">
      {% else %}
      <input type="submit" class="button expand" id="save-node" value="Save & Continue">
      {% endif %}
    </div>
  </div>
</div>
</form>
{% endblock %}