Skip to content

Commit a362f1a

Browse files
committed
translations & admin layouts
1 parent 59d4948 commit a362f1a

File tree

29 files changed

+903
-16
lines changed

29 files changed

+903
-16
lines changed

app/base/controllers/Admin/Commerce/PaymentMethods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static function getAdminPageLink() : array|null
137137
'permission_name' => static::getAccessPermission(),
138138
'route_name' => static::getPageRouteName(),
139139
'icon' => 'credit-card',
140-
'text' => 'Payments Methods',
140+
'text' => 'Payment Methods',
141141
'section' => 'commerce',
142142
'order' => 15,
143143
];

app/base/controllers/Admin/Dashboard.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public function getTemplateData(): array
129129
'icon' => $pageLink['icon'],
130130
'label' => $pageLink['text'],
131131
'route_name' => $pageLink['route_name'],
132+
'section' => $pageLink['section'],
132133
'data' => $dashboardData,
133134
];
134135
}

app/base/tools/Plates/SiteBase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,14 @@ public function renderAdminTable(array $elements, ?array $header = null, ?BasePa
403403
return $this->getHtmlRenderer()->renderAdminTable($elements, $header, $current_page);
404404
}
405405

406+
public function getUseruISetting(AdminPage $controller, string $setting) : mixed
407+
{
408+
$user = $controller->getCurrentUser();
409+
$uiSettings = $user->getUserSession()->getSessionKey('uiSettings');
410+
411+
return $uiSettings[$setting] ?? null;
412+
}
413+
406414
public function getDarkModeSwitch(AdminPage $controller) : string
407415
{
408416
$user = $controller->getCurrentUser();

js/src/admin.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@
8585
);
8686
});
8787

