diff --git a/app/Admin/Controllers/CostAdviceController.php b/app/Admin/Controllers/CostAdviceController.php new file mode 100644 index 0000000..fe4f00a --- /dev/null +++ b/app/Admin/Controllers/CostAdviceController.php @@ -0,0 +1,70 @@ +column('id')->sortable(); + $grid->column('nape_id'); + $grid->column('nurse_lv'); + $grid->column('money'); + $grid->column('created_at')->sortable(); + + $grid->filter(function (Grid\Filter $filter) { + $filter->equal('nape_id')->select()->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 CostAdvice(), function (Show $show) { + $show->field('id'); + $show->field('nape_id'); + $show->field('nurse_lv'); + $show->field('money'); + $show->field('created_at'); + $show->field('updated_at'); + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new CostAdvice(), function (Form $form) { + $form->display('id'); + $form->select('nape_id'); + $form->select('nurse_lv'); + $form->currency('money')->symbol('¥'); + + $form->display('created_at'); + $form->display('updated_at'); + }); + } +} diff --git a/app/Admin/Controllers/LiveInController.php b/app/Admin/Controllers/LiveInController.php new file mode 100644 index 0000000..6f9d0c7 --- /dev/null +++ b/app/Admin/Controllers/LiveInController.php @@ -0,0 +1,137 @@ +column('name'); + $grid->column('card_no'); + $grid->column('client_name'); + $grid->column('nurse_lv')->sortable(); + $grid->column('live_in_at')->sortable(); + $grid->column('avliable_at')->sortable(); + // $grid->column('created_at')->sortable(); + + $grid->disableCreateButton(); + $grid->tools(" +
+ +
"); + + $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'); + }); + } +} diff --git a/app/Admin/Controllers/OldmanController.php b/app/Admin/Controllers/OldmanController.php index b712d0f..07ebe75 100644 --- a/app/Admin/Controllers/OldmanController.php +++ b/app/Admin/Controllers/OldmanController.php @@ -24,7 +24,7 @@ class OldmanController extends AdminController $grid->column('name'); $grid->column('card_no'); $grid->column('sex'); - //年龄-todo + $grid->column('age'); $grid->column('client_name'); $grid->column('client_phone'); $grid->column('nurse_lv'); diff --git a/app/Admin/routes.php b/app/Admin/routes.php index 04022cc..70ec9a5 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -15,6 +15,9 @@ Route::group([ $router->get('/', 'HomeController@index'); $router->resource('oldmen', 'OldmanController')->names('oldmen'); + $router->resource('cost-advices', 'CostAdviceController')->names('cost_advices'); + + $router->get('live-in', 'LiveInController@index'); $router->group([ 'prefix' => 'api', diff --git a/app/Models/CostAdivce.php b/app/Models/CostAdvice.php similarity index 66% rename from app/Models/CostAdivce.php rename to app/Models/CostAdvice.php index a3d3b1a..eedf98e 100644 --- a/app/Models/CostAdivce.php +++ b/app/Models/CostAdvice.php @@ -5,7 +5,9 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -class CostAdivce extends Model +class CostAdvice extends Model { use HasFactory; + + protected $table = 'cost_advices'; } diff --git a/app/Models/Oldman.php b/app/Models/Oldman.php index 1b39c30..9c461c3 100644 --- a/app/Models/Oldman.php +++ b/app/Models/Oldman.php @@ -3,9 +3,11 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\Model; class Oldman extends Model { use HasFactory; + use HasDateTimeFormatter; } diff --git a/composer.json b/composer.json index 280fe94..d817aa5 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ "laravel/framework": "^9.19", "laravel/sanctum": "^3.0", "laravel/tinker": "^2.7", + "overtrue/laravel-lang": "^6.0", "peidikeji/dcat-admin": "^1.2" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 875ee6e..6b5830a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ebb63203f2e171fd6a7192c5ac6ec40e", + "content-hash": "96fceb38d5bcac126f8bac5cb6b9a003", "packages": [ { "name": "brick/math", @@ -996,6 +996,68 @@ ], "time": "2021-10-07T12:57:01+00:00" }, + { + "name": "laravel-lang/lang", + "version": "10.9.5", + "dist": { + "type": "zip", + "url": "https://mirrors.cloud.tencent.com/repository/composer/laravel-lang/lang/10.9.5/laravel-lang-lang-10.9.5.zip", + "reference": "e341421d40f2cd28feca24ab2cb84fa5cb5ddaf6", + "shasum": "" + }, + "require": { + "ext-json": "*" + }, + "conflict": { + "laravel-lang/publisher": "<12.0 >=14.0" + }, + "require-dev": { + "dragon-code/pretty-array": "^4.0", + "dragon-code/simple-dto": "^2.3", + "dragon-code/support": "^6.1", + "ext-zip": "*", + "guzzlehttp/guzzle": "^7.3", + "laravel-lang/publisher": "^13.0", + "laravel/breeze": "^1.2", + "laravel/fortify": "^1.7", + "laravel/jetstream": "^2.3", + "laravel/ui": "^3.4", + "orchestra/testbench": "^7.0", + "php": "^8.1", + "phpunit/phpunit": "^9.5", + "symfony/finder": "^6.0", + "symfony/var-dumper": "^6.0", + "vlucas/phpdotenv": "^5.4.1" + }, + "suggest": { + "arcanedev/laravel-lang": "Translations manager and checker for Laravel 5", + "laravel-lang/publisher": "Easy installation and update of translation files for your project", + "overtrue/laravel-lang": "Command to add languages in your project" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaravelLang\\Lang\\": "src" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laravel-Lang Team", + "homepage": "https://github.com/Laravel-Lang" + } + ], + "description": "Languages for Laravel", + "keywords": [ + "lang", + "languages", + "laravel", + "lpm" + ], + "time": "2022-06-27T01:57:27+00:00" + }, { "name": "laravel/framework", "version": "v9.52.4", @@ -1977,6 +2039,55 @@ ], "time": "2023-02-08T01:06:31+00:00" }, + { + "name": "overtrue/laravel-lang", + "version": "6.0.3", + "dist": { + "type": "zip", + "url": "https://mirrors.cloud.tencent.com/repository/composer/overtrue/laravel-lang/6.0.3/overtrue-laravel-lang-6.0.3.zip", + "reference": "9bdbc7cf422b2e93f8db1125f8f2b97f6e6eadad", + "shasum": "" + }, + "require": { + "ext-json": "*", + "laravel-lang/lang": "^10.4", + "symfony/process": "^6.0" + }, + "require-dev": { + "laravel/framework": "^9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Overtrue\\LaravelLang\\TranslationServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Overtrue\\LaravelLang\\": "src/" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "overtrue", + "email": "anzhengchao@gmail.com" + } + ], + "description": "List of 75 languages for Laravel.", + "keywords": [ + "i18n", + "languages", + "laravel", + "locale", + "overtrue" + ], + "time": "2022-06-18T12:46:29+00:00" + }, { "name": "peidikeji/dcat-admin", "version": "1.2.1", diff --git a/database/migrations/2023_02_28_154442_create_cost_adivces_table.php b/database/migrations/2023_02_28_154442_create_cost_advices_table.php similarity index 87% rename from database/migrations/2023_02_28_154442_create_cost_adivces_table.php rename to database/migrations/2023_02_28_154442_create_cost_advices_table.php index d790c26..ce13f94 100644 --- a/database/migrations/2023_02_28_154442_create_cost_adivces_table.php +++ b/database/migrations/2023_02_28_154442_create_cost_advices_table.php @@ -13,7 +13,7 @@ return new class extends Migration */ public function up() { - Schema::create('cost_adivces', function (Blueprint $table) { + Schema::create('cost_advices', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('nape_id')->default(0)->comment('费用项'); $table->unsignedBigInteger('nurse_lv')->default(0)->comment('护理等级'); @@ -31,6 +31,6 @@ return new class extends Migration */ public function down() { - Schema::dropIfExists('cost_adivces'); + Schema::dropIfExists('cost_advices'); } }; diff --git a/database/seeders/AdminMenuSeeder.php b/database/seeders/AdminMenuSeeder.php index 998ec35..74bb8f7 100644 --- a/database/seeders/AdminMenuSeeder.php +++ b/database/seeders/AdminMenuSeeder.php @@ -22,15 +22,17 @@ class AdminMenuSeeder extends Seeder $menus = [ ['title' => '主页', 'icon' => 'feather icon-bar-chart-2', 'uri' => '/'], ['title' => '客人信息', 'icon' => 'feather icon-users', 'uri' => '/oldmen'], - ['title' => '入住管理', 'icon' => 'feather icon-feather', 'uri' => '/', + ['title' => '入住管理', 'icon' => 'feather icon-feather', 'uri' => '', 'children' =>[ - ['title' => '入住列表', 'icon' => '', 'uri' => '/auth/users', 'permission' => ''], + ['title' => '入住列表', 'icon' => '', 'uri' => '/live-in', 'permission' => ''], ['title' => '续费列表', 'icon' => '', 'uri' => '/auth/users', 'permission' => ''], ]], ['title' => '快捷操作', 'icon' => 'feather icon-fast-forward', 'uri' => '/', 'children' =>[ ['title' => '入住', 'icon' => '', 'uri' => '/auth/users', 'permission' => ''], + ['title' => '续费', 'icon' => '', 'uri' => '/auth/users', 'permission' => ''], ['title' => '结算', 'icon' => '', 'uri' => '/auth/users', 'permission' => ''], ]], + ['title' => '费用配置', 'icon' => 'feather icon-stop-circle', 'uri' => '/cost-advices'], ['title' => '系统管理', 'icon' => 'feather icon-settings', 'uri' => '', 'permission' => ['administrators', 'roles', 'keywords', 'settings'], 'children' => [ diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index 33177ba..075c00d 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -77,6 +77,7 @@ namespace Dcat\Admin { * @property Grid\Column|Collection last_used_at * @property Grid\Column|Collection expires_at * @property Grid\Column|Collection email_verified_at + * @property Grid\Column|Collection index * * @method Grid\Column|Collection id(string $label = null) * @method Grid\Column|Collection name(string $label = null) @@ -144,6 +145,7 @@ namespace Dcat\Admin { * @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) + * @method Grid\Column|Collection index(string $label = null) */ class Grid {} @@ -216,6 +218,7 @@ namespace Dcat\Admin { * @property Show\Field|Collection last_used_at * @property Show\Field|Collection expires_at * @property Show\Field|Collection email_verified_at + * @property Show\Field|Collection index * * @method Show\Field|Collection id(string $label = null) * @method Show\Field|Collection name(string $label = null) @@ -283,6 +286,7 @@ namespace Dcat\Admin { * @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) + * @method Show\Field|Collection index(string $label = null) */ class Show {} diff --git a/lang/zh_CN/cost-advice.php b/lang/zh_CN/cost-advice.php new file mode 100644 index 0000000..7a86f5b --- /dev/null +++ b/lang/zh_CN/cost-advice.php @@ -0,0 +1,14 @@ + [ + 'CostAdvice' => '费用配置', + 'cost-advices' => '费用配置', + ], + 'fields' => [ + 'nape_id' => '费用项', + 'nurse_lv' => '护理等级', + 'money' => '金额', + ], + 'options' => [ + ], +]; diff --git a/lang/zh_CN/live-in.php b/lang/zh_CN/live-in.php new file mode 100644 index 0000000..b9227ca --- /dev/null +++ b/lang/zh_CN/live-in.php @@ -0,0 +1,17 @@ + [ + 'LiveIn' => '入住列表', + 'live-ins' => '入住列表', + ], + 'fields' => [ + 'name' => '姓名', + 'card_no' => '身份证号', + 'client_name' => '委托人', + 'nurse_lv' => '护理等级', + 'live_in_at' => '入住时间', + 'avliable_at' => '截至时间', + ], + 'options' => [ + ], +]; diff --git a/lang/zh_CN/oldman.php b/lang/zh_CN/oldman.php index 5bfdc98..75e7b77 100644 --- a/lang/zh_CN/oldman.php +++ b/lang/zh_CN/oldman.php @@ -9,6 +9,7 @@ return [ 'agreement_no' => '协议号码', 'name' => '姓名', 'sex' => '性别', + 'age' => '年龄', 'birthday' => '出生日期', 'card_no' => '身份证号码', 'card_province_id' => '户籍-省',