Skip to content

Commit

Permalink
primeng: acquisitions accounts
Browse files Browse the repository at this point in the history
Co-Authored-by: Johnny Mariéthoz <[email protected]>
Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
jma and Garfield-fr committed Jan 28, 2025
1 parent 65deef6 commit b8b1460
Show file tree
Hide file tree
Showing 18 changed files with 471 additions and 708 deletions.
29 changes: 23 additions & 6 deletions projects/admin/src/app/acquisition/acquisition-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,33 @@ import { AccountListComponent } from './components/account/account-list/account-
import { AccountTransferComponent } from './components/account/account-transfer/account-transfer.component';
import { OrderReceiptViewComponent } from './components/receipt/receipt-form/order-receipt-view.component';
import { CanOrderReceiptGuard } from './routes/guards/can-order-receipt.guard';
import { AcquisitionMainComponent } from './components/acquisition-main/acquisition-main.component';

const routes: Routes = [
{ path: '', redirectTo: 'accounts', pathMatch: 'full' },
{ path: 'accounts/transfer', component: AccountTransferComponent, canActivate: [ PermissionGuard ], data: { permissions: [ PERMISSIONS.ACAC_TRANSFER ] } },
{ path: 'accounts', component: AccountListComponent, canActivate: [ PermissionGuard ], data: { permissions: [ PERMISSIONS.ACAC_ACCESS, PERMISSIONS.ACAC_SEARCH ], operator: PERMISSION_OPERATOR.AND } },
{ path: 'acq_orders/:pid/receive', component: OrderReceiptViewComponent, canActivate: [ CanOrderReceiptGuard ] }
{
path: '',
component: AcquisitionMainComponent,
children: [
{ path: '', redirectTo: 'accounts', pathMatch: 'full' },
{
path: 'accounts/transfer',
component: AccountTransferComponent,
canActivate: [PermissionGuard],
data: { permissions: [PERMISSIONS.ACAC_TRANSFER] },
},
{
path: 'accounts',
component: AccountListComponent,
canActivate: [PermissionGuard],
data: { permissions: [PERMISSIONS.ACAC_ACCESS, PERMISSIONS.ACAC_SEARCH], operator: PERMISSION_OPERATOR.AND },
},
{ path: 'acq_orders/:pid/receive', component: OrderReceiptViewComponent, canActivate: [CanOrderReceiptGuard] },
],
},
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
exports: [RouterModule],
})
export class AcquisitionRoutingModule { }
export class AcquisitionRoutingModule {}
7 changes: 3 additions & 4 deletions projects/admin/src/app/acquisition/acquisition.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { PreviewEmailModule } from '../shared/preview-email/preview-email.module
import { AcquisitionRoutingModule } from './acquisition-routing.module';
import { AcqAccountApiService } from './api/acq-account-api.service';
import { AcqOrderApiService } from './api/acq-order-api.service';
import { AccountBriefViewComponent } from './components/account/account-brief-view/account-brief-view.component';
import { AccountDetailViewComponent } from './components/account/account-detail-view/account-detail-view.component';
import { AccountListComponent } from './components/account/account-list/account-list.component';
import { AccountTransferComponent } from './components/account/account-transfer/account-transfer.component';
Expand Down Expand Up @@ -57,14 +56,13 @@ import { NoteBadgeColorPipe } from './pipes/note-badge-color.pipe';
import { PreviewContentPipe } from './pipes/preview-content.pipe';
import { ReceiptLineTotalAmountPipe } from './pipes/receipt-line-total-amount.pipe';
import { ReceptionDatesPipe } from './pipes/reception-dates.pipe';
import { ChipsModule } from 'primeng/chips';
import { PrimengImportModule } from '../shared/primeng-import/primeng-import.module';
import { NotesComponent } from './components/notes/notes.component';
import { AcquisitionMainComponent } from './components/acquisition-main/acquisition-main.component';

@NgModule({
declarations: [
AccountListComponent,
AccountBriefViewComponent,
AccountTransferComponent,
AccountDetailViewComponent,
BudgetsBriefViewComponent,
Expand All @@ -89,7 +87,8 @@ import { NotesComponent } from './components/notes/notes.component';
PreviewContentPipe,
ReceiptLineTotalAmountPipe,
OrderEmailFormComponent,
NotesComponent
NotesComponent,
AcquisitionMainComponent
],
imports: [
CommonModule,
Expand Down
138 changes: 0 additions & 138 deletions projects/admin/src/app/acquisition/acquisition.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class AcqAccountApiService {
const query = defaultQueryParams.join(' AND ');
options = { ...{sort: 'name'}, ...options }; // add some default params
return this.recordService
.getRecords(this.resourceName, query, 1, RecordService.MAX_REST_RESULTS_SIZE, undefined, undefined, undefined, options.sort)
.getRecords(this.resourceName, query, 1, RecordService.MAX_REST_RESULTS_SIZE, undefined, undefined, {'Accept': 'application/rero+json'}, options.sort)
.pipe(
map((result: Record) => this.recordService.totalHits(result.hits.total) === 0 ? [] : result.hits.hits),
map((hits: any[]) => hits.map(hit => ({...this.accountDefaultData, ...hit.metadata}) ))
Expand Down
1 change: 1 addition & 0 deletions projects/admin/src/app/acquisition/classes/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ export interface IAcqAccount extends IAcqBaseResource {
distribution: number;
budget: IObjectReference;
parent: IObjectReference;
number_of_children?: number;
}

This file was deleted.

Loading

0 comments on commit b8b1460

Please sign in to comment.