Sindbad~EG File Manager

Current Path : /home/numerotech/conf-regdesk.numerotech.com/reg_desk/core/templates/signup/
Upload File :
Current File : //home/numerotech/conf-regdesk.numerotech.com/reg_desk/core/templates/signup/sigup_view_table.html

<br>
<div class="card">
	<input type="hidden" name="conf_id" id="conf_id" value="{{conf_id}}" />
	<input type="hidden" name="conf_key" id="conf_key" value="{{conf_key}}" />
	<div class="card-header">
		<h2> Total Registered Count :  {% if del_datas %} {{del_datas|length}} {% endif %}</h2>
		<button type="button" class="btn btn-secondary" id="all">All - {% if del_datas %} {{del_datas|length or '0'}} {% endif %} </button>
		
		{% if signed_on_count %}
			<button type="button" class="btn btn-success" id="signed">Signed - {{signed_on_count or '0'}}</button>
		{% endif %}

		{% if unsigned_on_count %}
			<button type="button" class="btn btn-danger" id="unsigned">Unsigned - {{unsigned_on_count or '0'}} </button>
			<button type="button" class="btn btn-primary" id="signup_delegate">Bulk Signup delegates</button>
		{% endif %}	
	</div>
	<div class="row">
		<div class="col-lg-12 col-md-12 col-sm-12 mobile-responsive">  
			<table class="table table-striped table-bordered bg-light mobile-responsive" style="font-size: 12px;">
				<thead  style="background-color: #072645;border-color: #dee2e6;color: #FFF;">
					<tr>
						<th scope="col" width="100px" class="text-center">No. 
							<select name="items" class ="item_options" id="item_options">        
                                 <option scope="col" value="empty" disabled selected>--Select--</option>
                                 <option scope="col" class="select_all" name="select_all" id="select_all" value="select_all">Select All</option>
                                 <option scope="col" value="unselect_all">UnSelect All</option>
                            </select>
						</th>
						<th><b>Delegate No</b></th>
						<th><b>Name</b></th>
						<th><b>Role</b></th>
						<th><b>Signed on</b></th>
						<th><b>Kit Collected</b></th>
					</tr>
				</thead>
				<tbody>
				{% if del_datas: %}
					{% for row in del_datas %}
					<tr {% if row.signed_on %} style="background-color:lightgreen;" class="signed" {% else %} class="unsigned" {% endif %} >
						<td data-label="Select Check">{{loop.index}}
						 	{% if row.signed_on %}
						 	    <button type="button" class="btn btn-warning btn-sm" onclick="BulkUnSignupFunc({{row.delegate_no}})">Unsignup</button>
							{% else %}
							 	<label><input type="checkbox" class="select chk_select"  id="select" name="chk_select" value="{{row.delegate_no }}" ></label>
						 	{% endif %}
						</td>
						<td data-label="Delegate No">{% if row.counter %} {{row.counter}} - {% endif %} {% if row.batch %}  {{row.batch}} - {% endif %} {{row.delegate_no or ''}}</td>
						<td data-label="Name" >{% if row.prefix %} {{row.prefix}} {% endif %} {{row.full_name or ''}}</td>
						<td data-label="Role">{% if row.badge_role %}{{row.badge_role}} {% else %}{{row.role or ''}}{% endif %}</td>
						<td data-label="Signed on">
							{% if row.signed_on %}	
								{{ row.signed_on.strftime("%d-%m-%Y") }} <br/> {{ row.signed_on.strftime("%I:%M %p") }}
							{% endif %}	
						</td>
						<td data-label="Kit Collected">
							{% if row.kit_collected_at %}	
								{{ row.kit_collected_at.strftime("%d-%m-%Y") }} <br/> {{ row.kit_collected_at.strftime("%I:%M %p") }}
							{% endif %}	
						</td>		
					</tr>
					{% endfor %}
				{% else: %}
					<tr>
						<td colspan="6" class="text-center" > No record found. </td>
					</tr>
				{% endif %}
				</tbody>
			</table>
		</div>
				
	</div>
</div>
<script type="text/javascript">
var BaseUrl = document.location.origin; 

	$("#item_options").change(function() {
        if(this.value == "select_all"){
           	$('.chk_select').prop('checked', true);
           	var all_del_no = [];
           	var all_del_no = jQuery.map($(':checkbox[name=chk_select]:checked'), function (n, i) {
                return n.value;
            }).join(',');
            $('#del_nos').val(all_del_no);
        } 
        else {
           $("input:checkbox[name='chk_select']").prop("checked", false);
        }  
        if(this.value == "unselect_all"){
    		$('#del_nos').val('');
    		$('.chk_select').prop('checked', false);
       	}
    });


	$(".chk_select").change(function() {
         $("#item_options").val("empty");
         var total_check_boxes = $(".chk_select").length;
         var total_checked_boxes = $('.chk_select:checked').length;
         var test = [];
         $('.chk_select:checked').each(function() {
               test.push($(this).val());
         });

         $('#del_nos').val(test.join(","));
         if (total_check_boxes === total_checked_boxes) {
            $("#item_options").val("select_all");
         }
         else {
            $("#select_all").prop("checked", false);
         }
      }); 


	function BulkUnSignupFunc(delegate_nos)
    {
       	if(confirm("are you sure want to unsignup this record?"))
       	{ 
	        var conf_id   = $("#conf_id").val();
	        var conf_key  = $("#conf_key").val();
	        var counter   = $("#counter").val();
	        var set       = $("#set").val();

	        $.ajax({
	            type: "GET", // <-- get method of form
	            url: BaseUrl + "/" + conf_id + "/" + conf_key + "/post_bulk_unsignup", // <-- get action of form
	            data: {"delegate_nos":delegate_nos,'counter':counter,'set':set},
	            dataType: "json",    
	            success: function(data){
	                if(data.status == 1 ){
	                	$("#success_msg").show();
                  		$("#SuccessMsg").html(data.msg);
	                    $("#show_html_table").empty();
	                    $("#show_html_table").html(data.html_data);
	                }
	                else{
	                    alert(data.msg);
	                }
	            }    
	        });
	    }    
    }

</script>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists