This commit is contained in:
bitbucket 2024-05-31 16:21:01 +05:30
parent 6b8f8db560
commit 5087ed1aff
4 changed files with 16 additions and 7 deletions

View File

@ -237,21 +237,24 @@ class MasterController extends BaseController
public function client_docs_preview()
{
if($this->session->has('is_staff_logged_in')){
$userData = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
}else if($this->session->has('is_client_logged_in')){
$userData = $this->ClientModel->where('client_id',$this->session->get('is_client_logged_in'))->get()->getRow();
}
$doc_id = $this->request->getVar('doc_id');
$data['docData'] = $this->ClientDocsModel->docPreview($doc_id);
$clientData = $this->ClientModel->where('client_id',$data['docData']->client_id)->get()->getRow();
$data['clientData'] = $this->ClientModel->where('client_id',$data['docData']->client_id)->get()->getRow();
$data['body_html'] = $data['docData']->body_html;
foreach ($clientData as $key => $value) {
foreach ($data['clientData'] as $key => $value) {
$placeHolder = '%'.$key.'%';
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
}
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
echo view('layout/header', ['Data'=>$staffdata]);
echo view('layout/header', ['Data'=>$userData]);
echo view('client_docs_preview',$data);
echo view('layout/footer');

View File

@ -37,7 +37,7 @@ class ClientDocsModel extends Model
public function docPreview($doc_id){
$this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_id ,template.template_name,template.body_html , services.service_name');
$this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_id ,client_docs.updated_at,template.template_name,template.body_html , services.service_name');
$this->join('template', 'template.template_id = client_docs.template_id');
$this->join('services', 'services.service_id = template.service_id');
$this->where('client_docs.id', $doc_id);

View File

@ -16,7 +16,9 @@
<div class="page-title-right">
<a onclick="window.history.back()" class="btn btn-secondary waves-effect waves-light"> Close </a>
<a href="<?= base_url(''); ?>" class="btn btn-danger waves-effect waves-light"> Reject </a>
<?php if($docData->is_approved != 1){ ?>
<a href="<?= base_url(''); ?>" class="btn btn-primary waves-effect waves-light"> Approve </a>
<?php } ?>
</div>
</div>
</div>
@ -39,6 +41,10 @@
<?php echo $body_html; ?>
</div>
<div>
<?php if($docData->is_approved == 1){ echo 'Approved at '.date('d-m-Y H:i:s', strtotime($docData->updated_at)).' through OTP sent to '.$clientData->mobile_no.' from ip address 119.22.334' ; } ?>
</div>
</div>
</div>

View File

@ -55,7 +55,7 @@
<?php endif; ?>
</td>
<td><a href="#"><i class='mdi mdi-eye-outline mr-1'></i>Preview</a></td>
<td><a href="<?php echo base_url().'client_docs_preview?doc_id='.$value['doc_id']; ?>"><i class='mdi mdi-eye-outline mr-1'></i>Preview</a></td>
</tr>
<?php } ?>