{
	"name": "form/nc/erp-sync/erp-sync.json",
	"layout": {
		"component": "nc-form",
		"attribute": {
			"id": "erp-sync"
		},
		"element": [
			{
				"component": "nc-popup",
				"attribute": {
					"flowing": "flowing",
					"hoverable": "hoverable",
					"position": "bottom left",
					"v-if": "false",
					"width": "96%"
				},
				"element": [
					{
						"component": "span",
						"attribute": {
							"id": "nc-grid-popup",
							"slot": "trigger",
							"style": "margin-top: 3em; margin-left: -1em;"
						}
					},
					{
						"component": "nc-popup-content",
						"element": [
							{
								"component": "nc-label",
								"text": "Rows {{ (selectedRowRecord && selectedRowRecord.order_id + ', ' + selectedRowRecord.company_id) || '' }}",
								"attribute": {
									"model": "hdr.erp_sync.rows"
								}
							},
							{
								"component": "nc-row",
								"element": [
									{
										"component": "nc-grid",
										"attribute": {
											"id": "row_area",
											":doesExternalFilterPass": "doesExternalFilterPass",
											":isExternalFilterPresent": "isExternalFilterPresent",
											"height": "11.5em",
											"model": "grid.row_area",
											"v-on:grid-row-clicked": "gridRowClicked",
											"v-on:grid-sort-changed": "gridSortChanged"
										}
									}
								]
							}
						]
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"width": "22em",
							"class": ["nc-margin-right-big"]
						},
						"element": [
							{
								"component": "nc-label-dropdown",
								"text": "Connection",
								"attribute": {
									":horizontal": "true",
									"hdr": "hdr.erp_sync.connection",
									"model": "rec.connection",
									"v-on:change": "changeConnection('update-data')"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"v-show": "rec.conn.firm_id",
							"width": "22em",
							"class": ["nc-margin-right-big"]
						},
						"element": [
							{
								"component": "nc-label-dropdown",
								"text": "Firm",
								"attribute": {
									":horizontal": "true",
									"hdr": "hdr.erp_sync.firm_id",
									"model": "rec.conn.firm_id",
									"v-on:change": "tabChanged()"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "auto",
							"class": ["nc-center-v", "nc-end-h"]
						},
						"element": [
							{
								"component": "nc-col",
								"attribute": {
									"width": "15em"
								},
								"element": [
									{
										"component": "nc-label-input",
										"text": "Date range",
										"attribute": {
											"hdr": "hdr.erp_sync.date_range",
											":horizontal": "true",
											"label-style-": "width: 7em; text-align: right;",
											"model": "rec.start_date"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1em",
									"class": ["nc-center-h"]
								},
								"element": [
									{
										"component": "span",
										"text": "-",
										"attribute": {
											"class": ["input-group-addon"]
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "8em"
								},
								"element": [
									{
										"component": "nc-input",
										"text": "End date",
										"attribute": {
											"model": "rec.end_date"
										}
									}
								]
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"class": ["nc-end-h"],
							"width": "10em"
						},
						"element": [
							{
								"component": "nc-button",
								"attribute": {
									"class": ["nc-button-wide"],
									"primary": "primary",
									"v-on:click": "loadRows('all')"
								},
								"element": [
									{
										"component": "nc-translate",
										"text": "Update",
										"attribute": {
											"model": "hdr.erp_sync.update"
										}
									}
								]
							}
						]
					}
				]
			},
			{
				"component": "nc-divider"
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "nc-tab",
						"attribute": {
							"model": "rec.tab",
							"v-on:change": "tabChanged"
						}
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/5"
						},
						"element": [
							{
								"component": "nc-image",
								"attribute": {
									":src": "rec.logo_path_local",
									"class": ["erp-sync-logo"]
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"class": ["nc-space-evenly"],
							"width": "3/5"
						},
						"element": [
							{
								"component": "nc-checkbox",
								"text": "Show open",
								"attribute": {
									"v-if": "false",
									"hdr": "hdr.erp_sync.show_open",
									"model": "rec.show_open",
									"v-on:click": "showRows"
								}
							},
							{
								"component": "nc-checkbox",
								"text": "Show new",
								"attribute": {
									"hdr": "hdr.erp_sync.show_new",
									"model": "rec.show_new",
									"v-on:click": "showRows"
								}
							},
							{
								"component": "nc-checkbox",
								"text": "Show changed",
								"attribute": {
									"hdr": "hdr.erp_sync.show_changed",
									"model": "rec.show_changed",
									"v-on:click": "showRows"
								}
							},
							{
								"component": "nc-checkbox",
								"text": "Show equal",
								"attribute": {
									"hdr": "hdr.erp_sync.show_equal",
									"model": "rec.show_equal",
									"v-on:click": "showRows"
								}
							},
							{
								"component": "nc-checkbox",
								"text": "Preview",
								"attribute": {
									"hdr": "hdr.erp_sync.show_invoice",
									"model": "rec.show_invoice",
									"v-on:click": "showInvoicePDF"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"class": ["nc-end-h"],
							"margin-top": "0.5em",
							"width": "auto"
						},
						"element": [
							{
								"component": "nc-button",
								"attribute": {
									"class": ["nc-button-wide"],
									"style": "margin-top: 1em;",
									"primary": "primary",
									"v-on:click": "loadRows('local')"
								},
								"element": [
									{
										"component": "nc-translate",
										"text": "Update",
										"attribute": {
											"model": "hdr.erp_sync.update"
										}
									}
								]
							}
						]
					},
					{
						"component": "nc-row",
						"element": [
							{
								"component": "nc-grid",
								"attribute": {
									"id": "local",
									":doesExternalFilterPass": "doesExternalFilterPass",
									":isExternalFilterPresent": "isExternalFilterPresent",
									"height": "30vh",
									"model": "grid.local",
									"v-on:grid-row-clicked": "gridRowClicked",
									"v-on:grid-sort-changed": "gridSortChanged",
									":style": "rec.show_pdf || rec.show_invoice ? 'width: 60%;' : 'width: 100%;'"
								}
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "auto",
									"style": "margin-left: 1em; width: 40%;",
									"v-show": "rec.show_pdf || rec.show_invoice"
								},
								"element": [
									{
										"component": "nc-row",
										"element": [
											{
												"component": "nc-col",
												"attribute": {
													"width": "auto"
												},
												"element": [
													{
														"component": "nc-icon",
														"attribute": {
															"icon": "file-pdf"
														}
													},
													{
														"component": "nc-translate",
														"text": "PDF Preview",
														"attribute": {
															"model": "hdr.pdfprint",
															"v-if": "rec.show_pdf"
														}
													},
													{
														"component": "nc-translate",
														"text": "Invoice Preview",
														"attribute": {
															"model": "hdr.erp_sync.invoice_preview",
															"v-if": "rec.show_invoice"
														}
													}
												]
											}
										]
									},
									{
										"component": "nc-row",
										"element": [
											{
												"component": "nc-pdf-viewer",
												"attribute": {
													"model": "rec.invoice_viewer",
													"height": "calc(30vh - 2em)",
													"width": "100%",
													"v-if": "rec.show_invoice || rec.show_pdf",
													"style": "border: 1px solid #ddd;"
												}
											}
										]
									}
								]
							}
						]
					},
					{
						"component": "nc-row",
						"attribute": {
							"class": ["nc-margin-top"]
						},
						"element": [
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/9"
								},
								"element": [
									{
										"component": "nc-image",
										"attribute": {
											":src": "rec.logo_path_external",
											"class": ["erp-sync-logo"]
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"class": ["nc-end-h"],
									"width": "auto"
								},
								"element": [
									{
										"component": "nc-button",
										"attribute": {
											"class": ["nc-button-wide"],
											":disabled": "!buttonEnabled('import')",
											"v-on:click": "saveRows('external', 'import')"
										},
										"element": [
											{
												"component": "nc-icon",
												"attribute": {
													"icon": "arrow-circle-up"
												}
											},
											{
												"component": "nc-translate",
												"text": "Import",
												"attribute": {
													"model": "hdr.erp_sync.import"
												}
											}
										]
									},
									{
										"component": "nc-button",
										"attribute": {
											"class": ["nc-button-wide"],
											":disabled": "!buttonEnabled('export')",
											"v-on:click": "saveRows('local', 'export')"
										},
										"element": [
											{
												"component": "nc-icon",
												"attribute": {
													"icon": "arrow-circle-down"
												}
											},
											{
												"component": "nc-translate",
												"text": "Export",
												"attribute": {
													"model": "hdr.erp_sync.export"
												}
											}
										]
									},
									{
										"component": "nc-button",
										"attribute": {
											"class": ["nc-button-wide"],
											"primary": "primary",
											"v-on:click": "loadRows('external')"
										},
										"element": [
											{
												"component": "nc-translate",
												"text": "Update",
												"attribute": {
													"model": "hdr.erp_sync.update"
												}
											}
										]
									}
								]
							}
						]
					},
					{
						"component": "nc-row",
						"element": [
							{
								"component": "nc-grid",
								"attribute": {
									"id": "external",
									":doesExternalFilterPass": "doesExternalFilterPass",
									":isExternalFilterPresent": "isExternalFilterPresent",
									"height": "calc(70vh - 23em)",
									"model": "grid.external",
									"v-on:grid-row-clicked": "gridRowClicked",
									"v-on:grid-sort-changed": "gridSortChanged"
								}
							}
						]
					}
				]
			}
		]
	}
}
