Skip to content

Commit

Permalink
Major fixes in all areas
Browse files Browse the repository at this point in the history
  • Loading branch information
Umut committed Apr 19, 2024
1 parent fe19bab commit fc6a39d
Show file tree
Hide file tree
Showing 51 changed files with 612 additions and 778 deletions.
1 change: 1 addition & 0 deletions components/LanguageBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function applyLanguage($event): void
Yii::$app->session->set('lang', $language);
Yii::$app->language = $language;

// inite taşınacak
foreach(Yii::$app->params['roles'] as $role => $roleDesc) {
Yii::$app->params['roles'][$role] = Yii::t('app', $roleDesc);
}
Expand Down
16 changes: 8 additions & 8 deletions components/MyMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static function getNavItems(): array
public static function getLeftMenuItems(): array
{
if (Yii::$app->user->identity->user->superadmin) {
$businesses = Business::find()->orderBy('name')->all();
$businesses = Business::find()->active()->orderBy('name')->all();
$items = [];
foreach ($businesses as $business) {
$isExpanded = ($business->slug === Yii::$app->request->get('slug')) ? true : false;
Expand All @@ -152,16 +152,16 @@ public static function getLeftMenuItems(): array
$businessStats = Yii::$app->cache->get($cacheKey);
if ($businessStats === false) {
$businessStats = [
'appointments' => $business->getAppointments()->count(),
'resources' => $business->getResources()->count(),
'rules' => $business->getRules()->count(),
'services' => $business->getServices()->count(),
'appointments' => $business->getAppointments()->active()->count(),
'resources' => $business->getResources()->andWhere(['deleted_at' => null])->count(),
'rules' => $business->getRules()->andWhere(['deleted_at' => null])->count(),
'services' => $business->getServices()->andWhere(['deleted_at' => null])->count(),
'users' => [],
];
foreach (Yii::$app->params['roles'] as $key=>$value) {
$businessStats['users'][$key] = $business->getUsers($key)->count();
$businessStats['users'][$key] = $business->getUsersByRole($key)->count();
}
Yii::$app->cache->set($cacheKey, $businessStats, 18400);
Yii::$app->cache->set($cacheKey, $businessStats, 86400);
}

$contents = [
Expand All @@ -172,7 +172,7 @@ public static function getLeftMenuItems(): array
],
[
'label' => Yii::t('app', 'Appointments').' <span class="badge text-black bg-success-subtle">'.$businessStats['appointments'].'</span>',
'url' => MyUrl::to(['business/appointment/'.$business->slug]),
'url' => MyUrl::to(['appointment/view/'.$business->slug]),
'class' => $highlightedAction === 'appointment' ? 'list-group-item-info' : '',
],
];
Expand Down
2 changes: 1 addition & 1 deletion config/i18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// array, required, list of language codes that the extracted messages
// should be translated to. For example, ['zh-CN', 'de'].
'languages' => [
'tr',
'tr',
// 'af', 'ar', 'az', 'be', 'bg', 'bs', 'ca', 'cs', 'da', 'de', 'el', 'es', 'et', 'fa', 'fi', 'fr', 'he', 'hi',
// 'pt-BR', 'ro', 'hr', 'hu', 'hy', 'id', 'it', 'ja', 'ka', 'kk', 'ko', 'kz', 'lt', 'lv', 'ms', 'nb-NO', 'nl',
// 'pl', 'pt', 'ru', 'sk', 'sl', 'sr', 'sr-Latn', 'sv', 'tg', 'th', 'tr', 'uk', 'uz', 'uz-Cy', 'vi', 'zh-CN',
Expand Down
7 changes: 6 additions & 1 deletion config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
$langPattern = implode('|', array_keys($params['supportedLanguages']));
$roles = implode('|', array_keys($params['roles']));

$businessActions = 'update|user|resource|rule|service';

return [

'' => 'site/index',
Expand All @@ -15,12 +17,15 @@
"<lang:$langPattern>/site/login/<s>" => 'site/login',

"<lang:$langPattern>/business/user/<role:$roles>/<slug>" => 'business/user',
"<lang:$langPattern>/business/<action:\w+>/<slug>" => 'business/<action>',
"<lang:$langPattern>/business/<action:$businessActions>/<slug>/<id>" => 'business/<action>',
"<lang:$langPattern>/business/<action:$businessActions>/<slug>" => 'business/<action>',

"<lang:$langPattern>/user/add/<role:$roles>/<slug>/<id>" => 'user/add',
"<lang:$langPattern>/user/add/<role:$roles>/<slug>" => 'user/add',
"<lang:$langPattern>/user/<action:\w+>/<id>" => 'user/<action>',

"<lang:$langPattern>/appointment/<action:\w+>/<slug>" => 'appointment/<action>',

"<lang:$langPattern>/<controller:\w+>/<action:\w+>" => '<controller>/<action>',

'<path:.*>' => 'site/reroute',
Expand Down
Loading

0 comments on commit fc6a39d

Please sign in to comment.