Skip to content

Commit 28f19f1

Browse files
committed
Native enums almost everywhere #11052
1 parent 327baf0 commit 28f19f1

File tree

55 files changed

+319
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+319
-370
lines changed

client/app/admin/order/services/order-lines.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class OrderLineService extends NaturalAbstractModelService<
5050
pricePerUnit: null,
5151
quantity: 0,
5252
isCHF: true,
53-
type: ProductType.digital,
53+
type: ProductType.Digital,
5454
additionalEmails: [],
5555
};
5656
}

client/app/admin/products/services/product.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class ProductService extends NaturalAbstractModelService<
101101
releaseDate: null,
102102
review: null,
103103
reviewNumber: null,
104-
type: ProductType.digital,
104+
type: ProductType.Digital,
105105
readingDuration: null,
106106
file: null,
107107
};

client/app/front-office/components/soutenir/rejoindre-association/rejoindre-association.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1 class="mat-headline-4">REJOINDRE L’ASSOCIATION</h1>
1616
pertinentes à entreprendre.
1717
</p>
1818

19-
<app-add-to-cart label="Rejoindre l'association" [product]="membershipProduct" [type]="ProductType.other" />
19+
<app-add-to-cart label="Rejoindre l'association" [product]="membershipProduct" [type]="ProductType.Other" />
2020
</div>
2121
</div>
2222
</div>

