Overview
Comment:Carte de membre: implement printing of a sheet of user cards
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: 64e09e15168f8f19d1059f3632e05b9891f2a8d52e69647d9793f8345e19896a
User & Date: bohwaz on 2023-05-11 23:49:06
Other Links: branch diff | manifest | tags
Context
2023-05-12
01:08
Add http_build_query modifier check-in: b7db7cbffb user: bohwaz tags: dev
2023-05-11
23:49
Carte de membre: implement printing of a sheet of user cards check-in: 64e09e1516 user: bohwaz tags: dev
23:48
Brindille math modifier: accept modulo sign % check-in: 2ee8300939 user: bohwaz tags: dev
Changes

Added src/modules/carte_membre/_carte.html version [d6aa28b2c7].



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{{if $module.config.photo}}
	{{:assign var="_photo" from="%s.0"|args:$module.config.photo}}
{{/if}}

<article{{if $module.config.logo == 1 || $_photo}} class="with-images"{{/if}}>
	{{if $module.config.logo == 1 && $config.files.logo}}
		<img src="{{$config.files.logo}}?150px" alt="" class="logo" />
	{{elseif $module.config.logo == 2 && $config.files.logo}}
		<img src="{{$config.files.logo}}?500px" alt="" class="bglogo" />
	{{/if}}

	{{if $_photo}}
		<img src="{{$_photo.url}}?150px" alt="" class="photo" />
	{{/if}}

	<div>
		{{if $module.config.fields|has:$number_field}}
			<div class="number"><span>N°</span><span>{{$_number}}</span></div>
		{{/if}}

		{{if $module.config.header}}
		<div class="content">
			{{$module.config.header|markdown|raw}}
		</div>
		{{/if}}

		<h1>{{$_name}}</h1>

		{{if $module.config.fields}}
		<ul class="fields">
			{{#foreach from=$module.config.fields item="key"}}
				{{:assign var="value" from=$key}}
				{{if $value && $key != $number_field}}
					<li>{{$value}}</li>
				{{/if}}
			{{/foreach}}
		</ul>
		{{/if}}

		{{if $module.config.id_service}}
			{{#subscriptions user=$id id_service=$module.config.id_service active=true}}
				<h3>Jusqu'au <strong>{{$expiry_date|date_short}}</strong></h3>
			{{else}}
				<h3>Expiré</h3>
			{{/subscriptions}}
		{{/if}}

	</div>
</article>

Modified src/modules/carte_membre/carte.css from [30a70d3e60] to [ab0902fbf3].







1
2
3
4


5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22


















23
24
25
26
27
28
29






* { margin: 0; padding: 0; }
body {
	font-family: sans-serif;
	font-size: 10pt;


}

main {
	display: flex;
	flex-wrap: wrap;
	grid-gap: 10mm;
	align-items: center;
	justify-content: center;

}

main.preview {
	background: #fff;
	padding: 2em;
}

main.preview article {
	box-shadow: 2px 2px 10px #000;
}



















article {
	background: #fff;
	display: block;
	position: relative;
	width: 85mm;
	height: 55mm;
>
>
>
>
>
>
|



>
>








>










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@page single {
	size: 85mm 55mm;
	margin: 0;
	padding: 0;
}

html, * { margin: 0; padding: 0; }
body {
	font-family: sans-serif;
	font-size: 10pt;
	height: 55mm;
	overflow: hidden;
}

main {
	display: flex;
	flex-wrap: wrap;
	grid-gap: 10mm;
	align-items: center;
	justify-content: center;
	border-bottom: 1px solid red;
}

main.preview {
	background: #fff;
	padding: 2em;
}

main.preview article {
	box-shadow: 2px 2px 10px #000;
}

main.single {
	page: single;
}

.sheet {
	grid-gap: 0;
	padding: .5em 0;
	background: #fff;
}

.sheet table {
	border-collapse: collapse;
}

.sheet td {
	border: 2px dashed #ccc;
}

article {
	background: #fff;
	display: block;
	position: relative;
	width: 85mm;
	height: 55mm;

Modified src/modules/carte_membre/carte.html from [aea1075dab] to [66cf2c50f5].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	{{if $_GET.print == 'pdf'}}
		{{:http type="pdf" download="%s.pdf"|args:$title}}
	{{/if}}
	<!DOCTYPE html>
	<html>
	<head>
		<title>{{$title}}</title>
		<link rel="stylesheet" type="text/css" href="carte.css" />
	</head>

	<body>

	{{if $_GET.mode == 'print'}}
		<main class="sheet">
	{{elseif $_GET.mode == 'preview'}}
		<main class="preview">
	{{/if}}

	{{if $module.config.photo}}
		{{:assign var="_photo" from="%s.0"|args:$module.config.photo}}
	{{/if}}

	<article{{if $module.config.logo == 1 || $_photo}} class="with-images"{{/if}}>
		{{if $module.config.logo == 1 && $config.files.logo}}
			<img src="{{$config.files.logo}}?150px" alt="" class="logo" />
		{{elseif $module.config.logo == 2 && $config.files.logo}}
			<img src="{{$config.files.logo}}?500px" alt="" class="bglogo" />
		{{/if}}

		{{if $_photo}}
			<img src="{{$_photo.url}}?150px" alt="" class="photo" />
		{{/if}}

		<div>
			{{if $module.config.fields|has:$number_field}}
				<div class="number"><span>N°</span><span>{{$_number}}</span></div>
			{{/if}}

			{{if $module.config.header}}
			<div class="content">
				{{$module.config.header|markdown|raw}}
			</div>
			{{/if}}

			<h1>{{$_name}}</h1>

			{{if $module.config.fields}}
			<ul class="fields">
				{{#foreach from=$module.config.fields item="key"}}
					{{:assign var="value" from=$key}}
					{{if $value && $key != $number_field}}
						<li>{{$value}}</li>
					{{/if}}
				{{/foreach}}
			</ul>
			{{/if}}

			{{if $module.config.id_service}}
				{{#subscriptions user=$id id_service=$module.config.id_service active=true}}
					<h3>Jusqu'au <strong>{{$expiry_date|date_short}}</strong></h3>
				{{else}}
					<h3>Expiré</h3>
				{{/subscriptions}}
			{{/if}}

		</div>
	</article>

	{{if $_GET.mode != 'embed'}}
		</main>
	{{/if}}


	{{:include file="/receipt/_footer.html"}}
{{else}}
	{{:error message="Le numéro de membre fourni n'existe pas."}}
{{/users}}







|





|




<
<
<
|
<
<
<
<
<
<

|
<
<
|
<
<
<
|

|
<
<
<
<
|
<
|
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
|
|

|
<
|
<
<
<
<
<
<



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50



51






52
53


54



55
56
57




58

59










60





61
62
63
64

65






66
67
68
	{{if $_GET.print == 'pdf'}}
		{{:http type="pdf" download="%s.pdf"|args:$title}}
	{{/if}}
	<!DOCTYPE html>
	<html>
	<head>
		<title>{{$title}}</title>
		<link rel="stylesheet" type="text/css" href="{{$module.url}}carte.css" />
	</head>

	<body>

	{{if $_GET.mode == 'print'}}
		<main class="single">
	{{elseif $_GET.mode == 'preview'}}
		<main class="preview">
	{{/if}}




	{{:include file="./_carte.html"}}







	{{if $_GET.mode != 'embed'}}


		</main>



	{{/if}}

	{{if $_GET.print == 'yes'}}




	<script type="text/javascript">

	window.onafterprint = window.close;










	window.print();





	</script>
	{{/if}}

	</body>

	</html>






{{else}}
	{{:error message="Le numéro de membre fourni n'existe pas."}}
{{/users}}

Added src/modules/carte_membre/index.html version [65c41fefbb].

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{{#restrict section="users" level="read"}}
	{{:admin_header title="Cartes de membres"}}

	<form method="post" action="planche.html" data-disable-progress="1" target="_dialog">
		<fieldset>
			<legend>Créer une planche de cartes de membres</legend>
			<p class="help">
				Sélectionner les membres dont les cartes seront créées.
			</p>
			<dl>
				{{:input type="list" target="!users/selector.php" multiple=true required=true label="Membres à faire figurer" name="users"}}
			</dl>
		</fieldset>
		<p class="submit">
			{{:button type="submit" label="Générer en PDF" name="pdf" shape="pdf" class="main"}}
			{{:button type="submit" label="Prévisualiser" name="preview" shape="eye"}}
			{{:button type="submit" label="Imprimer la planche" name="print" shape="print"}}
		</p>
	</form>

{{else}}
	{{:admin_header title="Ma carte de membre"}}

	{{:include file="./snippets/user_details.html" user=$logged_user}}

{{/restrict}}

{{:admin_footer}}

Modified src/modules/carte_membre/module.ini from [6e56d61037] to [1e3714a6ad].

1
2
3
4

name="Carte de membre"
description="Impression de carte de membre, à l'unité, par planche de plusieurs membres, ou export en PDF."
author="Paheko"
author_url="https://paheko.cloud/"





>
1
2
3
4
5
name="Carte de membre"
description="Impression de carte de membre, à l'unité, par planche de plusieurs membres, ou export en PDF."
author="Paheko"
author_url="https://paheko.cloud/"
home_button=true

Added src/modules/carte_membre/planche.html version [51b6e12267].





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{{#restrict section="users" level="read" block=true}}{{/restrict}}
{{:assign count=$_POST.users|count}}
{{:assign title="%d cartes de membre"|args:$count}}
{{if $_POST.pdf}}
	{{:http type="pdf" inline="%s.pdf"|args:$title}}
{{/if}}
<!DOCTYPE html>
<html>
<head>
	<title>{{$title}}</title>
	<link rel="stylesheet" type="text/css" href="{{$module.url}}carte.css" />
</head>

<body>

<main class="sheet">

	<table>
		{{:assign i=0}}
		{{#users id=$_POST.users|keys}}
			{{if "%d %% 2"|math:$i == 0}}
				<tr>
			{{/if}}
					<td>{{:include file="./_carte.html"}}</td>
			{{if "%d %% 2"|math:$i != 0}}
				</tr>
			{{/if}}
			{{:assign i="%d+1"|math:$i}}
		{{/users}}
	</table>

</main>

{{if $_POST.print}}
<script type="text/javascript">
window.onafterprint = window.close;
window.print();
</script>
{{/if}}

</body>
</html>