<?php require view('theme/header'); ?>
<style>
	.hide{display:none;}
</style>
<div class="app-content">
	<div class="container-fluid">

		<div class="d-card dc-dash">
			<div class="row">
				<div class="col-lg-6 col-md-8 col-12">
					<div class="py-3 px-5">
						<div class="dch-title">
							Yeni Sipariş
						</div>
						<div class="dch-text">
							Aşağıdaki formu kullanarak hızlı sipariş verebilirsiniz.
						</div>
					</div>
				</div>
			</div>
		</div>

<style>
	
  #new_order	.select2-container{width:100% !important}
	
	
		
		
</style>
		<section class="neworder">

			<div class="row">
				<div class="col-lg-7 col-12 mb-5 mb-lg-0">
					<div class="d-card">

						<div class="d-card-head">
							<div class="dch-body">
								<i class="icon far fa-layer-plus me-3"></i>
								<span class="ml-3">Sipariş Ver</span>
							</div>
						</div>

						<div class="d-card-body" id="dc-body">
							<form id="new_order" onsubmit="return false;">
								<div class="form-group mb-4 mt-3">
									<label for="orderform-category" class="control-label">{ORDER_FORM_CATEGORY_TITLE}:</label><br>
									<select class="form-control optmain select2" id="category" name="category">

									<?php
									$query = $db->from('categories')


									->where('category_status', 1)

									->orderby('category_number', 'ASC')

									->all();
									foreach($query as $qq){
										$textqq = json_decode($qq['category_name'],true);
										?>
										<option data-icon="<?= $qq['category_icon'] ?>" data-color="<?= $qq['category_icon_color'] ?>" value="<?= $qq['category_id'] ?>"><?= $textqq[0]['name'] ?></option>
									<?php } ?>
								</select>
							</div>
							<!-- form-group end -->
							<div class="form-group mb-4">
								<label for="service" class="control-label">{ORDER_FORM_SERVICE_TITLE}:</label><br>
								<select id="service" class="form-control select3" name="service">
							</select>
						</div>
						<!-- form-group end -->
						<div class="form-group">
							<label>
								{ORDER_FORM_DESC_TITLE}:
							</label>
							<div class="panel-body border-solid border-rounded" id="description">
							</div>
						</div>
						<!-- form-group end -->
						<div class="form-group mb-4">
							<label>{ORDER_FORM_LINK_TITLE}:</label>
							<input class="form-control" type="text"  name="link" id="link">
						</div>
						<div id="comment-group" class="form-group mb-3 hide">
							<label>
								<b>{ORDER_FORM_COMMENTS_TITLE}:</b>
							</label>
							<textarea name="comments" id="comments" class="form-control " rows="8"></textarea>
						</div>
						<!-- form-group end -->
						<div class="form-group">
							<label>{ORDER_FORM_QUANTITY_TITLE}:</label>
							<input class="form-control" type="text"  name="quantity" id="quantity">
						</div>

						<!-- form-group end -->
						<div class="form-group">
							<small class="help-block min-max">Min: <span id="min"></span> - Maks: <span id="max"></span></small>
						</div>
						<div class="form-group mb-4">
							<label>{ORDER_FORM_AMOUNT_TITLE}:</label>
							<input class="form-control" id="amount" type="text" name="" readonly>
						</div>
						<div id="drip-order" class="form-group mb-3 hide">
							<div class="custom-control custom-checkbox">
								<input type="checkbox" class="custom-control-input" id="drip-check">
								<label class="custom-control-label" for="drip-check">{ORDER_FORM_DRIP_CHECK_TITLE}</label>
							</div>
						</div>
						<div id="drip-group" class="hide">
							<div class="form-group mb-3">
								<label>{ORDER_FORM_DRIP_RUNS_TITLE}:</label>
								<input type="text" name="runs" id="runs" class="form-control" value="" />
							</div>
							<div class="form-group mb-3">
								<label>
									<b>{ORDER_FORM_DRIP_INTERVAL_TITLE}:</b>
								</label>
								<select name="interval" id="interval" class="form-control">
									<option value="0" selected>0</option>
									<option value="5">5</option>
									<option value="10">10</option>
									<option value="15">15</option>
									<option value="20">20</option>
									<option value="25">25</option>
									<option value="30">30</option>
								</select>
								<small class="form-text text-muted">{ORDER_FORM_DRIP_INTERVAL_MESSAGE_TITLE}</small>
							</div>
							<div class="form-group mb-3">
								<label>
									<b>{ORDER_FORM_DRIP_TOTAL_QUANTITY_TITLE}:</b>
								</label>
								<input type="text" id="total_quantity" class="form-control" value="" /readonly>
							</div>
						</div>
						<!-- form-group end -->
						<button class="btn btn-primary btn-block">{ORDER_FORM_SUBMIT}</button>
					</form>

				</div>
			</div>
		</div>
		<div class="col-lg-5 col-12 mb-5 mb-lg-0">
			<div class="d-card">
				<div class="d-card-head">
					<div class="dch-body">
						<i class="icon far fa-bell-on me-3"></i>
						<span class="ml-3">Duyurular</span>
					</div>
				</div>
				<div class="d-card-body">


					<div class="dh-noti">


						<ul class="app-news">
							<?php if ($duyurular) : foreach ($duyurular as $duyuru) : ?>
								<li>
									<div class="group">
										<div class="d-flex align-items-center">
												<div class="icon" style="background-color: <?= $duyuru['duyuru_daire_color'] ?>; color: <?= $duyuru['duyuru_icon_color'] ?>;">
													<i class="<?= $duyuru['duyuru_icon'] ?>"></i>
												</div>
											<div class="title">
												<?= $duyuru['duyuru_title'] ?>
											</div>
										</div>
										<div class="text">
											<?= htmlspecialchars_decode($duyuru['duyuru_content']) ?>.
										</div>
										<div class="date"><i
											class="fal fa-calendar-alt"></i> <?= str_date($duyuru['duyuru_date']) ?>
										</div>
									</div>
								</li>
							<?php endforeach;
							else : ?>
								<p>Henüz duyuru eklenmemiş.</p>
							<?php endif; ?>
						</ul>


					</div>
				</div>
			</div>
			<!--<br><div class="d-card">									
									<div class="d-card-head">
										<div class="dch-body">
											 <i class="icon far fa-comment-dollar me-3"></i>
											 <span class="ml-3">Geçmiş Ödemelerim</span>
										</div>
									</div>
									<div class="d-card-body">

										  <table class="table">
											 <thead class="white">
												<tr>
												   <th>ID</th>
												   <th>Tarih</th>
												   <th>Ödeme Yöntemi</th>
												   <th>Miktar</th>
												</tr>
											 </thead>
											 <tbody>
												<tr>
												   <td>102</td>
												   <td><span class="nowrap">2020-08-24 23:05:58</span></td>
												   <td>Kredi Kartı</td>
												   <td><strong>10.00</strong></td>
												</tr>
												<tr>
												   <td>103</td>
												   <td><span class="nowrap">2020-08-24 23:05:58</span></td>
												   <td>Diğer</td>
												   <td><strong>25.00</strong></td>
												</tr>
											 </tbody>
										  </table>

									</div>
								</div>-->
		</div>
	</div>

</section>

</div>
</div>
</div>
<script>
	document.addEventListener('DOMContentLoaded', function() {
	    $(document).ready(function () {
    		function formatText (icon) {
    			return $('<span><i class="' + $(icon.element).data('icon') + '" style="color:'+$(icon.element).data('color')+'"></i> ' + icon.text + '</span>');
    		};
    
    		$('.select2').select2({
    			templateSelection: formatText,
    			templateResult: formatText
    		});       
    		$('.select3').select2({
    		});
	    });
	});
</script>
<?php require view('theme/footer'); ?>