<?php require view('theme/header'); ?>
<style>
.hide{display:none;}
</style>
<main class="app-main">
    <div class="page-content">
        <div class="container-fluid">
		
            <div class="row mb-4">
                <div class="col-lg-12">
					<div class="card">
						<div class="py-4 px-lg-3 px-4">
							<div class="row">
								<div class="col-xl-3 col-md-6">
									<div class="top-card br">
										<div class="row align-items-center">
											<div class="col-auto">
												<div class="cnb-circle">
													<i class="far fa-box-heart"></i>
												</div>
											</div><!-- ./col -->
											<div class="col">
												<h2>Toplam Sipariş</h2>
												<?php $siparisler = $db->prepare("SELECT * FROM `orders`");	$siparisler->execute(); ?>
												<h3><?=$siparisler->rowCount()?></h3>
											</div>
										</div>
									</div>
								</div>
								
								<div class="col-xl-3 col-md-6">
									<div class="top-card br">
										<div class="row align-items-center">
											<div class="col-auto">
												<div class="cnb-circle">
													<i class="far fa-wallet"></i>
												</div>
											</div><!-- ./col -->
											<div class="col">
												<h2>Toplam Bakiye</h2>
												<h3>{USER_BALANCE} <?=CURRENCY_SYMBOL?></h3>
											</div>
										</div>
                                    </div>
								</div>
								
								<div class="col-xl-3 col-md-6">
									<div class="top-card br">
										<div class="row align-items-center">
											<div class="col-auto">
												<div class="cnb-circle">
													<i class="far fa-comment-alt-dollar"></i>
												</div>
											</div><!-- ./col -->
											<div class="col">
												<h2>Harcanan Bakiye</h2>
												<h3>{TOTAL_SPENT} <?=CURRENCY_SYMBOL?></h3>
											</div>
										</div>
                                    </div>
								</div>
								
								<div class="col-xl-3 col-md-6">
									<div class="top-card">
										<div class="row align-items-center">
											<div class="col-auto">
												<div class="cnb-circle">
													<i class="far fa-shield-check"></i>
												</div>
											</div><!-- ./col -->
											<div class="col">
												<h2>Hesap Statüsü</h2>
												  <?php if ($total_spent >= 25000){ ?>
												  <h3>Platin</h3>
												  <?php }elseif ($total_spent >= 5000){ ?>
												  <h3>Altın</h3>
												  <?php }elseif ($total_spent >= 2500){ ?>
												  <h3>Gümüş</h3>
												  <?php }else{ ?>
												  <h3>Bronz</h3>
												  <?php }; ?> 
											</div>
										</div>
                                    </div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

            <div class="row mt-2">
                <div class="col-lg-6">
                    <div class="card mb-5">
                        <div class="py-4 px-lg-3 px-4">
						
									<div class="t-head th-3">
										<div class="row align-items-center">
											<div class="col-md-auto">
												<div class="t-icon">
													<i class="fal fa-hand-holding-box"></i>
												</div>
											</div>
											<div class="col-md col-12">
												<h2>Yeni Bir Sipariş Ver</h2>
												<p>Siparişinizi buradan oluşturabilirsiniz</p>
											</div>
										</div>
									</div>
									
									<form id="new_order" onsubmit="return false;">
											  
											  
											  	
                                        <div class="fga mb-4">
                                            <label class="fla" for="category">{ORDER_FORM_CATEGORY_TITLE}</label>
                                            <div class="fg">
                                                <div class="fg-icon"><i class="far fa-list"></i></div>
                                                <select id="category" name="category" class="fg-control" data-toggle="ssp-selectbox" data-class="fg-control">
                                                    
                                                    <?php
                									$query = $db->from('categories')
                									
                									->join('services', 'services.category_id = categories.category_id')

                                                		->where('services.service_auto', 0)
                                                
                                                		->where('categories.category_status', 1)
                                                
                                                		->groupby('services.category_id')
                                                
                                                		->orderby('categories.category_number', 'ASC')
                                                
                                                		->all();
                									foreach($query as $qq){
                										$textqq = json_decode($qq['category_name'],true);
                										?>
													 <option value="<?= $qq['category_id'] ?>" <?php if ($_GET['cat_id'] == $qq['category_id']):  ?>selected <?php endif; ?> ><?= $textqq[0]['name'] ?></option>
													 <?php } ?>
                                                </select>
                                            </div>
                                        </div>
        
                                        <div class="fga mb-4">
                                            <label class="fla" for="service">{ORDER_FORM_SERVICE_TITLE}</label>
                                            <div class="fg">
                                                <div class="fg-icon"><i class="far fa-box-open"></i></div>
                                                <select name="service" id="service"  class="fg-control" data-toggle="ssp-selectbox" data-class="fg-control">
                                                    
                                                </select>
                                            </div>
                                        </div>
                                        
                                        <div class="fga mb-4">
                                            <label class="fla" for="link">{ORDER_FORM_LINK_TITLE}</label>
                                            <div class="fg">
                                                <div class="fg-icon"><i class="far fa-link"></i></div>
                                                <input name="link" id="link" class="fg-control" type="text" data-class="fg-control" />
                                            </div>
                                        </div>
                                        
                                         <div id="comment-group" class="fga mb-4 hide">
                                            <label class="fla" for="comments">{ORDER_FORM_COMMENTS_TITLE}</label>
                                            <div class="fg">
                                                <div class="fg-icon"><i class="fas fa-comments"></i></div>
                                                <textarea name="comments" id="comments" class="fg-control" type="text" rows="8" data-class="fg-control" ></textarea>
                                            </div>
                                        </div>
                                        
                                        <div class="fga mb-4">
                                            <label class="fla" for="quantity">{ORDER_FORM_QUANTITY_TITLE}</label>
                                            <div class="fg">
                                                <div class="fg-icon"><i class="far fa-sort-numeric-up-alt"></i></div>
                                                <input name="quantity" id="quantity" class="fg-control" type="text" data-class="fg-control" />
                                                <small class="help-block min-max">Min: <span id="min"></span> - Maks: <span id="max"></span></small>
                                            </div>
                                        </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="fga mb-4">
                                                <label class="fla" for="runs">{ORDER_FORM_DRIP_RUNS_TITLE}</label>
                                                <div class="fg">
                                                    <div class="fg-icon"><i class="far fa-sort-numeric-up-alt"></i></div>
                                                    <input name="runs" id="runs" class="fg-control" type="text" data-class="fg-control" />
                                                </div>
                                            </div>
                                            <div class="fga mb-4">
                                            <label class="fla" for="interval">{ORDER_FORM_DRIP_INTERVAL_TITLE}</label>
                                            <div class="fg">
                                                <div class="fg-icon"><i class="far fa-list"></i></div>
                                                <select id="interval" name="interval" class="fg-control" data-toggle="ssp-selectbox" data-class="fg-control">
                                                    
													 <option value="0" >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>
                                                
                                            </div>
                                            <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="row">
                                            <div class="col-md-6 col-12 mb-4 mb-mb-0">
												<input type="hidden" name="_csrf" value="{{ csrftoken }}">
                                                <button type="submit" class="btn btn-primary btn-block">
                                                    {ORDER_FORM_SUBMIT}
                                                </button>
                                            </div>
                                            <div class="col-md-6 col-12 mb-4 mb-mb-0 form-group">
                                                <div class="form-group">
                                                    <input type="text" class="form-control" id="amount" value="" readonly style="padding: 19px 50px;border-radius:10px" placeholder="Ödenecek Tutar">
                                                </div>
                                            </div>
                                        </div>
                                    </form>
                        </div>
                    </div><!-- card -->
                </div><!-- col -->
                <div class="col-lg-6">
                    <div class="card">
                        <div class="py-4 px-lg-3 px-4">
									<div class="t-head th-3">
										<div class="row align-items-center">
											<div class="col-md-auto">
												<div class="t-icon">
													<i class="fal fa-comment-alt-medical"></i>
												</div>
											</div>
											<div class="col-md col-12">
												<h2>Servis Açıklaması</h2>
												<p><span id="s_name"></span></p>
											</div>
										</div>
									</div>
									
                                    <div class="dp-service-text">
										<span id="description"></span>
                                    </div>
                                    <div class="card mt-4">
                                        <div class="cb-content">
                                            <div class="card-body">
                                                <div class="row text-center align-items-center">
                                                    <div class="col">
                                                        <div class="text-muted">
                                                           Sipariş verdiğiniz zaman <a href="/terms">Kullanım Sözleşmesi</a>'ni kabul etmiş sayılırsınız.
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                       
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>
		
		<?php require view('theme/footer'); ?>