<?php

$modalContent = ''; 
$modalContent .= '<div class="row"><div class="col-xs-12">';

$modalContent .= '<input type="hidden" name="op" value="'. $op .'" />
				'. $editInpID . '
				<input type="hidden" name="adminType" value="'. $adminType .'" />
				<input type="hidden" name="estDisplay" value="'. $estDisplay .'" />';

$modalContent .= '<h3>General Estimate Information:</h3>';
$modalContent .= '<div class="table-responsive">';
$modalContent .= '<table class="adminForm table table-condensed">';
$modalContent .= '<tr>
				<th>Name:</th>
				<td><input type="text" name="estName" value="'. $estName .'" /></td>
				<th>Status:</th>
				<td>'. $estimateStatus .'</td>
			</tr>';		
$modalContent .= '<tr>
				<th>Client:</th>
				<td colspan="3">'. $estimateClient .'</td>
			</tr>';
$modalContent .= '<tr>
				<th>Project:</th>
				<td colspan="3"><input type="hidden" name="existProjID" value="'. $projectID .'" />'. $estimateProject .'</td>
			</tr>';	
$modalContent .= '<tr>
				<th>Description:</th>
				<td colspan="3"><textarea name="estDesc" style="width: 570px; height: 100px;">'. $estDesc .'</textarea></td>
			</tr>';
$modalContent .= '<tr>
				<th>Hourly Rate:</th>
				<td colspan="3"><input type="number" step="any" id="estRate" class="calcField" name="estRate" value="' . $estRate . '" style="width: 60px" /> ($ per hour)</td>
				</tr>';
$modalContent .= '</table>';
$modalContent .= '</div><!-- /table-responsive -->';
	
$modalContent .= '<h3>Estimate Details:</h3>';	
$modalContent .= '<div class="table-responsive">';
$modalContent .= '<table class="adminForm table table-condensed">';
$modalContent .= '<tr>
				<td><strong>Technical:</strong><br><textarea name="estTech" style="width: 300px; height: 50px; margin-top: 5px">'. $estTech .'</textarea></td>
				<td>
					<strong>Hosting Acct Info:</strong> Supplied: 
					<input type="radio" class="radioBtn" style="width: 20px" name="estHaveHost" value="0"'. $selHostNo .' /> No &nbsp;&nbsp;
					<input type="radio" class="radioBtn" style="width: 20px" name="estHaveHost" value="1"'. $selHostYes .' /> Yes <br>
					<textarea name="estHostInfo" style="width: 300px; height: 50px; margin-top: 5px">'. $estHostInfo .'</textarea>
				</td>
			</tr>';
$modalContent .= '<tr>
				<td>
					<strong>Web Design:</strong>
					<input type="text" name="estDesign" class="calcField hours" value="' . $estDesign . '" style="width: 125px" /> hours<br>
					<textarea name="estDesignDesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estDesignDesc .'</textarea>
				</td>
				<td>
					<strong>Web Production:</strong>
					<input type="text" name="estProd" class="calcField hours" value="' . $estProd . '" style="width: 125px" /> hours<br>
					<textarea name="estProdDesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estProdDesc .'</textarea>
				</td>
			</tr>';
$modalContent .= '<tr>
				<td>
					<strong>Coding/Programming:</strong>
					<input type="text" name="estCode" class="calcField hours" value="' . $estCode . '" style="width: 125px" /> hours<br>
					<textarea name="estCodeDesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estCodeDesc .'</textarea>
				</td>
				<td>
					<strong>Database:</strong>
					<input type="text" name="estDB" class="calcField hours" value="' . $estDB . '" style="width: 125px" /> hours<br>
					<textarea name="estDBdesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estDBdesc .'</textarea>
				</td>
			</tr>';
$modalContent .= '<tr>
				<td>
					<strong>CMS:</strong>
					<input type="text" name="estCMS" class="calcField hours" value="' . $estCMS . '" style="width: 125px" /> hours<br>
					<textarea name="estCMSdesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estCMSdesc .'</textarea>
				</td>
				<td>
					<strong>SEO:</strong>
					<input type="text" name="estSEO" class="calcField hours" value="' . $estSEO . '" style="width: 125px" /> hours<br>
					<textarea name="estSEOdesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estSEOdesc .'</textarea>
				</td>
			</tr>';
$modalContent .= '<tr>
				<td>
					<strong>Logo Design:</strong>
					<input type="text" name="estLogo" class="calcField hours" value="' . $estLogo . '" style="width: 125px" /> hours<br>
					<textarea name="estLogoDesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estLogoDesc .'</textarea>
				</td>
				<td>
					<strong>Graphic Design:</strong>
					<input type="text" name="estGraphic" class="calcField hours" value="' . $estGraphic . '" style="width: 125px" /> hours<br>
					<textarea name="estGraphicDesc" style="width: 300px; height: 50px; margin-top: 5px">'. $estGraphicDesc .'</textarea>
				</td>
			</tr>';
