Skip to content

Commit 8e8b146

Browse files
authored
Merge pull request #47 from modx-pro/dev/customer
Работа с msCustomer
2 parents 4e57fc0 + f095e75 commit 8e8b146

File tree

116 files changed

+14737
-894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+14737
-894
lines changed

_build/elements/chunks.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,16 @@
2020
'tpl.msEmail.paid.manager' => 'ms3_email_paid_manager',
2121
'tpl.msEmail.sent.customer' => 'ms3_email_sent_customer',
2222
'tpl.msEmail.cancelled.customer' => 'ms3_email_cancelled_customer',
23+
24+
// Customer Account Chunks
25+
'tpl.msCustomer.base' => 'ms3_customer_base',
26+
'tpl.msCustomer.sidebar' => 'ms3_customer_sidebar',
27+
'tpl.msCustomer.unauthorized' => 'ms3_customer_unauthorized',
28+
'tpl.msCustomer.profile' => 'ms3_customer_profile',
29+
'tpl.msCustomer.addresses' => 'ms3_customer_addresses',
30+
'tpl.msCustomer.address.row' => 'ms3_customer_address_row',
31+
'tpl.msCustomer.address.form' => 'ms3_customer_address_form',
32+
'tpl.msCustomer.orders' => 'ms3_customer_orders',
33+
'tpl.msCustomer.order.row' => 'ms3_customer_order_row',
34+
'tpl.msCustomer.order.details' => 'ms3_customer_order_details',
2335
];

_build/elements/plugins.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
'description' => '',
77
'events' => [
88
'OnMODXInit',
9-
'OnHandleRequest',
109
'OnLoadWebDocument',
1110
'OnManagerPageBeforeRender',
11+
'OnUserSave',
12+
'OnBeforeUserFormSave',
13+
'OnUserRemove',
1214
],
1315
],
1416
];

_build/elements/settings.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,50 @@
332332
'area' => 'ms3_customers',
333333
],
334334

335+
// Customer Authentication & Registration
336+
'ms3_customer_auto_register_on_order' => [
337+
'value' => true,
338+
'xtype' => 'combo-boolean',
339+
'area' => 'ms3_customers',
340+
],
341+
'ms3_customer_auto_login_on_order' => [
342+
'value' => true,
343+
'xtype' => 'combo-boolean',
344+
'area' => 'ms3_customers',
345+
],
346+
'ms3_customer_require_email_verification' => [
347+
'value' => false,
348+
'xtype' => 'combo-boolean',
349+
'area' => 'ms3_customers',
350+
],
351+
'ms3_customer_send_welcome_email' => [
352+
'value' => true,
353+
'xtype' => 'combo-boolean',
354+
'area' => 'ms3_customers',
355+
],
356+
357+
// Customer Sync with modUser
358+
'ms3_customer_sync_enabled' => [
359+
'value' => false,
360+
'xtype' => 'combo-boolean',
361+
'area' => 'ms3_customers',
362+
],
363+
'ms3_customer_sync_create_moduser' => [
364+
'value' => false,
365+
'xtype' => 'combo-boolean',
366+
'area' => 'ms3_customers',
367+
],
368+
'ms3_customer_sync_delete_with_user' => [
369+
'value' => false,
370+
'xtype' => 'combo-boolean',
371+
'area' => 'ms3_customers',
372+
],
373+
'ms3_customer_sync_user_group' => [
374+
'value' => 0,
375+
'xtype' => 'numberfield',
376+
'area' => 'ms3_customers',
377+
],
378+
335379
// Token Security Settings
336380
'ms3_customer_token_ttl' => [
337381
'value' => 86400, // 24 часа
@@ -349,6 +393,40 @@
349393
'area' => 'ms3_security',
350394
],
351395

