logo

Display documents on a contractor page

Let's consider an example of how to make a Contractor page display documents, in which the contractor is specified as an attribute. As the result, the contractor page will include an additional tab with the required documents.
 
Assume there is a Contract (Contract) document type with the Contractor (Contractor) attribute. 
1. For the object (Contract document type) set the Generate filter property. For the attribute (Contractor) set Participates in search (filter).
2. Copy the Company view form (file c:\ELMA3-Standart\Web\Modules\EleWise.ELMA.CRM.Web\Views\ContractorLegal\TabView.cshtml ) to the folder \WebApplication\Modules\EleWise.ELMA.CRM.Web\Views\ContractorLegal. If some folders are missing, you should create them.
3. Open the form in any text editor and add to the end:
 
var docFilterdog = new EleWise.ELMA.Documents.Models.ContractFilter();
docFilterdog.Contractor = Model.Entity;
var docCount_dog = EntityManager<EleWise.ELMA.Documents.Models.Contract>.Instance.Count((EleWise.ELMA.Documents.Models.IContractFilter)docFilterdog);
 
tabs.Add(
new EleWise.ELMA.Web.Mvc.Models.Selectors.TabPanelItem
{
Text = SR.T("Contracts ({0})", docCount_dog),
TabIndex = 5,
Selected = seletedTab == 5
}).Content(@<text>
<div>
@Html.Action("Grid", "FilterDocumentFolder", new RouteValueDictionary { { "id", null }, { "area", "EleWise.ELMA.Documents.Web" }, {"DocumentFilter.Types[0].TypeUid", EleWise.ELMA.Model.Services.InterfaceActivator.UID<EleWise.ELMA.Documents.Models.Contract>().ToString()}, { "DocumentFilter.__TypeName", "EleWise.ELMA.Documents.Models.ContractFilter, EleWise.ELMA.DynamicModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" }, { "DocumentFilter.Contractor.Id", Model.Entity.Id }, { "enableChecked", false }, { "mergeFilter", false } })
</div>
</text>);
 
}).UseTabProvider(true).Render())

As the result, additional Contracts tab will be added to the contractor page with the list of contracts.

An example of the form is attached.

Attachments