<div class="page_title">
	<h2>Kata sandi</h2>
	<p>Update Kata sandi</p>
</div>
<?php if($this -> session -> mart_demo == 0) : ?>

    <form method="POST" class="card">
        <div class="card-body">
            <div class="row mb-4">
                <div class="col-sm-3 mb-2">
                    <strong class="d-block">Kata sandi Baru</strong>
                    <small class="text-muted">
                        Masukan kata sandi baru
                    </small>
                </div>                    
                <div class="col-sm-9">
                    <input type="password" required 
                            class="form-control" 
                            name="password"
                    >
                </div>
            </div>
            
        </div>
        <div class="text-end card-footer">
            <button class="btn btn-primary px-3">
                Simpan
            </button>
            <a href="javascript:history.back()" class="btn px-3">
                kembali
            </a>
        </div>
    </form>

    <script>
        $('form').on('submit', function(e) {
            e.preventDefault();

            swal_simpan.fire({
                text: 'Anda akan update sandi lama dengan sandi baru'
            }).then(res => {
                if(res.isConfirmed) {
                    $.post({
                        url: base_url + 'profil/update_sandi',
                        data: $(this).serialize(),
                        dataType: 'json',
                        success: json => {
                            if(json.success == 1) {
                                toast({
                                    icon: 'success',
                                    title: 'Kata sandi sudah diupdate'
                                })
                            }
                        }
                    })

                }
            })
        })
    </script>

<?php else: ?>
    <div class="msg warning">
        <i class="fa fa-info-circle me-1"></i>
        Halaman ini tidak tersedia untuk akun demo
    </div>
<?php endif ?>