2024-07-03 12:02:11 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
SPDX-License-Identifier: AGPL
|
|
|
|
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Route;
|
2024-07-05 15:46:34 +00:00
|
|
|
use MMF\FreescoutRestrictedCustomers\Http\Controllers\ConversationsController;
|
2024-07-03 12:02:11 +00:00
|
|
|
use MMF\FreescoutRestrictedCustomers\Http\Controllers\CrmController;
|
|
|
|
use MMF\FreescoutRestrictedCustomers\Http\Controllers\CustomersController;
|
|
|
|
|
|
|
|
// FIXME: Routes are not correctly exposed to the main application,
|
|
|
|
// routes/web.php and Modules/Crm/Http/routes.php must be manually edited.
|
|
|
|
|
2024-07-05 15:46:34 +00:00
|
|
|
// Customers
|
2024-07-03 12:02:11 +00:00
|
|
|
Route::get('/customers/{id}/edit', CustomersController::class . '@update')->name('customers.update');
|
|
|
|
Route::post('/customers/{id}/edit', CustomersController::class . '@updateSave');
|
|
|
|
Route::get('/customers/{id}/', CustomersController::class . '@conversations')->name('customers.conversations');
|
|
|
|
Route::get('/customers/ajax-search', ['uses' => CustomersController::class . '@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
|
|
|
|
Route::post('/customers/ajax', ['uses' => CustomersController::class . '@ajax', 'laroute' => true])->name('customers.ajax');
|
2024-07-05 15:46:34 +00:00
|
|
|
// Conversations
|
|
|
|
Route::get('/search', ConversationsController::class . '@search')->name('conversations.search');
|
|
|
|
// Crm module
|
2024-07-03 12:02:11 +00:00
|
|
|
Route::group([ 'roles' => ['user', 'admin'] ], function() {
|
2024-07-05 12:18:54 +00:00
|
|
|
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('freescout-restricted-customers.create_customer');
|
|
|
|
// The Crm module initialization will crash if no route named "crm.create_customer" is set.
|
2024-07-03 12:02:11 +00:00
|
|
|
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('crm.create_customer');
|
|
|
|
Route::post('/customers/new', CrmController::class . '@createCustomerSave');
|
|
|
|
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => CrmController::class . '@ajaxHtml'])->name('crm.ajax_html');
|
|
|
|
Route::get('/customers/fields/ajax-search', ['uses' => CrmController::class . '@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
|
|
|
|
Route::post('/crm/ajax', ['uses' => CrmController::class . '@ajax', 'laroute' => true])->name('crm.ajax');
|
|
|
|
});
|
|
|
|
Route::group([ 'roles' => ['admin'] ], function() {
|
|
|
|
Route::post('/customers/export', ['uses' => CrmController::class . '@export'])->name('crm.export');
|
|
|
|
Route::post('/crm/ajax-admin', ['uses' => CrmController::class . '@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
|
|
|
|
});
|