first commit
This commit is contained in:
181
Http/Controllers/ContactController.php
Normal file
181
Http/Controllers/ContactController.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
namespace Koneko\VuexyContacts\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Koneko\VuexyAdmin\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Koneko\VuexyAdmin\Queries\GenericQueryBuilder;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$bootstrapTableIndexConfig = [
|
||||
'table' => 'users',
|
||||
'columns' => [
|
||||
'users.id',
|
||||
'users.code',
|
||||
DB::raw("CONCAT_WS(' ', users.name, users.last_name) AS full_name"),
|
||||
'users.email',
|
||||
DB::raw("CONCAT_WS(' ', parent.name, parent.last_name) AS parent_name"),
|
||||
'parent.email AS parent_email',
|
||||
DB::raw("CONCAT_WS(' ', agent.name, agent.last_name) AS agent_name"),
|
||||
'agent.email AS agent_email',
|
||||
'users.company',
|
||||
'users.birth_date',
|
||||
'users.hire_date',
|
||||
'users.curp',
|
||||
'users.nss',
|
||||
'users.job_title',
|
||||
'users.rfc',
|
||||
'users.nombre_fiscal',
|
||||
'users.tipo_persona',
|
||||
'users.c_regimen_fiscal',
|
||||
'sat_regimen_fiscal.descripcion AS regimen_fiscal',
|
||||
'users.domicilio_fiscal',
|
||||
'users.c_uso_cfdi',
|
||||
'sat_uso_cfdi.descripcion AS uso_cfdi',
|
||||
'sat_estado.nombre_del_estado AS estado',
|
||||
'sat_municipio.descripcion AS municipio',
|
||||
'sat_localidad.descripcion AS localidad',
|
||||
'users.profile_photo_path',
|
||||
'users.is_partner',
|
||||
'users.is_employee',
|
||||
'users.is_prospect',
|
||||
'users.is_customer',
|
||||
'users.is_provider',
|
||||
'users.is_user',
|
||||
'users.status',
|
||||
DB::raw("CONCAT_WS(' ', created.name, created.last_name) AS creator"),
|
||||
'created.email AS creator_email',
|
||||
'users.created_at',
|
||||
'users.updated_at',
|
||||
],
|
||||
'joins' => [
|
||||
[
|
||||
'table' => 'users as parent',
|
||||
'first' => 'users.parent_id',
|
||||
'second' => 'parent.id',
|
||||
'type' => 'leftJoin',
|
||||
],
|
||||
[
|
||||
'table' => 'users as agent',
|
||||
'first' => 'users.agent_id',
|
||||
'second' => 'agent.id',
|
||||
'type' => 'leftJoin',
|
||||
],
|
||||
[
|
||||
'table' => 'users as created',
|
||||
'first' => 'users.created_by',
|
||||
'second' => 'created.id',
|
||||
'type' => 'leftJoin',
|
||||
],
|
||||
[
|
||||
'table' => 'sat_codigo_postal',
|
||||
'first' => 'users.domicilio_fiscal',
|
||||
'second' => 'sat_codigo_postal.c_codigo_postal',
|
||||
'type' => 'leftJoin',
|
||||
],
|
||||
[
|
||||
'table' => 'sat_estado',
|
||||
'first' => 'sat_codigo_postal.c_estado',
|
||||
'second' => 'sat_estado.c_estado',
|
||||
'type' => 'leftJoin',
|
||||
'and' => [
|
||||
'sat_estado.c_pais = "MEX"',
|
||||
],
|
||||
],
|
||||
[
|
||||
'table' => 'sat_localidad',
|
||||
'first' => 'sat_codigo_postal.c_localidad',
|
||||
'second' => 'sat_localidad.c_localidad',
|
||||
'type' => 'leftJoin',
|
||||
'and' => [
|
||||
'sat_codigo_postal.c_estado = sat_localidad.c_estado',
|
||||
],
|
||||
],
|
||||
[
|
||||
'table' => 'sat_municipio',
|
||||
'first' => 'sat_codigo_postal.c_municipio',
|
||||
'second' => 'sat_municipio.c_municipio',
|
||||
'type' => 'leftJoin',
|
||||
'and' => [
|
||||
'sat_codigo_postal.c_estado = sat_municipio.c_estado',
|
||||
],
|
||||
],
|
||||
[
|
||||
'table' => 'sat_regimen_fiscal',
|
||||
'first' => 'users.c_regimen_fiscal',
|
||||
'second' => 'sat_regimen_fiscal.c_regimen_fiscal',
|
||||
'type' => 'leftJoin',
|
||||
],
|
||||
[
|
||||
'table' => 'sat_uso_cfdi',
|
||||
'first' => 'users.c_uso_cfdi',
|
||||
'second' => 'sat_uso_cfdi.c_uso_cfdi',
|
||||
'type' => 'leftJoin',
|
||||
],
|
||||
],
|
||||
'filters' => [
|
||||
'search' => ['users.name', 'users.email', 'users.code', 'parent.name', 'created.name'],
|
||||
],
|
||||
'sort_column' => 'users.name',
|
||||
'default_sort_order' => 'asc',
|
||||
];
|
||||
|
||||
return (new GenericQueryBuilder($request, $bootstrapTableIndexConfig))->getJson();
|
||||
}
|
||||
|
||||
$pageConfigs = ['contentLayout' => 'wide'];
|
||||
|
||||
$breadcrumbs = [
|
||||
['route' => 'admin.home', 'name' => "Inicio"],
|
||||
['name' => "Contactos", 'active' => true]
|
||||
];
|
||||
|
||||
return view('vuexy-contacts::contacts.index', compact('breadcrumbs', 'pageConfigs'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the crud for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('vuexy-contacts::contacts.crud')
|
||||
->with('mode', 'create')
|
||||
->with('contact', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(User $contact)
|
||||
{
|
||||
return view('vuexy-contacts::contacts.show', compact('contact'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the crud for editing the specified resource.
|
||||
*/
|
||||
public function edit(User $contact)
|
||||
{
|
||||
//$contact = User::findOrFail($id);
|
||||
|
||||
|
||||
|
||||
return view('vuexy-contacts::contacts.crud', compact('contact'))->with('mode', 'edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the crud for editing the specified resource.
|
||||
*/
|
||||
public function delete(User $contact)
|
||||
{
|
||||
return view('vuexy-contacts::contact.crud', compact('contact'))->with('mode', 'delete');
|
||||
|
||||
}
|
||||
|
||||
}
|
65
Http/Controllers/CustomerController.php
Normal file
65
Http/Controllers/CustomerController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Koneko\VuexyContacts\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('vuexy-contacts::customers.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
65
Http/Controllers/EmployeeController.php
Normal file
65
Http/Controllers/EmployeeController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Koneko\VuexyContacts\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EmployeeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('vuexy-contacts::employees.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
65
Http/Controllers/SupplierController.php
Normal file
65
Http/Controllers/SupplierController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Koneko\VuexyContacts\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupplierController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('vuexy-contacts::suppliers.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user