{
	"name": "form/nc/nc-work-center/column/work_phase.json",
	"option": {
		"grid_option": {
			"row_class_rules": {
				"red": "data.work_phase_state === 'stopped'",
				"blue": "data.work_phase_state=== 'started'",
				"grey": "data.work_phase_state === 'done'",
				"green": "data.calc?.can_start_amount && data.calc.can_start_amount > 0 && data.work_phase_state === 'confirmed'",
				"nc-grid-row-new": "data.calc && data.calc.change == 'new'",
				"nc-grid-row-changed": "data.calc && data.calc.change == 'modify'",
				"nc-grid-row-deleted": "data.calc && data.calc.change == 'delete'"
			}
		}
	},
	"column": [
		{
			"name": "",
			"width": 65,
			"variable": "idx",
			"link_field-": "prwo.record_id",
			"record_type": "schedule"
		},
		{
			"name": "Resource",
			"field": "prwo.resource_id",
			"width": 100,
			"name_fi": "Kuorm."
		},
		{
			"name": "State",
			"field": "prwo.work_phase_state",
			"name_fi": "Tila",
			"value_map": "plugin/nc-calc-server/constant.json/phase_state_view",
			"width": 80
		},
		{
			"name": "Description",
			"field": "prwo.description",
			"width": 180,
			"name_fi": "Työnkuvaus"
		},
		{
			"name": "Days",
			"width": 75,
			"name_fi": "Jäljellä",
			"field": "prwo.calc.days_left",
			"cell_class": "gridGraph",
			"cell_graph_formatter": {
				"html": "<svg class='nc-cell-graph'><rect x='{{x}}%' y='5%' height='90%' width='{{size}}%' fill='{{color}}'></rect><text dy='75%'>{{value}}</text></svg>",
				"negative_from_end": true,
				"percent_color": [
					{
						"color": "red",
						"end": 0
					},
					{
						"color": "orange",
						"end": 8,
						"start": 0
					},
					{
						"color": "lightgreen",
						"end": 30,
						"start": 7
					},
					{
						"color": "MediumSeaGreen",
						"start": 30
					}
				],
				"percent_max": 30
			}
		},
		{
			"name": "Phase start",
			"name_fi": "Alku pv",
			"width": 95,
			"field": "prwo.json_data.critical_start_date",
			"field2-": "prwo.json_data.critical_start_time",
			"field-": "prwo.json_data.start_date",
			"field--": "prwo.json_data.start_time",
			"type": "date"
		},
		{
			"field": "prwo.json_data.critical_start_time",
			"field-": "prwo.json_data.start_time",
			"hide": true
		},
		{
			"name": "Phase end",
			"name_fi": "Loppu pv",
			"width": 95,
			"field": "prwo.json_data.critical_end_date",
			"field2-": "prwo.json_data.critical_end_time",
			"field-": "prwo.json_data.end_date",
			"field--": "prwo.json_data.end_time",
			"type": "date"
		},
		{
			"field": "prwo.json_data.critical_end_time",
			"field-": "prwo.json_data.end_time",
			"hide": true
		},
		{
			"name": "Start",
			"name_fi": "Voi aloittaa",
			"field": "prwo.calc.can_start_amount",
			"width": 55
		},
		{
			"name": "Done",
			"width": 55,
			"field": "prwo.produced_amount",
			"name_fi": "Tehty",
			"type": "integer",
			"footerValue": "==Sum"
		},
		{
			"name": "Failed",
			"width": 60,
			"field": "prwo.failed_amount",
			"name_fi": "Susia",
			"type": "integer",
			"footerValue": "==Sum"
		},
		{
			"name": "Lot",
			"name_fi": "Erä",
			"field": "pro.amount_to_produce",
			"width": 55
		},
		{
			"name": "Setup time",
			"width": 90,
			"field": "prwo.setup_hours",
			"name_fi": "As. aika",
			"format": "%'.2f",
			"footerValue": "==Sum"
		},
		{
			"name": "Time/pcs",
			"width": 85,
			"field": "prwo.work_hours",
			"name_fi": "Aika/kpl",
			"format": "%'.2f",
			"footerValue": "==Sum"
		},
		{
			"name": "Mach. time",
			"width": 95,
			"field": "prwo.machine_hours",
			"name_fi": "Koneaika",
			"format": "%'.2f",
			"footerValue": "==Sum"
		},
		{
			"name": "Phase",
			"field": "prwo.work_phase_number",
			"width": 65,
			"name_fi": "Vaihe"
		},
		{
			"name": "Substate",
			"field": "prwo.json_data.substate",
			"name_fi": "Tila",
			"value_map": "plugin/nc-calc-server/constant.json/phase_substateview",
			"width": 80
		},
		{
			"name": "Info",
			"field": "prwo.info",
			"width": 200,
			"name_fi": "Lisätietoja"
		},
		{
			"name": "Prod. ord.",
			"field": "prwo.production_order_id",
			"width": 90,
			"name_fi": "Valm.erä"
		},
		{
			"name": "Type",
			"field": "prwo.json_data.work_phase_type",
			"hide": true,
			"width": 65,
			"name_fi": "Tyyppi",
			"type": "integer"
		},
		{
			"name": "ID",
			"field": "prwo.record_id",
			"width": 360
		},
		{
			"name": "Change ID",
			"field": "prwo.modify_id",
			"width": 360,
			"name_fi": "Muutos ID"
		}
	],
	"column-": [
		{
			"name": "Start date",
			"field": "prwo.json_data.start_date",
			"field2": "prwo.json_data.start_time",
			"type": "datetime",
			"format": "datetime",
			"width": 125,
			"name_fi": "Alku pv"
		},
		{
			"field": "prwo.json_data.start_time",
			"hide": true
		},
		{
			"name": "End date",
			"field": "prwo.json_data.end_date",
			"field2": "prwo.json_data.end_time",
			"type": "datetime",
			"format": "datetime",
			"width": 125,
			"name_fi": "Loppu pv"
		},
		{
			"field": "prwo.json_data.end_time",
			"hide": true
		},
		{
			"field": "prwo.json_data.substate",
			"width": 96,
			"name_fi": "Alatyyppi"
		},
		{
			"field": "prwo.json_data.start_subtype",
			"width": 92,
			"name_fi": "Al. alat."
		},
		{
			"field": "prwo.json_data.start_person_id",
			"width": 79,
			"name_fi": "Aloittaja"
		},
		{
			"field": "prwo.person_id",
			"width": 74,
			"name_fi": "Työnt."
		},
		{
			"field": "prwo.json_data.program_id",
			"width": 107,
			"name_fi": "Ohj. numero"
		},
		{
			"field": "prwo.json_data",
			"width": 180,
			"name_fi": "Lisädata"
		},
		{
			"field": "prwo.json_data.start_work_shift",
			"width": 78,
			"name_fi": "Al.v."
		},
		{
			"field": "prwo.json_data.work_shift",
			"width": 77,
			"name_fi": "Lop.v."
		},
		{
			"width": 79,
			"field": "prwo.work_hours",
			"name_fi": "Työaika",
			"footerValue": "==Sum"
		},
		{
			"width": 81,
			"field": "prwo.machine_hours",
			"name_fi": "Konetunnit",
			"footerValue": "==Sum"
		},
		{
			"width": 100,
			"field": "prwo.json_data.unpaid_hours",
			"name_fi": "Palkattomat",
			"footerValue": "==Sum"
		},
		{
			"width": 91,
			"field": "prwo.json_data.evening_work_hours",
			"name_fi": "Iltalisätunnit",
			"footerValue": "==Sum"
		},
		{
			"width": 92,
			"field": "prwo.json_data.night_work_hours",
			"name_fi": "Yölisätunnit",
			"footerValue": "==Sum"
		},
		{
			"width": 81,
			"field": "prwo.cost_price",
			"name_fi": "Työ OK",
			"footerValue": "==Sum"
		},
		{
			"field": "prwo.json_data.track_time_status",
			"width": 94,
			"name_fi": "OA tila"
		}
	]
}