396+
// Login Security
397+
'ms3_customer_max_login_attempts' => [
398+
'value' => 5,
399+
'xtype' => 'numberfield',
400+
'area' => 'ms3_security',
401+
],
402+
'ms3_customer_block_duration' => [
403+
'value' => 300, // 5 минут в секундах
404+
'xtype' => 'numberfield',
405+
'area' => 'ms3_security',
406+
],
407+
408+
// Password Requirements
409+
'ms3_password_min_length' => [
410+
'value' => 8,
411+
'xtype' => 'numberfield',
412+
'area' => 'ms3_security',
413+
],
414+
'ms3_password_require_uppercase' => [
415+
'value' => false,
416+
'xtype' => 'combo-boolean',
417+
'area' => 'ms3_security',
418+
],
419+
'ms3_password_require_number' => [
420+
'value' => false,
421+
'xtype' => 'combo-boolean',
422+
'area' => 'ms3_security',
423+
],
424+
'ms3_password_require_special' => [
425+
'value' => false,
426+
'xtype' => 'combo-boolean',
427+
'area' => 'ms3_security',
428+
],
429+
352430
// Currency and Formatting Settings
353431
'ms3_currency_symbol' => [
354432
'value' => '',

_build/elements/snippets.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,6 @@
241241
'file' => 'ms3_customer',
242242
'description' => '',
243243
'properties' => [
244-
'tpl' => [
245-
'type' => 'textfield',
246-
'value' => 'tpl.msCustomerForm',
247-
],
248244
],
249245
],
250246
'msOrder' => [
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* - Каталог товаров (публичные данные)
1010
*
1111
* Использование:
12-
* action.php?route=/api/v1/customer/token/get
13-
* action.php?route=/api/v1/cart/add
12+
* api.php?route=/api/v1/customer/token/get
13+
* api.php?route=/api/v1/cart/add
1414
*
1515
* @package MiniShop3
1616
*/
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/**
2+
* MiniShop3 - Стили личного кабинета клиента
3+
*
4+
* Включает стили для:
5+
* - Базового layout (.ms3-customer-account)
6+
* - Sidebar (.ms3-customer-sidebar)
7+
* - Страницы профиля (.ms3-customer-profile)
8+
*/
9+
10+
/* ============================================
11+
БАЗОВЫЙ LAYOUT
12+
============================================ */
13+
.ms3-customer-account {
14+
padding: 2rem 0;
15+
}
16+
17+
.ms3-customer-content {
18+
background: #fff;
19+
border: 1px solid #dee2e6;
20+
border-radius: 0.5rem;
21+
padding: 2rem;
22+
box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
23+
}
24+
25+
@media (max-width: 768px) {
26+
.ms3-customer-content {
27+
padding: 1rem;
28+
}
29+
}
30+
31+
/* ============================================
32+
SIDEBAR
33+
============================================ */
34+
.ms3-customer-sidebar {
35+
background: #fff;
36+
border: 1px solid #dee2e6;
37+
border-radius: 0.5rem;
38+
padding: 1.5rem;
39+
box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
40+
}
41+
42+
.customer-info {
43+
padding-bottom: 1rem;
44+
border-bottom: 1px solid #dee2e6;
45+
}
46+
47+
.customer-avatar {
48+
width: 80px;
49+
height: 80px;
50+
border-radius: 50%;
51+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
52+
display: flex;
53+
align-items: center;
54+
justify-content: center;
55+
font-size: 2rem;
56+
font-weight: 600;
57+
color: white;
58+
margin-bottom: 1rem;
59+
box-shadow: 0 0.25rem 0.5rem rgba(102, 126, 234, 0.3);
60+
}
61+
62+
.customer-name {
63+
font-size: 1.1rem;
64+
font-weight: 600;
65+
color: #212529;
66+
margin: 0;
67+
}
68+
69+
.customer-email {
70+
font-size: 0.875rem;
71+
margin: 0.25rem 0;
72+
}
73+
74+
.verification-badge {
75+
display: inline-flex;
76+
align-items: center;
77+
font-size: 0.75rem;
78+
padding: 0.25rem 0.5rem;
79+
border-radius: 1rem;
80+
font-weight: 500;
81+
}
82+
83+
.verification-badge.verified {
84+
background: #d4edda;
85+
color: #155724;
86+
}
87+
88+
.verification-badge.unverified {
89+
background: #fff3cd;
90+
color: #856404;
91+
}
92+
93+
.ms3-customer-sidebar .nav-link {
94+
display: flex;
95+
align-items: center;
96+
padding: 0.75rem 1rem;
97+
margin-bottom: 0.25rem;
98+
color: #495057;
99+
border-radius: 0.375rem;
100+
transition: all 0.2s ease;
101+
text-decoration: none;
102+
font-weight: 500;
103+
}
104+
105+
.ms3-customer-sidebar .nav-link:hover {
106+
background: #f8f9fa;
107+
color: #212529;
108+
}
109+
110+
.ms3-customer-sidebar .nav-link.active {
111+
background: #667eea;
112+
color: white;
113+
}
114+
115+
.ms3-customer-sidebar .nav-link.text-danger {
116+
color: #dc3545 !important;
117+
}
118+
119+
.ms3-customer-sidebar .nav-link.text-danger:hover {
120+
background: #f8d7da;
121+
}
122+
123+
.ms3-customer-sidebar hr {
124+
margin: 0.5rem 0;
125+
border-color: #dee2e6;
126+
}
127+
128+
@media (max-width: 768px) {
129+
.customer-avatar {
130+
width: 60px;
131+
height: 60px;
132+
font-size: 1.5rem;
133+
}
134+
135+
.ms3-customer-sidebar .nav-link {
136+
padding: 0.5rem 0.75rem;
137+
font-size: 0.875rem;
138+
}
139+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Простой HTML wrapper для Vue приложения управления клиентами
3+
*
4+
* Создает контейнер для монтирования Vue приложения
5+
*/
6+
7+
// Создаем простой компонент для MODX
8+
Ext.reg('ms3-customers-vue-wrapper', Ext.extend(Ext.Component, {
9+
initComponent: function() {
10+
Ext.apply(this, {
11+
html: '<div id="ms3-customers-vue-wrapper" class="vueApp" style="padding: 20px; height: 100%;"></div>'
12+
});
13+
14+
this.constructor.superclass.initComponent.call(this);
15+
}
16+
}));

assets/components/minishop3/js/mgr/utilities/utilities.panel.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,30 @@ ms3.panel.Utilities = function (config) {
8686
}
8787
}
8888
}]
89+
},
90+
{
91+
title: _('grid_fields_config_title'),
92+
id: 'ms3-utilities-grid-fields-config-tab',
93+
layout: 'fit',
94+
autoScroll: true,
95+
items: [{
96+
xtype: 'panel',
97+
id: 'ms3-vue-grid-fields-config-panel',
98+
border: false,
99+
autoHeight: true,
100+
html: '<div id="ms3-grid-fields-config-vue-wrapper" class="vueApp" style="min-height: 600px;"></div>',
101+
listeners: {
102+
afterrender: function() {
103+
// Монтируем Vue приложение после рендера панели
104+
const event = new CustomEvent('ms3:mountVueGridFieldsConfig', {
105+
detail: {
106+
targetId: '#ms3-grid-fields-config-vue-wrapper'
107+
}
108+
});
109+
document.dispatchEvent(event);
110+
}
111+
}
112+
}]
89113
}
90114
// Старая ExtJS вкладка "Расширение объектов" удалена - используется новый Vue виджет
91115
]

