<?php
/**
 * Created by PhpStorm.
 * User: ywlministrator
 * Date: 2023/3/10
 * Time: 11:05
 */
$app = app();
$languagePath = '';
if(config('app.language_path')) {
    $languagePath = config('app.language_path').'/';
}
$app->router->group(['namespace' => 'App\Form\Controllers',
    'prefix' => $languagePath.'api'], function ($router) {

    //编辑器保存表单结构
    $router->post('form/agent-record', 'FormController@addFormRecord');

    //表单项详情排序
    $router->post('form/item_detail_sort', 'FormController@sortItemDetail');

    $router->get('form/record/list/export', 'FormRecordController@exportList');

    $router->group(['middleware' =>['admin.auth']], function ($router) {
        //保存表单结构
        $router->post('form/save-info', 'FormController@addForm');
        //保持单个表单项
        $router->post('form/save-item', 'FormController@addItem');
        //删除表单项
        $router->post('form/del-item', 'FormController@delItem');
        //获取表单结构
        $router->get('form/get-info','FormController@formById');
        //表单项排序
        $router->post('form/item_sort', 'FormController@sortItem');
        //获取表单列表
        $router->get('form/list', 'FormController@getList');
        //删除或者禁用表单
        $router->post('form/stop_and_del', 'FormController@stopAndDelFormById');
        //导出
        $router->get('form/record/export', 'FormRecordController@exportList');
        //记录列表
        $router->get('form/record/list', 'FormRecordController@getList');
        //设置为已读
        $router->post('form/record/record-set-is-read', 'FormRecordController@recordSetIsRead');
        //记录列表导出
        //记录详情
        $router->get('form/record', 'FormRecordController@getRecord');
        //记录删除
        $router->delete('form/record', 'FormRecordController@delRecord');
        $router->post('form/record/status', 'FormRecordController@changeRecordStatus');
        //获取对应公司下询盘列表
        $router->get('form/correspond/company/list', 'FormController@correspondCompanyFormList');
        //获取对应公司下询盘列表
        $router->get('form/record/company/not-read-count', 'FormController@getCompanyFormRecordNotReadCount');
        //导出
        $router->post('form/record/center/export', 'FormRecordController@centerExportList');
    });
});
