added scorta to mescola
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddSupportWeightToWorkSheetMescole extends AbstractMigration
|
||||
{
|
||||
public function change(): void
|
||||
{
|
||||
$this->table('work_sheet_mescole')
|
||||
->addColumn('support_weight_g_m', 'decimal', [
|
||||
'precision' => 10,
|
||||
'scale' => 2,
|
||||
'null' => true,
|
||||
'default' => null,
|
||||
'after' => 'mix_weight_g_m',
|
||||
'comment' => 'Peso metro sostegno mescola (g/m)',
|
||||
])
|
||||
->update();
|
||||
}
|
||||
}
|
||||
@@ -242,6 +242,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
|
||||
if ($pos <= 0) $pos = 1;
|
||||
|
||||
$mix_weight = $_POST['mix_weight_g_m'] !== '' ? (float)$_POST['mix_weight_g_m'] : null;
|
||||
$support_weight = ($_POST['support_weight_g_m'] ?? '') !== ''
|
||||
? (float)str_replace(',', '.', $_POST['support_weight_g_m'])
|
||||
: null;
|
||||
$density = trim($_POST['required_density'] ?? '');
|
||||
$hardness = trim($_POST['required_hardness_shore_a'] ?? '');
|
||||
|
||||
@@ -255,6 +258,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
|
||||
UPDATE work_sheet_mescole SET
|
||||
idmescola = ?,
|
||||
mix_weight_g_m = ?,
|
||||
support_weight_g_m = ?,
|
||||
required_density = ?,
|
||||
required_hardness_shore_a = ?,
|
||||
lubrication_type = ?,
|
||||
@@ -263,7 +267,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
|
||||
");
|
||||
$stmt->execute([
|
||||
$idmescola,
|
||||
$mix_weight,
|
||||
$density !== '' ? $density : null,
|
||||
$hardness !== '' ? $hardness : null,
|
||||
$lub_type,
|
||||
@@ -291,16 +294,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
|
||||
INSERT INTO work_sheet_mescole
|
||||
(
|
||||
worksheet_id, idmescola, mix_position, mix_weight_g_m,
|
||||
support_weight_g_m,
|
||||
required_density, required_hardness_shore_a,
|
||||
lubrication_type, lubrication_notes
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
");
|
||||
$stmt->execute([
|
||||
$worksheet_id,
|
||||
$idmescola,
|
||||
$pos,
|
||||
$mix_weight,
|
||||
$support_weight,
|
||||
$density !== '' ? $density : null,
|
||||
$hardness !== '' ? $hardness : null,
|
||||
$lub_type,
|
||||
@@ -1389,6 +1394,7 @@ $isEdit = ($worksheet_id > 0);
|
||||
<th style="width:70px;">Pos</th>
|
||||
<th>Mescola</th>
|
||||
<th style="width:120px;">Peso (g/m)</th>
|
||||
<th style="width:120px;">Sostegno (g/m)</th>
|
||||
<th style="width:140px;">Densità</th>
|
||||
<th style="width:150px;">Durezza</th>
|
||||
<th style="width:120px;">Lubr.</th>
|
||||
@@ -1406,6 +1412,7 @@ $isEdit = ($worksheet_id > 0);
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= h($r['mix_weight_g_m'] ?? '-') ?></td>
|
||||
<td><?= h($r['support_weight_g_m'] ?? '-') ?></td>
|
||||
<td><?= h($r['required_density'] ?? '-') ?></td>
|
||||
<td><?= h($r['required_hardness_shore_a'] ?? '-') ?></td>
|
||||
<td><?= h($r['lubrication_type'] ?? '-') ?></td>
|
||||
@@ -1456,7 +1463,7 @@ $isEdit = ($worksheet_id > 0);
|
||||
<input type="hidden" name="mix_position" id="mix_position" value="">
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="col-lg-8">
|
||||
<div class="col-lg-6">
|
||||
<label class="form-label">Mescola *</label>
|
||||
<select class="form-select" name="idmescola" id="idmescola" required>
|
||||
<option value="">-- Seleziona --</option>
|
||||
@@ -1468,11 +1475,16 @@ $isEdit = ($worksheet_id > 0);
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<label class="form-label">Peso metro mescola (g/m)</label>
|
||||
<input type="number" step="0.01" class="form-control" name="mix_weight_g_m" id="mix_weight_g_m">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<label class="form-label">Sostegno mescola (g/m)</label>
|
||||
<input type="number" step="0.01" class="form-control" name="support_weight_g_m" id="support_weight_g_m">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<label class="form-label">Densità richiesta</label>
|
||||
<input type="text" class="form-control" name="required_density" id="required_density" placeholder="es. 1,22 +/- 0,03">
|
||||
@@ -1708,6 +1720,7 @@ $isEdit = ($worksheet_id > 0);
|
||||
$('#idmescola').val(row.idmescola).trigger('change');
|
||||
|
||||
$('#mix_weight_g_m').val(row.mix_weight_g_m ?? '');
|
||||
$('#support_weight_g_m').val(row.support_weight_g_m ?? '');
|
||||
$('#required_density').val(row.required_density ?? '');
|
||||
$('#required_hardness_shore_a').val(row.required_hardness_shore_a ?? '');
|
||||
$('#lubrication_type').val(row.lubrication_type ?? '');
|
||||
@@ -1961,6 +1974,7 @@ $isEdit = ($worksheet_id > 0);
|
||||
'<td><div class="fw-bold">' + nome + '</div>' +
|
||||
'<div class="text-muted small">dal file: ' + (m.raw || '') + '</div></td>' +
|
||||
'<td>' + (m.mix_weight_g_m ?? '-') + '</td>' +
|
||||
'<td>' + (m.support_weight_g_m ?? '-') + '</td>' +
|
||||
'<td>' + (m.required_density ?? '-') + '</td>' +
|
||||
'<td>' + (m.required_hardness_shore_a ?? '-') + '</td>' +
|
||||
'<td>' + (m.lubrication_type ?? '-') + '</td>' +
|
||||
@@ -2063,6 +2077,7 @@ $isEdit = ($worksheet_id > 0);
|
||||
worksheet_id: newId,
|
||||
idmescola: m.idmescola,
|
||||
mix_weight_g_m: m.mix_weight_g_m ?? '',
|
||||
support_weight_g_m: m.support_weight_g_m ?? '',
|
||||
required_density: m.required_density ?? '',
|
||||
required_hardness_shore_a: m.required_hardness_shore_a ?? '',
|
||||
lubrication_type: m.lubrication_type ?? '',
|
||||
@@ -2110,6 +2125,7 @@ $isEdit = ($worksheet_id > 0);
|
||||
$('#mixRowId').val(0);
|
||||
$('#mixWorksheetId').val(newId);
|
||||
$('#mix_weight_g_m').val(m.mix_weight_g_m ?? '');
|
||||
$('#support_weight_g_m').val(m.support_weight_g_m ?? '');
|
||||
$('#required_density').val(m.required_density ?? '');
|
||||
$('#required_hardness_shore_a').val(m.required_hardness_shore_a ?? '');
|
||||
$('#lubrication_type').val(m.lubrication_type ?? '');
|
||||
|
||||
@@ -204,12 +204,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
|
||||
|
||||
$newWorksheetId = (int)$pdo->lastInsertId();
|
||||
|
||||
// Duplica le mescole collegate
|
||||
// Duplica le mescole collegate
|
||||
$stmtMixes = $pdo->prepare("
|
||||
SELECT
|
||||
idmescola,
|
||||
mix_position,
|
||||
mix_weight_g_m,
|
||||
support_weight_g_m,
|
||||
required_density,
|
||||
required_hardness_shore_a,
|
||||
lubrication_type,
|
||||
@@ -228,11 +229,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
|
||||
idmescola,
|
||||
mix_position,
|
||||
mix_weight_g_m,
|
||||
support_weight_g_m,
|
||||
required_density,
|
||||
required_hardness_shore_a,
|
||||
lubrication_type,
|
||||
lubrication_notes
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
");
|
||||
|
||||
foreach ($mixRows as $mix) {
|
||||
@@ -241,6 +243,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['ajax']) && $_POST['aj
|
||||
$mix['idmescola'],
|
||||
$mix['mix_position'],
|
||||
$mix['mix_weight_g_m'],
|
||||
$mix['support_weight_g_m'],
|
||||
$mix['required_density'],
|
||||
$mix['required_hardness_shore_a'],
|
||||
$mix['lubrication_type'],
|
||||
|
||||
Reference in New Issue
Block a user