<?php require view('theme/header'); ?>
<div class="row">
	<?php if($user["user_balance"] < 10): ?>
	<div class="col-md-12">
		<div class="alert alert-dismissible alert-danger">
			<b>Uyarı!</b>
			<p style="margin:0">Sevgili müşterimiz, bakiyeniz azalmış gibi gözüküyor, sorunsuz sipariş verebilmek için lütfen bakiye yüklemeyi unutmayınız.</p>
		</div>
	</div>
	<?php endif; ?>
	<div class="col-md-7">
		<div class="card">
			<div class="card-body">
				<form id="new_order" onsubmit="return false;">
					<div class="form-loader">
						<span class="intro-banner-vdo-play-btn pinkBg">
							<span class="ripple pinkBg"></span>
							<span class="ripple pinkBg"></span>
							<span class="ripple pinkBg"></span>
						</span>
					</div>
					<div class="form-group mb-3">
						<label>
							<b>{ORDER_FORM_CATEGORY_TITLE}:</b>
						</label>
						<select id="category" class="form-control ">							{ORDER_FORM_CATEGORIES}						</select>
					</div>
					<div class="form-group mb-3">
						<label>
							<b>{ORDER_FORM_SERVICE_TITLE}:</b>
						</label>
						<select id="service" name="service" class="form-control "></select>
					</div>
					<div class="form-group mb-3">
						<label>
							<b>{ORDER_FORM_DESC_TITLE}:</b>
						</label>
						<div class="panel panel-default">
							<div class="panel-body">
								<small id="description" class="card-text"></small>
							</div>
						</div>
					</div>
					<style>.min-max{padding:5px 15px;color:#fff;background:#dc123c;border-radius:6px;display:inline;font-weight:bold;}</style>
					<div class="form-group mb-3">
						<div class="min-max">                            Minimum: 
							<span id="min"></span> | Maksimum: 
							<span id="max"></span>
						</div>
					</div>
					<div class="form-group mb-3">
						<label>
							<b>{ORDER_FORM_LINK_TITLE}:</b>
						</label>
						<input type="text" name="link" id="link" class="form-control " />
					</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>
					<div id="quantity_div" class="form-group mb-3">
						<label>
							<b>{ORDER_FORM_QUANTITY_TITLE}:</b>
						</label>
						<input type="text" name="quantity" id="quantity" class="form-control " />
					</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>
							<div class="form-group mb-3">
								<label>
									<b>{ORDER_FORM_AMOUNT_TITLE}:</b>
								</label>
								<input type="text" id="amount" class="form-control" value="0" /readonly>
								</div>
								<div class="form-group">
									<button class="btn btn-primary">{ORDER_FORM_SUBMIT}</button>
								</div>
							</form>
						</div>
					</div>
				</div>
				<div class="col-md-5">
					<div class="card">
						<ul class="nav nav-tabs" id="myTab" role="tablist">
							<li class="nav-item" role="presentation">
								<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Bilgilendirme</a>
							</li>
							<li class="nav-item" role="presentation">
								<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Duyurular</a>
							</li>
						</ul>
						<div class="tab-content" id="myTabContent">
							<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
								<h4>{INDEX_LOGIN_HELLO}, {USER_USERNAME}</h4>
								<p>
									<b>{INDEX_BALANCE_INFO}: {USER_BALANCE} 
										<?=CURRENCY_SYMBOL?>
									</b>
								</p>
								<p>
									<b>{TOTAL_SPENT_TITLE}: {TOTAL_SPENT} 
										<?=CURRENCY_SYMBOL?>
									</b>
								</p>
								<hr>
									<?= htmlspecialchars_decode($page_content['page_content']) ?>
								</div>
								<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
									<h4>Duyurular</h4>
									<div class="scroll">
										<?php if($duyurular):							foreach($duyurular as $duyuru): ?>
										<div class="panel panel-default">
											<div class="panel-heading">
												<div class="icon" style="float:left; margin-right: 5px; text-align:center; border-radius: 10px; width:20px;
                                              height:20px; 
                                              background-color: <?= $duyuru['duyuru_daire_color'] ?>; color: <?= $duyuru['duyuru_icon_color'] ?>;">
                                              <i class="<?= $duyuru['duyuru_icon'] ?>"></i>
                                            </div><h4><?=$duyuru['duyuru_title']?></h4>
											</div>
											<div class="panel-body">
												<?=htmlspecialchars_decode($duyuru['duyuru_content'])?>
											</div>
											<div class="panel-footer">
												<?=str_date($duyuru['duyuru_date'])?>
											</div>
										</div>
										<?php endforeach; else: ?>
										<p>Henüz duyuru eklenmemiş.</p>
										<?php endif; ?>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<?php require view('theme/footer'); ?>