mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
fixed the listing of the contacts page
This commit is contained in:
@@ -22,16 +22,16 @@ class CompanyController extends Controller
|
||||
{
|
||||
foreach ($matchedTerms as $key => $matchedTerm)
|
||||
{
|
||||
array_push($output, ['recipient_id'=> $matchedTerm->id, 'company_name' => $matchedTerm->company_name, 'tel_no' => $matchedTerm->tel_no, 'contact_person'=>$matchedTerm->contact_person ]);
|
||||
array_push($output, ['recipient_id'=> $matchedTerm->id, 'company_name' => $matchedTerm->company_name, 'tel_no' => $matchedTerm->tel_no, 'contact_person'=>$matchedTerm->contact_person ]);
|
||||
}
|
||||
|
||||
return response($output);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return response()->json(['error'=>'Company not found'], 404);
|
||||
}
|
||||
{
|
||||
return response()->json(['error'=>'Company not found'], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
|
||||
@@ -37,15 +37,6 @@ class ContactController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// foreach ($contacts2 as $contact => $value) {
|
||||
// print_r($value->sender_company_name);
|
||||
// //if($value['sender_company_id'] == Auth::user()->company()->first()->id){
|
||||
// // var_dump($contact);
|
||||
// //print_r($value['sender_company_id']);
|
||||
// //}
|
||||
|
||||
// //$contact->helo
|
||||
// }
|
||||
return response()->json($contacts2, 200);
|
||||
}
|
||||
|
||||
|
||||
+75
-3
@@ -97,7 +97,7 @@
|
||||
</div>
|
||||
|
||||
<div class="popup-footer">
|
||||
<button class="button blue" id="accept-req" data-dismiss="true">Approve</button>
|
||||
<button class="button green" id="accept-req" data-dismiss="true">Approve</button>
|
||||
<button class="button red" id="rej-req" data-dismiss="true">Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
<div class="popup-footer">
|
||||
<div class="txt-center">
|
||||
<button id="del-contact" class="button red" data-dismiss="true">Delete Contact</button>
|
||||
<button id="del-contact" class="button blue" data-dismiss="true">Delete Contact</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -150,6 +150,53 @@
|
||||
</div>
|
||||
<!--POPUP HTML CONTENT END -->
|
||||
|
||||
<!--POPUP HTML CONTENT START -->
|
||||
<div class="popup-overlay" id="sentRequestDetails">
|
||||
<!-- if you dont want overlay add class .no-overlay -->
|
||||
<div class="popup-container">
|
||||
<div class="popup-header">
|
||||
<h1 style="color: black">Contact Details</h1>
|
||||
<span class="popup-close" data-dismiss="true"><i class="fa fa-times"></i></span>
|
||||
</div>
|
||||
<div class="popup-content">
|
||||
<div class="form-row-group with-icons-no-padding">
|
||||
<div class="form-row no-padding">
|
||||
<div class="form-element-title">
|
||||
<span style="color: #667f97;">Company Name: </span>
|
||||
<label id="sentreq-companyname" style="color: #667f97"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-divider"></div>
|
||||
|
||||
<div class="form-row no-padding">
|
||||
<div class="form-element-title">
|
||||
<span style="color: #667f97;">Telephone number: </span>
|
||||
<label id="sentreq-telno" style="color: #667f97"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-divider"></div>
|
||||
|
||||
<div class="form-row no-padding">
|
||||
<div class="form-element-title">
|
||||
<span style="color: #667f97;">Contact Person: </span>
|
||||
<label id="sentreq-contactpers" style="color: #667f97"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-divider"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="popup-footer">
|
||||
<div class="txt-center">
|
||||
<button id="del-contact" class="button red" data-dismiss="true">Cancel Request</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--POPUP HTML CONTENT END -->
|
||||
|
||||
<!-- Required For All Pages, Otherwise Ugly Others Function Won't Work -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="js/global.script.js"></script>
|
||||
@@ -166,7 +213,7 @@
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
data.forEach(function(entry) {
|
||||
console.log(entry.status);
|
||||
//console.log(entry.status);
|
||||
//console.log(entry.company_name);
|
||||
if(entry.status === 0)
|
||||
{
|
||||
@@ -177,6 +224,7 @@
|
||||
else //to display sent requests
|
||||
{
|
||||
//sent requwsts code go here
|
||||
$('#sent-req').append('<a href="#" class="list-item" onclick="displaydetailsSentRequest(' + "'" + entry.recipient_company_name + "'" + ',' + "'" + entry.recipient_tel_no + "'" + ',' + "'" + entry.recipient_contact_pers + "'" + ',' + "'" + entry.contact_id + "'" + ')"><i class="fa fa-user"></i> <em class="seperate-contact"></em> <span class="list-item-title-contact" style="color:#667f97">' + entry.recipient_company_name + '</span> <br /> <span class="list-item-title-contact" style="margin-top:-23px; color:#069"> Request Pending </span> <span class="list-item-title-role" style="margin-top:-23px; color:#667f97">'+ entry.recipient_contact_pers + '<br /> ' + entry.recipient_tel_no+ '</span></a>')
|
||||
}
|
||||
//$('#sent-req').append('<a href="#" class="list-item" onclick="displaydetails(' + "'" + entry.sender_company_name + "'" + ',' + "'" + entry.sender_tel_no + "'" + ',' + "'" + entry.sender_contact_pers + "'" + ',' + "'" + entry.contact_id + "'" + ')"><i class="fa fa-user"></i> <em class="seperate-contact"></em> <span class="list-item-title-contact" style="color:#667f97">' + entry.sender_company_name + '</span> <br /> <span class="list-item-title-contact" style="margin-top:-23px; color:#069"> Request sent </span> <span class="list-item-title-role" style="margin-top:-23px; color:#667f97">'+ entry.sender_contact_pers + '<br /> ' + entry.sender_tel_no+ '</span></a>')
|
||||
|
||||
@@ -189,6 +237,7 @@
|
||||
}
|
||||
else{
|
||||
//friends which the current user has added should be here
|
||||
$('#sent-req').append('<a href="#" class="list-item" onclick="displayApproved(' + "'" + entry.recipient_company_name + "'" + ',' + "'" + entry.recipient_tel_no + "'" + ',' + "'" + entry.recipient_contact_pers + "'" + ',' + "'" + entry.contact_id + "'" + ')"><i class="fa fa-user"></i> <em class="seperate-contact"></em> <span class="list-item-title-contact" style="color:#667f97">' + entry.recipient_company_name + '</span> <br /> <span class="list-item-title-contact" style="margin-top:-23px; color:#069"> Friend </span> <span class="list-item-title-role" style="margin-top:-23px; color:#667f97">'+ entry.recipient_contact_pers + '<br /> ' + entry.recipient_tel_no+ '</span></a>')
|
||||
}
|
||||
|
||||
}
|
||||
@@ -268,6 +317,29 @@
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function displaydetailsSentRequest(recipient_company_name, recipient_tel_no, recipient_contact_pers, contact_id){
|
||||
$('#sentreq-companyname').text(recipient_company_name);
|
||||
$('#sentreq-telno').text(recipient_tel_no);
|
||||
$('#sentreq-contactpers').text(recipient_contact_pers);
|
||||
|
||||
$('#sentRequestDetails').show();
|
||||
|
||||
$('#del-contact').click(function() {
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "api/contacts/reject",
|
||||
headers: {"Authorization": 'Bearer' + localStorage.getItem('token')},
|
||||
data: {
|
||||
id: contact_id,
|
||||
},
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -22,7 +22,7 @@
|
||||
<!-- or without .fix-searchbar -->
|
||||
<a id="btnback" type="button" class="search-result-btn" href="javascript:history.back();"><i class="fa fa-arrow-left"></i></a>
|
||||
<form class="fix-searchbar">
|
||||
<input type="text" id="search" name="search" class="form-element" placeholder="search by company/phone no/name">
|
||||
<input type="text" autocomplete="off" id="search" name="search" class="form-element" placeholder="search by company/phone no/name">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user