EnVisageOnline/Main/Source/EnVisage/Views/Scenarios/_gridTopDown.cshtml

227 lines
15 KiB
Plaintext

<tbody ng-repeat="row in data.Calendar.Rows track by $index" ng-if="!data.Scenario.IsBottomUp && $index > 0" ng-show="row.Visible" ng-init="ExpCatSourceIndex = $index">
<tr class="dnd-container">
<td class="headcol">
<div class="grid-actions-div">
<a href="#" ng-if="row.AllowResourceAssignment" ng-click="onOpenReallocate(row)" data-toggle="modal" data-target="#reallocator" title="Reallocate resource" ng-disabled="row.HasActuals || data.CalendarFilter.VisibleExpCats.length <= 1"><i class="fa fa-random icon black"></i></a>
<a href="#" ng-click="removeExpCat(row)" title="Delete Expenditure" ng-disabled="row.HasActuals || data.CalendarFilter.VisibleExpCats.length <= 1"><i class="fa fa-times-circle icon red"></i></a>
<a href="#" ng-if="row.AllowResourceAssignment" ng-click="prefillFormatCells(row)" data-toggle="modal" data-target="#modalFormatCells" title="Round expenditure" ng-disabled="row.HasActuals"><i class="fa fa-building-o icon black"></i></a>
<a href="#" ng-if="row.AllowResourceAssignment" ng-click="openChangeCurveModal(row)" data-toggle="modal" data-target="#editTotal" title="Change Curve" ng-disabled="row.HasActuals || data.CalendarFilter.VisibleExpCats.length <= 1"><i class="fa fa-bar-chart-o icon black"></i></a>
</div>
<script type="text/ng-template" id="drag-helper">
<div class="drag-helper">
<span ng-bind="getSelectedCellsCount(row)"></span>
<span>weeks</span>
</div>
</script>
</td>
<td class="headcol">
<div ng-controller="noteController" ng-init="initView(data.Scenario.Id, row.ExpCatId,3,(data.Scenario.Id != GuidEmpty),(NotesToAdd.length == 0))">
<a href="#" ng-click="openNoteModal()" data-toggle="modal" data-target="#editNote{{ParentId}}" title="Notes"><i class="fa fa-file-text-o icon black"></i></a>
<span id="NoteLabel" ng-hide="(Notes.length == 0)" class="button__badge label">{{Notes.length}}</span>
@Html.Partial("~/Views/Note/_index.cshtml")
</div>
</td>
<td class="headcol headcol-week {{data.CalendarFilter.ShowActuals ? row.CSSClass[0] : ''}}" ng-click="onExpCatCollapseClick(row, $event)">
<a id = "id_exp{{row.ExpCatId}}" href="#">
<i class="fa" ng-class="row.CollapsedClass" ng-if="!data.CalendarFilter.ShowActuals" style="margin-right: 5px;"
ng-attr-title="{{row.Collapsed ? 'Expand' : 'Collapse'}}">
</i>
{{ row.ExpCatName || 'empty' }}
</a>
</td>
<td class="headcol {{data.CalendarFilter.ShowActuals ? row.CSSClass[0] : ''}}">
<a ng-if="row.IsEditable" href="#"
editable-text="data.CalendarFilter.IsTableModeQuantity ? row.GrandTotalQuantity : row.GrandTotalCost"
e-name="ColValue" e-ng-blur="onTxtBlur(this);" onshow="watchKeyInput(this)" buttons="no" blur="submit"
onbeforesave="checkTotalValue($data, row, $index)" e-required>
{{ data.CalendarFilter.IsTableModeQuantity? (row.GrandTotalQuantity || 0 | number:2) : (row.GrandTotalCost || 0 | currency) }}
</a>
<span ng-if="!row.IsEditable">
{{ data.CalendarFilter.IsTableModeQuantity? (row.GrandTotalQuantity || 0 | number:2) : (row.GrandTotalCost || 0 | currency) }}
</span>
</td>
<td class="{{row.CSSClass[$index]}}"
ng-repeat="col in row.Cells track by $index" @* collection of weeks and months in the row this is the value *@
ng-class="{'droppable-active': row.ActiveDroppables[$index], 'draggable-selected': row.SelectedCells[$index]}"
ng-show="data.Calendar.WeekHeaders[$index].Show"
ng-if="data.Calendar.WeekHeaders[$index].Initialized"
dnd-draggable="!data.CalendarFilter.ShowActuals"
dnd-draggable-opts="{layer: 'l-ec-{{row.ExpCatId}}', helper: 'drag-helper', useAsPoint: true}"
dnd-on-dragstart="dragStart($dragmodel)"
dnd-on-drag="drag($api)"
dnd-on-dragend="dragEnd($dragmodel)"
dnd-on-dragenter="dragEnter($dropmodel, $dragmodel)"
dnd-droppable="!data.CalendarFilter.ShowActuals"
dnd-droppable-opts="{layer: 'l-ec-{{row.ExpCatId}}'}"
dnd-on-drop="drop($dropmodel, $dragmodel)"
dnd-containment="'.dnd-container'"
dnd-model="{ExpCat: row, ExpCatSourcePosition: ExpCatSourceIndex, Position: $index}"
ng-click="selectCell(row, $index, $event)">
<!--Editable forecast (non-calculated) columns-->
<a ng-if="row.Editable[$index][data.CalendarFilter.ViewModeName]" href="#" editable-text="col" e-name="ColValue" e-ng-blur="onTxtBlur(this);" onshow="watchKeyInput(this)" buttons="no" blur="submit" onbeforesave="checkValue($data, row.ExpCatId, $index)"
e-required>
{{ data.CalendarFilter.IsTableModeQuantity ? (col || 0 | number:2) : (col || 0 | currency) }}
</a>
<!--Readonly actuals or calculated columns-->
<span ng-if="!row.Editable[$index][data.CalendarFilter.ViewModeName]">
{{ data.CalendarFilter.IsTableModeQuantity ? (col || 0 | number:2) : (col || 0 | currency) }}
</span>
</td>
</tr>
<tr ng-repeat-start="team in row.Teams track by $index" ng-show="!row.Collapsed" ng-if="!row.Collapsed && !data.CalendarFilter.ShowActuals">
<td class="headcol">
<div class="grid-actions-div">
<a href="#" ng-click="removeTeam(team)" title="Delete Team" ng-show="team.CanBeDeleted"><i class="fa fa-times-circle icon red"></i></a>
</div>
</td>
<td class="headcol"></td>
<td class="headcol headcol-week" ng-click="onTeamCollapseClick(row.ExpCatId, team, $event)">
<div class="restbl" style="padding-left:20px;">
<div>
<div>
<a title="{{ team.Name || 'empty' }}" href="#" style="display:inline-block;max-width:154px;overflow-x:hidden;text-overflow:ellipsis">
<i class="fa" ng-class="team.CollapsedClass" ng-if="!data.CalendarFilter.ShowActuals" style="margin-right: 5px;" ng-attr-title="{{team.Collapsed ? 'Expand' : 'Collapse'}}"></i>{{ team.Name || 'empty' }}
</a>
</div>
<div>
<button type="button" title="Fill remaining" class="btn btn-info btn-xs" ng-disabled="!data.CalendarFilter.IsTableModeQuantity" ng-click="assignRestForTeam(row, team, $event)"><i class="fa fa-asterisk"></i></button>
<button type="button" title="Take full available capacity" class="btn btn-primary btn-xs" ng-disabled="!data.CalendarFilter.IsTableModeQuantity" ng-click="assignAllForTeam(row, team, $event)"><i class="fa fa-plus"></i></button>
<button type="button" title="Zero this team" class="btn btn-success btn-xs" ng-disabled="!data.CalendarFilter.IsTableModeQuantity" ng-click="zeroTeam(row, team, $event)"><i class="fa fa-minus"></i></button>
<button ng-class="{hideView:!team.IsAccessible}" type="button" title="View on Calendar" class="btn btn-primary btn-xs" ng-click="goToTeamBoard(team.Id, $event)"><i class="fa fa-calendar"></i></button>
</div>
</div>
</div>
</td>
<td class="headcol">
<a href="#" editable-text="team.GrandTotalQuantity" e-name="ColValue" e-ng-blur="onTxtBlur(this);" onshow="watchKeyInput(this)" buttons="no"
blur="submit" onbeforesave="checkTeamTotalValue($data, row, team)" e-required
ng-show="data.CalendarFilter.IsTableModeQuantity" >
{{ team.GrandTotalQuantity || 0 | number:2 }}
</a>
<span ng-show="!data.CalendarFilter.IsTableModeQuantity">N/A</span>
</td>
<td class="{{team.CSSClass[$index]}}"
ng-class="{'droppable-active': row.ActiveDroppables[$index], 'draggable-selected': row.SelectedCells[$index]}"
ng-repeat="col in team.Cells track by $index"
ng-if="data.Calendar.WeekHeaders[$index].Initialized"
ng-show="data.Calendar.WeekHeaders[$index].Show">
<a href="#" editable-text="col" e-name="ColValue" e-ng-blur="onTxtBlur(this);" onshow="watchKeyInput(this)" buttons="no"
blur="submit" onbeforesave="checkTeamValue(row, team, $index, $data, true)" e-required
ng-show="data.CalendarFilter.IsTableModeQuantity ">
{{ (col || 0 | number:2) }}
</a>
<span ng-show="!data.CalendarFilter.IsTableModeQuantity">N/A</span>
</td>
</tr>
<tr ng-repeat="res in team.Resources track by $index" ng-show="!team.Collapsed && !row.Collapsed" ng-if="!team.Collapsed && !data.CalendarFilter.ShowActuals">
<td class="headcol"></td>
<td class="headcol"></td>
<td class="headcol">
<div class="restbl" style="padding-left:40px;">
<div>
<div>{{res.Name}}</div>
<div>
<button type="button" title="Fill remaining" class="btn btn-info btn-xs" ng-disabled="(row.Resources.length <= 1) || !data.CalendarFilter.IsTableModeQuantity" ng-click="assignRestForResource(row, team, res)"><i class="fa fa-asterisk"></i></button>
<button type="button" title="Take full available capacity" class="btn btn-primary btn-xs" ng-disabled="!data.CalendarFilter.IsTableModeQuantity" ng-click="assignAllForResource(row, team, res)"><i class="fa fa-plus"></i></button>
<button type="button" title="Zero this resource" class="btn btn-success btn-xs" ng-disabled="!data.CalendarFilter.IsTableModeQuantity" ng-click="zeroResource(row, team, res)"><i class="fa fa-minus"></i></button>
<button type="button" title="Remove this resource" class="btn btn-danger btn-xs" ng-disabled="!data.CalendarFilter.IsTableModeQuantity" ng-click="removeResource(row, team, res, $index)"><i class="fa fa-times"></i></button>
</div>
</div>
</div>
</td>
<td class="headcol">
<a href="#" editable-text="res.GrandTotalQuantity" e-name="ColValue" e-ng-blur="onTxtBlur(this);" onshow="watchKeyInput(this)" buttons="no"
blur="submit" onbeforesave="checkResourceTotalValue($data, row, team, res)" e-required
ng-show="data.CalendarFilter.IsTableModeQuantity">
{{ res.GrandTotalQuantity || 0 | number:2 }}
</a>
<span ng-show="!data.CalendarFilter.IsTableModeQuantity">N/A</span>
</td>
<td class="{{res.CSSClass[$index]}}"
ng-class="{'droppable-active': row.ActiveDroppables[$index], 'draggable-selected': row.SelectedCells[$index]}"
ng-repeat="col in res.Cells track by $index"
ng-if="data.Calendar.WeekHeaders[$index].Initialized"
ng-show="data.Calendar.WeekHeaders[$index].Show">
<a href="#" editable-text="col" e-name="ColValue" e-ng-blur="onTxtBlur(this);" onshow="watchKeyInput(this)" buttons="no"
blur="submit" onbeforesave="checkResourceValue(row, team, res, $index, $data, true)" e-required
ng-show="data.CalendarFilter.IsTableModeQuantity && !res.ReadOnly[$index]">
{{ col || 0 | number:2 }}
</a>
<span ng-show="data.CalendarFilter.IsTableModeQuantity && res.ReadOnly[$index]">
{{ col || 0 | number:2 }}
</span>
<span ng-show="!data.CalendarFilter.IsTableModeQuantity">N/A</span>
</td>
</tr>
<tr ng-repeat-end ng-if="3 != row.UseType && !data.CalendarFilter.ShowActuals" ng-show="!team.Collapsed && !row.Collapsed && team.AvailableResources.length > 0" class="resRow">
<td class="headcol"></td>
<td class="headcol"></td>
<td class="headcol assign" colspan="2">
<div class="col-sm-8 select2-primary">
<select ng-model="team.ResourceToAssignId" id="assign-resource-select-{{row.ExpCatId}}-{{team.Id}}">
<option></option>
<option ng-repeat="resource in team.AvailableResources track by $index" value="{{resource.id}}">
{{resource.name}}
</option>
</select>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-success"
ng-disabled="!team.ResourceToAssignId || !data.CalendarFilter.IsTableModeQuantity"
ng-click="assignResource(row, team, $event)">
Assign
</button>
</div>
</td>
<td colspan="{{data.VisibleCellCount}}"></td>
</tr>
<tr ng-if="3 != row.UseType && !data.CalendarFilter.ShowActuals" ng-show="!row.Collapsed && row.AvailableTeams.length > 0" class="resRow">
<td class="headcol"></td>
<td class="headcol"></td>
<td class="headcol assign" colspan="2">
<div class="col-sm-8 select2-primary">
<select ng-model="row.TeamToAssignId" id="assign-team-select-{{row.ExpCatId}}">
<option></option>
<option ng-repeat="team in row.AvailableTeams | orderBy: 'Name'" value="{{team.Id}}">
{{ team.Name}}
</option>
</select>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-success"
ng-disabled="!row.TeamToAssignId || !data.CalendarFilter.IsTableModeQuantity"
ng-click="assignTeam(row, $event)">
Assign
</button>
</div>
</td>
<td colspan="{{data.VisibleCellCount}}"></td>
</tr>
</tbody>
<tfoot ng-show="data.Calendar.Rows[0].Visible">
<tr>
<td colspan="5" style="text-align: right;" class="headcol">{{data.Calendar.Rows[0].ExpCatName}}</td>
<td class="headcol">
<a href="#" ng-if="data.Calendar.Rows[0].IsEditable"
editable-text="data.CalendarFilter.IsTableModeQuantity ? data.Calendar.Rows[0].GrandTotalQuantity : data.Calendar.Rows[0].GrandTotalCost"
e-name="ColValue" e-ng-blur="onTxtBlur(this);" onshow="watchKeyInput(this)" buttons="no" blur="submit"
onbeforesave="checkGrandTotalValue($data)" e-required>
{{ data.CalendarFilter.IsTableModeQuantity ? (data.Calendar.Rows[0].GrandTotalQuantity || 0 | number:2) : (data.Calendar.Rows[0].GrandTotalCost || 0 | currency) }}
</a>
<span ng-if="!data.Calendar.Rows[0].IsEditable">
{{ data.CalendarFilter.IsTableModeQuantity ? (data.Calendar.Rows[0].GrandTotalQuantity || 0 | number:2) : (data.Calendar.Rows[0].GrandTotalCost || 0 | currency) }}
</span>
</td>
<td ng-repeat="col in data.Calendar.Rows[0].Cells track by $index" ng-if="data.Calendar.WeekHeaders[$index].Initialized" ng-show="data.Calendar.WeekHeaders[$index].Show">
{{ data.CalendarFilter.IsTableModeQuantity ? (col || 0 | number:2) : (col || 0 | currency) }}
</td>
</tr>
</tfoot>