policybot/application/views/front/agent-request.php
2021-11-30 16:26:55 +05:30

385 lines
16 KiB
PHP

<?php $this->load->view('front/includes/header'); ?>
<link rel="stylesheet" href="css/magnific-popup.css" type="text/css" />
<?php $primaryid=$this->session->userdata('primaryid');
$userrole=$this->session->userdata('userrole');
$loggedname=$this->session->userdata('loggedname');
$tables="users";
$wheres=array("id"=>$primaryid);
$shows=("*");
$userdet=$this->commonsql_model->selectTable($tables,$wheres,$shows);
if($userdet->num_rows()>0)
{
$u=$userdet->row();
$loggedusername=$u->name;
}
$CI=&get_instance();
$CI->load->model("frontend_model");
?>
<style>
.fbox-center .fbox-icon {
margin-bottom: 1rem!important;
}
.fbox-bg.fbox-center {
padding: 0 1rem 1rem !important;
}
.form-error{ text-align:end!important; }
</style>
<section id="page-title" style="background-image: url('<?=base_url();?>fassets/images/about/333.jpg');">
<div class="container clearfix">
<h1 style="text-align:center"> Agent Profile</h1>
<span style="text-align:center;font-weight:500">Hi <?=ucwords($loggedusername);?> , Welcome to policybot</span>
</div>
</section>
<section id="content">
<div class="content-wrap ">
<div class="container clearfix">
<div class="row" >
<div class="col-md-4 col-lg-3">
<?php $this->load->view('front/includes/leftmenu'); ?>
</div>
<div class="col-md-8 col-lg-9">
<h3>Request From User</h3>
<div class="table-responsive">
<table class="table table-striped table-bordered datatable1" cellspacing="0" width="100%">
<thead>
<tr>
<th>S.No</th>
<th>User Name</th>
<th>Policy Name</th>
<th>Date</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $agentcount=3;
if(isset($age_req)&& $age_req->num_rows()>0)
$i=1;
{ foreach($age_req->result() as $r)
{
$qid=$r->id;
$user_id=$r->user_id;
$username=$r->name;
$cdate=$r->cdate;
$pincode=$r->pincode;
$policy_id=$r->policy_id;
$status=$r->status;
$company=$r->company;
$agency_id=$r->agency_id;
$getquote=$CI->frontend_model->select_pincode_agentcount($pincode,$agentcount,$company);
//echo $this->db->last_query();
if($status==0){ $statusreq="<span style='cursor:text' class='btn btn-warning'>Requested</span>"; }
else if($status==1) { $statusreq= "<span style='cursor:text' class='btn btn-info'>Accepted</span>"; }
else if($status==2) { $statusreq= "<span style='cursor:text' class='btn btn-success'>Completed</span>"; }
else if($status==3) { $statusreq= "<span style='cursor:text'class='btn btn-success'>Cancelled</span>"; }
else if($status==4) { $statusreq= "<span style='cursor:text'class='btn btn-success'>Document Collected</span>"; }
else if($status==5) { $statusreq= "<span style='cursor:text'class='btn btn-success'>Verified</span>"; }
else if($status==6) { $statusreq= "<span style='cursor:text' class='btn btn-success'>Policy Issued</span>"; }
if($primaryid!=0){
$tables="users";
$wheres=array("id"=>$primaryid);
$shows=("*");
$agename=$this->commonsql_model->selectTable($tables,$wheres,$shows);
if ($agename->num_rows()>0){
$r=$agename->row();
$al_mobile=$r->mobile;
$al_email=$r->email;
}
}
foreach($getquote->result() as $gq){
$name=$gq->name;
$loggeduserid=$gq->id;
$tables="policies";
$wheres=array("id"=>$policy_id);
$shows=("*");
$pokl=$this->commonsql_model->selectTable($tables,$wheres,$shows);
if($pokl->num_rows()>0)
{
$p=$pokl->row();
$policyname=$p->name;
$category=$p->category;
}
$tables="quote_response";
$wheres=array("quote_id"=>$qid,"user_id"=>$user_id,"agency_id"=>$loggeduserid);
$shows=("*");
$resp=$this->commonsql_model->selectTable($tables,$wheres,$shows);
//get completed or cancelled agent show
$resp_det=$this->frontend_model->get_agent_det_to_show_quote($loggeduserid);
//quote info wise -- completed agents
if($primaryid==$loggeduserid){
if($agency_id==0){
?>
<tr>
<td><?=$i;?></td>
<td style="font-weight:900;color: #1abc9c;"> <?=ucwords($username);?> </td>
<td><a style="font-weight:900;color: #fd6003;" href="<?=base_url();?>policy-detail/<?=$policy_id;?>"><?=ucwords($policyname);?></a></td>
<td><?=date("d-m-Y H:i:s",strtotime($cdate));?></td>
<td ><?=$statusreq;?></td>
<td>
<?php if ($resp->num_rows()>0){
$re=$resp->row();
$mobile=$re->mobile;
$email=$re->email;
$message=$re->message;
$response_status=$re->status;
if($response_status!=7 && $status==0){?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class="respondview" data-msg="<?=$message;?>" data-mail="<?=$email;?>" data-mob="<?=$mobile;?>" style="color: #000;" >View</a></span> </div>
</div> <?php }else if($response_status!=7 && $status==1){?><div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>agent-collect-documents/<?=$qid;?>/<?=$category;?>" style="color: #000;" >Collect Documents</a></span> </div>
</div> <?php }else if($status==3){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class=" " style="color: #000;" >Cancelled</a></span> </div>
</div>
<?php }else if($response_status!=7 && $status==4){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>frontend/change_document_status/<?=$qid;?>/5/<?=$agency_id?>" class=" " style="color: #000;" >Verification</a></span> </div>
</div>
<?php } else if($response_status!=7 && $status==5){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>frontend/change_document_status/<?=$qid;?>/6/<?=$agency_id?>" class=" " style="color: #000;" >Policy Issue</a></span> </div>
</div>
<?php }else if($response_status!=7 && $status==6){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>frontend/change_document_status/<?=$qid;?>/2/<?=$agency_id?>" class=" " style="color: #000;" >Completed</a></span> </div>
</div>
<?php }else if($response_status==7 && $status==0){ ?>
<div class="edt_list">
<div> <span class="btn btn-danger" ><a href="javascript:;" class=" " style="color: #000;cursor:text;" >Rejected</a></span> </div>
</div>
<?php }else if($response_status!=7 && $status==2 ){?><div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class=" " style="color: #000;" >Process Closed</a></span> </div>
</div><?php } } else { ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class="respond" data-agid="<?=$loggeduserid;?>" data-qid="<?=$qid;?>" data-mail="<?=$al_email;?>" data-mob="<?=$al_mobile;?>" data-user="<?=$user_id;?>" style="color: #000;" >Reply</a></span> </div>
</div>
<?php } ?>
</td>
</tr>
<?php } else { if ($primaryid==$agency_id){ ?>
<tr>
<td><?=$i;?></td>
<td style="font-weight:900;color: #1abc9c;"> <?=ucwords($username);?> </td>
<td><a style="font-weight:900;color: #fd6003;" href="<?=base_url();?>policy-detail/<?=$policy_id;?>"><?=ucwords($policyname);?></a></td>
<td><?=date("d-m-Y H:i:s",strtotime($cdate));?></td>
<td><?=$statusreq;?></td>
<td>
<?php if ($resp->num_rows()>0){
$re=$resp->row();
$mobile=$re->mobile;
$email=$re->email;
$message=$re->message;
if($status==0){?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class="respondview" data-msg="<?=$message;?>" data-mail="<?=$email;?>" data-mob="<?=$mobile;?>" style="color: #000;" >View</a></span> </div>
</div> <?php }else if($status==1){?><div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>agent-collect-documents/<?=$qid;?>/<?=$category;?>" style="color: #000;" >Collect Documents</a></span> </div>
</div> <?php }else if($status==3){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class=" " style="color: #000;" >Cancelled</a></span> </div>
</div>
<?php }else if($status==4){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>frontend/change_document_status/<?=$qid;?>/5/<?=$agency_id?>" class=" " style="color: #000;" >Verification</a></span> </div>
</div>
<?php }else if($status==5){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>frontend/change_document_status/<?=$qid;?>/6/<?=$agency_id?>" class=" " style="color: #000;" >Policy Issue</a></span> </div>
</div>
<?php } else if($status==6){ ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="<?=base_url();?>frontend/change_document_status/<?=$qid;?>/2/<?=$agency_id?>" class=" " style="color: #000;" >Completed</a></span> </div>
</div>
<?php }else{?><div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class=" " style="color: #000;" >Process Closed</a></span> </div>
</div><?php }}
else { ?>
<div class="edt_list">
<div> <span class="btn btn-warning" style="background-color: #cbed1f;border-color: #cbed1f;"><a href="javascript:;" class="respond" data-agid="<?=$loggeduserid;?>" data-qid="<?=$qid;?>" data-mail="<?=$al_email;?>" data-mob="<?=$al_mobile;?>" data-user="<?=$user_id;?>" style="color: #000;" >Reply</a></span> </div>
</div>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php } } } $i++ ; } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<form action="<?=base_url();?>frontend/respondtouser" method="post" >
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Respond To User</h4>
<button type="button" class="btn-close btn-sm" data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<p style="color:red">All Fields are manditory</p>
<div class="form-group">
<label>Contact Number</label>
<input class="form-control" id="mob" readonly type="text" name="cMobile" data-validation="number length" data-validation-length="10" >
</div>
<div class="form-group">
<label>Email Address</label>
<input class="form-control" id="mail" readonly type="text" name="cEmail" data-validation="email" >
</div>
<div class="form-group">
<label>Message</label>
<textarea class="form-control" rows="5" name="cMessage" data-validation="required" ></textarea>
</div>
<input type="hidden" name="agid" id="agid" >
<input type="hidden" name="qid" id="qid" >
<input type="hidden" name="user" id="user" >
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<input type="submit" class="btn btn-primary" name="submit" value="Submit">
</div>
</div>
</form>
</div>
</div>
<div class="modal fade" id="viewrespond" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<form action="<?=base_url();?>frontend/respondtouser" method="post" >
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Your Response</h4>
<button type="button" class="btn-close btn-sm" data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<div class="row col-md-12 form-group">
<div class="col-md-5">
Contact
</div>
<div class="col-md-2">
:
</div>
<div class="col-md-5" >
<span id="mobi"></span>
</div>
</div>
<div class="row col-md-12 form-group">
<div class="col-md-5">
Email
</div>
<div class="col-md-2">
:
</div>
<div class="col-md-5">
<span id="mai"></span>
</div>
</div>
<div class="row col-md-12 form-group">
<div class="col-md-5">
Message
</div>
<div class="col-md-2">
:
</div>
<div class="col-md-5">
<span id="msg"></span>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</form>
</div>
</div>
<?php $this->load->view('front/includes/footer'); ?>
<script>
$(document).ready(function() {
$('.datatable1').dataTable();
});
</script>
<script>
$(".respond").on("click",function(){
var agid= $(this).attr("data-agid");
var qid= $(this).attr("data-qid");
var user= $(this).attr("data-user");
var mail= $(this).attr("data-mail");
var mob= $(this).attr("data-mob");
$("#myModal").modal("show");
$("#agid").val(agid);
$("#qid").val(qid);
$("#user").val(user);
$("#mob").val(mob);
$("#mail").val(mail);
});
</script>
<script>
$(".respondview").on("click",function(){
var msg= $(this).attr("data-msg");
var mail= $(this).attr("data-mail");
var mob= $(this).attr("data-mob");
$("#viewrespond").modal("show");
$("#msg").html(msg);
$("#mai").html(mail);
$("#mobi").html(mob);
});
</script>