<?php
// *************************************************************************
// *                                                                       *
// * DEPRIXA BASIC -  Freight Forwarding & Shipping Software Solutions     *
// * Copyright (c) JAOMWEB. All Rights Reserved                            *
// *                                                                       *
// *************************************************************************
// *                                                                       *
// * Email: support@jaom.info                                              *
// * Website: https://deprixa.link/documentation/                          *
// *                                                                       *
// *************************************************************************
// *                                                                       *
// * This software is furnished under a license and may be used and copied *
// * only  in  accordance  with  the  terms  of such  license and with the *
// * inclusion of the above copyright notice.                              *
// * If you Purchased from Codecanyon, Please read the full License from   *
// * here- http://codecanyon.net/licenses/standard                         *
// *                                                                       *
// *************************************************************************



require_once('helpers/querys.php');
$userData = $user->cdp_getUserData();

if (isset($_GET['id'])) {

	$row = cdp_getEmailTemplates($_GET['id']);
}


if (!isset($_GET['id']) or $row == null) {

	cdp_redirect_to("templates_email.php");
}


?>


<!DOCTYPE html>
<html dir="ltr" lang="en">

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="keywords" content="Courier DEPRIXA-Integral Web System" />
	<meta name="author" content="Jaomweb">

	<title><?php echo $lang['tools-config61'] ?> | <?php echo $core->site_name ?></title>

	<link rel="stylesheet" type="text/css" href="assets/extra-libs/summernote/summernote-lite.min.css">
	<?php include 'views/inc/head_scripts.php'; ?>
</head>

<body>

	<!-- ============================================================== -->
	<!-- Preloader - style you can find in spinners.css -->
	<!-- ============================================================== -->


	<?php include 'views/inc/preloader.php'; ?>
	<!-- ============================================================== -->
	<!-- Main wrapper - style you can find in pages.scss -->
	<!-- ============================================================== -->
	<div id="main-wrapper">
		<!-- ============================================================== -->
		<!-- Topbar header - style you can find in pages.scss -->
		<!-- ============================================================== -->

		<!-- ============================================================== -->
		<!-- Preloader - style you can find in spinners.css -->
		<!-- ============================================================== -->

		<?php include 'views/inc/topbar.php'; ?>

		<!-- End Topbar header -->


		<!-- Left Sidebar - style you can find in sidebar.scss  -->

		<?php include 'views/inc/left_sidebar.php'; ?>


		<!-- End Left Sidebar - style you can find in sidebar.scss  -->

		<!-- Page wrapper  -->
		<!-- ============================================================== -->
		<div class="page-wrapper">

			<!-- ============================================================== -->
			<!-- Start Page Content -->
			<!-- ============================================================== -->
			<div class="email-app">
				<!-- ============================================================== -->
				<!-- Left Part menu -->
				<!-- ============================================================== -->

				<?php include 'views/inc/left_part_menu.php'; ?>

				<div class="right-part mail-list bg-white overflow-auto">

					<!-- Action part -->
					<div class="p-4 border-bottom">
						<div class="d-flex align-items-center">
							<div>
								<h4><?php echo $lang['tools-config61'] ?> </h4>
								<span><i data-feather="chevrons-right" class="feather-sm fill-white me-2"></i> <b><?php echo $lang['tools-template2'] ?> || <?php echo $row->name; ?></b></span>
							</div>
						</div>
					</div>

					<!-- Button group part -->
					<div class="bg-light p-15">
						<div class="row justify-content-center">
							<div class="col-md-12">
								<div class="row">
									<div class="col-12">
										<div id="resultados_ajax"></div>
									</div>
								</div>
							</div>
						</div>
					</div>


					<div class="card-body">
						<form class="form-horizontal form-material" id="save_data_email" name="save_data_email" method="post">

							<div class="row">
								<div class="col-md-6 mb-3">
									<div class="form-group">
										<label for="firstName1"><?php echo $lang['tools-template3'] ?></label>
										<input type="text" class="form-control" name="name" id="name" value="<?php echo $row->name; ?>" placeholder="<?php echo $lang['tools-template3'] ?>">
									</div>
								</div>
								<div class="col-md-6 mb-3">
									<div class="form-group">
										<label for="lastName1"><?php echo $lang['tools-template4'] ?></label>
										<input type="text" class="form-control" name="subject" id="subject" value="<?php echo $row->subject; ?>" placeholder="<?php echo $lang['tools-template4'] ?>">
									</div>
								</div>
							</div>
							<hr>
							<div class="row">
								<div class="col-md-12 mb-3">
									<div class="form-group">
										<label for="lastName1"><?php echo $lang['tools-template5'] ?></label>
										<textarea type="text" class="form-control" name="help" id="help" rows="3"><?php echo $row->help; ?></textarea>
									</div>
								</div>
							</div>

							<div class="row">
								<div class="col-md-12 mb-3">
									<label for="lastName1">Template</label>
									<div id="editor">
										<textarea name="body" id="body" style="margin-top: 30px;" placeholder="Type some text">
										<?php echo $row->body; ?>
									</textarea>
										<span class="badge font-medium bg-light-danger text-white"><?php echo $lang['tools-template6'] ?> [ ]</span>
									</div>
								</div>
							</div>

							<br>
							<div class="form-group">
								<div class="col-sm-12">
									<button class="btn btn-primary btn-confirmation" name="dosubmit" type="submit"><?php echo $lang['tools-template7'] ?> <i class="icon-ok"></i></button>
									<a href="templates_email.php" class="btn btn-secondary btn-confirmation"><i class="ti-share-alt"></i> <?php echo $lang['tools-template8'] ?></a>
								</div>
							</div>
							<input name="id" id="id" type="hidden" value="<?php echo $_GET['id']; ?>" />
						</form>
					</div>

				</div>

			</div>
		</div>

		<?php include 'views/inc/footer.php'; ?>
	</div>


	<script src="assets/extra-libs/summernote/summernote-lite.min.js"></script>

	<script>
		$(document).ready(function() {
			$('#body').summernote();
		});
	</script>
	<script src="dataJs/templates_email.js"></script>







</body>

</html>