<?php
/**
* Template Name: Swyft Logistics CN#
*/
get_header();
?>
<div id="Content">
	<div class="content_wrapper clearfix">
		<div class="sections_group">
			<div class="entry-content" itemprop="mainContentOfPage">
				<div class="section the_content has_content">
					<div class="section_wrapper">
						<div class="the_content_wrapper">
					<?php
							
							

					if( current_user_can('administrator') ) {
					
					while ( have_posts() ) {
					?><h2>Swyft Logistics Booking</h2>
					<?php	
						the_post();
						$mfn_builder = new Mfn_Builder_Front( get_the_ID() );
						$mfn_builder->show();	
					}
						
					$mnpstatus[]="A";
					$mnpstatus[]="B";
					$mnpstatus[]="C";		
					
					print_r ($mnpstatus);
					
					$result = "{'data':[{'consigneeName':'Shazim Tahir','consigneeEmail':'mfa@fahadamer.com','consigneePhone':'03234823024','consigneeAddress':'2F2 Johar Town Lahore . ' ' . ','consigneeCity':'Lahore','parcelId':'LHE604895718263','qty':1,'weight':0,'specialHandlings':'','description':'1 VEGA.pk Product(s)','orderId':'2806','shipperName':'VEGA.PK','shipperAddress':'Warehouse: House#2 Block F2 Johar Town Lahore.','shipperCity':'Lahore','paymentMode':'COD','amount':798}]}";
					
					print_r ($result);
					echo "<hr >";
																
					$result = (explode(",",$result));
					print_r ($result);
					echo "<hr >";
					$cn = (explode(":",$result[5]));
					$cn = str_replace("'","",$cn[1]);
						
					echo "<strong>CN:</strong> ".$cn;
					
					echo "<hr>";
						
					$result = "{'error':{'message':'Invalid SHIPPER_ADDRESS_ID','stack':'Error: Invalid SHIPPER_ADDRESS_ID\n at module.exports (/home/ubuntu/backend/common/modules/parcel-management/api/api-parcel-creation.action.js:27:21)','statusCode':422,'extraInfo':{'systemErrorCode':'003','description':'Either parcel required attributes is missing or attributes type is incorrect. Invalid parcel data.'}}}";
						
					print_r ($result);
					echo "<hr >";
																
					$result = (explode(",",$result));
					print_r ($result);
					echo "<hr >";
					$cn = (explode(":",$result[5]));
					$cn = str_replace("'","",$cn[1]);
					
					if ($cn == ""){
						echo "Error";
					}
					echo "<strong>CN:</strong> ".$cn;
						
						
						
						
						
						
						
//
//					echo "<hr >";	
//					if ($status == "false" ){
//						$msg = (explode(":",$result[1]));
//						$msg = str_replace('"','',$msg[1]);
//						$note = "MNP booking status: ".$msg;}
//					else {
//						$cn = (explode(":",$result[2]));
//						$cn = str_replace('}]','',$cn[1]);
//						$cn = str_replace('"','',$cn);	
//						$note = "MNP booking CN#: ".$cn;}
//						
//					echo "<strong>Order note:</strong> ".$note;
//						
//					// Add the note
//					$order->add_order_note( $note );
//					// END  - bookingatmnp   
					}
					?>
							<br /><br /><br />
						</div>
					</div>
				</div>				
			</div>
		</div>
	</div>
</div>
<?php get_footer();