36 Customizing Display of Assets Section

This chapter describes how to customize Oracle Communications Billing Care Assets section in the Home tab.

About Customizing Display of Assets Section

In Billing Care, the Assets section in the Home tab displays the services and related charge offers and discount offers purchased for an account. Each service is displayed in an Asset card. You can view details of the assets of all bill units by clicking Bill Unit (All). You can also click an Asset card's Action menu and select Show Asset Details to view more information about the asset.

You can perform the following in the Assets section by using the Billing Care SDK:

Hiding Bill Units in the Home Tab

This section provides a high-level overview of the process on how to customize the Home tab in Billing Care to hide individual Bill Unit area and Show Bill Units in case of multiple bill units.

To customize Billing Care to hide bill units in the home tab:

  1. Create custom view model to define the display of the Home tab. See "Creating Custom Home Tab View Model to Hide Bill Units" for more information.

  2. Create a customRegistry.js file configuring Billing Care to use the custom view model created in step 1. See "Configuring the Custom Home Tab View Model in the Registry" for more information.

  3. Package and deploy your customization to your Billing Care domain using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

Creating Custom Home Tab View Model to Hide Bill Units

Billing Care uses the view model to define the display of the Home tab. You must create the custom view model, CustomHomeTabViewModel, containing overrides for the default Home tab. See "About View Models" for more information about Billing Care view models.

To create custom home tab view model to hide bill units:

  1. Create the customHomeTabViewModel.js file in the myproject/web/custom/js/viewmodels/homeTab directory, where myproject is the folder containing your NetBeans IDE project.

  2. Open the customHomeTabViewModel.js file using a text editor and add the code as shown in Example 36-1.

    Example 36-1 Sample code to hide Bill Units in the Home tab

    define([
        'jquery',
        'underscore',
        'knockout',
        Registry.base.viewmodel,
        'viewmodels/hometab/HomeTabViewModel'
    ],
            function ($, _, ko, BaseViewModel, HomeTabViewModel) {
                function customHomeTabViewModel() {
                    HomeTabViewModel.apply(this, arguments);
                    var self = this;
                                                  
                     $(function() {
                                
                                if(util.checkEmbeddedHtml()){
                                
    var myVar = setInterval(function() {
                                      
                                    
                                    if($('#allBillUnits').is(":visible"))
                                     {                                   
                                       $("#allBillUnits").remove();
                                        clearInterval(myVar);
                                     }
    if($('#billUnits_all').is(":visible"))
                                     {                                 
                                        $("#billUnits_all").remove();
                                        clearInterval(myVar);
                                     }  
    if($('#showHide').is(":visible"))
                                     {                               
                                        $("#showHide").remove();
                                        clearInterval(myVar);
                                     }                                  
                                 }, 20);
                                 }
                        });
                }
                
                customHomeTabViewModel.prototype = new HomeTabViewModel();
                return  customHomeTabViewModel;
            });
    
  3. Save the file in your NetBeans IDE project.

Configuring the Custom Home Tab View Model in the Registry

Create a custom entry in your customRegistry.js file. Billing Care uses the custom model instead of the default entry and renders Home tab containing your custom fields. See "About the Registry File" for more information.

To configure the custom home tab view model in the registry:

  1. Create a customRegistry.js file in the myproject/web/custom/ directory.

  2. Define the custom view model in this file. See Example 36-2.

    Example 36-2 Sample hiding Bill Units in the Home tab registry entry

    homeTab: { 
           viewmodel: 'custom/js/viewModels/hometab/customHomeTabViewModel.js' 
        }
    
  3. Save the file in your NetBeans IDE project.

Disabling Actions Menu in the Assets Section

This section provides a high-level overview of the process on how to customize Billing Care to disable the Actions menu in the Assets section.

To disable Actions menu in the Assets section:

  1. Create custom view model to define the disabling of the Actions menu in the Assets section. See "Creating Custom View Model to Disable Actions Menu" for more information.

  2. Create a customRegistry.js file configuring Billing Care to use the custom view model created in step 1. See "Configuring the Custom Assets Section View Model in the Registry" for more information.

  3. Package and deploy your customization to your Billing Care domain using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

Creating Custom View Model to Disable Actions Menu

Billing Care uses the view model to define the disabling of the Actions menu in the Assets section. You must create the custom view model, CustomAssetViewModel, containing overrides for the default Actions menu. See "About View Models" for more information about Billing Care view models.

