<?php require_once '../../masterpage/webservice_master.php'; 
	
	header("Access-Control-Allow-Origin: *");
 	$rand=rand();
extract($_POST);
if(isset($_POST['lfs_asign_survey'])){
foreach($_POST['lfs_asign_survey'] as $lfs_asign_survey) {
	
if($lfs_asign_survey['Signature']!='' && $lfs_asign_survey['Signature']!='null'){
	define('UPLOAD_DIR', '../../../images/sing/');
	$img = $lfs_asign_survey['Signature'];
	$img = str_replace('data:image/png;base64,', '', $img);
	$img = str_replace(' ', '+', $img);
	$data = base64_decode($img);
	$imagename = uniqid() . '.png';
	$file = UPLOAD_DIR.$imagename ;
	$success = file_put_contents($file, $data);

}else{
	$imagename = '';
}

	$field_new = array('surveyor_ID','surveyor_Type','surveyType_ID','project_ID','isStarted','isCompletedBySurveyor','isCompleted','Signature','isReassing','LastupdatedDate','createdBy','updatedBy','createdDate','updatedDate','isActive','isDelete');
	$value_new = array($lfs_asign_survey['surveyor_ID'],$lfs_asign_survey['surveyor_Type'],$lfs_asign_survey['surveyType_ID'],$lfs_asign_survey['project_ID'],$lfs_asign_survey['isStarted'],$lfs_asign_survey['isCompletedBySurveyor'],$lfs_asign_survey['isCompleted'],$imagename,$lfs_asign_survey['isReassing'],$lfs_asign_survey['LastupdatedDate'],$lfs_asign_survey['createdBy'],$lfs_asign_survey['updatedBy'],$lfs_asign_survey['createdDate'],$lfs_asign_survey['updatedDate'],$lfs_asign_survey['isActive'],$lfs_asign_survey['isDelete']);

 		$condi="asign_ID=".$lfs_asign_survey['asign_ID'];

	$assign_surveyor = $obj->update($field_new,$value_new,$condi,'lfs_asign_survey');
}
}
	if(!empty($assign_surveyor)){
		echo json_encode(1);
	}
	else
	{
		echo json_encode(0);
	}

?>