88+
$('#dashboard-layout-selector').on('change', function () {
89+
$elem.appAdmin('updateUserUiSettings',
90+
{'dashboardLayout': $(this).is(':checked') ? 'by_section' : 'list'},
91+
function (data) {
92+
document.location.reload();
93+
}
94+
);
95+
});
96+
8897
$('a.inToolSidePanel[href]', $elem).click(function(evt){
8998
const $btnElement = $(this);
9099

scss/partials/admin_sidebar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
#sidebar-minimize-btn {
9494
position: absolute;
9595
bottom: 40px;
96-
right: 0;
96+
right: -15px;
9797
color: $color-black;
9898
span {
9999
color: inherit;

templates/admin/dashboard.php

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
* @var $page_views integer
1616
* @var $mails_sent integer
1717
*/
18+
19+
$bySection = ($this->sitebase()->getUseruISetting($controller, 'dashboardLayout') ?? 'list') == 'by_section';
1820
$this->layout('admin::layout', ['title' => $controller->getPageTitle()] + get_defined_vars()) ?>
19-
<div class="jumbotron p-4">
21+
<div class="jumbotron p-4 position-relative">
2022
<div class="row">
2123
<div class="col-2 text-center">
2224
<?php echo $this->sitebase()->getGravatar($current_user->email, 100);?>
@@ -26,13 +28,62 @@
2628
<div class="info"><?= $current_user->getEmail();?> (<?= $this->sitebase()->translate('role');?>: <?= $current_user->getRole()->getName();?>)</div>
2729
</div>
2830
</div>
31+
32+
<div class="dashboard-bysection-switch position-absolute" style="top: 15px; right: 15px;">Group By Section
33+
<label class="switch">
34+
<input type="checkbox" id="dashboard-layout-selector" value="" class="paginator-items-choice" style="width: 50px"<?php if ($bySection) :?> checked="checked"<?php endif;?>>
35+
<span class="slider"></span>
36+
</label>
37+
</div>
38+
2939
</div>
3040

31-
<div class="counters h6">
32-
<div class="row justify-content-md-center">
41+
<div class="counters container-fluid">
42+
<div class="row row-cols-3 justify-content-md-between">
43+
<?php if ($bySection):
44+
$bySectionLinks = [];
45+
foreach ($dashboard_links as $link) {
46+
$section = $link['section'] ?? 'general';
47+
if (!isset($bySectionLinks[$section])) {
48+
$bySectionLinks[$section] = [];
49+
}
50+
$bySectionLinks[$section][] = $link;
51+
}
52+
ksort($bySectionLinks);
53+
?>
54+
<?php foreach ($bySectionLinks as $sectionName => $chunk) : ?>
55+
<div class="col">
56+
<div class="h4 font-weight-bolder text-center"><?= $this->sitebase()->translate(ucfirst($sectionName)); ?></div>
57+
<div class="mb-2"><hr /></div>
58+
<?php foreach ($chunk as $link): ?>
59+
<div class="counter mb-2 d-flex justify-content-between align-items-center">
60+
<label class="text-left nowrap pl-5 d-inline-flex align-items-center">
61+
<a class="d-flex align-items-center" href="<?= $this->sitebase()->getUrl($link['route_name']);?>">
62+
<?php $this->sitebase()->drawIcon($link['icon'])?>&nbsp;<?= $this->sitebase()->translate($link['label']);?>
63+
</a>
64+
</label>
65+
<?= $link['data'];?>
66+
</div>
67+
<?php endforeach; ?>
68+
</div>
69+
<?php endforeach;?>
70+
71+
<div class="col">
72+
73+
<div class="counter mb-2 d-flex justify-content-between"><hr /></div>
74+
<div class="counter mb-2 d-flex justify-content-between"><label class="text-left nowrap pl-5 d-inline-flex align-items-center"><?php $this->sitebase()->drawIcon('info')?>&nbsp;<?= $this->sitebase()->translate('Page Views');?></label> <?= $page_views;?></div>
75+
<div class="counter mb-2 d-flex justify-content-between"><label class="text-left nowrap pl-5 d-inline-flex align-items-center"><?php $this->sitebase()->drawIcon('mail')?>&nbsp;<?= $this->sitebase()->translate('Mails sent');?></label> <?= $mails_sent;?></div>
76+
<?php if ($controller->checkPermission('administer_logs')) :?>
77+
<div class="text-left nowrap pl-5"><a class="btn btn-light d-flex align-items-center justify-content-center" href="<?= $this->sitebase()->getUrl('admin.stats');?>"><?php $this->sitebase()->drawIcon('bar-chart')?>&nbsp;<?= $this->sitebase()->translate('Stats');?></a></div>
78+
<?php endif; ?>
79+
80+
</div>
81+
82+
<?php else: ?>
83+
3384
<?php $chunks = array_chunk($dashboard_links, ceil(count($dashboard_links) / 3 + 2)); ?>
3485
<?php foreach ($chunks as $chunkIndex => $chunk) : ?>
35-
<div class="col-md-4 text-center">
86+
<div class="col text-center">
3687
<?php foreach ($chunk as $link): ?>
3788
<div class="counter mb-2 d-flex justify-content-between align-items-center">
3889
<label class="text-left nowrap pl-5 d-inline-flex align-items-center">
@@ -53,9 +104,9 @@
53104
<?php endif; ?>
54105
<?php endif; ?>
55106

56-
57107
</div>
58108
<?php endforeach ?>
59-
</div>
60109

61-
</div>
110+
<?php endif; ?>
111+
</div>
112+
</div>

templates/admin/layout.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@
5151
<a href="#" class="closebtn d-sm-block d-md-none">&times;</a>
5252
<?php $this->insert('admin::partials/sidemenu', ['controller' => $controller]); ?>
5353
</div>
54-
</nav>
54+
<a href="#" id="sidebar-minimize-btn">
55+
<span class="close-arrow"><?php $this->sitebase()->drawIcon('chevrons-left'); ?></span>
56+
<span class="open-arrow"><?php $this->sitebase()->drawIcon('chevrons-right'); ?></span>
57+
</a>
58+
</nav>
5559

5660
<main role="main" class="col-md-10 ml-sm-auto col-lg-10 pt-3 px-4">
5761

templates/admin/partials/sidemenu.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,4 @@
5050
</div>
5151
</div>
5252
<?php endif;?>
53-
</div>
54-
55-
<a href="#" id="sidebar-minimize-btn">
56-
<span class="close-arrow"><?php $this->sitebase()->drawIcon('chevrons-left'); ?></span>
57-
<span class="open-arrow"><?php $this->sitebase()->drawIcon('chevrons-right'); ?></span>
58-
</a>
53+
</div>

translations/ar.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,43 @@
197197
'Term' => 'مصطلح تصنيفي',
198198
'Thanks for your submission!' => 'شكرًا على إرسالكم!',
199199
'Sending...' => 'جارٍ الإرسال...',
200+
'Mass Delete' => 'حذف جماعي',
201+
'Mass Edit' => 'تعديل جماعي',
202+
'Cms' => 'نظام إدارة المحتوى',
203+
'Commerce' => 'تجارة',
204+
'Site' => 'موقع',
205+
'System' => 'نظام',
206+
'Countries' => 'بلدان',
207+
'Progress Manager' => 'مدير التقدم',
208+
'Carts' => 'عربات التسوق',
209+
'Orders' => 'الطلبات',
210+
'Downloadable Products' => 'المنتجات القابلة للتنزيل',
211+
'Sitemaps' => 'خرائط الموقع',
212+
'Payment Methods' => 'طرق الدفع',
213+
'Cart Discounts' => 'خصومات العربة',
214+
'Discounts' => 'الخصومات',
215+
'Tax Classes' => 'فئات الضرائب',
216+
'Tax Rates' => 'معدلات الضرائب',
217+
'Order Statuses' => 'حالات الطلب',
218+
'Order Payments' => 'مدفوعات الطلب',
219+
'Layout' => 'تخطيط',
220+
'Payment Method' => 'طريقة الدفع',
221+
'Transaction Id' => 'معرف المعاملة',
222+
'Transaction Amount' => 'مبلغ المعاملة',
223+
'Tax Class' => 'فئة الضريبة',
224+
'Price' => 'السعر',
225+
'Is Physical' => 'فعلي',
226+
'Order Number' => 'رقم الطلب',
227+
'Order Status' => 'حالة الطلب',
228+
'Customer' => 'العميل',
229+
'Total' => 'الإجمالي',
230+
'Admin Total' => 'الإجمالي الإداري',
231+
'Updated At' => 'تم التحديث في',
232+
'Rate' => 'معدل',
233+
'Class Name' => 'اسم الفئة',
234+
'Discount Amount' => 'مبلغ الخصم',
235+
'Discount Type' => 'نوع الخصم',
236+
'Code' => 'رمز',
237+
'Class' => 'فئة',
238+
'Is Active' => 'نشط',
200239
];

translations/bn.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,43 @@
199199
'Term' => 'শ্রেণীবিভাগ শব্দ',
200200
'Thanks for your submission!' => 'আপনার জমা দেওয়ার জন্য ধন্যবাদ!',
201201
'Sending...' => 'প্রেরণ হচ্ছে...',
202+
'Mass Delete' => 'একসাথে মুছে ফেলুন',
203+
'Mass Edit' => 'একসাথে সম্পাদনা',
204+
'Cms' => 'CMS',
205+
'Commerce' => 'বাণিজ্য',
206+
'Site' => 'সাইট',
207+
'System' => 'সিস্টেম',
208+
'Countries' => 'দেশ',
209+
'Progress Manager' => 'অগ্রগতি ব্যবস্থাপক',
210+
'Carts' => 'কার্ট',
211+
'Orders' => 'অর্ডার',
212+
'Downloadable Products' => 'ডাউনলোডযোগ্য পণ্য',
213+
'Sitemaps' => 'সাইটম্যাপ',
214+
'Payment Methods' => 'পেমেন্ট পদ্ধতি',
215+
'Cart Discounts' => 'কার্ট ছাড়',
216+
'Discounts' => 'ছাড়',
217+
'Tax Classes' => 'কর শ্রেণি',
218+
'Tax Rates' => 'কর হার',
219+
'Order Statuses' => 'অর্ডারের অবস্থা',
220+
'Order Payments' => 'অর্ডার পেমেন্ট',
221+
'Layout' => 'লেআউট',
222+
'Payment Method' => 'পেমেন্ট পদ্ধতি',
223+
'Transaction Id' => 'লেনদেন আইডি',
224+
'Transaction Amount' => 'লেনদেনের পরিমাণ',
225+
'Tax Class' => 'কর শ্রেণি',
226+
'Price' => 'মূল্য',
227+
'Is Physical' => 'ফিজিকাল',
228+
'Order Number' => 'অর্ডার নম্বর',
229+
'Order Status' => 'অর্ডারের অবস্থা',
230+
'Customer' => 'গ্রাহক',
231+
'Total' => 'মোট',
232+
'Admin Total' => 'অ্যাডমিন মোট',
233+
'Updated At' => 'আপডেট হয়েছে',
234+
'Rate' => 'হার',
235+
'Class Name' => 'শ্রেণির নাম',
236+
'Discount Amount' => 'ছাড়ের পরিমাণ',
237+
'Discount Type' => 'ছাড়ের ধরন',
238+
'Code' => 'কোড',
239+
'Class' => 'শ্রেণি',
240+
'Is Active' => 'সক্রিয়',
202241
];

0 commit comments

Comments
 (0)