assets/components/minishop3/js/web/core/ApiClient.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
class ApiClient {
1616
/**
1717
* @param {Object} config - Конфигурация клиента
18-
* @param {string} config.baseUrl - Базовый URL API (например: '/assets/components/minishop3/action.php')
18+
* @param {string} config.baseUrl - Базовый URL API (например: '/assets/components/minishop3/api.php')
1919
* @param {TokenManager} config.tokenManager - Менеджер токенов
2020
*/
2121
constructor (config) {
22-
this.baseUrl = config.baseUrl || '/assets/components/minishop3/action.php'
22+
this.baseUrl = config.baseUrl || '/assets/components/minishop3/api.php'
2323
this.tokenManager = config.tokenManager
2424
}
2525

@@ -105,6 +105,17 @@ class ApiClient {
105105
return this.request('POST', endpoint, data)
106106
}
107107

108+
/**
109+
* PUT запрос (полное обновление)
110+
*
111+
* @param {string} endpoint - Endpoint API
112+
* @param {Object} data - Данные для отправки
113+
* @returns {Promise<Object>}
114+
*/
115+
put (endpoint, data) {
116+
return this.request('PUT', endpoint, data)
117+
}
118+
108119
/**
109120
* PATCH запрос (частичное обновление)
110121
*

0 commit comments

Comments
 (0)