mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
Added the search and popup function
This commit is contained in:
@@ -17,7 +17,7 @@ class ContactController extends Controller
|
||||
return response()->json($contact, 200);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
public function sendRequest(Request $request)
|
||||
{
|
||||
// get company id from request ex:
|
||||
//$request->input('company_id');
|
||||
@@ -47,7 +47,7 @@ class ContactController extends Controller
|
||||
return response()->json($contact, 204);
|
||||
}
|
||||
|
||||
public function postApprove(Request $request, $id)
|
||||
public function acceptRequest(Request $request, $id)
|
||||
{
|
||||
$contact = Contact::where("user_id", Auth::user()->id)->where('id', $id)->first();
|
||||
//$contact = Contact::where('id', '=', e($id))->first();
|
||||
|
||||
+33
-12
@@ -62,7 +62,7 @@
|
||||
</div>
|
||||
<!-- Menu navigation start -->
|
||||
<div class="cont-container">
|
||||
<ul id="AddCompany" class="main-menu" style="background-color: #FFF">
|
||||
<ul id="search_results" class="main-menu" style="background-color: #FFF">
|
||||
|
||||
</ul>
|
||||
<div class="form-divider"></div>
|
||||
@@ -97,21 +97,21 @@
|
||||
<div class="form-row-group with-icons-no-padding">
|
||||
<div class="form-row no-padding">
|
||||
<div class="form-element-title">
|
||||
<label style="color: #000">Company Name</label>
|
||||
<label id="companyname" style="color: #000">Company Name</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-divider"></div>
|
||||
|
||||
<div class="form-row no-padding">
|
||||
<div class="form-element-title">
|
||||
<label style="color: #000">Telephone number</label>
|
||||
<label id="telno" style="color: #000">Telephone number</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-divider"></div>
|
||||
|
||||
<div class="form-row no-padding">
|
||||
<div class="form-element-title">
|
||||
<label style="color: #000">Contact Person</label>
|
||||
<label id="contactpers" style="color: #000">Contact Person</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-divider"></div>
|
||||
@@ -129,9 +129,10 @@
|
||||
<!-- Required For All Pages, Otherwise Ugly Others Function Won't Work -->
|
||||
|
||||
<script type="text/javascript">
|
||||
//var company_name, tel_no, contact_person;
|
||||
$('#search').on('keyup', function(){
|
||||
$('#AddCompany').empty();
|
||||
var ul, li;
|
||||
$('#search_results').empty();
|
||||
var ul, li, data;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "api/company/search",
|
||||
@@ -141,9 +142,9 @@
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
for(i=0; i<data.length; i++){
|
||||
$('#AddCompany').append('<li style="display: show;"> <a href="#" onclick="displayCompany()"> <i class="fa fa-user"></i>' + data[i].company_name + '<span class="list-item-title-role" style="margin-top:-10px">' + data[i].tel_no + '</span> <br> <span class="list-item-title-role" style="margin-top:-10px">'+ data[i].contact_person);
|
||||
$('#search_results').append('<li style="display: show;"> <a href="#" onclick="displayCompany(' + "'" + data[i].company_name + "'" + ',' + "'" + data[i].tel_no + "'" + ',' + "'" + data[i].contact_person + "'" + ')"> <i class="fa fa-user"></i>' + data[i].company_name + '<span class="list-item-title-role" style="margin-top:-10px">' + data[i].tel_no + '</span> <br> <span class="list-item-title-role" style="margin-top:-10px">'+ data[i].contact_person);
|
||||
}
|
||||
//$('#AddCompany').show();
|
||||
//$('#searchresults').show();
|
||||
},
|
||||
error:function(data){
|
||||
console.log(data);
|
||||
@@ -151,17 +152,37 @@
|
||||
});
|
||||
|
||||
})
|
||||
//displayCompany.apply(this, data);
|
||||
function displayCompany(company_name, tel_no, contact_person){
|
||||
$('#companyname').text(company_name);
|
||||
$('#telno').text(tel_no);
|
||||
$('#contactpers').text(contact_person);
|
||||
|
||||
function displayCompany(){
|
||||
$('#formPopup5').show();
|
||||
|
||||
$('#formPopup5').show();
|
||||
$('#addContact').click(function() {
|
||||
$.ajax({
|
||||
type: "",
|
||||
url: "api/",
|
||||
headers: {"Authorization": 'Bearer' + localStorage.getItem('token')},
|
||||
data: {
|
||||
role:$('#role').val(),
|
||||
name: $('#name').val(),
|
||||
password: $('#password').val(),
|
||||
password_confirmation:$('#password_confirmation').val()
|
||||
},
|
||||
success: function(data) {
|
||||
document.location.href="company-profile.html";
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// function CSearch() {
|
||||
// // Declare variables
|
||||
// var input, filter, ul, li, a, i;
|
||||
// input = document.getElementById('searchInput');
|
||||
// filter = input.value.toUpperCase();
|
||||
// ul = document.getElementById("AddCompany");
|
||||
// ul = document.getElementById("searchresults");
|
||||
// li = ul.getElementsByTagName('li');
|
||||
// if (input.value.length == 0) {
|
||||
// ul.style.display = "none";
|
||||
|
||||
@@ -59,5 +59,6 @@ Route::group(['middleware' => ['jwt.auth']], function() {
|
||||
Route::get('/company/search', 'CompanyController@search');
|
||||
//Route::get('/company/search/{company_name}', 'CompanyController@search');//search company in contacts
|
||||
Route::post('/contacts/{company_id}/request', 'ContactController@postApprove');
|
||||
//Route::post()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user