<?php

namespace App\Http\Controllers\Backend;

use App\DataTables\Orders\OrderDataTable;
use App\DataTables\BillingDesks\BillingDeskDataTableEditor;
use App\Http\Controllers\Controller;
use App\Models\OrderManagement\Order;
use App\Models\UserManagement\Admin;
use App\Models\UserManagement\Customer;


class SalesController extends Controller{

    public function index(){
        $table_sale_id = "table-sales";
         $dataTable = new OrderDataTable([
             "table_id" => $table_sale_id,
             'ajax' => route("admin.sales.index")
         ]);
         $statuses = Order::getStatuses();
         $users = Admin::active()->get();
         $customers = Customer::active()->get();
         $billing_desks = auth()->user()->billingDesks()->active()->get();
         $title = __("Sales");
         return $dataTable->render('backend.sales.index',
                 compact("title","users","customers","statuses","billing_desks","table_sale_id")
                );

       // dd($dataTable->html()->html);
    }

    public function dtEdit(BillingDeskDataTableEditor $editor){
        return $editor->process(request());
    }

}
