Aller au contenu

Module:Infobox/Usine

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 9 août 2017 à 14:38 et modifiée en dernier par Zolo (discuter | contributions). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.

 Documentation[voir] [modifier] [historique] [purger]

Cette page définit un module d'infobox. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Usine.


local building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local localdata = require "Module:Infobox/Localdata"
local wd = require "Module:Interface Wikidata".fromLua
local address = require "Module:Adresse"
local linguistic = require "Module:Linguistique"
local convert = require "Module:Conversion"
local formatnum = require "Module:Format".do_formatnum

return 
	{
	parts =
    	{
			general.title(),
			building.mainimage(), 
			{type = 'table', title = 'Localisation', rows = {
				{type = 'row', label = 'Situation',  value = function()
					-- adaptation de l'affichage de l'emplacement aux paramètres legacy "région" et "localité"
					local item = localdata['item']
					local country = localdata['pays']
					local divstr
					if localdata['localité'] or localdata['région']then
						divstr = linguistic.conj({localdata['localité'], linguistic.inparentheses(localdata['région'])}, " ")
					end
					return address.fullAddress(item, country, nil, divstr) end
				},
				building.coordinates(),
				},
				building.geoloc({defaultmaps = "interactive", pointtype = "usine", maptype = "relief"})
			},
			{type = 'table', title = 'Installations', rows = {	
				{type = 'row', label = "Type d'usine", value = "type d'usine"},
				{type = 'row', label = "Superficie",
					value = function() if localdata['superficie'] then return convert.convertvalue(localdata['superficie'], 'ha') end end,
					wikidata = {property = 'P2046', targetunit = 'hectare'}
				},
				}
			},
			{type = 'table', title = 'Fonctionnement', rows = {
				{type = 'row', label = 'Opérateur', value = 'opérateur', wikidata = {property = 'P137'}},
				{type = 'row', label = 'Effectif',
					value =
					function()
						local n = formatnum(localdata['effectif']) or localdata['effectif']
						local dat = localdata['date effectif']
						return linguistic.conj({n, linguistic.inparentheses(dat)}, " ")
						end
				}, -- wikidata : P1128 ? mais distinction ouvrier, personnes qui travaillent sur le lieu
				{type = 'row', label = "Date d'ouverture", value = "date d'ouverture", wikidata = {property = 'P1619'}},
				{type = 'row', label = "Date de fermeture", value = "date de fermeture", wikidata = {property = 'P3999'}},
				{type = 'row', label = "Destination actuelle", value = 'destination actuelle'},
				},
			},
			{type = 'table', title = 'Production', rows = {
				{type = 'row', label = 'Produits', value = 'produits'},
				{type = 'row', label = 'Marques', value = 'marques'},
				{type = 'row', label = "Modèles", value = "modèles"},
				{type = 'row', label = "Production",
					value = function()
						local val, dat = localdata['production'], localdata['date production']
						return linguistic.conj({val, linguistic.inparentheses(dat)}, " ")
					end
					},
				}
			}
	}
}