<?php

namespace App\Http\Resources\Reports\CRM;


use App\Models\CommentsClients;
use App\Models\Customers;
use App\Models\Sales;
use Illuminate\Http\Resources\Json\JsonResource;
use DB;
use Auth;
use DateTime;
class DelegateVistsReportApiResources extends JsonResource
{


    public function toArray($request)
    {


        $lang = $request->header('lang', '');


        if (app()->getLocale() == 'ar') {
            $emp_name = $this->Emp()->first()->Name;
            $client_name = $this->Client()->first()->Name;

        } else {
            $emp_name = $this->Emp()->first()->NameEn;
            $client_name = $this->Client()->first()->NameEn;

        }


        if ($this->Status == 1) {
            $status=trans('admin.Postive');
        }else{
            $status=trans('admin.Negative');

        }
        if ($this->Day == 'Sat') {
            $day=trans('admin.Sat');
        }elseif($this->Day == 'Sun'){
            $day=trans('admin.Sun');

        }elseif($this->Day == 'Mon'){
            $day=trans('admin.Mon');

        }elseif($this->Day == 'Tue'){
            $day=trans('admin.Tue');

        }elseif($this->Day == 'Wed'){
            $day=trans('admin.Wed');

        }elseif($this->Day == 'Thu'){
            $day=trans('admin.Thr');

        }elseif($this->Day == 'Fri'){
            $day=trans('admin.Fri');

        }


        $data=[

            'date'=>$this->Date
            ,'time'=>$this->Time
            ,'day'=>$day
            ,'emp_name'=>$emp_name
            ,'client_name'=>$client_name
            ,'status'=>$status
            ,'note'=>$this->Note


        ];




        return $data ;
    }

}
