インポートしたデータを消せるようにする
This commit is contained in:
parent
fb5b34b239
commit
c0d62f5112
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\DeactivatedUser;
|
use App\DeactivatedUser;
|
||||||
|
use App\Ejaculation;
|
||||||
use App\Exceptions\CsvImportException;
|
use App\Exceptions\CsvImportException;
|
||||||
use App\Services\CheckinCsvExporter;
|
use App\Services\CheckinCsvExporter;
|
||||||
use App\Services\CheckinCsvImporter;
|
use App\Services\CheckinCsvImporter;
|
||||||
@ -104,6 +105,16 @@ class SettingController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function destroyImport()
|
||||||
|
{
|
||||||
|
Auth::user()
|
||||||
|
->ejaculations()
|
||||||
|
->where('ejaculations.source', Ejaculation::SOURCE_CSV)
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
return redirect()->route('setting.import')->with('status', '削除が完了しました。');
|
||||||
|
}
|
||||||
|
|
||||||
public function export()
|
public function export()
|
||||||
{
|
{
|
||||||
return view('setting.export');
|
return view('setting.export');
|
||||||
|
5
resources/assets/js/setting/import.js
vendored
Normal file
5
resources/assets/js/setting/import.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
$('#destroy-form').on('submit', function () {
|
||||||
|
if (!confirm('本当に削除してもよろしいですか?')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
@ -26,7 +26,17 @@
|
|||||||
@endif
|
@endif
|
||||||
<button type="submit" class="btn btn-primary mt-2">アップロード</button>
|
<button type="submit" class="btn btn-primary mt-2">アップロード</button>
|
||||||
</form>
|
</form>
|
||||||
|
<h3 class="mt-5">インポートしたデータを一括削除</h3>
|
||||||
|
<hr>
|
||||||
|
<p class="mb-0">取り込んだチェックインデータをすべて削除することができます。データにミスがあってやり直したい場合などにお使いください。</p>
|
||||||
|
<p class="text-danger">ただし、インポート後に個別に手修正などしている場合、そのデータも失われてしまうことに注意してください!</p>
|
||||||
|
<form id="destroy-form" class="mt-4" action="{{ route('setting.import.destroy') }}" method="post">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
{{ method_field('DELETE') }}
|
||||||
|
<button type="submit" class="btn btn-danger mt-2">データを削除</button>
|
||||||
|
</form>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('script')
|
@push('script')
|
||||||
|
<script src="{{ mix('js/setting/import.js') }}"></script>
|
||||||
@endpush
|
@endpush
|
||||||
|
@ -38,6 +38,7 @@ Route::middleware('auth')->group(function () {
|
|||||||
Route::post('/setting/privacy', 'SettingController@updatePrivacy')->name('setting.privacy.update');
|
Route::post('/setting/privacy', 'SettingController@updatePrivacy')->name('setting.privacy.update');
|
||||||
Route::get('/setting/import', 'SettingController@import')->name('setting.import');
|
Route::get('/setting/import', 'SettingController@import')->name('setting.import');
|
||||||
Route::post('/setting/import', 'SettingController@storeImport')->name('setting.import');
|
Route::post('/setting/import', 'SettingController@storeImport')->name('setting.import');
|
||||||
|
Route::delete('/setting/import', 'SettingController@destroyImport')->name('setting.import.destroy');
|
||||||
Route::get('/setting/export', 'SettingController@export')->name('setting.export');
|
Route::get('/setting/export', 'SettingController@export')->name('setting.export');
|
||||||
Route::get('/setting/export/csv', 'SettingController@exportToCsv')->name('setting.export.csv');
|
Route::get('/setting/export/csv', 'SettingController@exportToCsv')->name('setting.export.csv');
|
||||||
Route::get('/setting/deactivate', 'SettingController@deactivate')->name('setting.deactivate');
|
Route::get('/setting/deactivate', 'SettingController@deactivate')->name('setting.deactivate');
|
||||||
|
1
webpack.mix.js
vendored
1
webpack.mix.js
vendored
@ -16,6 +16,7 @@ mix.js('resources/assets/js/app.js', 'public/js')
|
|||||||
.js('resources/assets/js/home.js', 'public/js')
|
.js('resources/assets/js/home.js', 'public/js')
|
||||||
.js('resources/assets/js/user/stats.js', 'public/js/user')
|
.js('resources/assets/js/user/stats.js', 'public/js/user')
|
||||||
.js('resources/assets/js/setting/privacy.js', 'public/js/setting')
|
.js('resources/assets/js/setting/privacy.js', 'public/js/setting')
|
||||||
|
.js('resources/assets/js/setting/import.js', 'public/js/setting')
|
||||||
.js('resources/assets/js/setting/deactivate.js', 'public/js/setting')
|
.js('resources/assets/js/setting/deactivate.js', 'public/js/setting')
|
||||||
.ts('resources/assets/js/checkin.ts', 'public/js')
|
.ts('resources/assets/js/checkin.ts', 'public/js')
|
||||||
.sass('resources/assets/sass/app.scss', 'public/css')
|
.sass('resources/assets/sass/app.scss', 'public/css')
|
||||||
|
Loading…
Reference in New Issue
Block a user