添加客人信息样式

develop
vine_liutk 2023-03-01 15:45:57 +08:00
parent 49ad9b55fc
commit 8d44553b86
9 changed files with 646 additions and 3 deletions

View File

@ -0,0 +1,133 @@
<?php
namespace App\Admin\Controllers;
use App\Models\Oldman;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class OldmanController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Oldman(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('floor_name');
$grid->column('agreement_no');
$grid->column('name');
$grid->column('card_no');
$grid->column('sex');
//年龄-todo
$grid->column('client_name');
$grid->column('client_phone');
$grid->column('nurse_lv');
$grid->column('created_at')->sortable();
// $grid->column('updated_at')
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('name')->width(3);
$filter->equal('card_no')->width(3);
$filter->equal('nurse_lv')->select()->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Oldman(), function (Show $show) {
$show->field('id');
$show->field('floor_name');
$show->field('agreement_no');
$show->field('name');
$show->field('sex');
$show->field('birthday');
$show->field('card_no');
$show->field('card_province_id');
$show->field('card_city_id');
$show->field('card_area_id');
$show->field('card_address');
$show->field('client_name');
$show->field('client_province_id');
$show->field('client_city_id');
$show->field('client_area_id');
$show->field('client_address');
$show->field('client_phone');
$show->field('nurse_lv');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Oldman(), function (Form $form) {
$form->display('id');
$form->row(function (Form\Row $form) {
$form->divider('居住人');
});
$form->row(function (Form\Row $form) {
$form->width(6)->text('floor_name');
$form->width(6)->text('agreement_no');
});
$form->row(function (Form\Row $form) {
$form->width(6)->text('name')->required();
$form->width(3)->radio('sex')->options(['1'=>'男', '2'=>'女'])->required();
});
$form->row(function (Form\Row $form) {
$form->width(6)->text('card_no')->required();
$form->width(6)->date('birthday')->required();
});
$form->row(function (Form\Row $form) {
$form->width(3)->select('card_province_id')->required();
$form->width(3)->select('card_city_id')->required();
$form->width(3)->select('card_area_id')->required();
});
$form->row(function (Form\Row $form) {
$form->text('card_address')->required();
});
$form->row(function (Form\Row $form) {
$form->select('nurse_lv')->required();
});
$form->row(function (Form\Row $form) {
$form->divider('委托人');
});
$form->row(function (Form\Row $form) {
$form->width(6)->text('client_name')->required();
$form->width(6)->text('client_phone')->required();
});
$form->row(function (Form\Row $form) {
$form->width(3)->select('client_province_id')->required();
$form->width(3)->select('client_city_id')->required();
$form->width(3)->select('client_area_id')->required();
});
$form->row(function (Form\Row $form) {
$form->text('client_address')->required();
});
$form->display('created_at');
$form->display('updated_at');
});
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Admin\Controllers;
use App\Models\Zone;
use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Http\Request;
class ZoneController extends AdminController
{
public function list(Request $request)
{
$query = Zone::query()->filter($request->all());
if ($request->filled('q')) {
if ($request->filled('_type')) {
$query->where('parent_id', $request->input('q'));
} else {
$search = '%'.$request->input('q').'%';
$query->where('name', 'like', $search);
}
}
$query->select(['id', 'name as text']);
if ($request->filled('_paginate')) {
$list = $query->paginate();
} else {
$list = $query->get();
}
return $list;
}
}

View File

@ -1,10 +1,13 @@
<?php
use App\Models\Admin\Menu;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\Column;
use Dcat\Admin\Layout\Navbar;
use Dcat\Admin\Show;
use Dcat\Admin\Support\Helper;
/**
* Dcat-admin - admin builder based on Laravel.
@ -24,3 +27,49 @@ use Dcat\Admin\Show;
* Admin::js('/packages/prettydocs/js/main.js');
*
*/
Grid::resolving(function (Grid $grid) {
$grid->disableRowSelector();
// debug-todo
// $grid->disableCreateButton();
// $grid->disableViewButton();
// $grid->disableEditButton();
$grid->disableDeleteButton();
$grid->enableDialogCreate();
$grid->setDialogFormDimensions('50%', '70%');
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->expand();
});
});
Show::resolving(function (Show $show) {
$show->panel()->tools(function ($tools) {
$tools->disableEdit();
// $tools->disableList();
$tools->disableDelete();
});
});
Form::resolving(function (Form $form) {
$form->disableViewButton();
$form->disableViewCheck();
$form->disableResetButton();
});
Admin::style(
<<<'CSS'
.main-footer {
display: none;
}
.layui-layer-nobg{
max-width: 800px;
max-height: 1100px;
}
CSS
);

