<?php
include "header.php";

if(!empty($setup)){
	$fndur = gtOne("ktmmenu_name"," murl = '$setup' ", 'mn_id'); //GET MENU VERIFIED
	$getmnms = (!empty($fndur)) ?  gtAll("ktmmenu_category "," mn_id = '$fndur' ", '') : ''; //FETCH MENU CATEGORY 
	$fndnm = (!empty($fndur)) ?  gtOne("ktmmenu_name"," mn_id = '$fndur' ", 'mname') : ''; //GET MENU NAME
}else{
	$getmnms = gtAll("ktmmenu_name","", ''); // FECTCH ALL MENU RECORDS
}
?>

<div id="content" class="main-content">

	<div class="layout-px-spacing">
		<div class="row layout-top-spacing" id="cancel-row">
  
			<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing m-auto">
			
			<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 ">
				<h1 class="title-4"> <?= !empty($fndnm) ? $fndnm .' Menu' : 'Product Category' ?> </h1>
				<div class="btn-toolbar mb-2 mb-md-0">
					<div class="btn-group mr-2">
						<?php if(!empty($setup)){ ?>
						<a href="?preg=category" class="btn btn-icon bg-warning text-white">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-corner-up-left"><polyline points="9 14 4 9 9 4"></polyline><path d="M20 20v-7a4 4 0 0 0-4-4H4"></path></svg>
						&nbsp; Back </a>
						<?php } ?>
						<button type="button" class="btn btn-icon bg-primary text-white"  id="opentosubject">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clipboard"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>
						&nbsp; Add New </button>
					</div>
				</div>
			</div>
	
			
			<div class="row">
				<div class="col-md-7 col-12 mx-auto">
							
				<div class="widget-content widget-content-area br-6">	
		<?php
		if(!empty($setup)){
		?>
					<div class="table-responsive mb-4 mt-4">
						<table id="events_tbrec" class="table table-stripped caption-top" style="width:100%">
							<thead>
								<tr>
									<th width="40%">Category Name</th>
									<th width="60%" class="text-center vertical-align"  data-sortable="false">Action</th>
								</tr>
							</thead>
							<tbody id="subj_rcx">
								<?php
								if(!empty($getmnms))
								{
									foreach($getmnms as $sjs):
								?>
								<tr class="tritem">
									<td>
										<p class="mb-0 subj-name font-weight-bold" data-subj="<?= $sjs['cname']; ?>" data-suid="<?= $sjs['mc_id']; ?>"><?= $sjs['cname']; ?></p>
									</td>
									<td class="vertical-align text-center">
										<div class="table-data-feature">
										
											<a href="javascript:void(0);" id="<?= $sjs['curl']; ?>" class="bg-warning text-white bs-tooltip border-0 btn rounded-circle subrecx"  title="Add Sub Category">
												<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" 
												stroke-linejoin="round" class="feather feather-git-pull-request"><circle cx="18" cy="18" r="3">
												</circle><circle cx="6" cy="6" r="3"></circle><path d="M13 6h3a2 2 0 0 1 2 2v7"></path><line x1="6" y1="9" x2="6" y2="21"></line></svg>
											</a>
											
											<a href="javascript:void(0);" class="bg-secondary text-white bs-tooltip border-0 btn rounded-circle editsubjs"  title="Edit">
												<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" 
												stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" 
												class="feather feather-edit"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
												<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>
											</a>
											
											<button class="bg-danger text-white bs-tooltip border-0 btn rounded-circle" id="del_<?= $sjs['mc_id']; ?>" onClick="takeoff(<?= $sjs['mc_id']; ?>,'pqcrl')"  title="Delete">
												<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2">
												<polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line>
												</svg>
											</button>
											
											<button type="button" class="bg-info text-white bs-tooltip border-0 btn rounded-circle viewsubjcls"  title="Record">
												<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
											</button>
										</div>
									</td>
								</tr>
								<?php
									endforeach;
								}
								else
								{ ?> <tr> 	<td colspan="2" class="text-center" >No Available Data.</td> </tr> <?php } ?>
							</tbody>
						</table>
					</div>
		<?php
		}
		else{
		?>
					<div class="table-responsive mb-4 mt-4">
						<table id="events_tbrec" class="table table-stripped caption-top" style="width:100%">
							<thead>
								<tr>
									<th width="40%">Title</th>
									<th width="60%" class="text-right vertical-align"  data-sortable="false">Action</th>
								</tr>
							</thead>
							<tbody id="subj_rcx">
								<?php
								if(!empty($getmnms))
								{
									foreach($getmnms as $sjs):
									
									$prd_id = $sjs['mn_id'];
								?>
								<tr class="tritem">
									<td>
										<a href="?preg=category&setup=<?= $sjs['murl']; ?>" class="mb-0 subj-name font-weight-bold text-primary" data-subj="<?= $sjs['mname']; ?>" data-suid="<?= $prd_id; ?>"><?= $sjs['mname']; ?></a>
									</td>
									<td class="vertical-align text-right">
										<div class="table-data-feature">
										
											<a href="javascript:void(0);" class="bg-secondary text-white bs-tooltip border-0 btn rounded-circle editsubjs"  title="Edit">
												<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" 
												stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" 
												class="feather feather-edit"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
												<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>
											</a>
											
											<button class="bg-danger text-white bs-tooltip border-0 btn rounded-circle" id="del_<?= $sjs['mn_id']; ?>" onClick="takeoff(<?= $sjs['mn_id']; ?>,'nhaqpk')"  title="Delete">
												<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2">
												<polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line>
												</svg>
											</button>
											
											<button type="button" class="bg-info text-white bs-tooltip border-0 btn rounded-circle viewsubjcls"  title="Record">
												<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
											</button>
											
											<div class="dropdown custom-dropdown vertical-align text-center d-inline">
												<a class="dropdown-toggle bg-danger text-white border-0 btn rounded-circle" href="#" role="button" id="dropdownMenuLink7" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
													<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-more-horizontal"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg>
												</a>
												
												<div class="dropdown-menu" aria-labelledby="dropdownMenuLink7">
													
												<a class="dropdown-item nwsfts" href="javascript:void(0);" id="homtb_<?= $prd_id; ?>" >
													<svg xmlns="http://www.w3.org/2000/svg" width="18" height="24" viewBox="0 0 24 25" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-grid"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg> Tabs Feature</a>
												<?php /*
												<a class="dropdown-item nwsfts" href="javascript:void(0);" id="catsd_'.$prd_id.'">
													<svg xmlns="http://www.w3.org/2000/svg" width="18" height="24" viewBox="0 0 24 25" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-layers"><polygon points="12 2 2 7 12 12 22 7 12 2"></polygon><polyline points="2 17 12 22 22 17"></polyline><polyline points="2 12 12 17 22 12"></polyline></svg> Category Feature</a>
												
												<a class="dropdown-item nwsfts" href="javascript:void(0);" id="nmz_'.$prd_id.'">
													<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 25" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-hash"><line x1="4" y1="9" x2="20" y2="9"></line><line x1="4" y1="15" x2="20" y2="15"></line><line x1="10" y1="3" x2="8" y2="21"></line><line x1="16" y1="3" x2="14" y2="21"></line></svg> Category Feature</a>
												*/ ?>
												</div>
											</div>
		
										</div>
									</td>
								</tr>
								<?php
									endforeach;
								}
								else
								{ ?> <tr> 	<td colspan="2" class="text-center" >No Available Data.</td> </tr> <?php } ?>
							</tbody>
						</table>
					</div>
					
  
<script type="text/javascript" language="javascript" >

$(document).ready(function(){

$(document).on('click', '.nwsfts', function(){	
	var id = this.id;   var split_id = id.split("_"); var textnt = split_id[0]; var postid = split_id[1];
	
	swal({
	  title: 'Are you sure you want to Feature this Category', html: '', type: 'question',
	  showCancelButton: true, confirmButtonText: 'Yes, Feature', padding: '2em'
	}).then(function(result) {
		if (result.value) {
		$.ajax({
			url: 'actions/fetch_data.php', type: 'POST',
			data:  { 'featuringmenucategory':1, 'pstnt':textnt, 'pstrec':postid, },
			dataType:"json",beforeSend: function(){	
			$(".swal2-cancel").attr('disabled', 'disabled');
			$(".swal2-confirm").attr('disabled', 'disabled');
			$(".swal2-confirm").html('processing <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-aperture fa fa-spin"><circle cx="12" cy="12" r="10"></circle><line x1="14.31" y1="8" x2="20.05" y2="17.94"></line><line x1="9.69" y1="8" x2="21.17" y2="8"></line><line x1="7.38" y1="12" x2="13.12" y2="2.06"></line><line x1="9.69" y1="16" x2="3.95" y2="6.06"></line><line x1="14.31" y1="16" x2="2.83" y2="16"></line><line x1="16.62" y1="12" x2="10.88" y2="21.94"></line></svg>');
			},
			success: function(data) { donejob(data.runstt,data.runsttinfo); return; }
		});	
		}
	})
	
	return;
});

})
</script>
		<?php
		}
		?>
				</div>
				</div>	
				</div>
		
			</div>

		</div>

	</div>

