Merge branch 'main' of https://git.project-pro.pl/Project-Pro/orderPRO
# Conflicts: # .paul/PROJECT.md # .paul/ROADMAP.md # .paul/STATE.md # .paul/codebase/tech_changelog.md # resources/lang/pl.php # resources/views/shipments/prepare.php # routes/web.php # src/Modules/Settings/IntegrationsHubController.php # src/Modules/Shipments/ShipmentController.php
This commit is contained in:
@@ -6,6 +6,7 @@ $prefs = is_array($preferences ?? null) ? $preferences : [];
|
||||
$comp = is_array($company ?? null) ? $company : [];
|
||||
$services = is_array($deliveryServices ?? null) ? $deliveryServices : [];
|
||||
$apaczkaSvcList = is_array($apaczkaServices ?? null) ? $apaczkaServices : [];
|
||||
$polkurierSvcList = is_array($polkurierServices ?? null) ? $polkurierServices : [];
|
||||
$packages = is_array($existingPackages ?? null) ? $existingPackages : [];
|
||||
$pendingPrintIds = is_array($pendingPrintPackageIds ?? null) ? $pendingPrintPackageIds : [];
|
||||
$servicesError = (string) ($deliveryServicesError ?? '');
|
||||
@@ -105,6 +106,7 @@ $defaultCodAmount = $isCod ? number_format($totalWithTax, 2, '.', '') : '0';
|
||||
<option value="allegro"<?= $preselectedCarrier === 'allegro' ? ' selected' : '' ?>>Allegro</option>
|
||||
<option value="inpost"<?= $preselectedCarrier === 'inpost' ? ' selected' : '' ?>>InPost</option>
|
||||
<option value="apaczka"<?= $preselectedCarrier === 'apaczka' ? ' selected' : '' ?>>Apaczka</option>
|
||||
<option value="polkurier"<?= $preselectedCarrier === 'polkurier' ? ' selected' : '' ?>>polkurier</option>
|
||||
</select>
|
||||
<?php if ($deliveryMethodName !== ''): ?>
|
||||
<div class="muted mt-4" style="font-size:12px">Metoda z zamowienia: <strong><?= $e($deliveryMethodName) ?></strong><?php if ($mappedServiceName !== ''): ?> → <?= $e($mappedCarrier === 'inpost' ? 'InPost' : ($mappedCarrier === 'apaczka' ? 'Apaczka' : 'Allegro')) ?>: <?= $e($mappedServiceName) ?><?php endif; ?></div>
|
||||
@@ -213,12 +215,46 @@ $defaultCodAmount = $isCod ? number_format($totalWithTax, 2, '.', '') : '0';
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="shipment-polkurier-panel" style="<?= $preselectedCarrier !== 'polkurier' ? 'display:none' : '' ?>">
|
||||
<?php if ($polkurierSvcList === []): ?>
|
||||
<div class="muted">Brak uslug polkurier (sprawdz konfiguracje w Ustawienia → Integracje → polkurier).</div>
|
||||
<?php else: ?>
|
||||
<select class="form-control" id="shipment-polkurier-select">
|
||||
<option value="">-- Wybierz usluge polkurier --</option>
|
||||
<?php foreach ($polkurierSvcList as $pSvc): ?>
|
||||
<?php
|
||||
if (!is_array($pSvc)) {
|
||||
continue;
|
||||
}
|
||||
$pSvcId = trim((string) ($pSvc['id'] ?? ''));
|
||||
$pSvcName = trim((string) ($pSvc['name'] ?? $pSvcId));
|
||||
if ($pSvcId === '') {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<option
|
||||
value="<?= $e($pSvcId) ?>"
|
||||
data-carrier-id="<?= $e($pSvcId) ?>">
|
||||
<?= $e($pSvcName) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div class="muted mt-4" style="font-size:12px">Dla uslug paczkomatowych wpisz ID punktu w pole "Punkt odbioru" w sekcji Adres odbiorcy ponizej (np. <code>POP-RZE54</code>).</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div id="shipment-empty-panel" class="muted" style="<?= $preselectedCarrier !== '' ? 'display:none' : '' ?>">Wybierz przewoznika</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="credentials_id" id="shipment-credentials-id" value="">
|
||||
<input type="hidden" name="carrier_id" id="shipment-carrier-id" value="">
|
||||
<input type="hidden" name="provider_code" id="shipment-provider-code" value="<?= $e($preselectedCarrier === 'apaczka' ? 'apaczka' : ($preselectedCarrier === 'inpost' ? 'inpost' : 'allegro_wza')) ?>">
|
||||
<input type="hidden" name="service_code" id="shipment-service-code" value="">
|
||||
<input type="hidden" name="provider_code" id="shipment-provider-code" value="<?php
|
||||
if ($preselectedCarrier === 'apaczka') { echo 'apaczka'; }
|
||||
elseif ($preselectedCarrier === 'inpost') { echo 'inpost'; }
|
||||
elseif ($preselectedCarrier === 'polkurier') { echo 'polkurier'; }
|
||||
else { echo 'allegro_wza'; }
|
||||
?>">
|
||||
|
||||
<label class="form-field">
|
||||
<span class="field-label">Typ paczki</span>
|
||||
@@ -586,6 +622,8 @@ $defaultCodAmount = $isCod ? number_format($totalWithTax, 2, '.', '') : '0';
|
||||
var carrierSelect = document.getElementById('shipment-carrier-select');
|
||||
var inpostSelect = document.getElementById('shipment-inpost-select');
|
||||
var apaczkaSelect = document.getElementById('shipment-apaczka-select');
|
||||
var polkurierSelect = document.getElementById('shipment-polkurier-select');
|
||||
var serviceCodeInput = document.getElementById('shipment-service-code');
|
||||
|
||||
document.querySelectorAll('form select.form-control').forEach(function (sel) {
|
||||
enhanceSelect(sel);
|
||||
@@ -594,6 +632,7 @@ $defaultCodAmount = $isCod ? number_format($totalWithTax, 2, '.', '') : '0';
|
||||
var allegroPanel = document.getElementById('shipment-allegro-panel');
|
||||
var inpostPanel = document.getElementById('shipment-inpost-panel');
|
||||
var apaczkaPanel = document.getElementById('shipment-apaczka-panel');
|
||||
var polkurierPanel = document.getElementById('shipment-polkurier-panel');
|
||||
var emptyPanel = document.getElementById('shipment-empty-panel');
|
||||
|
||||
var wrapper = document.getElementById('shipment-service-wrapper');
|
||||
@@ -612,14 +651,21 @@ $defaultCodAmount = $isCod ? number_format($totalWithTax, 2, '.', '') : '0';
|
||||
hiddenInput.value = '';
|
||||
credentialsInput.value = '';
|
||||
carrierInput.value = '';
|
||||
if (serviceCodeInput) serviceCodeInput.value = '';
|
||||
}
|
||||
|
||||
function showPanel(carrier) {
|
||||
if (allegroPanel) allegroPanel.style.display = carrier === 'allegro' ? '' : 'none';
|
||||
if (inpostPanel) inpostPanel.style.display = carrier === 'inpost' ? '' : 'none';
|
||||
if (apaczkaPanel) apaczkaPanel.style.display = carrier === 'apaczka' ? '' : 'none';
|
||||
if (polkurierPanel) polkurierPanel.style.display = carrier === 'polkurier' ? '' : 'none';
|
||||
if (emptyPanel) emptyPanel.style.display = carrier === '' ? '' : 'none';
|
||||
if (providerInput) providerInput.value = carrier === 'apaczka' ? 'apaczka' : (carrier === 'inpost' ? 'inpost' : 'allegro_wza');
|
||||
if (providerInput) {
|
||||
if (carrier === 'apaczka') providerInput.value = 'apaczka';
|
||||
else if (carrier === 'inpost') providerInput.value = 'inpost';
|
||||
else if (carrier === 'polkurier') providerInput.value = 'polkurier';
|
||||
else providerInput.value = 'allegro_wza';
|
||||
}
|
||||
}
|
||||
|
||||
var weekendWrap = document.getElementById('shipment-apaczka-weekend-wrap');
|
||||
@@ -648,6 +694,10 @@ $defaultCodAmount = $isCod ? number_format($totalWithTax, 2, '.', '') : '0';
|
||||
apaczkaSelect.selectedIndex = 0;
|
||||
if (apaczkaSelect._syncTrigger) apaczkaSelect._syncTrigger();
|
||||
}
|
||||
if (polkurierSelect) {
|
||||
polkurierSelect.selectedIndex = 0;
|
||||
if (polkurierSelect._syncTrigger) polkurierSelect._syncTrigger();
|
||||
}
|
||||
allegroOpts.forEach(function (o) { o.classList.remove('is-selected'); });
|
||||
showPanel(carrierSelect.value);
|
||||
toggleWeekendOption();
|
||||
@@ -683,6 +733,24 @@ $defaultCodAmount = $isCod ? number_format($totalWithTax, 2, '.', '') : '0';
|
||||
}
|
||||
toggleWeekendOption();
|
||||
|
||||
if (polkurierSelect) {
|
||||
function syncPolkurierFields() {
|
||||
var opt = polkurierSelect.options[polkurierSelect.selectedIndex];
|
||||
var serviceCode = polkurierSelect.value;
|
||||
hiddenInput.value = serviceCode;
|
||||
if (serviceCodeInput) serviceCodeInput.value = serviceCode;
|
||||
credentialsInput.value = '';
|
||||
carrierInput.value = opt ? (opt.getAttribute('data-carrier-id') || serviceCode) : serviceCode;
|
||||
if (providerInput) providerInput.value = 'polkurier';
|
||||
}
|
||||
|
||||
polkurierSelect.addEventListener('change', syncPolkurierFields);
|
||||
|
||||
if (carrierSelect.value === 'polkurier' && polkurierSelect.value !== '') {
|
||||
syncPolkurierFields();
|
||||
}
|
||||
}
|
||||
|
||||
if (wrapper && searchInput && dropdown) {
|
||||
var isAllegroOpen = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user