View File

@ -14,4 +14,11 @@ Route::group([
$router->get('/', 'HomeController@index');
$router->resource('oldmen', 'OldmanController')->names('oldmen');
$router->group([
'prefix' => 'api',
], function (Router $router) {
$router->get('zones', 'ZoneController@list')->name('api.zones');
});
});

View File

@ -0,0 +1,49 @@
<?php
namespace App\Models;
use Dcat\Admin\Traits\ModelTree;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
class Zone extends Model
{
use Filterable, ModelTree;
protected $fillable = ['name', 'parent_id', 'type', 'index'];
protected $titleColumn = 'name';
protected $orderColumn = 'id';
protected $parentColumn = 'parent_id';
public static function selectOptions(\Closure $closure = null, $cache = true)
{
if (!$cache) {
Cache::forget('admin_zone_select_options');
}
if (Cache::has('admin_zone_select_options')) {
return Cache::get('admin_zone_select_options');
}
$options = (new static())->withQuery($closure)->buildSelectOptions();
$data = collect($options)->all();
Cache::put('admin_zone_select_options', $data);
return $data;
}
public function parent()
{
return $this->belongsTo(self::class, 'parent_id');
}
public function children()
{
return $this->hasMany(self::class, 'parent_id');
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$zoneFile = database_path('sql/zone.sql');
DB::unprepared(file_get_contents($zoneFile));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('zones');
}
};

View File

