/*-----------------------------------------------------------------------------
	Name: A01_MPD_010b_GenPg_Srch_Zip_PolicyToAdd.c
	Recorded By: Converted via tool
	Date of recording:
	Flow details:
	Build details:
	Modification History:
-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ns_string.h"

void A01_MPD_010b_GenPg_Srch_Zip_PolicyToAdd()
{
	//ns_page_think_time(think_time);

	/* search FN/LN/DOB */

	

	/* slect policy to add - check box */

	
ns_start_transaction("A01_AZ_024_MPD_ZipSrch_PoltoAddCheckBox");

	//addDynaTraceHeader("NA=A01_AZ_024_MPD_ZipSrch_PoltoAddCheckBox;PC=flow_24");
	ns_web_url("Zip_PolicyToAdd",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded", 
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t28.inf", 
		ITEMDATA,
		"Name=autoOtherPolicySearchForm:searchById","Value=customer",
		"Name=autoOtherPolicySearchForm:orderFirstName","Value={P_ZipFname}",
		"Name=autoOtherPolicySearchForm:orderLastName","Value={P_ZipLname}",
		"Name=autoOtherPolicySearchForm:orderDobInputDate","Value=",
		"Name=autoOtherPolicySearchForm:orderDobInputCurrentDate","Value={C_InsuredInputCurrentDate_02}",
		"Name=autoOtherPolicySearchForm:orderZipCode","Value={P_ZipZipCode}",
		"Name=autoOtherPolicySearchForm:orderAddressLine1","Value=",
		"Name=autoOtherPolicySearchForm:orderCity","Value={C_City_02}",
		"Name=autoOtherPolicySearchForm:riskStateDropdown","Value=AZ",
		"Name=autoOtherPolicySearchForm:orderMembershipNumber","Value=",
		"Name=autoOtherPolicySearchForm:orderPhoneNumber","Value=",
		"Name=autoOtherPolicySearchForm:orderEmailAddress","Value=",
		"Name=autoOtherPolicySearchForm:hideSearch","Value=false",
		"Name=autoOtherPolicySearchForm:enableAddSelected","Value=false",
		"Name=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_01}:customerSelected","Value=true",
		"Name=autoOtherPolicySearchForm_SUBMIT","Value=1",
		"Name=javax.faces.ViewState","Value={C_VSPrefillPage_02}",
		"Name=javax.faces.behavior.event","Value=click",
		"Name=org.richfaces.ajax.component","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_01}:customerSelected",
		"Name=AJAX:EVENTS_COUNT","Value=1",
		"Name=javax.faces.partial.event","Value=click",
		"Name=javax.faces.source","Value=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_01}:customerSelected",
		"Name=javax.faces.partial.ajax","Value=true",
		"Name=javax.faces.partial.execute","Value=@component autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_01}:customerSelected",
		"Name=javax.faces.partial.render","Value=@component",
		"Name=autoOtherPolicySearchForm","Value=autoOtherPolicySearchForm",
		ITEMDATA_END
		);
	
	ns_end_transaction("A01_AZ_024_MPD_ZipSrch_PoltoAddCheckBox",NS_AUTO_STATUS);
	//ns_page_think_time(think_time);
	
	/* add selected */

	
	ns_start_transaction("A01_AZ_025_MPD_ZipSrch_AddSelected");

	//addDynaTraceHeader("NA=A01_AZ_025_MPD_ZipSrch_AddSelected;PC=flow_25");
	ns_web_url("Zip_ADDSelected",
		"URL={P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Method=POST", 
		//"HEADER=Faces-Request:partial/ajax",
		"HEADER=Origin:{P_URL}",
        	"HEADER=Content-Type:application/x-www-form-urlencoded", 
		"HEADER=Referer: {P_URL}/aaa-app/flow?_flowId=quote-main-flow&_flowExecutionKey=e4s1&_windowId={C_windowID}", 
		"Snapshot=t29.inf", 
		ITEMDATA, 
		"Name=autoOtherPolicySearchForm:searchById", "Value=customer",  
		"Name=autoOtherPolicySearchForm:orderFirstName", "Value={P_ZipFname}",  
		"Name=autoOtherPolicySearchForm:orderLastName", "Value={P_ZipLname}",  
		"Name=autoOtherPolicySearchForm:orderDobInputDate", "Value=",  
		"Name=autoOtherPolicySearchForm:orderDobInputCurrentDate", "Value={C_InsuredInputCurrentDate_02}",  
		"Name=autoOtherPolicySearchForm:orderZipCode", "Value={P_ZipZipCode}",  
		"Name=autoOtherPolicySearchForm:orderAddressLine1", "Value=",  
		"Name=autoOtherPolicySearchForm:orderCity", "Value={C_City_02}",  
		"Name=autoOtherPolicySearchForm:riskStateDropdown", "Value=AZ",  
		"Name=autoOtherPolicySearchForm:orderMembershipNumber", "Value=",  
		"Name=autoOtherPolicySearchForm:orderPhoneNumber", "Value=",  
		"Name=autoOtherPolicySearchForm:orderEmailAddress", "Value=",  
		"Name=autoOtherPolicySearchForm:hideSearch", "Value=false",  
		"Name=autoOtherPolicySearchForm:enableAddSelected", "Value=false",  
		"Name=autoOtherPolicySearchForm:elasticSearchResponseTable:{C_SelChkboxID_01}:customerSelected", "Value=true",  
		"Name=autoOtherPolicySearchForm:btnAddSelected", "Value=Add Selected",  
		"Name=autoOtherPolicySearchForm_SUBMIT", "Value=1",  
		"Name=javax.faces.ViewState", "Value={C_VSPrefillPage_02}",  
		ITEMDATA_END
		);
	
	//lr_end_transaction("A01_AZ_025_MPD_ZipSrch_AddSelected",LR_AUTO);
	
	if(atoi(ns_eval_string("{SuccessAdd}"))>0){
		
			ns_end_transaction("A01_AZ_025_MPD_ZipSrch_AddSelected", NS_SUCCESS_STATUS);
			printf( " User: [%s] has Successfully Searched and retrieved ",ns_eval_string("{P_Username}"));
			printf( " Other AAA OWned Policy: [%s]",ns_eval_string("{P_ZipPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_ZipFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_ZipLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By ZipCode: [%s]",ns_eval_string("{P_ZipZipCode}"));
	}else{
		ns_end_transaction("A01_AZ_025_MPD_ZipSrch_AddSelected", NS_SUCCESS_STATUS);
		
			printf( " User: [%s] has Failed for retrieving ",ns_eval_string("{P_Username}"));
			printf( " Other AAA OWned Policy: [%s]",ns_eval_string("{P_ZipPolNum}"));
			printf( " for Customer with First Name: [%s] & ",ns_eval_string("{P_ZipFname}"));
			printf( " Last Name: [%s] on ",ns_eval_string("{P_ZipLname}"));
			printf( " URL: [%s] ",ns_eval_string("{P_URL}"));
			printf( " for Search By ZipCode: [%s]",ns_eval_string("{P_ZipZipCode}"));

			ns_exit_session();
	}
	
}
