<?php
if (!isset($_SESSION)) {
	session_start();
}
require_once("Connections/constants.php");
include("function/function.php");
$action = $_POST['act'];
$_SESSION['member_no'];

$apikey = $_SESSION['apikey'];
$username = $_SESSION['facility_name'];
$password = $_SESSION['password'];
$providerId = $_SESSION['provider_id'];
$principal_id = $_SESSION['principal_id'];


$imagepath = $_SERVER['DOCUMENT_ROOT'] .'/'.ROOTFOLDER."/assets/images/pharmacy/";
if ($action == "add_medication") {
    $name_medication = validateUserInputs($_POST['drugname']);
    $medication_desceription = validateUserInputs($_POST['medication_desceription']);
    $pharmacy_name = validateUserInputs($_POST['pharmacy_name']);
    $member_no1 = validateUserInputs($_POST['member_no']);

    if (!empty($_FILES['imageUpload']['name'])) {
        $date = new DateTime();
        $newFileName = $date->getTimestamp();
        $file_type = $_FILES['imageUpload']['type'];
        $allowed = array("image/jpeg", "image/gif", "image/png","image/jpg");
        if (!in_array($file_type, $allowed)) {
            $error_message = 'Only jpg, gif, and png files are allowed.';
            echo "<script>alert('$error_message')</script>";
            exit();
        }
        $user_image = $_FILES['imageUpload']['name'];
        $user_image1 = $newFileName . $user_image;
        $filepath = $imagepath . $user_image1;
        $user_image_tmp = $_FILES['imageUpload']['tmp_name'];
        move_uploaded_file($user_image_tmp, $filepath);
    }

    $SAVE_PERSONAL_MEDICATION = array(
        'METHOD' => urlencode('SAVE_PERSONAL_MEDICATION'),
        'APIKEY' => $apikey,
        'USERNAME' => $username,
        'PASSWORD' => $password,
        'PROVIDERID' => $providerId,
        'member_no' => $member_no1,
        'name_medication' => $name_medication,
        'medication_desceription' => $medication_desceription,
        'pharmacy_name' => $pharmacy_name,
        'user_image1' => $user_image1,

    );
    $get_saved_record_all = APICall($SAVE_PERSONAL_MEDICATION);
    $get_saved_record_json_all = json_decode($get_saved_record_all, "true");
    $savedRecord_all = $get_saved_record_json_all['RESULT'];


}else if ($action == "deleteMedication"){
        $delete_id = $_POST['id'];
        $DELETE_ITEM = array(
        'METHOD' => urlencode('DELETE_ITEM'),
        'APIKEY' => $apikey,
        'USERNAME' => $username,
        'PASSWORD' => $password,
        'PROVIDERID' => $providerId,
        'delete_id' => $delete_id,
    );
    $get_saved_record_delete = APICall($DELETE_ITEM);
    $get_saved_record_json_delete = json_decode($get_saved_record_delete, "true");
    $savedRecord_delete = $get_saved_record_json_delete['RESULT'];

}else if ($action == "update_medication"){
    if (!empty($_FILES['imageUpload_update']['name'])) {
        $date = new DateTime();
        $newFileName = $date->getTimestamp();
        $file_type = $_FILES['imageUpload_update']['type'];
        $allowed = array("image/jpeg", "image/gif", "image/png","image/jpg");
        if (!in_array($file_type, $allowed)) {
            $error_message = 'Only jpg, gif, and png files are allowed.';
            echo "<script>alert('$error_message')</script>";
            exit();
        }
        $user_image = $_FILES['imageUpload_update']['name'];
        $user_image1 = $newFileName . $user_image;
        $filepath = $imagepath . $user_image1;
        $user_image_tmp = $_FILES['imageUpload_update']['tmp_name'];
        move_uploaded_file($user_image_tmp, $filepath);
    }
    $update_id = $_POST['id'];
    $name_medication_update = validateUserInputs($_POST['drugname_update']);
    $medication_desceription_update = validateUserInputs($_POST['medication_desceription_update']);
    $pharmacy_name_update = validateUserInputs($_POST['pharmacy_name_update']);
    $member_no1_update = validateUserInputs($_POST['member_no_update']);

    $SAVE_PERSONAL_MEDICATION_UPDATE = array(
        'METHOD' => urlencode('SAVE_PERSONAL_MEDICATION_UPDATE'),
        'APIKEY' => $apikey,
        'USERNAME' => $username,
        'PASSWORD' => $password,
        'PROVIDERID' => $providerId,
        'update_id' => $update_id,
        'name_medication' => $name_medication_update,
        'medication_desceription' => $medication_desceription_update,
        'pharmacy_name' => $pharmacy_name_update,
        'user_image1' => $user_image1,

    );
    $get_saved_record_all = APICall($SAVE_PERSONAL_MEDICATION_UPDATE);
    $get_saved_record_json_all = json_decode($get_saved_record_all, "true");
    $savedRecord_all = $get_saved_record_json_all['RESULT'];

    //var_dump($SAVE_PERSONAL_MEDICATION_UPDATE);
}else if ($action == "add_allergies"){
    $reaction_medication = $_POST['reaction_medication'];
    $member_no1 = validateUserInputs($_POST['member_no']);

    $reaction_true_allergy = $_POST['reaction_true_allergy'];
    $reaction_side = $_POST['reaction_side'];
    $medication_taken = $_POST['medication_taken'];
    $medication_reaction = $_POST['medication_reaction'];
    $food_reaction = $_POST['food_reaction'];

    $duration = validateUserInputs($_POST['duration']);
    $duration_specific = validateUserInputs($_POST['duration_specific']);
    $duration_for_reaction = validateUserInputs($_POST['duration_for_reaction']);
    $reaction_medical_attention = validateUserInputs($_POST['reaction_medical_attention']);


    $location_seen = validateUserInputs($_POST['location_seen']);
    $medication_stopped = validateUserInputs($_POST['medication_stopped']);
    $similar_medication = validateUserInputs($_POST['similar_medication']);
    $new_problem = validateUserInputs($_POST['new_problem']);

$content ="";
foreach($reaction_true_allergy as $looped_value) {
     $content .= $looped_value.',';
}

//    foreach($reaction_side as $looped_value1) {
//        $content1 .= $looped_value1.',';
//    }

    foreach($medication_taken as $looped_value1) {
        $content2 .= $looped_value1.',';
    }

    foreach($medication_reaction as $looped_value2) {
        $content3 .= $looped_value2.',';
    }

    foreach($food_reaction as $looped_value3) {
        $content4 .= $looped_value3.',';
    }

//    $sqlVals = array();
//    foreach ($reaction_true_allergy as $id123){
//         echo $sqlVals = $id123.',';
//    }
     //$sqlVals; exit();

//
//    $sqlVals1 = array();
//    foreach ($reaction_side as $id1234){
//        $sqlVals1[] = $id1234.',';
//    }
//
//    $sqlVals2 = array();
//    foreach ($medication_taken as $id12345){
//        $sqlVals[] = $id12345.',';
//    }


    $SAVE_PERSONAL_ALLERGY = array(
        'METHOD' => urlencode('SAVE_PERSONAL_ALLERGY'),
        'APIKEY' => $apikey,
        'USERNAME' => $username,
        'PASSWORD' => $password,
        'PROVIDERID' => $providerId,
        'member_no' => $member_no1,
        'reaction_medication' => $reaction_medication,
        'reaction_true_allergy' => $content,
        'medication_taken' => $content2,

        'duration' => $duration,
        'duration_specific' => $duration_specific,
        'duration_for_reaction' => $duration_for_reaction,
        'reaction_medical_attention' => $reaction_medical_attention,
        'location_seen' => $location_seen,
        'medication_stopped' => $medication_stopped,
        'similar_medication' => $similar_medication,
        'new_problem' => $new_problem,
        'medication_reaction' => $content3,
        'food_reaction' => $content4,
    );
    //print_r(json_encode($SAVE_PERSONAL_ALLERGY)); exit();
    $get_saved_record_all = APICall($SAVE_PERSONAL_ALLERGY);
    $get_saved_record_json_all = json_decode($get_saved_record_all, "true");
    $savedRecord_all = $get_saved_record_json_all['RESULT'];


}else if ($action == "deleteAllergy"){
    $update_id = $_POST['id'];
    $DELETE_PERSONAL_ALLERGY = array(
        'METHOD' => urlencode('DELETE_PERSONAL_ALLERGY'),
        'APIKEY' => $apikey,
        'USERNAME' => $username,
        'PASSWORD' => $password,
        'PROVIDERID' => $providerId,
        'member_no' => $update_id,
    );
    $get_saved_record_all = APICall($DELETE_PERSONAL_ALLERGY);
    $get_saved_record_json_all = json_decode($get_saved_record_all, "true");
    $savedRecord_all = $get_saved_record_json_all['RESULT'];

    //var_dump($DELETE_PERSONAL_ALLERGY);
}


