Skip to content

Commit

Permalink
Merge pull request #115 from sancsoft/psr-list-updates
Browse files Browse the repository at this point in the history
PSR list updates
  • Loading branch information
rmaffitsancsoft authored Jun 11, 2024
2 parents 17ed68c + 51ca74b commit ee78773
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 58 deletions.
8 changes: 7 additions & 1 deletion src/angular/hq/src/app/models/PSR/get-PSR-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export enum SortColumn {
BookingHours = 16,
BookingAvailableHours = 17,
TotalPercentComplete = 18,
BookingPercentComplete = 19
BookingPercentComplete = 19,
SummaryHoursTotal = 20,
SummaryHoursAvailable = 21,
SummaryPercentComplete = 22
}

export interface GetPSRRecordV1 {
Expand Down Expand Up @@ -68,6 +71,9 @@ export interface GetPSRRecordV1 {
lastHours?: number;
submittedAt?: Date | null;
isLate: boolean;
summaryHoursTotal: number;
summaryHoursAvailable: number;
summaryPercentComplete: number;
}

export interface GetPSRRecordsV1 {
Expand Down
91 changes: 43 additions & 48 deletions src/angular/hq/src/app/psr/psrlist/psrlist.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,18 @@ <h1 class="font-rajdhani font-semibold text-3xl">PSR</h1>
<th width="100" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer" (click)="onSortClick(sortColumn.ProjectManagerName)">PM
<hq-sort-icon [column]="sortColumn.ProjectManagerName" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
<th width="150" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right" (click)="onSortClick(sortColumn.ThisHours)">Hrs This
<th width="170" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right" (click)="onSortClick(sortColumn.ThisHours)">Hrs This
<hq-sort-icon [column]="sortColumn.ThisHours" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
<th width="150" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right" (click)="onSortClick(sortColumn.BookingHours)">Hrs Book
<hq-sort-icon [column]="sortColumn.BookingHours" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
<th width="170" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right" (click)="onSortClick(sortColumn.SummaryHoursTotal)">Hrs Total
<hq-sort-icon [column]="sortColumn.SummaryHoursTotal" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
<th width="150" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right" (click)="onSortClick(sortColumn.BookingAvailableHours)">Hrs Avl Book
<hq-sort-icon [column]="sortColumn.BookingAvailableHours" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
<th width="170" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right pe-2" (click)="onSortClick(sortColumn.SummaryHoursAvailable)">Hrs Available
<hq-sort-icon [column]="sortColumn.SummaryHoursAvailable" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
<th width="150" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right" (click)="onSortClick(sortColumn.TotalHours)">Hrs Total
<hq-sort-icon [column]="sortColumn.TotalHours" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
<th width="150" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer text-right pe-2" (click)="onSortClick(sortColumn.TotalAvailableHours)">Hrs Avl Total
<hq-sort-icon [column]="sortColumn.TotalAvailableHours" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
<th scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer" (click)="onSortClick(sortColumn.BookingPercentComplete)">Booking %
<hq-sort-icon [column]="sortColumn.BookingPercentComplete" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
<th scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer" colspan="2" (click)="onSortClick(sortColumn.TotalPercentComplete)">Total %
<hq-sort-icon [column]="sortColumn.TotalPercentComplete" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
<th width="150" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3">Status</th>
<th colspan="2" scope="col" class="bg-blue-900 border-steel-blue-600 border-y py-3 cursor-pointer" (click)="onSortClick(sortColumn.SummaryPercentComplete)">Complete %
<hq-sort-icon [column]="sortColumn.SummaryPercentComplete" [activeColumn]="sortOption$ | async" [activeSortDirection]="sortDirection$ | async" />
</th>
</tr>

Expand All @@ -80,49 +72,52 @@ <h1 class = "text-center py-4 font-bold">No matching records found</h1>
</td>
}
@for((report of projectStatusReports$ | async); track report.id) {
<tr [class]="report.isLate ? 'bg-red-950' : 'even:bg-gray-850 odd:bg-black-alt'">
<tr [class]="report.isLate ? 'bg-red-850' : 'even:bg-gray-850 odd:bg-black-alt'">
<td class="border-b border-black py-2 pl-5">{{report.chargeCode}}</td>
<td class="border-b border-black py-2">{{report.startDate}}</td>
<td class="border-b border-black py-2">{{report.endDate}}</td>
<td class="border-b border-black py-2">{{report.clientName}}</td>
<td class="border-b border-black py-2">{{report.projectName}}</td>
<td class="border-b border-black py-2">{{report.projectManagerName}}</td>
<td class="border-b border-black py-2 text-right">{{report.thisHours | number: '0.2-2'}}</td>
<td class="border-b border-black py-2 text-right">{{report.bookingHours | number: '0.2-2'}}</td>
<td class="border-b border-black py-2 text-right">{{report.bookingAvailableHours | number: '0.2-2'}}</td>
<td class="border-b border-black py-2 text-right">{{report.totalHours | number: '0.2-2'}}</td>
<td class="border-b border-black py-2 text-right pe-2">{{report.totalAvailableHours | number: '0.2-2'}}</td>
<td class="border-b border-black py-2 text-right">{{report.summaryHoursTotal | number: '0.2-2'}}</td>
<td class="border-b border-black py-2 text-right pe-2">{{report.summaryHoursAvailable | number: '0.2-2'}}</td>
<td class="border-b border-black py-2">{{getProjectSatusString(report.status)}}</td>
<td width="200" class="border-b border-black py-2 pe-2">
@if(report.bookingPercentComplete && report.bookingPercentComplete > 1) {
<div class="w-full bg-gray-450 border border-red-850 h-[10px]" title="{{ report.bookingStartDate }} - {{ report.bookingEndDate }}">
<div class="bg-red-850 h-[8px]" [style.width.%]="Math.min(report.bookingPercentComplete - 1, 1) * 100"></div>
</div>
} @else {
<div class="w-full bg-gray-500 border border-white h-[10px]" title="{{ report.bookingStartDate }} - {{ report.bookingEndDate }}">
<div class="bg-white h-[8px]" [style.width.%]="(report.bookingPercentComplete ?? 0) * 100"></div>
</div>
@if(report.status == ProjectStatus.Ongoing)
{
@if(report.bookingPercentComplete && report.bookingPercentComplete > 1) {
<div class="w-full bg-gray-450 border border-red-950 h-[10px]" title="{{ report.bookingStartDate }} - {{ report.bookingEndDate }}">
<div class="bg-red-950 h-[8px]" [style.width.%]="Math.min(report.bookingPercentComplete - 1, 1) * 100"></div>
</div>
} @else {
<div class="w-full bg-gray-500 border border-white h-[10px]" title="{{ report.bookingStartDate }} - {{ report.bookingEndDate }}">
<div class="bg-white h-[8px]" [style.width.%]="(report.bookingPercentComplete ?? 0) * 100"></div>
</div>
}
<div class="flex justify-between gap-2 text-xs text-gray-300">
<span class="lowercase">{{ report.bookingHours | number: '0.2-2' }} hrs this {{ getPeriodName(report.bookingPeriod) }} to date</span>
<span>{{ report.bookingPercentComplete | percent }}</span>
</div>
}
<div class="flex justify-between gap-2 text-xs text-gray-300">
<span class="lowercase">{{ report.bookingHours | number: '0.2-2' }} hrs this {{ getPeriodName(report.bookingPeriod) }} to date</span>
<span>{{ report.bookingPercentComplete | percent }}</span>
</div>
</td>
<td width="200" class="border-b border-black py-2">
@if(report.totalPercentComplete && report.totalPercentComplete > 1) {
<div class="w-full bg-gray-450 border border-red-850 h-[10px]" title="{{ report.totalStartDate ?? '-' }} - {{ report.totalEndDate ?? '-' }}">
<div class="bg-red-850 h-[8px]" [style.width.%]="Math.min(report.totalPercentComplete - 1, 1) * 100"></div>
</div>
} @else {
<div class="w-full bg-gray-500 border border-white h-[10px]" title="{{ report.totalStartDate ?? '-' }} - {{ report.totalEndDate ?? '-' }}">
<div class="bg-white h-[8px]" [style.width.%]="(report.totalPercentComplete ?? 0) * 100"></div>
</div>
@if(report.status == ProjectStatus.InProduction)
{
@if(report.totalPercentComplete && report.totalPercentComplete > 1) {
<div class="w-full bg-gray-450 border border-red-950 h-[10px]" title="{{ report.totalStartDate ?? '-' }} - {{ report.totalEndDate ?? '-' }}">
<div class="bg-red-950 h-[8px]" [style.width.%]="Math.min(report.totalPercentComplete - 1, 1) * 100"></div>
</div>
} @else {
<div class="w-full bg-gray-500 border border-white h-[10px]" title="{{ report.totalStartDate ?? '-' }} - {{ report.totalEndDate ?? '-' }}">
<div class="bg-white h-[8px]" [style.width.%]="(report.totalPercentComplete ?? 0) * 100"></div>
</div>
}
<div class="flex justify-between gap-2 text-xs text-gray-300">
<span>{{ report.totalHours | number: '0.2-2' }} hrs total</span>
<span>{{ report.totalPercentComplete != null ? (report.totalPercentComplete | percent) : '-' }}</span>
</div>
}
<div class="flex justify-between gap-2 text-xs text-gray-300">
<span>{{ report.totalHours | number: '0.2-2' }} hrs total</span>
<span>{{ report.totalPercentComplete != null ? (report.totalPercentComplete | percent) : '-' }}</span>
</div>
</td>
<td class="border-b border-black py-2 text-right pr-5"><a [routerLink]="[report.id]" class="truncate text-teal-200 hover:text-teal-300">VIEW</a></td>
<td width="80" class="border-b border-black py-2 text-right pr-5"><a [routerLink]="[report.id]" class="truncate text-teal-200 hover:text-teal-300">VIEW</a></td>
</tr>
}

Expand Down
1 change: 1 addition & 0 deletions src/angular/hq/src/app/psr/psrlist/psrlist.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class PSRListComponent implements OnInit, OnDestroy {
Math = Math;
sortColumn = SortColumn;
sortDirection = SortDirection;
ProjectStatus = ProjectStatus;

async ngOnInit() {
this.psrListService.showSearch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public enum SortColumn
BookingAvailableHours = 17,
TotalPercentComplete = 18,
BookingPercentComplete = 19,
SummaryHoursTotal = 20,
SummaryHoursAvailable = 21,
SummaryPercentComplete = 22,
}

public class Response : PagedResponseV1<Record>
Expand Down Expand Up @@ -98,11 +101,16 @@ public class Record
public DateOnly? TotalEndDate { get; set; }
public DateOnly StartDate { get; set; }
public DateOnly EndDate { get; set; }
public DateOnly BookingStartDate { get; set; }
public DateOnly BookingEndDate { get; set; }
public DateOnly? BookingStartDate { get; set; }
public DateOnly? BookingEndDate { get; set; }
public Period BookingPeriod { get; set; }
public Guid? LastId { get; set; }
public decimal? LastHours { get; set; }
public bool IsLate { get; set; }

public decimal? SummaryHoursTotal { get; set; }
public decimal? SummaryHoursAvailable { get; set; }
public decimal? SummaryPercentComplete { get; set; }
public decimal? SummaryPercentCompleteSort { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
migrationBuilder.Sql("UPDATE projects p SET status = 5 FROM charge_codes c WHERE p.id = c.project_id AND c.code LIKE 'Q%'");
migrationBuilder.Sql("UPDATE projects p SET status = 6 FROM charge_codes c WHERE p.id = c.project_id AND c.code LIKE 'P%'");
migrationBuilder.Sql("UPDATE projects p SET status = 6 FROM charge_codes c WHERE p.id = c.project_id AND c.code LIKE 'S%'");
migrationBuilder.Sql("UPDATE project_status_reports psr SET status = p.status FROM projects p WHERE p.id = psr.project_id");
}

/// <inheritdoc />
Expand Down
Loading

0 comments on commit ee78773

Please sign in to comment.