<commit_before><?php
namespace Baskets\Pages;
class Proposals
{

///////////////////////////////////////////////

//////////     Page Display Switch   //////////

///////////////////////////////////////////////

	public static function display()
	{
		switch (\Baskets\Tools\Tracker::$uri[2])
		{
			case 'list':
				self::lister();
				break;
			case 'new':
				self::newer();
				break;
			case 'proposal':
				self::proposal();
				break;
			case 'old':
				self::old();
				break;
			default:
				Framework::$newurl = 'proposals/list';
				self::lister();
				break;
		}
	}




///////////////////////////////////////

//////////     BIDS LIST    //////////

///////////////////////////////////////

	public static function lister()
	{
		Framework::page_header('Proposals | Baskets');
	?>
		<div class='main-viewer' id='main-viewer'>
			<div class='dash-box'>
				<div class='dash-box-header'>
					<h1><i class="fa fa-leaf"></i> All Proposals</h1>
					<a href='<?=MY_URL?>/proposals/add' class='add-button'>Add Proposal</a>
				</div>
				<p>
					<table class='table-one'>

		<?
			// Print column titles
			$cols = array('id','proposal');
			echo '<tr>';
			foreach($cols as $col)
			{
				echo "<td>$col</td>";				
			}
			echo '</tr>';

			// Connect to DB and print proposals
			$db = \Baskets\Tools\Database::getConnection();
			$stm = $db->prepare("SELECT * FROM proposals");
			$stm->execute();
			while($proposals = $stm->fetch())
			{
				echo "<tr class='list-item' onclick=\"document.location = '".MY_URL."/proposals/bid/".$bids['id']."'\">";
				foreach($cols as $col)
				{
					echo '<td>' . $proposals[$col] . '</td>';
				}
				echo '</tr>';
			}
		?>

					</table>
				</p>
			</div>
		</div>
<?php
		Framework::page_footer();
	}







///////////////////////////////////////

//////////     ADD Proposal    ///////////

///////////////////////////////////////

