<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use Illuminate\Support\Facades\Auth;
use App\Models\User;
use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use ReCaptcha\ReCaptcha;

Auth::routes();
Route::get('/', function () {
    return redirect()->route('admin-login');
});
Route::get('login', 'Admin\AuthController@loginView')->name('admin-login');
Route::get('register', 'Admin\AuthController@signupView');
Route::post('agencyRegister', 'Admin\AuthController@agencyRegister')->name('agency-register');
Route::post('agentRegister', 'Admin\AuthController@agentRegister')->name('agent-register');
Route::get('logout', function () {
    Auth::logout();
    return redirect()->route('admin-login');
});
Route::middleware('auth')->group(function () {
    // Route::post('doCP', 'Admin\AuthController@doCP')->name('doCP');
    // Route::post('doUP', 'Admin\AuthController@doUP')->name('doUP');
    // Route::get('profile', 'Admin\AdminsController@adminProfileView')->name('admin-profile');
    Route::get('dashboard', 'Admin\DashboardController@dashboardView')->name('admin-dashboard');
    Route::get('calling-database', 'Admin\SetupController@cdView');
    Route::get('leads', 'Admin\SetupController@leadsView');
    Route::get('lead-detail/{id}', 'Admin\SetupController@leadDetailsView');
    Route::get('contacts', 'Admin\SetupController@contactsView');
    Route::get('contact-detail/{id}', 'Admin\SetupController@contactDetailsView');
    Route::get('listings', 'Admin\ListingsController@listingsView');
    Route::get('wip', 'Admin\ListingsController@wipView');
    Route::get('requirements', 'Admin\SetupController@reqView');
    Route::get('offplan', 'Admin\SetupController@offplanView');
    Route::get('appointments', 'Admin\SetupController@appointmentsView');
    Route::get('calender', 'Admin\SetupController@calenderView');
    Route::post('upload-cds-file', 'Admin\SetupController@uploadCdsFile')->name('upload-cds-file');
    Route::post('upload-offplan-file', 'Admin\SetupController@uploadOffplanFile')->name('upload-offplan-file');
    Route::get('export-cds', 'Admin\SetupController@exportCds')->name('export-cds');
    Route::get('export-leads', 'Admin\SetupController@exportLeads')->name('export-leads');
    Route::get('export-contacts', 'Admin\SetupController@exportContacts')->name('export-contacts');
    Route::middleware('is_admin_agency')->group(function () {
        Route::get('agents', 'Admin\UsersController@agentsView');
    });
    Route::middleware('is_admin')->group(function () {
        Route::get('roles', 'Admin\RolesController@rolesView');
        Route::get('users', 'Admin\UsersController@usersView');
        Route::get('states', 'Admin\SetupController@citiesView');
        Route::get('areas', 'Admin\SetupController@districtsView');
        Route::get('projects', 'Admin\SetupController@projectsView');
        Route::get('developers', 'Admin\SetupController@developersView');
        Route::get('purposes', 'Admin\SetupController@purposesView');
        Route::get('unit-types', 'Admin\SetupController@unitTypesView');
        Route::get('property-types', 'Admin\SetupController@propertyTypesView');
        Route::get('features', 'Admin\SetupController@featuresView');
        Route::get('completion-status', 'Admin\SetupController@completionStatusView');
        Route::get('development-status', 'Admin\SetupController@developmentStatusView');
        Route::get('sale-status', 'Admin\SetupController@saleStatusView');
        Route::get('ownership-status', 'Admin\SetupController@ownershipStatusView');
        Route::get('rent-frequencies', 'Admin\SetupController@rentFrequenciesView');
        Route::get('cheques', 'Admin\SetupController@chequesView');
        Route::get('lead-status', 'Admin\SetupController@leadStatusView');
        Route::get('lead-types', 'Admin\SetupController@leadTypesView');
        Route::get('lead-categories', 'Admin\SetupController@leadCategoriesView');
        Route::get('lead-interest-levels', 'Admin\SetupController@leadInterestLevelsView');
        Route::get('lead-sources', 'Admin\SetupController@leadSourcesView');
        Route::get('enquiry-sources', 'Admin\SetupController@enquirySourcesView');
        Route::get('contact-roles', 'Admin\SetupController@contactRolesView');
//        Route::get('settings', 'Admin\SetupController@settingsView');
//        Route::post('doUP', 'Admin\AuthController@doUP')->name('doUP');
    });
});
// BackOffice end
//    API Routes
require_once(__DIR__ . '/api/web.php');
