Commit b9d9b6ef by Jansa Jose

Merge branch 'jansa'

parents 2436d1a4 a3dd8ea9
...@@ -42,16 +42,16 @@ class Webservice extends CI_Controller { ...@@ -42,16 +42,16 @@ class Webservice extends CI_Controller {
$ress = $this->cpf_valid($data['cpf']); $ress = $this->cpf_valid($data['cpf']);
if((isset($ress)) && ($ress == 1)){ if((isset($ress)) && ($ress == 1)){
/*$is_cpf = $this->Webservice_model->is_cpf_exist($data['cpf']); $is_cpf = $this->Webservice_model->is_cpf_exist($data['cpf']);
if($is_cpf['status'] == 'success'){*/ if($is_cpf['status'] == 'success'){
$res = $this->registration_processing_user($data,$type); $res = $this->registration_processing_user($data,$type);
/*}else{ }else{
$res = array( $res = array(
"status"=> "error", "status"=> "error",
"error"=> "CPF Exist", "error"=> "CPF Exist",
"message"=> "CPF Already Exist" "message"=> "CPF Already Exist"
); );
}*/ }
}else{ }else{
$res = array( $res = array(
"status"=> "error", "status"=> "error",
...@@ -2060,46 +2060,55 @@ class Webservice extends CI_Controller { ...@@ -2060,46 +2060,55 @@ class Webservice extends CI_Controller {
// $data['dob'] = strtotime($dob); // $data['dob'] = strtotime($dob);
$ress = $this->cpf_valid($data['dependent_cpf']); $ress = $this->cpf_valid($data['dependent_cpf']);
if($ress == '1'){ if($ress == '1'){
$auth_result = $this->Webservice_model->get_userid_frm_authtoken($headers['Auth']); $is_cpf = $this->Webservice_model->is_cpf_exist($data['dependent_cpf']);
$fileName =$auth_result->userid.'_'.$_FILES['dependent_image']['name']; if($is_cpf['status'] == 'error'){
$fileName = str_replace('%','a',$fileName); $res = array(
$config = set_upload_options('../assets/uploads/profilepic/patient_dependent/');
$config['file_name'] = $fileName;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('dependent_image')) {
$error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"message"=> "Sorry! Profile Photo not uploaded".$error['error']
);
}
else {
$imagedata = $this->upload->data();
$data['image']='assets/uploads/profilepic/patient_dependent/'.$imagedata['file_name'];
}
$result = $this->Webservice_model->add_dependent($auth_result->userid,$data);
if($result == false){
$res = array(
"status"=> "error", "status"=> "error",
"error"=> "No data", "error"=> "CPF Exist",
"message"=> "No data" "message"=> "CPF Already Exist"
); );
}else{ }else{
$new_data = array(); $auth_result = $this->Webservice_model->get_userid_frm_authtoken($headers['Auth']);
foreach ($result as $key => $value) { $fileName =$auth_result->userid.'_'.$_FILES['dependent_image']['name'];
$new_data[$key]['dependent_id'] =$value->id; $fileName = str_replace('%','a',$fileName);
$new_data[$key]['dependent_name'] =$value->dependent_name; $config = set_upload_options('../assets/uploads/profilepic/patient_dependent/');
$new_data[$key]['dependent_relation'] =$value->relation; $config['file_name'] = $fileName;
$new_data[$key]['dependent_image'] =$value->image; $this->load->library('upload', $config);
$new_data[$key]['dependent_cpf'] =$value->cpf; if ( ! $this->upload->do_upload('dependent_image')) {
$new_data[$key]['age'] =$value->dob; $error = array('error' => $this->upload->display_errors('', ''));
} $res = array(
$res = array( "status"=> "error",
'status'=>'success', "error"=> "Upload Error",
'data' =>array('dependent_list'=>$new_data) "message"=> "Sorry! Profile Photo not uploaded".$error['error']
); );
} }
else {
$imagedata = $this->upload->data();
$data['image']='assets/uploads/profilepic/patient_dependent/'.$imagedata['file_name'];
}
$result = $this->Webservice_model->add_dependent($auth_result->userid,$data);
if($result == false){
$res = array(
"status"=> "error",
"error"=> "No data",
"message"=> "No data"
);
}else{
$new_data = array();
foreach ($result as $key => $value) {
$new_data[$key]['dependent_id'] =$value->id;
$new_data[$key]['dependent_name'] =$value->dependent_name;
$new_data[$key]['dependent_relation'] =$value->relation;
$new_data[$key]['dependent_image'] =$value->image;
$new_data[$key]['dependent_cpf'] =$value->cpf;
$new_data[$key]['age'] =$value->dob;
}
$res = array(
'status'=>'success',
'data' =>array('dependent_list'=>$new_data)
);
}
}
}else{ }else{
$res = array( $res = array(
"status"=> "error", "status"=> "error",
...@@ -2179,46 +2188,55 @@ class Webservice extends CI_Controller { ...@@ -2179,46 +2188,55 @@ class Webservice extends CI_Controller {
if((isset($data['dependent_name'])) && strlen(trim($data['dependent_name']," ")) > 0 && isset($data['dependent_relation']) && strlen(trim($data['dependent_relation']," ")) > 0 && isset($data['dependent_age']) && strlen(trim($data['dependent_age']," ")) > 0 && (isset($_FILES['dependent_image']) && isset($data['dependent_id']) && strlen(trim($data['dependent_id']," ")) > 0) && isset($data['dependent_cpf']) && strlen(trim($data['dependent_cpf']," ")) > 0){ if((isset($data['dependent_name'])) && strlen(trim($data['dependent_name']," ")) > 0 && isset($data['dependent_relation']) && strlen(trim($data['dependent_relation']," ")) > 0 && isset($data['dependent_age']) && strlen(trim($data['dependent_age']," ")) > 0 && (isset($_FILES['dependent_image']) && isset($data['dependent_id']) && strlen(trim($data['dependent_id']," ")) > 0) && isset($data['dependent_cpf']) && strlen(trim($data['dependent_cpf']," ")) > 0){
$ress = $this->cpf_valid($data['dependent_cpf']); $ress = $this->cpf_valid($data['dependent_cpf']);
if($ress == '1'){ if($ress == '1'){
$auth_result = $this->Webservice_model->get_userid_frm_authtoken($headers['Auth']); $is_cpf = $this->Webservice_model->is_cpf_exist($data['dependent_cpf']);
$fileName = $auth_result->userid.'_'.$_FILES['dependent_image']['name']; if($is_cpf['status'] == 'error'){
$config = set_upload_options('../assets/uploads/profilepic/patient_dependent/'); $res = array(
$config['file_name'] = $fileName;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('dependent_image')) {
$error = array('error' => $this->upload->display_errors('', ''));
$res = array(
"status"=> "error",
"error"=> "Upload Error",
"message"=> "Sorry! Profile Photo not uploaded".$error['error']
);
}
else {
$imagedata = $this->upload->data();
$data['image'] ='assets/uploads/profilepic/patient_dependent/'.$imagedata['file_name'];
}
$result = $this->Webservice_model->edit_dependent($data,$auth_result->userid);
if($result == false){
$res = array(
"status"=> "error", "status"=> "error",
"error"=> "No data", "error"=> "CPF Exist",
"message"=> "No data" "message"=> "CPF Already Exist"
); );
}else{ }else{
$new_data = array(); $auth_result = $this->Webservice_model->get_userid_frm_authtoken($headers['Auth']);
foreach ($result as $key => $value) { $fileName = $auth_result->userid.'_'.$_FILES['dependent_image']['name'];
$new_data[$key]['dependent_id'] =$value->id; $config = set_upload_options('../assets/uploads/profilepic/patient_dependent/');
$new_data[$key]['dependent_name'] =$value->dependent_name; $config['file_name'] = $fileName;
$new_data[$key]['dependent_relation'] =$value->relation; $this->load->library('upload', $config);
$new_data[$key]['dependent_image'] =$value->image; if ( ! $this->upload->do_upload('dependent_image')) {
$new_data[$key]['dependent_cpf'] =$value->cpf; $error = array('error' => $this->upload->display_errors('', ''));
$new_data[$key]['age'] =$value->dob; $res = array(
} "status"=> "error",
$res = array( "error"=> "Upload Error",
'status'=>'success', "message"=> "Sorry! Profile Photo not uploaded".$error['error']
'data' =>array('dependent_list'=>$new_data) );
); }
} else {
$imagedata = $this->upload->data();
$data['image'] ='assets/uploads/profilepic/patient_dependent/'.$imagedata['file_name'];
}
$result = $this->Webservice_model->edit_dependent($data,$auth_result->userid);
if($result == false){
$res = array(
"status"=> "error",
"error"=> "No data",
"message"=> "No data"
);
}else{
$new_data = array();
foreach ($result as $key => $value) {
$new_data[$key]['dependent_id'] =$value->id;
$new_data[$key]['dependent_name'] =$value->dependent_name;
$new_data[$key]['dependent_relation'] =$value->relation;
$new_data[$key]['dependent_image'] =$value->image;
$new_data[$key]['dependent_cpf'] =$value->cpf;
$new_data[$key]['age'] =$value->dob;
}
$res = array(
'status'=>'success',
'data' =>array('dependent_list'=>$new_data)
);
}
}
}else{ }else{
$res = array( $res = array(
"status"=> "error", "status"=> "error",
......
...@@ -4177,9 +4177,9 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -4177,9 +4177,9 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
$this->db->where('doctor_id',$doc_id); $this->db->where('doctor_id',$doc_id);
$query = $this->db->get()->row_array(); $query = $this->db->get()->row_array();
$query['reedem_earn'] = decrypt_data($query['reedem_earn']); $query['reedem_earn'] = $query['reedem_earn'] == "" ? 0 : decrypt_data($query['reedem_earn']);
$query['future_earn'] = decrypt_data($query['future_earn']); $query['future_earn'] = $query['future_earn'] == "" ? 0 : decrypt_data($query['future_earn']);
$query['total_earn'] = decrypt_data($query['total_earn']); $query['total_earn'] = $query['total_earn'] == "" ? 0 : decrypt_data($query['total_earn']);
return $query; return $query;
} }
......
...@@ -2090,6 +2090,7 @@ $('#home_registernowbtn a').click(function() ...@@ -2090,6 +2090,7 @@ $('#home_registernowbtn a').click(function()
$("#login_submit_patient").click(function() $("#login_submit_patient").click(function()
{ {
$("#loading").show(); $("#loading").show();
//$('#loading').css('display','none');
$('#err-login').addClass('hidden'); $('#err-login').addClass('hidden');
if ($('#login-form-patient').parsley().validate() ) if ($('#login-form-patient').parsley().validate() )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment