import jingrow


def execute():
	for web_form_name in jingrow.get_all("Web Form", pluck="name"):
		web_form = jingrow.get_pg("Web Form", web_form_name)
		pagetype_layout = jingrow.get_pg(
			dict(
				pagetype="PageType Layout",
				document_type=web_form.pg_type,
				name=web_form.title,
				route=web_form.route,
				fields=[
					dict(fieldname=d.fieldname, label=d.label)
					for d in web_form.web_form_fields
					if d.fieldname
				],
			)
		).insert()
		print(pagetype_layout.name)
