<?php 
if ( ! function_exists('aksi_button'))
{
    function aksi_button($name=[], $url=[], $modal=[])
    {
        $html = '
        <div class="btn-group">
            <button type="button" class="btn btn-info btn-sm">Aksi</button>
            <button type="button" class="btn btn-info btn-sm dropdown-toggle dropdown-icon" data-toggle="dropdown" aria-expanded="false">
                <span class="sr-only">Toggle Dropdown</span>
            </button>
            <div class="dropdown-menu" role="menu" style="">
        ';
        
        if(count($name) > 0){
            foreach($name as $key => $n){
                $mdl = '';
                if(count($modal) > 0){
                    $mdl = $modal[$key];
                }

                $url_label = base_url($url[$key]);
                if($url[$key] == '#') {
                    $url_label = '#';
                }

                $html .= '
                <a class="dropdown-item" '.$mdl.' href="'.$url_label.'">'.$n.'</a>
                ';
            }
        }

        $html .= '
        </div>
        ';

        return $html;
    }
}