feature : add login as customer to admin customer grid

This commit is contained in:
darvishani 2022-11-25 13:11:11 +03:30
parent a9f1cc92f6
commit b81301c828
26 changed files with 231 additions and 1 deletions

View File

@ -192,6 +192,14 @@ class CustomerDataGrid extends DataGrid
'title' => trans('admin::app.customers.note.help-title'),
]);
$this->addAction([
'method' => 'GET',
'route' => 'admin.customer.loginascustomer',
'icon' => 'icon lock-icon',
'target'=>'blank',
'title' => trans('admin::app.customers.loginascustomer.grid-title'),
]);
$this->addAction([
'method' => 'POST',
'route' => 'admin.customer.delete',

View File

@ -168,6 +168,22 @@ class CustomerController extends Controller
return response()->json(['message' => trans('admin::app.response.delete-failed', ['name' => 'Customer'])], 400);
}
/**
* @param $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function loginAsCustomer($id)
{
$customer = $this->customerRepository->findOrFail($id);
auth()->guard('customer')->login($customer);
session()->flash('success',trans('admin::app.customers.loginascustomer.login-message',['customer_name'=>$customer->name]));
return redirect(route('shop.customer.profile.index'));
}
/**
* To load the note taking screen for the customers.
*

View File

@ -1036,6 +1036,11 @@ return [
'error-create' => 'لم يتم إنشاء عنوان العميل',
],
'loginascustomer' => [
'grid-title'=>'سجل دخولك كعميل',
'login-message'=>'you login as :customer_name'
],
'note' => [
'title' => 'اضف ملاحظة',
'save-note' => 'حفظ الملاحظة',

View File

@ -1044,6 +1044,11 @@ return [
'error-create' => 'গ্রাহক ঠিকানা তৈরি করা হয়নি.',
],
'loginascustomer' => [
'grid-title'=>'গ্রাহক হিসাবে লগইন করুন',
'login-message'=>'আপনি হিসাবে লগ ইন করেছেন :customer_name'
],
'note' => [
'title' => 'নোট যোগ করুন',
'save-note' => 'নোট সংরক্ষণ করুন',

View File

@ -1037,6 +1037,12 @@ return [
'success-mass-delete' => 'Erfolg: Die ausgewählten Adressen wurden erfolgreich gelöscht.',
'error-create' => 'Fehler: Kunde-Adresse nicht erstellt.',
],
'loginascustomer' => [
'grid-title'=>'inloggen als klant',
'login-message'=>'je bent ingelogd als :customer_name'
],
'note' =>
[
'title' => 'Notiz hinzufügen',

View File

@ -1043,6 +1043,11 @@ return [
'error-create' => 'Customer address not created.',
],
'loginascustomer' => [
'grid-title'=>'login as customer',
'login-message'=>'you logged in as :customer_name'
],
'note' => [
'title' => 'Add Note',
'save-note' => 'Save Note',

View File

@ -1034,6 +1034,11 @@ return [
'error-create' => 'La dirección del cliente no fue creada.',
],
'loginascustomer' => [
'grid-title'=>'logige sisse kliendina',
'login-message'=>'logisite sisse kui :customer_name'
],
'note' => [
'title' => 'Agregar nota',
'save-note' => 'Guardar nota',

View File

@ -1017,6 +1017,11 @@ return [
'error-create' => 'آدرس مشتری ایجاد نشده است Error:',
],
'loginascustomer' => [
'grid-title'=>'به عنوان مشتری وارد شوید',
'login-message'=>'به عنوان مشتری وارد شدید :customer_name'
],
'note' => [
'title' => 'افزودن یادداشت',
'save-note' => 'ذخیره یادداشت',

View File

@ -1044,6 +1044,11 @@ return [
'error-create' => 'Erreur : L\'adresse du client n\'a pas été créée.',
],
'loginascustomer' => [
'grid-title'=>'se connecter en tant que client',
'login-message'=>'vous vous êtes connecté en tant que :customer_name'
],
'note' => [
'title' => 'Ajouter une note',
'save-note' => 'Enregistrer la note',

View File

@ -1043,6 +1043,11 @@ return [
'error-create' => 'Customer address not created.',
],
'loginascustomer' => [
'grid-title'=>'login as customer',
'login-message'=>'you logged in as :customer_name'
],
'note' => [
'title' => 'Add Note',
'save-note' => 'Save Note',

View File

@ -1040,6 +1040,11 @@ return [
'error-create' => 'ग्राहक पता नहीं बनाया गया।',
],
'loginascustomer' => [
'grid-title'=>'ग्राहक के रूप में लॉगिन करें',
'login-message'=>'आप के रूप में लॉग इन किया :customer_name'
],
'note' => [
'title' => 'नोट जोड़े',
'save-note' => 'नोट सहेजें',

View File

@ -1026,6 +1026,11 @@ return [
'error-create' => 'Indirizzo cliente non creato.',
],
'loginascustomer' => [
'grid-title'=>'accedi come cliente',
'login-message'=>'hai effettuato l accesso come :customer_name'
],
'note' => [
'title' => 'Aggiungi Nota',
'save-note' => 'Salva Nota',

View File

@ -1043,6 +1043,11 @@ return [
'error-create' => 'Customer address not created.',
],
'loginascustomer' => [
'grid-title'=>'login as customer',
'login-message'=>'you login as :customer_name'
],
'note' => [
'title' => 'Add Note',
'save-note' => 'Save Note',

View File

@ -1020,6 +1020,11 @@ return [
'error-create' => 'Error: Klantadres niet aangemaakt.',
],
'loginascustomer' => [
'grid-title'=>'login as customer',
'login-message'=>'you login as :customer_name'
],
'note' => [
'title' => 'Notitie toevoegen',
'save-note' => 'Notitie opslaan',

View File

@ -1021,6 +1021,11 @@ return [
'error-create' => 'Błąd: nie utworzono adresu klienta.',
],
'loginascustomer' => [
'grid-title'=>'zaloguj się jako klient',
'login-message'=>'logujesz się jako :customer_name'
],
'note' => [
'title' => 'Dodaj notatkę',
'save-note' => 'Zapisz notatkę ',

View File

@ -1020,6 +1020,11 @@ return [
'error-create' => 'Error: Endereço do cliente não criado.',
],
'loginascustomer' => [
'grid-title'=>'entrar como cliente',
'login-message'=>'você se conectou como :customer_name'
],
'note' => [
'title' => 'Adicionar nota',
'save-note' => 'Salvar nota',

View File

@ -1043,6 +1043,11 @@ return [
'error-create' => 'Адрес клиента не создан.',
],
'loginascustomer' => [
'grid-title'=>'войти как клиент',
'login-message'=>'вы вошли как :customer_name'
],
'note' => [
'title' => 'Добавить заметку',
'save-note' => 'Сохранить заметку',

View File

@ -1043,6 +1043,11 @@ return [
'error-create' => 'Customer address not created.',
],
'loginascustomer' => [
'grid-title'=>'login as customer',
'login-message'=>'you logged in as :customer_name'
],
'note' => [
'title' => 'Add Note',
'save-note' => 'Save Note',

View File

@ -1022,6 +1022,11 @@ return [
'error-create' => 'Müşteri adresi silinirken hata oluştu!',
],
'loginascustomer' => [
'grid-title'=>'login as customer',
'login-message'=>'you login as :customer_name'
],
'note' => [
'title' => 'Not Ekle',
'save-note' => 'Not Kaydet',

View File

@ -1044,6 +1044,11 @@ return [
'error-create' => 'Адрес клиента не создан.',
],
'loginascustomer' => [
'grid-title'=>'увійти як клієнт',
'login-message'=>'ви ввійшли як :customer_name'
],
'note' => [
'title' => 'Добавить заметку',
'save-note' => 'Сохранить заметку',

View File

@ -1018,6 +1018,11 @@ return [
'error-create' => '客户地址没有创建.',
],
'loginascustomer' => [
'grid-title'=>'以客户身份登录',
'login-message'=>'您登录为 :customer_name'
],
'note' => [
'title' => '添加备注',
'save-note' => '保存备注',

View File

@ -29,6 +29,8 @@ Route::group(['middleware' => ['web', 'admin'], 'prefix' => config('app.admin_ur
'view' => 'admin::customers.edit',
])->name('admin.customer.edit');
Route::get('customers/loginascustomer/{id}', [CustomerController::class, 'loginAsCustomer'])->name('admin.customer.loginascustomer');
Route::get('customers/note/{id}', [CustomerController::class, 'createNote'])->defaults('_config', [
'view' => 'admin::customers.note',
])->name('admin.customer.note.create');

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 202.96 202.96" style="enable-background:new 0 0 202.96 202.96;" xml:space="preserve">
<g>
<g>
<path style="fill:#010002;" d="M155.082,77.378h-10.271l6.116-23.373c5.404-20.654-6.997-41.858-27.657-47.266l-20.897-5.472
c-20.661-5.408-41.873,7-47.28,27.654l8.904,2.33C68.113,15.5,84.289,6.041,100.029,10.164l20.911,5.468
c15.743,4.123,25.209,20.292,21.094,36.043l-6.732,25.7H47.885c-7.605,0-13.796,6.188-13.796,13.796v97.993
c0,7.605,6.191,13.796,13.796,13.796h107.194c7.601,0,13.793-6.191,13.793-13.796V91.178
C168.875,83.57,162.684,77.378,155.082,77.378z M159.674,189.171c0,2.537-2.061,4.595-4.592,4.595H47.885
c-2.53,0-4.595-2.058-4.595-4.595V91.178c0-2.537,2.065-4.599,4.595-4.599h107.194c2.53,0,4.592,2.061,4.592,4.599v97.993H159.674
z"/>
<path style="fill:#010002;" d="M101.478,120.081c-9.563,0-17.347,7.777-17.347,17.343c0,5.894,3.035,11.345,7.995,14.527v19.358
c0,5.161,4.191,9.352,9.348,9.352c5.154,0,9.355-4.191,9.355-9.352v-19.351c4.964-3.189,7.995-8.636,7.995-14.534
C118.832,127.858,111.048,120.081,101.478,120.081z M107.444,148.615l-1.217,0.651v22.042c0,2.62-2.126,4.756-4.749,4.756
c-2.613,0-4.753-2.137-4.753-4.756v-22.049l-1.217-0.644c-4.177-2.248-6.782-6.531-6.782-11.191
c0-7.025,5.719-12.744,12.751-12.744c7.029,0,12.748,5.719,12.748,12.744C114.226,142.08,111.635,146.368,107.444,148.615z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 202.96 202.96" style="enable-background:new 0 0 202.96 202.96;" xml:space="preserve">
<g>
<g>
<path style="fill:#010002;" d="M155.082,77.378h-10.271l6.116-23.373c5.404-20.654-6.997-41.858-27.657-47.266l-20.897-5.472
c-20.661-5.408-41.873,7-47.28,27.654l8.904,2.33C68.113,15.5,84.289,6.041,100.029,10.164l20.911,5.468
c15.743,4.123,25.209,20.292,21.094,36.043l-6.732,25.7H47.885c-7.605,0-13.796,6.188-13.796,13.796v97.993
c0,7.605,6.191,13.796,13.796,13.796h107.194c7.601,0,13.793-6.191,13.793-13.796V91.178
C168.875,83.57,162.684,77.378,155.082,77.378z M159.674,189.171c0,2.537-2.061,4.595-4.592,4.595H47.885
c-2.53,0-4.595-2.058-4.595-4.595V91.178c0-2.537,2.065-4.599,4.595-4.599h107.194c2.53,0,4.592,2.061,4.592,4.599v97.993H159.674
z"/>
<path style="fill:#010002;" d="M101.478,120.081c-9.563,0-17.347,7.777-17.347,17.343c0,5.894,3.035,11.345,7.995,14.527v19.358
c0,5.161,4.191,9.352,9.348,9.352c5.154,0,9.355-4.191,9.355-9.352v-19.351c4.964-3.189,7.995-8.636,7.995-14.534
C118.832,127.858,111.048,120.081,101.478,120.081z M107.444,148.615l-1.217,0.651v22.042c0,2.62-2.126,4.756-4.749,4.756
c-2.613,0-4.753-2.137-4.753-4.756v-22.049l-1.217-0.644c-4.177-2.248-6.782-6.531-6.782-11.191
c0-7.025,5.719-12.744,12.751-12.744c7.029,0,12.748,5.719,12.748,12.744C114.226,142.08,111.635,146.368,107.444,148.615z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -453,4 +453,10 @@
background-image: url("../images/upload-icon.svg");
width: 24px;
height: 24px;
}
.lock-icon {
background-image: url("../images/icon-lock.svg");
width: 24px;
height: 24px;
}