<?php

namespace App\Admin\Controllers;

use App\Services\CoachScoreService;
use Slowlyo\OwlAdmin\Controllers\AdminController;

/**
 * 技师评分
 *
 * @property CoachScoreService $service
 */
class CoachScoreController extends AdminController
{
	protected string $serviceName = CoachScoreService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('coach_id', '技师编号'),
				amis()->TableColumn('service_duration', '服务时长(分钟)')->sortable(),
				amis()->TableColumn('order_count', '订单数量')->sortable(),
				amis()->TableColumn('good_rate', '好评率'),
				amis()->TableColumn('efficiency', '服务效率'),
				amis()->TableColumn('punctual_rate', '准时率'),
				amis()->TableColumn('completion_rate', '完成率'),
				amis()->TableColumn('rating_score', '评价得分'),
				amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
				amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
				$this->rowActions('dialog')
			]);

		return $this->baseList($crud);
	}

	public function form($isEdit = false)
	{
		return $this->baseForm()->body([
			amis()->TextControl('coach_id', '技师编号'),
			amis()->TextControl('service_duration', '服务时长(分钟)'),
			amis()->TextControl('order_count', '订单数量'),
			amis()->TextControl('good_rate', '好评率'),
			amis()->TextControl('efficiency', '服务效率'),
			amis()->TextControl('punctual_rate', '准时率'),
			amis()->TextControl('completion_rate', '完成率'),
			amis()->TextControl('rating_score', '评价得分'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('coach_id', '技师编号')->static(),
			amis()->TextControl('service_duration', '服务时长(分钟)')->static(),
			amis()->TextControl('order_count', '订单数量')->static(),
			amis()->TextControl('good_rate', '好评率')->static(),
			amis()->TextControl('efficiency', '服务效率')->static(),
			amis()->TextControl('punctual_rate', '准时率')->static(),
			amis()->TextControl('completion_rate', '完成率')->static(),
			amis()->TextControl('rating_score', '评价得分')->static(),
			amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
			amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
		]);
	}
}