{
	"name": "form/nc/report/nc-report/nc-report.json",
	"layout": {
		"component": "nc-form",
		"attribute": {
			"id": "nc-report"
		},
		"element": [
			{
				"component": "nc-row",
				"attribute": {
					"class": ["nc-align-top", "nc-padding-bottom"]
				},
				"element": [
					{
						"component": "nc-tab",
						"attribute": {
							"model": "rec.tab",
							"v-on:change": "tabChanged"
						}
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"class": ["nc-align-top"],
							"width": "192px"
						},
						"element": [
							{
								"component": "nc-image",
								"attribute": {
									":src": "rec.logo_path_local",
									"height": "30px",
									"width": "190px",
									"image-style": "object-fit:contain;"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"class": ["nc-align-top"],
							"width": "auto"
						},
						"element": [
							{
								"component": "nc-row",
								"attribute": {
									"class": ["nc-center-h"]
								},
								"element": [
									{
										"component": "nc-header",
										"text": "Delivery reliability",
										"attribute": {
											"model": "hdr.report_name",
											"size": "large"
										}
									}
								]
							},
							{
								"component": "nc-row",
								"attribute": {
									"class": ["nc-center-h"]
								},
								"element": [
									{
										"component": "nc-span",
										"text": "{{ dt.formatDate(rec.start_date) + ' - ' + dt.formatDate(rec.end_date) }}"
									}
								]
							},
							{
								"component": "nc-row",
								"attribute": {
									"class": ["nc-center-h"]
								},
								"element": [
									{
										"component": "nc-span",
										"text": "&nbsp;{{ rec.report_header1 }}&nbsp;"
									}
								]
							},
							{
								"component": "nc-row",
								"attribute": {
									"class": ["nc-center-h"]
								},
								"element": [
									{
										"component": "nc-span",
										"text": "&nbsp;{{ rec.report_header2 }}&nbsp;"
									}
								]
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"class": ["nc-end-h", "nc-align-top"],
							"width": "192px"
						},
						"element": [
							{
								"component": "nc-span",
								"text": "{{ dt.formatDateTime(dt.currentDate()) }}"
							}
						]
					}
				]
			},
			{
				"component": "nc-row",
				"attribute": {
					"class": ["nc-no-print"]
				},
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"width": "auto",
							"class": ["nc-align-top"]
						},
						"element": [
							{
								"component": "nc-row",
								"attribute": {
									"class": ["normal-row-height"]
								},
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "19em"
										},
										"element": [
											{
												"component": "nc-label-input",
												"text": "Time period",
												"attribute": {
													"id": "start_date",
													"label-style": "width: 9em;",
													"model": "rec.start_date",
													"hdr": "hdr.time_period",
													"end-calendar": "rec.end_date",
													"v-on:change": "changeDate()"
												}
											}
										]
									},
									{
										"component": "nc-col",
										"attribute": {
											"class": ["nc-center-h"],
											"width": "1em"
										},
										"element": [
											{
												"component": "nc-span",
												"text": "-"
											}
										]
									},
									{
										"component": "nc-col",
										"attribute": {
											"width": "9em"
										},
										"element": [
											{
												"component": "nc-input",
												"attribute": {
													"id": "end_date",
													"model": "rec.end_date",
													"start-calendar": "rec.start_date",
													"v-on:change": "changeDate()"
												}
											}
										]
									}
								]
							},
							{
								"component": "nc-row",
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "auto"
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.company",
													"label-style": "width: 9em;",
													"v-on:change": "drawChart()"
												}
											}
										]
									}
								]
							},
							{
								"component": "nc-row",
								"attribute": {
									"v-show": "rec.show_date_row"
								},
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "1/2"
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"text": "Calculate date from",
												"attribute": {
													"model": "rec.sales_calculate_date",
													"hdr": "hdr.delivery_reliability.calculate_date_from",
													"label-style": "width: 9em;",
													"v-if": "rec.report_type === 'delivery-sales'",
													"v-on:change": "drawChart()"
												}
											},
											{
												"component": "nc-label-dropdown",
												"text": "Calculate date from",
												"attribute": {
													"model": "rec.purchase_calculate_date",
													"hdr": "hdr.delivery_reliability.calculate_date",
													"label-style": "width: 9em;",
													"v-else": "",
													"v-on:change": "drawChart()"
												}
											}
										]
									},
									{
										"component": "nc-col",
										"attribute": {
											"width": "1/2",
											"class": ["nc-padding-left"]
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.sales_compare_date",
													"hdr": "hdr.delivery_reliability.compare_date",
													"label-style": "width: 9em;",
													"v-if": "rec.report_type === 'delivery-sales'",
													"v-on:change": "drawChart()"
												}
											},
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.purchase_compare_date",
													"hdr": "hdr.delivery_reliability.compare_date",
													"label-style": "width: 9em;",
													"v-else": "",
													"v-on:change": "drawChart()"
												}
											}
										]
									}
								]
							},
							{
								"component": "nc-row",
								"attribute": {
									"v-show": "rec.tab === 'reclamation'"
								},
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "auto"
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.reclamation.reclamation_type",
													"label-style": "width: 9em;",
													"v-on:change": "drawChart()"
												}
											}
										]
									}
								]
							},
							{
								"component": "nc-row",
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "auto"
										},
										"element": [
											{
												"component": "nc-row",
												"element": [
													{
														"component": "nc-col",
														"attribute": {
															"width": "16em"
														},
														"element": [
															{
																"component": "nc-label-input",
																"text": "Error count",
																"attribute": {
																	"model": "rec.error_count",
																	":disabled": "true",
																	"label-style": "width: 9em;"
																}
															}
														]
													},
													{
														"component": "nc-col",
														"attribute": {
															"width": "auto",
															"class": ["nc-padding-left"]
														},
														"element": [
															{
																"component": "nc-checkbox",
																"text": "Show error",
																"attribute": {
																	"model": "rec.show_error"
																}
															}
														]
													}
												]
											}
										]
									}
								]
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "auto",
							"class": ["nc-padding-left", "nc-align-top"]
						},
						"element": [
							{
								"component": "nc-row",
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "auto"
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.report_type",
													"hdr": "hdr.report_type",
													"label-style": "width: 9em;",
													"v-on:change": "callServer('update')"
												}
											}
										]
									},
									{
										"component": "nc-col",
										"attribute": {
											"class": ["nc-end-h"],
											"width": "10em"
										},
										"element": [
											{
												"component": "nc-button",
												"attribute": {
													"class": ["nc-button-wide"],
													"type": "submit",
													":class-": "{negative: dt.dateToString(rec.start_date) < dt.dateToString(rec.query_start_date) || dt.dateToString(rec.end_date) > dt.dateToString(rec.query_end_date)}",
													":class": "{negative: rec.start_date < rec.query_start_date || rec.end_date > rec.query_end_date}",
													"primary": "primary",
													"submit": "submit",
													"v-on:click": "callServer('update')"
												},
												"element": [
													{
														"component": "nc-icon",
														"attribute": {
															"icon": ["sync"]
														}
													},
													{
														"component": "nc-translate",
														"text": "Update",
														"attribute": {
															"model": "hdr.update"
														}
													}
												]
											}
										]
									}
								]
							},
							{
								"component": "nc-row",
								"element": [
									{
										"component": "nc-label-dropdown",
										"attribute": {
											"model": "rec.product_group",
											"hdr": "hdr.product_group",
											"label-style": "width: 9em;",
											"v-on:change": "drawChart()"
										}
									}
								]
							},
							{
								"component": "nc-row",
								"attribute": {
									"v-show": "rec.tab === 'reclamation'"
								},
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "auto"
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.reclamation.reclamation_state",
													"label-style": "width: 9em;",
													"v-on:change": "drawChart()"
												}
											}
										]
									},
									{
										"component": "nc-col",
										"attribute": {
											"width": "auto",
											"class": ["nc-padding-left"]
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.reclamation.calculation_type",
													"label-style": "width: 9em;",
													"v-on:change": "drawChart()"
												}
											}
										]
									}
								]
							},
							{
								"component": "nc-row",
								"attribute": {
									"width": "16em",
									"v-show": "rec.show_date_row"
								},
								"element": [
									{
										"component": "nc-label-input",
										"text": "Allow days late",
										"attribute": {
											"model": "rec.days_late_allowed",
											"hdr": "hdr.delivery_reliability.days_late_allowed",
											"label-style": "width: 9em;",
											"v-on:change": "drawChart()"
										}
									}
								]
							},
							{
								"component": "nc-row",
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "auto"
										},
										"element": [
											{
												"component": "nc-label-dropdown",
												"attribute": {
													"model": "rec.color_palette",
													"label-style": "width: 9em;",
													"v-on:change": "drawChart()"
												}
											}
										]
									}
								]
							}
						]
					}
				]
			},
			{
				"component": "nc-line",
				"attribute": {
					"class": ["nc-margin-top"]
				}
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"v-if": "rec.show_error",
							"width": "1/4",
							"class": ["nc-padding-right", "na-margin-top"]
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Error details"
							},
							{
								"component": "nc-grid",
								"attribute": {
									"id": "error_detail",
									"model": "grid.error_detail",
									"height": "calc(100vh - 39em - 13em)",
									":doesExternalFilterPass": "doesExternalFilterPass",
									":isExternalFilterPresent": "isExternalFilterPresent",
									"v-show": "rec.show_error"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "auto",
							"height": "calc(70vh - 22em)"
						},
						"element": [
							{
								"component": "nc-chart",
								"attribute": {
									":update": "rec.update_chart",
									":init-option": "rec.chart.init_option",
									":options": "rec.chart.option",
									"style": ["width: 100%;"],
									"print-height": "80%"
								}
							}
						]
					}
				]
			},
			{
				"component": "nc-line",
				"attribute": {
					"class": ["nc-margin-top", "nc-no-print"]
				}
			},
			{
				"component": "nc-row",
				"attribute": {
					"class": ["nc-margin-top", "nc-no-print"]
				},
				"element": [
					{
						"component": "nc-label",
						"text": "Sales order row",
						"attribute": {
							"v-if": "rec.report_type === 'delivery-sales'"
						}
					},
					{
						"component": "nc-label",
						"text": "Purchase order row",
						"attribute": {
							"v-if": "rec.report_type === 'delivery-purchase'"
						}
					},
					{
						"component": "nc-label",
						"text": "Reclamation",
						"attribute": {
							"v-if": "rec.tab === 'reclamation'"
						}
					}
				]
			},
			{
				"component": "nc-row",
				"attribute": {
					"class": ["nc-no-print"]
				},
				"element": [
					{
						"component": "nc-grid",
						"attribute": {
							"id": "report1",
							"model": "grid.report1",
							":height": "rec.show_grid2 ? 'calc(15vh - 5.5em)' : 'calc(30vh - 9em)'",
							":doesExternalFilterPass": "doesExternalFilterPass",
							":isExternalFilterPresent": "isExternalFilterPresent"
						}
					}
				]
			},
			{
				"component": "nc-row",
				"attribute": {
					"v-if": "rec.show_grid2",
					"class": ["nc-no-print"]
				},
				"element": [
					{
						"component": "nc-row",
						"element": [
							{
								"component": "nc-label",
								"text": "Sales order row"
							}
						]
					},
					{
						"component": "nc-row",
						"element": [
							{
								"component": "nc-grid",
								"attribute": {
									"id": "report2",
									"model": "grid.report2",
									"height": "calc(15vh - 5.5em )"
								}
							}
						]
					}
				]
			}
		]
	}
}