To create custom view model to disable Actions menu:

  1. Create the customAssetViewModel.js file in the myproject/web/custom/js/viewmodels/customerAssets directory.

  2. Open the customAssetViewModel.js file in a text editor and add the code as shown in Example 36-3.

    Example 36-3 Sample code to disable Actions menu in the Assets section

    define(['ojs/ojcore', 'ojtranslations/nls/ojtranslations',
    'ojs/ojvalidation', 'ojs/ojdatetimepicker',
        'jquery',
        'underscore',
        'knockout',
        'knockout-mapping',
        Registry.base.viewmodel,
        'viewmodels/customerAssets/AssetViewModel',
        Registry.balances.bindings
        
    ],
            function (oj, delojt, delojv, delojdatepicker, $, _, ko, komapping,
    BaseViewModel, AssetViewModel) {
                
                function customAssetViewModel() {
                    AssetViewModel.apply(this, arguments);
                    var self = this;
                  
    if(util.checkEmbeddedHtml()){  
                      
                        self.disableActionsMenu(true);  
                        
    //Override OOTB showOfferDetails method()  
     
    self.showOfferDetails = function () {
              
    self.isOfferDetailsVisible(true);
                        self.disableActionsMenu(true);
                        var assetsCardArray = [];
                        if (sessionStorage.getItem("assetsCards") !== null) {
                            assetsCardArray =
    JSON.parse(sessionStorage.getItem("assetsCards"));
                        }
                        assetsCardArray.push(self.assetCard);
                        sessionStorage.setItem("assetsCards",
    JSON.stringify(assetsCardArray));
                    
    };
                    }
                    
                }        
                    
                customAssetViewModel.prototype = new AssetViewModel();
                
                return  customAssetViewModel;
            });
    
  3. Save the file in your NetBeans IDE project.

Configuring the Custom Assets Section View Model in the Registry

Create a custom entry in your customRegistry.js file. Billing Care uses the custom model instead of the default entry and renders the Assets section containing your custom fields. See "About the Registry File" for more information.

To configure the custom Assets section view model in the registry:

  1. Create a customRegistry.js file in myproject/web/custom/ directory.

  2. Define the custom view model in this file. See Example 36-4.

    Example 36-4 Sample Assets section Registry Entry

    customerAssets: {
            containedViewModel:
    'custom/js/viewModels/customerAssets/customAssetViewModel.js'
    }
    
  3. Save the file in your NetBeans IDE project.

Hiding the Service Icon in Assets Card

To hide the service icon in Assets card:

  1. Copy the SDK_home/BillingCare_SDK/references/Configurations.xml file to the myproject/web/custom/configurations directory, where SDK_home is the directory in which you installed the Billing Care SDK.

  2. Open the copied file using a text editor and remove the serviceTypes.icons key values.

    For more information, see "Editing the Billing Care Configuration File".

  3. Save and close the file.

  4. Open the customAssetViewModel.js file using a text editor in the myproject/web/custom/js/viewmodels/customerAssets directory, and add the code as shown in Example 36-5.

    Example 36-5 Sample code to hide service icons

    define(['ojs/ojcore', 'ojtranslations/nls/ojtranslations',
    'ojs/ojvalidation', 'ojs/ojdatetimepicker',
        'jquery',
        'underscore',
        'knockout',
        'knockout-mapping',
        Registry.base.viewmodel,
        'viewmodels/customerAssets/AssetViewModel',
        Registry.balances.bindings
        
    ],
            function (oj, delojt, delojv, delojdatepicker, $, _, ko, komapping,
    BaseViewModel, AssetViewModel) {
                function customAssetViewModel() { 
                    AssetViewModel.apply(this, arguments); 
                    var self = this; 
    if(util.checkEmbeddedHtml()){ 
     
     $(function () {                     
                            var myVar =    setInterval(function () { 
                                       
                                                                 if 
    ($('.customerAssets-workspace-card-header-icon').is(":visible")) 
                                                                 { 
                                                            
                                     
                                       $(".customerAssets-workspace-card-header-ic 
    on").remove(); 
                                     
                                        clearInterval(myVar); 
                                                                 } 
                                       
                                                         }, 20); 
     
                            var myVar1 =    setInterval(function () {         
                                                       
                                                                   if 
    ($('.custmerAssets-workspace-card-header-fromplan').is(":visible")) 
                                                                 { 
                                                                             
                                     
    $(".custmerAssets-workspace-card-header-fromplan").css({"margin-top": "20px", 
    "margin-left": "10px"}); 
                                     
                                        clearInterval(myVar1); 
                                                                 
    }                                   
                                                         }, 20); 
                                                     
                                        }); 
     } 
     } 
                customAssetViewModel.prototype = new AssetViewModel();
                
                return customAssetViewModel;
            });
    
  5. Save the file in your NetBeans IDE project.

  6. Create a custom entry in your customRegistry.js file. Billing Care uses the custom model instead of the default entry and renders the Assets section containing your custom fields. See "Configuring the Custom Assets Section View Model in the Registry".

  7. Package and deploy your customization to your Billing Care domain using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".