Skip to content

Commit 2688ec3

Browse files
committed
feat(ManagePromotionsPage, translations): enhance promotion management with new fields and localized messages
1 parent ea560ce commit 2688ec3

7 files changed

Lines changed: 79 additions & 37 deletions

File tree

‎frontend/public/locales/ar/promotions.json‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"multiplier": "مضاعف النقاط",
5353
"bonus": "نقاط إضافية",
5454
"discount": "خصم",
55-
"freeItem": "منتج مجاني"
55+
"freeItem": "منتج مجاني",
56+
"automatic": "تلقائي (بناءً على المعدل)",
57+
"oneTime": "رمز لمرة واحدة"
5658
},
5759
"create": {
5860
"title": "إنشاء عرض",
@@ -83,7 +85,7 @@
8385
},
8486
"delete": {
8587
"title": "حذف العرض",
86-
"message": "هل أنت متأكد أنك تريد حذف هذا العرض؟ لا يمكن التراجع عن هذا الإجراء.",
88+
"message": "هل أنت متأكد أنك تريد حذف \"{{name}}\"? لا يمكن التراجع عن هذا الإجراء.",
8789
"success": "تم حذف العرض بنجاح",
8890
"error": "فشل حذف العرض"
8991
},
@@ -111,7 +113,12 @@
111113
"delete": "حذف",
112114
"saving": "جاري الحفظ...",
113115
"updatePromotion": "تحديث العرض",
114-
"createPromotion": "إنشاء عرض"
116+
"createPromotion": "إنشاء عرض",
117+
"bonusRate": "معدل المكافأة",
118+
"ratePlaceholder": "مثال: 0.5 لـ 50%",
119+
"rateHelper": "أدخل كرقم عشري (0.5 = 50%)",
120+
"minSpending": "الحد الأدنى للإنفاق ($)",
121+
"pointsPlaceholder": "مثال: 100"
115122
},
116123
"createPromotion": "إنشاء عرض"
117124
},

‎frontend/public/locales/en/promotions.json‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"multiplier": "Points Multiplier",
5353
"bonus": "Bonus Points",
5454
"discount": "Discount",
55-
"freeItem": "Free Item"
55+
"freeItem": "Free Item",
56+
"automatic": "Automatic (Rate-based)",
57+
"oneTime": "One-Time Code"
5658
},
5759
"create": {
5860
"title": "Create Promotion",
@@ -83,7 +85,7 @@
8385
},
8486
"delete": {
8587
"title": "Delete Promotion",
86-
"message": "Are you sure you want to delete this promotion? This action cannot be undone.",
88+
"message": "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.",
8789
"success": "Promotion deleted successfully",
8890
"error": "Failed to delete promotion"
8991
},
@@ -111,7 +113,12 @@
111113
"delete": "Delete",
112114
"saving": "Saving...",
113115
"updatePromotion": "Update Promotion",
114-
"createPromotion": "Create Promotion"
116+
"createPromotion": "Create Promotion",
117+
"bonusRate": "Bonus Rate",
118+
"ratePlaceholder": "e.g., 0.5 for 50%",
119+
"rateHelper": "Enter as decimal (0.5 = 50%)",
120+
"minSpending": "Min Spending ($)",
121+
"pointsPlaceholder": "e.g., 100"
115122
},
116123
"createPromotion": "Create Promotion"
117124
},

‎frontend/public/locales/es/promotions.json‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"multiplier": "Multiplicador de puntos",
5353
"bonus": "Puntos de bonificación",
5454
"discount": "Descuento",
55-
"freeItem": "Artículo gratis"
55+
"freeItem": "Artículo gratis",
56+
"automatic": "Automático (Basado en tasa)",
57+
"oneTime": "Código de un solo uso"
5658
},
5759
"create": {
5860
"title": "Crear promoción",
@@ -83,7 +85,7 @@
8385
},
8486
"delete": {
8587
"title": "Eliminar promoción",
86-
"message": "¿Está seguro de que desea eliminar esta promoción? Esta acción no se puede deshacer.",
88+
"message": "¿Está seguro de que desea eliminar \"{{name}}\"? Esta acción no se puede deshacer.",
8789
"success": "Promoción eliminada correctamente",
8890
"error": "No se pudo eliminar la promoción"
8991
},
@@ -111,7 +113,12 @@
111113
"delete": "Eliminar",
112114
"saving": "Guardando...",
113115
"updatePromotion": "Actualizar promoción",
114-
"createPromotion": "Crear promoción"
116+
"createPromotion": "Crear promoción",
117+
"bonusRate": "Tasa de bonificación",
118+
"ratePlaceholder": "ej: 0.5 para 50%",
119+
"rateHelper": "Ingrese como decimal (0.5 = 50%)",
120+
"minSpending": "Gasto mín. ($)",
121+
"pointsPlaceholder": "ej: 100"
115122
},
116123
"createPromotion": "Crear promoción"
117124
},

