update standardstep

This commit is contained in:
Claudio 2025-03-10 11:52:58 +01:00
parent 9b74f92a4c
commit c53c298401
20 changed files with 2356 additions and 68 deletions

View File

@ -0,0 +1,11 @@
<img src="[calzatura] (importata)" width="1153" height="684" border="0" usemap="#map" />
<map name="map">
<!-- #$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:info -->
<area shape="rect" coords="473,162,534,203" target="a" href="a" />
<area shape="rect" coords="770,231,789,258" target="b" href="b" />
</map>

BIN
images/calzatura (1).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 KiB

After

Width:  |  Height:  |  Size: 466 KiB

View File

@ -0,0 +1,55 @@
v1.2.3 (2015/04/20)
-------------------
- Added 'bower.json' to use this package manager
- Added 'tbody' in the selector during the construction of the structure, to avoid problems with the 'tfoot'
- Now when you tab in a row, the form is saved. Only if there is no save button
v1.2.2 (2015/04/02)
-------------------
- Updated 'example.php' file
- Updated project page with examples and documentation
- Now if 'onAjax()' hook returns false, does not send the ajax request
- Added 'rowIdentifier' option to change the name of attribute in td element for the row identifier
- Fixed bug that allows you to change to edit mode with mouse click when the line was deleted
- Quick fix for issue that sometimes could not remove the warning class on the edited rows
v1.2.1 (2015/03/10)
-------------------
- Improved the select element
- Does not add hidden save button if the 'editButton' option is false
- Does not add hidden restore button if the 'deleteButton' option is false
- Added a new option 'autoFocus' to enable or not the focus in the first input when click in edit button
- Added a new hook 'onAjax(action, serialize)' that runs before the ajax request
v1.2.0 (2015/03/07)
-------------------
- Added 'saveButton' and 'restoreButton' options
- Added 'toolbarClass' and 'groupClass' options
- Changed 'removeButton' option to 'deleteButton'
- Changed 'remove' action to 'delete'
- Removed 'textSelection' option, using CSS to prevent the text is selected with double click
- Removed 'confirmText' option, because a button was created to confirm the removal
- Removed form wrapped on table, because now it serialize inputs instead of the form
- In 'buttons' option now have a new child 'action' to change name of action input ('edit', 'delete' and 'restore')
- Redesign of toolbox and changed name to toolbar
- Minor code improvement
- Fixed some bugs
v1.1.1 (2015/03/05)
-------------------
- Fixed bug when creates the form wrapped on table
v1.1.0 (2015/02/08)
-------------------
- Added toolbox column with edit and remove buttons
- Added effect on table row when ajax request fails
- Added effect on table row when changes are saved with success
- Added 'onAlways()' hook, that is executed whenever there is an ajax request
- Change 'onComplete(response)' hook to 'onSuccess(data, textStatus, jqXHR)'
- Change 'onError()' hook to 'onFail(jqXHR, textStatus, errorThrown)'
- Fixed some minor bugs
- Minor code improvement
v1.0.0 (2015/01/30)
-------------------
- Initial release

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Celso Marques
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,18 @@
# jQuery-Tabledit v1.2.3
Inline editor for HTML tables compatible with Bootstrap.
## Examples
http://markcell.github.io/jquery-tabledit/#examples
## Documentation
http://markcell.github.io/jquery-tabledit/#documentation
## Changelog
See [CHANGELOG.md](https://github.com/markcell/jquery-tabledit/blob/master/CHANGELOG.md) file.
## License
Code released under the MIT license.

View File

@ -0,0 +1,24 @@
{
"name": "markcell/jquery-tabledit",
"version": "1.2.3",
"description": "Inline editor for HTML tables compatible with Bootstrap.",
"main": "jquery.tabledit.js",
"license": "MIT",
"homepage": "http://markcell.github.io/jquery-tabledit",
"keywords": [
"html",
"table",
"edit",
"bootstrap",
"spreadsheet",
"inline",
"editor"
],
"ignore": [
"*.md",
"*.php"
],
"dependencies": {
"jquery": "jquery/jquery"
}
}

View File

@ -0,0 +1,27 @@
<?php
// Basic example of PHP script to handle with jQuery-Tabledit plug-in.
// Note that is just an example. Should take precautions such as filtering the input data.
header('Content-Type: application/json');
$input = filter_input_array(INPUT_POST);
$mysqli = new mysqli('localhost', 'user', 'password', 'database');
if (mysqli_connect_errno()) {
echo json_encode(array('mysqli' => 'Failed to connect to MySQL: ' . mysqli_connect_error()));
exit;
}
if ($input['action'] === 'edit') {
$mysqli->query("UPDATE users SET username='" . $input['username'] . "', email='" . $input['email'] . "', avatar='" . $input['avatar'] . "' WHERE id='" . $input['id'] . "'");
} else if ($input['action'] === 'delete') {
$mysqli->query("UPDATE users SET deleted=1 WHERE id='" . $input['id'] . "'");
} else if ($input['action'] === 'restore') {
$mysqli->query("UPDATE users SET deleted=0 WHERE id='" . $input['id'] . "'");
}
mysqli_close($mysqli);
echo json_encode($input);

View File

@ -0,0 +1,611 @@
/*!
* Tabledit v1.2.3 (https://github.com/markcell/jQuery-Tabledit)
* Copyright (c) 2015 Celso Marques
* Licensed under MIT (https://github.com/markcell/jQuery-Tabledit/blob/master/LICENSE)
*/
/**
* @description Inline editor for HTML tables compatible with Bootstrap
* @version 1.2.3
* @author Celso Marques
*/
if (typeof jQuery === 'undefined') {
throw new Error('Tabledit requires jQuery library.');
}
(function($) {
'use strict';
$.fn.Tabledit = function(options) {
if (!this.is('table')) {
throw new Error('Tabledit only works when applied to a table.');
}
var $table = this;
var defaults = {
url: window.location.href,
inputClass: 'form-control input-sm',
toolbarClass: 'btn-toolbar',
groupClass: 'btn-group btn-group-sm',
dangerClass: 'danger',
warningClass: 'warning',
mutedClass: 'text-muted',
eventType: 'click',
rowIdentifier: 'id',
hideIdentifier: false,
autoFocus: true,
editButton: true,
deleteButton: true,
saveButton: true,
restoreButton: true,
buttons: {
edit: {
class: 'btn btn-sm btn-default',
html: '<span class="glyphicon glyphicon-pencil"></span>',
action: 'edit'
},
delete: {
class: 'btn btn-sm btn-default',
html: '<span class="glyphicon glyphicon-trash"></span>',
action: 'delete'
},
save: {
class: 'btn btn-sm btn-success',
html: 'Save'
},
restore: {
class: 'btn btn-sm btn-warning',
html: 'Restore',
action: 'restore'
},
confirm: {
class: 'btn btn-sm btn-danger',
html: 'Confirm'
}
},
onDraw: function() { return; },
onSuccess: function() { return; },
onFail: function() { return; },
onAlways: function() { return; },
onAjax: function() { return; }
};
var settings = $.extend(true, defaults, options);
var $lastEditedRow = 'undefined';
var $lastDeletedRow = 'undefined';
var $lastRestoredRow = 'undefined';
/**
* Draw Tabledit structure (identifier column, editable columns, toolbar column).
*
* @type {object}
*/
var Draw = {
columns: {
identifier: function() {
// Hide identifier column.
if (settings.hideIdentifier) {
$table.find('th:nth-child(' + parseInt(settings.columns.identifier[0]) + 1 + '), tbody td:nth-child(' + parseInt(settings.columns.identifier[0]) + 1 + ')').hide();
}
var $td = $table.find('tbody td:nth-child(' + (parseInt(settings.columns.identifier[0]) + 1) + ')');
$td.each(function() {
// Create hidden input with row identifier.
var span = '<span class="tabledit-span tabledit-identifier">' + $(this).text() + '</span>';
var input = '<input class="tabledit-input tabledit-identifier" type="hidden" name="' + settings.columns.identifier[1] + '" value="' + $(this).text() + '" disabled>';
// Add elements to table cell.
$(this).html(span + input);
// Add attribute "id" to table row.
$(this).parent('tr').attr(settings.rowIdentifier, $(this).text());
});
},
editable: function() {
for (var i = 0; i < settings.columns.editable.length; i++) {
var $td = $table.find('tbody td:nth-child(' + (parseInt(settings.columns.editable[i][0]) + 1) + ')');
$td.each(function() {
// Get text of this cell.
var text = $(this).text();
// Add pointer as cursor.
if (!settings.editButton) {
$(this).css('cursor', 'pointer');
}
// Create span element.
var span = '<span class="tabledit-span">' + text + '</span>';
// Check if exists the third parameter of editable array.
if (typeof settings.columns.editable[i][2] !== 'undefined') {
// Create select element.
var input = '<select class="tabledit-input ' + settings.inputClass + '" name="' + settings.columns.editable[i][1] + '" style="display: none;" disabled>';
// Create options for select element.
$.each(jQuery.parseJSON(settings.columns.editable[i][2]), function(index, value) {
if (text === value) {
input += '<option value="' + index + '" selected>' + value + '</option>';
} else {
input += '<option value="' + index + '">' + value + '</option>';
}
});
// Create last piece of select element.
input += '</select>';
} else {
// Create text input element.
var input = '<input class="tabledit-input ' + settings.inputClass + '" type="text" name="' + settings.columns.editable[i][1] + '" value="' + $(this).text() + '" style="display: none;" disabled>';
}
// Add elements and class "view" to table cell.
$(this).html(span + input);
$(this).addClass('tabledit-view-mode');
});
}
},
toolbar: function() {
if (settings.editButton || settings.deleteButton) {
var editButton = '';
var deleteButton = '';
var saveButton = '';
var restoreButton = '';
var confirmButton = '';
// Add toolbar column header if not exists.
if ($table.find('th.tabledit-toolbar-column').length === 0) {
$table.find('tr:first').append('<th class="tabledit-toolbar-column"></th>');
}
// Create edit button.
if (settings.editButton) {
editButton = '<button type="button" class="tabledit-edit-button ' + settings.buttons.edit.class + '" style="float: none;">' + settings.buttons.edit.html + '</button>';
}
// Create delete button.
if (settings.deleteButton) {
deleteButton = '<button type="button" class="tabledit-delete-button ' + settings.buttons.delete.class + '" style="float: none;">' + settings.buttons.delete.html + '</button>';
confirmButton = '<button type="button" class="tabledit-confirm-button ' + settings.buttons.confirm.class + '" style="display: none; float: none;">' + settings.buttons.confirm.html + '</button>';
}
// Create save button.
if (settings.editButton && settings.saveButton) {
saveButton = '<button type="button" class="tabledit-save-button ' + settings.buttons.save.class + '" style="display: none; float: none;">' + settings.buttons.save.html + '</button>';
}
// Create restore button.
if (settings.deleteButton && settings.restoreButton) {
restoreButton = '<button type="button" class="tabledit-restore-button ' + settings.buttons.restore.class + '" style="display: none; float: none;">' + settings.buttons.restore.html + '</button>';
}
var toolbar = '<div class="tabledit-toolbar ' + settings.toolbarClass + '" style="text-align: left;">\n\
<div class="' + settings.groupClass + '" style="float: none;">' + editButton + deleteButton + '</div>\n\
' + saveButton + '\n\
' + confirmButton + '\n\
' + restoreButton + '\n\
</div></div>';
// Add toolbar column cells.
$table.find('tbody>tr').append('<td style="white-space: nowrap; width: 1%;">' + toolbar + '</td>');
}
}
}
};
/**
* Change to view mode or edit mode with table td element as parameter.
*
* @type object
*/
var Mode = {
view: function(td) {
// Get table row.
var $tr = $(td).parent('tr');
// Disable identifier.
$(td).parent('tr').find('.tabledit-input.tabledit-identifier').prop('disabled', true);
// Hide and disable input element.
$(td).find('.tabledit-input').blur().hide().prop('disabled', true);
// Show span element.
$(td).find('.tabledit-span').show();
// Add "view" class and remove "edit" class in td element.
$(td).addClass('tabledit-view-mode').removeClass('tabledit-edit-mode');
// Update toolbar buttons.
if (settings.editButton) {
$tr.find('button.tabledit-save-button').hide();
$tr.find('button.tabledit-edit-button').removeClass('active').blur();
}
},
edit: function(td) {
Delete.reset(td);
// Get table row.
var $tr = $(td).parent('tr');
// Enable identifier.
$tr.find('.tabledit-input.tabledit-identifier').prop('disabled', false);
// Hide span element.
$(td).find('.tabledit-span').hide();
// Get input element.
var $input = $(td).find('.tabledit-input');
// Enable and show input element.
$input.prop('disabled', false).show();
// Focus on input element.
if (settings.autoFocus) {
$input.focus();
}
// Add "edit" class and remove "view" class in td element.
$(td).addClass('tabledit-edit-mode').removeClass('tabledit-view-mode');
// Update toolbar buttons.
if (settings.editButton) {
$tr.find('button.tabledit-edit-button').addClass('active');
$tr.find('button.tabledit-save-button').show();
}
}
};
/**
* Available actions for edit function, with table td element as parameter or set of td elements.
*
* @type object
*/
var Edit = {
reset: function(td) {
$(td).each(function() {
// Get input element.
var $input = $(this).find('.tabledit-input');
// Get span text.
var text = $(this).find('.tabledit-span').text();
// Set input/select value with span text.
if ($input.is('select')) {
$input.find('option').filter(function() {
return $.trim($(this).text()) === text;
}).attr('selected', true);
} else {
$input.val(text);
}
// Change to view mode.
Mode.view(this);
});
},
submit: function(td) {
// Send AJAX request to server.
var ajaxResult = ajax(settings.buttons.edit.action);
if (ajaxResult === false) {
return;
}
$(td).each(function() {
// Get input element.
var $input = $(this).find('.tabledit-input');
// Set span text with input/select new value.
if ($input.is('select')) {
$(this).find('.tabledit-span').text($input.find('option:selected').text());
} else {
$(this).find('.tabledit-span').text($input.val());
}
// Change to view mode.
Mode.view(this);
});
// Set last edited column and row.
$lastEditedRow = $(td).parent('tr');
}
};
/**
* Available actions for delete function, with button as parameter.
*
* @type object
*/
var Delete = {
reset: function(td) {
// Reset delete button to initial status.
$table.find('.tabledit-confirm-button').hide();
// Remove "active" class in delete button.
$table.find('.tabledit-delete-button').removeClass('active').blur();
},
submit: function(td) {
Delete.reset(td);
// Enable identifier hidden input.
$(td).parent('tr').find('input.tabledit-identifier').attr('disabled', false);
// Send AJAX request to server.
var ajaxResult = ajax(settings.buttons.delete.action);
// Disable identifier hidden input.
$(td).parents('tr').find('input.tabledit-identifier').attr('disabled', true);
if (ajaxResult === false) {
return;
}
// Add class "deleted" to row.
$(td).parent('tr').addClass('tabledit-deleted-row');
// Hide table row.
$(td).parent('tr').addClass(settings.mutedClass).find('.tabledit-toolbar button:not(.tabledit-restore-button)').attr('disabled', true);
// Show restore button.
$(td).find('.tabledit-restore-button').show();
// Set last deleted row.
$lastDeletedRow = $(td).parent('tr');
},
confirm: function(td) {
// Reset all cells in edit mode.
$table.find('td.tabledit-edit-mode').each(function() {
Edit.reset(this);
});
// Add "active" class in delete button.
$(td).find('.tabledit-delete-button').addClass('active');
// Show confirm button.
$(td).find('.tabledit-confirm-button').show();
},
restore: function(td) {
// Enable identifier hidden input.
$(td).parent('tr').find('input.tabledit-identifier').attr('disabled', false);
// Send AJAX request to server.
var ajaxResult = ajax(settings.buttons.restore.action);
// Disable identifier hidden input.
$(td).parents('tr').find('input.tabledit-identifier').attr('disabled', true);
if (ajaxResult === false) {
return;
}
// Remove class "deleted" to row.
$(td).parent('tr').removeClass('tabledit-deleted-row');
// Hide table row.
$(td).parent('tr').removeClass(settings.mutedClass).find('.tabledit-toolbar button').attr('disabled', false);
// Hide restore button.
$(td).find('.tabledit-restore-button').hide();
// Set last restored row.
$lastRestoredRow = $(td).parent('tr');
}
};
/**
* Send AJAX request to server.
*
* @param {string} action
*/
function ajax(action)
{
var serialize = $table.find('.tabledit-input').serialize()
if (!serialize) {
return false;
}
serialize += '&action=' + action;
var result = settings.onAjax(action, serialize);
if (result === false) {
return false;
}
var jqXHR = $.post(settings.url, serialize, function(data, textStatus, jqXHR) {
if (action === settings.buttons.edit.action) {
$lastEditedRow.removeClass(settings.dangerClass).addClass(settings.warningClass);
setTimeout(function() {
//$lastEditedRow.removeClass(settings.warningClass);
$table.find('tr.' + settings.warningClass).removeClass(settings.warningClass);
}, 1400);
}
settings.onSuccess(data, textStatus, jqXHR);
}, 'json');
jqXHR.fail(function(jqXHR, textStatus, errorThrown) {
if (action === settings.buttons.delete.action) {
$lastDeletedRow.removeClass(settings.mutedClass).addClass(settings.dangerClass);
$lastDeletedRow.find('.tabledit-toolbar button').attr('disabled', false);
$lastDeletedRow.find('.tabledit-toolbar .tabledit-restore-button').hide();
} else if (action === settings.buttons.edit.action) {
$lastEditedRow.addClass(settings.dangerClass);
}
settings.onFail(jqXHR, textStatus, errorThrown);
});
jqXHR.always(function() {
settings.onAlways();
});
return jqXHR;
}
Draw.columns.identifier();
Draw.columns.editable();
Draw.columns.toolbar();
settings.onDraw();
if (settings.deleteButton) {
/**
* Delete one row.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-delete-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
// Get current state before reset to view mode.
var activated = $(this).hasClass('active');
var $td = $(this).parents('td');
Delete.reset($td);
if (!activated) {
Delete.confirm($td);
}
event.handled = true;
}
});
/**
* Delete one row (confirm).
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-confirm-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
var $td = $(this).parents('td');
Delete.submit($td);
event.handled = true;
}
});
}
if (settings.restoreButton) {
/**
* Restore one row.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-restore-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
Delete.restore($(this).parents('td'));
event.handled = true;
}
});
}
if (settings.editButton) {
/**
* Activate edit mode on all columns.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-edit-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
var $button = $(this);
// Get current state before reset to view mode.
var activated = $button.hasClass('active');
// Change to view mode columns that are in edit mode.
Edit.reset($table.find('td.tabledit-edit-mode'));
if (!activated) {
// Change to edit mode for all columns in reverse way.
$($button.parents('tr').find('td.tabledit-view-mode').get().reverse()).each(function() {
Mode.edit(this);
});
}
event.handled = true;
}
});
/**
* Save edited row.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-save-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
// Submit and update all columns.
Edit.submit($(this).parents('tr').find('td.tabledit-edit-mode'));
event.handled = true;
}
});
} else {
/**
* Change to edit mode on table td element.
*
* @param {object} event
*/
$table.on(settings.eventType, 'tr:not(.tabledit-deleted-row) td.tabledit-view-mode', function(event) {
if (event.handled !== true) {
event.preventDefault();
// Reset all td's in edit mode.
Edit.reset($table.find('td.tabledit-edit-mode'));
// Change to edit mode.
Mode.edit(this);
event.handled = true;
}
});
/**
* Change event when input is a select element.
*/
$table.on('change', 'select.tabledit-input:visible', function(event) {
if (event.handled !== true) {
// Submit and update the column.
Edit.submit($(this).parent('td'));
event.handled = true;
}
});
/**
* Click event on document element.
*
* @param {object} event
*/
$(document).on('click', function(event) {
var $editMode = $table.find('.tabledit-edit-mode');
// Reset visible edit mode column.
if (!$editMode.is(event.target) && $editMode.has(event.target).length === 0) {
Edit.reset($table.find('.tabledit-input:visible').parent('td'));
}
});
}
/**
* Keyup event on table element.
*
* @param {object} event
*/
$table.on('keyup', function(event) {
// Get input element with focus or confirmation button.
var $input = $table.find('.tabledit-input:visible');
var $button = $table.find('.tabledit-confirm-button');
if ($input.length > 0) {
var $td = $input.parents('td');
} else if ($button.length > 0) {
var $td = $button.parents('td');
} else {
return;
}
// Key?
switch (event.keyCode) {
case 9: // Tab.
if (!settings.editButton) {
Edit.submit($td);
Mode.edit($td.closest('td').next());
}
break;
case 13: // Enter.
Edit.submit($td);
break;
case 27: // Escape.
Edit.reset($td);
Delete.reset($td);
break;
}
});
return this;
};
}(jQuery));

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,611 @@
/*!
* Tabledit v1.2.3 (https://github.com/markcell/jQuery-Tabledit)
* Copyright (c) 2015 Celso Marques
* Licensed under MIT (https://github.com/markcell/jQuery-Tabledit/blob/master/LICENSE)
*/
/**
* @description Inline editor for HTML tables compatible with Bootstrap
* @version 1.2.3
* @author Celso Marques
*/
if (typeof jQuery === 'undefined') {
throw new Error('Tabledit requires jQuery library.');
}
(function($) {
'use strict';
$.fn.Tabledit = function(options) {
if (!this.is('table')) {
throw new Error('Tabledit only works when applied to a table.');
}
var $table = this;
var defaults = {
url: window.location.href,
inputClass: 'form-control input-sm',
toolbarClass: 'btn-toolbar',
groupClass: 'btn-group btn-group-sm',
dangerClass: 'danger',
warningClass: 'warning',
mutedClass: 'text-muted',
eventType: 'click',
rowIdentifier: 'id',
hideIdentifier: false,
autoFocus: true,
editButton: true,
deleteButton: true,
saveButton: true,
restoreButton: true,
buttons: {
edit: {
class: 'btn btn-sm btn-default',
html: '<span class="glyphicon glyphicon-pencil"></span>',
action: 'edit'
},
delete: {
class: 'btn btn-sm btn-default',
html: '<span class="glyphicon glyphicon-trash"></span>',
action: 'delete'
},
save: {
class: 'btn btn-sm btn-success',
html: 'Save'
},
restore: {
class: 'btn btn-sm btn-warning',
html: 'Restore',
action: 'restore'
},
confirm: {
class: 'btn btn-sm btn-danger',
html: 'Confirm'
}
},
onDraw: function() { return; },
onSuccess: function() { return; },
onFail: function() { return; },
onAlways: function() { return; },
onAjax: function() { return; }
};
var settings = $.extend(true, defaults, options);
var $lastEditedRow = 'undefined';
var $lastDeletedRow = 'undefined';
var $lastRestoredRow = 'undefined';
/**
* Draw Tabledit structure (identifier column, editable columns, toolbar column).
*
* @type {object}
*/
var Draw = {
columns: {
identifier: function() {
// Hide identifier column.
if (settings.hideIdentifier) {
$table.find('th:nth-child(' + parseInt(settings.columns.identifier[0]) + 1 + '), tbody td:nth-child(' + parseInt(settings.columns.identifier[0]) + 1 + ')').hide();
}
var $td = $table.find('tbody td:nth-child(' + (parseInt(settings.columns.identifier[0]) + 1) + ')');
$td.each(function() {
// Create hidden input with row identifier.
var span = '<span class="tabledit-span tabledit-identifier">' + $(this).text() + '</span>';
var input = '<input class="tabledit-input tabledit-identifier" type="hidden" name="' + settings.columns.identifier[1] + '" value="' + $(this).text() + '" disabled>';
// Add elements to table cell.
$(this).html(span + input);
// Add attribute "id" to table row.
$(this).parent('tr').attr(settings.rowIdentifier, $(this).text());
});
},
editable: function() {
for (var i = 0; i < settings.columns.editable.length; i++) {
var $td = $table.find('tbody td:nth-child(' + (parseInt(settings.columns.editable[i][0]) + 1) + ')');
$td.each(function() {
// Get text of this cell.
var text = $(this).text();
// Add pointer as cursor.
if (!settings.editButton) {
$(this).css('cursor', 'pointer');
}
// Create span element.
var span = '<span class="tabledit-span">' + text + '</span>';
// Check if exists the third parameter of editable array.
if (typeof settings.columns.editable[i][2] !== 'undefined') {
// Create select element.
var input = '<select class="tabledit-input ' + settings.inputClass + '" name="' + settings.columns.editable[i][1] + '" style="display: none;" disabled>';
// Create options for select element.
$.each(jQuery.parseJSON(settings.columns.editable[i][2]), function(index, value) {
if (text === value) {
input += '<option value="' + index + '" selected>' + value + '</option>';
} else {
input += '<option value="' + index + '">' + value + '</option>';
}
});
// Create last piece of select element.
input += '</select>';
} else {
// Create text input element.
var input = '<input class="tabledit-input ' + settings.inputClass + '" type="text" name="' + settings.columns.editable[i][1] + '" value="' + $(this).text() + '" style="display: none;" disabled>';
}
// Add elements and class "view" to table cell.
$(this).html(span + input);
$(this).addClass('tabledit-view-mode');
});
}
},
toolbar: function() {
if (settings.editButton || settings.deleteButton) {
var editButton = '';
var deleteButton = '';
var saveButton = '';
var restoreButton = '';
var confirmButton = '';
// Add toolbar column header if not exists.
if ($table.find('th.tabledit-toolbar-column').length === 0) {
$table.find('tr:first').append('<th class="tabledit-toolbar-column"></th>');
}
// Create edit button.
if (settings.editButton) {
editButton = '<button type="button" class="tabledit-edit-button ' + settings.buttons.edit.class + '" style="float: none;">' + settings.buttons.edit.html + '</button>';
}
// Create delete button.
if (settings.deleteButton) {
deleteButton = '<button type="button" class="tabledit-delete-button ' + settings.buttons.delete.class + '" style="float: none;">' + settings.buttons.delete.html + '</button>';
confirmButton = '<button type="button" class="tabledit-confirm-button ' + settings.buttons.confirm.class + '" style="display: none; float: none;">' + settings.buttons.confirm.html + '</button>';
}
// Create save button.
if (settings.editButton && settings.saveButton) {
saveButton = '<button type="button" class="tabledit-save-button ' + settings.buttons.save.class + '" style="display: none; float: none;">' + settings.buttons.save.html + '</button>';
}
// Create restore button.
if (settings.deleteButton && settings.restoreButton) {
restoreButton = '<button type="button" class="tabledit-restore-button ' + settings.buttons.restore.class + '" style="display: none; float: none;">' + settings.buttons.restore.html + '</button>';
}
var toolbar = '<div class="tabledit-toolbar ' + settings.toolbarClass + '" style="text-align: left;">\n\
<div class="' + settings.groupClass + '" style="float: none;">' + editButton + deleteButton + '</div>\n\
' + saveButton + '\n\
' + confirmButton + '\n\
' + restoreButton + '\n\
</div></div>';
// Add toolbar column cells.
$table.find('tbody>tr').append('<td style="white-space: nowrap; width: 1%;">' + toolbar + '</td>');
}
}
}
};
/**
* Change to view mode or edit mode with table td element as parameter.
*
* @type object
*/
var Mode = {
view: function(td) {
// Get table row.
var $tr = $(td).parent('tr');
// Disable identifier.
$(td).parent('tr').find('.tabledit-input.tabledit-identifier').prop('disabled', true);
// Hide and disable input element.
$(td).find('.tabledit-input').blur().hide().prop('disabled', true);
// Show span element.
$(td).find('.tabledit-span').show();
// Add "view" class and remove "edit" class in td element.
$(td).addClass('tabledit-view-mode').removeClass('tabledit-edit-mode');
// Update toolbar buttons.
if (settings.editButton) {
$tr.find('button.tabledit-save-button').hide();
$tr.find('button.tabledit-edit-button').removeClass('active').blur();
}
},
edit: function(td) {
Delete.reset(td);
// Get table row.
var $tr = $(td).parent('tr');
// Enable identifier.
$tr.find('.tabledit-input.tabledit-identifier').prop('disabled', false);
// Hide span element.
$(td).find('.tabledit-span').hide();
// Get input element.
var $input = $(td).find('.tabledit-input');
// Enable and show input element.
$input.prop('disabled', false).show();
// Focus on input element.
if (settings.autoFocus) {
$input.focus();
}
// Add "edit" class and remove "view" class in td element.
$(td).addClass('tabledit-edit-mode').removeClass('tabledit-view-mode');
// Update toolbar buttons.
if (settings.editButton) {
$tr.find('button.tabledit-edit-button').addClass('active');
$tr.find('button.tabledit-save-button').show();
}
}
};
/**
* Available actions for edit function, with table td element as parameter or set of td elements.
*
* @type object
*/
var Edit = {
reset: function(td) {
$(td).each(function() {
// Get input element.
var $input = $(this).find('.tabledit-input');
// Get span text.
var text = $(this).find('.tabledit-span').text();
// Set input/select value with span text.
if ($input.is('select')) {
$input.find('option').filter(function() {
return $.trim($(this).text()) === text;
}).attr('selected', true);
} else {
$input.val(text);
}
// Change to view mode.
Mode.view(this);
});
},
submit: function(td) {
// Send AJAX request to server.
var ajaxResult = ajax(settings.buttons.edit.action);
if (ajaxResult === false) {
return;
}
$(td).each(function() {
// Get input element.
var $input = $(this).find('.tabledit-input');
// Set span text with input/select new value.
if ($input.is('select')) {
$(this).find('.tabledit-span').text($input.find('option:selected').text());
} else {
$(this).find('.tabledit-span').text($input.val());
}
// Change to view mode.
Mode.view(this);
});
// Set last edited column and row.
$lastEditedRow = $(td).parent('tr');
}
};
/**
* Available actions for delete function, with button as parameter.
*
* @type object
*/
var Delete = {
reset: function(td) {
// Reset delete button to initial status.
$table.find('.tabledit-confirm-button').hide();
// Remove "active" class in delete button.
$table.find('.tabledit-delete-button').removeClass('active').blur();
},
submit: function(td) {
Delete.reset(td);
// Enable identifier hidden input.
$(td).parent('tr').find('input.tabledit-identifier').attr('disabled', false);
// Send AJAX request to server.
var ajaxResult = ajax(settings.buttons.delete.action);
// Disable identifier hidden input.
$(td).parents('tr').find('input.tabledit-identifier').attr('disabled', true);
if (ajaxResult === false) {
return;
}
// Add class "deleted" to row.
$(td).parent('tr').addClass('tabledit-deleted-row');
// Hide table row.
$(td).parent('tr').addClass(settings.mutedClass).find('.tabledit-toolbar button:not(.tabledit-restore-button)').attr('disabled', true);
// Show restore button.
$(td).find('.tabledit-restore-button').show();
// Set last deleted row.
$lastDeletedRow = $(td).parent('tr');
},
confirm: function(td) {
// Reset all cells in edit mode.
$table.find('td.tabledit-edit-mode').each(function() {
Edit.reset(this);
});
// Add "active" class in delete button.
$(td).find('.tabledit-delete-button').addClass('active');
// Show confirm button.
$(td).find('.tabledit-confirm-button').show();
},
restore: function(td) {
// Enable identifier hidden input.
$(td).parent('tr').find('input.tabledit-identifier').attr('disabled', false);
// Send AJAX request to server.
var ajaxResult = ajax(settings.buttons.restore.action);
// Disable identifier hidden input.
$(td).parents('tr').find('input.tabledit-identifier').attr('disabled', true);
if (ajaxResult === false) {
return;
}
// Remove class "deleted" to row.
$(td).parent('tr').removeClass('tabledit-deleted-row');
// Hide table row.
$(td).parent('tr').removeClass(settings.mutedClass).find('.tabledit-toolbar button').attr('disabled', false);
// Hide restore button.
$(td).find('.tabledit-restore-button').hide();
// Set last restored row.
$lastRestoredRow = $(td).parent('tr');
}
};
/**
* Send AJAX request to server.
*
* @param {string} action
*/
function ajax(action)
{
var serialize = $table.find('.tabledit-input').serialize()
if (!serialize) {
return false;
}
serialize += '&action=' + action;
var result = settings.onAjax(action, serialize);
if (result === false) {
return false;
}
var jqXHR = $.post(settings.url, serialize, function(data, textStatus, jqXHR) {
if (action === settings.buttons.edit.action) {
$lastEditedRow.removeClass(settings.dangerClass).addClass(settings.warningClass);
setTimeout(function() {
//$lastEditedRow.removeClass(settings.warningClass);
$table.find('tr.' + settings.warningClass).removeClass(settings.warningClass);
}, 1400);
}
settings.onSuccess(data, textStatus, jqXHR);
}, 'json');
jqXHR.fail(function(jqXHR, textStatus, errorThrown) {
if (action === settings.buttons.delete.action) {
$lastDeletedRow.removeClass(settings.mutedClass).addClass(settings.dangerClass);
$lastDeletedRow.find('.tabledit-toolbar button').attr('disabled', false);
$lastDeletedRow.find('.tabledit-toolbar .tabledit-restore-button').hide();
} else if (action === settings.buttons.edit.action) {
$lastEditedRow.addClass(settings.dangerClass);
}
settings.onFail(jqXHR, textStatus, errorThrown);
});
jqXHR.always(function() {
settings.onAlways();
});
return jqXHR;
}
Draw.columns.identifier();
Draw.columns.editable();
Draw.columns.toolbar();
settings.onDraw();
if (settings.deleteButton) {
/**
* Delete one row.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-delete-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
// Get current state before reset to view mode.
var activated = $(this).hasClass('active');
var $td = $(this).parents('td');
Delete.reset($td);
if (!activated) {
Delete.confirm($td);
}
event.handled = true;
}
});
/**
* Delete one row (confirm).
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-confirm-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
var $td = $(this).parents('td');
Delete.submit($td);
event.handled = true;
}
});
}
if (settings.restoreButton) {
/**
* Restore one row.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-restore-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
Delete.restore($(this).parents('td'));
event.handled = true;
}
});
}
if (settings.editButton) {
/**
* Activate edit mode on all columns.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-edit-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
var $button = $(this);
// Get current state before reset to view mode.
var activated = $button.hasClass('active');
// Change to view mode columns that are in edit mode.
Edit.reset($table.find('td.tabledit-edit-mode'));
if (!activated) {
// Change to edit mode for all columns in reverse way.
$($button.parents('tr').find('td.tabledit-view-mode').get().reverse()).each(function() {
Mode.edit(this);
});
}
event.handled = true;
}
});
/**
* Save edited row.
*
* @param {object} event
*/
$table.on('click', 'button.tabledit-save-button', function(event) {
if (event.handled !== true) {
event.preventDefault();
// Submit and update all columns.
Edit.submit($(this).parents('tr').find('td.tabledit-edit-mode'));
event.handled = true;
}
});
} else {
/**
* Change to edit mode on table td element.
*
* @param {object} event
*/
$table.on(settings.eventType, 'tr:not(.tabledit-deleted-row) td.tabledit-view-mode', function(event) {
if (event.handled !== true) {
event.preventDefault();
// Reset all td's in edit mode.
Edit.reset($table.find('td.tabledit-edit-mode'));
// Change to edit mode.
Mode.edit(this);
event.handled = true;
}
});
/**
* Change event when input is a select element.
*/
$table.on('change', 'select.tabledit-input:visible', function(event) {
if (event.handled !== true) {
// Submit and update the column.
Edit.submit($(this).parent('td'));
event.handled = true;
}
});
/**
* Click event on document element.
*
* @param {object} event
*/
$(document).on('click', function(event) {
var $editMode = $table.find('.tabledit-edit-mode');
// Reset visible edit mode column.
if (!$editMode.is(event.target) && $editMode.has(event.target).length === 0) {
Edit.reset($table.find('.tabledit-input:visible').parent('td'));
}
});
}
/**
* Keyup event on table element.
*
* @param {object} event
*/
$table.on('keyup', function(event) {
// Get input element with focus or confirmation button.
var $input = $table.find('.tabledit-input:visible');
var $button = $table.find('.tabledit-confirm-button');
if ($input.length > 0) {
var $td = $input.parents('td');
} else if ($button.length > 0) {
var $td = $button.parents('td');
} else {
return;
}
// Key?
switch (event.keyCode) {
case 9: // Tab.
if (!settings.editButton) {
Edit.submit($td);
Mode.edit($td.closest('td').next());
}
break;
case 13: // Enter.
Edit.submit($td);
break;
case 27: // Escape.
Edit.reset($td);
Delete.reset($td);
break;
}
});
return this;
};
}(jQuery));

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,8 @@
<?php if (in_array(16, $partids)) { ?><div id="16" style="position:absolute;left:642px;top:482px;width:35px;height:35px;background-color:yellow;opacity:0.4;"></div><?php } ?>
<?php if (in_array(18, $partids)) { ?><div id="18" style="position:absolute;left:468px;top:248px;width:35px;height:35px;background-color:yellow;opacity:0.4;"></div><?php } ?>
<?php if (in_array(19, $partids)) { ?><div id="19" style="position:absolute;left:468px;top:190px;width:35px;height:35px;background-color:yellow;opacity:0.4;"></div><?php } ?>
<?php if (in_array(20, $partids)) { ?><div id="20" style="position:absolute;left:435px;top:150px;width:35px;height:35px;background-color:yellow;opacity:0.4;"></div><?php } ?>
</div>
<map name="map">
<!-- LEFT IMAGE -->
@ -44,6 +46,16 @@
<area shape="poly" coords="612,394, 746,475, 812,509, 809,529, 774,513, 771,501, 691,454, 682,474, 591,422, 592,373, 603,366" target="_self" alt="<?php echo $sixteens; ?>" title="<?php echo $sixteens; ?>" onclick="document.getElementById('descriptionpartvalue').value='<?php echo $sixteens; ?>';document.getElementById('partid').value='16';" href="javascript:void(0)">
<area shape="poly" coords="631,298, 658,301, 709,358, 710,385, 649,354, 624,353, 611,359,615,232" target="_self" alt="<?php echo $eighteens; ?>" title="<?php echo $eighteens; ?>" onclick="document.getElementById('descriptionpartvalue').value='<?php echo $eighteens; ?>';document.getElementById('partid').value='18';" href="javascript:void(0)">
<area shape="poly" coords="637,214, 684,206, 764,213, 767,282, 784,340, 833,398, 848,405, 857,413, 808,424, 794,439, 709,384, 708,358, 661,301, 630,297, 634,245, 631,221" target="_self" alt="<?php echo $nineteens; ?>" title="<?php echo $nineteens; ?>" onclick="document.getElementById('descriptionpartvalue').value='<?php echo $nineteens; ?>';document.getElementById('partid').value='19';" href="javascript:void(0)">
<area shape="rect" coords="473,162,534,203"
target="_self" alt="<?php echo $twentys; ?>" title="<?php echo $twentys; ?>"
onclick="document.getElementById('descriptionpartvalue').value='<?php echo $twentys; ?>';document.getElementById('partid').value='20';"
href="javascript:void(0)">
<area shape="rect" coords="770,231,789,258"
target="_self" alt="<?php echo $twentys; ?>" title="<?php echo $twentys; ?>"
onclick="document.getElementById('descriptionpartvalue').value='<?php echo $twentys; ?>';document.getElementById('partid').value='20';"
href="javascript:void(0)">
<!-- <area target="_self" alt="<?php echo $twos; ?>" title="<?php echo $twos; ?>" coords="286,177,292,239,286,288,318,338,344,383,324,392,264,306,255,296,252,248,245,211,236,201,256,184" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $twos; ?>')" href="javascript:void(0)">
<area target="_self" alt="<?php echo $fours; ?>" title="<?php echo $fours; ?>" coords="331,393,349,383,380,422,466,459,454,490,397,509,380,532,365,564,263,530,211,493,170,457,161,449,161,421,219,433,264,455,291,478,345,431" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $fours; ?>')" href="javascript:void(0)">
@ -59,7 +71,11 @@
<area target="_self" alt="<?php echo $fifteens; ?>" title="<?php echo $fifteens; ?>" coords="797,479,719,430,636,376,618,369,644,363,698,387,745,413,811,445,912,475,976,510,1009,532,986,537,914,523,870,510" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $fifteens; ?>')" href="javascript:void(0)">
<area target="_self" alt="<?php echo $sixteens; ?>" title="<?php echo $sixteens; ?>" coords="729,468,698,570,750,582,765,489" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $sixteens; ?>')" href="javascript:void(0)">
<area target="_self" alt="<?php echo $nineteens; ?>" title="<?php echo $nineteens; ?>" coords="633,215,629,295,661,303,705,344,708,380,744,407,795,434,846,406,791,346,765,291,764,243,761,208,668,205" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $nineteens; ?>')" href="javascript:void(0)">
<area target="_self" alt="<?php echo $eighteens; ?>" title="<?php echo $eighteens; ?>" coords="628,301,614,355,644,354,683,366,707,379,700,340,661,302,642,299,653,300" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $eighteens; ?>')" href="javascript:void(0)">
<area shape="rect" coords="553,162,534,203"
target="_self" alt="<?php echo $twentys; ?>" title="<?php echo $twentys; ?>"
onclick="setInputVal('descriptionpartvalue', '<?php echo $twentys; ?>')"
href="javascript:void(0)">
<area target="_self" alt="<?php echo $eighteens; ?>" title="<?php echo $eighteens; ?>" coords="628,301,614,355,644,354,683,366,707,379,700,340,661,302,642,299,653,300" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $eighteens; ?>')" href="javascript:void(0)">
<area target="_self" alt="<?php echo $ones; ?>" title="<?php echo $ones; ?>" coords="647,171,654,186,636,208,703,201,765,205,781,173,723,164" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $ones; ?>')" href="javascript:void(0)">
<area target="_self" alt="<?php echo $sixs; ?>" title="<?php echo $sixs; ?>" coords="18,192,14,239,114,259,114,218" shape="poly" onclick="setInputVal('descriptionpartvalue', '<?php echo $sixs; ?>')" href="javascript:void(0)"> -->
</map>

View File

@ -1,22 +1,21 @@
<?php
$ones="Collar";
$twos="Tongue";
$threes="Facing";
$fours="Upper (vamp)";
$fives="Scuff cap";
$sixs="back strap";
$sevens="Upper (quarter)";
$eights="Upper (counter)";
$nines="Outsole - Heel";
$tens="Sole Complex";
$elevens="Outsole - Forepart";
$twelves="Vamp lining";
$thirteens="Safety toe cap";
$fourteens="Insole";
$fifteens="Insock or seat sock";
$sixteens="Perforation-resistant insert";
$seventeens="Counter stiffener";
$eighteens="Counter lining";
$nineteens="Quarter lining";
$twentys="Toecap back edge covering";
?>
$ones = "Collar";
$twos = "Tongue";
$threes = "Facing";
$fours = "Upper (vamp)";
$fives = "Scuff cap";
$sixs = "back strap";
$sevens = "Upper (quarter)";
$eights = "Upper (counter)";
$nines = "Outsole - Heel";
$tens = "Sole Complex";
$elevens = "Outsole - Forepart";
$twelves = "Vamp lining";
$thirteens = "Safety toe cap";
$fourteens = "Insole";
$fifteens = "Insock or seat sock";
$sixteens = "Perforation-resistant insert";
$seventeens = "Counter stiffener";
$eighteens = "Counter lining";
$nineteens = "Quarter lining";
$twentys = "Tongue lining";

View File

@ -1,22 +1,21 @@
<?php
$ones="Collarino";
$twos="Linguetta";
$threes="Listino portaocchielli";
$fours="Tomaio (mascherina)";
$fives="Copripuntale";
$sixs="Tirante posteriore";
$sevens="Tomaio (quartiere)";
$eights="Tomaio (tallone) ";
$nines="Suola - Tacco";
$tens="Fondo della calzatura";
$elevens="Suola - Pianta";
$twelves="Fodera della mascherina";
$thirteens="Puntale di sicurezza";
$fourteens="Sottopiede ";
$fifteens="Plantare o tallonetta";
$sixteens="Inserto resistente alla perforazione";
$seventeens="Contrafforte";
$eighteens="Fodera del tallone";
$nineteens="Fodera del quartiere";
$twentys="Imbottitura del bordo posteriore del puntale";
?>
$ones = "Collarino";
$twos = "Linguetta";
$threes = "Listino portaocchielli";
$fours = "Tomaio (mascherina)";
$fives = "Copripuntale";
$sixs = "Tirante posteriore";
$sevens = "Tomaio (quartiere)";
$eights = "Tomaio (tallone) ";
$nines = "Suola - Tacco";
$tens = "Fondo della calzatura";
$elevens = "Suola - Pianta";
$twelves = "Fodera della mascherina";
$thirteens = "Puntale di sicurezza";
$fourteens = "Sottopiede ";
$fifteens = "Plantare o tallonetta";
$sixteens = "Inserto resistente alla perforazione";
$seventeens = "Contrafforte";
$eighteens = "Fodera del tallone";
$nineteens = "Fodera del quartiere";
$twentys = "Fodera della linguetta";

View File

@ -9,41 +9,35 @@ include('db-connect.php');
$input = filter_input_array(INPUT_POST);
if ($input['action'] === 'edit')
{
$sqlSelect="SELECT * FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'";
$records=mysqli_query($con,$sqlSelect);
if(mysqli_num_rows($records)>0){
if(isset($input['idprotectioncategory'])){
$q_idprotectioncategory = "idprotectioncategory='{$input['idprotectioncategory']}'" ;
}else{
if ($input['action'] === 'edit') {
$sqlSelect = "SELECT * FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'";
$records = mysqli_query($con, $sqlSelect);
if (mysqli_num_rows($records) > 0) {
if (isset($input['idprotectioncategory'])) {
$q_idprotectioncategory = "idprotectioncategory='{$input['idprotectioncategory']}'";
} else {
$q_idprotectioncategory = "";
}
if(isset($input['iddpicategory'])){
$q_iddpicategory = "iddpicategory='{$input['iddpicategory']}'" ;
}else{
if (isset($input['iddpicategory'])) {
$q_iddpicategory = "iddpicategory='{$input['iddpicategory']}'";
} else {
$q_iddpicategory = "";
}
$sql = "UPDATE trfstandards SET {$q_idprotectioncategory} {$q_iddpicategory} WHERE idtrfstandards='" . $input['id'] . "'";
// mysqli_query($con,$sql);
} else {
$sql = "INSERT INTO trfstandards SET idtrfdetails ='" . $input['idtrfdetails'] . "', idstandards='" . $input['idstandards'] . "'" . " , idprotectioncategory='" . $input['idprotectioncategory'] . "'" . " , iddpicategory='" . $input['iddpicategory'] . "'";
}
else {
$sql = "INSERT INTO trfstandards SET idtrfdetails ='" . $input['idtrfdetails'] . "', idstandards='" . $input['idstandards'] . "'" ." , idprotectioncategory='" . $input['idprotectioncategory'] . "'" ." , iddpicategory='" . $input['iddpicategory'] . "'";
}
mysqli_query($con,$sql);
}
if ($input['action'] === 'delete')
{
mysqli_query($con,"DELETE FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'");
}
mysqli_query($con, $sql);
}
if ($input['action'] === 'delete') {
mysqli_query($con, "DELETE FROM trfstandards WHERE idtrfstandards='" . $input['id'] . "'");
}
//mysqli_close($mysqli);
echo json_encode($input);
?>

Binary file not shown.

Binary file not shown.

View File

@ -320,8 +320,8 @@ $iddpicategoryperStdJson = json_encode($iddpicategorylistRecord);
<!-- inline edit -->
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="https://kit.fontawesome.com/f13e61f9bf.js" crossorigin="anonymous"></script>
<script src="jquery.tabledit.js"></script>
<!-- submit form with button -->

View File

@ -0,0 +1,890 @@
<?php require_once('../Connections/cmctrfdb.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
include('include/headscript.php');
include('db-connect.php');
?>
<?php
// pickup the get variable
// pickup the get variable
if (isset($_POST["idtrf"])) {
$idtrf = $_POST["idtrf"];
}
if (isset($_GET["idtrf"])) {
$idtrf = $_GET["idtrf"];
}
if (isset($_POST["photoname"])) {
$photoname = $_POST["photoname"];
}
if (isset($_POST["description"])) {
$description = $_POST["description"];
}
if (isset($_POST["model"])) {
$model = $_POST["model"];
}
if (isset($_POST["rangemeasuremin"])) {
$rangemeasuremin = $_POST["rangemeasuremin"];
}
if (isset($_POST["rangemeasuremax"])) {
$rangemeasuremax = $_POST["rangemeasuremax"];
}
if (isset($_POST["registeredmark"])) {
$registeredmark = $_POST["registeredmark"];
}
if (isset($_POST["rangemeasuremintext"])) {
$rangemeasuremintext = $_POST["rangemeasuremintext"];
}
if (isset($_POST["rangemeasuremaxtext"])) {
$rangemeasuremaxtext = $_POST["rangemeasuremaxtext"];
}
if (isset($_POST["articletype"])) {
$articletype = $_POST["articletype"];
}
if (isset($_POST["previousreportnumber"])) {
$previousreportnumber = $_POST["previousreportnumber"];
} else {
$previousreportnumber = '';
}
if (isset($_POST["toextend"])) {
$toextend = $_POST["toextend"];
} else {
$toextend = '';
}
if (isset($_POST["revisionfor"])) {
$revisionfor = $_POST["revisionfor"];
} else {
$revisionfor = '';
}
if (isset($_POST["renewdate"])) {
$renewdate = $_POST["renewdate"];
} else {
$renewdate = '';
}
if (isset($_POST["articlecharacteristic"])) {
$articlecharacteristic = $_POST["articlecharacteristic"];
}
if (isset($_POST["formupdtrfdetails"])) {
$formupdtrfdetails = $_POST["formupdtrfdetails"];
}
if (isset($_POST['stdselected'])) {
$stds = $_POST['stdselected'];
}
if (isset($_POST["updstdform"])) {
$updstdform = $_POST["updstdform"];
}
if (isset($articlecharacteristic)) {
$listartchar = implode(',', $articlecharacteristic);
} else {
$listartchar = "";
}
//echo $listartchar;
?>
<?php
include('include/trfqueryscript.php'); ?>
<?php if (isset($articlecharacteristic)) {
foreach ($articlecharacteristic as $ac) {
$stdfromartchar = new WA_MySQLi_RS("stdfromartchar", $cmctrfdb, 1);
$stdfromartchar->setQuery("SELECT * FROM standards WHERE standards.idarticlecharacteristic='$ac'");
$stdfromartchar->execute();
$value = $stdfromartchar->getColumnVal("idstandards");
$dpicatsel = $stdfromartchar->getColumnVal("iddpicategory");
//foreach ($stds as $hobys=>$value) {
$stdcheckpresent = new WA_MySQLi_RS("stdcheckpresent", $cmctrfdb, 1);
$stdcheckpresent->setQuery("SELECT * FROM trfstandards WHERE trfstandards.idtrfdetails='$idtrf' AND trfstandards.idstandards='$value'");
$stdcheckpresent->execute();
// insert for glovces EN 420 if not present
/* if ($articletype==2) {
$stdcheckpresent420 = new WA_MySQLi_RS("stdcheckpresent420",$cmctrfdb,1);
$stdcheckpresent420->setQuery("SELECT * FROM trfstandards WHERE trfstandards.idtrfdetails='$idtrf' AND trfstandards.idstandards='129'");
$stdcheckpresent420->execute();
if (empty($stdcheckpresent420->getColumnVal("idtrfstandards"))) {
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "trfstandards";
$InsertQuery->bindColumn("idtrfdetails", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("idstandards", "i", "129", "WA_DEFAULT");
$InsertQuery->bindColumn("iddpicategory", "i", "$dpicatsel", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
}} */
if (empty($stdcheckpresent->getColumnVal("idtrfstandards"))) {
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "trfstandards";
$InsertQuery->bindColumn("idtrfdetails", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("idstandards", "i", "$value", "WA_DEFAULT");
$InsertQuery->bindColumn("iddpicategory", "i", "$dpicatsel", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
}
}
} //}
?>
<?php
if (isset($formupdtrfdetails)) {
if ($articletype == '1' or $articletype == '2' or $articletype == '4') {
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`trf-details`";
$UpdateQuery->bindColumn("sample_description", "s", "$description", "WA_DEFAULT");
$UpdateQuery->bindColumn("measurefrom", "s", "$rangemeasuremin", "WA_DEFAULT");
$UpdateQuery->bindColumn("measureto", "s", "$rangemeasuremax", "WA_DEFAULT");
$UpdateQuery->bindColumn("model", "s", "$model", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticletype", "i", "$articletype", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticle_characteristics", "s", "$listartchar", "WA_DEFAULT");
$UpdateQuery->bindColumn("registeredmark", "s", "$registeredmark", "WA_DEFAULT");
$UpdateQuery->bindColumn("previousreportnumber", "s", "$previousreportnumber", "WA_DEFAULT");
$UpdateQuery->bindColumn("toextend", "s", "$toextend", "WA_DEFAULT");
$UpdateQuery->bindColumn("revisionfor", "s", "$revisionfor", "WA_DEFAULT");
$UpdateQuery->bindColumn("renewdate", "s", "$renewdate", "WA_DEFAULT");
$UpdateQuery->addFilter("idtrfdetails", "=", "i", "" . ($idtrf) . "");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";
$UpdateQuery->redirect($UpdateGoTo);
$code = "3";
$InsertQuery2 = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery2->Action = "insert";
$InsertQuery2->Table = "wheretrfstep";
$InsertQuery2->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery2->bindColumn("code", "s", "$code", "WA_DEFAULT");
$InsertQuery2->saveInSession("");
$InsertQuery2->execute();
$InsertGoTo = "";
$InsertQuery2->redirect($InsertGoTo);
} else {
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`trf-details`";
$UpdateQuery->bindColumn("sample_description", "s", "$description", "WA_DEFAULT");
$UpdateQuery->bindColumn("measurefrom", "s", "$rangemeasuremintext", "WA_DEFAULT");
$UpdateQuery->bindColumn("measureto", "s", "$rangemeasuremaxtext", "WA_DEFAULT");
$UpdateQuery->bindColumn("model", "s", "$model", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticletype", "i", "$articletype", "WA_DEFAULT");
$UpdateQuery->bindColumn("idarticle_characteristics", "s", "$listartchar", "WA_DEFAULT");
$UpdateQuery->bindColumn("registeredmark", "s", "$registeredmark", "WA_DEFAULT");
$UpdateQuery->addFilter("idtrfdetails", "=", "i", "" . ($idtrf) . "");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";
$UpdateQuery->redirect($UpdateGoTo);
$code = "3";
$InsertQuery2 = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery2->Action = "insert";
$InsertQuery2->Table = "wheretrfstep";
$InsertQuery2->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery2->bindColumn("code", "s", "$code", "WA_DEFAULT");
$InsertQuery2->saveInSession("");
$InsertQuery2->execute();
$InsertGoTo = "";
$InsertQuery2->redirect($InsertGoTo);
}
}
?>
<?php
include('include/trfqueryscript.php'); ?>
<?php
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal", $cmctrfdb, 1);
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");
$trfnumberfinal->execute();
$idcertn = $trfnumberfinal->getColumnVal("idcertification");
$articletype = $trfnumberfinal->getColumnVal("idarticletype");
$articlecharact = $trfnumberfinal->getColumnVal("idarticle_characteristics");
?>
<?php $idcert = $trfnumberfinal->getColumnVal("idcertification") ?>
<?php
$certname = new WA_MySQLi_RS("certname", $cmctrfdb, 1);
$certname->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcert'");
$certname->execute(); ?>
<?php // if all the standards of articletype
// $stdcheck = new WA_MySQLi_RS("stdcheck",$cmctrfdb,0);
// $stdcheck->setQuery("SELECT * FROM standards WHERE standards.idarticletype='$articletype'");
// $stdcheck->execute();
?>
<?php // preselection based on article characteristic
$stdcheck = new WA_MySQLi_RS("stdcheck", $cmctrfdb, 0);
$stdcheck->setQuery("SELECT * FROM standards WHERE standards.idarticlecharacteristic='$articlecharact' ");
$stdcheck->execute();
$idstselect = $stdcheck->getColumnVal("idstandards");
?>
<?php // inline edit query
$idtrfdetails = $idtrf;
$row1 = mysqli_query($con, "SELECT *,trfstandards.iddpicategory as iddpicategoryid,trfstandards.idprotectioncategory as idprotectioncategoryid,trfstandards.idstandards as idstandardsid FROM trfstandards LEFT JOIN standards ON trfstandards.idstandards=standards.idstandards LEFT JOIN dpicategory ON trfstandards.iddpicategory=dpicategory.iddpicategory LEFT JOIN protectioncategory ON trfstandards.idprotectioncategory=protectioncategory.idprotectioncategory WHERE trfstandards.idtrfdetails='$idtrf'");
//$rows = mysqli_fetch_assoc($row1);
//print_r($rows);
//exit;
$idstandards = mysqli_query($con, "SELECT idstandards ,standardname FROM standards");
//query list protectioncategory
// $proteccategorylist=mysqli_query($con,"SELECT idprotectioncategory ,name_protectioncategory FROM protectioncategory");
// $idproteccategorylistRecord=array();
// while($idprotectioncategoryrow = mysqli_fetch_assoc($proteccategorylist)) {
// $idproteccategorylistRecord[$idprotectioncategoryrow['idprotectioncategory']]=utf8_encode($idprotectioncategoryrow['name_protectioncategory']);
// }
// $idprotectioncategoryJson=json_encode($idproteccategorylistRecord);
/* GET OPTIONS FOR Categoria di protezione per standard */
$idprotectioncategoryJson = json_encode(array());
$proteccategorylist = mysqli_query($con, "select s.idstandards, p.idprotectioncategory, p.name_protectioncategory
from stdprotectioncat s
left join protectioncategory p
on s.idprotectioncategory = p.idprotectioncategory
where 1");
$idproteccategorylistRecord = array();
while ($idprotectioncategoryrow = mysqli_fetch_assoc($proteccategorylist)) {
$nameprotcat = html_entity_decode($idprotectioncategoryrow['name_protectioncategory']);
$nameprotcat = iconv('UTF-8', 'windows-1252', $nameprotcat);
$idproteccategorylistRecord[$idprotectioncategoryrow['idstandards']][$idprotectioncategoryrow['idprotectioncategory']] = utf8_encode(htmlspecialchars($nameprotcat, ENT_QUOTES));
//utf8_encode(htmlspecialchars($idprotectioncategoryrow['name_protectioncategory']
}
$idprotectioncategoryperStdJson = json_encode($idproteccategorylistRecord);
/* END GET OPTIONS FOR Categoria di protezione per standard */
// //Impermeabilità
// //query list protectioncategory
// $dpicategroylist=mysqli_query($con,"SELECT iddpicategory ,value_dpicategory FROM dpicategory");
// $iddpicategorylistRecord=array();
// while($iddpicategoryrow = mysqli_fetch_assoc($dpicategroylist)) {
// $iddpicategorylistRecord[$iddpicategoryrow['iddpicategory']]=utf8_encode($iddpicategoryrow['value_dpicategory']);
// }
// $iddpicategoryJson=json_encode($iddpicategorylistRecord);
/* GET OPTIONS FOR Categoria DPI per standard */
$iddpicategoryJson = json_encode(array());
$dpicategroylist = mysqli_query($con, "select s.idstandards, d.iddpicategory, d.value_dpicategory
from stddpicategory s
left join dpicategory d
on s.iddpicategory = d.iddpicategory
where 1");
$iddpicategorylistRecord = array();
while ($iddpicategoryrow = mysqli_fetch_assoc($dpicategroylist)) {
$iddpicategorylistRecord[$iddpicategoryrow['idstandards']][$iddpicategoryrow['iddpicategory']] = utf8_encode(htmlspecialchars($iddpicategoryrow['value_dpicategory'], ENT_QUOTES));
}
$iddpicategoryperStdJson = json_encode($iddpicategorylistRecord);
/* END GET OPTIONS FOR Categoria DPI per standard */
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php echo $titlepage; ?> </title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta content="CIMAC TRF Portal" name="description" />
<meta content="" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="../images/favicon.ico">
<!--Form Wizard-->
<link href="../plugins/jquery-steps/jquery.steps.css" rel="stylesheet" type="text/css">
<!-- App css -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/jquery-ui.min.css" rel="stylesheet">
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/metisMenu.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/app.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.6/dist/sweetalert2.min.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.6/dist/sweetalert2.min.js"></script>
<!-- inline edit -->
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://kit.fontawesome.com/f13e61f9bf.js" crossorigin="anonymous"></script>
<script src="jquery.tabledit.js"></script>
<!-- submit form with button -->
<script>
function formSubmit() {
document.forms["myForm"].submit();
}
</script>
<script type="text/javascript">
$(document).ready(function() {
var articletype = <?php echo $articletype; ?>;
populate_cat_tbl();
$("#add").click(function(e) {
var table = $(this).attr('for-table'); //get the target table selector
var $tr = $(table + ">tbody>tr:last-child").clone(true, true); //clone the last row
var nextID = parseInt($tr.find("input.tabledit-identifier").val()) + 1; //get the ID and add one.
$tr.find("input.tabledit-identifier").val(nextID); //set the row identifier
$tr.find("span.tabledit-identifier").text(nextID); //set the row identifier
$(table + ">tbody").append($tr); //add the row to the table
$tr.find(".tabledit-edit-button").click(); //pretend to click the edit button
$tr.find("input:not([type=hidden]), select").val(""); //wipe out the inputs.
$(this).prop('disabled', true);
$('select[name=idprotectioncategoryid]').prepend("<option value='' selected='selected'>Please Select</option>");
$('select[name=iddpicategoryid]').prepend("<option value='' selected='selected'>Please Select</option>");
});
/*$('#example1').Tabledit({
url: 'logic-edit-delete.php',
columns: {
identifier: [0, 'id'],
editable: [[2, 'idprotectioncategory','<?php echo $idprotectioncategoryJson; ?>'], [3, 'iddpicategory','<?php echo $iddpicategoryJson; ?>']]
},
onDraw: function() {
console.log('onDraw()');
},
onSuccess: function(data, textStatus, jqXHR) {
console.log('onSuccess(data, textStatus, jqXHR)');
console.log(data);
console.log(textStatus);
console.log(jqXHR);
$("#add").prop('disabled', false);
//location.reload();
},
onFail: function(jqXHR, textStatus, errorThrown) {
console.log('onFail(jqXHR, textStatus, errorThrown)');
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
},
onAlways: function() {
console.log('onAlways()');
},
onAjax: function(action, serialize) {
console.log('onAjax(action, serialize)');
console.log(action);
console.log(serialize);
}
});*/
});
function populate_cat_tbl() {
// $.get('cat-table.php', {idtrf:'<?php echo $idtrf; ?>', standardcodetitle:'<?php echo $standardcodetitle ?>', protectioncategorytitle:'<?php echo $protectioncategorytitle; ?>', dpicategorytitle:'<?php echo $dpicategorytitle; ?>', pleaseselectstd:'<?php echo $pleaseselectstd; ?>'}, function(data){
// $('#cat_table_cont').html(data);
// $('#example1').Tabledit({
// url: 'logic-edit-delete.php',
// autoFocus: true,
// columns: {
// identifier: [0, 'id'],
// editable: [[2, 'idprotectioncategory','<?php echo $idprotectioncategoryJson; ?>'], [3, 'iddpicategory','<?php echo $iddpicategoryJson; ?>']]
// },
// editButton: false,
// onDraw: function() {
// // console.log('onDraw()');
// },
// onSuccess: function(data, textStatus, jqXHR) {
// // console.log('onSuccess(data, textStatus, jqXHR)');
// // console.log(data);
// // console.log(textStatus);
// // console.log(jqXHR);
// $("#add").prop('disabled', false);
// populate_cat_tbl();
// /* HIGHLIGHT TR */
// let trID = "#"+data['id'];
// let defBGColor = $(trID).css("background-color");
// let defTxtColor = $(trID).css("color");
// setTimeout(function(){
// $(trID).css({'background-color':'#228B22', 'color':'#F0F8FF'});
// $(trID).fadeOut(300, function(){ $(trID).css({'background-color':defBGColor, 'color':defTxtColor}) }).fadeIn(100);
// } ,200);
// }
// });
// });
$.ajax({
type: "GET",
url: "cat-table.php",
cache: false,
data: {
"idtrf": "<?php echo $idtrf; ?>",
"standardcodetitle": "<?php echo $standardcodetitle ?>",
"protectioncategorytitle": "<?php echo $protectioncategorytitle; ?>",
"dpicategorytitle": "<?php echo $dpicategorytitle; ?>",
"pleaseselectstd": "<?php echo $pleaseselectstd; ?>"
},
success: function(result) {
if (result != '') {
/* POPULATE TABLE */
$('#cat_table_cont').html(result);
/* INITIATE TABLEDIT */
$('#example1').Tabledit({
url: 'logic-edit-delete.php',
autoFocus: true,
columns: {
identifier: [0, 'id'],
editable: [
[2, 'idprotectioncategory', '<?php echo $idprotectioncategoryJson; ?>'],
[3, 'iddpicategory', '<?php echo $iddpicategoryJson; ?>']
]
},
editButton: false,
onSuccess: function(data, textStatus, jqXHR) {
$("#add").prop('disabled', false);
populate_cat_tbl();
/* HIGHLIGHT TR */
let trID = "#" + data['id'];
let defBGColor = $(trID).css("background-color");
let defTxtColor = $(trID).css("color");
setTimeout(function() {
$(trID).css({
'background-color': '#228B22',
'color': '#F0F8FF'
});
$(trID).fadeOut(300, function() {
$(trID).css({
'background-color': defBGColor,
'color': defTxtColor
})
}).fadeIn(100);
}, 200);
}
});
}
}
});
}
</script>
<style>
.table.user-select-none {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
</style>
</head>
<body>
<!-- Top Bar Start -->
<?php include('include/topbar.php'); ?>
<!-- Top Bar End -->
<!-- Left Sidenav -->
<?php include('include/leftsidenav.php'); ?>
<!-- end left-sidenav-->
<div class="page-wrapper">
<!-- Page Content-->
<div class="page-content">
<div class="container-fluid">
<!-- Page-Title -->
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<div class="float-right">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);"><?php echo $titlepage; ?></a></li>
<li class="breadcrumb-item active">Starter</li>
</ol>
</div>
<h4 class="page-title"><?php echo $titlewb; ?></h4>
</div><!--end page-title-box-->
</div><!--end col-->
</div>
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<div class="media">
<?php include('include/appform.php'); ?>
</div><!--end media-->
</div><!--end card-body-->
</div><!--end card-->
<div id="accordion">
<div class="card">
<div class="card-2" id="headingThree">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
<?php echo $descriptionstep; ?>
</button>
</h5>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
<div class="card-body">
<div class="table-responsive">
<table class="table table-success mb-0">
<thead>
<tr>
<th></th>
<th><?php echo $typearticletitle; ?></th>
<th><?php echo $descriptiontitle; ?></th>
<th><?php echo $modeltitle; ?></th>
<th><?php echo $rangemeasuremintitle; ?></th>
<th><?php echo $rangemeasuremaxtitle; ?></th>
<th><?php echo $articlecharacteristictitle; ?></th>
<th><?php echo $registeredmarktitle; ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="uploadimages/<?php echo $sphotofilename; ?>" height="100" alt="" /></td>
<td><span class="badge badge-soft-primary"><?php echo $sname_articletype; ?></span></td>
<td><?php echo $sdescription; ?></td>
<td><?php echo $smodel; ?></td>
<td><?php echo $smeasuremin; ?></td>
<td><?php echo $smeasuremax; ?></td>
<td><span class="badge badge-soft-primary"><?php echo $sname_articlecharacteristic; ?></span></td>
<td><?php echo $sregisteredmark; ?></td>
</tr>
</tbody>
</table><!--end /table-->
<br>
<a href="trfdetails.php?idtrf=<?php echo $idtrf; ?>"><button type="button" class="btn btn-success waves-effect waves-light"><?php echo $edittitle; ?></button> </a>
</div><!--end /tableresponsive-->
</div>
</div>
</div>
</div>
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 50%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">50%</div>
</div>
<!-- <div class="card">
<div class="card-body">
<?php include('include/alertcheck.php'); ?>
<h5><?php echo $standardlink; ?></h5>
<p class="text-muted mb-3"><?php echo $standardlink_help; ?></p>
<form class="was-validated" action="standardstep.php" method="post" name="myForm">
<?php
$wa_startindex = 0;
while (!$stdcheck->atEnd()) {
$wa_startindex = $stdcheck->Index;
?>
<?php
$stdcheck->moveNext();
}
$stdcheck->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</form>
</div>--><!--end card-->
</div><!--end col-->
<?php
$standardselectedlist = new WA_MySQLi_RS("standardselectedlist", $cmctrfdb, 0);
$standardselectedlist->setQuery("SELECT * FROM trfstandards LEFT JOIN standards ON trfstandards.idstandards=standards.idstandards WHERE trfstandards.idtrfdetails='$idtrf'");
$standardselectedlist->execute(); ?>
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h5><?php echo $assignedstd; ?></h4>
<p class="text-muted mb-3">
<?php echo $assignedstd_help; ?>.
</p>
<div class="table-responsive">
<?php include('include/alertcheck.php'); ?>
<div id="cat_table_cont"></div>
<!--<table class="table table-striped mb-0" id="example1" style="border:1px solide red">
<tr><th style="display:none;">id</th><th><?php echo $standardcodetitle; ?></th><th><?php echo $protectioncategorytitle; ?></th><th><?php echo $dpicategorytitle; ?></th></tr>
<?php while ($rowquery = mysqli_fetch_assoc($row1)) { ?>
<tr>
<td style="display:none;"><?php echo $rowquery['idtrfstandards']; ?></td>
<td><?php echo $rowquery['standardcode']; ?></td>
<?php $nameprotcatrec = html_entity_decode($rowquery['name_protectioncategory']);
//$nameprotcatrec=utf8_encode($nameprotcatrec);
//$nameprotcatrec = iconv('UTF-8', 'windows-1252', $nameprotcatrec);
?>
<td><?php if (isset($rowquery['name_protectioncategory'])) {
echo $nameprotcatrec;
} else { ?><p style="color:red;"><?php echo $pleaseselectstd;
} ?></p></td>
<td><?php if (isset($rowquery['value_dpicategory'])) {
echo $rowquery['value_dpicategory'];
} else {
echo $pleaseselectstd;
} ?></td>
//echo $rowquery['name_protectioncategory']
</tr>
<?php } ?>
</table>-->
<?php include('include/virusquerycheck.php'); ?><br>
<?php
if (isset($_GET['error']) && $_GET['error'] == "tuttiicampidevonoesserericompilati") {
echo '<p style="color: red;">Attenzione: tutti i campi devono essere compilati.</p>';
}
?>
<?php
$conn = mysqli_connect($hostname_cmctrfdb, $username_cmctrfdb, $password_cmctrfdb, $database_cmctrfdb);
if (!$conn) {
die("Connessione al database fallita: " . mysqli_connect_error());
}
// Controllo dei campi nulli
$sql = "SELECT COUNT(*) AS num_rows FROM trfstandards WHERE idtrfdetails = $idtrf AND (idprotectioncategory IS NULL OR iddpicategory IS NULL)";
$resultcat = mysqli_query($conn, $sql);
// Controllo degli errori
if (!$resultcat) {
die("Errore nella query: " . mysqli_error($conn));
}
$row = mysqli_fetch_assoc($resultcat);
// Campi nulli trovati, torna alla pagina standardstep.php e mostra il messaggio di errore
echo '<button onclick="checkParts()" class="btn btn-success waves-effect waves-light">' . $nextsteptitle . '</button>';
if (($articletype == 1) || (!empty($virusstep))) {
echo '<script>
function checkParts() {
var isValid = true;
$("select[name=idprotectioncategory]").each(function() {
if ($(this).val() === "" || $(this).val() === "Seleziona" || $(this).parent("td").find("span").html() == "Please Select" || $(this).parent("td").find("span").html() == "Seleziona") {
isValid = false;
}
});
if (!isValid) {
Swal.fire({
icon: "warning",
title: "Attenzione/Warning",
text: "Devi selezionare la categoria di protezione / Please select Protection category!",
confirmButtonText: "Conferma/Confirm",
showCancelButton: false,
}).then((result) => {
});
} else {
Swal.fire({
icon: "warning",
title: "' . $titlealertstd . '",
text: "' . $textalertstd . '",
confirmButtonText: "' . $confirmButtonTextalertstd . '",
showCancelButton: true,
cancelButtonText: "' . $cancelButtonTextalertstdandard . '"
}).then((result) => {
if (result.isConfirmed) {
window.location.href = "additionalinfo.php?idtrf=' . $idtrf . '&codestep=3";
} else if (result.dismiss === Swal.close) {
alert("' . $alertTextstd . '");
}
});
}
}
</script>';
} else {
echo '<script>
function checkParts() {
var isValid = true;
$("select[name=idprotectioncategory]").each(function() {
if ($(this).val() === "" || $(this).val() === "Seleziona" || $(this).parent("td").find("span").html() == "Please Select" || $(this).parent("td").find("span").html() == "Seleziona") {
isValid = false;
}
});
if (!isValid) {
Swal.fire({
icon: "warning",
title: "Warning",
text: "Please select Protection category!",
confirmButtonText: "Confirm",
showCancelButton: false,
}).then((result) => {
});
} else {
Swal.fire({
icon: "warning",
title: "' . $titlealertstd . '",
text: "' . $textalertstd . '",
confirmButtonText: "' . $confirmButtonTextalertstd . '",
showCancelButton: true,
cancelButtonText: "' . $cancelButtonTextalertstdandard . '"
}).then((result) => {
if (result.isConfirmed) {
window.location.href = "addrequirements.php?idtrf=' . $idtrf . '&codestep=3";
} else if (result.dismiss === Swal.close) {
alert("' . $alertTextstd . '");
}
});
}
}
</script>';
}
?>
<button type="button" class="btn btn-dark waves-effect waves-light" onclick="history.back()"><?php echo $backstep; ?></button>
<!--end /table-->
</div><!--end /tableresponsive-->
</div><!--end card-body-->
</div><!--end card-->
</div>
</div>
<!-- end page title end breadcrumb -->
</div><!-- container -->
<!-- footer start -->
<?php include('include/footer.php'); ?>
</footer><!--end footer-->
</div>
<!-- end page content -->
</div>
<!-- end page-wrapper -->
<!-- jQuery -->
<!-- <script src="assets/js/jquery.min.js"></script> -->
<script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/metismenu.min.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/feather.min.js"></script>
<script src="assets/js/jquery.slimscroll.min.js"></script>
<script src="assets/js/jquery-ui.min.js"></script>
<script src="../plugins/jquery-steps/jquery.steps.min.js"></script>
<script src="assets/pages/jquery.form-wizard.init.js"></script>
<!-- App js -->
<script src="assets/js/app.js"></script>
<script>
function getSelectOptions(standardId, selectName, currentValue) {
let thisOptions = [];
let totalOptionsCount = 0;
if (selectName == 'iddpicategory') {
thisOptions = JSON.parse('<?php echo $iddpicategoryperStdJson; ?>'); /* GET LIST OF dpi category PER STANDARD */
} else if (selectName == 'idprotectioncategory') {
thisOptions = JSON.parse('<?php echo $idprotectioncategoryperStdJson; ?>'); /* GET LIST OF protection category PER STANDARD */
}
totalOptionsCount = Object.keys(thisOptions[standardId]).length;
$("[name='" + selectName + "']").empty(); /* CLEAR SELECT OPTIONS */
$("[name='" + selectName + "']").append('<option value=\'\'><?php echo $pleaseselectstd; ?></option>'); /* ADD EMPTY OPTION */
Object.keys(thisOptions[standardId]).forEach(function(key) {
if (totalOptionsCount == 1) {
/* IF SELECT HAS ONLY 1 OPTION, SET AS "SELECTED" */
currentValue = key;
$("[name='" + selectName + "']").empty(); /* REMOVE EMPTY OPTION */
}
/* POPULATE SELECT OPTIONS BASED ON STANDARD*/
if (currentValue == key) {
$("[name='" + selectName + "']").append('<option value=' + key + ' selected=\'selected\'>' + thisOptions[standardId][key] + '</option>');
} else {
$("[name='" + selectName + "']").append('<option value=' + key + '>' + thisOptions[standardId][key] + '</option>');
}
});
if (totalOptionsCount == 1) {
/* TRIGGER ONCHANGE EVENT */
$("[name='" + selectName + "']").change();
}
}
</script>
<script type="text/javascript">
$(document).ready(function() {
function checkProtectionCategory() {
var isValid = true;
$('select[name="idprotectioncategory"]').each(function() {
if ($(this).val() === '' || $(this).find('option:selected').text() === 'Seleziona') {
isValid = false;
}
});
return isValid;
}
$('#nextStepButton').click(function(e) {
if (!checkProtectionCategory()) {
Swal.fire({
icon: "warning",
title: "Devi selezionare una categoria di protezione",
confirmButtonText: "OK"
});
e.preventDefault();
} else {
// proceed to next step
window.location.href = "additionalinfo.php?idtrf=<?php echo $idtrf; ?>&codestep=3";
}
});
});
</script>
</body>
</html>