Browse Source

Fix date range in simplefin import because the original author made up their own configuration keys.

pull/902/head
James Cole 3 months ago
parent
commit
e73dce3348
  1. 4
      app/Http/Controllers/Import/ConfigurationController.php
  2. 3
      app/Http/Controllers/Import/MapController.php
  3. 8
      resources/views/v2/import/004-configure/partials/simplefin-options.blade.php

4
app/Http/Controllers/Import/ConfigurationController.php

@ -366,13 +366,9 @@ class ConfigurationController extends Controller
}
}
$configuration->updateDateRange();
// Map data option is now user-selectable for SimpleFIN via checkbox
$json = '{}';
try {
$json = json_encode($configuration->toArray(), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
} catch (JsonException $e) {

3
app/Http/Controllers/Import/MapController.php

@ -31,6 +31,7 @@ use App\Http\Controllers\Controller;
use App\Http\Middleware\MapControllerMiddleware;
use App\Services\CSV\Mapper\MapperInterface;
use App\Services\CSV\Mapper\MapperService;
use App\Services\CSV\Mapper\OpposingAccounts;
use App\Services\Session\Constants;
use App\Services\Shared\Configuration\Configuration;
use App\Services\Storage\StorageService;
@ -305,7 +306,7 @@ class MapController extends Controller
$expenseRevenue['values'] = $this->getExpenseRevenueAccounts();
// Use ExpenseRevenueAccounts mapper for SimpleFIN
$class = ExpenseRevenueAccounts::class;
$class = OpposingAccounts::class;
if (!class_exists($class)) {
throw new InvalidArgumentException(sprintf('Class %s does not exist.', $class));
}

8
resources/views/v2/import/004-configure/partials/simplefin-options.blade.php

@ -11,8 +11,8 @@
<div class="col-sm-9">
<select name="date_range" id="date_range" class="form-control" onchange="toggleDateRangeInputs()">
<option value="all" @if($configuration->getDateRange() === 'all') selected @endif>All time</option>
<option value="dynamic" @if($configuration->getDateRange() === 'dynamic') selected @endif>Dynamic range</option>
<option value="specific" @if($configuration->getDateRange() === 'specific') selected @endif>Specific dates</option>
<option value="partial" @if($configuration->getDateRange() === 'partial') selected @endif>Dynamic range</option>
<option value="range" @if($configuration->getDateRange() === 'specific') selected @endif>Specific dates</option>
</select>
</div>
</div>
@ -77,8 +77,8 @@
const dynamicInputs = document.getElementById('dynamic_range_inputs');
const specificInputs = document.getElementById('specific_dates_inputs');
dynamicInputs.style.display = (dateRangeType === 'dynamic') ? 'block' : 'none';
specificInputs.style.display = (dateRangeType === 'specific') ? 'block' : 'none';
dynamicInputs.style.display = (dateRangeType === 'partial') ? 'block' : 'none';
specificInputs.style.display = (dateRangeType === 'range') ? 'block' : 'none';
}
// Initialize on page load
document.addEventListener('DOMContentLoaded', toggleDateRangeInputs);

Loading…
Cancel
Save