Browse Source

密码修改与增加讯盘提示

moshaorui 4 months ago
parent
commit
debb2f3912

+ 4 - 4
app/Admin/Controllers/AuthController.php

@@ -131,10 +131,10 @@ class AuthController extends BaseAuthController
             $form->ignore(['password_confirmation', 'old_password']);
 
             // 添加语言选择的下拉框
-            $form->select('language', trans('admin.language'))
-                ->options(config('dictionary.languages'))
-                ->default('en')
-                ->required();;  // 设置默认语言
+//            $form->select('language', trans('admin.language'))
+//                ->options(config('dictionary.languages'))
+//                ->default('en')
+//                ->required();;  // 设置默认语言
 
             $form->saving(function (Form $form) {
                 if ($form->password && $form->model()->password != $form->password) {

+ 4 - 4
app/Distributor/Controllers/AuthController.php

@@ -157,10 +157,10 @@ class AuthController extends BaseAuthController
             $form->ignore(['password_confirmation', 'old_password']);
 
             // 添加语言选择的下拉框
-            $form->select('language', trans('admin.language'))
-                ->options(config('dictionary.languages'))
-                ->default('en')
-                ->required();;  // 设置默认语言
+//            $form->select('language', trans('admin.language'))
+//                ->options(config('dictionary.languages'))
+//                ->default('en')
+//                ->required();;  // 设置默认语言
 
             $form->saving(function (Form $form) {
                 if ($form->password && $form->model()->password != $form->password) {

+ 1 - 1
app/Distributor/Controllers/DistInquiryController.php

@@ -4,7 +4,7 @@ namespace App\Distributor\Controllers;
 
 use App\Admin\Actions\Grid\InquiryAssignment;
 use App\Admin\Actions\Tools\InquiryHandle;
-use App\Admin\Repositories\DistInquiry;
+use App\Distributor\Repositories\DistInquiry;
 use Dcat\Admin\Form;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Http\Controllers\AdminController;

+ 59 - 0
app/Distributor/Repositories/DistInquiry.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace App\Distributor\Repositories;
+
+use App\Models\DistInquiry as Model;
+use Carbon\Carbon;
+use Dcat\Admin\Repositories\EloquentRepository;
+
+class DistInquiry extends EloquentRepository
+{
+    /**
+     * Model.
+     *
+     * @var string
+     */
+    protected $eloquentClass = Model::class;
+
+
+    /*
+     * 检测状态是否为0,即未处理
+     */
+    public static function assessTheStatus($ids) {
+        $inquirieCount = Model::whereIn('id', $ids)->where('status', '=', 0)->count();
+        if ($inquirieCount != count($ids)) {
+            return false;
+        }
+        return true;
+    }
+
+
+
+
+    /*
+     * 供应商把询价单设置为已处理
+     */
+    public static function distSetStatusProcessed($ids)
+    {
+        $result = true;
+        foreach ($ids as $id) {
+            $id = intval($id);
+            $row = Model::find($id);
+            if ($row && $row->dist_id == getDistributorId() && $row->status == 1) {
+                $row->status = 2;
+                $row->save();
+            } else {
+                $result = false;
+            }
+        }
+        return $result;
+    }
+
+    /*
+     *  供应商获取未处理的询价单
+     */
+    public static  function getProcessingNum() {
+        return Model::where('dist_id', getDistributorId())->where('status', 1)->count();
+    }
+
+}

+ 7 - 0
app/Distributor/bootstrap.php

@@ -8,6 +8,8 @@ use Dcat\Admin\Show;
 use Dcat\Admin\Layout\Content;
 use Illuminate\Support\ServiceProvider;
 use Dcat\Admin\Form\Field\Editor;
+use Dcat\Admin\Layout\Menu;
+
 /**
  * Dcat-admin - admin builder based on Laravel.
  * @author jqh <https://github.com/jqhph>
@@ -58,3 +60,8 @@ Editor::resolving(function (Editor $editor) {
         'toolbar'=>["undo redo | preview fullscreen | formatselect  | fontsizeselect bold italic underline strikethrough forecolor backcolor | link image media blockquote removeformat codesample","alignleft aligncenter alignright  alignjustify| indent outdent bullist numlist table subscript superscript | code"],
     ]);
 });
+
+//菜单
+Admin::menu(function (Menu $menu) {
+    $menu->view('distributor.partials_custom.menu');
+});

+ 1 - 1
config/dictionary.php

@@ -40,7 +40,7 @@ return [
     //询价状态
     'inquiryStatus' => [
         '0' => 'new',
-        '1' => 'processing',
+        '1' => 'pending',
         '2' => 'processed',
     ],
     //菜单类型

+ 1 - 1
lang/en/global.php

@@ -139,7 +139,7 @@ return [
         'published'             => 'Published',
         'video_player'          => 'Video Player',
         'new'                  => 'New',
-        'processing'           => 'Processing',
+        'pending'           => 'Pending',
         'processed'            => 'Processed',
         'home_page'            => 'Home Page',
         'collections'          => 'Collections',

+ 1 - 1
lang/zh_CN/global.php

@@ -139,7 +139,7 @@ return [
         'published'             => '已发布',
         'video_player'          => '视频播放器',
         'new'                  => '待分配',
-        'processing'           => '处理中',
+        'pending'           => '待处理',
         'processed'            => '已处理',
         'home_page'            => '首页',
         'collections'          => '集合',

+ 9 - 0
public/vendor/dcat-admin/dcat/css/dcatplus.css

@@ -1140,3 +1140,12 @@ body:not(.sidebar-mini-md) .content-wrapper, body:not(.sidebar-mini-md) .main-fo
     font-weight: normal !important;
 }
 /* end setp form*/
+
+.nav-item .nav-link {
+    display: flex;
+    align-items: center;
+}
+
+.nav-item .nav-link .badge, .label{
+    margin-left: .5rem;margin-bottom: 0px;
+}

+ 50 - 0
resources/views/distributor/partials_custom/menu.blade.php

@@ -0,0 +1,50 @@
+@php
+    $depth = $item['depth'] ?? 0;
+
+    $horizontal = config('admin.layout.horizontal_menu');
+
+    $defaultIcon = config('admin.menu.default_icon', 'feather icon-circle');
+
+    $num = \App\Distributor\Repositories\DistInquiry::getProcessingNum();
+@endphp
+
+@if($builder->visible($item))
+    @if(empty($item['children']))
+        <li class="nav-item">
+            <a data-id="{{ $item['id'] ?? '' }}" @if(mb_strpos($item['uri'], '://') !== false) target="_blank" @endif
+               href="{{ $builder->getUrl($item['uri']) }}"
+               class="nav-link {!! $builder->isActive($item) ? 'active' : '' !!}">
+                {!! str_repeat('&nbsp;', $depth) !!}<i class="fa fa-fw {{ $item['icon'] ?: $defaultIcon }}"></i>
+                <p>
+                    {!! $builder->translate($item['title']) !!}
+                </p>
+                @if($item['title'] == 'Inquiry' && $num > 0) <i class="badge badge-danger">{{$num}}</i>@endif
+            </a>
+        </li>
+    @else
+
+        <li class="{{ $horizontal ? 'dropdown' : 'has-treeview' }} {{ $depth > 0 ? 'dropdown-submenu' : '' }} nav-item {{ $builder->isActive($item) ? 'menu-open' : '' }}">
+            <a href="#"  data-id="{{ $item['id'] ?? '' }}"
+               class="nav-link {{ $builder->isActive($item) ? ($horizontal ? 'active' : '') : '' }}
+                    {{ $horizontal ? 'dropdown-toggle' : '' }}">
+                {!! str_repeat('&nbsp;', $depth) !!}<i class="fa fa-fw {{ $item['icon'] ?: $defaultIcon }}"></i>
+                <p>
+                    {!! $builder->translate($item['title']) !!}
+
+                    @if(! $horizontal)
+                        <i class="right fa fa-angle-left"></i>
+                    @endif
+                </p>
+            </a>
+            <ul class="nav {{ $horizontal ? 'dropdown-menu' : 'nav-treeview' }}">
+                @foreach($item['children'] as $item)
+                    @php
+                        $item['depth'] = $depth + 1;
+                    @endphp
+
+                    @include('admin::partials.menu', ['item' => $item])
+                @endforeach
+            </ul>
+        </li>
+    @endif
+@endif