PHP code example of asantibanez / livewire-status-board

1. Go to this page and download the library: Download asantibanez/livewire-status-board library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asantibanez / livewire-status-board example snippets


public function statuses() : Collection 
{
    //
}

public function records() : Collection 
{
    //
}

public function statuses() : Collection
{
    return collect([
        [
            'id' => 'registered',
            'title' => 'Registered',
        ],
        [
            'id' => 'awaiting_confirmation',
            'title' => 'Awaiting Confirmation',
        ],
        [
            'id' => 'confirmed',
            'title' => 'Confirmed',
        ],
        [
            'id' => 'delivered',
            'title' => 'Delivered',
        ],
    ]);
}

public function records() : Collection
{
    return SalesOrder::query()
        ->map(function (SalesOrder $salesOrder) {
            return [
                'id' => $salesOrder->id,
                'title' => $salesOrder->client,
                'status' => $salesOrder->status,
            ];
        });
}

$status['id'] == $record['status'];

public function onStatusSorted($recordId, $statusId, $orderedIds)
{
    //   
}

public function onStatusChanged($recordId, $statusId, $fromOrderedIds, $toOrderedIds)
{
    //
}

public function onRecordClick($recordId)
{
    //
}

return [
    'wrapper' => 'w-full h-full flex space-x-4 overflow-x-auto', // component wrapper
    'statusWrapper' => 'h-full flex-1', // statuses wrapper
    'status' => 'bg-blue-200 rounded px-2 flex flex-col h-full', // status column wrapper 
    'statusHeader' => 'p-2 text-sm text-gray-700', // status header
    'statusFooter' => '', // status footer
    'statusRecords' => 'space-y-2 p-2 flex-1 overflow-y-auto', // status records wrapper 
    'record' => 'shadow bg-white p-2 rounded border', // record wrapper
    'recordContent' => '', // record content
]; 

public function styles()
{
    $baseStyles = parent::styles();

    $baseStyles['wrapper'] = 'w-full flex space-x-4 overflow-x-auto bg-blue-500 px-4 py-8';

    $baseStyles['statusWrapper'] = 'flex-1';

    $baseStyles['status'] = 'bg-gray-200 rounded px-2 flex flex-col flex-1';

    $baseStyles['statusHeader'] = 'text-sm font-medium py-2 text-gray-700';

    $baseStyles['statusRecords'] = 'space-y-2 px-1 pt-2 pb-2';

    $baseStyles['record'] = 'shadow bg-white p-2 rounded border text-sm text-gray-800';

    return $baseStyles;
}
 bash
php artisan make:livewire SalesOrdersStatusBoard