public function postSearch() { $name = Input::get('query'); //$posts=DB::table('contacts')->select('name', 'email')->get(); $posts = Contact::where('name', 'LIKE', "%{$name}%")->get(); return View::make('contacts.showcontacts')->with('contacts', $posts); }
public function sendEmail() { $contacts = Contact::where('user_id', Auth::user()->id)->lists('full_name', 'id'); $templates = EmailTemplate::lists('subject', 'id'); $list_templates = EmailTemplate::all(); return View::make('users.send', compact('contacts', 'templates', 'list_templates')); }
public function showMemberContacts() { $memberCollection = array(); if (Auth::user()->isAdmin()) { $contacts = Contact::all(); } else { $contacts = Contact::where('user_id', Auth::user()->id)->get(); $memberCollection = MemberAPI::getmemberapiselect(Auth::user()->id); foreach ($memberCollection as $member) { if (!User::find($member->member_id)) { $user = new User(); $user->id = $member->member_id; $user->username = $member->username; $user->name = $member->name; $user->password = Hash::make(rand()); $user->active = 1; $user->save(); } $membercontacts = Contact::where('user_id', $member->member_id)->get(); $contacts = $contacts->merge($membercontacts); } // return $contacts->toJson(); } return View::make('contacts.member', compact('contacts', 'memberCollection')); }
public function getContacts() { $id = Input::get('id'); //return Response::json($id); $contacts = Contact::where('client_id', '=', $id)->whereNull('deleted_at')->select('id', 'first_name', 'last_name', 'email', 'phone')->get(); $client = Client::where('id', $id)->firstOrFail(); $enviar = ['contact' => $contacts, 'note' => $client->private_notes]; return Response::json($enviar); }
/** * Show the form for creating a new resource. * GET /api\apicontact/create * * @return Response */ public function getSingle($id) { try { $contact = Contact::where('published', 1)->where('id', $id)->firstOrFail(); $this->googleAnalytics('/contacts/single/' . $id); return Response::json($contact); } catch (Exception $e) { return Response::json(array('status' => 'fail')); } }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { if (Session::get('user_level') < Config::get('cms.viewContacts')) { return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning'); } $this->setLayout(); if (Input::get('q')) { $contacts = Contact::where('first_name', 'LIKE', '%' . Input::get('q') . '%')->orWhere(function ($query) { $query->where('last_name', 'LIKE', '%' . Input::get('q') . '%'); })->orderBy('created_at', 'desc')->paginate(20); } else { $contacts = Contact::orderBy('created_at', 'desc')->paginate(20); } View::share('title', Lang::get('admin.allContacts')); View::share('contacts', $contacts); $this->layout->content = View::make('backend.puskice.contacts.index'); }
public function getClients() { $clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'public_id', 'name', 'nit', 'custom_value4', 'work_phone', 'business_name')->orderBy('name', 'ASC')->get(); //$clientes= Client::where('account_id', Auth::user()->account_id)->orderBy('name', 'ASC')->get(); //return $clientes; //return Response::json($clientes); foreach ($clientes as $key => $client) { $contact = Contact::where('account_id', Auth::user()->account_id)->where('client_id', $client->id)->first(); $client->name2 = "<a href='clientes/{$client->public_id}'>{$client->name}</a>"; $client->business = "<a href='clientes/{$client->public_id}'>{$client->business_name}</a>"; $client->nit2 = "<a href='clientes/{$client->public_id}'>{$client->nit}</a>"; $client->contacto = "<a href='#'>{$contact->last_name} {$contact->first_name}</a>"; $client->campo = "<a href='clientes/{$client->public_id}'>{$client->custom_value4}</a>"; $client->button = "<a class='btn btn-primary btn-xs' data-task='view' href='clientes/{$client->public_id}' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-eye-open'></i></a> <a class='btn btn-warning btn-xs' href='clientes/{$client->public_id}/edit' style='text-decoration:none;color:white;'><i class='glyphicon glyphicon-edit'></i></a>"; } $clientJson = ['data' => $clientes]; return Response::json($clientJson); }
} else { $data['msg'] = 'The contact should have at least one address!'; } $contactList->response()->header('Content-Type', 'application/json'); echo json_encode($data); }); // Check email address $contactList->post("/checkemail", function () use($contactList) { $email = $contactList->request->params('email'); $checkEmail = Contact::where('email', '=', $email)->count(); if ($checkEmail == 0) { $data['available'] = true; } else { $data['available'] = false; } $contactList->response()->header('Content-Type', 'application/json'); echo json_encode($data); }); // Check email address $contactList->post("/checkemail/:id", function ($id) use($contactList) { $email = $contactList->request->params('email'); $checkEmail = Contact::where('email', '=', $email)->where('id', '<>', $id)->count(); if ($checkEmail == 0) { $data['available'] = true; } else { $data['available'] = false; } $contactList->response()->header('Content-Type', 'application/json'); echo json_encode($data); }); $contactList->run();
public function copia($id) { $invoice = Invoice::where('id', $id)->first(array('id', 'account_name', 'account_nit', 'account_uniper', 'account_uniper', 'address1', 'address2', 'terms', 'importe_neto', 'importe_total', 'branch_name', 'city', 'client_id', 'client_name', 'client_nit', 'control_code', 'deadline', 'discount', 'economic_activity', 'end_date', 'invoice_date', 'invoice_status_id', 'invoice_number', 'number_autho', 'phone', 'public_notes', 'qr', 'logo', 'public_id', 'note', 'sfc', 'type_third', 'branch_id', 'state', 'law', 'phone', 'javascript')); $account = Account::find(Auth::user()->account_id); //return $invoice['id']; $products = InvoiceItem::where('invoice_id', $invoice->id)->get(); $invoice['invoice_items'] = $products; $invoice['third'] = $invoice->type_third; $invoice['is_uniper'] = $account->is_uniper; $invoice['uniper'] = $account->uniper; $invoice['logo'] = $invoice->getLogo(); $client_id = $invoice->getClient(); $client = DB::table('clients')->where('id', '=', $client_id)->first(); $contacts = Contact::where('client_id', $client->id)->get(array('id', 'is_primary', 'first_name', 'last_name', 'email')); $status = InvoiceStatus::where('id', $invoice->invoice_status_id)->first(); //echo $client_id; //print_r($contacts); // return 0; if ($invoice->note == "") { $nota = []; } else { $nota = json_decode($invoice['note']); } $data = array('invoice' => $invoice, 'account' => $account, 'products' => $products, 'contacts' => $contacts, 'nota' => $nota, 'copia' => 1, 'matriz' => Branch::scope(1)->first(), 'status' => $status->name == "Parcial" ? "Parcialmente Pagado" : $status->name); // return Response::json($data); return View::make('factura.show', $data); }
function employee_get() { $filters = $this->get("filter")["filters"]; $data["results"] = array(); $data["count"] = 0; $obj = new Contact(null, $this->entity); $obj->where("contact_type_id", 3); $obj->get(); foreach ($obj as $value) { //Results $data["results"][] = array("id" => $value->id, "name" => $value->surname . ' ' . $value->name); } //Response Data $this->response($data, 200); }
public function indexDown($name = null, $numero = null, $nit = null, $group = null, $contact = null) { $name = Input::get('name'); $numero = Input::get('numero'); $nit = Input::get('nit'); $group = Input::get('group'); $contact = Input::get('contact'); if (Session::get('sw') == 'DESC') { Session::put('sw', 'ASC'); } else { Session::put('sw', 'DESC'); } $sw = Session::get('sw'); if ($numero == "" && $name == "" && $nit == "" && $group == "" && $contact == "") { $clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->orderBy('id', $sw)->simplePaginate(30); foreach ($clientes as $key => $client) { $contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first(); $client->contacto_first_name = $contacts->first_name; $client->contacto_last_name = $contacts->last_name; } return View::make('clientes.index', array('clients' => $clientes, 'sw' => 'ASC', 'contacts' => $contacts)); } if ($numero) { $clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->where('id', 'like', $numero . "%")->orderBy('id', $sw)->simplePaginate(30); foreach ($clientes as $key => $client) { $contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first(); $client->contacto_first_name = $contacts->first_name; $client->contacto_last_name = $contacts->last_name; } $data = ['clients' => $clientes, 'numero' => $numero, 'name' => $name, 'nit' => $nit, 'create' => $create]; return View::make('clientes.index', $data); } if ($name) { $clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->where('business_name', 'like', $name . "%")->orderBy('business_name', $sw)->simplePaginate(30); // $clientes = Client::join('contacts', 'clients.id' ,'=', 'contacts.client_id') // ->where('business_name', 'like', $name."%") // ->select('clients.id', 'clients.business_name', 'clients.nit', 'clients.created_at', 'contacts.first_name', 'contacts.last_name') // ->orderBy('business_name', $sw) // ->simplePaginate(30); foreach ($clientes as $key => $client) { $contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first(); $client->contacto_first_name = $contacts->first_name; $client->contacto_last_name = $contacts->last_name; } // return $clientes; $data = ['clients' => $clientes, 'numero' => $numero, 'name' => $name, 'nit' => $nit, 'create' => $create]; return View::make('clientes.index', $data); } if ($nit) { $clientes = Client::where('account_id', Auth::user()->account_id)->select('id', 'business_name', 'nit', 'created_at', 'group_id')->where('nit', 'like', $nit . "%")->orderBy('nit', $sw)->simplePaginate(30); foreach ($clientes as $key => $client) { $contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first(); $client->contacto_first_name = $contacts->first_name; $client->contacto_last_name = $contacts->last_name; } $data = ['clients' => $clientes, 'numero' => $numero, 'name' => $name, 'nit' => $nit, 'create' => $create]; return View::make('clientes.index', $data); } // if ($create) { // // $clientes = Client::where('account_id', Auth::user()->account_id) // ->select('id', 'business_name', 'nit', 'created_at', 'group_id') // ->where('created_at', 'like', $create."%") // ->orderBy('created_at', $sw) // ->simplePaginate(30); // foreach ($clientes as $key => $client) { // $contacts = Contact::where('account_id', Auth::user()->account_id) // ->select('first_name', 'last_name') // ->where('client_id', $client->id) // ->first(); // $client->contacto_first_name = $contacts->first_name; // $client->contacto_last_name = $contacts->last_name; // } // // $data = [ // 'clients' => $clientes, // 'numero' => $numero, // 'name' => $name, // 'nit' => $nit, // 'create' => $create // ]; // return View::make('clientes.index', $data); // } if ($group) { $clientes = Client::join('groups', 'clients.group_id', '=', 'groups.id')->select('clients.id', 'clients.nit', 'clients.business_name', 'clients.created_at', 'clients.group_id')->where('groups.name', 'like', $group . '%')->orderBy('groups.name', $sw)->simplePaginate(30); foreach ($clientes as $key => $client) { $contacts = Contact::where('account_id', Auth::user()->account_id)->select('first_name', 'last_name')->where('client_id', $client->id)->first(); $client->contacto_first_name = $contacts->first_name; $client->contacto_last_name = $contacts->last_name; } $data = ['clients' => $clientes, 'group' => $group]; return View::make('clientes.index', $data); } if ($contact) { $clientes = Client::join('contacts', 'clients.id', '=', 'contacts.client_id')->select('clients.id', 'clients.nit', 'clients.business_name', 'clients.created_at', 'clients.group_id', 'contacts.first_name', 'contacts.last_name')->where('contacts.first_name', 'like', $contact . "%")->orderBy('contacts.first_name', $sw)->simplePaginate(30); foreach ($clientes as $key => $client) { $client->contacto_first_name = $client->first_name; $client->contacto_last_name = $client->last_name; } $data = ['clients' => $clientes, 'contact' => $contact]; return View::make('clientes.index', $data); } }
public static function findClientContactsArray($id_client = null) { return Contact::where('id_client', '=', $id_client)->get(array('id', 'firstname', 'lastname')); }
/** * Update the specified resource in storage. * PUT /contact/{id} * * @param int $id * @return Response */ public function update($id) { Input::merge(array_map('trim', Input::all())); $input = Input::all(); $validation = Validator::make($input, Contact::$rules); $gettime = time() - 14400; $datetime_now = date("H:i:s", $gettime); if (Input::get('fullname') == 'No record found.') { return Redirect::route('contact.edit')->withInput()->with('class', 'error')->with('message', 'Input proper fullname.'); } if ($validation->passes()) { if (Input::get('category') == '1') { $street = Input::get('street_hid'); $city = Input::get('city_hid'); $province = Input::get('province_hid'); $country = Input::get('country_hid'); $zip_code = Input::get('zip_code_hid'); $street_2 = Input::get('street_2'); $city_2 = Input::get('city_2'); $province_2 = Input::get('province_2'); $country_2 = Input::get('country_2'); $zip_code_2 = Input::get('zip_code_2'); } else { $street = Input::get('i_street'); $city = Input::get('i_city'); $province = Input::get('i_province'); $country = Input::get('i_country'); $zip_code = Input::get('i_zip_code'); $street_2 = Input::get('street_2'); $city_2 = Input::get('city_2'); $province_2 = Input::get('province_2'); $country_2 = Input::get('country_2'); $zip_code_2 = Input::get('zip_code_2'); } if ($street == "" || $city == "" || $country == "") { return Redirect::route('contact.edit', $id)->withInput()->with('class', 'error')->with('message', 'Make sure to fill-up company address.'); } $contact = Contact::find($id); if (is_null($contact)) { return Redirect::route('contact.edit', $id)->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Contact information not exist.'); } $contact->position = Input::get('profession'); $contact->fullname = strtoupper(Input::get('fullname')); $contact->gender = strtoupper(Input::get('gender')); $contact->category = Input::get('category'); $contact->company = Input::get('company'); $contact->in_company_position = Input::get('position'); $contact->street = strtoupper($street); $contact->city = strtoupper($city); $contact->province = strtoupper($province); $contact->country = strtoupper($country); $contact->zip_code = strtoupper($zip_code); $contact->street_2 = strtoupper($street_2); $contact->city_2 = strtoupper($city_2); $contact->province_2 = strtoupper($province_2); $contact->country_2 = strtoupper($country_2); $contact->zip_code_2 = strtoupper($zip_code_2); $contact->contact_number = Input::get('contact_number'); $contact->contact_number2 = Input::get('2nd_contact_number'); $contact->contact_number3 = Input::get('3rd_contact_number'); $contact->status = 1; // if(Contact::check_ifcontactinfoExist($contact)) // { // return Redirect::route('contact.edit', $id) // ->withInput() // ->withErrors($validation) // ->with('class', 'warning') // ->with('message', 'Record was already added by BDO.'); // } $contactinformation = DB::table('contacts')->select('contacts.*', 'positions.position as cp_position')->join('positions', 'positions.id', '=', 'contacts.position')->where('contacts.id', $id)->first(); $pos = DB::table('positions')->where('id', Input::get('position'))->first(); if ($contactinformation->company != '0') { $comp = Company::where('id', $contactinformation->company)->first(); $companyname = $comp->company_name; $new_comp = Company::where('id', Input::get('company'))->first(); $new_companyname = $new_comp->company_name; } else { $companyname = 'N/A'; $new_companyname = 'N/A'; } if (Contact::where('position', Input::get('position'))->where('id', $id)->count() > 0) { $position = ""; } else { $position = "POSITION : " . $contactinformation->cp_position . " INTO " . strtoupper($pos->position) . ", "; } if (Contact::where('fullname', strtoupper(Input::get('fullname')))->where('id', $id)->count() > 0) { $fullname = ""; } else { $fullname = "FULLNAME : " . $contactinformation->fullname . " INTO " . strtoupper(Input::get('fullname')) . ", "; } if (Contact::where('gender', strtoupper(Input::get('gender')))->where('id', $id)->count() > 0) { $gender = ""; } else { $gender = "GENDER : " . $contactinformation->gender . " INTO " . strtoupper(Input::get('gender')) . ", "; } if (Contact::where('company', Input::get('company'))->where('id', $id)->count() > 0) { $company = ""; } else { $company = "COMPANY : " . $companyname . " INTO " . strtoupper($new_companyname) . ", "; } if (Input::get('category') == '1') { if (Contact::where('street', Input::get('street_hid'))->where('city', Input::get('city_hid'))->where('province', Input::get('province_hid'))->where('country', Input::get('country_hid'))->where('zip_code', Input::get('zip_code_hid'))->where('id', $id)->count() > 0) { $address = ""; } else { $address = "COMPANY ADDRESS : " . $contactinformation->street . " " . $contactinformation->city . ", " . $contactinformation->country . " " . $contactinformation->zip_code . " INTO " . strtoupper(Input::get('street_hid')) . " " . strtoupper(Input::get('city_hid')) . ", " . strtoupper(Input::get('country_hid')) . " " . strtoupper(Input::get('zip_code_hid')) . ", "; } } else { if (Contact::where('street', Input::get('i_street'))->where('city', Input::get('i_city'))->where('province', Input::get('i_province'))->where('country', Input::get('i_country'))->where('zip_code', Input::get('i_zip_code'))->where('id', $id)->count() > 0) { $address = ""; } else { $address = "PERSONAL ADDRESS : " . $contactinformation->street . " " . $contactinformation->city . ", " . $contactinformation->country . " " . $contactinformation->zip_code . " INTO " . strtoupper(Input::get('i_street')) . " " . strtoupper(Input::get('i_city')) . ", " . strtoupper(Input::get('i_country')) . " " . strtoupper(Input::get('i_zip_code')) . ", "; } } if (Contact::where('contact_number', Input::get('contact_number'))->where('id', $id)->count() > 0) { $contact1 = ""; } else { $contact1 = "CONTACT NUMBER : " . $contactinformation->contact_number . " INTO " . strtoupper(Input::get('contact_number')) . ", "; } if (Contact::where('contact_number2', Input::get('2nd_contact_number'))->where('id', $id)->count() > 0) { $contact2 = ""; } else { $contact2 = "2nd CONTACT NUMBER : " . $contactinformation->contact_number2 . " INTO " . strtoupper(Input::get('2nd_contact_number')) . ", "; } if (Contact::where('contact_number3', Input::get('3rd_contact_number'))->where('id', $id)->count() > 0) { $contact3 = ""; } else { $contact3 = "3rd CONTACT NUMBER : " . $contactinformation->contact_number3 . " INTO " . strtoupper(Input::get('3rd_contact_number')) . ", "; } $contact->save(); DB::table('contact_status')->insert(array(['contact_id' => $contact->id, 'user_id' => Auth::id(), 'update' => 'CHANGE ' . $contactinformation->fullname . ' IN CONTACT PERSON RECORD ' . ' | ' . $position . $fullname . $gender . $company . $address . $contact1 . $contact2 . $contact3, 'created_by' => Auth::id(), 'created_at' => date('Y-m-d') . ' ' . $datetime_now, 'access' => 1])); return Redirect::route('contact.index')->with('class', 'success')->with('message', 'Record successfully updated.'); } else { return Redirect::route('contact.edit', $id)->withInput()->withErrors($validation)->with('class', 'error')->with('message', 'There were validation errors.'); } }
public function postUpdateCustomer() { $company = Session::get('companyID'); $contact = Session::get('contactID'); $editedContact = Contact::where('contact_id', '=', $contact)->first(); $validator = Validator::make(Input::all(), array('name' => 'required|max:100', 'email' => 'required|email|max:200', 'number' => 'required|max:100')); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } else { $name = Input::get('name'); $email = Input::get('email'); $number = Input::get('number'); $editedContact->contact_name = $name; $editedContact->email = $email; $editedContact->contact_number = $number; $updatedContact = $editedContact->save(); if ($updatedContact) { return Redirect::route('dashboard'); } else { return Redirect::route('contactEdit'); } } }
public function contactList($id_client) { $contacts = Contact::where('id_client', '=', $id_client)->get(array('id', 'firstname', 'lastname')); $contactsRow = array(); $contactsRow[0] = "Contacto con el cliente"; foreach ($contacts as $contact) { $contactsRow[$contact->id] = $contact->fullname(); } return $contactsRow; }
public function edittask_forcontact($id) { $pagetitle = 'Edit Task for Contact'; $get_contact = Contact::where('status', '=', 2)->orderBy('fullname', 'asc')->lists('fullname', 'id'); $get_task = Task::orderBy('task', 'asc')->lists('task', 'id'); $get_taskforcontact = DB::table('mytask_forcontact')->where('id', $id)->first(); $getattached = DB::table('attached_forcontact')->where('forcontact_id', $id)->get(); $my_contact = Contact::where('id', $get_taskforcontact->contact_id)->first(); $my_task = Task::where('id', $get_taskforcontact->task_id)->first(); return View::make('task.edit_taskforcontact', compact('pagetitle', 'get_contact', 'get_task', 'get_taskforcontact', 'my_contact', 'my_task', 'getattached')); }
public function search() { $contacts = Contact::where(function ($query) { $search = Input::get('search'); $query->where('last_name', 'like', "%{$search}%"); $query->orWhere('email', 'like', "%{$search}%"); $query->orWhere('phone', 'like', "%{$search}%"); })->where('user_id', '=', Auth::id())->get(); if (count($contacts) > 0) { return (string) View::make('contacts.table', ['contacts' => $contacts]); } }