added order column
This commit is contained in:
@@ -57,7 +57,8 @@ $isSchemajsonEmpty = empty(trim($template['schemajson'] ?? ''));
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT
|
||||
id,
|
||||
field_id,
|
||||
field_id,
|
||||
field_order,
|
||||
excel_column,
|
||||
json_node,
|
||||
is_manual,
|
||||
@@ -79,6 +80,7 @@ $stmt = $pdo->prepare("
|
||||
is_visible_parts
|
||||
FROM template_mapping
|
||||
WHERE template_id = ?
|
||||
ORDER BY field_order ASC, id ASC
|
||||
");
|
||||
$stmt->execute([$id]);
|
||||
$mappings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
@@ -205,28 +207,37 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
}
|
||||
|
||||
/* Type */
|
||||
/* Order */
|
||||
#schemaFieldsTable th:nth-child(5),
|
||||
#schemaFieldsTable td:nth-child(5) {
|
||||
width: 70px;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Type */
|
||||
#schemaFieldsTable th:nth-child(6),
|
||||
#schemaFieldsTable td:nth-child(6) {
|
||||
width: 120px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Mapping = wide but NOT insane */
|
||||
#schemaFieldsTable th:nth-child(6),
|
||||
#schemaFieldsTable td:nth-child(6) {
|
||||
#schemaFieldsTable th:nth-child(7),
|
||||
#schemaFieldsTable td:nth-child(7) {
|
||||
width: 380px;
|
||||
}
|
||||
|
||||
/* Default Value = wider */
|
||||
#schemaFieldsTable th:nth-child(7),
|
||||
#schemaFieldsTable td:nth-child(7) {
|
||||
#schemaFieldsTable th:nth-child(8),
|
||||
#schemaFieldsTable td:nth-child(8) {
|
||||
width: 320px;
|
||||
}
|
||||
|
||||
/* selects fill the cell */
|
||||
#schemaFieldsTable td:nth-child(6) .form-select,
|
||||
#schemaFieldsTable td:nth-child(7) .form-control,
|
||||
#schemaFieldsTable td:nth-child(7) .form-select {
|
||||
#schemaFieldsTable td:nth-child(7) .form-select,
|
||||
#schemaFieldsTable td:nth-child(8) .form-control,
|
||||
#schemaFieldsTable td:nth-child(8) .form-select {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
@@ -347,6 +358,7 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
<th style="width:45px; text-align:center;">Import</th>
|
||||
<th style="width:45px; text-align:center;">Parts</th>
|
||||
<th style="width:320px;">Title</th>
|
||||
<th style="width:70px; text-align:center;">Order</th>
|
||||
<th style="width:120px;">Type</th>
|
||||
<th><?php echo $sourceType === 'API' ? 'JSON Mapping' : 'Mapping'; ?></th>
|
||||
<th>Default Value</th>
|
||||
@@ -383,6 +395,12 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
<?php echo (int)($mapping['field_order'] ?? 9999); ?>
|
||||
</td>
|
||||
|
||||
<td><?php echo htmlspecialchars($mapping['data_type'] ?? 'N/A'); ?></td>
|
||||
|
||||
<td><?php echo htmlspecialchars($mapping['data_type'] ?? 'N/A'); ?></td>
|
||||
|
||||
<td>
|
||||
@@ -1737,7 +1755,7 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
mappedColumn = document.createElement('span');
|
||||
mappedColumn.className = 'mapped-column';
|
||||
mappedColumn.style.marginLeft = '5px';
|
||||
tr.querySelector('td:nth-child(6)').appendChild(mappedColumn);
|
||||
tr.querySelector('td:nth-child(7)').appendChild(mappedColumn);
|
||||
}
|
||||
if (!removeBtn) {
|
||||
removeBtn = document.createElement('button');
|
||||
@@ -1745,7 +1763,7 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
removeBtn.textContent = 'X';
|
||||
removeBtn.style.marginLeft = '5px';
|
||||
removeBtn.setAttribute('data-id', mappingId);
|
||||
tr.querySelector('td:nth-child(6)').appendChild(removeBtn);
|
||||
tr.querySelector('td:nth-child(7)').appendChild(removeBtn);
|
||||
|
||||
removeBtn.addEventListener('click', function(e) {
|
||||
let tr = e.target.closest('tr');
|
||||
@@ -1791,7 +1809,7 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
mappedJsonNode = document.createElement('span');
|
||||
mappedJsonNode.className = 'mapped-json-node';
|
||||
mappedJsonNode.style.marginLeft = '5px';
|
||||
tr.querySelector('td:nth-child(6)').appendChild(mappedJsonNode);
|
||||
tr.querySelector('td:nth-child(7)').appendChild(mappedJsonNode);
|
||||
}
|
||||
|
||||
if (!removeJsonBtn) {
|
||||
@@ -1800,7 +1818,7 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
|
||||
removeJsonBtn.textContent = 'X';
|
||||
removeJsonBtn.style.marginLeft = '5px';
|
||||
removeJsonBtn.setAttribute('data-id', mappingId);
|
||||
tr.querySelector('td:nth-child(6)').appendChild(removeJsonBtn);
|
||||
tr.querySelector('td:nth-child(7)').appendChild(removeJsonBtn);
|
||||
}
|
||||
|
||||
mappedJsonNode.textContent = event.target.value ? `(${event.target.value})` : '';
|
||||
|
||||
Reference in New Issue
Block a user