| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- export class reservation {
- email;
- phone_number;
- product_barcode;
- constructor(target = null) {
- this.email = null;
- this.phone_number = null;
- this.product_barcode = null;
- if (target === null) {
- return ;
- }
- if ("email" in target) {
- this.email = target["email"];
- }
- if ("target_barcode" in target) {
- this.product_barcode = target["target_barcode"];
- }
- if ("phone_number" in target) {
- this.phone_number = target["phone_number"];
- }
- }
- get dump() {
- const dumped = {
- "target_barcode": this.product_barcode
- };
- if (this.email !== null) {
- dumped["email"] = this.email;
- }
- if (this.phone_number !== null) {
- dumped["phone_number"] = this.phone_number;
- }
- return dumped;
- }
- get ready() {
- if (this.product_barcode === null) return false;
- if (this.email === null && this.phone_number === null) return false;
- return true;
- }
- copy() {
- return new reservation(this.dump);
- }
- }
|