-
Notifications
You must be signed in to change notification settings - Fork 5.6k
E_conomic - new components #18918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,098
−14
Merged
E_conomic - new components #18918
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
components/e_conomic/actions/book-invoice/book-invoice.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import economic from "../../e_conomic.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "e_conomic-book-invoice", | ||
| name: "Book Invoice", | ||
| description: "Books an invoice. [See the documentation](https://restdocs.e-conomic.com/#post-invoices-booked)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| economic, | ||
| draftInvoiceNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "draftInvoiceNumber", | ||
| ], | ||
| }, | ||
| sendByEan: { | ||
| type: "boolean", | ||
| label: "Send by EAN", | ||
| description: "Send your invoice electronically via EAN (European Article Numbering)", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.economic.bookInvoice({ | ||
| $, | ||
| data: { | ||
| draftInvoice: { | ||
| draftInvoiceNumber: this.draftInvoiceNumber, | ||
| }, | ||
| sendBy: this.sendByEan | ||
| ? "ean" | ||
| : undefined, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully booked invoice."); | ||
| return response; | ||
| }, | ||
| }; |
123 changes: 123 additions & 0 deletions
123
components/e_conomic/actions/create-customer/create-customer.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| import economic from "../../e_conomic.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "e_conomic-create-customer", | ||
| name: "Create Customer", | ||
| description: "Creates a new customer. [See the documentation](https://restdocs.e-conomic.com/#post-customers)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| economic, | ||
| name: { | ||
| propDefinition: [ | ||
| economic, | ||
| "name", | ||
| ], | ||
| }, | ||
| currency: { | ||
| propDefinition: [ | ||
| economic, | ||
| "currencyCode", | ||
| ], | ||
| }, | ||
| customerGroupNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "customerGroupNumber", | ||
| ], | ||
| }, | ||
| paymentTermNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "paymentTermNumber", | ||
| ], | ||
| }, | ||
| vatZoneNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "vatZoneNumber", | ||
| ], | ||
| }, | ||
| email: { | ||
| propDefinition: [ | ||
| economic, | ||
| "email", | ||
| ], | ||
| }, | ||
| mobilePhone: { | ||
| propDefinition: [ | ||
| economic, | ||
| "mobilePhone", | ||
| ], | ||
| }, | ||
| website: { | ||
| propDefinition: [ | ||
| economic, | ||
| "website", | ||
| ], | ||
| }, | ||
| ean: { | ||
| propDefinition: [ | ||
| economic, | ||
| "ean", | ||
| ], | ||
| }, | ||
| address: { | ||
| propDefinition: [ | ||
| economic, | ||
| "streetAddress", | ||
| ], | ||
| }, | ||
| city: { | ||
| propDefinition: [ | ||
| economic, | ||
| "city", | ||
| ], | ||
| }, | ||
| zip: { | ||
| propDefinition: [ | ||
| economic, | ||
| "zip", | ||
| ], | ||
| }, | ||
| country: { | ||
| propDefinition: [ | ||
| economic, | ||
| "country", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.economic.createCustomer({ | ||
| $, | ||
| data: { | ||
| name: this.name, | ||
| currency: this.currency, | ||
| customerGroup: { | ||
| customerGroupNumber: this.customerGroupNumber, | ||
| }, | ||
| paymentTerms: { | ||
| paymentTermsNumber: this.paymentTermNumber, | ||
| }, | ||
| vatZone: { | ||
| vatZoneNumber: this.vatZoneNumber, | ||
| }, | ||
| email: this.email, | ||
| mobilePhone: this.mobilePhone, | ||
| website: this.website, | ||
| ean: this.ean, | ||
| address: this.address, | ||
| city: this.city, | ||
| zip: this.zip, | ||
| country: this.country, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully created customer."); | ||
| return response; | ||
| }, | ||
| }; |
118 changes: 118 additions & 0 deletions
118
components/e_conomic/actions/create-invoice/create-invoice.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| import economic from "../../e_conomic.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "e_conomic-create-invoice", | ||
| name: "Create Invoice", | ||
| description: "Creates a new draft invoice. [See the documentation](https://restdocs.e-conomic.com/#post-invoices-drafts)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| economic, | ||
| currency: { | ||
| propDefinition: [ | ||
| economic, | ||
| "currencyCode", | ||
| ], | ||
| }, | ||
| customerNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "customerNumber", | ||
| ], | ||
| }, | ||
| date: { | ||
| type: "string", | ||
| label: "Date", | ||
| description: "The date of the invoice in the format YYYY-MM-DD", | ||
| }, | ||
| layoutNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "layoutNumber", | ||
| ], | ||
| }, | ||
| paymentTermNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "paymentTermNumber", | ||
| ], | ||
| }, | ||
| recipientNmae: { | ||
| type: "string", | ||
| label: "Recipient Name", | ||
| description: "The name of the recipient of the invoice", | ||
| }, | ||
| recipientVatZoneNumber: { | ||
| propDefinition: [ | ||
| economic, | ||
| "vatZoneNumber", | ||
| ], | ||
| }, | ||
| productNumbers: { | ||
| propDefinition: [ | ||
| economic, | ||
| "productNumbers", | ||
| ], | ||
| withLabel: true, | ||
| reloadProps: true, | ||
| }, | ||
| }, | ||
| async additionalProps() { | ||
| const props = {}; | ||
| if (!this.productNumbers?.length) { | ||
| return props; | ||
| } | ||
| for (const productNumber of this.productNumbers) { | ||
| props[`${productNumber.value || productNumber}_quantity`] = { | ||
| type: "string", | ||
| label: `Quantity for Product ${productNumber.label || productNumber}`, | ||
| description: `The quantity of the product ${productNumber.label || productNumber} to add to the invoice`, | ||
| }; | ||
| } | ||
| return props; | ||
| }, | ||
| async run({ $ }) { | ||
| const lines = []; | ||
| for (let i = 0; i < this.productNumbers.length; i++) { | ||
| const productNumber = this.productNumbers[i].value || this.productNumbers[i]; | ||
| lines.push({ | ||
| lineNumber: i + 1, | ||
| product: { | ||
| productNumber, | ||
| }, | ||
| quantity: parseFloat(this[`${productNumber}_quantity`]), | ||
| }); | ||
| } | ||
|
|
||
| const response = await this.economic.createDraftInvoice({ | ||
| $, | ||
| data: { | ||
| currency: this.currency, | ||
| customer: { | ||
| customerNumber: this.customerNumber, | ||
| }, | ||
| date: this.date, | ||
| layout: { | ||
| layoutNumber: this.layoutNumber, | ||
| }, | ||
| paymentTerms: { | ||
| paymentTermsNumber: this.paymentTermNumber, | ||
| }, | ||
| recipient: { | ||
| name: this.recipientName, | ||
| vatZone: { | ||
| vatZoneNumber: this.recipientVatZoneNumber, | ||
| }, | ||
| }, | ||
| lines, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully created invoice."); | ||
| return response; | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.