diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 9bac127..78aaa40 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -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) diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index ec155cd..841d875 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -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); } diff --git a/public/contacts.html b/public/contacts.html index f9a59eb..dc33762 100644 --- a/public/contacts.html +++ b/public/contacts.html @@ -97,7 +97,7 @@ @@ -142,7 +142,7 @@ @@ -150,6 +150,53 @@ + + + + + @@ -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(' ' + entry.recipient_company_name + '
Request Pending '+ entry.recipient_contact_pers + '
' + entry.recipient_tel_no+ '
') } //$('#sent-req').append(' ' + entry.sender_company_name + '
Request sent '+ entry.sender_contact_pers + '
' + entry.sender_tel_no+ '
') @@ -189,6 +237,7 @@ } else{ //friends which the current user has added should be here + $('#sent-req').append(' ' + entry.recipient_company_name + '
Friend '+ entry.recipient_contact_pers + '
' + entry.recipient_tel_no+ '
') } } @@ -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(); + } + }) + }) + } \ No newline at end of file diff --git a/public/search-contact.html b/public/search-contact.html index 74d1254..8b5133c 100644 --- a/public/search-contact.html +++ b/public/search-contact.html @@ -22,7 +22,7 @@