This commit is contained in:
pushuo 2022-08-05 09:25:59 +08:00
parent a7377c7e9f
commit 14d13e0ce1
6 changed files with 145 additions and 0 deletions

View File

@ -54,6 +54,7 @@ class PermissionRepo
['title' => trans('admin/common.tax_rate'), 'permissions' => $this->getTaxRatePermissions()],
['title' => trans('admin/common.tax_class'), 'permissions' => $this->getTaxClassPermissions()],
['title' => trans('admin/common.currency'), 'permissions' => $this->getCurrencyPermissions()],
['title' => trans('admin/common.language'), 'permissions' => $this->getLanguagePermissions()],
];
return hook_filter('role.all_permissions', $permissions);
}
@ -228,6 +229,19 @@ class PermissionRepo
}
/**
* 获取语言权限列表
*
* @return array[]
*/
private function getLanguagePermissions(): array
{
$routes = ['languages_index', 'languages_create', 'languages_edit', 'languages_update', 'languages_delete'];
$items = $this->getPermissionList('language', $routes);
return hook_filter('role.language_permissions', $items);
}
/**
* 根据模块和路由返回权限列表
*

View File

@ -176,6 +176,7 @@ class Sidebar extends Component
['route' => 'tax_classes.index', 'icon' => 'fa fa-tachometer-alt'],
['route' => 'currencies.index', 'icon' => 'fa fa-tachometer-alt'],
['route' => 'design.index', 'icon' => 'fa fa-tachometer-alt', 'blank' => true],
['route' => 'languages.index', 'icon' => 'fa fa-tachometer-alt', 'blank' => true],
];
return hook_filter('sidebar.setting_routes', $routes);
}

View File

@ -0,0 +1,80 @@
@extends('admin::layouts.master')
@section('title', '货币管理')
@section('content')
<div id="currency-app-form" class="card">
<div class="card-body">
<form action="{{ admin_route('currencies.store') }}" method="post">
@csrf
<div class="form-group">
<label class="form-label" id="name">名称</label>
<input type="input" name="name" value="{{ old('name') }}" class="form-control" placeholder="名称">
@error('name')
<x-admin::form.error :message="$message" />
@enderror
</div>
<div class="form-group">
<label class="form-label" id="code">编码</label>
<input type="input" name="code" value="{{ old('code') }}" class="form-control" placeholder="编码">
@error('code')
<x-admin::form.error :message="$message" />
@enderror
</div>
<div class="form-group">
<label class="form-label" id="symbol_left">左符号</label>
<input type="input" name="symbol_left" value="{{ old('symbol_left') }}" class="form-control"
placeholder="左符号">
@error('symbol_left')
<x-admin::form.error :message="$message" />
@enderror
</div>
<div class="form-group">
<label class="form-label" id="symbol_right">右符号</label>
<input type="input" name="symbol_right" value="{{ old('symbol_right') }}" class="form-control"
placeholder="右符号">
@error('symbol_right')
<x-admin::form.error :message="$message" />
@enderror
</div>
<div class="form-group">
<label class="form-label" id="decimal_place">小数位数</label>
<input type="input" name="decimal_place" value="{{ old('decimal_place') }}" class="form-control"
placeholder="小数位数">
@error('decimal_place')
<x-admin::form.error :message="$message" />
@enderror
</div>
<div class="form-group">
<label class="form-label" id="value">汇率值</label>
<input type="input" name="value" value="{{ old('value') }}" class="form-control" placeholder="汇率值">
@error('value')
<x-admin::form.error :message="$message" />
@enderror
</div>
<div class="form-group">
<label class="form-label" id="status">状态</label>
<input type="input" name="status" class="form-control" placeholder="状态">
@error('status')
<x-admin::form.error :message="$message" />
@enderror
</div>
@if (session('error'))
<div class="alert alert-success">
{{ session('error') }}
</div>
@endif
<button type="submit" class="btn btn-primary mb-4">确定</button>
</form>
</div>
</div>
@endsection

View File

@ -0,0 +1,46 @@
@extends('admin::layouts.master')
@section('title', '货币管理')
@section('content')
<div id="customer-app" class="card">
<div class="card-body">
<div class="d-flex justify-content-between my-4">
<a href="{{ admin_route('languages.create') }}" class="btn btn-primary">创建</a>
</div>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>名称</th>
<th>编码</th>
<th>货币左符号</th>
<th>货币右符号</th>
<th>小数位数</th>
<th>汇率值</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach ($languages as $currency)
<tr>
<td>{{ $currency['id'] }}</td>
<td>{{ $currency['name'] }}</td>
<td>{{ $currency['code'] }}</td>
<td>{{ $currency['symbol_left'] }}</td>
<td>{{ $currency['symbol_right'] }}</td>
<td>{{ $currency['decimal_place'] }}</td>
<td>{{ $currency['value'] }}</td>
<td>{{ $currency['status'] }}</td>
<td>
<a class="btn btn-outline-secondary btn-sm"
href="{{ admin_route('languages.edit', [$currency['id']]) }}">编辑</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View File

@ -27,6 +27,7 @@ return [
'tax_rate' => 'Tax Rate',
'tax_class' => 'Tax Class',
'currency' => 'Currency',
'language' => 'Language',
'access_frontend' => 'Frontend',
// sidebar
@ -37,6 +38,7 @@ return [
'tax_rates_index' => 'Tax Rates',
'tax_classes_index' => 'Tax Classes',
'currencies_index' => 'Currencies',
'languages_index' => 'Languages',
'design_index' => 'Page Builder',
'categories_index' => 'Categories',
'products_index' => 'Products',

View File

@ -26,6 +26,7 @@ return [
'tax_rate' => '税率管理',
'tax_class' => '税类管理',
'currency' => '货币管理',
'language' => '语言管理',
'access_frontend' => '访问前台',
// sidebar
@ -36,6 +37,7 @@ return [
'tax_rates_index' => '税率设置',
'tax_classes_index' => '税费类别',
'currencies_index' => '货币管理',
'languages_index' => '语言管理',
'design_index' => '首页装修',
'categories_index' => '产品分类',
'products_index' => '商品管理',