‎frontend/public/locales/fr/promotions.json‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"multiplier": "Multiplicateur de points",
5353
"bonus": "Points bonus",
5454
"discount": "Réduction",
55-
"freeItem": "Article gratuit"
55+
"freeItem": "Article gratuit",
56+
"automatic": "Automatique (Basé sur le taux)",
57+
"oneTime": "Code à usage unique"
5658
},
5759
"create": {
5860
"title": "Créer une promotion",
@@ -83,7 +85,7 @@
8385
},
8486
"delete": {
8587
"title": "Supprimer la promotion",
86-
"message": "Êtes-vous sûr de vouloir supprimer cette promotion ? Cette action est irréversible.",
88+
"message": "Êtes-vous sûr de vouloir supprimer \"{{name}}\" ? Cette action est irréversible.",
8789
"success": "Promotion supprimée avec succès",
8890
"error": "Échec de la suppression de la promotion"
8991
},
@@ -111,7 +113,12 @@
111113
"delete": "Supprimer",
112114
"saving": "Enregistrement...",
113115
"updatePromotion": "Mettre à jour la promotion",
114-
"createPromotion": "Créer une promotion"
116+
"createPromotion": "Créer une promotion",
117+
"bonusRate": "Taux de bonus",
118+
"ratePlaceholder": "ex: 0.5 pour 50%",
119+
"rateHelper": "Entrez en décimal (0.5 = 50%)",
120+
"minSpending": "Dépense min. ($)",
121+
"pointsPlaceholder": "ex: 100"
115122
},
116123
"createPromotion": "Créer une promotion"
117124
},

‎frontend/public/locales/ru/promotions.json‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"multiplier": "Множитель баллов",
5353
"bonus": "Бонусные баллы",
5454
"discount": "Скидка",
55-
"freeItem": "Бесплатный товар"
55+
"freeItem": "Бесплатный товар",
56+
"automatic": "Автоматическая (на основе ставки)",
57+
"oneTime": "Одноразовый код"
5658
},
5759
"create": {
5860
"title": "Создать акцию",
@@ -83,7 +85,7 @@
8385
},
8486
"delete": {
8587
"title": "Удалить акцию",
86-
"message": "Вы уверены, что хотите удалить эту акцию? Это действие нельзя отменить.",
88+
"message": "Вы уверены, что хотите удалить \"{{name}}\"? Это действие нельзя отменить.",
8789
"success": "Акция успешно удалена",
8890
"error": "Не удалось удалить акцию"
8991
},
@@ -111,7 +113,12 @@
111113
"delete": "Удалить",
112114
"saving": "Сохранение...",
113115
"updatePromotion": "Обновить акцию",
114-
"createPromotion": "Создать акцию"
116+
"createPromotion": "Создать акцию",
117+
"bonusRate": "Бонусная ставка",
118+
"ratePlaceholder": "напр.: 0.5 для 50%",
119+
"rateHelper": "Введите десятичное число (0.5 = 50%)",
120+
"minSpending": "Мин. расходы ($)",
121+
"pointsPlaceholder": "напр.: 100"
115122
},
116123
"createPromotion": "Создать акцию"
117124
},

‎frontend/public/locales/zh/promotions.json‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"multiplier": "积分倍数",
5353
"bonus": "奖励积分",
5454
"discount": "折扣",
55-
"freeItem": "免费商品"
55+
"freeItem": "免费商品",
56+
"automatic": "自动(基于比率)",
57+
"oneTime": "一次性代码"
5658
},
5759
"create": {
5860
"title": "创建促销",
@@ -83,7 +85,7 @@
8385
},
8486
"delete": {
8587
"title": "删除促销",
86-
"message": "您确定要删除此促销吗?此操作无法撤销。",
88+
"message": "您确定要删除\"{{name}}\"吗?此操作无法撤销。",
8789
"success": "促销删除成功",
8890
"error": "删除促销失败"
8991
},
@@ -111,7 +113,12 @@
111113
"delete": "删除",
112114
"saving": "保存中...",
113115
"updatePromotion": "更新促销",
114-
"createPromotion": "创建促销"
116+
"createPromotion": "创建促销",
117+
"bonusRate": "奖励比率",
118+
"ratePlaceholder": "例如:0.5表示50%",
119+
"rateHelper": "输入小数(0.5 = 50%)",
120+
"minSpending": "最低消费 ($)",
121+
"pointsPlaceholder": "例如:100"
115122
},
116123
"createPromotion": "创建促销"
117124
},

‎frontend/src/pages/ManagePromotionsPage.jsx‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ const ManagePromotionsPage = () => {
303303
setShowCreateModal(false);
304304
setShowEditModal(false);
305305
}}
306-
title={showEditModal ? 'Edit Promotion' : 'Create Promotion'}
306+
title={showEditModal ? t('promotions.edit.title') : t('promotions.create.title')}
307307
size="medium"
308308
>
309309
<form onSubmit={handleSubmit} className="promotion-form">
@@ -312,34 +312,34 @@ const ManagePromotionsPage = () => {
312312
)}
313313

