<!DOCTYPE html>
<html lang="en">    
<head>
<meta charset="utf-8" />
<title> Assign Anganwadi</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="" />
<meta content="Indev Consultancy Pvt. Ltd." name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="assets/images/fav.png">
<link href="assets/css/app.min.css" id="app-stylesheet" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="assets/transfer/icon_font/css/icon_font.css">
<link rel="stylesheet" type="text/css" href="assets/transfer/css/jquery.transfer.css?v=0.0.3">
</head>
<body data-layout="horizontal" data-topbar="light">
<div id="wrapper">
<?php include("include/header.php");?>
<div class="content-page">
<div class="content">
<div class="page-title-box">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="d-flex d-title-box-block align-items-center justify-content-between">
<h4 class="page-title">Assign Anganwadi</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="dashboard.php">Home</a></li>
<li class="breadcrumb-item active">Assign Anganwadi</li>
</ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xl-12">
<div class="card-box project-box">
<form action="" method="post" id="anganwadi-assign">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label class="col-form-label"> Select user to assign:</label>
<select class="form-control select2" name="user" id="user" required>
<option>Select An User</option>
<option value="1">User 1</option>
<option value="2">User 2</option>
<option value="3">User 3</option>
<option value="4">User 4</option>
<option value="5">User 5</option>
<option value="6">User 6</option>
<option value="7">User 7</option>
<option value="8">User 8</option>
<option value="9">User 9</option>
<option value="10">User 10</option>
<option value="11">User 11</option>
</select>
</div>
</div>
<div class="col-lg-12">
   <div id="transfer" class="transfer-demo"></div>
</div>
<input type="hidden" name="assignedfarmer" id="sf">


<div class="col-md-12 text-right">
<div class="form-group mt-3">
<input type="button" class="btn btn-primary btn-rounded w-md waves-effect waves-light" name="submit-form" id="select_all" onClick="selectall()" value="Submit">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div> 
</div> 
<?php include("include/footer.php");?>
</div>
</div>
<script src="assets/js/vendor.min.js"></script>
<script src="assets/js/app.min.js"></script>
<script src="assets/libs/select2/select2.full.min.js"></script>
<script src="assets/libs/moment/moment.js"></script>
<script src="assets/libs/multiselect/jquery.multi-select.js"></script>
<script src="assets/libs/select2/select2.full.min.js"></script>
<script src="assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="assets/libs/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="assets/libs/jquery-mask-plugin/jquery.mask.min.js"></script>
<script src="assets/libs/dropify/dropify.min.js"></script>
<script src="assets/js/custom.js"></script>

<script type="text/javascript" src="assets/transfer/js/jquery.transfer.js?v=0.0.6"></script>
<script type="text/javascript">
var dataArray = [
				
	{
		"anganwadi-name": "Anganwadi 1",
		"value": 1,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 2",
		"value": 2,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 3",
		"value": 3,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 4",
		"value": 4,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 6",
		"value": 5,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 7",
		"value": 6,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 8",
		"value": 7,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 9",
		"value": 8,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 10",
		"value": 9,
		"selected": false,
	},
	 
					
	 {
		"anganwadi-name": "Anganwadi 11",
		"value": 10,
		"selected": false,
	},
	 
		   
	
	];
	
	var settings = {
	"dataArray": dataArray,
	"itemName": "anganwadi-name",
	"valueName": "value",
	"callable": function (items) {
	//console.dir(items)
	}
	};
	
	var transfer = $("#transfer").transfer(settings);
	
	
	//console.log("Manually get selected items: %o", items);
	
	function selectall() {
	
	  var username = $("#user");
	  
		  //If the "Please Select" option is selected display error.
		  
		var result = [];
		var items = transfer.getSelectedItems()
		// console.log(this.items);
		objArray = items;
		result = objArray.map(({ value }) => value)
		var jsonString = JSON.stringify(result);
		//console.log(jsonString);
		$('#sf').val(jsonString);
		//document.theForm.submit();
		$("#anganwadi-assign").submit();
		
	}

</script>


</body>
</html>