<?php

namespace App\Admin\Forms;

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

class AceLeft extends Form
{
    public function form()
    {
        //主题选择
        $this->select('appearance_id','Select Appearance')
            ->options(DistAppearance::selectOptions())
            ->width(12,12)
            ->setLabelClass('d-flex');
        //供应商选择
        $this->selectTable('dist_id', 'Select Distributor')
            ->width(12,12)
            ->setLabelClass('d-flex')
            ->title('Select Distributor')
            ->placeholder('Select Distributor')
            ->from(DistDistributorTable::make())
            ->help('If empty, use the original template.');
        $this->disableSubmitButton();
        $this->disableResetButton();
    }

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

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

}
