index.php

mail@pastecode.io avatar
unknown
php
a year ago
24 kB
1
Indexable
Never
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />

	<title>Редактор XML</title>
	<script src="js/jquery-3.6.0.min.js"></script>
	<link rel="stylesheet" href="style/bootstrap.min.css" integrity="undefined" crossorigin="anonymous">
	<link rel="stylesheet" type="text/css" href="style/all.css">
	<link rel="icon" type="image/gif/png" href="images/code.png">
</head>
<body>
	<style>
	#checkboxes label{
		display:block;
		padding: 5px;

	}

	#checkboxes {
		max-height: 310px;
		overflow-y: scroll;
		margin: 0;
		padding: 5px;
	}

	#checkboxes input {
		margin-right: 10px;
	}

	#checkboxes li {
		list-style-type: none;
	}

	#StorCheckboxes label{
		display:block;
		padding: 5px;

	}

	#StorCheckboxes {
		max-height: 200px;
		overflow-y: scroll;
		margin: 0;
		padding: 5px;
	}

	#StorCheckboxes input {
		margin-right: 10px;
	}

	#StorCheckboxes li {
		list-style-type: none;
	}

	#brand {
		max-height: 310px;
		overflow-y: scroll;
		margin: 0;
		padding: 5px;
	}

	#brand input {
		margin-right: 10px;
	}

	#brand li {
		list-style-type: none;
	}
	
</style>
<?php 

include "db.php";

