<!-- Modal -->
<div id="modal1" class="center-modal modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<style media="screen">
/* these changes need to be propagated into the site.css */
.close {
top: 0;
right: 0;
color: #a41822;
position: absolute;
font-size: 61px;
height: 58px;
line-height: 0;
}
.close:hover,
.close:focus {
color: #a41822;
text-decoration: none;
cursor: pointer;
-webkit-text-stroke: 1px #a41822;
outline: unset;
}
@media only screen and (max-width: 700px){
.modal{
padding: unset;
}
.modal-content {
width: 100%;
height:auto;
}
.close{
color: #a41822;
position: absolute;
font-size: 61px;
top: -37px;
right: 5px;
line-height: unset;
}
}
</style>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<center>
<a href="/rcs-club-sign-up"><img src="https://www.rooferscoffeeshop.com/uploads/media/2019/04/rcs-r-club.png" style="width:450px; align: center;" loading='lazy'></a>
Join R-Club to save up to 50% on your classified ads!
</center>
</div>
</div>
</div>
</div>
{# TODO: test this #}
{#
{% if purchaseItem is not empty %}
{% set temp = purchaseItem.getContent() %}
<div class="alert alert-info clearfix">
<div class="float-right">
<button
type="submit"
name="action"
value="discard"
class="btn btn-link p-0"
><i class="fa fa-close"></i> Discard</button> or
<button
type="submit"
class="btn btn-link p-0"
name="action"
value="add_to_cart"
><i class="fa fa-shopping-cart"></i> Save and create new</button>
</div>
<i class="fa fa-info"></i>
You are currently editing
{% if temp is not empty %}
your listing: <strong>{{ temp.getTitle() }}</strong>
{% else %}
a previous listing.
{% endif %}
</div>
{% endif %}
#}
{#
<button
type="submit"
class="btn btn-secondary float-right"
>Continue to Create Your AD <i class="fa fa-angle-double-right"></i></button>
<h4>Choose a Package</h4>
<p><strong>Purchase Packages:</strong></p>
{% for p in products %}
<div>
<label class="btn-block m-0">
<table class="table m-0">
<tr>
<td style="width: 1px;">
<input
type="radio"
name="product[product_id]"
value="{{ p.getId() }}"
{% if product is not empty %}
{{ (product.getId() == p.getId()) ? 'checked' : '' }}
{% endif %}
required
/>
</td>
<td>
{{ p.getTitle() }}<br />
<strong>{{ p.getFullPrice() }}</strong>
{{ p.getDescription() }}
</td>
</tr>
</table>
</label>
</div>
{% endfor %}
<hr />
<p><strong>SW — Region 1 Southwest Edition, includes:</strong><br />
Southern California, Southern Nevada, Arizona, Texas, New Mexico, Oklahoma and Hawaii.
</p>
<p><strong>NW — Region 2 Northwest Edition, includes:</strong><br />
Wyoming, Montana, Idaho, Oregon, Washington, Alaska, Northern California, Northern Nevada, Utah and Colorado
</p>
<p><strong>SE — Region 3 SouthEast Edition, includes:</strong><br />
North Carolina, Tennessee, Florida, Georgia, South Carolina, Alabama, Mississippi, Louisiana and Arkansas
</p>
<p><strong>MW — Region 4 Midwest Edition includes:</strong><br />
Minnesota, Iowa, Illinois, Wisconsin, Michigan, Indiana, Nebraska, South Dakota, North Dakota, Ohio, Kentucky, Kansas and Missouri.
</p>
<p><strong>NE — Region 5 Northeast includes:</strong><br />
Pennsylvania, Delaware, Virginia, West Virginia, Maryland, Washington D.C., Connecticut, New Hampshire, New York, Maine, Massachussetts, Vermont, New Jersey, Rhode Island.
</p>
#}
{% if not app.user or (not app.user.isMember() and not app.user.isAdmin()) %}
<button id="not-member" type="button" class="button" style="display: none;" data-toggle="modal" data-target="#modal1">View</button>
<script>
setTimeout(function() { document.getElementById("not-member").click(); }, 3000);
</script>
{% endif %}
<style>
.classified-options {
border: 1px solid #ccc;
border-radius: 6px;
padding:20px;
}
.classified-options h3 {
color: #A6252A;
}
.btn-classified {
color: black;
border: 1px solid #ccc;
border-radius: 6px;
width: 100%;
}
.cbtn-wrapper {
padding: 5px;
}
.btn-check {
position: absolute;
clip: rect(0,0,0,0);
pointer-events: none;
}
.btn-check:checked ~ .btn-classified {
color: #fff;
background-color: #A6252A;
}
.top-highlight {
position: absolute;
font-size: 12px;
top: -14px;
background-color: #A6252A;
color: white;
width: 96%;
border-top-right-radius: 6px;
border-top-left-radius: 6px;
padding-left: 70px;
text-transform: uppercase;
border: 1px solid #ccc;
}
</style>
{# TODO: pull these from database #}
{% set durations = [
{'id': 1, 'text': '30 Days'},
{'id': 2, 'text': '60 Days'},
{'id': 3, 'text': '90 Days'}
] %}
{% set graphics = [
{'id': 4, 'text': 'Image'},
{'id': 5, 'text': 'Video'},
{'id': 22, 'text': 'Featured'}
] %}
{% set sites = [
{'id': 20, 'text': 'RoofersCoffeeShop'},
{'id': 21, 'text': 'MetalCoffeeShop'},
{'id': 23, 'text': 'CoatingsCoffeeShop'}
] %}
{% set regions = [
{'id': 6, 'text': 'All Regions'},
{'id': 7, 'text': 'Northeast'},
{'id': 8, 'text': 'Southeast'},
{'id': 9, 'text': 'Midwest'},
{'id': 10, 'text': 'Northwest'},
{'id': 11, 'text': 'Southwest'},
{'id': 12, 'text': 'Canada: Alberta'},
{'id': 13, 'text': 'Canada: British Columbia'},
{'id': 14, 'text': 'Canada: Manitoba'},
{'id': 15, 'text': 'Canada: Newfoundland'},
{'id': 16, 'text': 'Canada: Ontario'},
{'id': 17, 'text': 'Canada: Prince Edward Island, Nova Scotia, New Brunswick'},
{'id': 18, 'text': 'Canada: Quebec'},
{'id': 19, 'text': 'Canada: Saskatchewan'}
] %}
<form id="classified-form">
<div class="classified-options">
<div class="row">
<div class="col-lg-6">
<h3>Duration</h3>
<div class="row">
{% for duration in durations %}
<div class="col-6 cbtn-wrapper">
<input type="radio" class="btn-check" name="duration" autocomplete="off" value="{{duration.id}}" required>
{% if duration.text == '60 Days' %}
<label class="top-highlight">Most Popular</label>
{% endif %}
<label class="btn btn-classified">{{duration.text}}</label>
</input>
</div>
{% endfor %}
</div>
</div>
<div class="col-lg-6">
<h3>Graphics</h3>
<div class="row">
{% for graphic in graphics %}
<div class="col-6 cbtn-wrapper">
<input type="radio" class="btn-check" name="graphic" autocomplete="off" value="{{graphic.id}}">
<label class="btn btn-classified">{{graphic.text}}
{% if graphic.text == "Featured" %}
<span class="rtooltip"> <i class="fa fa-question-circle"></i>
<div class="rtooltiptext" style="font-size:14px;">
Featured classified listings include a video or image, are posted on RoofersCoffeeShop's Twitter, and are highlighted at the top of our classifieds page.
<br><br>
Selecting this option will automatically select "All Regions" below.
<br>
</div>
</span>
{% endif %}
</label>
</input>
</div>
{% endfor %}
</div>
</div>
<div class="col-lg-12 mt-4">
<h3>Sites</h3>
<div id="sites-row" class="row">
{% for site in sites %}
<div class="col-lg-3 col-6 cbtn-wrapper">
<input type="checkbox" class="btn-check" name="sites[]" autocomplete="off" value="{{site.id}}" {#required#}>
<label class="btn btn-classified">{{site.text}}</label>
</input>
</div>
{% endfor %}
</div>
</div>
<div class="col-lg-12 mt-4">
<h3 style="margin-bottom:20px;">Region</h3>
<div id="regions-row" class="row">
{% for region in regions %}
{#<div class="col-3 cbtn-wrapper"><button class="btn btn-classified">{{region}}</button></div>#}
<div class="col-lg-3 col-6 cbtn-wrapper">
{% if region.text == 'All Regions' %}
<label class="top-highlight">Best Value</label>
{% endif %}
<input type="checkbox" class="btn-check" name="regions[]" autocomplete="off" value="{{region.id}}">
<label class="btn btn-classified" {% if region.text|length > 35 %} style="line-height:15px; padding:5px;" {% endif %}>{{region.text}}</label>
</input>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
<div style="padding-top:10px;" class="row">
<div class="col-3">
<h2 style="color:#A6252A;">PRICE: $<span id="total-classified-price">30</span></h2>
<input type="hidden" id="total-price-input" name="total-price-input" value="30"/>
</div>
<div class="col-9">
<button type="submit" class="btn btn-primary" style="color: #fff; background-color: #A6252A;border-radius:6px;">Continue to Create Your Ad</button>
</div>
</div>
</form>
<script>
(function($){
$(function(){
$(".btn-classified").click(function (e) {
var checkBox = $(this).parent().find(".btn-check");
var checkedVal = checkBox.prop("checked");
if(checkBox.parent().parent().attr('id') == "regions-row") {
var disabled = false;
$("input[name='graphic']").each(function (index, obj) {
if($(this).prop("checked") && $(this).val() == 22) {
disabled = true;
}
});
if(!disabled) {
checkBox.prop("checked", !checkBox.prop("checked"));
checkedVal = checkBox.prop("checked");
if(checkBox.val() == 6 && checkedVal) { // All Regions
$(this).parent().parent().find(".btn-check").prop("checked", false);
checkBox.prop("checked", checkedVal);
}
else if(checkedVal) {
$(this).parent().parent().find(":input[value=6]").prop("checked", false);
}
}
}
else {
checkBox.prop("checked", !checkBox.prop("checked"));
checkedVal = checkBox.prop("checked");
}
// If featured: force "All Regions" to be selected
if(checkBox.val() == 22 && checkedVal) { // Featured
$("#regions-row .btn-check").each(function (index, obj) {
$(this).prop("checked", $(this).val() == 6);
});
$(this).parent().parent().find(".btn-check").prop("checked", false);
checkBox.prop("checked", checkedVal);
}
var months = 1;
var totalPrice = 30;
$("input[name='duration']").each(function (index, obj) {
if($(this).prop("checked")) {
switch($(this).val()) {
case '2':
totalPrice += 30;
months = 2;
break;
case '3':
totalPrice += 60;
months = 3;
break;
}
}
});
var featured = false;
$("input[name='graphic']").each(function (index, obj) {
if($(this).prop("checked")) {
switch($(this).val()) {
case '4':
totalPrice += 25;
break;
case '5':
totalPrice += 75;
break;
case '22':
totalPrice = (months * 175); //Total price for featured is $175 per month (for one site)
featured = true;
break;
}
}
});
var firstRegion = true;
$("input[name='regions[]']").each(function (index, obj) {
if($(this).prop("checked")) {
if($(this).val() == 6) { // All Regions
if(!featured) { //All regions included with Featured
totalPrice += 50;
}
}
else if(firstRegion) {
firstRegion = false;
}
else {
totalPrice += 10;
}
}
});
var firstSite = true;
$("input[name='sites[]']").each(function (index, obj) {
if($(this).prop("checked")) {
if(firstSite) {
firstSite = false;
}
else {
totalPrice += 50;
}
}
});
$("#total-classified-price").text(totalPrice);
$("#total-price-input").val(totalPrice);
});
//$("#classified-form").submit(function(e) {
$("form").submit(function(e) { // TODO: Only specific form
if($("input[name='sites[]']:checked").length == 0) {
e.preventDefault();
alert("Please select at least one site to continue.");
}
else if($("input[name='regions[]']:checked").length == 0) {
e.preventDefault();
alert("Please select at least one region to continue.");
}
});
});
}(jQuery));
</script>