<?php

namespace App\Admin\Forms;

use App\Admin\Renderable\DistDistributorTable;
use App\Models\DistAdminDistributor;
use Symfony\Component\HttpFoundation\Response;
use Dcat\Admin\Widgets\Form;
use App\Admin\Repositories\DistAppearance;
use App\Admin\Repositories\DistAdminDistributor as DistAdminDistributorRepository;

class AceLeft extends Form
{
    public function form()
    {
        //供应商选择
//        $this->selectTable('dist_id', 'Select Distributor')
//            ->width(12,12)
//            ->setLabelClass('d-flex')
//            ->title('Select Distributor')
//            ->placeholder('Select Distributor')
//            ->model(DistAdminDistributor::class, 'id', 'client_code')
//            ->from(DistDistributorTable::make());

        $this->select('dist_id', 'Select Distributor')
            ->options(DistAdminDistributorRepository::selectOptionsNew(1000))
            ->width(12,12)
            ->setLabelClass('d-flex');

        //主题选择
        $this->select('appearance_id','Select Appearance')
            ->options(DistAppearance::selectOptions(true))
            ->width(12,12)
            ->setLabelClass('d-flex');

        $this->disableSubmitButton();
        $this->disableResetButton();
    }

    // 处理表单提交请求
    public function handle(array $input)
    {
        return $this->response()->success('Processed successfully.')->refresh();
    }

    /**
     * 返回表单数据，如不需要可以删除此方法
     *
     * @return array
     */
    public function default()
    {
        return [
        ];
    }

}