	public static function newer()
	{
		Framework::page_header('Add Proposal | Baskets');
	?>
		<div class='main-viewer' id='main-viewer'>
			<div class='dash-box'>
				<div class='dash-box-header'>
					<h1><i class="fa fa-leaf"></i> Add Proposal</h1>
					<a href='<?=MY_URL?>/proposals/list' class='add-button'>List Proposals</a>
				</div>
				<p>
					<form class='formula-one'>
						<div class='line'>
							<div class='group'>
								<input type='text' name='contractor' id='contractor' placeholder='Contactor'>
							</div>
						</div>	
						<div class='line'>
							<div class='group'>
								<label for='model'>Model</label>
								<span><input type='text' name='model' id='model'></span>
							</div>
						</div>
						<div class='line'>
							<div class='group'>
								<label for='option'>Option</label>
								<span><input type='text' name='option' id='option'></span>
							</div>
						</div>
						<div id='rooms'>
							<div id='room0' style='display:none'>
								<input type='text' name='name-of-room0' placeholder='Room' onfocus='addRoomInput(0)'>
								<div id='room0-parts'>
									<div id='room0-part0'>
										<input type='text' name='room0-part0-id' placehold='Part ID' onfocus='addPartInput(0,0)'>
										<span id='room0-part0-name'></span>
										<select>
											<option val='custom'>$</option>
										</select>
										<input type='number' class='room-part-price' step='0.01' min='0.01' name='room0-part0-price' placeholder='0.01'>
									</div>
								</div>
							</div>
						</div>
						<div class='input-wrap'>
							<input type='hidden' name='job' value='add_proposal'>
							<input type='hidden' name='pp' id='pp' value='1'>
							<input type='submit'>
						</div>
					</form>
					<script>
						$( 'form' ).submit( function( event ) {
							event.preventDefault();
							var formdata = JSON.stringify($( this ).serializeObject());
							sender('proposals',formdata);
						});

						// PROPOSED ROOM INPUT ROW ADDITION
						$(function() { addRoomInput(0) } );

						function addRoomInput(rn) {
							nrn = rn + 1;
							next_room = document.getElementById('name-of-room' + nrn);

							if ( typeof(next_room) == 'undefined' || next_room == null) {
								var newRoom = document.getElementById('room0').cloneNode(true);
								newRoom.id = 'room' + nrn;
								newRoom.style.display = 'block';
								newRoom.childNodes[1].name = 'name-of-room' + nrn;
								console.log(newRoom.childNodes[3].childNodes[1]);
								newRoom.childNodes[3].childNodes[1].childNodes[1].name = 'room' + nrn + '-part0';
								newRoom.childNodes[3].childNodes[1].childNodes[3].id = 'room' + nrn + '-part0-name';
								newRoom.childNodes[3].childNodes[1].childNodes[3].name = 'room' + nrn + '-part0-price';
								document.getElementById('rooms').appendChild(newRoom);
							}

						}


						function addPartInput(rn,pn) {
							npn = pn + 1;
							next_part = document.getElementById('room' + rn + '-part' + npn);
							if ( typeof(next_part) == 'undefined' || next_part == null) {
								var newPart = document.getElementById('room0-part0').cloneNode(true);
								newPart.childNodes[1].name = 'room' + rn + '-part' + npn + '-id';
								console.log(newPart.childNodes[7]);
								newPart.childNodes[3].id = 'room' + rn + '-part' + npn + '-name';
								newPart.childNodes[7].name = 'room' + rn + '-part' + npn + '-price';
								document.getElementById('room' + rn + '-parts').appendChild(newPart);
							}
						}

						









var numparts = 0;

function checkpp(elem){
	var mynum = elem.getAttribute('data-pn');
	if (mynum == numparts) addpp();
}

function addpp(){
	var pp = document.getElementById('pp0').cloneNode(true);<commit_msg>new proposals js works<commit_after><?php
namespace Baskets\Pages;
class Proposals
{

///////////////////////////////////////////////

//////////     Page Display Switch   //////////

///////////////////////////////////////////////

	public static function display()
	{
		switch (\Baskets\Tools\Tracker::$uri[2])
		{
			case 'list':
				self::lister();
				break;
			case 'new':
				self::newer();
				break;
			case 'proposal':
				self::proposal();
				break;
			case 'old':
				self::old();
				break;
			default:
				Framework::$newurl = 'proposals/list';
				self::lister();
				break;
		}
	}




///////////////////////////////////////

//////////     BIDS LIST    //////////

///////////////////////////////////////

	public static function lister()
	{
		Framework::page_header('Proposals | Baskets');
	?>
		<div class='main-viewer' id='main-viewer'>
			<div class='dash-box'>
				<div class='dash-box-header'>
					<h1><i class="fa fa-leaf"></i> All Proposals</h1>
					<a href='<?=MY_URL?>/proposals/add' class='add-button'>Add Proposal</a>
				</div>
				<p>
					<table class='table-one'>

		<?
			// Print column titles
			$cols = array('id','proposal');
			echo '<tr>';
			foreach($cols as $col)
			{
				echo "<td>$col</td>";				
			}
			echo '</tr>';

			// Connect to DB and print proposals
			$db = \Baskets\Tools\Database::getConnection();
			$stm = $db->prepare("SELECT * FROM proposals");
			$stm->execute();
			while($proposals = $stm->fetch())
			{
				echo "<tr class='list-item' onclick=\"document.location = '".MY_URL."/proposals/bid/".$bids['id']."'\">";
				foreach($cols as $col)
				{
					echo '<td>' . $proposals[$col] . '</td>';
				}
				echo '</tr>';
			}
		?>

					</table>
				</p>
			</div>
		</div>
<?php
		Framework::page_footer();
	}







///////////////////////////////////////

//////////     ADD Proposal    ///////////

///////////////////////////////////////

	public static function newer()
	{
		Framework::page_header('Add Proposal | Baskets');
	?>
		<div class='main-viewer' id='main-viewer'>
			<div class='dash-box'>
				<div class='dash-box-header'>
					<h1><i class="fa fa-leaf"></i> Add Proposal</h1>
					<a href='<?=MY_URL?>/proposals/list' class='add-button'>List Proposals</a>
				</div>
				<p>
					<form class='formula-one'>
						<div class='line'>
							<div class='group'>
								<input type='text' name='contractor' id='contractor' placeholder='Contactor'>
							</div>
						</div>	
						<div class='line'>
							<div class='group'>
								<label for='model'>Model</label>
								<span><input type='text' name='model' id='model'></span>
							</div>
						</div>
						<div class='line'>
							<div class='group'>
								<label for='option'>Option</label>
								<span><input type='text' name='option' id='option'></span>
							</div>
						</div>
						<div id='rooms'>
							<div id='room0' style='display:none'>
								<input type='text' name='name-of-room0' placeholder='Room' >
								<div id='room0-parts'>
									<div id='room0-part0'>
										<input type='text' name='room0-part0-id' placehold='Part ID' >
										<span id='room0-part0-name'></span>
										<select>
											<option val='custom'>$</option>
										</select>
										<input type='number' class='room-part-price' step='0.01' min='0.01' name='room0-part0-price' placeholder='0.01'>
									</div>
								</div>
							</div>
						</div>
						<div class='input-wrap'>
							<input type='hidden' name='job' value='add_proposal'>
							<input type='hidden' name='pp' id='pp' value='1'>
							<input type='submit'>
						</div>
					</form>
					<script>
						$( 'form' ).submit( function( event ) {
							event.preventDefault();
							var formdata = JSON.stringify($( this ).serializeObject());
							sender('proposals',formdata);
						});

						// PROPOSED ROOM INPUT ROW ADDITION
						$(function() { addRoomInput(0) } );

						var rooms = 0;

						function addRoomInput(rn) {
							var nrn = rn + 1;
							next_room = document.getElementById('room' + nrn);
							console.log('room' + nrn);
							if ( typeof(next_room) == 'undefined' || next_room == null) {
								var newRoom = document.getElementById('room0').cloneNode(true);
								newRoom.id = 'room' + nrn;
								newRoom.style.display = 'block';
								newRoom.childNodes[1].name = 'name-of-room' + nrn;
								newRoom.childNodes[1].onfocus = function () { addRoomInput(nrn); };
								newRoom.childNodes[3].id = 'room' + nrn + '-parts';
								newRoom.childNodes[3].childNodes[1].id = 'room' + nrn + '-part0';
								newRoom.childNodes[3].childNodes[1].childNodes[1].name = 'room' + nrn + '-part0';
								newRoom.childNodes[3].childNodes[1].childNodes[1].onfocus = function () { addPartInput(nrn,0); };
								newRoom.childNodes[3].childNodes[1].childNodes[3].id = 'room' + nrn + '-part0-name';
								newRoom.childNodes[3].childNodes[1].childNodes[7].name = 'room' + nrn + '-part0-price';
								document.getElementById('rooms').appendChild(newRoom);
							}

						}


						function addPartInput(rn,pn) {
							var npn = pn + 1;
							next_part = document.getElementById('room' + rn + '-part' + npn);
							if ( typeof(next_part) == 'undefined' || next_part == null) {
								var newPart = document.getElementById('room0-part0').cloneNode(true);
								newPart.id = 'room' + rn + '-part' + npn;
								newPart.childNodes[1].name = 'room' + rn + '-part' + npn + '-id';
								newPart.childNodes[1].onfocus = function () { addPartInput(rn,npn); };
								newPart.childNodes[3].id = 'room' + rn + '-part' + npn + '-name';
								newPart.childNodes[7].name = 'room' + rn + '-part' + npn + '-price';
								document.getElementById('room' + rn + '-parts').appendChild(newPart);
							}
						}

						









var numparts = 0;

function checkpp(elem){
	var mynum = elem.getAttribute('data-pn');
	if (mynum == numparts) addpp();
}

function addpp(){
	var pp = document.getElementById('pp0').cloneNode(true);
{'fraction_non_alphanumeric': 0.2354969399189725, 'fraction_numerical': 0.01008533747090768, 'mean_word_length': 2.162169528481875, 'pattern_counts': {'":': 0, '<': 179, '<?xml version=': 0, '>': 185, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1751927', 'n_tokens_mistral': 5135, 'n_tokens_neox': 3798, 'n_words': 711}