session_start();
if (isset($_SESSION['crm_plaza_login'])) {
	$id = $_SESSION['crm_plaza_login'];
	$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
	$stmt->bind_param("i", $id);
	if($stmt->execute()) {
			$result = $stmt->get_result(); // get the mysqli result
			$row = $result->fetch_object(); // fetch data 
		} else {
			header("Location: login.php");
		}
	} else {
		header("Location: login.php");
	}
	
	?>
	<!-- navbar -->
	<?php 
	include "./header.php";
	?>
	<!-- navbar -->
	
	<div class="container">
		<br>
		<div class="row border" style="padding: 10px">
			<div class="col-5 d-flex align-items-center">	
				<h5 style="margin-bottom: -1%;">Магазин</h5>
			</div>
			<div class="col-7">	
				<select id="storeSelect" class="form-select" aria-label="Default select example">
					<option value="1" selected>Загрузка...</option>
				</select>
			</div>
		</div>
		<br>	
		<div class="row">
			<div class="col-3">
				<button  type="button" class="btn" data-bs-toggle="modal" data-bs-target="#excelModal" style="background: green; color:#fff;">Загрузить прайс в EXCEL</button>
				<a href="files/Шаблон загрузки цен.xlsx" type="button" class="btn" style="background: gray; color:#fff; margin-top: 10px;">Скачать шаблон EXCEL<span style="font-size: 18px;">↓</span></a>
			</div>
			<div class="col-3">
				
			</div>
			<div class="col-3">
				<button  type="button" class="btn" data-bs-toggle="modal" data-bs-target="#excelUpdateModal" style="background: green; color:#fff;">Обновить прайс в EXCEL</button>
				<a href="files/Шаблон обновления цен.xlsx" type="button" class="btn" style="background: gray; color:#fff; margin-top: 10px;">Скачать шаблон Обновления<span style="font-size: 18px;">↓</span></a>
			</div>
			<div class="col-3">
				
			</div>
		</div>
		<br>
		<div class="row">
			<div class="col-4 col-md-6 d-flex justify-content-start">
				
				<div class="row gy-1">
					<div class="col-6">
						<button  class="btn btn-danger w-100" id="decreasePercentButton" data-bs-toggle="tooltip" data-bs-placement="top"  title="Если вы не укажиите цену, то цена всех товаров будет уменшена на 10" >- %</button>
					</div>
					<div class="col-6">
						<button  class="btn btn-danger w-100" id="increasePercentButton" data-bs-toggle="tooltip" data-bs-placement="top"  title="Если вы не укажиите цену, то цена всех товаров будет уменшена на 10" >+ %</button>
					</div>
					
					<div class="col-12">
						<input id="amountField" class="w-100" type="text" name="" autocomplete="off" placeholder="Изменить цену на" >
					</div>
					<div class="col-6">
						<button  class="btn btn-primary w-100" id="decreaseButton" data-bs-toggle="tooltip" data-bs-placement="top"  title="Если вы не укажиите цену, то цена всех товаров будет уменшена на 10" >-</button>
					</div>
					<div class="col-6">
						<button  class="btn btn-primary w-100" id="increaseButton" data-bs-toggle="tooltip" data-bs-placement="top"  title="Если вы не укажиите цену, то цена всех товаров будет уменшена на 10" >+</button>
					</div>
					
				</div>
			</div>
			<div class="col-6 d-flex justify-content-end">
				<div class="row gy-1">
					<!-- Button triggers modal -->
					<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">+ Добавить новый товар</button>

					<?php 
					if ($row->role =="ADMIN") {
						echo '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#uploadModal">загрузить файл</button>';
					}
					?>
					
					<button id="downloadHomeCreditXML" type="button" class="btn" style="background: #560511; color:#fff;">Экспорт HOME CREDIT <span style="font-size: 18px;">↓</span></button>
					
					<button id="downloadHalykXML" type="button" class="btn btn-success">Экспорт Halyk XML <span style="font-size: 18px;">↓</span></button>
					<button id="downloadXML" type="button" class="btn" style="background: #F24634; color:#fff;">Экспорт Kaspi XML <span style="font-size: 18px;">↓</span></button>

				</div>
			</div>
		</div>
		
		<br>

		<!-- Filter -->
		<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
			Фильтр
		</button>
		<div class="collapse" id="filterCollapse">
			<div class="card card-body">
				<div class="row">
					<div class="col-4">
						<h6>SKU Продукта</h6>
						<div class="input-group mb-3">
							<input id="inputSku" type="text" class="form-control" placeholder="ID" aria-label="Username" aria-describedby="basic-addon1">
						</div>
					</div>
					<div class="col-4">
						<h6>Наименование</h6>
						<div class="input-group mb-3">
							<input id="inputModel" type="text" class="form-control" placeholder="Наименование" aria-label="Username" aria-describedby="basic-addon1">
						</div>
					</div>
					<div class="col-4">
						<h6>Статус наличия</h6>
						<select id="availableFilter" class="form-select" aria-label="Default select example">
							<option value="" selected>Все</option>
							<option value="yes">В наличии</option>
							<option value="no">Отсутствует</option>
						</select>
					</div>
					<div class="col-4">
						<h6>Производитель</h6>
						<ul id="brand" class="border rounded">
							<li><label for="one"><input type="checkbox" id="one" />Сбросьте кэш! ctrl + shift + R</label></li>
						</ul>
						<!-- <select id="brand" class="form-select" aria-label="Default select example">
							 <option value="" selected>Все</option> 
							</select> -->
						</div>
					<!-- <div class="col-4">
						<h6>На Kaspi</h6>
						<select class="form-select" aria-label="Default select example" disabled="">
							<option selected>Все товары</option>
							<option value="1">Да</option>
							<option value="2">Нет</option>
						</select>
					</div> -->

					<!-- <div class="col-4">
						<h6>Поставщик</h6>
						<select id="shipperFilter" class="select" aria-label="Default select example" multiple="">
							
						</select>
						
					</div> -->
					<div class="col-8">
						<h6>Поставщик</h6>
						<ul id="checkboxes" class="border rounded">
							<li><label for="one"><input type="checkbox" id="one" />Сбросьте кэш! ctrl + shift + R</label></li>
						</ul>

					</div>
					
				</div>
				<br>
				
				<div class="row">
					<div class="col-11">
						<button id="resetFilterButton" class="btn btn-primary" style="margin-right: 20px;">Сброс</button>
						<button id="searchButton" class="btn btn-primary">Поиск</button>
					</div>
					<div class="col-1">
						<button id="dippingButton" class="btn" style="background-color: green; color: #fff;">Диппинг</button>
					</div>
				</div>
			</div>
		</div>
		<!-- End of filter -->

		<!-- Profile Modal -->
		<div class="modal fade" id="profileModal" tabindex="-1" aria-labelledby="profileModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" id="profileModalLabel">Профиль</h5>
						<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
					</div>
					<div class="modal-body">
						<div class="mb-3">
							<div class="row">
								<div id="profileImage" class="col-5 d-flex justify-content-center">
									
								</div>
								<div class="col-7">
									<h5 id="profileName"></h5>
									<p id="profileEmail"></p>
								</div>
							</div>
						</div>

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
					</div>
				</div>
			</div>
		</div>
		<!-- End of Profile Modal -->

		<!-- Add Modal -->
		<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" id="exampleModalLabel">Добавить новый товар</h5>
						<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
					</div>
					<div class="modal-body">
						<div class="input-group mb-3">
							<span class="input-group-text" id="basic-addon1">SKU</span>
							<input type="text" class="form-control" placeholder="SKU" id="inputNewSKU">
						</div>
						<div class="input-group mb-3">
							<span class="input-group-text" id="basic-addon1">Модель</span>
							<input type="text" class="form-control" placeholder="Модель"  id="inputNewModel">
						</div>
						<div class="input-group mb-3">
							<span class="input-group-text" id="basic-addon1">Производитель</span>
							<input type="text" class="form-control" placeholder="Бренд" id="inputNewBrand">
						</div>
						
						<div class="input-group mb-3">
							<span class="input-group-text" id="basic-addon1" style="background-color: purple; color: #fff">Вход</span>
							<input type="text" class="form-control" placeholder="Входная цена" id="inputNewPurchasePrice">
						</div>

						<div class="input-group mb-3">
							<span class="input-group-text" id="basic-addon1">Цена</span>
							<input type="text" class="form-control" placeholder="Цена" id="inputNewPrice">
						</div>

						<div class="input-group mb-3">
							<span class="input-group-text" id="basic-addon1">Поставщик</span>
							<select id="shipperAddList"  class="form-select" aria-label="Default select example" >
								<!-- <option selected>Откройте чтобы выбрать</option>
								<option value="1">В наличии</option>
								<option value="2">Отсутствует</option> -->
							</select>
						</div>

						<div>
							
							<input type="checkbox" name="addSelectAllStores" id="addSelectAllStores">
							<label for="addSelectAllStores">Отметить все магазины</label>
							
							<ul id="StorCheckboxes" class="border rounded">
								<!-- <li><label><input type="checkbox" id="shipperCheck" data-id="0">Все поставщики</label></li>
									<li><label for="39"><input type="checkbox" id="shipperCheck" name="39" data-id="39">7-строй</label></li> -->
								</ul>
							</div>

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="closeModalButton">Закрыть</button>
							<button id="sendNewOfferButton" type="button" class="btn btn-primary">Добавить</button>
						</div>
					</div>
				</div>
			</div>
			<!-- End of Add Modal -->

			<!-- Edit Modal -->
			<div class="modal fade" id="editModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Изменить товар</h5>
							<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
						</div>
						<div class="modal-body">
							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">SKU</span>
								<input type="text" disabled class="form-control" placeholder="SKU" id="editInputSKU">
							</div>
							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Модель</span>
								<input type="text" class="form-control" placeholder="Model"  id="editInputModel">
							</div>
							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Бренд</span>
								<input type="text" class="form-control" placeholder="Brand" id="editInputBrand">
							</div>

							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Вход</span>
								<input type="text" class="form-control" placeholder="Входная цена" id="editInputPurchasePrice">
							</div>

							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Цена</span>
								<input type="text" class="form-control" placeholder="Цена" id="editInputPrice">
							</div>

							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Маржа</span>
								<input type="text" disabled="" class="form-control" placeholder="Маржа недоступна" id="editInputMarzha">
							</div>

							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Предзаказ (кол)</span>
								<input type="text" class="form-control" placeholder="Предзаказ" id="editPreorder">
							</div>
							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">PP</span>
								<input type="text" class="form-control" placeholder="PP" id="editProvider">
							</div>

							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Поставщик</span>
								<select id="shipperSelect" class="form-select" aria-label="Default select example">

								</select>
							</div>

							<div class="input-group mb-3">
								<p id="editErrorMesage" class="hidden" style="color: red;"><strong>Вы пытаетесь понизить цену ниже входной!</strong></p>
							</div>

							<div class="form-check form-switch">
								<input class="form-check-input" type="checkbox" id="editSwitchAvailable">
								<label class="form-check-label" for="flexSwitchCheckDefault">Есть в наличии</label>
							</div>


						</div>
						<div class="modal-footer">
							<div class="row w-100">
								<div class="col-5">
									<button class="btn btn-danger" data-bs-target="#deleteGoodModal" data-bs-toggle="modal" data-bs-dismiss="modal">
										<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
											<path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"/>
										</svg>
									</button>
								</div>
								<div class="col-7 d-flex justify-content-end">
									<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="closeEditModalButton">Закрыть</button>
									<button id="saveOfferButton" type="button" class="btn btn-primary" style="margin-left: 10px;">Сохранить</button>
								</div>
							</div>

						</div>
					</div>
				</div>
			</div>
			<!-- End of Edit Modal -->

			<!-- Delete Modal -->
			<div class="modal fade" id="deleteGoodModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="deleteModalLabel">Вы уверены?</h5>
							<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
						</div>
						<div class="modal-body">
							<p >Выбранный вами товар будет удален и больше не будет достпуен в системе!</p>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="closeDeleteModalButton">Закрыть</button>
							<button type="button" class="btn btn-danger" id="deleteOfferButton">Все равно удалить</button>
						</div>
					</div>
				</div>
			</div>
			<!-- End of Edit Modal -->

			<!-- Upload Modal -->
			<div class="modal fade" id="uploadModal" tabindex="-1" aria-labelledby="uploadModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="uploadModalLabel">Загрузить файл для редактирования</h5>
							<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
						</div>
						<div class="modal-body" id="uploadModalContent">
							<div class="input-group mb-3">
								<input id="fileInput" type="file" class="form-control" id="inputGroupFile02">
							</div>
							<br>
							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Поставщик</span>
								<select id="shipperSelectUpload" class="form-select" aria-label="Default select example">
									<option value="0" selected>Поставщиков нет</option>
								</select>
							</div>
							<br>
							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1"><strong>Тип загрузки</strong></span>
								<select id="uploadTypeSelect" class="form-select" aria-label="Default select example">
									<option value="UPDATE_OFFERS" selected>Только обновить данные</option>
									<option value="REPLACE_OFFERS">Заменить все</option>
								</select>
							</div>
							<div id="uploadLoadingSpinner" class="spinner-border text-primary hidden" role="status">
								<span class="visually-hidden">Loading...</span>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="closeUploadModalButton">Закрыть</button>
							<button id="uploadFileButton" type="button" class="btn btn-primary">Загрузить</button>
						</div>
					</div>
				</div>
			</div>
			<!-- End of Upload Modal -->

			<!-- EXCEL Modal -->
			<div class="modal fade" id="excelModal" tabindex="-1" aria-labelledby="uploadModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="uploadModalLabel">EXCEL добавление прайса</h5>
							<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
						</div>
						<div class="modal-body" id="uploadModalContent">
							<div class="input-group mb-3">
								<input id="fileInputExcel" type="file" class="form-control">
							</div>
							<br>
							<div class="input-group mb-3">
								<span class="input-group-text" id="basic-addon1">Поставщик</span>
								<select id="shipperSelectUploadExcel" class="form-select" aria-label="Default select example">
									<option value="0" selected>Поставщиков нет</option>
								</select>
							</div>
							<br>
							<div id="uploadExcelLoadingSpinner" class="spinner-border text-primary hidden" role="status">
								<span class="visually-hidden">Loading...</span>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="closeExcelUploadModalButton">Закрыть</button>
							<button id="ExcelUploadFileButton" type="button" class="btn btn-primary">Загрузить</button>
						</div>
					</div>
				</div>
			</div>
			<!-- End of EXCEL Modal -->

			<!-- EXCEL Update Modal -->
			<div class="modal fade" id="excelUpdateModal" tabindex="-1" aria-labelledby="uploadModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="uploadModalLabel">EXCEL обновление прайса</h5>
							<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
						</div>
						<div class="modal-body" id="uploadModalContent">
							<div class="input-group mb-3">
								<input id="fileUpdateExcel" type="file" class="form-control">
							</div>
							<br>
							<div class="input-group mb-3">
								<input class="form-control" id="PriceAddup" placeholder="Наценка" type="text" >
								<span class="input-group-text">%</span>
							</div>
							<br>
							<div id="ExcelUpdateLoadingSpinner" class="spinner-border text-primary hidden" role="status">
								<span class="visually-hidden">Loading...</span>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="CloseExcelUpdateModal">Закрыть</button>
							<button id="ExcelUpdateButton" type="button" class="btn btn-primary">Загрузить</button>
						</div>
					</div>
				</div>
			</div>
			<!-- End of EXCEL Update Modal -->


		</div>
			<br>	
			<br>	

			<div class="wrapper">
			<div class="row">
				<div class="col-12">
					<h4>Список товаров</h4>
				</div>
				<div class="col-12">
					<p id="counterLabel"></p>
				</div>
			</div>
			<div class="row ">
				<div class="col-12" style="overflow-y: hidden;">
					<table class="table table-light table-bordered fs-6 w-100" style="word-wrap: break-word; " id="list">

					</table>
				</div>
			</div>
			<!-- List start -->
			<!-- <div class="row gy-2" id="list"></div> -->
			<!-- List end -->

			<br>
			<!-- Pagination block -->
			<div class="col d-flex justify-content-center" id="pages"></div>
			<!-- End of pagination block -->
			<br>

	</div>





		<script src="js/bootstrap.bundle.min.js" ></script>
		<!-- <script type="text/javascript" src="https://unpkg.com/@popperjs/core@2"></script> -->
		<!-- <script src="js/bootstrap.min.js"></script> -->

		<script type="text/javascript" src="js/notify.min.js"></script>
		<script type="text/javascript" src="js/index.js"></script>
<script src="js/wildberriesBage.js"></script>
	</body>
	</html>