<?php
session_start();
	include("connect.php");	
	header("Access-Control-Allow-Origin: *");
	$cmpmid = $_SESSION['linkarisecmpmid'];

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
	}

	$eve = "select * from res_inquirystage_master where cmpmid=$cmpmid";
	$re = mysqli_query($conn, $eve);


	$response = array();
	$posts = array();

	$result="0";

	if(mysqli_num_rows($re) > 0)
	{
		$i=1;
		 while($rt = mysqli_fetch_assoc($re))
		 {

				$unitmid=$rt['ismid'];
				$umidedit="<a href='inquirystageedit.php?id=".$rt['ismid']."'data-toggle='tooltip' data-placement='top' title='Edit' class='fa fa-edit fa-lg' >  </a>";
				
				
				$umiddelete="<a href='inquirystagedelete.php?id=".$rt['ismid']."' onclick='return confirm(&#39;Are you sure you want to delete ?&#39;);' data-toggle='tooltip' data-placement='top' title='Delete' class='far fa-trash-alt fa-lg'>  </a>";

				$op=$umidedit."&nbsp;&nbsp;&nbsp;".$umiddelete;
				

			

				$unitname=str_replace ("'","'",$rt['inquirystagename']);
				$unitname=str_replace ('"','\"',$unitname);
				
				
				



				$posts[] = array('unitmid'=> $i++,'op'=> $op,'uname'=> $unitname);




		 }

		$response['posts'] = $posts;
		echo stripslashes(json_encode( array('data' => $posts)));
		mysqli_close($conn);
		return;
	}

   else
   {
		$result="0";
		$msg="Invalid Error";

		$posts[] = array('p1'=> $result,'p2'=> $msg);

		$response['posts'] = $posts;
		echo stripslashes(json_encode( array('item' => $posts)));
   }

	mysqli_close($conn);


?>
