Skip to content

Commit d5b79f1

Browse files
committed
[ACTIONS] picqer - new components
1 parent 85caf1b commit d5b79f1

File tree

20 files changed

+469
-12
lines changed

20 files changed

+469
-12
lines changed

components/picqer/actions/add-order-comment/add-order-comment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "picqer-add-order-comment",
55
name: "Add Comment To Order",
66
description: "Add a comment to an order in Picqer. [See the documentation](https://picqer.com/en/api/comments#adding-comments-to-an-order)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import app from "../../picqer.app.mjs";
2+
3+
export default {
4+
key: "picqer-add-order-tags",
5+
name: "Add Order Tags",
6+
description: "Associates a tag with an order. [See the documentation](https://picqer.com/en/api/orders)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
orderId: {
17+
propDefinition: [
18+
app,
19+
"orderId",
20+
],
21+
},
22+
tagId: {
23+
propDefinition: [
24+
app,
25+
"tagId",
26+
],
27+
},
28+
},
29+
async run({ $ }) {
30+
const response = await this.app.addOrderTags({
31+
$,
32+
orderId: this.orderId,
33+
data: {
34+
idtag: this.tagId,
35+
},
36+
});
37+
38+
$.export("$summary", `Successfully added tag to order ${this.orderId}`);
39+
return response;
40+
},
41+
};
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import app from "../../picqer.app.mjs";
2+
3+
export default {
4+
key: "picqer-add-product-to-order",
5+
name: "Add Product To Order",
6+
description: "Adds a single product to concept orders only. [See the documentation](https://picqer.com/en/api/orders)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
orderId: {
17+
propDefinition: [
18+
app,
19+
"orderId",
20+
() => ({
21+
params: {
22+
status: "concept",
23+
},
24+
}),
25+
],
26+
},
27+
productId: {
28+
propDefinition: [
29+
app,
30+
"productId",
31+
],
32+
},
33+
amount: {
34+
type: "integer",
35+
label: "Amount",
36+
description: "The quantity of the product to add",
37+
default: 1,
38+
},
39+
price: {
40+
type: "string",
41+
label: "Price",
42+
description: "The price of the product",
43+
optional: true,
44+
},
45+
name: {
46+
type: "string",
47+
label: "Name",
48+
description: "The name of the product",
49+
optional: true,
50+
},
51+
remarks: {
52+
type: "string",
53+
label: "Remarks",
54+
description: "Remarks for the product",
55+
optional: true,
56+
},
57+
},
58+
async run({ $ }) {
59+
const response = await this.app.addProductToOrder({
60+
$,
61+
orderId: this.orderId,
62+
data: {
63+
idproduct: this.productId,
64+
amount: this.amount,
65+
price: this.price,
66+
name: this.name,
67+
remarks: this.remarks,
68+
},
69+
});
70+
71+
$.export("$summary", `Successfully added product to order ${this.orderId}`);
72+
return response;
73+
},
74+
};

components/picqer/actions/add-return-comment/add-return-comment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "picqer-add-return-comment",
55
name: "Add Comment To Return",
66
description: "Add a comment to a return in Picqer. [See the documentation](https://picqer.com/en/api/comments#add-a-comment-to-an-return)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import app from "../../picqer.app.mjs";
2+
3+
export default {
4+
key: "picqer-cancel-order",
5+
name: "Cancel Order",
6+
description: "Removes orders with 'concept' or 'expected' status only. [See the documentation](https://picqer.com/en/api/orders)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: true,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
orderId: {
17+
propDefinition: [
18+
app,
19+
"orderId",
20+
],
21+
},
22+
force: {
23+
type: "boolean",
24+
label: "Force Cancel",
25+
description: "If enabled, cancels orders regardless of status, removing attached picklists even if picked",
26+
optional: true,
27+
},
28+
},
29+
async run({ $ }) {
30+
const {
31+
app,
32+
orderId,
33+
force,
34+
} = this;
35+
36+
await app.cancelOrder({
37+
$,
38+
orderId,
39+
params: {
40+
force,
41+
},
42+
});
43+
$.export("$summary", "Successfully canceled order");
44+
return {
45+
success: true,
46+
};
47+
},
48+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import app from "../../picqer.app.mjs";
2+
3+
export default {
4+
key: "picqer-change-order-to-concept",
5+
name: "Change Order To Concept",
6+
description: "Converts expected orders back to concept status for editing. [See the documentation](https://picqer.com/en/api/orders)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
orderId: {
17+
propDefinition: [
18+
app,
19+
"orderId",
20+
() => ({
21+
params: {
22+
status: "expected",
23+
},
24+
}),
25+
],
26+
},
27+
},
28+
async run({ $ }) {
29+
const response = await this.app.changeOrderToConcept({
30+
$,
31+
orderId: this.orderId,
32+
});
33+
34+
$.export("$summary", `Successfully changed order ${this.orderId} to concept status`);
35+
return response;
36+
},
37+
};

components/picqer/actions/create-order/create-order.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "picqer-create-order",
88
name: "Create Picqer Order",
99
description: "Create a new order in Picqer. [See the documentation](https://picqer.com/en/api/orders)",
10-
version: "0.0.2",
10+
version: "0.0.3",
1111
annotations: {
1212
destructiveHint: false,
1313
openWorldHint: true,

components/picqer/actions/get-customer/get-customer.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "picqer-get-customer",
55
name: "Get Customer",
66
description: "Get a customer in Picqer. [See the documentation](https://picqer.com/en/api/customers#get-single-customer)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import app from "../../picqer.app.mjs";
2+
3+
export default {
4+
key: "picqer-get-order-comments",
5+
name: "Get Order Comments",
6+
description: "Retrieves comments linked to an order. [See the documentation](https://picqer.com/en/api/orders)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
orderId: {
17+
propDefinition: [
18+
app,
19+
"orderId",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.app.getOrderComments({
25+
$,
26+
orderId: this.orderId,
27+
});
28+
29+
$.export("$summary", `Successfully retrieved ${response.length} comment(s) for order ${this.orderId}`);
30+
return response;
31+
},
32+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import app from "../../picqer.app.mjs";
2+
3+
export default {
4+
key: "picqer-get-order-tags",
5+
name: "Get Order Tags",
6+
description: "Retrieves all tags associated with an order. [See the documentation](https://picqer.com/en/api/orders)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
orderId: {
17+
propDefinition: [
18+
app,
19+
"orderId",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.app.getOrderTags({
25+
$,
26+
orderId: this.orderId,
27+
});
28+
29+
$.export("$summary", `Successfully retrieved ${response.length} tag(s) for order ${this.orderId}`);
30+
return response;
31+
},
32+
};

0 commit comments

Comments
 (0)