<%
'=============================================================================
' FILE: includes/response.asp
' PURPOSE: Styled error and success response pages for form submissions
' USAGE: Include this file, then call ShowError() or ShowSuccess()
'=============================================================================

Sub ShowError(errorMessage, backUrl)
%>
<!DOCTYPE html>
<html lang="en">
<head>
  <!--#include file="header.asp"-->
  <style>
    .response-container {
      min-height: 60vh;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
    }
    .response-icon {
      font-size: 80px;
      margin-bottom: 20px;
    }
    .response-icon.error { color: #f44336; }
    .response-icon.success { color: #28a745; }
    .response-message {
      font-size: 24px;
      margin-bottom: 30px;
    }
    .alert-custom {
      padding: 15px;
      margin-bottom: 20px;
      border: 1px solid transparent;
      border-radius: 4px;
      max-width: 600px;
      margin-left: auto;
      margin-right: auto;
    }
    .alert-error {
      background-color: rgba(244, 67, 54, 0.1);
      border-color: rgba(244, 67, 54, 0.3);
      color: #f44336;
    }
    .alert-success {
      background-color: rgba(40, 167, 69, 0.1);
      border-color: rgba(40, 167, 69, 0.3);
      color: #28a745;
    }
  </style>
</head>
<%
	Dim respTheme
	respTheme = Request.Cookies("theme")
	If respTheme = "" Then respTheme = "bg-theme1"
%>
<body class="bg-theme <%=respTheme%>">

<!-- start loader -->
<div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner"><div class="loader"></div></div></div></div>
<!-- end loader -->

<!-- Start wrapper-->
<div id="wrapper">
  <!--#include file="leftsidebar.asp"-->
  <!--#include file="topbarheader.asp"-->
  <div class="clearfix"></div>

  <div class="content-wrapper">
    <div class="container-fluid">
      <div class="response-container">
        <div>
          <div class="response-icon error">
            <i class="zmdi zmdi-alert-triangle"></i>
          </div>
          <div class="response-message">Error</div>
          <div class="alert-custom alert-error">
            <strong><i class="zmdi zmdi-info"></i> Details:</strong><br>
            <%=Server.HTMLEncode(errorMessage)%>
          </div>
          <div style="margin-top: 30px;">
            <a href="<%=Server.HTMLEncode(backUrl)%>" class="btn btn-primary btn-lg">
              <i class="zmdi zmdi-arrow-left"></i> Go Back
            </a>
            <a href="default.asp" class="btn btn-secondary btn-lg">
              <i class="zmdi zmdi-home"></i> Dashboard
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <footer class="footer">
    <div class="container"><div class="text-center"></div></div>
  </footer>
</div>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
<script src="assets/js/sidebar-menu.js"></script>
<script src="assets/js/app-script.js"></script>
</body>
</html>
<%
End Sub

Sub ShowSuccess(successMessage, redirectUrl, entityName)
%>
<!DOCTYPE html>
<html lang="en">
<head>
  <!--#include file="header.asp"-->
  <style>
    .response-container {
      min-height: 60vh;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
    }
    .response-icon {
      font-size: 80px;
      margin-bottom: 20px;
    }
    .response-icon.error { color: #f44336; }
    .response-icon.success { color: #28a745; }
    .response-message {
      font-size: 24px;
      margin-bottom: 30px;
    }
    .alert-custom {
      padding: 15px;
      margin-bottom: 20px;
      border: 1px solid transparent;
      border-radius: 4px;
      max-width: 600px;
      margin-left: auto;
      margin-right: auto;
    }
    .alert-error {
      background-color: rgba(244, 67, 54, 0.1);
      border-color: rgba(244, 67, 54, 0.3);
      color: #f44336;
    }
    .alert-success {
      background-color: rgba(40, 167, 69, 0.1);
      border-color: rgba(40, 167, 69, 0.3);
      color: #28a745;
    }
  </style>
  <meta http-equiv="refresh" content="2; url=<%=Server.HTMLEncode(redirectUrl)%>">
</head>
<%
	Dim succTheme
	succTheme = Request.Cookies("theme")
	If succTheme = "" Then succTheme = "bg-theme1"
%>
<body class="bg-theme <%=succTheme%>">

<!-- start loader -->
<div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner"><div class="loader"></div></div></div></div>
<!-- end loader -->

<!-- Start wrapper-->
<div id="wrapper">
  <!--#include file="leftsidebar.asp"-->
  <!--#include file="topbarheader.asp"-->
  <div class="clearfix"></div>

  <div class="content-wrapper">
    <div class="container-fluid">
      <div class="response-container">
        <div>
          <div class="response-icon success">
            <i class="zmdi zmdi-check-circle"></i>
          </div>
          <div class="response-message">Success!</div>
          <div class="alert-custom alert-success">
            <strong><i class="zmdi zmdi-check"></i></strong>
            <%=Server.HTMLEncode(successMessage)%>
          </div>
          <div style="margin-top: 20px; opacity: 0.7;">
            Redirecting to <%=Server.HTMLEncode(entityName)%>...
          </div>
          <div style="margin-top: 30px;">
            <a href="<%=Server.HTMLEncode(redirectUrl)%>" class="btn btn-primary btn-lg">
              <i class="zmdi zmdi-arrow-right"></i> Go Now
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>

  <footer class="footer">
    <div class="container"><div class="text-center"></div></div>
  </footer>
</div>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
<script src="assets/js/sidebar-menu.js"></script>
<script src="assets/js/app-script.js"></script>
</body>
</html>
<%
End Sub
%>