$modalContent .= '<tr>
				<td>
					<strong>Misc 1 Estimate:</strong>
					<input type="text" name="estMisc1" class="calcField hours" value="' . $estMisc1 . '" style="width: 125px" /> hours<br>
					<textarea name="estMisc1Desc" style="width: 300px; height: 50px; margin-top: 5px">'. $estMisc1Desc .'</textarea>
				</td>
				<td>
					<strong>Misc 2 Estimate:</strong>
					<input type="text" name="estMisc2" class="calcField hours" value="' . $estMisc2 . '" style="width: 125px" /> hours<br>
					<textarea name="estMisc2Desc" style="width: 300px; height: 50px; margin-top: 5px">'. $estMisc2Desc .'</textarea>
				</td>
			</tr>';
$modalContent .= '<tr>
				<td colspan="2">
					<strong>Per-Page Estimates:</strong>
					<input type="number" step="any" id="estPagesAmt" class="calcField" name="estPagesAmt" value="' . $estPagesAmt . '" style="width: 50px" /> pages x <input type="number" step="any" id="estPagesTime" class="calcField" name="estPagesTime" value="' . $estPagesTime . '" style="width: 60px" /> hours per page = <input name="estPagesTotal" id="estPagesTotal" value="'. $estPagesTotal .'"  style="width: 50px" readonly> hours <input type="button" id="calculate" value="Calculate" style="width: 75px" /><br>
					<textarea name="estPagesDesc" style="width: 630px; height: 50px; margin-top: 5px">'. $estPagesDesc .'</textarea>
				</td>
			</tr>';

$modalContent .= '<tr>
				<td colspan="2">
					<strong>Misc Costs (software, templates, etc.):</strong>
					$ <input type="text" name="estCosts" id="estCosts" class="calcField" value="' . $estCosts . '" style="width: 100px" /> (total amount - please describe below)<br>
					<textarea name="estCostsDesc" style="width: 630px; height: 50px; margin-top: 5px">'. $estCostsDesc .'</textarea>
				</td>
			</tr>';

$modalContent .= '<tr>
				<td colspan="2" style="text-align: center">
					<strong>Estimate Total: </strong><span id="totalHours">' . $estTotalHours . '</span> hours &nbsp;&nbsp;<strong>|</strong>&nbsp;&nbsp; $<span id="totalCost">' . $estTotalCost . '</span>
				</td>
			</tr>';
$modalContent .= '</table>';
$modalContent .= '</div><!-- /table-responsive -->';

$modalContent .= '<h3>Estimate Dates:</h3>';	
$modalContent .= '<div class="table-responsive">';
$modalContent .= '<table class="adminForm table table-condensed">';
$modalContent .= '<tr>
				<th>Started:</th>
				<td>
					<input class="datepicker dateField" type="text" name="estDate" id="estDate" readonly="readonly" value="' . $estDate . '" />
				</td>
				<th>Submitted:</th>
				<td>
					<input class="datepicker dateField" type="text" name="estSubmitDate" id="estSubmitDate" readonly="readonly" value="' . $estSubmitDate . '" />
				</td>
			</tr>';
$modalContent .= '<tr>
				<th>Accepted:</th>
				<td>
					<input class="datepicker dateField" type="text" name="estAcceptDate" id="estAcceptDate" readonly="readonly" value="' . $estAcceptDate . '" />
				</td>
				<th>Declined:</th>
				<td>
					<input class="datepicker dateField" type="text" name="estDeclineDate" id="estDeclineDate" readonly="readonly" value="' . $estDeclineDate . '" />
				</td>
			</tr>';
$modalContent .= '</table>';
$modalContent .= '</div><!-- /table-responsive -->';
	
$modalContent .= '<p style="text-align: center"><input type="submit" name="submit" value="'. $subBtn .'" /></p>';
$modalContent .= '</div></div><!-- /.row -->';

$modalContent .= "<script>
	$('.calcField').keyup(function() {
		calcTotals();
	});
	
	$('#calculate').click(function() {
		var prod = $('#estPagesAmt').val() * $('#estPagesTime').val();
		$('#estPagesTotal').val(prod);
		calcTotals();
	});
	
	function calcTotals() {
		var hoursTotal = 0; 
		var rate = $('#estRate').val();
		var pageHours = $('#estPagesTotal').val();
		var miscCosts = $('#estCosts').val();
		
		$('.calcField.hours').each(function() {
			hoursTotal += Number($(this).val());
		});
		hoursTotal += Number(pageHours);
		$('#totalHours').html(hoursTotal);
		
		costTotal = hoursTotal * rate;
		costTotal += Number(miscCosts);
		$('#totalCost').html(costTotal);
	}
</script>"; 

?>