blob: fb7fd68dd40721d78159aeace7b2097a785336e8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
export default class Product {
id = 0;
name = "";
description = "";
cents = 0;
quantity = 0;
featured = false;
photo_base = "";
photo_fullsize = "";
photo_thumbnail = "";
category = "";
constructor(from) {
if (from) {
this.id = from.id;
this.name = from.name;
this.description = from.description;
this.cents = from.cents;
this.quantity = from.quantity;
this.featured = from.featured;
this.photo_base = from.photo_base;
this.photo_fullsize = from.photo_fullsize;
this.photo_thumbnail = from.photo_thumbnail;
this.category = from.category;
}
}
isDifferent(product) {
return (
this.id != product.id ||
this.name != product.name ||
this.quantity != product.quantity ||
this.cents != product.cents ||
this.photo_base != product.photo_base ||
this.photo_thumbnail != product.photo_thumbnail ||
this.photo_fullsize != product.photo_fullsize ||
this.description != product.description ||
this.featured != product.featured ||
this.category != product.category
);
}
isValid() {
return (
this.cents > 0 &&
this.name != "" &&
this.photo_thumbnail != "" &&
this.photo_base != "" &&
this.photo_fullsize != "" &&
this.category != "" &&
this.description != ""
);
}
}
|