diff --git a/api/application/config/routes.php b/api/application/config/routes.php index cb6841c1..51675aeb 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -255,6 +255,8 @@ $route['uploadPDImgByApplicant'] = 'PD_Controller/uploadPDPhotosByApplicant'; $route['getPDImgDetails'] = 'PD_Controller/getPDImgDetails'; $route['updateVendorStatus'] = 'PD_Controller/updateVendorStatus'; $route['getVendorAnswers'] = 'PD_Controller/getVendorAnswers'; +$route['auditSmartPDImages'] = 'PD_Controller/auditSmartPDImages'; +$route['getAuditedImages'] = 'PD_Controller/getAuditedImages'; //$route['getTypeOfActivetyFromBusinessJSON'] = 'PD_Controller/getTypeOfActivetyFromBusinessJSON'; //Dashboard and Reports Related routes diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index ed8c0552..359c9783 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -10234,6 +10234,152 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() } } + + public function auditSmartPDImages_post() + { + + $docs = ($this->post()); + $result_array = array(); + $is_api_processed = false; + $total_affected_rows = null; + + $where_condition_array = array(); + if(count($docs)) + { + foreach ($docs as $key => $value) + { + $where_condition_array[] = $value['pd_document_id'] ; + } + + $this->db->WHERE_IN('pd_document_id',$where_condition_array)->UPDATE(PDDOCUMENTS,array('retake_flag' => 1)); + $total_affected_rows = $this->db->affected_rows(); + $is_api_processed = $total_affected_rows == count($docs) ? true : false; + //print_r($this->db->last_query()); + + } + + if((count($docs) == $total_affected_rows) && $is_api_processed) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $total_affected_rows; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'Something Went Wrong! Try Later!'; + $this->response($data,REST_Controller::HTTP_OK); + } + } + + public function getAuditedImages_post() + { + $random_string = $this->post('random_string'); + $pd_id = $this->post('pd_id'); + + $result_array = array(); + $where_condition_array = array('random_string' => $random_string); + if($pd_id){ $where_condition_array['pd_id'] = $pd_id; } + + //Get PD ID by Random String + $pd_id = $this->PD_Model->selectCustomRecords(array('pd_id','fk_lender_id','is_cus_link_valid','cus_link_count','is_cus_link_disabled'),$where_condition_array,PDTRIGGER); + + if(count($pd_id) && count($pd_id) == 1) + { + //check and update link meta data + if($pd_id[0]['is_cus_link_valid'] && !$pd_id[0]['is_cus_link_disabled']) + { + + $where_condition_array = array('fk_pd_id' => $pd_id[0]['pd_id'],'retake_flag' => 1); + $document_lists = $this->db->SELECT('*')->FROM(PDDOCUMENTS)->WHERE($where_condition_array)->get()->result_array(); + // print_r($this->db->last_query()); + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_id[0]['fk_lender_id']; + + foreach($document_lists as $key => $value) + { + $profilepics3path = 'pd'.$pd_id[0]['pd_id'].'/'.$value['pd_document_name']; + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'+5 minutes'); + //$document_lists[$key]['doc_url'] = $singed_uri; + + + ####################################################################################################################### + + if($value['img_type'] == 1 ) + { + + //echo "SELFIE"; + $arr = array('img_key' => 'selfie_with_person_met','img_name' => $this->photo_names['selfie_with_person_met'][0],'fk_form_id' => $this->photo_names['selfie_with_person_met'][1],'img_url' => $singed_uri,'is_multiple' => 0,'pd_document_id' => $value['pd_document_id']); + // unset($this->existing_imges[$key]); + $result_array[] = $arr; + // return $arr; + + } + else if($value['img_type'] == 2) + { + + //echo 'HOLD'; + $arr = array('img_key' => 'person_met_id','img_name' => $this->photo_names['person_met_id'][0],'img_url' => $singed_uri,'fk_form_id' => $this->photo_names['person_met_id'][1],'is_multiple' => 0,'pd_document_id' => $value['pd_document_id']); + $result_array[] = $arr; + } + else if(strpos($value['pd_document_title'], 'Approach') !== false) + { + + //echo "APPROACH"; + $arr = array('img_key' => 'approach_to_pd_location','img_name' => $this->photo_names['approach_to_pd_location'][0],'img_url' => $singed_uri,'fk_form_id' => $this->photo_names['approach_to_pd_location'][1],'is_multiple' => 0,'pd_document_id' => $value['pd_document_id']); + $result_array[] = $arr; + } + else if(strpos($value['pd_document_title'], 'Name Board Seen') !== false) + { + + //echo "APPROACH"; + $arr = array('img_key' => 'name_board_seen','img_name' => $this->photo_names['name_board_seen'][0],'img_url' => $singed_uri,'fk_form_id' => $this->photo_names['name_board_seen'][1],'is_multiple' => 0,'pd_document_id' => $value['pd_document_id']); + $result_array[] = $arr; + // unset($this->photo_names['selfie_with_person_met']); + // return $arr; + } + else + { + $arr = array('img_key' => $value['pd_document_title'],'img_name' => $this->photo_names['name_board_seen'][0],'img_url' => $singed_uri,'fk_form_id' => $this->photo_names['name_board_seen'][1],'is_multiple' => 0,'pd_document_id' => $value['pd_document_id']); + $result_array[] = $arr; + } + ####################################################################################################################### + } + + if(count($result_array)) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result_array; + $this->response($data,REST_Controller::HTTP_OK); + } + + + + + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'Link Expired'; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + else if(count($pd_id) > 1 || !count($pd_id)) + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'Invalid Link'; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + + + }