prasadnarwadkar_ASPNETCorePostgreSQL/ASPNETIdentityPostgres/Areas/ADT/Views/Patients/MyTaskList.cshtml
@model ASPNETIdentityPostgres.Areas.ADT.Models.claimSubmittedInfo

@{
    ViewData["Title"] = "My Tasks";

    var username = User.Identity.Name;

    var bpmRole = "";

    var mapping = ASPNETIdentityPostgres.Areas.ADT.Models.WebAppAndBPMUserMap.mappings.FirstOrDefault(m => m.UserNameOnWebApp.ToLower() == username.ToLower());

    if (mapping != null)
    {
        bpmRole = mapping.UserRoleOnBPMEngineOrApp;
    }
}

<p class="alert-danger">@ViewData["NoConnError"]</p>

<div class="modal" tabindex="-1" role="dialog" id="exampleModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">BonitaSoft Engine Must Be Running</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <p class="small">This example uses BonitaSoft RESTful API and the Claims management process is executed from within this web app using that API.</p>
                <p class="small">BonitaSoft Engine (Studio) must be running for this to work. Please refer to <a href="https://documentation.bonitasoft.com/bonita/2021.2/getting-started/draw-bpmn-diagram">this page</a> and follow all the instructions from the pages linked on this page. There are links to download the BonitaSoft BPM studio and then work with it. BonitaSoft doesn't expose conventional API. However, HTTP-based API can still be used to interact with it.</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-10">
        @if (bpmRole == "claim_initiator")
        {
            <p class="alert-info small">You are a claim initiator (a customer). You can raise claims and review the answer/comments from the claim reviewer and rate how satisfied you are with the service.</p>
            <p>
                <a asp-action="SubmitClaimBonitaSoft" class="btn btn-primary">Submit a new claim</a>

            </p>
        }
        <div>

            <hr />
            <h5>My Tasks</h5>
            <table class="table">
                <thead>
                    <tr>
                        <th>
                            Name
                        </th>

                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.tasks)
                    {
                        if (item.displayName == "Review and answer claim"
                        && bpmRole == "claim_reviewer")
                        {
                            <tr>
                                <td>
                                    @Html.DisplayFor(modelItem => item.displayName)
                                </td>

                                <td>
                                    <a asp-action="BonitaSoftTaskDetails" asp-route-id="@item.id">Go To Task Details</a>
                                </td>
                            </tr>
                        }
                        else if (item.displayName == "Read the answer and rate it"
                        && bpmRole == "claim_initiator")
                        {
                            <tr>
                                <td>
                                    @Html.DisplayFor(modelItem => item.displayName)
                                </td>

                                <td>
                                    <a asp-action="BonitaSoftTaskDetails" asp-route-id="@item.id">Go To Task Details</a>
                                </td>
                            </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
    <div class="col-md-2">
        <!-- Button trigger modal -->

        <button type="button" class="glyphicon glyphicon-info-sign" data-toggle="modal" data-target="#exampleModal">
        </button>
    </div>
</div>

<p>
    @*<a asp-action="LoginToBonitaSoftEngine">Login to BonitaSoft Engine</a>*@
</p>

