<?php

namespace App\Modules\Invoices;

use App\Modules\Clients\Customer;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\App;
use App\Http\Controllers\BaseController;
use Setting;

class SalesController extends BaseController
{
    /**
     *	The layout that should be used for responses.
     */
    protected $layout = 'layouts.master';

    /*
    |--------------------------------------------------------------------------
    | Sales index page
    |--------------------------------------------------------------------------
    |
    |
    */
    public function getIndex()
    {
        // Static product types (removed KashFlow integration)
        $product_types = [
            ['name' => 'Labour - Repairs', 'value' => '8141749'],
            ['name' => 'Labour - Support', 'value' => '8141823'],
            ['name' => 'Labour - Onsite', 'value' => '8141859'],
            ['name' => 'Parts - Hardware', 'value' => '8141861'],
            ['name' => 'Parts - Software', 'value' => '8141862'],
            ['name' => 'Antivirus', 'value' => '8141863'],
            ['name' => 'Labour - Development', 'value' => '8222039'],
            ['name' => 'Hosting', 'value' => '8341131'],
            ['name' => 'Domains', 'value' => '11292912'],
            ['name' => 'Office 365', 'value' => '11293174'],
            ['name' => 'Remote Support Contract', 'value' => '11293175'],
            ['name' => 'Full Contract', 'value' => '11293176'],
            ['name' => 'Website Hosting', 'value' => '11293178'],
            ['name' => 'Broadband', 'value' => '12561214'],
            ['name' => 'Backup - Carbonite', 'value' => '12561299'],
            ['name' => 'Backup - Mozy', 'value' => '12561332'],
            ['name' => 'Backup - Hosting Assistance', 'value' => '12561333'],
            ['name' => 'DynDNS', 'value' => '12561651'],
            ['name' => 'LogMeIn', 'value' => '12561652'],
            ['name' => 'Hosting - Backup MX', 'value' => '12561654'],
            ['name' => 'Hosting - SMTP Relay', 'value' => '12562101'],
            ['name' => 'Spamfilter', 'value' => '12562390'],
            ['name' => 'Google Apps', 'value' => '12563398'],
            ['name' => 'Dropbox', 'value' => '12563402'],
            ['name' => 'Delivery', 'value' => '13390309'],
            ['name' => 'VoIP', 'value' => '17142975'],
            ['name' => 'Backup - Cloudberry', 'value' => '21695067'],
            ['name' => 'Labour - Booking Fee', 'value' => '26476366'],
            ['name' => 'Visio online plan', 'value' => '28460478'],
            ['name' => ' Onsite Support Contract', 'value' => '28675027'],
            ['name' => 'Other income', 'value' => '29275204'],
            ['name' => 'PayPal Sales', 'value' => '19306691'],
            ['name' => 'Landline', 'value' => '24593382'],
            ['name' => 'Back-up VeeamCloud', 'value' => '26744922'],
            ['name' => 'Back-up VeeamOffsite', 'value' => '26744923'],
            ['name' => 'PayPal Charges', 'value' => '19306690'],
            ['name' => 'Write offs', 'value' => '28271242'],
            ['name' => 'Other', 'value' => '8088337'],
            ['name' => 'Discount-Refund from Supplier', 'value' => '26429841'],
        ];

        // Retrieve the Walk in customer
        $data = [
            'walkInCustomer' => Customer::query()->where('first_name', 'like', '%Walk in%')->where('last_name', 'like', 'customer%')->first(),
            'types'          => $product_types,
        ];
        
        $this->layout->content = View::make('invoices::index', $data);
    }
}