</div>
 

  <div class="modal fade" id="subjects_Modal" tabindex="-1" role="dialog" aria-labelledby="catModalLabel" aria-hidden="true"  data-backdrop="static">
    <div class="modal-dialog" role="document">
	<form method="post" id="crtsub_form" enctype="multipart/form-data">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="ctsub">Product Menu</h5>
          <button class="close closecats" type="button" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">×</span>
          </button>
        </div>
        <div class="modal-body subinblk" style="display:block;">
		
		<div class="form-group ">
			<label class="text-dark font-weight-bold">Menu Name<code>*</code></label>
			<div class="input-group">
				<div class="input-group-prepend">
					<div class="input-group-text font-weight-bold bg-transparent">1.</div>
				</div>
				<input type="text" class="form-control" id="sing_subj" name="subjec[]" required />
			</div>
			<span id="" class="error_here text-left d-block"></span>
		</div>
		<?php
		if(empty($setup)){
		?>
		<div class="form-group" id="ctbnr" style="display:none;">
			<label class="text-dark font-weight-bold">Menu Banner</label>
			<div class="form-group">
				<input type="file" class="form-control" name="pic_a" />
			</div>
			<span id="" class="error_here text-left d-block"></span>
		</div>
		<?php
		}
		?>
		
		<div class="form-group ntsub">
			<div class="input-group">
				<div class="input-group-prepend">
					<div class="input-group-text font-weight-bold bg-transparent">2.</div>
				</div>
				<input type="text" class="form-control" name="subjec[]" />
			</div>
			<span id="" class="error_here text-left d-block"></span>
		</div>
		
		<div class="form-group ntsub">
			<div class="input-group">
				<div class="input-group-prepend">
					<div class="input-group-text font-weight-bold bg-transparent">3.</div>
				</div>
				<input type="text" class="form-control" name="subjec[]" />
			</div>
			<span id="" class="error_here text-left d-block"></span>
		</div>
		
		<div class="form-group ntsub">
			<div class="input-group">
				<div class="input-group-prepend">
					<div class="input-group-text font-weight-bold bg-transparent">4.</div>
				</div>
				<input type="text" class="form-control" name="subjec[]" />
			</div>
			<span id="" class="error_here text-left d-block"></span>
		</div>
		
		<div class="form-group ntsub">
			<div class="input-group">
				<div class="input-group-prepend">
					<div class="input-group-text font-weight-bold bg-transparent">5.</div>
				</div>
				<input type="text" class="form-control" name="subjec[]" />
			</div>
			<span id="" class="error_here text-left d-block"></span>
		</div>
		
		
		</div>
		
		<div class="modal-body forshwset" style="display:none;">
		
		</div>
		
        <div class="modal-footer">
			<input type="hidden" value="" name="subjid" id="subjid" />
			<?php if(!empty($setup) && !empty($fndur)) { ?> <input type="hidden" value="<?= $setup; ?>" name="menuname" id="menuname" />  <input type="hidden" value="" id="setmenu" name="setmenu" /> <?php } ?>
          <button class="btn btn-danger" type="button" data-dismiss="modal">Close/Cancel</button>
		  <button id="button_subbtn" name="button_subbtn"  type="submit" class="btn btn-secondary"> Submit
		  </button>
        </div>
      </div>
	  
	  </form>
	  
    </div>
  </div>