314314
<div className="form-group">
315-
<label htmlFor="name" className="form-label">Promotion Name *</label>
315+
<label htmlFor="name" className="form-label">{t('promotions.create.nameLabel')} *</label>
316316
<input
317317
type="text"
318318
id="name"
319319
name="name"
320320
value={formData.name}
321321
onChange={handleInputChange}
322322
required
323-
placeholder="e.g., Summer Sale"
323+
placeholder={t('promotions.create.namePlaceholder')}
324324
className="form-input"
325325
/>
326326
</div>
327327

328328
<div className="form-group">
329-
<label htmlFor="description" className="form-label">Description</label>
329+
<label htmlFor="description" className="form-label">{t('promotions.create.descriptionLabel')}</label>
330330
<textarea
331331
id="description"
332332
name="description"
333333
value={formData.description}
334334
onChange={handleInputChange}
335335
rows={3}
336-
placeholder="Describe the promotion..."
336+
placeholder={t('promotions.create.descriptionPlaceholder')}
337337
className="form-textarea"
338338
/>
339339
</div>
340340

341341
<div className="form-group">
342-
<label htmlFor="type" className="form-label">Type *</label>
342+
<label htmlFor="type" className="form-label">{t('promotions.create.typeLabel')} *</label>
343343
<select
344344
id="type"
345345
name="type"
@@ -348,14 +348,14 @@ const ManagePromotionsPage = () => {
348348
required
349349
className="form-select"
350350
>
351-
<option value="automatic">Automatic (Rate-based)</option>
352-
<option value="one-time">One-Time Code</option>
351+
<option value="automatic">{t('promotions.types.automatic')}</option>
352+
<option value="one-time">{t('promotions.types.oneTime')}</option>
353353
</select>
354354
</div>
355355

356356
<div className="form-row">
357357
<div className="form-group">
358-
<label htmlFor="startTime" className="form-label">Start Date *</label>
358+
<label htmlFor="startTime" className="form-label">{t('common:startDate')} *</label>
359359
<input
360360
type="datetime-local"
361361
id="startTime"
@@ -368,7 +368,7 @@ const ManagePromotionsPage = () => {
368368
</div>
369369

370370
<div className="form-group">
371-
<label htmlFor="endTime" className="form-label">End Date *</label>
371+
<label htmlFor="endTime" className="form-label">{t('common:endDate')} *</label>
372372
<input
373373
type="datetime-local"
374374
id="endTime"
@@ -384,7 +384,7 @@ const ManagePromotionsPage = () => {
384384
{formData.type === 'automatic' ? (
385385
<div className="form-row">
386386
<div className="form-group">
387-
<label htmlFor="rate" className="form-label">Bonus Rate *</label>
387+
<label htmlFor="rate" className="form-label">{t('promotions.manage.bonusRate')} *</label>
388388
<input
389389
type="number"
390390
id="rate"
@@ -394,15 +394,15 @@ const ManagePromotionsPage = () => {
394394
step="0.01"
395395
min="0"
396396
max="10"
397-
placeholder="e.g., 0.5 for 50%"
397+
placeholder={t('promotions.manage.ratePlaceholder')}
398398
required={formData.type === 'automatic'}
399399
className="form-input"
400400
/>
401-
<span className="form-helper">Enter as decimal (0.5 = 50%)</span>
401+
<span className="form-helper">{t('promotions.manage.rateHelper')}</span>
402402
</div>
403403

404404
<div className="form-group">
405-
<label htmlFor="minSpending" className="form-label">Min Spending ($)</label>
405+
<label htmlFor="minSpending" className="form-label">{t('promotions.manage.minSpending')}</label>
406406
<input
407407
type="number"
408408
id="minSpending"
@@ -418,15 +418,15 @@ const ManagePromotionsPage = () => {
418418
</div>
419419
) : (
420420
<div className="form-group">
421-
<label htmlFor="points" className="form-label">Points *</label>
421+
<label htmlFor="points" className="form-label">{t('promotions.manage.points')} *</label>
422422
<input
423423
type="number"
424424
id="points"
425425
name="points"
426426
value={formData.points}
427427
onChange={handleInputChange}
428428
min="1"
429-
placeholder="e.g., 100"
429+
placeholder={t('promotions.manage.pointsPlaceholder')}
430430
required={formData.type === 'one-time'}
431431
className="form-input"
432432
/>
@@ -457,9 +457,9 @@ const ManagePromotionsPage = () => {
457457
isOpen={showDeleteConfirm}
458458
onClose={() => setShowDeleteConfirm(false)}
459459
onConfirm={handleDelete}
460-
title="Delete Promotion"
461-
message={`Are you sure you want to delete "${selectedPromotion?.name}"? This action cannot be undone.`}
462-
confirmText="Delete"
460+
title={t('promotions.delete.title')}
461+
message={t('promotions.delete.message', { name: selectedPromotion?.name })}
462+
confirmText={t('common:delete')}
463463
confirmVariant="danger"
464464
/>
465465
</div>

0 commit comments

Comments
 (0)