Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
quadrige
quadrige3-app
Commits
61f43153
Commit
61f43153
authored
Dec 22, 2020
by
PECQUOT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[enh] add unit in sampling-equipment.table.html (not finished)
parent
cf1c3a54
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
26 deletions
+38
-26
src/app/referential/services/referential-generic.service.ts
src/app/referential/services/referential-generic.service.ts
+12
-2
src/app/referential/table/referential.table.ts
src/app/referential/table/referential.table.ts
+0
-1
src/app/referential/table/sampling-equipment.table.html
src/app/referential/table/sampling-equipment.table.html
+9
-20
src/app/referential/table/sampling-equipment.table.ts
src/app/referential/table/sampling-equipment.table.ts
+17
-3
src/app/shared/directive/resizable-old/resizable-column.directive.ts
...red/directive/resizable-old/resizable-column.directive.ts
+0
-0
src/app/shared/directive/resizable-old/resizable-table.directive.ts
...ared/directive/resizable-old/resizable-table.directive.ts
+0
-0
No files found.
src/app/referential/services/referential-generic.service.ts
View file @
61f43153
/* eslint-disable no-throw-literal */
import
{
Inject
,
Injectable
}
from
"
@angular/core
"
;
import
{
BaseEntityService
,
EntitiesService
,
EntityUtils
,
EnvironmentService
,
GraphqlService
,
LoadResult
,
PlatformService
,
Referential
,
ReferentialUtils
}
from
"
sumaris-lib
"
;
import
{
BaseEntityService
,
EntitiesService
,
EntityUtils
,
EnvironmentService
,
GraphqlService
,
LoadResult
,
PlatformService
,
Referential
,
ReferentialUtils
,
SuggestService
}
from
"
sumaris-lib
"
;
import
{
ReferentialQueries
}
from
"
@app/referential/services/referential.queries
"
;
import
gql
from
"
graphql-tag
"
;
import
{
referentialFragments
}
from
"
@app/referential/services/referential.fragments
"
;
...
...
@@ -74,7 +74,7 @@ const loadReferentialTypesQuery: any = gql`
@
Injectable
({
providedIn
:
'
root
'
})
export
class
ReferentialGenericService
extends
BaseEntityService
<
Referential
>
implements
EntitiesService
<
Referential
,
ReferentialFilter
>
{
implements
EntitiesService
<
Referential
,
ReferentialFilter
>
,
SuggestService
<
Referential
,
ReferentialFilter
>
{
constructor
(
protected
graphql
:
GraphqlService
,
...
...
@@ -207,6 +207,16 @@ implements EntitiesService<Referential, ReferentialFilter> {
}
async
suggest
(
value
:
any
,
filter
?:
ReferentialFilter
,
sortBy
?:
keyof
Referential
,
sortDirection
?:
SortDirection
):
Promise
<
Referential
[]
>
{
if
(
ReferentialUtils
.
isNotEmpty
(
value
))
return
[
value
];
value
=
(
typeof
value
===
"
string
"
&&
value
!==
'
*
'
)
&&
value
||
undefined
;
const
res
=
await
this
.
loadAll
(
0
,
!
value
?
30
:
10
,
sortBy
,
sortDirection
,
{
...
filter
,
searchText
:
value
},
{
withTotal
:
false
/* total not need */
}
);
return
res
.
data
;
}
async
saveAll
(
entities
:
Referential
[],
options
?:
any
):
Promise
<
Referential
[]
>
{
if
(
!
entities
)
return
entities
;
...
...
src/app/referential/table/referential.table.ts
View file @
61f43153
...
...
@@ -12,7 +12,6 @@ import {BehaviorSubject} from "rxjs";
import
{
debounceTime
,
filter
}
from
"
rxjs/operators
"
;
import
{
CanLeave
}
from
"
@app/shared/table/component-dirty.guard
"
;
import
{
CommentModal
}
from
"
@app/shared/comment/comment.modal
"
;
import
{
ReferentialGenericService
}
from
"
@app/referential/services/referential-generic.service
"
;
@
Directive
()
...
...
src/app/referential/table/sampling-equipment.table.html
View file @
61f43153
...
...
@@ -217,26 +217,15 @@
</ng-container>
<!-- Unit column -->
<!-- <ng-container matColumnDef="unit">-->
<!-- <th mat-header-cell *matHeaderCellDef [resizableColumn]="true" [resizableColumnDef]="'unit'" resizable>-->
<!-- <span mat-sort-header cdkDrag><ion-label translate>REFERENTIAL.SAMPLING_EQUIPMENT.UNIT</ion-label></span>-->
<!-- </th>-->
<!-- <td mat-cell *matCellDef="let row" [class.mat-form-field-disabled]="!row.editing">-->
<!-- <mat-form-field floatLabel="never">-->
<!-- <ion-icon matPrefix *ngIf="row.validator.controls.unitId.value >= 0" [name]="statusById[row.validator.controls.unitId.value]?.icon"></ion-icon>-->
<!-- <mat-select [formControl]="row.validator.controls.unitId" [placeholder]="'REFERENTIAL.SAMPLING_EQUIPMENT.UNIT'|translate">-->
<!-- <mat-select-trigger>-->
<!-- <span *ngIf="row.validator.controls.unitId.value >= 0">-->
<!-- {{ unitsById[row.validator.controls.unitId.value]?.label | translate}}</span>-->
<!-- </mat-select-trigger>-->
<!-- <mat-option *ngFor="let item of unitsList" [value]="item.id">-->
<!-- <ion-icon [name]="item.icon"></ion-icon>-->
<!-- {{ item.label |translate }}-->
<!-- </mat-option>-->
<!-- </mat-select>-->
<!-- </mat-form-field>-->
<!-- </td>-->
<!-- </ng-container>-->
<ng-container
matColumnDef=
"unit"
>
<th
mat-header-cell
*matHeaderCellDef
[resizableColumn]=
"true"
[resizableColumnDef]=
"'unit'"
resizable
>
<span
mat-sort-header
cdkDrag
><ion-label
translate
>
REFERENTIAL.SAMPLING_EQUIPMENT.UNIT
</ion-label></span>
</th>
<td
mat-cell
*matCellDef=
"let row"
[class.mat-form-field-disabled]=
"!row.editing"
>
</td>
</ng-container>
<!-- Comment column -->
<ng-container
matColumnDef=
"comments"
>
...
...
src/app/referential/table/sampling-equipment.table.ts
View file @
61f43153
...
...
@@ -6,6 +6,7 @@ import {ActivatedRoute} from "@angular/router";
import
{
SamplingEquipmentService
}
from
"
@app/referential/services/sampling-equipment.service
"
;
import
{
SamplingEquipmentValidator
}
from
"
@app/referential/validator/sampling-equipment.validator
"
;
import
{
CdkDragDrop
,
moveItemInArray
}
from
"
@angular/cdk/drag-drop
"
;
import
{
ReferentialGenericService
}
from
"
@app/referential/services/referential-generic.service
"
;
@
Component
({
selector
:
'
app-sampling-equipment-table
'
,
...
...
@@ -17,8 +18,9 @@ export class SamplingEquipmentTable extends ReferentialTable<SamplingEquipment,
constructor
(
protected
injector
:
Injector
,
protected
referential
Service
:
SamplingEquipmentService
,
protected
samplingEquipment
Service
:
SamplingEquipmentService
,
protected
validatorService
:
SamplingEquipmentValidator
,
protected
referentialService
:
ReferentialGenericService
,
@
Inject
(
EnvironmentService
)
protected
environment
)
{
super
(
injector
,
injector
.
get
(
ActivatedRoute
),
...
...
@@ -28,14 +30,14 @@ export class SamplingEquipmentTable extends ReferentialTable<SamplingEquipment,
'
name
'
,
'
description
'
,
'
size
'
,
//
'unit',
'
unit
'
,
'
comments
'
,
'
status
'
,
'
creationDate
'
,
'
updateDate
'
,
])
.
concat
(
RESERVED_END_COLUMNS
),
new
EntitiesTableDataSource
<
SamplingEquipment
,
SamplingEquipmentFilter
>
(
SamplingEquipment
,
referential
Service
,
environment
,
validatorService
,
{
new
EntitiesTableDataSource
<
SamplingEquipment
,
SamplingEquipmentFilter
>
(
SamplingEquipment
,
samplingEquipment
Service
,
environment
,
validatorService
,
{
prependNewElements
:
false
,
suppressErrors
:
environment
.
production
,
dataServiceOptions
:
{
...
...
@@ -52,6 +54,18 @@ export class SamplingEquipmentTable extends ReferentialTable<SamplingEquipment,
});
}
ngOnInit
()
{
super
.
ngOnInit
();
// Unit combo
this
.
registerAutocompleteField
(
'
unit
'
,
{
service
:
this
.
referentialService
,
filter
:
{
entityName
:
'
Unit
'
}
});
}
ngAfterViewInit
()
{
super
.
ngAfterViewInit
();
...
...
src/app/shared/directive/resizable-column.directive.ts
→
src/app/shared/directive/resizable-
old/resizable-
column.directive.ts
View file @
61f43153
File moved
src/app/shared/directive/resizable-table.directive.ts
→
src/app/shared/directive/resizable-
old/resizable-
table.directive.ts
View file @
61f43153
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment