export class SellPlanningUtil {
}

export function TOGGLE_SIDEPANEL_WIDTH(isExpanded: any){
    console.log("TOGGLE_SIDEPANEL_WIDTH isExpanded  ============>",isExpanded);
    var widthVal = '';
    if( isExpanded )
    {
        widthVal = '760px';
    }
    else
    {
        widthVal = '330px';
    }
    var rootElem = <HTMLElement>document.querySelector(':root')
    rootElem.style.setProperty('--sidepanel-width', widthVal);
}

export function updateThemeColor(){
    
    var colorCode = localStorage.getItem('themeColor');
    if( colorCode )
    {
        console.log("colorCode ============>",colorCode);
        var rootElem = <HTMLElement>document.querySelector(':root')
        rootElem.style.setProperty('--primary', colorCode)
    }
}

export function DOWNLOAD_URI(uri: any, name: any, outputType: any) {

    switch(outputType)
    {
        case 'Excel': name = name + '.xlsx'; break;
        case 'Acrobat PDF':  name = name + '.pdf'; break;
        default :  name = name + '.' + outputType;
    }
    console.log( 'uri:[', uri, '] \\n name:[', name,']');
    let link = document.createElement("a");
    link.download = name;
    link.href = uri;
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
}