Compare commits

..

No commits in common. "128301db41acb2e6556ad01a9e1c547bda45561e" and "21d7bbf158b298f50c837ab64a82ba8c014f0a6a" have entirely different histories.

28 changed files with 320 additions and 449 deletions

View file

@ -1,8 +1,3 @@
0.7.0
* Convert the PHP package into a Laravel module,
cf. https://laravelmodules.com/
0.6.1 0.6.1
* Fix the ability to rollback migrations. * Fix the ability to rollback migrations.

View file

@ -1,5 +0,0 @@
<?php
return [
'name' => 'MMFRestrictedCustomers'
];

View file

@ -1,21 +0,0 @@
<?php
namespace Modules\MMFRestrictedCustomers\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class MMFRestrictedCustomersDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}

View file

@ -1,30 +0,0 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => 'web', 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\MMFRestrictedCustomers\Http\Controllers'], function() {
// Customers
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');
// Conversations
Route::get('/search', ConversationsController::class . '@search')->name('conversations.search');
// Crm module
Route::group([ 'roles' => ['user', 'admin'] ], function() {
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('mmfrestrictedcustomers.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');
});
});

View file

@ -1,109 +0,0 @@
<?php
namespace Modules\MMFRestrictedCustomers\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use Modules\MMFRestrictedCustomers\Console\Commands\FetchEmails;
class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Boot the application events.
*
* @return void
*/
public function boot() {
$this->registerConfig();
$this->registerViews();
$this->registerFactories();
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->commands([
FetchEmails::class,
]);
$this->hooks();
}
/**
* Module hooks.
*/
public function hooks() {
//
}
/**
* Register the service provider.
*
* @return void
*/
public function register() {
$this->registerTranslations();
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig() {
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('mmfrestrictedcustomers.php'),
], 'config');
$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'mmfrestrictedcustomers'
);
}
/**
* Register views.
*
* @return void
*/
public function registerViews() {
$viewPath = resource_path('views/modules/mmfrestrictedcustomers');
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([
$sourcePath => $viewPath
],'views');
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/mmfrestrictedcustomers';
}, \Config::get('view.paths')), [$sourcePath]), 'mmfrestrictedcustomers');
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations() {
$this->loadJsonTranslationsFrom(__DIR__ .'/../Resources/lang');
}
/**
* Register an additional directory of factories.
* @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
*/
public function registerFactories() {
if (! app()->environment('production')) {
app(Factory::class)->load(__DIR__ . '/../Database/factories');
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides() {
return [];
}
}

2
Public/.gitignore vendored
View file

@ -1,2 +0,0 @@
*
!/.gitignore

View file

@ -19,7 +19,7 @@ You have been warned.
### Install the package with composer ### Install the package with composer
``` ```
composer require "millions-missing-france/mmfrestrictedcustomers" "0.7.0" composer require "millions-missing-france/freescout-restricted-customers" "0.6.1"
``` ```
### Edit the application routes ### Edit the application routes
@ -44,11 +44,11 @@ should be replaced with:
```php ```php
// Customers // Customers
Route::get('/customers/{id}/edit', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@update')->name('customers.update'); Route::get('/customers/{id}/edit', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@update')->name('customers.update');
Route::post('/customers/{id}/edit', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@updateSave'); Route::post('/customers/{id}/edit', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@updateSave');
Route::get('/customers/{id}/', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@conversations')->name('customers.conversations'); Route::get('/customers/{id}/', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajaxSearch', 'laroute' => true])->name('customers.ajax_search'); Route::get('/customers/ajax-search', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax'); Route::post('/customers/ajax', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax');
``` ```
This other section should be edited too: This other section should be edited too:
@ -78,7 +78,7 @@ Route::get('/mailbox/{mailbox_id}/new-ticket', 'ConversationsController@create')
Route::get('/mailbox/{mailbox_id}/clone-ticket/{from_thread_id}', 'ConversationsController@cloneConversation')->name('conversations.clone_conversation'); Route::get('/mailbox/{mailbox_id}/clone-ticket/{from_thread_id}', 'ConversationsController@cloneConversation')->name('conversations.clone_conversation');
//Route::get('/conversation/draft/{id}', 'ConversationsController@draft')->name('conversations.draft'); //Route::get('/conversation/draft/{id}', 'ConversationsController@draft')->name('conversations.draft');
Route::get('/conversation/ajax-html/{action}', ['uses' => 'ConversationsController@ajaxHtml', 'laroute' => true])->name('conversations.ajax_html'); Route::get('/conversation/ajax-html/{action}', ['uses' => 'ConversationsController@ajaxHtml', 'laroute' => true])->name('conversations.ajax_html');
Route::get('/search', '\Modules\MMFRestrictedCustomers\Http\Controllers\ConversationsController@search')->name('conversations.search'); Route::get('/search', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\ConversationsController@search')->name('conversations.search');
Route::get('/conversation/undo-reply/{thread_id}', 'ConversationsController@undoReply')->name('conversations.undo'); Route::get('/conversation/undo-reply/{thread_id}', 'ConversationsController@undoReply')->name('conversations.undo');
Route::get('/mailbox/{mailbox_id}/chats', 'ConversationsController@chats')->name('conversations.chats'); Route::get('/mailbox/{mailbox_id}/chats', 'ConversationsController@chats')->name('conversations.chats');
``` ```
@ -107,19 +107,19 @@ Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'p
should be replaced with: should be replaced with:
```php ```php
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\MMFRestrictedCustomers\Http\Controllers'], function() Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers'], function()
{ {
Route::get('/customers/new', '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@createCustomer')->name('mmfrestrictedcustomers.create_customer'); Route::get('/customers/new', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@createCustomer')->name('freescout-restricted-customers.create_customer');
Route::post('/customers/new', '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@createCustomerSave'); Route::post('/customers/new', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajaxHtml'])->name('crm.ajax_html'); Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search'); Route::get('/customers/fields/ajax-search', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajax', 'laroute' => true])->name('crm.ajax'); Route::post('/crm/ajax', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajax', 'laroute' => true])->name('crm.ajax');
}); });
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => '\Modules\MMFRestrictedCustomers\Http\Controllers'], function() Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers'], function()
{ {
Route::post('/customers/export', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@export'])->name('crm.export'); Route::post('/customers/export', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@export'])->name('crm.export');
Route::post('/crm/ajax-admin', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin'); Route::post('/crm/ajax-admin', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
}); });
``` ```
@ -134,7 +134,7 @@ At line 173, this route call:
should be replaced with: should be replaced with:
```php ```php
$html = __('Customers').' <a href="#" data-trigger="modal" data-modal-title="'.__('Add Customer').'" data-modal-size="lg" data-modal-no-footer="true" data-modal-body=\'<iframe src="'.route('mmfrestrictedcustomers.create_customer', ['x_embed' => 1]).'" frameborder="0" class="modal-iframe"></iframe>\' class="btn btn-bordered btn-xs" style="position:relative;top:-1px;margin-left:4px;"><i class="glyphicon glyphicon-plus" title="'.__('Add Customer').'" data-toggle="tooltip"></i></a>'; $html = __('Customers').' <a href="#" data-trigger="modal" data-modal-title="'.__('Add Customer').'" data-modal-size="lg" data-modal-no-footer="true" data-modal-body=\'<iframe src="'.route('freescout-restricted-customers.create_customer', ['x_embed' => 1]).'" frameborder="0" class="modal-iframe"></iframe>\' class="btn btn-bordered btn-xs" style="position:relative;top:-1px;margin-left:4px;"><i class="glyphicon glyphicon-plus" title="'.__('Add Customer').'" data-toggle="tooltip"></i></a>';
``` ```
### Edit the artisan commands ### Edit the artisan commands
@ -151,8 +151,8 @@ At the lines 107-108, this:
should be replaced with: should be replaced with:
```php ```php
$fetch_command_identifier = \Helper::getWorkerIdentifier('mmfrestrictedcustomers:fetch-emails'); $fetch_command_identifier = \Helper::getWorkerIdentifier('freescout-restricted-customers:fetch-emails');
$fetch_command_name = 'mmfrestrictedcustomers:fetch-emails' $fetch_command_name = 'freescout-restricted-customers:fetch-emails'
``` ```
### Update the database schema ### Update the database schema

