<?php
/**
 * Cart View Registration for NetSuite Module
 * 
 * This file shows how the NetSuite module can register its cart view customizations.
 * Add this to the NetSuite module's init() method or bootstrap process.
 */

// Example configuration that should be added to params['admin_views']['cart']:
return [
    'tabs' => [        
        [
            'label' => 'NetSuite Integration',
            'content' => 'viewtabs/_netsuite_integration_tab',
            'active' => false,
            'weight' => 300,
            'enabled' => true,
            'conditions' => [
                'netsuite_enabled' => 1,
            ],
            'module' => 'netsuite',
        ],
        [
            'label' => 'NetSuite Orders',
            'content' => 'viewtabs/_netsuite_orders_tab',
            'active' => false,
            'weight' => 310,
            'enabled' => true,
            'conditions' => [
                'netsuite_enabled' => true,
                'status' => ['Complete', 'Ordered'],
            ],
            'module' => 'netsuite',
        ],
    ],
    'buttons' => [
        [
            'label' => 'Send to NetSuite',
            'class' => 'nav-link btn bg-success text-white w-100 mb-1',
            'id' => 'send-netsuite-btn',
            'onclick' => 'sendToNetsuite(this.dataset.cartId)',
            'weight' => 300,
            'enabled' => true,
            'conditions' => [
                'netsuite_enabled' => true,
                'billingstatus' => 'paid',
                'user_groups' => ['Global Admins', 'Sales Admin'],
            ],
            'module' => 'netsuite',
        ],
        [
            'label' => 'Link to NetSuite',
            'class' => 'nav-link btn bg-info text-white w-100 mb-1',
            'id' => 'link-netsuite-btn', 
            'onclick' => 'linkToNetsuite(this.dataset.cartId)',
            'weight' => 310,
            'enabled' => true,
            'conditions' => [
                'netsuite_enabled' => true,
                'user_groups' => ['Global Admins', 'Sales Admin'],
            ],
            'module' => 'netsuite',
        ],
        [
            'label' => 'NetSuite Status',
            'class' => 'nav-link btn bg-secondary text-white w-100 mb-1',
            'id' => 'netsuite-status-btn',
            'onclick' => 'checkNetsuiteStatus(this.dataset.cartId)',
            'weight' => 320,
            'enabled' => false, // Example: disabled by default
            'conditions' => [
                'netsuite_enabled' => true,
                // Only show if NetSuite ID exists (has been sent to NetSuite)
                // This would need custom condition logic in the controller
            ],
            'module' => 'netsuite',
        ],
    ],
];