client/app/front-office/modules/cart/classes/cart.spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,62 +41,62 @@ describe('Cart', () => {
4141
it('should add to cart', () => {
4242
expect(cart.productLines).withContext('cart to be empty').toEqual([]);
4343

44-
cart.addProduct(product1, ProductType.paper, 1);
44+
cart.addProduct(product1, ProductType.Paper, 1);
4545

46-
const expectedCart = [{product: product1, quantity: 1, totalTaxInc: 10, type: ProductType.paper}] as CartLine[];
46+
const expectedCart = [{product: product1, quantity: 1, totalTaxInc: 10, type: ProductType.Paper}] as CartLine[];
4747

4848
expect(cart.productLines).withContext('cart have one product').toEqual(expectedCart);
4949
});
5050

5151
it('should addProduct quantity for existing product into cart', () => {
52-
cart.addProduct(product1, ProductType.paper, 1);
53-
cart.addProduct(product1, ProductType.paper, 1);
52+
cart.addProduct(product1, ProductType.Paper, 1);
53+
cart.addProduct(product1, ProductType.Paper, 1);
5454

55-
const expectedCart = [{product: product1, quantity: 2, totalTaxInc: 20, type: ProductType.paper}] as CartLine[];
55+
const expectedCart = [{product: product1, quantity: 2, totalTaxInc: 20, type: ProductType.Paper}] as CartLine[];
5656

5757
expect(cart.productLines).withContext('cart have one product').toEqual(expectedCart);
5858
expect(cart.totalTaxInc).toEqual(20);
5959
});
6060

6161
it('should add two different products to cart', () => {
62-
cart.addProduct(product1, ProductType.paper, 1);
63-
cart.addProduct(product2, ProductType.paper, 1);
62+
cart.addProduct(product1, ProductType.Paper, 1);
63+
cart.addProduct(product2, ProductType.Paper, 1);
6464

6565
const expectedCart = [
66-
{product: product1, quantity: 1, totalTaxInc: 10, type: ProductType.paper},
67-
{product: product2, quantity: 1, totalTaxInc: 100, type: ProductType.paper},
66+
{product: product1, quantity: 1, totalTaxInc: 10, type: ProductType.Paper},
67+
{product: product2, quantity: 1, totalTaxInc: 100, type: ProductType.Paper},
6868
] as CartLine[];
6969

7070
expect(cart.productLines).toEqual(expectedCart);
7171
expect(cart.totalTaxInc).toEqual(110);
7272
});
7373

7474
it('should add more than one unit to cart', () => {
75-
cart.addProduct(product1, ProductType.paper, 2);
75+
cart.addProduct(product1, ProductType.Paper, 2);
7676

77-
const expectedCart = [{product: product1, quantity: 2, totalTaxInc: 20, type: ProductType.paper}] as CartLine[];
77+
const expectedCart = [{product: product1, quantity: 2, totalTaxInc: 20, type: ProductType.Paper}] as CartLine[];
7878

7979
expect(cart.productLines).toEqual(expectedCart);
8080
expect(cart.totalTaxInc).toEqual(20);
8181
});
8282

8383
it('should add decimals quantity', () => {
84-
cart.addProduct(product3, ProductType.paper, 0.5);
84+
cart.addProduct(product3, ProductType.Paper, 0.5);
8585

8686
const expectedCart = [
87-
{product: product3, quantity: 0.5, totalTaxInc: 500, type: ProductType.paper},
87+
{product: product3, quantity: 0.5, totalTaxInc: 500, type: ProductType.Paper},
8888
] as CartLine[];
8989

9090
expect(cart.productLines).toEqual(expectedCart);
9191
expect(cart.totalTaxInc).toEqual(500);
9292
});
9393

9494
it('should add product decimals quantity to existing products in cart', () => {
95-
cart.addProduct(product3, ProductType.paper, 0.5);
96-
cart.addProduct(product3, ProductType.paper, 2.5);
95+
cart.addProduct(product3, ProductType.Paper, 0.5);
96+
cart.addProduct(product3, ProductType.Paper, 2.5);
9797

9898
const expectedCart = [
99-
{product: product3, quantity: 3, totalTaxInc: 3000, type: ProductType.paper},
99+
{product: product3, quantity: 3, totalTaxInc: 3000, type: ProductType.Paper},
100100
] as CartLine[];
101101

102102
expect(cart.productLines).toEqual(expectedCart);

client/app/front-office/modules/cart/components/create-order/create-order.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<h1 class="mat-headline-4">MÉTHODE DE PAIEMENT</h1>
66
<mat-radio-group formControlName="paymentMethod" class="nat-vertical nat-gap-10">
77
<div class="payment-method">
8-
<mat-radio-button [value]="PaymentMethod.datatrans"
8+
<mat-radio-button [value]="PaymentMethod.Datatrans"
99
>Paiement par carte de crédit
1010
</mat-radio-button>
1111
</div>
1212
<div>
13-
<mat-radio-button [value]="PaymentMethod.bvr">Recevoir une facture</mat-radio-button>
13+
<mat-radio-button [value]="PaymentMethod.Bvr">Recevoir une facture</mat-radio-button>
1414
</div>
1515
</mat-radio-group>
1616
<h1 class="mat-headline-4">Votre adresse</h1>

client/app/front-office/modules/cart/components/create-order/create-order.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class CreateOrderComponent implements OnInit {
142142
}
143143

144144
// For datatrans, we ask for payment immediately
145-
if (paymentMethod.value === PaymentMethod.datatrans) {
145+
if (paymentMethod.value === PaymentMethod.Datatrans) {
146146
this.datatrans(order, this.cart.totalTaxInc, this.currencyService.current.value);
147147
} else {
148148
this.confirmationRedirect();

client/app/front-office/modules/cart/services/cart.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class CartService {
5858
if (cart.donationAmount) {
5959
orderLines.push({
6060
quantity: 1,
61-
type: ProductType.digital,
61+
type: ProductType.Digital,
6262
isCHF: isCHF,
6363
pricePerUnit: cart.donationAmount.toFixed(2),
6464
});

client/app/front-office/modules/shop/components/product-page/product-page.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ <h2 class="mat-h2">Téléchargement</h2>
145145
label="Version papier"
146146
[buttonColor]="null"
147147
[product]="data.model"
148-
[type]="ProductType.paper"
148+
[type]="ProductType.Paper"
149149
/>
150150
</div>
151151
}
@@ -158,7 +158,7 @@ <h2 class="mat-h2">Téléchargement</h2>
158158
label="Version numérique"
159159
[buttonColor]="null"
160160
[product]="data.model"
161-
[type]="ProductType.digital"
161+
[type]="ProductType.Digital"
162162
/>
163163
</div>
164164
}

client/app/front-office/modules/shop/components/product-page/product-page.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ export class ProductPageComponent extends NaturalAbstractDetail<ProductService>
128128

129129
// Show button to buy only if we didn't already bought those version
130130
this.purchaseService.getAll(qvm).subscribe(purchases => {
131-
const digital = [ProductType.both, ProductType.digital];
132-
const paper = [ProductType.both, ProductType.paper];
131+
const digital = [ProductType.Both, ProductType.Digital];
132+
const paper = [ProductType.Both, ProductType.Paper];
133133

134134
this.showBuyDigital =
135135
digital.includes(this.data.model.type) &&

client/app/front-office/modules/shop/components/subscriptions/subscription.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class SubscriptionService extends NaturalAbstractModelService<
7373
internalRemarks: '',
7474
isActive: true,
7575
image: null,
76-
type: ProductType.digital,
76+
type: ProductType.Digital,
7777
};
7878
}
7979
}

0 commit comments

Comments
 (0)