View file

@ -1,175 +0,0 @@
@extends('layouts.app')
@section('title', ($q ? $q.' - ' : '').strip_tags(Eventy::filter('search.title', __('Search'))))
@section('body_class', 'body-search')
@section('sidebar')
@include('partials/sidebar_menu_toggle')
<div class="sidebar-title">
{!! Eventy::filter('search.title', __('Search')) !!}
</div>
<ul class="sidebar-menu sidebar-menu-noicons">
@if (!$recent || (count($recent) == 1 && $recent[0] == $q))
@else
<li class="no-link"><span class="text-help">{{ __('Recent') }}</span></li>
@foreach ($recent as $recent_query)
@if ($recent_query != $q)
<li class="menu-link menu-padded"><a href="{{ route('conversations.search', ['q' => $recent_query, 'mode' => $mode])}}">{{ $recent_query }}</a></li>
@endif
@endforeach
@endif
<li class="no-link"><span class="text-help">{{ __('Filters') }}</span></li>
@foreach ($filters_list as $filter)
<li class="menu-link menu-padded">
<a href="#" data-filter="{{ $filter }}" @if (isset($filters[$filter]))class="active"@endif>{{ mb_strtolower(__(ucwords($filter))) }}:</a>
</li>
@endforeach
</ul>
@endsection
@section('content')
<div class="section-heading section-search">
<form action="{{ route('conversations.search') }}">
@if (request()->x_embed)
<input type="hidden" name="x_embed" value="{{ request()->x_embed }}" />
@endif
@if (!empty($filters['custom']))
<input type="hidden" name="f[custom]" value="{{ $filters['custom'] }}" />
@endif
@if ($mode != App\Conversation::SEARCH_MODE_CONV)
<input type="hidden" name="mode" value="{{ $mode }}" />
@endif
<div class="row" id="search-filters">
<div class="col-sm-6 form-group @if (isset($filters['assigned'])) active @endif" data-filter="assigned">
<label>{{ __('Assigned') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[assigned]" class="form-control" @if (empty($filters['assigned'])) disabled @endif>
<option value=""></option>
<option value="{{ App\Conversation::USER_UNASSIGNED }}" @if (!empty($filters['assigned']) && $filters['assigned'] == App\Conversation::USER_UNASSIGNED)selected="selected"@endif>{{ __('Unassigned') }}</option>
@foreach ($users as $user)
<option value="{{ $user->id }}" @if (!empty($filters['assigned']) && $filters['assigned'] == $user->id)selected="selected"@endif>{{ $user->getFullName() }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['customer'])) active @endif" data-filter="customer">
<label>{{ __('Customer') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<div class="controls">
<select class="form-control" name="f[customer]" id="search-filter-customer" @if (empty($filters['customer'])) disabled @endif/>
@if (!empty($filters['customer']) && !empty($filters_data['customer']))
<option value="{{ $filters_data['customer']->id }}" selected="selected">{{ $filters_data['customer']->getEmailAndName() }}</option>
@endif
</select>
</div>
</div>
<div class="col-sm-6 form-group @if (isset($filters['mailbox'])) active @endif" data-filter="mailbox">
<label>{{ __('Mailbox') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[mailbox]" class="form-control" @if (empty($filters['mailbox'])) disabled @endif>
<option value=""></option>
@foreach ($mailboxes as $mailbox_item)
<option value="{{ $mailbox_item->id }}" @if (!empty($filters['mailbox']) && $filters['mailbox'] == $mailbox_item->id)selected="selected"@endif>{{ $mailbox_item->name }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['status'])) active @endif" data-filter="status">
<label>{{ __('Status') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[status][]" class="form-control filter-multiple" multiple @if (empty($filters['status'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$statuses as $status_id => $dummy)
<option value="{{ $status_id }}" @if (!empty($filters['status']) && in_array($status_id, $filters['status']))selected="selected"@endif>{{ App\Conversation::statusCodeToName($status_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['state'])) active @endif" data-filter="state">
<label>{{ __('State') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[state][]" class="form-control filter-multiple" multiple @if (empty($filters['state'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$states as $state_id => $dummy)
<option value="{{ $state_id }}" @if (!empty($filters['state']) && in_array($state_id, $filters['state']))selected="selected"@endif>{{ App\Conversation::stateCodeToName($state_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['subject'])) active @endif" data-filter="subject">
<label>{{ __('Subject') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[subject]" value="{{ $filters['subject'] ?? ''}}" class="form-control" @if (empty($filters['subject'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['attachments'])) active @endif" data-filter="attachments">
<label>{{ __('Attachments') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[attachments]" class="form-control" @if (empty($filters['attachments'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['attachments']) && $filters['attachments'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
<option value="no" @if (!empty($filters['attachments']) && $filters['attachments'] == 'no')selected="selected"@endif>{{ __('No') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['type'])) active @endif" data-filter="type">
<label>{{ __('Type') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[type]" class="form-control" @if (empty($filters['type'])) disabled @endif>
<option value=""></option>
@foreach (App\Conversation::$types as $type_id => $dummy)
<option value="{{ $type_id }}" @if (!empty($filters['type']) && $filters['type'] == $type_id)selected="selected"@endif>{{ App\Conversation::typeToName($type_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['body'])) active @endif" data-filter="body">
<label>{{ __('Body') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[body]" value="{{ $filters['body'] ?? ''}}" class="form-control" @if (empty($filters['body'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['number'])) active @endif" data-filter="number">
<label>{{ __('Number') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[number]" value="{{ $filters['number'] ?? ''}}" class="form-control" @if (empty($filters['number'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['following'])) active @endif" data-filter="following">
<label>{{ __('Following') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[following]" class="form-control" @if (empty($filters['following'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['following']) && $filters['following'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['id'])) active @endif" data-filter="id">
<label>{{ __('ID') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[id]" value="{{ $filters['id'] ?? ''}}" class="form-control" @if (empty($filters['id'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['after'])) active @endif" data-filter="after">
<label>{{ __('After') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[after]" value="{{ $filters['after'] ?? ''}}" class="form-control input-date" @if (empty($filters['after'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['before'])) active @endif" data-filter="before">
<label>{{ __('Before') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[before]" value="{{ $filters['before'] ?? ''}}" class="form-control input-date" @if (empty($filters['before'])) disabled @endif>
</div>
@action('search.display_filters', $filters, $filters_data, $mode)
</div>
<div class="input-group input-group-lg1">
<input type="text" class="form-control" name="q" value="{{ $q }}">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">{{ __('Search') }}</button>
</span>
</div>
</form>
</div>
<div class="search-results">
<ul class="nav nav-tabs nav-tabs-main margin-top">
@if (Eventy::filter('search.is_tab_visible', true, App\Conversation::SEARCH_MODE_CONV))
<li @if ($mode == App\Conversation::SEARCH_MODE_CONV)class="active search-tab-conv"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CONV])) }}">{{ __('Conversations') }} <b>({{ $conversations->total() }})</b>@action('search.conversations_tab_append', $filters, $conversations->total())</a></li>
@endif
<li @if ($mode == App\Conversation::SEARCH_MODE_CUSTOMERS)class="active"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CUSTOMERS])) }}">{{ __('Customers') }} <b>({{ $customers->total() }})</b></a></li>
</ul>
@if ($mode == App\Conversation::SEARCH_MODE_CONV)
@include('conversations/conversations_table', ['mailbox' => $search_mailbox, 'params' => ['target_blank' => true, 'show_mailbox' => (count(Auth::user()->mailboxesCanView(true)) > 1)]])
@else
@include('mmfrestrictedcustomers::customers/partials/customers_table')
@endif
</div>
@endsection
@include('partials/include_datepicker')
@section('javascript')
@parent
searchInit();
@endsection

View file

@ -1,7 +1,7 @@
{ {
"name": "millions-missing-france/freescout-restricted-customers", "name": "millions-missing-france/freescout-restricted-customers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes", "description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "0.7.0", "version": "0.6.1",
"type": "library", "type": "library",
"license": ["AGPL-3.0-only"], "license": ["AGPL-3.0-only"],
"authors": [ "authors": [
@ -10,19 +10,19 @@
"email": "info@millionsmissing.fr" "email": "info@millionsmissing.fr"
} }
], ],
"extra": { "require": {
"laravel": { "laravel/framework": "v5.5.40"
"providers": [
"Modules\\MMFRestrictedCustomers\\Providers\\MMFRestrictedCustomersServiceProvider"
],
"aliases": {
}
}
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Modules\\MMFRestrictedCustomers\\": "" "MillionsMissingFrance\\FreescoutRestrictedCustomers\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"MillionsMissingFrance\\FreescoutRestrictedCustomers\\FreescoutRestrictedCustomersServiceProvider"
]
} }
} }
} }

View file

@ -7,6 +7,8 @@
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Symfony\Component\Console\Output\ConsoleOutput;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
class DropEmailsOnCustomersDeletion extends Migration { class DropEmailsOnCustomersDeletion extends Migration {
/** /**

View file

@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\ConsoleOutput;
use Modules\MMFRestrictedCustomers\Entities\Customer; use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
class AddMailboxIdColumnToCustomersTable extends Migration { class AddMailboxIdColumnToCustomersTable extends Migration {
/** /**

View file

@ -1,25 +0,0 @@
{
"name": "MMFRestrictedCustomers",
"alias": "mmfrestrictedcustomers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "0.7.0",
"detailsUrl": "",
"author": "Millions Missing FRANCE",
"authorUrl": "info@millionsmissing.fr",
"requiredAppVersion": "1.8.117",
"license": "AGPL-3.0-only",
"keywords": [],
"active": 0,
"order": 0,
"providers": [
"Modules\\MMFRestrictedCustomers\\Providers\\MMFRestrictedCustomersServiceProvider"
],
"aliases": {},
"files": [
"start.php"
],
"requires": [],
"requiredModules": {
"crm": "1.0.46"
}
}

View file

@ -0,0 +1,175 @@
@extends('layouts.app')
@section('title', ($q ? $q.' - ' : '').strip_tags(Eventy::filter('search.title', __('Search'))))
@section('body_class', 'body-search')
@section('sidebar')
@include('partials/sidebar_menu_toggle')
<div class="sidebar-title">
{!! Eventy::filter('search.title', __('Search')) !!}
</div>
<ul class="sidebar-menu sidebar-menu-noicons">
@if (!$recent || (count($recent) == 1 && $recent[0] == $q))
@else
<li class="no-link"><span class="text-help">{{ __('Recent') }}</span></li>
@foreach ($recent as $recent_query)
@if ($recent_query != $q)
<li class="menu-link menu-padded"><a href="{{ route('conversations.search', ['q' => $recent_query, 'mode' => $mode])}}">{{ $recent_query }}</a></li>
@endif
@endforeach
@endif
<li class="no-link"><span class="text-help">{{ __('Filters') }}</span></li>
@foreach ($filters_list as $filter)
<li class="menu-link menu-padded">
<a href="#" data-filter="{{ $filter }}" @if (isset($filters[$filter]))class="active"@endif>{{ mb_strtolower(__(ucwords($filter))) }}:</a>
</li>
@endforeach
</ul>
@endsection
@section('content')
<div class="section-heading section-search">
<form action="{{ route('conversations.search') }}">
@if (request()->x_embed)
<input type="hidden" name="x_embed" value="{{ request()->x_embed }}" />
@endif
@if (!empty($filters['custom']))
<input type="hidden" name="f[custom]" value="{{ $filters['custom'] }}" />
@endif
@if ($mode != App\Conversation::SEARCH_MODE_CONV)
<input type="hidden" name="mode" value="{{ $mode }}" />
@endif
<div class="row" id="search-filters">
<div class="col-sm-6 form-group @if (isset($filters['assigned'])) active @endif" data-filter="assigned">
<label>{{ __('Assigned') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[assigned]" class="form-control" @if (empty($filters['assigned'])) disabled @endif>
<option value=""></option>
<option value="{{ App\Conversation::USER_UNASSIGNED }}" @if (!empty($filters['assigned']) && $filters['assigned'] == App\Conversation::USER_UNASSIGNED)selected="selected"@endif>{{ __('Unassigned') }}</option>
@foreach ($users as $user)
<option value="{{ $user->id }}" @if (!empty($filters['assigned']) && $filters['assigned'] == $user->id)selected="selected"@endif>{{ $user->getFullName() }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['customer'])) active @endif" data-filter="customer">
<label>{{ __('Customer') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<div class="controls">
<select class="form-control" name="f[customer]" id="search-filter-customer" @if (empty($filters['customer'])) disabled @endif/>
@if (!empty($filters['customer']) && !empty($filters_data['customer']))
<option value="{{ $filters_data['customer']->id }}" selected="selected">{{ $filters_data['customer']->getEmailAndName() }}</option>
@endif
</select>
</div>
</div>
<div class="col-sm-6 form-group @if (isset($filters['mailbox'])) active @endif" data-filter="mailbox">
<label>{{ __('Mailbox') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[mailbox]" class="form-control" @if (empty($filters['mailbox'])) disabled @endif>
<option value=""></option>
@foreach ($mailboxes as $mailbox_item)
<option value="{{ $mailbox_item->id }}" @if (!empty($filters['mailbox']) && $filters['mailbox'] == $mailbox_item->id)selected="selected"@endif>{{ $mailbox_item->name }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['status'])) active @endif" data-filter="status">
<label>{{ __('Status') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[status][]" class="form-control filter-multiple" multiple @if (empty($filters['status'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$statuses as $status_id => $dummy)
<option value="{{ $status_id }}" @if (!empty($filters['status']) && in_array($status_id, $filters['status']))selected="selected"@endif>{{ App\Conversation::statusCodeToName($status_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['state'])) active @endif" data-filter="state">
<label>{{ __('State') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[state][]" class="form-control filter-multiple" multiple @if (empty($filters['state'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$states as $state_id => $dummy)
<option value="{{ $state_id }}" @if (!empty($filters['state']) && in_array($state_id, $filters['state']))selected="selected"@endif>{{ App\Conversation::stateCodeToName($state_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['subject'])) active @endif" data-filter="subject">
<label>{{ __('Subject') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[subject]" value="{{ $filters['subject'] ?? ''}}" class="form-control" @if (empty($filters['subject'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['attachments'])) active @endif" data-filter="attachments">
<label>{{ __('Attachments') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[attachments]" class="form-control" @if (empty($filters['attachments'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['attachments']) && $filters['attachments'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
<option value="no" @if (!empty($filters['attachments']) && $filters['attachments'] == 'no')selected="selected"@endif>{{ __('No') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['type'])) active @endif" data-filter="type">
<label>{{ __('Type') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[type]" class="form-control" @if (empty($filters['type'])) disabled @endif>
<option value=""></option>
@foreach (App\Conversation::$types as $type_id => $dummy)
<option value="{{ $type_id }}" @if (!empty($filters['type']) && $filters['type'] == $type_id)selected="selected"@endif>{{ App\Conversation::typeToName($type_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['body'])) active @endif" data-filter="body">
<label>{{ __('Body') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[body]" value="{{ $filters['body'] ?? ''}}" class="form-control" @if (empty($filters['body'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['number'])) active @endif" data-filter="number">
<label>{{ __('Number') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[number]" value="{{ $filters['number'] ?? ''}}" class="form-control" @if (empty($filters['number'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['following'])) active @endif" data-filter="following">
<label>{{ __('Following') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[following]" class="form-control" @if (empty($filters['following'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['following']) && $filters['following'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['id'])) active @endif" data-filter="id">
<label>{{ __('ID') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[id]" value="{{ $filters['id'] ?? ''}}" class="form-control" @if (empty($filters['id'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['after'])) active @endif" data-filter="after">
<label>{{ __('After') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[after]" value="{{ $filters['after'] ?? ''}}" class="form-control input-date" @if (empty($filters['after'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['before'])) active @endif" data-filter="before">
<label>{{ __('Before') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[before]" value="{{ $filters['before'] ?? ''}}" class="form-control input-date" @if (empty($filters['before'])) disabled @endif>
</div>
@action('search.display_filters', $filters, $filters_data, $mode)
</div>
<div class="input-group input-group-lg1">
<input type="text" class="form-control" name="q" value="{{ $q }}">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">{{ __('Search') }}</button>
</span>
</div>
</form>
</div>
<div class="search-results">
<ul class="nav nav-tabs nav-tabs-main margin-top">
@if (Eventy::filter('search.is_tab_visible', true, App\Conversation::SEARCH_MODE_CONV))
<li @if ($mode == App\Conversation::SEARCH_MODE_CONV)class="active search-tab-conv"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CONV])) }}">{{ __('Conversations') }} <b>({{ $conversations->total() }})</b>@action('search.conversations_tab_append', $filters, $conversations->total())</a></li>
@endif
<li @if ($mode == App\Conversation::SEARCH_MODE_CUSTOMERS)class="active"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CUSTOMERS])) }}">{{ __('Customers') }} <b>({{ $customers->total() }})</b></a></li>
</ul>
@if ($mode == App\Conversation::SEARCH_MODE_CONV)
@include('conversations/conversations_table', ['mailbox' => $search_mailbox, 'params' => ['target_blank' => true, 'show_mailbox' => (count(Auth::user()->mailboxesCanView(true)) > 1)]])
@else
@include('freescout-restricted-customers::customers/partials/customers_table')
@endif
</div>
@endsection
@include('partials/include_datepicker')
@section('javascript')
@parent
searchInit();
@endsection

View file

@ -3,7 +3,7 @@
@section('title', 'Add Customer (MillionsMissingFrance)') @section('title', 'Add Customer (MillionsMissingFrance)')
@section('content') @section('content')
@include('mmfrestrictedcustomers::customers/partials/edit_form', ['save_button_title' => __('Add')]) @include('freescout-restricted-customers::customers/partials/edit_form', ['save_button_title' => __('Add')])
@endsection @endsection
@section('javascript') @section('javascript')

View file

@ -14,7 +14,7 @@
@section('content') @section('content')
@include('customers/profile_tabs') @include('customers/profile_tabs')
@include('mmfrestrictedcustomers::customers/partials/edit_form') @include('freescout-restricted-customers::customers/partials/edit_form')
@endsection @endsection
@section('javascript') @section('javascript')

36
routes/web.php Normal file
View file

@ -0,0 +1,36 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
use Illuminate\Support\Facades\Route;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\ConversationsController;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController;
use MillionsMissingFrance\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.
// Customers
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');
// Conversations
Route::get('/search', ConversationsController::class . '@search')->name('conversations.search');
// Crm module
Route::group([ 'roles' => ['user', 'admin'] ], function() {
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.
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');
});

View file

@ -4,10 +4,10 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr> SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/ */
namespace Modules\MMFRestrictedCustomers\Console\Commands; namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Console\Commands;
use App\Conversation; use App\Conversation;
use Modules\MMFRestrictedCustomers\Entities\Customer; use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use App\Events\CustomerCreatedConversation; use App\Events\CustomerCreatedConversation;
use App\Events\CustomerReplied; use App\Events\CustomerReplied;
use App\Thread; use App\Thread;
@ -21,7 +21,7 @@ class FetchEmails extends BaseFetchEmails {
* *
* @var string * @var string
*/ */
protected $signature = 'mmfrestrictedcustomers:fetch-emails {--days=3} {--unseen=1} {--identifier=dummy} {--mailboxes=0}'; protected $signature = 'freescout-restricted-customers:fetch-emails {--days=3} {--unseen=1} {--identifier=dummy} {--mailboxes=0}';
/** /**
* Save email from customer as thread. * Save email from customer as thread.

View file

@ -4,8 +4,14 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr> SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/ */
namespace Modules\MMFRestrictedCustomers\Entities; namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
use App\CustomerChannel;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Watson\Rememberable\Rememberable;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Mailbox;
use App\Customer as BaseCustomer; use App\Customer as BaseCustomer;
class Customer extends BaseCustomer { class Customer extends BaseCustomer {

View file

@ -4,8 +4,10 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr> SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/ */
namespace Modules\MMFRestrictedCustomers\Entities; namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
use Illuminate\Database\Eloquent\Model;
use Watson\Rememberable\Rememberable;
use App\Email as BaseEmail; use App\Email as BaseEmail;
class Email extends BaseEmail { class Email extends BaseEmail {

View file

@ -0,0 +1,38 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Console\Commands\FetchEmails;
class FreescoutRestrictedCustomersServiceProvider extends ServiceProvider {
public function register() {
//
}
public function boot() {
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
$this->registerRoutes();
$this->loadViewsFrom(__DIR__.'/../resources/views', 'freescout-restricted-customers');
$this->commands([
FetchEmails::class,
]);
}
protected function registerRoutes() {
Route::group($this->routeConfiguration(), function () {
$this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
});
}
protected function routeConfiguration() {
return [
'middleware' => ['web', 'auth', 'roles'],
];
}
}

View file

@ -4,13 +4,13 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr> SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/ */
namespace Modules\MMFRestrictedCustomers\Http\Controllers; namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers;
use App\Conversation; use App\Conversation;
use App\User; use App\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\ConversationsController as BaseConversationsController; use App\Http\Controllers\ConversationsController as BaseConversationsController;
use Modules\MMFRestrictedCustomers\Entities\Customer; use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
class ConversationsController extends BaseConversationsController { class ConversationsController extends BaseConversationsController {
/** /**
@ -91,7 +91,7 @@ class ConversationsController extends BaseConversationsController {
$search_mailbox = $mailboxes[0]; $search_mailbox = $mailboxes[0];
} }
return view('mmfrestrictedcustomers::conversations/search', [ return view('freescout-restricted-customers::conversations/search', [
'folder' => $folder, 'folder' => $folder,
'q' => $request->q, 'q' => $request->q,
'filters' => $filters, 'filters' => $filters,

View file

@ -4,7 +4,7 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr> SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/ */
namespace Modules\MMFRestrictedCustomers\Http\Controllers; namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers;
use App\Conversation; use App\Conversation;
use Modules\Crm\Entities\CustomerField; use Modules\Crm\Entities\CustomerField;
@ -14,9 +14,9 @@ use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Routing\Controller; use Illuminate\Routing\Controller;
use Modules\Crm\Http\Controllers\CrmController as BaseCrmController; use Modules\Crm\Http\Controllers\CrmController as BaseCrmController;
use Modules\MMFRestrictedCustomers\Entities\Customer; use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use Modules\MMFRestrictedCustomers\Entities\Email; use MillionsMissingFrance\FreescoutRestrictedCustomers\Email;
use Modules\MMFRestrictedCustomers\Entities\Mailbox; use MillionsMissingFrance\FreescoutRestrictedCustomers\Mailbox;
class CrmController extends BaseCrmController { class CrmController extends BaseCrmController {
public function createCustomer(Request $request) { public function createCustomer(Request $request) {
@ -26,7 +26,7 @@ class CrmController extends BaseCrmController {
$user = auth()->user(); $user = auth()->user();
$mailboxes = $user->mailboxesCanView(); $mailboxes = $user->mailboxesCanView();
return view('mmfrestrictedcustomers::create_customer', [ return view('freescout-restricted-customers::create_customer', [
'customer' => $customer, 'customer' => $customer,
'mailboxes' => $mailboxes, 'mailboxes' => $mailboxes,
'emails' => [''], 'emails' => [''],
@ -68,7 +68,7 @@ class CrmController extends BaseCrmController {
} }
if ($fail || $validator->fails()) { if ($fail || $validator->fails()) {
return redirect()->route('mmfrestrictedcustomers.create_customer') return redirect()->route('freescout-restricted-customers.create_customer')
->withErrors($validator) ->withErrors($validator)
->withInput(); ->withInput();
} }

View file

@ -4,14 +4,14 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr> SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/ */
namespace Modules\MMFRestrictedCustomers\Http\Controllers; namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers;
use App\Conversation; use App\Conversation;
use App\Email; use App\Email;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Validator; use Validator;
use App\Http\Controllers\CustomersController as BaseCustomersController; use App\Http\Controllers\CustomersController as BaseCustomersController;
use Modules\MMFRestrictedCustomers\Entities\Customer; use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
class CustomersController extends BaseCustomersController { class CustomersController extends BaseCustomersController {
/** /**
@ -36,7 +36,7 @@ class CustomersController extends BaseCustomersController {
$emails = ['']; $emails = [''];
} }
return view('mmfrestrictedcustomers::customers/update', [ return view('freescout-restricted-customers::customers/update', [
'customer' => $customer, 'customer' => $customer,
'mailboxes' => $mailboxes, 'mailboxes' => $mailboxes,
'emails' => $emails, 'emails' => $emails,
@ -382,11 +382,11 @@ class CustomersController extends BaseCustomersController {
// Conversations navigation // Conversations navigation
case 'customers_pagination': case 'customers_pagination':
$customers = app('Modules\MMFRestrictedCustomers\Http\Controllers\ConversationsController')->searchCustomers($request, $user); $customers = app('MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\ConversationsController')->searchCustomers($request, $user);
$response['status'] = 'success'; $response['status'] = 'success';
$response['html'] = view('mmfrestrictedcustomers::customers/partials/customers_table', [ $response['html'] = view('freescout-restricted-customers::customers/partials/customers_table', [
'customers' => $customers, 'customers' => $customers,
])->render(); ])->render();
break; break;

View file

@ -4,8 +4,9 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr> SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/ */
namespace Modules\MMFRestrictedCustomers\Entities; namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use App\Mailbox as BaseMailbox; use App\Mailbox as BaseMailbox;
class Mailbox extends BaseMailbox { class Mailbox extends BaseMailbox {

View file

@ -1,17 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Register Namespaces And Routes
|--------------------------------------------------------------------------
|
| When a module starting, this file will executed automatically. This helps
| to register some namespaces like translator or view. Also this file
| will load the routes file for each module. You may also modify
| this file as you want.
|
*/
if (!app()->routesAreCached()) {
require __DIR__ . '/Http/routes.php';
}