@extends('layouts.admin')
@section('content')
<div class="page-header"><div class="page-block"><div class="row align-items-center">
    <div class="col-md-12"><ul class="breadcrumb"><li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">হোম</a></li><li class="breadcrumb-item"><a href="javascript: void(0)">সিস্টেম</a></li><li class="breadcrumb-item" aria-current="page">Backup</li></ul></div>
    <div class="col-md-12"><div class="page-header-title"><h2 class="mb-0">{{ __('Server Backup') }}</h2></div></div>
</div></div></div>

@include('includes.admin.form-both')

<div class="card">
    <div class="card-header"><h5>{{ __('Backup Management') }}</h5></div>
    <div class="card-body text-center py-5">
        <div class="mb-4">
            @if($bkuplink == "")
                <span id="bkupData" class="text-muted">{{ __('No Backup File Generated.') }}</span>
            @else
                <span id="bkupData"><a href="{{$bkuplink}}" class="btn btn-outline-success">{{$chk}}</a> <a href="{{route('admin-clear-backup')}}" class="btn btn-outline-danger btn-sm ms-2"><i class="ti ti-trash"></i></a></span>
            @endif
        </div>
        <hr>
        <button id="generateBkup" type="button" class="btn btn-primary"><i class="ti ti-database-export me-1"></i>{{ __('Generate Backup') }}</button>
    </div>
</div>
@endsection

@section('scripts')
<script type="text/javascript">
    $("#generateBkup").click(function(){
        $('#bkupData').html('<img style="height:100px;" src="{{asset("assets/images/".$gs->loader)}}"><br>{{ __("Generating Backup... Please wait....") }}');
        $.ajax({
            url: "{{url('admin/check/movescript')}}",
            success: function(result){
                if(result.status == 'success'){
                    $("#bkupData").html('<a href="'+result.backupfile+'">'+result.filename+'</a>');
                }
            }
        });
    });
</script>
@endsection