<?php

namespace RxConnexionBundle\Service;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\ORM\EntityManager;
use Symfony\Component\HttpFoundation\RedirectResponse;

Class AuthService {

    private $em;
    private $container;

    public function __construct(EntityManager $em, ContainerInterface $container) {

        $this->em = $em;
        $this->container = $container;
    }

    // Original PHP code by Chirp Internet: www.chirp.com.au
    public function better_crypt($input, $rounds = 7)
    {
        $salt = "";
        $salt_chars = array_merge(range('A','Z'), range('a','z'), range(0,9));
        for($i=0; $i < 22; $i++) {
            $salt .= $salt_chars[array_rand($salt_chars)];
        }
        return crypt($input, sprintf('$2a$%02d$', $rounds) . $salt);
    }

    /**
     * Checks if the user is logged in or not
     */
    public function isLoggedIn($requestUri = true) {

        $session = $this->container->get('session');

        if($session->has('userData') && isset($_COOKIE['userId']) && '' !== $_COOKIE['userId'] && null !== $_COOKIE['userId']) {
            return true;
        } else {
            if($requestUri) {
                $req_uri = $_SERVER['REQUEST_URI'];
                if($req_uri !== $this->container->get('router')->generate('login') &&
                    $req_uri !== $this->container->get('router')->generate('logout') &&
                    strpos($req_uri, 'ajax') === false) $session->set('req_uri', $req_uri);
            }
            return false;
        }
    }

    /**
     * Checks if the general user is logged in or not
     */
    public function isLoggedInGeneralUser() {

        $session = $this->container->get('session');

        return $session->has('generalUserData');
    }

    /**
     * Checks if the user has the access
     */
    public function isUserHasAccesses($accessDescriptions, $hasErrorMsg=true, $matchCtr=false) {
        $session = $this->container->get('session');
        //$session->save(); // This will automatically call session_write_close() to prevent session lock timeout error
        $userData = $session->get('userData');
        if($userData['type'] === 'Super Admin') {
            return true;
        } else {
            if($matchCtr) {
                $accessCtr = 0;
                foreach($accessDescriptions as $accessDescription) if(in_array($accessDescription, $userData['accesses'])) $accessCtr++;
                $hasAccess = count($accessDescriptions) === $accessCtr;
                if(!$hasAccess) {
                    if($hasErrorMsg) {
                        $session->getFlashBag()->set('error_messages', "You don't have the right to access the page. Please contact the administrator.");
                    }
                    return false;
                } else {
                    return true;
                }
            } else {
                foreach($accessDescriptions as $accessDescription) if(in_array($accessDescription, $userData['accesses'])) return true;
                if($hasErrorMsg) $session->getFlashBag()->set('error_messages', "You don't have the right to access the page. Please contact the administrator.");
                return false;
            }
        }
    }

    /**
     * Checks if the user has the access on notetemplate
     */
    public function isUserHasAccessNoteTemplate($accessDescriptions, $hasErrorMsg=true, $matchCtr=false) {
        $session = $this->container->get('session');
        $userData = $session->get('userData');
        if($userData['type'] === 'Super Admin') {
            return true;
        } else {
            if($matchCtr) {
                $accessCtr = 0;
                foreach($accessDescriptions as $accessDescription) if(in_array($accessDescription, $userData['accesses'])) $accessCtr++;
                $hasAccess = count($accessDescriptions) === $accessCtr;
                if(!$hasAccess) {
                    return false;
                } else {
                    return true;
                }
            } else {
                foreach($accessDescriptions as $accessDescription) if(in_array($accessDescription, $userData['accesses'])) return true;
                return false;
            }
        }
    }

    /**
     * Redirects to login page
     */
    public function redirectToLogin() {

        $req_uri = $_SERVER['REQUEST_URI'];
        if($req_uri !== $this->container->get('router')->generate('login') &&
            $req_uri !== $this->container->get('router')->generate('logout') &&
            /*$req_uri !== $this->container->get('router')->generate('auth_forgot_password') &&*/
            strpos($req_uri, 'ajax') === false) {
            $url = $this->container->get('router')->generate('login', array('then' => $req_uri));
        } else {
            $url = $this->container->get('router')->generate('login');
        }

        return new RedirectResponse($url, 302);
    }

    /**
     * Redirects to home page
     */
    public function redirectToHome() {

        return new RedirectResponse($this->container->get('router')->generate('main'), 302);
    }

    /**
     * Get user
     */
    public function getUser() {

        $session = $this->container->get('session');
        //$session->save(); // This will automatically call session_write_close() to prevent session lock timeout error
        $userData = $session->get('userData');
        if($userData['userType'] != 'System'){
            return $accountUser = $this->em->getRepository('RxConnexionBundle:AccountUserEntity')->find($userData['id']);
        }else{
            return $this->em->getRepository('RxConnexionBundle:UserEntity')->find($userData['id']);
        }

    }

    /**
     * Get user types
     */
    public function getUserTypes() {

//        $accountUserType = $this->em->getRepository('RxConnexionBundle:AccountUserTypeEntity')->userTypeAccessList();
//
//        foreach ($accountUserType as $rows) {
//            return array (
//                $rows['description']
//            );
//        }
    }

    /**
     * Get user account Id
     */
    public function get_user_account_id() {
        $userData = $this->container->get('session')->get('userData');
        return $userData['accountId'];
    }

    public function getAccesses()
    {
        return array(
            array('label' => 'Admin', 'description' => 'Admin', 'children' => array(
                //Patient Access
                array('label' => 'Manage Patient', 'description' => 'Admin Patient', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Patient New'),
                    array('label' => 'Update', 'description' => 'Admin Patient Update'),
                    array('label' => 'Delete', 'description' => 'Admin Patient Delete'),
                    array('label' => 'Patient Details', 'description' => 'Admin Patient Detail', 'children' => array(
                        array('label' => 'Profile', 'description' => 'Admin Patient Detail Profile'),

                        //Patient Encounter
                        array('label' => 'Patient Encounter', 'description' => 'Admin Patient Detail Encounter', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Chart New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Chart Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Chart Delete', 'children' => array(
                                array('label' => 'Encounter Medical', 'description' => 'Admin Patient Chart Medical', 'children' => array(
                                    array('label' => 'Encounter Diagnosis', 'description' => 'Admin Patient Chart Medical Diagnosis', 'children' => array(
                                        array('label' => 'New', 'description' => 'Admin Patient Chart Medical Diagnosis New'),
                                        array('label' => 'Update', 'description' => 'Admin Patient Chart Medical Diagnosis Update'),
                                        array('label' => 'Delete', 'description' => 'Admin Patient Chart Medical Diagnosis Delete')
                                    )),
                                    array('label' => 'Encounter Medication', 'description' => 'Admin Patient Chart Medical Medication', 'children' => array(
                                        array('label' => 'New', 'description' => 'Admin Patient Chart Medical Medication New'),
                                        array('label' => 'Update', 'description' => 'Admin Patient Chart Medical Medication Update'),
                                        array('label' => 'Delete', 'description' => 'Admin Patient Chart Medical Medication Delete')
                                    )),
                                )),
                                array('label' => 'Encounter Insurance', 'description' => 'Admin Patient Insurance', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Patient Insurance New'),
                                    array('label' => 'Update', 'description' => 'Admin Patient Insurance Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Patient Insurance Delete')
                                )),
                                array('label' => 'Encounter File', 'description' => 'Admin Patient Chart File', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Patient Chart File New'),
                                    array('label' => 'Update', 'description' => 'Admin Patient Chart File Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Patient Chart File Delete')
                                )),
                                array('label' => 'Encounter Billing', 'description' => 'Admin Patient Chart Billing', 'children' => array(
                                    array('label' => 'Billing', 'description' => 'Admin Patient Chart Billing Procedure', 'children' => array(
                                        array('label' => 'New', 'description' => 'Admin Patient Chart Billing Procedure New'),
                                        array('label' => 'Update', 'description' => 'Admin Patient Chart Billing Procedure Update'),
                                        array('label' => 'Delete', 'description' => 'Admin Patient Chart Billing Procedure Delete'),
                                    )),
                                    array('label' => 'Other Billing', 'description' => 'Admin Patient Chart Billing Other', 'children' => array(
                                        array('label' => 'New', 'description' => 'Admin Patient Chart Billing Other Procedure New'),
                                        array('label' => 'Update', 'description' => 'Admin Patient Chart Billing Other Procedure Update'),
                                        array('label' => 'Delete', 'description' => 'Admin Patient Chart Billing Other Procedure Delete'),
                                    )),
                                )),
                                array('label' => 'Payment', 'description' => 'Admin Patient Chart Payment', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Patient Chart Payment New'),
                                    array('label' => 'Update', 'description' => 'Admin Patient Chart Payment Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Patient Chart Payment Delete'),
                                )),
                                array('label' => 'Encounter Note', 'description' => 'Admin Patient Chart Note', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Patient Chart Note New'),
                                    array('label' => 'Update', 'description' => 'Admin Patient Chart Note Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Patient Chart Note Delete')
                                )),
                            )),
                        )),

                        //Patient Appointment
                        array('label' => 'Patient Appointment', 'description' => 'Admin Patient Appointment', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Schedule New'),
                            array('label' => 'Appointment Notice', 'description' => 'Admin Appointment Notice'),
                            array('label' => 'Update', 'description' => 'Admin Patient Schedule Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Schedule Delete', 'children' => array(
                                array('label' => 'Fax', 'description' => 'Admin Appointment Fax Pdf'),
                                array('label' => 'Fax Preview', 'description' => 'Admin Appointment Notice Pdf Preview'),
                            )),
                        )),

                        //Patient Branch
                        array('label' => 'Patient Branch', 'description' => 'Admin Patient Health Facility', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Health Facility New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Health Facility Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Health Facility Delete')
                        )),

                        //Patient Affiliation
                        array('label' => 'Patient Affiliation', 'description' => 'Admin Patient Detail Affiliation', 'children' => array(
                            array('label' => 'Insurance', 'description' => 'Admin Patient Insurance', 'children' => array(
                                array('label' => 'New', 'description' => 'Admin Patient Insurance New'),
                                array('label' => 'Update', 'description' => 'Admin Patient Insurance Update'),
                                array('label' => 'Delete', 'description' => 'Admin Patient Insurance Delete')
                            )),
                            array('label' => 'Referring Affiliate', 'description' => 'Admin Patient Referring Health Facility', 'children' => array(
                                array('label' => 'New', 'description' => 'Admin Patient Referring Health Facility New'),
                                array('label' => 'Update', 'description' => 'Admin Patient Referring Health Facility Update'),
                                array('label' => 'Delete', 'description' => 'Admin Patient Referring Health Facility Delete')
                            )),
                            array('label' => 'Referring Physician', 'description' => 'Admin Patient Referring Provider', 'children' => array(
                                array('label' => 'New', 'description' => 'Admin Patient Referring Provider New'),
                                array('label' => 'Update', 'description' => 'Admin Patient Referring Provider Update'),
                                array('label' => 'Delete', 'description' => 'Admin Patient Referring Provider Delete')
                            )),
                            array('label' => 'Specialist', 'description' => 'Admin Patient Specialist', 'children' => array(
                                array('label' => 'New', 'description' => 'Admin Patient Specialist New'),
                                array('label' => 'Update', 'description' => 'Admin Patient Specialist Update'),
                                array('label' => 'Delete', 'description' => 'Admin Patient Specialist Delete')
                            )),
                        )),

                        //Patient File
                        array('label' => 'Patient File', 'description' => 'Admin Patient Detail File', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient File New'),
                            array('label' => 'Update', 'description' => 'Admin Patient File Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient File Delete'),
                        )),

                        //Patient File From Import
                        array('label' => 'Patient File From Import', 'description' => 'Admin Patient Detail File From Import'),

                        //Patient Letters
                        array('label' => 'Patient Letter', 'description' => 'Admin Patient Detail Letter', 'children' => array(
                            array('label' => 'Preview', 'description' => 'Admin Patient Letter Preview'),
                            array('label' => 'Export to PDF', 'description' => 'Admin Patient Letter Pdf'),
                            array('label' => 'Approved', 'description' => 'Admin Patient Letter Approved'),
                            array('label' => 'Fax', 'description' => 'Admin Patient Letter Update'),
                            array('label' => 'New', 'description' => 'Admin Patient Letter New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Letter Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Letter Delete'),
                            array('label' => 'Note', 'description' => 'Admin Patient Letter Note')
                        )),

                        //Patient Email
                        array('label' => 'Patient Email', 'description' => 'Admin Patient Email', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Email New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Email Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Email Delete'),
                            array('label' => 'Send', 'description' => 'Admin Patient Email Send')
                        )),

                        //Patient Billing and Payment
                        array('label' => 'Patient Billing', 'description' => 'Admin Patient Billing', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Billing New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Billing Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Billing Delete'),
                            array('label' => 'Void', 'description' => 'Admin Patient Billing Void'),
                            array('label' => 'Return', 'description' => 'Admin Patient Billing Return'),
                            array('label' => 'Refund', 'description' => 'Admin Patient Refund', 'children' => array(
                                array('label' => 'New', 'description' => 'Admin Patient Billing Refund New'),
                                array('label' => 'Update', 'description' => 'Admin Patient Billing Refund Update'),
                                array('label' => 'Delete', 'description' => 'Admin Patient Billing Refund Delete'),
                            )),
                            array('label' => 'Preview Invoice', 'description' => 'Admin Patient Billing Invoice Preview'),
                            array('label' => 'Print Invoice', 'description' => 'Admin Patient Billing Invoice Print'),
                            array('label' => 'Insurance Package', 'description' => 'Admin Patient Billing Upload'),
                            array('label' => 'Inventory Sold Value', 'description' => 'Admin Patient Billing Inventory Sold Value'),
                            array('label' => 'Add Button', 'description' => 'Admin Patient Billing Inventory Add Button'),
                        )),
                        array('label' => 'Patient Payment', 'description' => 'Admin Patient Payment', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Payment New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Payment Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Payment Delete'),
                            array('label' => 'Void', 'description' => 'Admin Patient Payment Void'),
                            array('label' => 'Post', 'description' => 'Admin Patient Payment Post'),
                            array('label' => 'Preview Receipt', 'description' => 'Admin Patient Payment Receipt Preview'),
                            array('label' => 'Print Receipt', 'description' => 'Admin Patient Payment Receipt Print'),
                        )),

                        //Patient Rental
                        array('label' => 'Patient Rental', 'description' => 'Admin Patient Rental', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Rental New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Rental Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Rental Delete'),
                        )),

                        //Patient Ticket
                        array('label' => 'Patient Ticket', 'description' => 'Admin Patient Ticket', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Ticket New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Ticket Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Ticket Delete'),
                        )),

                        //Patient Reminder
                        array('label' => 'Patient Reminder', 'description' => 'Admin Patient Reminder', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Reminder New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Reminder Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Reminder Delete'),
                        )),

                        //Patient History
                        array('label' => 'Patient Audit Trail', 'description' => 'Admin Patient History'),

                        //Patient Notes
                        array('label' => 'Patient Note', 'description' => 'Admin Patient Detail Note', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Note New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Note Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Note Delete', 'children' => array(
                                array('label' => 'Clinical Tab', 'description' => 'Admin Patient Clinical Note'),
                                array('label' => 'Billing Tab', 'description' => 'Admin Patient Billing Note'),
                                array('label' => 'Appointment Tab', 'description' => 'Admin Patient Appointment Note'),
                                array('label' => 'Specialist Tab', 'description' => 'Admin Patient Specialist Note'),
                                array('label' => 'All Tab', 'description' => 'Admin Patient All Note'),
                            )),
                        )),
                    )),

                    //Patient Medical
                    array('label' => 'Patient Medical', 'description' => 'Admin Patient Detail Medical', 'children' => array(
                        array('label' => 'Diagnosis', 'description' => 'Admin Patient Medical Diagnosis', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Medical Diagnosis New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Medical Diagnosis Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Medical Diagnosis Delete'),
                        )),
                        array('label' => 'Treatment Consideration', 'description' => 'Admin Patient Treatment Consideration', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Treatment Consideration New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Treatment Consideration Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Treatment Consideration Delete'),
                        )),
                        array('label' => 'Treatment Plan', 'description' => 'Admin Patient Treatment Plan', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Treatment Plan New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Treatment Plan Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Treatment Plan Delete'),
                        )),
                        array('label' => 'Medication', 'description' => 'Admin Patient Medical Medication', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Patient Detail Medical Medication New'),
                            array('label' => 'Update', 'description' => 'Admin Patient Detail Medical Medication Update'),
                            array('label' => 'Delete', 'description' => 'Admin Patient Detail Medical Medication Delete'),
                        )),
                    )),

                    //Patient Red Flag
                    array('label' => 'Patient Red Flag', 'description' => 'Admin Patient Red Flag', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Patient Red Flag New'),
                        array('label' => 'Update', 'description' => 'Admin Patient Red Flag Update'),
                        array('label' => 'Delete', 'description' => 'Admin Patient Red Flag Delete'),
                    )),

                    //Patient Services
                    array('label' => 'Patient Services', 'description' => 'Admin Patient Services', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Patient Services New'),
                        array('label' => 'Update', 'description' => 'Admin Patient Services Update'),
                        array('label' => 'Delete', 'description' => 'Admin Patient Services Delete'),
                    )),

                    //Patient Services
                    array('label' => 'Files (Imported)', 'description' => 'Admin Clinicmaster File'),


                    array('label' => 'Encounter Transfer', 'description' => 'Admin Patient Chart Transfer'),
                    array('label' => 'File Transfer', 'description' => 'Admin Patient File Transfer'),
                    array('label' => 'Letter Transfer', 'description' => 'Admin Patient Letter Transfer'),
                    array('label' => 'Billing Transfer', 'description' => 'Admin Patient Billing Transfer'),
                    array('label' => 'Red Flag Transfer', 'description' => 'Admin Patient Red Flag Transfer'),
                    array('label' => 'Endorsement Transfer', 'description' => 'Admin Patient Endorsement Transfer'),
                    array('label' => 'Reminder Transfer', 'description' => 'Admin Patient Reminder Transfer'),
                    array('label' => 'Notes Transfer', 'description' => 'Admin Patient Note Transfer'),

                    array('label' => 'Purchased Items', 'description' => 'Admin Patient Purchased Items', 'children' => [
	                    array('label' => 'Return', 'description' => 'Admin Patient Purchased Items Return'),

                    ]),
                )),

                //Clinician Menu
                array('label' => 'Manage Clinician', 'description' => 'Admin Provider', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Provider New'),
                    array('label' => 'Update', 'description' => 'Admin Provider Update'),
                    array('label' => 'Delete', 'description' => 'Admin Provider Delete'),
                    array('label' => 'Clinician Details', 'description' => 'Admin Provider Health Facility', 'children' => array(
                        array('label' => 'Branch', 'description' => 'Admin Provider Detail', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Provider Health Facility New'),
                            array('label' => 'Update', 'description' => 'Admin Provider Health Facility Update'),
                            array('label' => 'Delete', 'description' => 'Admin Provider Health Facility Delete')
                        )),
                        array('label' => 'Work Schedule', 'description' => 'Admin Provider Work Schedule', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Physician Work Schedule New'),
                            array('label' => 'Update', 'description' => 'Admin Physician Work Schedule Update'),
                            array('label' => 'Delete', 'description' => 'Admin Physician Work Schedule Delete'),
                            array('label' => 'History', 'description' => 'Admin Provider Work Schedule History'),
                        )),
                    )),
                )),

                //Appointment Menu
                array('label' => 'Manage Appointment', 'description' => 'Admin Calendar', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Schedule New'),
                    array('label' => 'Update', 'description' => 'Admin Schedule Update'),
                    array('label' => 'Delete', 'description' => 'Admin Schedule Delete'),
                    array('label' => 'Week', 'description' => 'Admin Calendar Week'),
                )),


                //Marketing Staff Appointment Menu
                array('label' => 'Manage Marketing Appointment', 'description' => 'Admin Marketing Staff Calendar', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Marketing Staff Schedule New'),
                    array('label' => 'Update', 'description' => 'Admin Marketing Staff Schedule Update'),
                    array('label' => 'Delete', 'description' => 'Admin Marketing Staff Schedule Delete'),
                )),


                //Referral Menu
                array('label' => 'Manage Referral', 'description' => 'Admin Referral', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Referral New'),
                    array('label' => 'Update', 'description' => 'Admin Referral Update'),
                    array('label' => 'Delete', 'description' => 'Admin Referral Delete'),
                )),

                //Ticket Menu
                array('label' => 'Manage Ticket', 'description' => 'Admin Ticket', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Ticket New'),
                    array('label' => 'Update', 'description' => 'Admin Ticket Update'),
                    array('label' => 'Delete', 'description' => 'Admin Ticket Delete'),
                )),

                //Letter Menu
                array('label' => 'Manage Ticket', 'description' => 'Admin Letter', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Letter New'),
                    array('label' => 'Update', 'description' => 'Admin Letter Update'),
                    array('label' => 'Delete', 'description' => 'Admin Letter Delete'),
                )),

                //Portal Menu
                array('label' => 'Manage Portal', 'description' => 'Admin Portal', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Portal New'),
                    array('label' => 'Update', 'description' => 'Admin Portal Update'),
                    array('label' => 'Delete', 'description' => 'Admin Portal Delete'),
                )),

                //Faxing Option Menu
                array('label' => 'Manage Faxing Option', 'description' => 'Admin Faxing Option'),

                //Fax Outbound
                array('label' => 'Manage Fax Outbound', 'description' => 'Admin Faxing Option'),

                //Faxing Option Outbound
                array('label' => 'Manage Faxing Option Outbound', 'description' => 'Admin Faxing Option Outbound'),
                //Fax Menu
                array('label' => 'Fax', 'description' => 'Admin Fax', 'children' => array(
                    array('label' => 'Send Fax', 'description' => 'Admin Send Fax'),
                    array('label' => 'Fax Details', 'description' => 'Admin Fax Update'),
                )),

                array('label' => 'Manage Fax Unite', 'description' => 'Admin Unite Fax'),

                //Fax Menu
                array('label' => 'Map', 'description' => 'Admin Map'),
                array('label' => 'User', 'description' => 'Admin Account User', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Account User New'),
                    array('label' => 'Update', 'description' => 'Admin Account User Update'),
                    array('label' => 'Delete', 'description' => 'Admin Account User Delete'),
                    array('label' => 'Details', 'description' => 'Admin Account User Detail', 'children' => array(
                        array('label' => 'Account User Company', 'description' => 'Admin Account User Company', 'children' => array(
                            array('label' => 'Add Company', 'description' => 'Admin Account User Company New'),
                            array('label' => 'Update Company', 'description' => 'Admin Account User Company Update'),
                            array('label' => 'Delete Company', 'description' => 'Admin Account User Company Delete'),
                        )),
                        array('label' => 'Account User Branch', 'description' => 'Admin Account User Health Facility', 'children' => array(
                            array('label' => 'Add Branch', 'description' => 'Admin Account User Health Facility'),
                            array('label' => 'Update Branch', 'description' => 'Admin Account User Health Facility Update'),
                            array('label' => 'Delete Branch', 'description' => 'Admin Account User Health Facility Delete'),
                        )),
                    )),
                    array('label' => 'Account User Reminder', 'description' => 'Admin Account User Reminder', 'children' => array(
                        array('label' => 'Add Reminder', 'description' => 'Admin Account User Reminder New'),
                        array('label' => 'Update Reminder', 'description' => 'Admin Account User Reminder Update'),
                        array('label' => 'Delete Reminder', 'description' => 'Admin Account User Reminder Delete'),
                    )),
                )),
                array('label' => 'Specialist', 'description' => 'Admin Specialist', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Specialist New'),
                    array('label' => 'Update', 'description' => 'Admin Specialist Update'),
                    array('label' => 'Delete', 'description' => 'Admin Specialist Delete'),
                )),
                array('label' => 'Sales Agent', 'description' => 'Admin Sales Agent', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Sales Agent New'),
                    array('label' => 'Update', 'description' => 'Admin Sales Agent Update'),
                    array('label' => 'Delete', 'description' => 'Admin Sales Agent Delete'),
                    array('label' => 'Details', 'description' => 'Admin Sales Agent Detail', 'children' => array(
                        array('label' => 'Add Affiliate', 'description' => 'Admin Sales Agent New Referring Health Facility'),
                        array('label' => 'Update Affiliate', 'description' => 'Admin Sales Agent Referring Health Facility Update'),
                        array('label' => 'Delete Affiliate', 'description' => 'Admin Sales Agent Referring Health Facility Delete'),
                    )),
                )),
                array('label' => 'Account Staff', 'description' => 'Admin Account Staff', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Account Staff New'),
                    array('label' => 'Update', 'description' => 'Admin Account Staff Update'),
                    array('label' => 'Delete', 'description' => 'Admin Account Staff Delete'),
//                    array('label' => 'Details', 'description' => 'Admin Account Staff Detail'),
                )),
                array('label' => 'Chat', 'description' => 'Admin Chat', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Chat New'),
                    array('label' => 'Update', 'description' => 'Admin Chat Update'),
                    array('label' => 'Delete', 'description' => 'Admin Chat Delete'),
                    array('label' => 'Send', 'description' => 'Admin Chat Send Message'),
                )),

                //REPORTS
                array('label' => 'Access Reports', 'description' => 'Admin Report'),
                array('label' => 'Access Productivity Report', 'description' => 'Admin Report Productivity', 'children' => array(
                    array('label' => 'Productivity Report (Clinical)', 'description' => 'Admin Report Productivity Clinical', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Productivity Clinical Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Productivity Clinical Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Productivity Clinical Excel'),
                    )),
                    array('label' => 'Productivity Report (Billing)', 'description' => 'Admin Report Productivity Billing', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Productivity Billing Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Productivity Billing Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Productivity Billing Excel'),
                    )),
                )),
                array('label' => 'Access Billing Report', 'description' => 'Admin Report Billing', 'children' => array(
                    array('label' => 'Invoice', 'description' => 'Admin Report Invoice', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Invoice Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Invoice Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Invoice Excel'),
                        array('label' => 'Cost/Net', 'description' => 'Admin Report Invoice Cost Net'),
                    )),
                    array('label' => 'Invoice Itemised', 'description' => 'Admin Report Invoice Itemised', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Invoice Itemised Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Invoice Itemised Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Invoice Itemised Excel'),
                        array('label' => 'Cost/Net', 'description' => 'Admin Report Invoice Itemised Cost Net'),
                    )),
                    array('label' => 'Report Rent to Own and Long Term Rental', 'description' => 'Admin Report Rent to Own and Long Term Rental', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Rent to Own and Long Term Rental Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Rent to Own and Long Term Rental Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Rent to Own and Long Term Rental Excel'),
                    )),
                    array('label' => 'Accounts Receivable', 'description' => 'Admin Report Accounts Receivable', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Accounts Receivable Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Accounts Receivable Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Accounts Receivable Excel'),
                    )),
                    array('label' => 'AR Summary', 'description' => 'Admin Report AR Summary', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report AR Summary Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report AR Summary Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report AR Summary Excel'),
                    )),
                    array('label' => 'Payment', 'description' => 'Admin Report Payment', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Payment Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Payment Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Payment Excel'),
                    )),
                    array('label' => 'Payment Without Invoice', 'description' => 'Admin Report Payment Without Invoice', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Payment Without Invoice Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Payment Without Invoice Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Payment Without Invoice Excel'),
                    )),
                )),
                array('label' => 'Access Productivity(CBT) Report', 'description' => 'Admin Report Productivity(CBT)', 'children' => array(
                    array('label' => 'Patient With Different Branches', 'description' => 'Admin Report Patient With Different Branches', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Patient With Different Branches Preview'),
//                        array('label' => 'Export to PDF', 'description' => 'Admin Report Fax Summary Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Patient With Different Branches Excel'),
                    )),
                    array('label' => 'Patient With Different Branches (Invoice)', 'description' => 'Admin Report Patient With Different Branches Invoice', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Patient With Different Branches Invoice Preview'),
//                        array('label' => 'Export to PDF', 'description' => 'Admin Report Fax Summary Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Patient With Different Branches Invoice Excel'),
                    )),
                    array('label' => 'Fax Summary', 'description' => 'Admin Report Fax Summary', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Fax Summary Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Fax Summary Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Fax Summary Excel'),
                    )),
                    array('label' => 'Access Report Productivity CBT Scheduling', 'description' => 'Admin Report Productivity CBT Scheduling', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Productivity CBT Scheduling Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Productivity CBT Scheduling Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Productivity CBT Scheduling Excel'),
                    )),
                    array('label' => 'Access Report Productivity CBT Encounter', 'description' => 'Admin Report Productivity CBT Encounter', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report Productivity CBT Encounter Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report Productivity CBT Encounter Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report Productivity CBT Encounter Excel'),
                    )),
                    array('label' => 'Key Performance Indicator', 'description' => 'Admin Report KPI', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report KPI Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report KPI Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report KPI Excel'),
                    )),
                    array('label' => 'Access Report CBT Tracker', 'description' => 'Admin Report CBT Tracker', 'children' => array(
                        array('label' => 'Preview', 'description' => 'Admin Report CBT Tracker Preview'),
                        array('label' => 'Export to PDF', 'description' => 'Admin Report CBT Tracker Pdf'),
                        array('label' => 'Export to Excel', 'description' => 'Admin Report CBT Tracker Excel'),
                    )),
                )),
                array('label' => 'Patient Cycle', 'description' => 'Admin Report Patient Cycle', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Patient Cycle Preview'),
//                        array('label' => 'Export to PDF', 'description' => 'Admin Report Fax Summary Pdf'),
//                        array('label' => 'Export to Excel', 'description' => 'Admin Report Fax Summary Excel'),
                )),
                array('label' => 'Access Marketing Report', 'description' => 'Admin Report Marketing', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Marketing Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Marketing Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Marketing Excel'),
                )),
                array('label' => 'Access Marketing Referral Report', 'description' => 'Admin Report Referral Marketing', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Referral Marketing Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Referral Marketing Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Referral Marketing Excel'),
                )),
                array('label' => 'Access Specialist Tracker Report', 'description' => 'Admin Report Specialist Referral Tracker', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Specialist Referral Tracker Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Specialist Referral Tracker Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Specialist Referral Tracker Excel'),
                )),
                array('label' => 'Access Letter Tracker Report', 'description' => 'Admin Report Letter Tracker', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Letter Tracker Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Letter Tracker Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Letter Tracker Excel'),
                )),
                array('label' => 'Access Letter Report', 'description' => 'Admin Report Letter', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Letter Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Letter Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Letter Excel'),
                )),
                array('label' => 'Access Affiliation Report', 'description' => 'Admin Report Affiliation', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Affiliation Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Affiliation Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Affiliation Excel'),
                )),
                array('label' => 'Access Patient Referring Affiliate Report', 'description' => 'Admin Report Patient Referring Provider', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Patient Referring Provider Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Patient Referring Provider Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Patient Referring Provider Excel'),
                )),
                array('label' => 'Access Appointment History Report', 'description' => 'Admin Report Appointment History', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Appointment History Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Appointment History Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Appointment History Excel'),
                )),
                array('label' => 'Access Patient Progress Report', 'description' => 'Admin Report Patient Progress', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Patient Progress Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Patient Progress Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Patient Progress Excel'),
                )),
                array('label' => 'Access Appointment Report', 'description' => 'Admin Report Appointment', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Appointment Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Appointment Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Appointment Excel'),
                )),
                array('label' => 'Access Conversion', 'description' => 'Admin Report Conversion', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Conversion Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Conversion Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Conversion Excel'),
                )),
                array('label' => 'Access Diagnosis Report', 'description' => 'Admin Report Diagnosis', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Diagnosis Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Diagnosis Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Diagnosis Excel'),
                )),
                array('label' => 'Access Fax Report', 'description' => 'Admin Report Fax', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Fax Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Fax Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Fax Excel'),
                )),
                array('label' => 'Access File Report', 'description' => 'Admin Report File', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report File Preview'),
//                    array('label' => 'Export to PDF', 'description' => 'Admin Report File Pdf'),
//                    array('label' => 'Export to Excel', 'description' => 'Admin Report File Excel'),
                )),
                array('label' => 'Access Fax Outbound', 'description' => 'Admin Report Fax Outbound', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Fax Outbound Preview'),
//                    array('label' => 'Export to PDF', 'description' => 'Admin Report Fax Pdf'),
//                    array('label' => 'Export to Excel', 'description' => 'Admin Report Fax Excel'),
                )),
                array('label' => 'Access Encounter Report', 'description' => 'Admin Report Encounter', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Encounter Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Encounter Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Encounter Excel'),
                )),
                array('label' => 'Access Insurance Report', 'description' => 'Admin Report Insurance', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Insurance Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Insurance Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Insurance Excel'),
                )),
                array('label' => 'Access Insurance Coverage Report', 'description' => 'Admin Report Insurance Coverage', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Insurance Coverage Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Insurance Coverage Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Insurance Coverage Excel'),
                )),
                array('label' => 'Access Medication Report', 'description' => 'Admin Report Medication', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Medication Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Medication Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Medication Excel'),
                )),
                array('label' => 'Access Patient Report', 'description' => 'Admin Report Patient', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Patient Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Patient Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Patient Excel'),
                    array('label' => 'Patient Transfer (Patient Report)', 'description' => 'Admin Report Transfer'),
                )),
                array('label' => 'Access Referred By Tracking Report', 'description' => 'Admin Report Referred By Tracking', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Referred By Tracking Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Referred By Tracking Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Referred By Tracking Excel'),
                )),
                array('label' => 'Access Patient Data Transfer', 'description' => 'Admin Report Patient Data Transfer', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Patient Data Transfer Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Patient Data Transfer Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Patient Data Transfer Excel'),
                )),
                array('label' => 'Access Patient Billing File', 'description' => 'Admin Report Patient Billing File', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Patient Billing File Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Patient Billing File Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Patient Billing File Excel'),
                )),
                array('label' => 'Access Login Tracker Report', 'description' => 'Admin Report Login Tracker', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Login Tracker Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Login Tracker Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Login Tracker Excel'),
                )),
                array('label' => 'Access Referral Report', 'description' => 'Admin Report Referral', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Referral Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Referral Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Referral Excel'),
                )),
                array('label' => 'Access Sales Report', 'description' => 'Admin Report Sales', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Sales Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Sales Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Sales Excel'),
                )),
                array('label' => 'Access Booked Encounter Report', 'description' => 'Admin Report Booked Encounter', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Booked Encounter Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Booked Encounter Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Booked Encounter Excel'),
                )),
                array('label' => 'Access User Endorsed Report', 'description' => 'Admin Report User Endorsed', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report User Endorsed Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report User Endorsed Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report User Endorsed Excel'),
                )),
                array('label' => 'Access Status Rebooking Report', 'description' => 'Admin Report Status Rebooking', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Status Rebooking Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Status Rebooking Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Status Rebooking Excel'),
                )),
                array('label' => 'Access Reminder Report', 'description' => 'Admin Report Reminder', 'children' => array(
                    array('label' => 'Preview', 'description' => 'Admin Report Reminder Preview'),
                    array('label' => 'Export to PDF', 'description' => 'Admin Report Reminder Pdf'),
                    array('label' => 'Export to Excel', 'description' => 'Admin Report Reminder Excel'),
                )),
                array('label' => 'Access Status Report', 'description' => 'Admin Report Status'),
	            array('label' => 'Inventory Report', 'description' => 'Admin Report Inventory', 'children' => array(
		            array('label' => 'Item List', 'description' => 'Admin Report Inventory Item List', 'children' => array(
			            array('label' => 'Preview', 'description' => 'Admin Report Inventory Item List Preview'),
			            array('label' => 'Export to PDF', 'description' => 'Admin Report Inventory Item List PDF'),
			            array('label' => 'Export to Excel', 'description' => 'Admin Report Inventory Item List Excel'),
		            )),
		            array('label' => 'Serial Code', 'description' => 'Admin Report Inventory Serial Code', 'children' => array(
			            array('label' => 'Preview', 'description' => 'Admin Report Inventory Serial Code Preview'),
			            array('label' => 'Export to PDF', 'description' => 'Admin Report Inventory Serial Code Pdf'),
			            array('label' => 'Export to Excel', 'description' => 'Admin Report Inventory Serial Code Excel'),
		            )),
		            array('label' => 'Transfer', 'description' => 'Admin Report Inventory Transfer', 'children' => array(
			            array('label' => 'Preview', 'description' => 'Admin Report Inventory Transfer Preview'),
			            array('label' => 'Export to PDF', 'description' => 'Admin Report Inventory Transfer Pdf'),
			            array('label' => 'Export to Excel', 'description' => 'Admin Report Inventory Transfer Excel'),
		            )),
		            array('label' => 'Items Sold', 'description' => 'Admin Report Inventory Items Sold', 'children' => array(
			            array('label' => 'Preview', 'description' => 'Admin Report Inventory Items Sold Preview'),
			            array('label' => 'Export to PDF', 'description' => 'Admin Report Inventory Items Sold Pdf'),
			            array('label' => 'Export to Excel', 'description' => 'Admin Report Inventory Items Sold Excel'),
		            )),
	            )),

                //Dashboards
                array('label' => 'My Task Dashboard', 'description' => 'Admin Dashboard My Task'),
                array('label' => 'Endorsed Dashboard', 'description' => 'Admin Dashboard Endorsed'),
                array('label' => 'View New Fax Dashboard', 'description' => 'Admin Dashboard New Fax'),
                array('label' => 'View New Unite Fax Dashboard', 'description' => 'Admin Dashboard New Unite Fax'),
                array('label' => 'View Letters Dashboard', 'description' => 'Admin Dashboard Letters'),
                array('label' => 'View Fax w/o Encounter Dashboard', 'description' => 'Admin Dashboard Patient With Fax No Encounter', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Fax No Encounter Excel'),
                )),
                array('label' => 'View Referral w/o Encounter Dashboard', 'description' => 'Admin Dashboard Patient With Referral No Encounter', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Patient With Referral No Encounter Excel'),
                )),
                array('label' => 'View Patient w/o Encounter Dashboard', 'description' => 'Admin Dashboard Patient Initial Encounter', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Initial Encounter Excel'),
                )),
                array('label' => 'View Appointment Notice Dashboard', 'description' => 'Admin Dashboard Appointment Notice', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Appointment Notice Excel'),
                )),
                array('label' => 'View Encounter Call Dashboard', 'description' => 'Admin Dashboard Patient Encounter Call'),
                array('label' => 'View For Rebooking Dashboard', 'description' => 'Admin Dashboard Patient For Rebooking', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Patient For Rebooking Excel'),
                )),
                array('label' => 'View 72 Hour Follow-up Dashboard', 'description' => 'Admin Dashboard Patient 72 Hours Follow Up', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Patient 72 Month Follow Up Excel'),
                )),
                array('label' => 'View 3 Month Follow-up Dashboard', 'description' => 'Admin Dashboard Patient 3 Month Follow Up', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Patient 3 Month Follow Up Excel'),
                )),
                array('label' => 'View 6 Month Follow-up Dashboard', 'description' => 'Admin Dashboard Patient 6 Month Follow Up', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Patient 6 Month Follow Up Excel'),
                )),
                array('label' => 'View PFT Dashboard', 'description' => 'Admin Dashboard Patient Pft'),
                array('label' => 'View Referral With Specialist Service Dashboard', 'description' => 'Admin Dashboard Referral With Specialist Service', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Referral With Specialist Service Excel'),
                )),
                array('label' => 'View Referral With Other Service Dashboard', 'description' => 'Admin Dashboard Referral With Other Service', 'children' => array(
                    array('label' => 'Export to Excel', 'description' => 'Admin Dashboard Referral With Other Service Excel'),
                )),
                array('label' => 'View Accounts Receivable Dashboard', 'description' => 'Admin Dashboard Accounts Receivable'),
                array('label' => 'View Pending Purchase Order Dashboard', 'description' => 'Admin Dashboard Pending Purchase Order'),
                array('label' => 'View Payables Dashboard', 'description' => 'Admin Dashboard Payables'),
                array('label' => 'Management Dashboard', 'description' => 'Admin Management Dashboard'),
                array('label' => 'Clinician Dashboard', 'description' => 'Admin Clinician Dashboard'),

                //Insurance Menu
                array('label' => 'Manage Insurance', 'description' => 'Admin Insurance', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Insurance New'),
                    array('label' => 'Update', 'description' => 'Admin Insurance Update'),
                    array('label' => 'Delete', 'description' => 'Admin Insurance Delete'),
                )),

                //User Menu
                array('label' => 'User', 'description' => 'Admin Account User', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Account User New'),
                    array('label' => 'Update', 'description' => 'Admin Account User Update'),
                    array('label' => 'Delete', 'description' => 'Admin Account User Delete'),
                    array('label' => 'Details', 'description' => 'Admin Account User Detail', 'children' => array(
                        array('label' => 'Account User Company', 'description' => 'Admin Account User Company', 'children' => array(
                            array('label' => 'Add Company', 'description' => 'Admin Account User Company New'),
                            array('label' => 'Update Company', 'description' => 'Admin Account User Company Update'),
                            array('label' => 'Delete Company', 'description' => 'Admin Account User Company Delete'),
                        )),
                        array('label' => 'Account User Branch', 'description' => 'Admin Account User Health Facility', 'children' => array(
                            array('label' => 'Add Branch', 'description' => 'Admin Account User Health Facility'),
                            array('label' => 'Update Branch', 'description' => 'Admin Account User Health Facility Update'),
                            array('label' => 'Delete Branch', 'description' => 'Admin Account User Health Facility Delete'),
                        )),
                    )),
                )),

                //Specialist Menu
                array('label' => 'Specialist', 'description' => 'Admin Specialist', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Specialist New'),
                    array('label' => 'Update', 'description' => 'Admin Specialist Update'),
                    array('label' => 'Delete', 'description' => 'Admin Specialist Delete'),
                )),

                //Referring Physician Menu
                array('label' => 'Referring Physician', 'description' => 'Admin Referring Provider', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Referring Provider New'),
                    array('label' => 'Update', 'description' => 'Admin Referring Provider Update'),
                    array('label' => 'Delete', 'description' => 'Admin Referring Provider Delete'),
                    array('label' => 'Detail', 'description' => 'Admin Referring Provider Detail', 'children' => [
                    	array('label' => 'Chart', 'description' => 'Admin Referring Provider Chart', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Provider Chart New'),
							array('label' => 'Update', 'description' => 'Admin Referring Provider Chart Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Provider Chart Delete'),
							array('label' => 'Note', 'description' => 'Admin Referring Provider Chart Note', 'children' => [
								array('label' => 'New', 'description' => 'Admin Referring Provider Chart Note New'),
								array('label' => 'Update', 'description' => 'Admin Referring Provider Chart Note Update'),
								array('label' => 'Delete', 'description' => 'Admin Referring Provider Chart Note Delete'),
							]),
						]),
                    	array('label' => 'Schedule', 'description' => 'Admin Referring Provider Schedule', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Provider Schedule New'),
							array('label' => 'Update', 'description' => 'Admin Referring Provider Schedule Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Provider Schedule Delete'),
						]),
                    	array('label' => 'File', 'description' => 'Admin Referring Provider File', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Provider File New'),
							array('label' => 'Update', 'description' => 'Admin Referring Provider File Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Provider File Delete'),
						]),
                    	array('label' => 'Note', 'description' => 'Admin Referring Provider Note', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Provider Note New'),
							array('label' => 'Update', 'description' => 'Admin Referring Provider Note Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Provider Note Delete'),
						]),
                    	array('label' => 'Referring Health Facilities', 'description' => 'Admin Referring Provider Referring Health Facilities', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Provider Referring Health Facility New'),
							array('label' => 'Update', 'description' => 'Admin Referring Provider Referring Health Facility Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Provider Referring Health Facility Delete'),
						]),
					]),
                )),

                //Referring Affiliate Menu
				
                array('label' => 'Referring Affiliate', 'description' => 'Admin Referring Health Facility', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Referring Health Facility New'),
                    array('label' => 'Update', 'description' => 'Admin Referring Health Facility Update'),
                    array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Delete'),
					array('label' => 'Details', 'description' => 'Admin Referring Health Facility Detail', 'children' => array(
						array('label' => 'Referring Affiliate Tab', 'description' => 'Admin Referring Health Facility Detail Referring Health Facility'),
						array('label' => 'Provider', 'description' => 'Admin Referring Health Facility Provider', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Health Facility Provider New'),
							array('label' => 'Update', 'description' => 'Admin Referring Health Facility Provider Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Provider Delete'),
						]),
						array('label' => 'Sales Agent', 'description' => 'Admin Referring Health Facility Sales Agent', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Health Facility Sales Agent New'),
							array('label' => 'Update', 'description' => 'Admin Referring Health Facility Sales Agent Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Sales Agent Delete'),
						]),
						array('label' => 'Chart', 'description' => 'Admin Referring Health Facility Chart', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Health Facility Chart New'),
							array('label' => 'Update', 'description' => 'Admin Referring Health Facility Chart Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Chart Delete'),
							array('label' => 'Note', 'description' => 'Admin Referring Health Facility Chart Note', 'children' => [
								array('label' => 'New', 'description' => 'Admin Referring Health Facility Chart Note New'),
								array('label' => 'Update', 'description' => 'Admin Referring Health Facility Chart Note Update'),
								array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Chart Note Delete'),
							]),
						]),
						array('label' => 'File', 'description' => 'Admin Referring Health Facility File', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Health Facility File New'),
							array('label' => 'Update', 'description' => 'Admin Referring Health Facility File Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Health Facility File Delete'),
						]),
						array('label' => 'Schedule', 'description' => 'Admin Referring Health Facility Schedule', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Health Facility Schedule New'),
							array('label' => 'Update', 'description' => 'Admin Referring Health Facility Schedule Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Schedule Delete'),
						]),
						array('label' => 'Note', 'description' => 'Admin Referring Health Facility Note', 'children' => [
							array('label' => 'New', 'description' => 'Admin Referring Health Facility Note New'),
							array('label' => 'Update', 'description' => 'Admin Referring Health Facility Note Update'),
							array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Note Delete'),
						]),
					)),
                )),

                //Inventory Menu
                array('label' => 'Inventory Menu', 'description' => 'Admin Inventory Menu', 'children' => array(
	                array('label' => 'Supplier', 'description' => 'Admin Supplier', 'children' => array(
		                array('label' => 'New', 'description' => 'Admin Supplier New'),
		                array('label' => 'Update', 'description' => 'Admin Supplier Update'),
		                array('label' => 'Delete', 'description' => 'Admin Supplier Delete'),
	                )),
                    array('label' => 'Inventory', 'description' => 'Admin Inventory', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Inventory New'),
                        array('label' => 'Update', 'description' => 'Admin Inventory Update'),
                        array('label' => 'Delete', 'description' => 'Admin Inventory Delete'),
                        array('label' => 'History', 'description' => 'Admin Inventory History'),
                    )),
                    array('label' => 'Add Inventory', 'description' => 'Admin Add Inventory', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Add Inventory New'),
                        array('label' => 'Update', 'description' => 'Admin Add Inventory Update'),
                        array('label' => 'Delete', 'description' => 'Admin Add Inventory Delete', 'children' => array(
                            array('label' => 'Add Inventory Item', 'description' => 'Admin Add Inventory Item','children' => array(
                                array('label' => 'New', 'description' => 'Admin Add Inventory Item Update'),
                                array('label' => 'Update', 'description' => 'Admin Add Inventory Item Update'),
                                array('label' => 'Delete', 'description' => 'Admin Add Inventory Item Update Delete'),
                                array('label' => 'Send', 'description' => 'Admin Add Inventory Send'),
                            )),
                            array('label' => 'Add Inventory Payment', 'description' => 'Admin Add Inventory Payment','children' => array(
                                array('label' => 'New', 'description' => 'Admin Add Inventory Payment Update'),
                                array('label' => 'Update', 'description' => 'Admin Add Inventory Payment Update'),
                                array('label' => 'Delete', 'description' => 'Admin Add Inventory Payment Delete'),
                            )),
                        )),
                        array('label' => 'Transfer Inventory', 'description' => 'Admin Transfer Inventory','children' => array(
                            array('label' => 'New', 'description' => 'Admin Transfer Inventory New'),
                            array('label' => 'Update', 'description' => 'Admin Transfer Inventory Update'),
                            array('label' => 'Delete', 'description' => 'Admin Transfer Inventory Delete', 'children' => array(
                                array('label' => 'Items Requested Tab', 'description' => 'Admin Transfer Inventory Item', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Transfer Inventory Item New'),
                                    array('label' => 'Update', 'description' => 'Admin Transfer Inventory Item Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Transfer Inventory Item Delete'),
                                )),
                                array('label' => 'Send Request', 'description' => 'Admin Transfer Inventory Item Send'),    
                                array('label' => 'Delivery Tab', 'description' => 'Admin Transfer Inventory Delivery', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Transfer Inventory Delivery New'),
                                    array('label' => 'Update', 'description' => 'Admin Transfer Inventory Delivery Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Transfer Inventory Delivery Delete'),
                                )),
                                array('label' => 'Receiving Tab', 'description' => 'Admin Transfer Inventory Receiving', 'children' => array(
                                    array('label' => 'Receive', 'description' => 'Admin Transfer Inventory Item Receive'),
                                    array('label' => 'Receive Update', 'description' => 'Admin Transfer Inventory Item Receive Update'),
                                )),
                            )),
                        )),
                    )),

                    array('label' => 'Convert Inventory', 'description' => 'Admin Convert Inventory', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Convert Inventory New'),
                        array('label' => 'Update', 'description' => 'Admin Convert Inventory Update'),
                        array('label' => 'Delete', 'description' => 'Admin Convert Inventory Delete'),
                        array('label' => 'Item', 'description' => 'Admin Convert Inventory Item', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Convert Inventory Item New'),
                            array('label' => 'Update', 'description' => 'Admin Convert Inventory Item Update'),
                            array('label' => 'Delete', 'description' => 'Admin Convert Inventory Item Delete'),
                            array('label' => 'Send', 'description' => 'Admin Convert Inventory Item Send'),
                        )),
                    )),
                )),

                //Sales Agent Menu
                array('label' => 'Sales Agent', 'description' => 'Admin Sales Agent', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Sales Agent New'),
                    array('label' => 'Update', 'description' => 'Admin Sales Agent Update'),
                    array('label' => 'Delete', 'description' => 'Admin Sales Agent Delete'),
                    array('label' => 'Details', 'description' => 'Admin Sales Agent Detail', 'children' => array(
                        array('label' => 'Add Affiliate', 'description' => 'Admin Sales Agent New Referring Health Facility'),
                        array('label' => 'Update Affiliate', 'description' => 'Admin Sales Agent Referring Health Facility Update'),
                        array('label' => 'Delete Affiliate', 'description' => 'Admin Sales Agent Referring Health Facility Delete'),
                    )),
                )),

                //Account Staff Menu
                array('label' => 'Account Staff', 'description' => 'Admin Account Staff', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Account Staff New'),
                    array('label' => 'Update', 'description' => 'Admin Account Staff Update'),
                    array('label' => 'Delete', 'description' => 'Admin Account Staff Delete'),
//                    array('label' => 'Details', 'description' => 'Admin Account Staff Detail'),
                )),

                //Chat Menu
                array('label' => 'Chat', 'description' => 'Admin Chat', 'children' => array(
                    array('label' => 'New', 'description' => 'Admin Chat New'),
                    array('label' => 'Update', 'description' => 'Admin Chat Update'),
                    array('label' => 'Delete', 'description' => 'Admin Chat Delete'),
                    array('label' => 'Send', 'description' => 'Admin Chat Send Message'),
                )),

                array('label' => 'Access CMS', 'description' => 'Admin Cms', 'children' => array(
                    array('label' => 'Account CMS', 'description' => 'Admin Account CMS', 'children' => array(
                        array('label' => 'Account', 'description' => 'Admin Account'),
                        array('label' => 'Company', 'description' => 'Admin Company'),
                        array('label' => 'Branch', 'description' => 'Admin Branch'),
                    )),
                    array('label' => 'User CMS', 'description' => 'Admin Users CMS', 'children' => array(
                        array('label' => 'User', 'description' => 'Admin User'),
                        array('label' => 'User Group', 'description' => 'Admin User Group', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin User Group New'),
                            array('label' => 'Update', 'description' => 'Admin User Group Update'),
                            array('label' => 'Delete', 'description' => 'Admin User Group Delete', 'children' => array(
                                array('label' => 'Detail', 'description' => 'Admin User Group Detail', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin User Group Account User New'),
                                    array('label' => 'Update', 'description' => 'Admin User Group Account User Update'),
                                    array('label' => 'Delete', 'description' => 'Admin User Group Account User Delete'),
                                )),
                            )),
                        )),
                        array('label' => 'Account Staff', 'description' => 'Admin Account Staff', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Account Staff New'),
                            array('label' => 'Update', 'description' => 'Admin Account Staff Update'),
                            array('label' => 'Delete', 'description' => 'Admin Account Staff Delete'),
                        )),
                        array('label' => 'Sales Agent', 'description' => 'Admin Sales Agent', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Sales Agent New'),
                            array('label' => 'Update', 'description' => 'Admin Sales Agent Update'),
                            array('label' => 'Delete', 'description' => 'Admin Sales Agent Delete', 'children' => array(
                                array('label' => 'Detail', 'description' => 'Admin Sales Agent Detail'),
                                array('label' => 'Referring Affiliate', 'description' => 'Admin Sales Agent Detail Referring Health Facility', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Sales Agent Detail Referring Health Facility New'),
                                    array('label' => 'Update', 'description' => 'Admin Sales Agent Detail Referring Health Facility Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Sales Agent Detail Referring Health Facility Delete'),
                                )),

                            )),
                        )),
                    )),
                    array('label' => 'Admin Encounter CMS', 'description' => 'Admin Encounter CMS', 'children' => array(
                        array('label' => 'Encounter Type Group', 'description' => 'Admin Chart Type Group', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Chart Type Group New'),
                            array('label' => 'Update', 'description' => 'Admin Chart Type Group Update'),
                            array('label' => 'Delete', 'description' => 'Admin Chart Type Group Delete'),
                        )),
                        array('label' => 'Encounter Type', 'description' => 'Admin Chart Type', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Chart Type New'),
                            array('label' => 'Update', 'description' => 'Admin Chart Type Update'),
                            array('label' => 'Delete', 'description' => 'Admin Chart Type Delete'),
                        )),
                        array('label' => 'Method', 'description' => 'Admin Chart Type Method', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Chart Type Method New'),
                            array('label' => 'Update', 'description' => 'Admin Chart Type Method Update'),
                            array('label' => 'Delete', 'description' => 'Admin Chart Type Method Delete'),
                        )),
                        array('label' => 'Status', 'description' => 'Admin Chart Type Status', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Chart Type Status New'),
                            array('label' => 'Update', 'description' => 'Admin Chart Type Status Update'),
                            array('label' => 'Delete', 'description' => 'Admin Chart Type Status Delete'),
                        )),
                        array('label' => 'Billing', 'description' => 'Admin Chart Type Billing', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Chart Type Billing New'),
                            array('label' => 'Update', 'description' => 'Admin Chart Type Billing Update'),
                            array('label' => 'Delete', 'description' => 'Admin Chart Type Billing Delete'),
                        )),
                        array('label' => 'Financing Company', 'description' => 'Admin Financing Company', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Financing Company New'),
                            array('label' => 'Update', 'description' => 'Admin Financing Company Update'),
                            array('label' => 'Delete', 'description' => 'Admin Financing Company Delete'),
                        )),
                    )),
                    array('label' => 'Admin Appointment CMS', 'description' => 'Admin Appointment CMS', 'children' => array(
                        array('label' => 'Appointment Status', 'description' => 'Admin Schedule Status', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Schedule Status New'),
                            array('label' => 'Update', 'description' => 'Admin Schedule Status Update'),
                            array('label' => 'Delete', 'description' => 'Admin Schedule Status Delete'),
                        )),
                        array('label' => 'Queuing Status', 'description' => 'Admin Schedule Queued Status', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Schedule Queued Status New'),
                            array('label' => 'Update', 'description' => 'Admin Schedule Queued Status Update'),
                            array('label' => 'Delete', 'description' => 'Admin Schedule Queued Status Delete'),
                        )),
                    )),
                    //Marketing Staff
                    array('label' => 'Admin Appointment CMS', 'description' => 'Admin Marketing Staff Appointment CMS', 'children' => array(
                        array('label' => 'Appointment Status', 'description' => 'Admin Marketing Staff Schedule Status', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Marketing Staff Schedule Status New'),
                            array('label' => 'Update', 'description' => 'Admin Marketing Staff Schedule Status Update'),
                            array('label' => 'Delete', 'description' => 'Admin Marketing Staff Schedule Status Delete'),
                        )),
                        array('label' => 'Queuing Status', 'description' => 'Admin Marketing Staff Schedule Queued Status', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Marketing Staff Schedule Queued Status New'),
                            array('label' => 'Update', 'description' => 'Admin Marketing Staff Schedule Queued Status Update'),
                            array('label' => 'Delete', 'description' => 'Admin Marketing Staff Schedule Queued Status Delete'),
                        )),
                    )),
                    array('label' => 'Manage Marketing Staff Type', 'description' => 'Admin Marketing Staff Type', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Marketing Staff Type New'),
                        array('label' => 'Update', 'description' => 'Admin Marketing Staff Type Update'),
                        array('label' => 'Delete', 'description' => 'Admin Marketing Staff Type Delete'),
                    )),
                    array('label' => 'Manage Marketing Staff', 'description' => 'Admin Marketing Staff', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Marketing Staff New'),
                        array('label' => 'Update', 'description' => 'Admin Marketing Staff Update'),
                        array('label' => 'Delete', 'description' => 'Admin Marketing Staff Delete'),
                        array('label' => 'Detail', 'description' => 'Admin Marketing Staff Detail', 'children' => [
							array('label' => 'Health Facility', 'description' => 'Admin Marketing Staff Health Facility', 'children' => [
								array('label' => 'New', 'description' => 'Admin Marketing Staff Health Facility New'),
								array('label' => 'Update', 'description' => 'Admin Marketing Staff Health Facility Update'),
								array('label' => 'Delete', 'description' => 'Admin Marketing Staff Health Facility Delete'),
							]),
							array('label' => 'Work Schedule', 'description' => 'Admin Marketing Staff Work Schedule', 'children' => [
								array('label' => 'New', 'description' => 'Admin Marketing Staff Work Schedule New'),
								array('label' => 'Update', 'description' => 'Admin Marketing Staff Work Schedule Update'),
								array('label' => 'Delete', 'description' => 'Admin Marketing Staff Work Schedule Delete'),
								array('label' => 'History', 'description' => 'Admin Marketing Staff Work Schedule History'),
							]),
						]),
                    )),

                    array('label' => 'Admin RX CMS', 'description' => 'Admin RX CMS', 'children' => array(
                        array('label' => 'Diagnosis', 'description' => 'Admin Diagnosis', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Diagnosis New'),
                            array('label' => 'Update', 'description' => 'Admin Diagnosis Update'),
                            array('label' => 'Delete', 'description' => 'Admin Diagnosis Delete'),
                        )),
                        array('label' => 'Medication', 'description' => 'Admin Medication', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Medication New'),
                            array('label' => 'Update', 'description' => 'Admin Medication Update'),
                            array('label' => 'Delete', 'description' => 'Admin Medication Delete'),
                        )),
                    )),
                    array('label' => 'Admin Referral CMS', 'description' => 'Admin Referral CMS', 'children' => array(
                        array('label' => 'Source', 'description' => 'Admin Source', 'children', array(
                            array('label' => 'New', 'description' => 'Admin Source New'),
                            array('label' => 'Update', 'description' => 'Admin Source Update'),
                            array('label' => 'Delete', 'description' => 'Admin Source Delete'),
                        )),
                        array('label' => 'Referring Physician', 'description' => 'Admin Referring Provider CMS', 'children', array(
                            array('label' => 'New', 'description' => 'Admin Referring Provider New'),
                            array('label' => 'Update', 'description' => 'Admin Referring Provider Update'),
                            array('label' => 'Delete', 'description' => 'Admin Referring Provider Delete'),
                        )),
                        //array('label' => 'Referring Affiliate', 'description' => 'Admin Referring Health Facility CMS', 'children', array(
                        //    array('label' => 'New', 'description' => 'Admin Referring Health Facility New'),
                        //    array('label' => 'Update', 'description' => 'Admin Referring Health Facility Update'),
                        //    array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Delete', 'children', array(
                        //        array('label' => 'Detail', 'description' => 'Admin Referring Health Facility Detail', 'children', array(
                        //            array('label' => 'New', 'description' => 'Admin Referring Health Facility Provider New'),
                        //            array('label' => 'Update', 'description' => 'Admin Referring Health Facility Provider Update'),
                        //            array('label' => 'Delete', 'description' => 'Admin Referring Health Facility Provider Delete'),
                        //        )),
                        //    )),
                        //)),
                    )),
                    array('label' => 'FAQs', 'description' => 'Admin Faq', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Faq New'),
                        array('label' => 'Update', 'description' => 'Admin Faq Update'),
                        array('label' => 'Delete', 'description' => 'Admin Faq Delete'),
                    )),
                    array('label' => 'Service', 'description' => 'Admin Service CMS', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Service New'),
                        array('label' => 'Update', 'description' => 'Admin Service Update'),
                        array('label' => 'Delete', 'description' => 'Admin Service Delete')
                    )),
                    array('label' => 'Admin Treatment Consideration CMS', 'description' => 'Admin Treatment Consideration CMS', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Treatment Consideration New'),
                        array('label' => 'Update', 'description' => 'Admin Treatment Consideration Update'),
                        array('label' => 'Delete', 'description' => 'Admin Treatment Consideration Delete')
                    )),
                    array('label' => 'Admin Treatment Plan CMS', 'description' => 'Admin Treatment Plan CMS', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Treatment Plan New'),
                        array('label' => 'Update', 'description' => 'Admin Treatment Plan Update'),
                        array('label' => 'Delete', 'description' => 'Admin Treatment Plan Delete')
                    )),
                    array('label' => 'Admin Items Devices CMS', 'description' => 'Admin Items Devices CMS', 'children' => array(
                        array('label' => 'Items', 'description' => 'Admin Items', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Items New'),
                            array('label' => 'Update', 'description' => 'Admin Items Update'),
                            array('label' => 'Delete', 'description' => 'Admin Items Delete'),
                            array('label' => 'Detail', 'description' => 'Admin Items Detail', 'children' => array(
                                array('label' => 'Price', 'description' => 'Admin Items Price', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Items Price New'),
                                    array('label' => 'Update', 'description' => 'Admin Items Price Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Items Price Delete'),
                                )),
                                array('label' => 'Item', 'description' => 'Admin Items Item', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Items Item New'),
                                    array('label' => 'Update', 'description' => 'Admin Items Item Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Items Item Delete'),
                                )),
                                array('label' => 'Tax Code', 'description' => 'Admin Items Tax Code', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Items Tax Code New'),
                                    array('label' => 'Update', 'description' => 'Admin Items Tax Code Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Items Tax Code Delete'),
                                )),
                                array('label' => 'Ave Cost', 'description' => 'Admin Items Ave Cost', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Items Ave Cost New'),
                                    array('label' => 'Update', 'description' => 'Admin Items Ave Cost Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Items Ave Cost Delete'),
                                )),
                                array('label' => 'Size', 'description' => 'Admin Items Size', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Items Size New'),
                                    array('label' => 'Update', 'description' => 'Admin Items Size Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Items Size Delete'),
                                )),
                                array('label' => 'Unit', 'description' => 'Admin Items Unit', 'children' => array(
                                    array('label' => 'New', 'description' => 'Admin Items Unit New'),
                                    array('label' => 'Update', 'description' => 'Admin Items Unit Update'),
                                    array('label' => 'Delete', 'description' => 'Admin Items Unit Delete'),
                                )),
                            )),
                        )),
                        array('label' => 'Devices', 'description' => 'Admin Device', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Device New'),
                            array('label' => 'Update', 'description' => 'Admin Device Update'),
                            array('label' => 'Delete', 'description' => 'Admin Device Delete'),
                        )),
                        array('label' => 'Category', 'description' => 'Admin Item Category', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Item Category New'),
                            array('label' => 'Update', 'description' => 'Admin Item Category Update'),
                            array('label' => 'Delete', 'description' => 'Admin Item Category Delete'),
                        )),
                        array('label' => 'Subcategory', 'description' => 'Admin Item Subcategory', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Item Subcategory New'),
                            array('label' => 'Update', 'description' => 'Admin Item Subcategory Update'),
                            array('label' => 'Delete', 'description' => 'Admin Item Subcategory Delete'),
                        )),
                    )),
                    array('label' => 'Admin Address CMS', 'description' => 'Admin Address CMS', 'children' => array(
                        array('label' => 'Country', 'description' => 'Admin Country', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Country New'),
                            array('label' => 'Update', 'description' => 'Admin Country Update'),
                            array('label' => 'Delete', 'description' => 'Admin Country Delete'),
                        )),
                        array('label' => 'Province', 'description' => 'Admin Province', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Province New'),
                            array('label' => 'Update', 'description' => 'Admin Province Update'),
                            array('label' => 'Delete', 'description' => 'Admin Province Delete'),
                        )),
                        array('label' => 'City', 'description' => 'Admin City', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin City New'),
                            array('label' => 'Update', 'description' => 'Admin City Update'),
                            array('label' => 'Delete', 'description' => 'Admin City Delete'),
                        )),
                        array('label' => 'Postal Code', 'description' => 'Admin Postal Code', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Postal Code New'),
                            array('label' => 'Update', 'description' => 'Admin Postal Code Update'),
                            array('label' => 'Delete', 'description' => 'Admin Postal Code Delete'),
                        )),
                    )),
                    array('label' => 'Access System Parameters', 'description' => 'Admin System Parameters', 'children' => array(
                        array('label' => 'Letter Template', 'description' => 'Admin Letter Template', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Letter Template New'),
                            array('label' => 'Update', 'description' => 'Admin Letter Template Update'),
                            array('label' => 'Delete', 'description' => 'Admin Letter Template Delete'),
                        )),
                        array('label' => 'Email Template', 'description' => 'Admin Email Template', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Email Template New'),
                            array('label' => 'Update', 'description' => 'Admin Email Template Update'),
                            array('label' => 'Delete', 'description' => 'Admin Email Template Delete'),
                        )),
                        array('label' => 'Note Template', 'description' => 'Admin Note Template', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Note Template New'),
                            array('label' => 'Update', 'description' => 'Admin Note Template Update'),
                            array('label' => 'Delete', 'description' => 'Admin Note Template Delete'),
                        )),
                        array('label' => 'Account User Type', 'description' => 'Admin Account User Type'),
                        array('label' => 'Patient Type', 'description' => 'Admin Patient Type'),
                        array('label' => 'Insurance Type', 'description' => 'Admin Insurance Type'),
                        array('label' => 'File Type', 'description' => 'Admin File Type'),
                        array('label' => 'Reminder Type', 'description' => 'Admin Reminder Type'),
                        array('label' => 'Clinician Type', 'description' => 'Admin Clinician Type'),
                        array('label' => 'Branch Type', 'description' => 'Admin Branch Type'),
                        array('label' => 'Medication Type', 'description' => 'Admin Medication Type'),
                        array('label' => 'Diagnosis Type', 'description' => 'Admin Diagnosis Type'),
                        array('label' => 'Internal Status', 'description' => 'Admin Internal Status'),
                        array('label' => 'Ticket Status', 'description' => 'Admin Ticket Status'),
                        array('label' => 'Ticket Severity', 'description' => 'Admin Ticket Severity'),
                        array('label' => 'Letter Status', 'description' => 'Admin Letter Status'),
                        array('label' => 'AuditTrail', 'description' => 'Admin AuditTrail'),
                        array('label' => 'System Parameter', 'description' => 'Admin System Parameter', 'children' => array(
	                        array('label' => 'New', 'description' => 'Admin System Parameter New'),
	                        array('label' => 'Update', 'description' => 'Admin System Parameter Update'),
	                        array('label' => 'Delete', 'description' => 'Admin System Parameter Delete'),
                        )),
                        array('label' => 'Billing Parameter', 'description' => 'Admin Billing Parameter', 'children' => array(
	                        array('label' => 'New', 'description' => 'Admin Billing Parameter New'),
	                        array('label' => 'Update', 'description' => 'Admin Billing Parameter Update'),
	                        array('label' => 'Delete', 'description' => 'Admin Billing Parameter Delete'),
                        )),
                    )),
                )),

                // MR
                array('label' => 'Purchasing', 'description' => 'Admin Purchasing', 'children' => array(
                    array('label' => 'Order Supplies', 'description' => 'Admin Material Requisition', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Material Requisition New'),
                        array('label' => 'Update', 'description' => 'Admin Material Requisition Update'),
                        array('label' => 'Delete', 'description' => 'Admin Material Requisition Delete'),
                        array('label' => 'Send', 'description' => 'Admin Material Requisition Send'),
                        array('label' => 'Void', 'description' => 'Admin Material Requisition Void'),
                        array('label' => 'Item', 'description' => 'Admin Material Requisition Item', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Material Requisition Item New'),
                            array('label' => 'Update', 'description' => 'Admin Material Requisition Item Update'),
                            array('label' => 'Delete', 'description' => 'Admin Material Requisition Item Delete'),
                        )),
                        array('label' => 'Notes', 'description' => 'Admin Material Requisition Note', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Material Requisition Note New'),
                            array('label' => 'Update', 'description' => 'Admin Material Requisition Note Update'),
                            array('label' => 'Delete', 'description' => 'Admin Material Requisition Note Delete'),
                        )),
                    )),
                    array('label' => 'Canvass', 'description' => 'Admin Canvass', 'children' => array(
                        array('label' => 'Send', 'description' => 'Admin Canvass Send'),
                        array('label' => 'Cancel', 'description' => 'Admin Canvass Cancel'),
                        array('label' => 'Void', 'description' => 'Admin Canvass Void'),
                        array('label' => 'Add Supplier', 'description' => 'Admin Canvass Add Supplier'),
                        array('label' => 'Select Supplier', 'description' => 'Admin Canvass Select Supplier'),
                        array('label' => 'Print Blank PO', 'description' => 'Admin Canvass Print Blank PO'),
                    )),
                    array('label' => 'Purchase Order', 'description' => 'Admin Purchase Order', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Purchase Order New'),
                        array('label' => 'Update', 'description' => 'Admin Purchase Order Update'),
                        array('label' => 'Delete', 'description' => 'Admin Purchase Order Delete'),
                        array('label' => 'Send', 'description' => 'Admin Purchase Order Send'),
                        array('label' => 'Void', 'description' => 'Admin Purchase Order Void'),
                        array('label' => 'Cancel', 'description' => 'Admin Purchase Order Cancel'),
                        array('label' => 'Print', 'description' => 'Admin Purchase Order Print'),
                    )),
                    array('label' => 'Purchase Invoice', 'description' => 'Admin Purchase Invoice', 'children' => array(
                        array('label' => 'Purchase Invoice Payment', 'description' => 'Admin Purchase Invoice Payment', 'children' => array(
                            array('label' => 'New', 'description' => 'Admin Purchase Invoice Payment New'),
                            array('label' => 'Update', 'description' => 'Admin Purchase Invoice Payment Update'),
                            array('label' => 'Delete', 'description' => 'Admin Purchase Invoice Payment Delete'),
                        )),
                        array('label' => 'Send', 'description' => 'Admin Purchase Invoice Send'),
                        array('label' => 'Other Cost', 'description' => 'Admin Purchase Invoice Other Cost', 'children' => array(
	                        array('label' => 'New', 'description' => 'Admin Purchase Invoice Other Cost New'),
	                        array('label' => 'Update', 'description' => 'Admin Purchase Invoice Other Cost Update'),
	                        array('label' => 'Delete', 'description' => 'Admin Purchase Invoice Other Cost Delete'),
                        )),
                    )),
                    array('label' => 'Receive Order', 'description' => 'Admin Purchase Order Receive', 'children' => array(
                        array('label' => 'New', 'description' => 'Admin Purchase Order Receive New'),
                        array('label' => 'New', 'description' => 'Admin Purchase Order Receive Cancel'),
                        array('label' => 'Update', 'description' => 'Admin Purchase Order Receive Update'),
                        array('label' => 'Delete', 'description' => 'Admin Purchase Order Receive Delete'),
                        array('label' => 'Send', 'description' => 'Admin Purchase Order Receive Send'),
                        array('label' => 'Void', 'description' => 'Admin Purchase Order Receive Void'),
                    )),
                    array('label' => 'User Access', 'description' => 'Admin User Access'),
                )),
            )),
        );

    }
}