{
	"name": "form/nc/report/lead-time/lead-time.json",
	"layout": {
		"component": "nc-form",
		"attribute": {
			"id": "lead-time"
		},
		"element": [
			{
				"component": "nc-row",
				"element": [
					{
						"component": "pre",
						"text": "gridData length: {{gridData.length}}"
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "nc-header",
						"attribute": {
							"size": "medium",
							"hdr": "hdr.leadtime.header"
						}
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"width": "2/12"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Time period",
								"attribute": {
									"model": "hdr.leadtime.time_period"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "3/12"
						},
						"element": [
							{
								"component": "nc-col",
								"attribute": {
									"width": "auto"
								},
								"element": [
									{
										"component": "nc-input",
										"attribute": {
											"id": "start_date",
											"end-calendar": "rec.end_date",
											"model": "rec.start_date",
											"no-live-update": "no-live-update",
											"style": "width: 100%",
											"v-on:click.native": "update('start_date')"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"class": ["nc-center-v", "nc-center-h"]
								},
								"element": [
									{
										"component": "nc-label",
										"text": "–",
										"attribute": {
											"model": "hdr.leadtime.query_divider"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "auto"
								},
								"element": [
									{
										"component": "nc-input",
										"attribute": {
											"id": "end_date",
											"model": "rec.end_date",
											"no-live-update": "no-live-update",
											"start-calendar": "rec.start_date",
											"style": "width: 100%",
											"v-on:click.native": "update('end_date')"
										}
									}
								]
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "2/12"
						},
						"element": [
							{
								"component": "nc-button",
								"attribute": {
									"model": "hdr.leadtime.update",
									"primary": "primary",
									"v-on:click.native": "update"
								},
								"element": [
									{
										"component": "nc-icon",
										"attribute": {
											"icon": "sync"
										}
									},
									{
										"component": "nc-translate",
										"text": "Update",
										"attribute": {
											"model": "hdr.leadtime.update"
										}
									}
								]
							}
						]
					}
				]
			},
			{
				"component": "nc-row",
				"attribute": {
					"class": ["nc-padding-top"]
				},
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"width": "8/12"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Sales order row",
								"attribute": {
									"model": "hdr.leadtime.sales_order_row"
								}
							}
						]
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "hr",
						"attribute": {
							"class": ["small"]
						}
					}
				]
			},
			{
				"component": "nc-row",
				"attribute": {
					"class": ["nc-report"]
				},
				"element": [
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Order row",
								"attribute": {
									"model": "hdr.leadtime.order_with_row"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Company",
								"attribute": {
									"model": "hdr.leadtime.ord.company_id"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "3/24"
						},
						"element": [
							{
								"component": "nc-col",
								"attribute": {
									"width": "5/12"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Product",
										"attribute": {
											"model": "hdr.leadtime.pr.product_id"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "7/12"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Product name",
										"attribute": {
											"model": "hdr.leadtime.pr.name"
										}
									}
								]
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "3/24"
						},
						"element": [
							{
								"component": "nc-col",
								"attribute": {
									"width": "4/12"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Production order",
										"attribute": {
											"model": "hdr.leadtime.pro.production_order_id"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "3/12"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Work order",
										"attribute": {
											"model": "hdr.leadtime.pro.json_data.production_order_number"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "4/12"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Produced amount",
										"attribute": {
											"model": "hdr.leadtime.pro.produced_amount"
										}
									}
								]
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "6/24"
						},
						"element": [
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/5"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Order date",
										"attribute": {
											"model": "hdr.leadtime.ord.order_date"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/5"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Print date",
										"attribute": {
											"model": "hdr.leadtime.pro.print_date"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/5"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Start date",
										"attribute": {
											"model": "hdr.leadtime.work_start_date"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/5"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "End date",
										"attribute": {
											"model": "hdr.leadtime.work_end_date"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/5"
								},
								"element": [
									{
										"component": "nc-label",
										"text": "Delivery date",
										"attribute": {
											"model": "hdr.leadtime.ordr.delivery_date"
										}
									}
								]
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Work time",
								"attribute": {
									"model": "hdr.leadtime.work_time"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Order days(d)",
								"attribute": {
									"model": "hdr.leadtime.order_days"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Start days(d)",
								"attribute": {
									"model": "hdr.leadtime.work_start_days"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Production days(d)",
								"attribute": {
									"model": "hdr.leadtime.production_days"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Delivery days(d)",
								"attribute": {
									"model": "hdr.leadtime.delivery_days"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Order lead time",
								"attribute": {
									"model": "hdr.leadtime.order_lead_time"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Prod. lead time",
								"attribute": {
									"model": "hdr.leadtime.production_lead_time"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Productive time",
								"attribute": {
									"model": "hdr.leadtime.productive_time"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Unprod. time",
								"attribute": {
									"model": "hdr.leadtime.unproductive_time"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "1/24"
						},
						"element": [
							{
								"component": "nc-label",
								"text": "Productive %",
								"attribute": {
									"model": "hdr.leadtime.productive_percent"
								}
							}
						]
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "hr",
						"attribute": {
							"class": ["small"]
						}
					}
				]
			},
			{
				"component": "nc-row",
				"attribute": {
					":key": "item.ordr.record_id",
					"class": ["nc-line-small", "nc-report"],
					"v-for": "(item, idx) in gridData"
				},
				"element": [
					{
						"component": "div",
						"text": "{{ nc.map(state, gridData, 'order_row', {'order': item.ordr.order_id, 'order_row': item.ordr.row_number}) }}",
						"attribute": {
							"v-show": "false"
						}
					},
					{
						"component": "nc-row",
						"attribute": {
							"v-if": "idx > 0 && (gridData[idx-1].ordr.order_id != gridData[idx].ordr.order_id)"
						},
						"element": [
							{
								"component": "hr",
								"attribute": {
									"class": ["small"]
								}
							}
						]
					},
					{
						"component": "nc-col",
						"text": "{{item.order_with_row}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.ord.company_id}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "3/24"
						},
						"element": [
							{
								"component": "nc-col",
								"text": "{{item.pr.product_id}}",
								"attribute": {
									"width": "5/12"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item.pr.name}}",
								"attribute": {
									"width": "7/12"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "3/24"
						},
						"element": [
							{
								"component": "nc-col",
								"text": "{{item.pro.production_order_id}}",
								"attribute": {
									"width": "4/12"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item.pro.json_data.production_order_number}}",
								"attribute": {
									"width": "3/12"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item.pro.produced_amount}}",
								"attribute": {
									"width": "4/12"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"attribute": {
							"width": "6/24"
						},
						"element": [
							{
								"component": "nc-col",
								"text": "{{dt.formatDate(item.ord.order_date)}}",
								"attribute": {
									"width": "1/5"
								}
							},
							{
								"component": "nc-col",
								"text": "{{dt.formatDate(item.pro.print_date)}}",
								"attribute": {
									"width": "1/5"
								}
							},
							{
								"component": "nc-col",
								"text": "{{dt.formatDate(item.work_start_date)}}",
								"attribute": {
									"width": "1/5"
								}
							},
							{
								"component": "nc-col",
								"text": "{{dt.formatDate(item.work_end_date)}}",
								"attribute": {
									"width": "1/5"
								}
							},
							{
								"component": "nc-col",
								"text": "{{dt.formatDate(item.ordr.delivery_date)}}",
								"attribute": {
									"width": "1/5"
								}
							}
						]
					},
					{
						"component": "nc-col",
						"text": "{{item.work_time}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.order_days}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.work_start_days}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.production_days}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.delivery_days}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.order_lead_time}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.production_lead_time}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.productive_time}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.unproductive_time}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-col",
						"text": "{{item.productive_percent}}",
						"attribute": {
							"width": "1/24"
						}
					},
					{
						"component": "nc-row",
						"attribute": {
							":class": "{'blue': true}",
							":key": "item2.pro.record_id",
							"class": ["nc-line-small"],
							"v-for": "(item2, idx2) in nc.filter(state, gridData, 'order_row_work_orders', {'order': item.ordr.order_id, 'order_row': item.ordr.row_number})",
							"v-if": "rec.ordr_rows_expanded"
						},
						"element": [
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "3/24"
								},
								"element": [
									{
										"component": "nc-col",
										"text": "{{item2.pr.product_id}}",
										"attribute": {
											"width": "5/12"
										}
									},
									{
										"component": "nc-col",
										"text": "{{item2.pr.name}}",
										"attribute": {
											"width": "7/12"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "3/24"
								},
								"element": [
									{
										"component": "nc-col",
										"text": "{{item2.pro.production_order_id}}",
										"attribute": {
											"width": "4/12"
										}
									},
									{
										"component": "nc-col",
										"text": "{{item2.pro.json_data.production_order_number}}",
										"attribute": {
											"width": "3/12"
										}
									},
									{
										"component": "nc-col",
										"text": "{{item2.pro.produced_amount}}",
										"attribute": {
											"width": "4/12"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "6/24"
								},
								"element": [
									{
										"component": "nc-col",
										"attribute": {
											"width": "1/5"
										}
									},
									{
										"component": "nc-col",
										"text": "{{dt.formatDate(item2.pro.print_date)}}",
										"attribute": {
											"width": "1/5"
										}
									},
									{
										"component": "nc-col",
										"text": "{{dt.formatDate(item2.work_start_date)}}",
										"attribute": {
											"width": "1/5"
										}
									},
									{
										"component": "nc-col",
										"text": "{{dt.formatDate(item2.work_end_date)}}",
										"attribute": {
											"width": "1/5"
										}
									},
									{
										"component": "nc-col",
										"attribute": {
											"width": "1/5"
										}
									}
								]
							},
							{
								"component": "nc-col",
								"text": "{{item2.work_time}}",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item2.work_start_days}}",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item2.production_days}}",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item2.production_lead_time}}",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item2.productive_time}}",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item2.unproductive_time}}",
								"attribute": {
									"width": "1/24"
								}
							},
							{
								"component": "nc-col",
								"text": "{{item2.productive_percent}}",
								"attribute": {
									"width": "1/24"
								}
							}
						]
					}
				]
			},
			{
				"component": "nc-row",
				"element": [
					{
						"component": "hr",
						"attribute": {
							"class": ["small"]
						}
					}
				]
			}
		]
	}
}