<script type="text/javascript" language="javascript" >

$(document).ready(function(){

<?php
if(!empty($setup)){
?>
$(document).on('click', '.subrecx', function(){
	var id = this.id; var split_id = id.split("_"); var text2 = split_id[1];
	$('.subinblk').show(); $('#button_subbtn').show();
	$("#button_subbtn").attr('disabled', false); $("#button_subbtn").html("Submit"); $("#sing_subj").attr('name','subjec[]');
	$("#subjid").val(''); $("#setmenu").val(id);
	$(".ntsub").each(function() { $(".ntsub").show(); });
	$('#ctsub').html('Sub Category Menu');	$('.forshwset').hide(); $('#subjects_Modal').modal('show');
	return;
});
<?php
}
?>
$(document).on('click', '#opentosubject', function(){
	$('.subinblk').show(); $('#button_subbtn').show(); $("#button_subbtn").attr('disabled', false); $("#button_subbtn").html("Submit"); $("#sing_subj").attr('name','subjec[]');
	$("#subjid,#setmenu").val(''); $(".ntsub").each(function() { $(".ntsub").show(); });  $('#ctbnr').hide();
	$('#ctsub').html('Product Menu Name');	$('.forshwset').hide(); $('#subjects_Modal').modal('show');
	return;
});

$('.editsubjs').on('click', function(event) {
	$('.forshwset').hide(); $('.subinblk').show(); $('#ctbnr').show();
	$("#button_subbtn").html('Submit'); $("#button_subbtn").attr('disabled', false); $('#button_subbtn').show();
    var getParentItem = $(this).parents('.tritem'); var getModal = $('#crtsub_form');
    var $_name = getParentItem.find('.subj-name'); var $_nameAttrValue = $_name.attr('data-subj'); var $_nameidAttrValue = $_name.attr('data-suid');
	$("#subjid,#setmenu").val(''); $("#sing_subj").attr('name','sinsubjec');
    var $_getModalNameInput = getModal.find('#sing_subj');  var $_setModalNameValue = $_getModalNameInput.val($_nameAttrValue);
    $('#subjid').val($_nameidAttrValue); $(".ntsub").each(function() { $(".ntsub").hide(); });
	
    $('#subjects_Modal').modal('show');

    $("#button_subbtn").off('click').click(function(){
      var getParent = $(this).parents('#crtsub_form'); var $_getInputName = getParent.find('#sing_subj');  var $_nameValue = $_getInputName.val(); $('#subjid').val() 
	  var  setUpdatedNameValue = $_name.text($_nameValue); var  setUpdatedAttrNameValue = $_name.attr('data-subj', $_nameValue); $('#subjects_Modal').modal('hide');
    });
	
});


$("#crtsub_form").on('submit',function(e) {
		e.preventDefault();	 var data = $("#crtsub_form").serialize();
		$.ajax({ url: 'actions/fr_category.php', type: 'POST',  data:  new FormData(this), contentType: false, cache: false, processData:false, beforeSend: function(){
		$("#button_subbtn").html('Submitting <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-loader spin mr-2"><line x1="12" y1="2" x2="12" y2="6"></line><line x1="12" y1="18" x2="12" y2="22"></line><line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line><line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line><line x1="2" y1="12" x2="6" y2="12"></line><line x1="18" y1="12" x2="22" y2="12"></line><line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line><line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line></svg>');
		$("#button_subbtn").attr('disabled', 'disabled'); },
		dataType:"json", success: function(response){
		donejob(response.runstt,response.dtct);
		$("#button_subbtn").html('Submit'); $("#button_subbtn").attr('disabled', false); $("#crtsub_form").trigger('reset');
		setTimeout( function(){ window.location.reload(); },4000);
		return true;
            }
        });
});

$('.viewsubjcls').on('click', function(event) {
	$('.subinblk').hide(); $('.forshwset').show(); $("#subjid").val(''); $('#button_subbtn').hide();
	var getParentItem = $(this).parents('.tritem'); var $_name = getParentItem.find('.subj-name'); var _nameAttrValue = $_name.attr('data-subj'); var _nameidAttrValue = $_name.attr('data-suid');
	$.ajax({ url: 'actions/fetch_data.php', type: 'POST', data: { 'fetch_clprdss':1, 'namesujid':_nameidAttrValue <?php if(!empty($setup)){ ?> , 'sgnmk': 'hsrec' <?php } ?> },
		beforeSend: function(){	$('#ctsub').html(_nameAttrValue);
			$(".forshwset").html('<div class="w-100 text-center"><svg xmlns="http://www.w3.org/2000/svg" width="70" height="70" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-loader spin m-auto"><line x1="12" y1="2" x2="12" y2="6"></line><line x1="12" y1="18" x2="12" y2="22"></line><line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line><line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line><line x1="2" y1="12" x2="6" y2="12"></line><line x1="18" y1="12" x2="22" y2="12"></line><line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line><line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line></svg></div>');
			$('#subjects_Modal').modal('show');
		},
		dataType:"json", success: function(response) { $(".forshwset").html(response.subjdata); return true; }
	});
});

	var userdataTable = $('#events_tbrecs').DataTable({
		"processing": true,	"serverSide": true, "order": [], "ajax" : {	url:"actions/fetch_events.php", type:"POST"	},
		"oLanguage": {
        "oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
        "sInfo": "Showing _START_ to _END_ of _TOTAL_ Events",
        "sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
        "sSearchPlaceholder": "Search event...","sLengthMenu": "Results :  _MENU_", "sInfoFiltered": "" },
		"stripeClasses": [],
		"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
		"pageLength": 10,
		drawCallback: function () { $('.dataTables_paginate > .pagination').addClass(' pagination-style-13 pagination-bordered mb-5'); }
	});
})
</script>
<?php
include "footer.php"; 
?>