$GET_PRINCIPAL = array(
	'METHOD' => urlencode('GET_PRINCIPAL'),
	'APIKEY' => $apikey,
	'USERNAME' => $username,
	'PASSWORD' => $password,
	'PROVIDERID' => $providerId,
	'PRINCIPAL_ID' => $principal_id,

);
$get_saved_record = onlineJohnAPI($GET_PRINCIPAL);
$get_saved_record_json = json_decode($get_saved_record,"true");
$savedRecord = $get_saved_record_json['RESULT'];
if ($get_saved_record_json['STATCODE'] == "200") {
	foreach ($savedRecord as $savedRecords){
		$ins_company = $savedRecords['ins_company'];
		$member_no = $savedRecords['member_no'];
		$member_plan = $savedRecords['member_plan'];
		$surname = $savedRecords['surname'];
		$firstname = $savedRecords['firstname'];
	}
	$fullname = $surname.' '.$firstname;
}
//print_r($savedRecord);

?>
<div class="row">
	<div class="col-md-3">
		<div class="kt-portlet">
			<div class="kt-portlet__body">
				<div class="kt-widget kt-widget--user-profile-1">
					<div class="kt-widget__head">
						<div class="kt-widget__media">
							<?php
							if(empty($_SESSION['picpath'])){?>
								<img alt='no_photo' width='11' height='40' src='<?php echo BASE_URL ?>assets/images/avatar-placeholder.png' style='text-align:center; width: 115px; height:115px; object-fit: cover;'>
							<?php }else{?>

								<div class="demo-gallery" style="width: 100px">
									<ul id="lightgallery" class="list-unstyled row">

										<li class="col-xs-12 col-sm-12 col-md-12" data-responsive="<?php echo $_SESSION['picpath'] ?> 375, <?php echo $_SESSION['picpath'] ?> 480, <?php echo $_SESSION['picpath'] ?> 800" data-src="<?php echo $_SESSION['picpath'] ?>" data-sub-html="">
											<a href="">
												<img class="img-responsive" src="<?php echo $_SESSION['picpath'] ?>" style='text-align:center; height:115px; object-fit: cover;'>
											</a>
										</li>
									</ul>
								</div>
							<?php }
							?>
						</div>
						<div class="kt-widget__content">
							<div class="kt-widget__section">
								<a href="#" class="kt-widget__username">
									<?php echo ucfirst($_SESSION['myMM_Fullname']) ?>
									<!-- <i class="flaticon2-correct kt-font-success"></i> -->
								</a>
								<span class="kt-widget__subtitle">
									<?php echo ucfirst($_SESSION['employer']) ?>
								</span>
							</div>
							<div class="kt-widget__action">
								<button type="button" class="btn btn-info btn-sm" style="font-size: 10px; font-weight: 100; margin-right: 0.1rem"><?php echo ucfirst($_SESSION['member_type']) ?></button>&nbsp;
								<button type="button" class="btn btn-success btn-sm" style="font-size: 10px; font-weight: 100; margin-right: 0.1rem">Verified</button>
							</div>
						</div>
					</div>
					<div class="kt-widget__body">
						<div class="kt-widget__content">
							<?php if($_SESSION['member_type'] == "Dependent"){ ?>
								<div class="kt-widget__info">
									<span class="kt-widget__label" style="color: #000000">Principal Name:</span>
									<a href="javascript:;" class="kt-widget__data"><?php echo ucwords($fullname) ?></a>
								</div>
							<?php } ?>

							<div class="kt-widget__info">
								<span class="kt-widget__label" style="color: #000000">Phone:</span>
								<a href="javascript:;" class="kt-widget__data"><?php echo $_SESSION['telephone'] ?></a>
							</div>

							<div class="kt-widget__info">
								<span class="kt-widget__label" style="color: #000000">Email:</span>
								<a href="javascript:;" class="kt-widget__data"><?php echo $_SESSION['email'] ?></a>
							</div>

							<div class="kt-widget__info">
								<span class="kt-widget__label" style="color: #000000">Plan:</span>
								<span class="kt-widget__data"><span class="kt-badge <?php if($_SESSION['member_plan']=="STANDARD [GS10-GS20]"){echo "kt-badge--warning"; }else if($_SESSION['member_plan']=="STANDARD PLUS [GS30-GS40]"){echo "kt-badge--primary"; }else if($_SESSION['member_plan']=="PREMIUM [GS50-GS70]"){ echo "kt-badge--success"; }else if($_SESSION['member_plan'] == "PREMIUM PLUS [GS80-GS100]"){ echo "kt-badge--success"; } ?>  kt-badge--inline kt-badge--pill"><?php echo strtoupper($_SESSION['member_plan']) ?></span></span>
							</div>


						</div>
						<div class="kt-widget__items">
							<a onclick="getstep2('searchByDrug','<?php echo $recordId ?>')" class="kt-widget__item">
								<span class="kt-widget__section">
									<span class="kt-widget__icon">
										<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
											<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
												<polygon id="Bound" points="0 0 24 0 24 24 0 24" />
												<path d="M12.9336061,16.072447 L19.36,10.9564761 L19.5181585,10.8312381 C20.1676248,10.3169571 20.2772143,9.3735535 19.7629333,8.72408713 C19.6917232,8.63415859 19.6104327,8.55269514 19.5206557,8.48129411 L12.9336854,3.24257445 C12.3871201,2.80788259 11.6128799,2.80788259 11.0663146,3.24257445 L4.47482784,8.48488609 C3.82645598,9.00054628 3.71887192,9.94418071 4.23453211,10.5925526 C4.30500305,10.6811601 4.38527899,10.7615046 4.47382636,10.8320511 L4.63,10.9564761 L11.0659024,16.0730648 C11.6126744,16.5077525 12.3871218,16.5074963 12.9336061,16.072447 Z" id="Shape" fill="#000000" fill-rule="nonzero" />
												<path d="M11.0563554,18.6706981 L5.33593024,14.122919 C4.94553994,13.8125559 4.37746707,13.8774308 4.06710397,14.2678211 C4.06471678,14.2708238 4.06234874,14.2738418 4.06,14.2768747 L4.06,14.2768747 C3.75257288,14.6738539 3.82516916,15.244888 4.22214834,15.5523151 C4.22358765,15.5534297 4.2250303,15.55454 4.22647627,15.555646 L11.0872776,20.8031356 C11.6250734,21.2144692 12.371757,21.2145375 12.909628,20.8033023 L19.7677785,15.559828 C20.1693192,15.2528257 20.2459576,14.6784381 19.9389553,14.2768974 C19.9376429,14.2751809 19.9363245,14.2734691 19.935,14.2717619 L19.935,14.2717619 C19.6266937,13.8743807 19.0546209,13.8021712 18.6572397,14.1104775 C18.654352,14.112718 18.6514778,14.1149757 18.6486172,14.1172508 L12.9235044,18.6705218 C12.377022,19.1051477 11.6029199,19.1052208 11.0563554,18.6706981 Z" id="Path" fill="#000000" opacity="0.3" />
											</g>
										</svg> </span>
										<span class="kt-widget__desc">
											Search by Drugs
										</span>
									</span>
								</a>
								<a onclick="getstep2('searchByProvider', '<?php echo $clientId ?>','editFromAccount')" class="kt-widget__item ">
									<span class="kt-widget__section">
										<span class="kt-widget__icon">
											<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
												<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
													<rect id="bound" x="0" y="0" width="24" height="24"/>
													<rect id="Combined-Shape" fill="#000000" opacity="0.3" x="2" y="3" width="20" height="18" rx="2"/>
													<path d="M9.9486833,13.3162278 C9.81256925,13.7245699 9.43043041,14 9,14 L5,14 C4.44771525,14 4,13.5522847 4,13 C4,12.4477153 4.44771525,12 5,12 L8.27924078,12 L10.0513167,6.68377223 C10.367686,5.73466443 11.7274983,5.78688777 11.9701425,6.75746437 L13.8145063,14.1349195 L14.6055728,12.5527864 C14.7749648,12.2140024 15.1212279,12 15.5,12 L19,12 C19.5522847,12 20,12.4477153 20,13 C20,13.5522847 19.5522847,14 19,14 L16.118034,14 L14.3944272,17.4472136 C13.9792313,18.2776054 12.7550291,18.143222 12.5298575,17.2425356 L10.8627389,10.5740611 L9.9486833,13.3162278 Z" id="Path-108" fill="#000000" fill-rule="nonzero"/>
													<circle id="Oval" fill="#000000" opacity="0.3" cx="19" cy="6" r="1"/>
												</g>
											</svg> </span>
											<span class="kt-widget__desc">
												Search by Provider
											</span>
										</span>
									</a>

									<a onclick="getstep2('otherPlans', '<?php echo $clientId ?>','editFromAccount')" class="kt-widget__item ">
										<span class="kt-widget__section">
											<span class="kt-widget__icon">
												<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
													<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
														<polygon id="Shape" points="0 0 24 0 24 24 0 24"/>
														<path d="M5.85714286,2 L13.7364114,2 C14.0910962,2 14.4343066,2.12568431 14.7051108,2.35473959 L19.4686994,6.3839416 C19.8056532,6.66894833 20,7.08787823 20,7.52920201 L20,20.0833333 C20,21.8738751 19.9795521,22 18.1428571,22 L5.85714286,22 C4.02044787,22 4,21.8738751 4,20.0833333 L4,3.91666667 C4,2.12612489 4.02044787,2 5.85714286,2 Z" id="Combined-Shape" fill="#000000" fill-rule="nonzero" opacity="0.3"/>
														<rect id="Rectangle" fill="#000000" x="6" y="11" width="9" height="2" rx="1"/>
														<rect id="Rectangle-Copy" fill="#000000" x="6" y="15" width="5" height="2" rx="1"/>
													</g>
												</svg> </span>
												<span class="kt-widget__desc">
													Other Plans
												</span>
											</span>
										</a>

										<a onclick="getstep2('dependants', '<?php echo $clientId ?>','editFromAccount')" class="kt-widget__item ">
											<span class="kt-widget__section">
												<span class="kt-widget__icon">
													<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
														<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
															<polygon id="Shape" points="0 0 24 0 24 24 0 24" />
															<path d="M12,11 C9.790861,11 8,9.209139 8,7 C8,4.790861 9.790861,3 12,3 C14.209139,3 16,4.790861 16,7 C16,9.209139 14.209139,11 12,11 Z" id="Mask" fill="#000000" fill-rule="nonzero" opacity="0.3" />
															<path d="M3.00065168,20.1992055 C3.38825852,15.4265159 7.26191235,13 11.9833413,13 C16.7712164,13 20.7048837,15.2931929 20.9979143,20.2 C21.0095879,20.3954741 20.9979143,21 20.2466999,21 C16.541124,21 11.0347247,21 3.72750223,21 C3.47671215,21 2.97953825,20.45918 3.00065168,20.1992055 Z" id="Mask-Copy" fill="#000000" fill-rule="nonzero" />
														</g>
													</svg> </span>
													<span class="kt-widget__desc">
														<?php if($_SESSION['member_type'] == "Dependent"){ echo "Other Dependents"; }else{ echo "Dependents"; } ?>
														
													</span>
												</span>
											</a>

											<a onclick="getstep2('visit_history', '<?php echo $_SESSION['member_no'] ?>','<?php echo $fullname ?>')" class="kt-widget__item ">
												<span class="kt-widget__section">
													<span class="kt-widget__icon">
														<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
															<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
																<rect id="bound" x="0" y="0" width="24" height="24"/>
																<path d="M3.5,21 L20.5,21 C21.3284271,21 22,20.3284271 22,19.5 L22,8.5 C22,7.67157288 21.3284271,7 20.5,7 L10,7 L7.43933983,4.43933983 C7.15803526,4.15803526 6.77650439,4 6.37867966,4 L3.5,4 C2.67157288,4 2,4.67157288 2,5.5 L2,19.5 C2,20.3284271 2.67157288,21 3.5,21 Z" id="Combined-Shape" fill="#000000"/>
															</g>
														</svg>
													</span>
													<span class="kt-widget__desc">
														Visit History
													</span>
												</span>
											</a>

                            <a onclick="getstep2('drug_history', '<?php echo $_SESSION['member_no'] ?>','<?php echo $fullname ?>')" class="kt-widget__item ">
												<span class="kt-widget__section">
													<span class="kt-widget__icon">
														<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
															<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
																<rect id="bound" x="0" y="0" width="24" height="24"/>
																<path d="M3.5,21 L20.5,21 C21.3284271,21 22,20.3284271 22,19.5 L22,8.5 C22,7.67157288 21.3284271,7 20.5,7 L10,7 L7.43933983,4.43933983 C7.15803526,4.15803526 6.77650439,4 6.37867966,4 L3.5,4 C2.67157288,4 2,4.67157288 2,5.5 L2,19.5 C2,20.3284271 2.67157288,21 3.5,21 Z" id="Combined-Shape" fill="#000000"/>
															</g>
														</svg>
													</span>
													<span class="kt-widget__desc">
														 Medication Diary
													</span>
												</span>
                            </a>

                            <a onclick="getstep2('allergy_history', '<?php echo $_SESSION['member_no'] ?>','<?php echo $fullname ?>')" class="kt-widget__item ">
												<span class="kt-widget__section">
													<span class="kt-widget__icon">
														<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1" class="kt-svg-icon">
															<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
																<rect id="bound" x="0" y="0" width="24" height="24"/>
																<path d="M3.5,21 L20.5,21 C21.3284271,21 22,20.3284271 22,19.5 L22,8.5 C22,7.67157288 21.3284271,7 20.5,7 L10,7 L7.43933983,4.43933983 C7.15803526,4.15803526 6.77650439,4 6.37867966,4 L3.5,4 C2.67157288,4 2,4.67157288 2,5.5 L2,19.5 C2,20.3284271 2.67157288,21 3.5,21 Z" id="Combined-Shape" fill="#000000"/>
															</g>
														</svg>
													</span>
													<span class="kt-widget__desc">
														My Allergies
													</span>
												</span>
                            </a>

										</div>
									</div>
								</div>
							</div>

						</div>
					</div>

    <script src="<?php echo BASE_URL ?>assets/vendors/general/jquery/dist/jquery.js" type="text/javascript"></script>
    <script src="<?php echo BASE_URL ?>assets/js/leftmenu.js?v=<?php echo rand(); ?>" type="text/javascript"></script>

					<div class="col-md-9">
						<div class="kt-portlet">

							<script>
							//$(document ).ready(function() {
								//alert('ywyeuwy');
								getstep2('searchByDrug_load_graph','<?php echo $recordId ?>')
                   // });
                           </script>

                            <?php if ($action == "add_medication"){ ?>
                                <script>
                                    // $( document ).ready(function() {
                                        alert('sdsds');
                                        getstep2('drug_history', '<?php echo $_SESSION['member_no'] ?>','<?php echo $fullname ?>')
                                    //});
                                </script>
                            <?php } ?>


               <div class="" id="client_area">

               </div>

           </div>
       </div>
   </div>



   <script type="text/javascript">
   	$(document).ready(function(){
   		$('#lightgallery').lightGallery();
   	});
   </script>

