<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\ServiceOrder;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class ServiceOrderController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new ServiceOrder(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('user_id');
            $grid->column('order_sn');
            $grid->column('pay_type');
            $grid->column('transaction_id');
            $grid->column('project_id');
            $grid->column('area_id');
            $grid->column('project_name');
            $grid->column('project_icon');
            $grid->column('pay_price');
            $grid->column('balance_price');
            $grid->column('discount_price');
            $grid->column('coupon_price');
            $grid->column('car_price');
            $grid->column('material_price');
            $grid->column('service_price');
            $grid->column('coach_id');
            $grid->column('start_time');
            $grid->column('end_time');
            $grid->column('time_long');
            $grid->column('true_time_long');
            $grid->column('payment_time');
            $grid->column('remark');
            $grid->column('pay_time');
            $grid->column('receiving_time');
            $grid->column('depart_time');
            $grid->column('arrive_time');
            $grid->column('over_time');
            $grid->column('refund_time');
            $grid->column('refund_text');
            $grid->column('distance');
            $grid->column('is_show');
            $grid->column('depart_lng');
            $grid->column('depart_lat');
            $grid->column('depart_address');
            $grid->column('arrive_img');
            $grid->column('arrive_lng');
            $grid->column('arrive_lat');
            $grid->column('arrive_address');
            $grid->column('address');
            $grid->column('real_address');
            $grid->column('address_lng');
            $grid->column('address_lat');
            $grid->column('over_img');
            $grid->column('over_lng');
            $grid->column('over_lat');
            $grid->column('over_address');
            $grid->column('agent_commission_ratio');
            $grid->column('agent_commission_price');
            $grid->column('coach_commission_ratio');
            $grid->column('coach_commission_price');
            $grid->column('company_price');
            $grid->column('retail_price');
            $grid->column('coupon_id');
            $grid->column('channel_id');
            $grid->column('channel_cate_id');
            $grid->column('extend_order');
            $grid->column('extend_order_id');
            $grid->column('store_id');
            $grid->column('type');
            $grid->column('status');
            $grid->column('user_del');
            $grid->column('user_end');
            $grid->column('created_at');
            $grid->column('updated_at')->sortable();
        
            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
        
            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new ServiceOrder(), function (Show $show) {
            $show->field('id');
            $show->field('user_id');
            $show->field('order_sn');
            $show->field('pay_type');
            $show->field('transaction_id');
            $show->field('project_id');
            $show->field('area_id');
            $show->field('project_name');
            $show->field('project_icon');
            $show->field('pay_price');
            $show->field('balance_price');
            $show->field('discount_price');
            $show->field('coupon_price');
            $show->field('car_price');
            $show->field('material_price');
            $show->field('service_price');
            $show->field('coach_id');
            $show->field('start_time');
            $show->field('end_time');
            $show->field('time_long');
            $show->field('true_time_long');
            $show->field('payment_time');
            $show->field('remark');
            $show->field('pay_time');
            $show->field('receiving_time');
            $show->field('depart_time');
            $show->field('arrive_time');
            $show->field('over_time');
            $show->field('refund_time');
            $show->field('refund_text');
            $show->field('distance');
            $show->field('is_show');
            $show->field('depart_lng');
            $show->field('depart_lat');
            $show->field('depart_address');
            $show->field('arrive_img');
            $show->field('arrive_lng');
            $show->field('arrive_lat');
            $show->field('arrive_address');
            $show->field('address');
            $show->field('real_address');
            $show->field('address_lng');
            $show->field('address_lat');
            $show->field('over_img');
            $show->field('over_lng');
            $show->field('over_lat');
            $show->field('over_address');
            $show->field('agent_commission_ratio');
            $show->field('agent_commission_price');
            $show->field('coach_commission_ratio');
            $show->field('coach_commission_price');
            $show->field('company_price');
            $show->field('retail_price');
            $show->field('coupon_id');
            $show->field('channel_id');
            $show->field('channel_cate_id');
            $show->field('extend_order');
            $show->field('extend_order_id');
            $show->field('store_id');
            $show->field('type');
            $show->field('status');
            $show->field('user_del');
            $show->field('user_end');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new ServiceOrder(), function (Form $form) {
            $form->display('id');
            $form->text('user_id');
            $form->text('order_sn');
            $form->text('pay_type');
            $form->text('transaction_id');
            $form->text('project_id');
            $form->text('area_id');
            $form->text('project_name');
            $form->text('project_icon');
            $form->text('pay_price');
            $form->text('balance_price');
            $form->text('discount_price');
            $form->text('coupon_price');
            $form->text('car_price');
            $form->text('material_price');
            $form->text('service_price');
            $form->text('coach_id');
            $form->text('start_time');
            $form->text('end_time');
            $form->text('time_long');
            $form->text('true_time_long');
            $form->text('payment_time');
            $form->text('remark');
            $form->text('pay_time');
            $form->text('receiving_time');
            $form->text('depart_time');
            $form->text('arrive_time');
            $form->text('over_time');
            $form->text('refund_time');
            $form->text('refund_text');
            $form->text('distance');
            $form->text('is_show');
            $form->text('depart_lng');
            $form->text('depart_lat');
            $form->text('depart_address');
            $form->text('arrive_img');
            $form->text('arrive_lng');
            $form->text('arrive_lat');
            $form->text('arrive_address');
            $form->text('address');
            $form->text('real_address');
            $form->text('address_lng');
            $form->text('address_lat');
            $form->text('over_img');
            $form->text('over_lng');
            $form->text('over_lat');
            $form->text('over_address');
            $form->text('agent_commission_ratio');
            $form->text('agent_commission_price');
            $form->text('coach_commission_ratio');
            $form->text('coach_commission_price');
            $form->text('company_price');
            $form->text('retail_price');
            $form->text('coupon_id');
            $form->text('channel_id');
            $form->text('channel_cate_id');
            $form->text('extend_order');
            $form->text('extend_order_id');
            $form->text('store_id');
            $form->text('type');
            $form->text('status');
            $form->text('user_del');
            $form->text('user_end');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
