Page 30159 Shpfy Catalogs

Shopify Connector, Microsoft.Integration.Shopify

src/Apps/W1/Shopify/App/src/Catalogs/Pages/ShpfyCatalogs.Page.al163 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.Integration.Shopify;/// <summary>/// Page Shpfy Catalogs (ID 30159)./// </summary>page 30159 "Shpfy Catalogs"{    ApplicationArea = All;    Caption = 'Shopify B2B Catalogs';    InsertAllowed = false;    PageType = List;    SourceTable = "Shpfy Catalog";    UsageCategory = Lists;    PromotedActionCategories = 'New,Process,Related,Catalog';    layout    {        area(content)        {            repeater(General)            {                field(Id; Rec.Id) { }                field("Customer No."; Rec."Customer No.") { }                field(Name; Rec.Name) { }                field("Company Name"; Rec."Company Name")                {                    Caption = 'Company';                    Editable = false;                    DrillDown = true;                    trigger OnDrillDown()                    var                        Company: Record "Shpfy Company";                    begin                        if Company.GetBySystemId(Rec."Company SystemId") then                            Page.Run(Page::"Shpfy Company Card", Company);                    end;                }                field(SyncPrices; Rec."Sync Prices") { }                field("Currency Code"; Rec."Currency Code")                {                    Editable = false;                }                field(CustomerPriceGroup; Rec."Customer Price Group") { }                field(CustomerDiscountGroup; Rec."Customer Discount Group") { }                field("Prices Including VAT"; Rec."Prices Including VAT") { }                field("Allow Line Disc."; Rec."Allow Line Disc.") { }                field("Gen. Bus. Posting Group"; Rec."Gen. Bus. Posting Group") { }                field("VAT Bus. Posting Group"; Rec."VAT Bus. Posting Group")                {                    Editable = Rec."Prices Including VAT";                }                field("Customer Posting Group"; Rec."Customer Posting Group") { }                field("VAT Country/Region Code"; Rec."VAT Country/Region Code") { }                field("Tax Area Code"; Rec."Tax Area Code") { }                field("Tax Liable"; Rec."Tax Liable") { }            }        }    }    actions    {        area(Navigation)        {            action(Products)            {                ApplicationArea = All;                Caption = 'Products';                Image = ItemGroup;                Promoted = true;                PromotedOnly = true;                PromotedCategory = Category4;                ToolTip = 'View a list of Shopify products for the catalog.';                trigger OnAction()                var                    Shop: Record "Shpfy Shop";                    CatalogAPI: Codeunit "Shpfy Catalog API";                begin                    if Shop.Get(Rec."Shop Code") then begin                        CatalogAPI.SetShop(Shop);                        CatalogAPI.SetCatalogType("Shpfy Catalog Type"::Company);                        Hyperlink(CatalogAPI.GetCatalogProductsURL(Rec.Id));                    end;                end;            }        }        area(Processing)        {            action(GetCatalogs)            {                ApplicationArea = All;                Caption = 'Get Catalogs';                Image = Import;                Promoted = true;                PromotedOnly = true;                PromotedCategory = Process;                ToolTip = 'Retrieve active B2B catalogs from Shopify for companies that have already been imported. If no companies are synced to this shop, no catalogs will be retrieved.';                trigger OnAction()                var                    ShopifyCompany: Record "Shpfy Company";                    SyncCatalogs: Report "Shpfy Sync Catalogs";                begin                    if Rec.GetFilter("Company SystemId") <> '' then begin                        ShopifyCompany.GetBySystemId(Rec.GetFilter("Company SystemId"));                        SyncCatalogs.SetCompany(ShopifyCompany);                        SyncCatalogs.UseRequestPage(false);                    end;                    SyncCatalogs.SetCatalogType("Shpfy Catalog Type"::Company);                    SyncCatalogs.Run();                    if not Rec.IsEmpty() then                        PriceSyncEnabled := true;                end;            }            action(PriceSync)            {                ApplicationArea = All;                Caption = 'Sync Prices';                Enabled = PriceSyncEnabled;                Image = ImportExport;                Promoted = true;                PromotedOnly = true;                PromotedCategory = Process;                ToolTip = 'Sync the latest prices to Shopify. Only lines with Sync Prices enabled will be processed.';                trigger OnAction()                var                    Shop: Record "Shpfy Shop";                    SyncCatalogsPrices: Report "Shpfy Sync Catalog Prices";                    BackgroundSyncs: Codeunit "Shpfy Background Syncs";                begin                    if Rec.GetFilter("Company SystemId") <> '' then                        BackgroundSyncs.CatalogPricesSync(Rec."Shop Code", Rec.GetFilter("Company SystemId"), "Shpfy Catalog Type"::Company)                    else begin                        Shop.SetRange(Code, Rec."Shop Code");                        SyncCatalogsPrices.SetTableView(Shop);                        SyncCatalogsPrices.SetCatalogType("Shpfy Catalog Type"::Company);                        SyncCatalogsPrices.Run();                    end;                end;            }        }    }    trigger OnOpenPage()    begin        Rec.SetRange("Catalog Type", "Shpfy Catalog Type"::"Company");        if not Rec.IsEmpty() then            PriceSyncEnabled := true;    end;    var        PriceSyncEnabled: Boolean;}