Overview
Comment:Invoice module: dynamic input generation fixed
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | invoice_module
Files: files | file ages | folders
SHA3-256: 1bc3bf31d51bf359a1722fb0327ed20f48baef01c3677d8acf0b6b3784753f52
User & Date: alinaar on 2023-02-07 18:26:56
Other Links: branch diff | manifest | tags
Context
2023-02-17
13:48
Invoice module: quotation's items recording strengthened check-in: 370877a7a0 user: alinaar tags: invoice_module
2023-02-07
18:26
Invoice module: dynamic input generation fixed check-in: 1bc3bf31d5 user: alinaar tags: invoice_module
2023-02-03
18:32
Invoice module: status label display optimized check-in: a1de44db38 user: alinaar tags: invoice_module
Changes

Modified src/skel-dist/modules/invoice/item_form.html from [8e4e88cc60] to [92a5d026eb].

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
{{:admin_header title="Ajouter un article au devis"}}

<script type="text/javascript">
function add_item() {
	const DEVISE = '{{$config.currency|htmlspecialchars|args:ENT_QUOTES}}';
	let row_line;
	let row_index;
	let td;
	let item_properties = ['name', 'description', 'unit_price', 'quantity'];
	let value;

	let total;

	row_line = document.createElement('tr');
	row_line.classList.add('item');
	row_index = window.parent.document.getElementById('item_list').children.length - 1;
	for (let i = 0; i < 4; ++i) {
		td = document.createElement('td');
		td.classList.add('item_' + item_properties[i]);
		value = document.getElementById('item_' + item_properties[i]).value;


		td.innerHTML = '<input type="hidden" name="items[' + row_index + '][' + item_properties[i] + ']" id="item_' + item_properties[i] + '_' + row_index + '" value="' + value + '" />' + value; // Need to escape (e.g., htmlspecialchars) "value"




		row_line.appendChild(td);
	}
	window.parent.document.getElementById('item_list_no_item_message').style.display = 'none';
	window.parent.document.getElementById('item_list').style.display = 'block';
	window.parent.document.getElementById('item_list').appendChild(row_line);
	total = computeTotal();
	window.parent.document.getElementById('quotation_total').textContent = parseFloat(total) + ' ' + DEVISE;










>









>
>
|
>
>
>
>







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
{{:admin_header title="Ajouter un article au devis"}}

<script type="text/javascript">
function add_item() {
	const DEVISE = '{{$config.currency|htmlspecialchars|args:ENT_QUOTES}}';
	let row_line;
	let row_index;
	let td;
	let item_properties = ['name', 'description', 'unit_price', 'quantity'];
	let value;
	let input;
	let total;

	row_line = document.createElement('tr');
	row_line.classList.add('item');
	row_index = window.parent.document.getElementById('item_list').children.length - 1;
	for (let i = 0; i < 4; ++i) {
		td = document.createElement('td');
		td.classList.add('item_' + item_properties[i]);
		value = document.getElementById('item_' + item_properties[i]).value;
		input = document.createElement('input');
		input.type = 'hidden';
		input.name = 'items[' + row_index + '][' + item_properties[i] + ']';
		input.id = 'item_' + item_properties[i] + '_' + row_index;
		input.value = value;
		td.appendChild(input);
		td.appendChild(document.createTextNode(value));
		row_line.appendChild(td);
	}
	window.parent.document.getElementById('item_list_no_item_message').style.display = 'none';
	window.parent.document.getElementById('item_list').style.display = 'block';
	window.parent.document.getElementById('item_list').appendChild(row_line);
	total = computeTotal();
	window.parent.document.getElementById('quotation_total').textContent = parseFloat(total) + ' ' + DEVISE;