@ -21,7 +21,7 @@ class AdminMenuSeeder extends Seeder
//
$menus = [
['title' => '主页', 'icon' => 'feather icon-bar-chart-2', 'uri' => '/'],
['title' => '客人信息', 'icon' => 'feather icon-users', 'uri' => '/'],
['title' => '客人信息', 'icon' => 'feather icon-users', 'uri' => '/oldmen'],
['title' => '入住管理', 'icon' => 'feather icon-feather', 'uri' => '/',
'children' =>[
['title' => '入住列表', 'icon' => '', 'uri' => '/auth/users', 'permission' => ''],

View File

@ -0,0 +1,313 @@
<?php
/**
* A helper file for Dcat Admin, to provide autocomplete information to your IDE
*
* This file should not be included in your code, only analyzed by your IDE!
*
* @author jqh <841324345@qq.com>
*/
namespace Dcat\Admin {
use Illuminate\Support\Collection;
/**
* @property Grid\Column|Collection id
* @property Grid\Column|Collection name
* @property Grid\Column|Collection version
* @property Grid\Column|Collection is_enabled
* @property Grid\Column|Collection created_at
* @property Grid\Column|Collection updated_at
* @property Grid\Column|Collection type
* @property Grid\Column|Collection detail
* @property Grid\Column|Collection parent_id
* @property Grid\Column|Collection order
* @property Grid\Column|Collection icon
* @property Grid\Column|Collection uri
* @property Grid\Column|Collection extension
* @property Grid\Column|Collection slug
* @property Grid\Column|Collection http_method
* @property Grid\Column|Collection http_path
* @property Grid\Column|Collection permission_id
* @property Grid\Column|Collection menu_id
* @property Grid\Column|Collection role_id
* @property Grid\Column|Collection user_id
* @property Grid\Column|Collection username
* @property Grid\Column|Collection password
* @property Grid\Column|Collection avatar
* @property Grid\Column|Collection remember_token
* @property Grid\Column|Collection nape_id
* @property Grid\Column|Collection nurse_lv
* @property Grid\Column|Collection money
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection connection
* @property Grid\Column|Collection queue
* @property Grid\Column|Collection payload
* @property Grid\Column|Collection exception
* @property Grid\Column|Collection failed_at
* @property Grid\Column|Collection key
* @property Grid\Column|Collection value
* @property Grid\Column|Collection type_key
* @property Grid\Column|Collection sort
* @property Grid\Column|Collection level
* @property Grid\Column|Collection floor_name
* @property Grid\Column|Collection agreement_no
* @property Grid\Column|Collection sex
* @property Grid\Column|Collection birthday
* @property Grid\Column|Collection card_no
* @property Grid\Column|Collection card_province_id
* @property Grid\Column|Collection card_city_id
* @property Grid\Column|Collection card_area_id
* @property Grid\Column|Collection card_address
* @property Grid\Column|Collection client_name
* @property Grid\Column|Collection client_province_id
* @property Grid\Column|Collection client_city_id
* @property Grid\Column|Collection client_area_id
* @property Grid\Column|Collection client_address
* @property Grid\Column|Collection client_phone
* @property Grid\Column|Collection live_in
* @property Grid\Column|Collection need_pay
* @property Grid\Column|Collection live_in_at
* @property Grid\Column|Collection avliable_at
* @property Grid\Column|Collection bonds
* @property Grid\Column|Collection email
* @property Grid\Column|Collection token
* @property Grid\Column|Collection tokenable_type
* @property Grid\Column|Collection tokenable_id
* @property Grid\Column|Collection abilities
* @property Grid\Column|Collection last_used_at
* @property Grid\Column|Collection expires_at
* @property Grid\Column|Collection email_verified_at
*
* @method Grid\Column|Collection id(string $label = null)
* @method Grid\Column|Collection name(string $label = null)
* @method Grid\Column|Collection version(string $label = null)
* @method Grid\Column|Collection is_enabled(string $label = null)
* @method Grid\Column|Collection created_at(string $label = null)
* @method Grid\Column|Collection updated_at(string $label = null)
* @method Grid\Column|Collection type(string $label = null)
* @method Grid\Column|Collection detail(string $label = null)
* @method Grid\Column|Collection parent_id(string $label = null)
* @method Grid\Column|Collection order(string $label = null)
* @method Grid\Column|Collection icon(string $label = null)
* @method Grid\Column|Collection uri(string $label = null)
* @method Grid\Column|Collection extension(string $label = null)
* @method Grid\Column|Collection slug(string $label = null)
* @method Grid\Column|Collection http_method(string $label = null)
* @method Grid\Column|Collection http_path(string $label = null)
* @method Grid\Column|Collection permission_id(string $label = null)
* @method Grid\Column|Collection menu_id(string $label = null)
* @method Grid\Column|Collection role_id(string $label = null)
* @method Grid\Column|Collection user_id(string $label = null)
* @method Grid\Column|Collection username(string $label = null)
* @method Grid\Column|Collection password(string $label = null)
* @method Grid\Column|Collection avatar(string $label = null)
* @method Grid\Column|Collection remember_token(string $label = null)
* @method Grid\Column|Collection nape_id(string $label = null)
* @method Grid\Column|Collection nurse_lv(string $label = null)
* @method Grid\Column|Collection money(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection connection(string $label = null)
* @method Grid\Column|Collection queue(string $label = null)
* @method Grid\Column|Collection payload(string $label = null)
* @method Grid\Column|Collection exception(string $label = null)
* @method Grid\Column|Collection failed_at(string $label = null)
* @method Grid\Column|Collection key(string $label = null)
* @method Grid\Column|Collection value(string $label = null)
* @method Grid\Column|Collection type_key(string $label = null)
* @method Grid\Column|Collection sort(string $label = null)
* @method Grid\Column|Collection level(string $label = null)
* @method Grid\Column|Collection floor_name(string $label = null)
* @method Grid\Column|Collection agreement_no(string $label = null)
* @method Grid\Column|Collection sex(string $label = null)
* @method Grid\Column|Collection birthday(string $label = null)
* @method Grid\Column|Collection card_no(string $label = null)
* @method Grid\Column|Collection card_province_id(string $label = null)
* @method Grid\Column|Collection card_city_id(string $label = null)
* @method Grid\Column|Collection card_area_id(string $label = null)
* @method Grid\Column|Collection card_address(string $label = null)
* @method Grid\Column|Collection client_name(string $label = null)
* @method Grid\Column|Collection client_province_id(string $label = null)
* @method Grid\Column|Collection client_city_id(string $label = null)
* @method Grid\Column|Collection client_area_id(string $label = null)
* @method Grid\Column|Collection client_address(string $label = null)
* @method Grid\Column|Collection client_phone(string $label = null)
* @method Grid\Column|Collection live_in(string $label = null)
* @method Grid\Column|Collection need_pay(string $label = null)
* @method Grid\Column|Collection live_in_at(string $label = null)
* @method Grid\Column|Collection avliable_at(string $label = null)
* @method Grid\Column|Collection bonds(string $label = null)
* @method Grid\Column|Collection email(string $label = null)
* @method Grid\Column|Collection token(string $label = null)
* @method Grid\Column|Collection tokenable_type(string $label = null)
* @method Grid\Column|Collection tokenable_id(string $label = null)
* @method Grid\Column|Collection abilities(string $label = null)
* @method Grid\Column|Collection last_used_at(string $label = null)
* @method Grid\Column|Collection expires_at(string $label = null)
* @method Grid\Column|Collection email_verified_at(string $label = null)
*/
class Grid {}
class MiniGrid extends Grid {}
/**
* @property Show\Field|Collection id
* @property Show\Field|Collection name
* @property Show\Field|Collection version
* @property Show\Field|Collection is_enabled
* @property Show\Field|Collection created_at
* @property Show\Field|Collection updated_at
* @property Show\Field|Collection type
* @property Show\Field|Collection detail
* @property Show\Field|Collection parent_id
* @property Show\Field|Collection order
* @property Show\Field|Collection icon
* @property Show\Field|Collection uri
* @property Show\Field|Collection extension
* @property Show\Field|Collection slug
* @property Show\Field|Collection http_method
* @property Show\Field|Collection http_path
* @property Show\Field|Collection permission_id
* @property Show\Field|Collection menu_id
* @property Show\Field|Collection role_id
* @property Show\Field|Collection user_id
* @property Show\Field|Collection username
* @property Show\Field|Collection password
* @property Show\Field|Collection avatar
* @property Show\Field|Collection remember_token
* @property Show\Field|Collection nape_id
* @property Show\Field|Collection nurse_lv
* @property Show\Field|Collection money
* @property Show\Field|Collection uuid
* @property Show\Field|Collection connection
* @property Show\Field|Collection queue
* @property Show\Field|Collection payload
* @property Show\Field|Collection exception
* @property Show\Field|Collection failed_at
* @property Show\Field|Collection key
* @property Show\Field|Collection value
* @property Show\Field|Collection type_key
* @property Show\Field|Collection sort
* @property Show\Field|Collection level
* @property Show\Field|Collection floor_name
* @property Show\Field|Collection agreement_no
* @property Show\Field|Collection sex
* @property Show\Field|Collection birthday
* @property Show\Field|Collection card_no
* @property Show\Field|Collection card_province_id
* @property Show\Field|Collection card_city_id
* @property Show\Field|Collection card_area_id
* @property Show\Field|Collection card_address
* @property Show\Field|Collection client_name
* @property Show\Field|Collection client_province_id
* @property Show\Field|Collection client_city_id
* @property Show\Field|Collection client_area_id
* @property Show\Field|Collection client_address
* @property Show\Field|Collection client_phone
* @property Show\Field|Collection live_in
* @property Show\Field|Collection need_pay
* @property Show\Field|Collection live_in_at
* @property Show\Field|Collection avliable_at
* @property Show\Field|Collection bonds
* @property Show\Field|Collection email
* @property Show\Field|Collection token
* @property Show\Field|Collection tokenable_type
* @property Show\Field|Collection tokenable_id
* @property Show\Field|Collection abilities
* @property Show\Field|Collection last_used_at
* @property Show\Field|Collection expires_at
* @property Show\Field|Collection email_verified_at
*
* @method Show\Field|Collection id(string $label = null)
* @method Show\Field|Collection name(string $label = null)
* @method Show\Field|Collection version(string $label = null)
* @method Show\Field|Collection is_enabled(string $label = null)
* @method Show\Field|Collection created_at(string $label = null)
* @method Show\Field|Collection updated_at(string $label = null)
* @method Show\Field|Collection type(string $label = null)
* @method Show\Field|Collection detail(string $label = null)
* @method Show\Field|Collection parent_id(string $label = null)
* @method Show\Field|Collection order(string $label = null)
* @method Show\Field|Collection icon(string $label = null)
* @method Show\Field|Collection uri(string $label = null)
* @method Show\Field|Collection extension(string $label = null)
* @method Show\Field|Collection slug(string $label = null)
* @method Show\Field|Collection http_method(string $label = null)
* @method Show\Field|Collection http_path(string $label = null)
* @method Show\Field|Collection permission_id(string $label = null)
* @method Show\Field|Collection menu_id(string $label = null)
* @method Show\Field|Collection role_id(string $label = null)
* @method Show\Field|Collection user_id(string $label = null)
* @method Show\Field|Collection username(string $label = null)
* @method Show\Field|Collection password(string $label = null)
* @method Show\Field|Collection avatar(string $label = null)
* @method Show\Field|Collection remember_token(string $label = null)
* @method Show\Field|Collection nape_id(string $label = null)
* @method Show\Field|Collection nurse_lv(string $label = null)
* @method Show\Field|Collection money(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection connection(string $label = null)
* @method Show\Field|Collection queue(string $label = null)
* @method Show\Field|Collection payload(string $label = null)
* @method Show\Field|Collection exception(string $label = null)
* @method Show\Field|Collection failed_at(string $label = null)
* @method Show\Field|Collection key(string $label = null)
* @method Show\Field|Collection value(string $label = null)
* @method Show\Field|Collection type_key(string $label = null)
* @method Show\Field|Collection sort(string $label = null)
* @method Show\Field|Collection level(string $label = null)
* @method Show\Field|Collection floor_name(string $label = null)
* @method Show\Field|Collection agreement_no(string $label = null)
* @method Show\Field|Collection sex(string $label = null)
* @method Show\Field|Collection birthday(string $label = null)
* @method Show\Field|Collection card_no(string $label = null)
* @method Show\Field|Collection card_province_id(string $label = null)
* @method Show\Field|Collection card_city_id(string $label = null)
* @method Show\Field|Collection card_area_id(string $label = null)
* @method Show\Field|Collection card_address(string $label = null)
* @method Show\Field|Collection client_name(string $label = null)
* @method Show\Field|Collection client_province_id(string $label = null)
* @method Show\Field|Collection client_city_id(string $label = null)
* @method Show\Field|Collection client_area_id(string $label = null)
* @method Show\Field|Collection client_address(string $label = null)
* @method Show\Field|Collection client_phone(string $label = null)
* @method Show\Field|Collection live_in(string $label = null)
* @method Show\Field|Collection need_pay(string $label = null)
* @method Show\Field|Collection live_in_at(string $label = null)
* @method Show\Field|Collection avliable_at(string $label = null)
* @method Show\Field|Collection bonds(string $label = null)
* @method Show\Field|Collection email(string $label = null)
* @method Show\Field|Collection token(string $label = null)
* @method Show\Field|Collection tokenable_type(string $label = null)
* @method Show\Field|Collection tokenable_id(string $label = null)
* @method Show\Field|Collection abilities(string $label = null)
* @method Show\Field|Collection last_used_at(string $label = null)
* @method Show\Field|Collection expires_at(string $label = null)
* @method Show\Field|Collection email_verified_at(string $label = null)
*/
class Show {}
/**
*/
class Form {}
}
namespace Dcat\Admin\Grid {
/**
*/
class Column {}
/**
*/
class Filter {}
}
namespace Dcat\Admin\Show {
/**
*/
class Field {}
}

View File

@ -0,0 +1,29 @@
<?php
return [
'labels' => [
'Oldman' => '客人信息',
'oldmen' => '客人信息',
],
'fields' => [
'floor_name' => '楼栋',
'agreement_no' => '协议号码',
'name' => '姓名',
'sex' => '性别',
'birthday' => '出生日期',
'card_no' => '身份证号码',
'card_province_id' => '户籍-省',
'card_city_id' => '户籍-市',
'card_area_id' => '户籍-区',
'card_address' => '户籍-街道详细地址',
'client_name' => '委托人',
'client_province_id' => '委托人-省',
'client_city_id' => '委托人-市',
'client_area_id' => '委托人-区',
'client_address' => '委托人-街道详细地址',
'client_phone' => '委托人-手机号',
'nurse_lv' => '护理级别',
'created_at' => '添加时间'
],
'options' => [
],
];