You are on page 1of 15

@using System.Data.

Entity;
@model IEnumerable<RealForum.Models.POSTLISTING>
@{
ApplicationDbContext db = new ApplicationDbContext();

var responces = db.Response_Offers.Where(a => a.p_cat_name == "10001" &&


a.Response_Type == "Seller" && a.Respons_Offer_status == "Active").ToList();
}

<style>
.drop-down {
position: relative;
}

.selected {
width: 100px;
border: 1px solid #eee;
padding: 2px 5px;
cursor: pointer;
}

.options {
position: absolute;
width: 100px;
bottom: -50px;
left: 0;
display: none;
border: 1px solid #eee;
border-top: none;
list-style: none;
margin: 0;
padding: 0;
bottom: -250px;
padding-left: 10px;
}

.options.show {
display: block;
}

.options li {
background: white;
cursor: pointer;
padding: 3px;
}

.options li:hover {
background: #FFEA32;
}

.dropdown-menu .dropdown-item {
white-space: normal;
}

table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
}

body {
font-family: "Open Sans", sans-serif;
line-height: 1.25;
}

table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
table-layout: fixed;
}

table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}

table tr {
background-color: #f8f8f8;
border: 1px solid #ddd;
padding: .35em;
border-color: black;
}

table th,
table td {
padding: .625em;
text-align: center;
}

table th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
}

.dropbtn {
background-color: white;
color: black;
padding: 0px;
font-size: 16px;
cursor: pointer;
}

.dropbtn:hover, .dropbtn:focus {
background-color: wheat;
}

.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}

.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

.dropdown a:hover {
background-color: #ddd;
}

.show {
display: block;
}

.historybtn {
background: black;
color: white;
width: 74%;
cursor: pointer;
font-family: montserrat;
font-weight: 600;
}

.for-sale {
font-family: montserrat;
}

.detailinfo {
font-size: small;
line-height: 18px;
margin-bottom: 0%;
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-family: montserrat;
}

.maindiv {
padding: 0px;
margin-bottom: 0px;
height: auto;
}

.titlediv {
margin-bottom: 0px;
margin-top: -1.5%;
font-family: montserrat;
}

.precinctimage {
max-width: 100%;
height: 210px;
}

.constructionstatus {
background: black;
color: gold;
padding: 10px;
text-align: center;
}

.NewOffer {
font-size: small;
line-height: 18px;
margin-bottom: 0%;
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-family: montserrat;
}

.row {
margin-bottom: 2px;
}
</style>

@*@Html.Partial("MP_PartialModalView")*@

@foreach (var item in Model)


{
var offerdata = db.Offers.Where(a => a.POSTLIST_id ==
item.POSTLIST_id).ToList();
if (offerdata.Count > 0)
{
<div class="col-md-12 col-sm-12 col-xs-12 maindiv" style="background-
color:lightgray; margin-bottom:50px;">
<div class="row">

<div class="col-md-4 col-xs-12" style="padding-left:0px; padding-


right:0px; text-align:center; border:1px solid;">
<span class="for-sale" style="background:black;">@item.RentSale
/ @item.ResidentialCommercial</span>
@*<span class="for-sale pull-right"
style="background:black;">@item.RentSale</span>*@
<a href="/PostListing/Details/@item.POSTLIST_id">
@if (File.Exists(Server.MapPath("/EditPricinct/Photo-" +
item.POSTLIST_id + ".jpg")))
{
var img = "Photo-" + item.POSTLIST_id + ".jpg";
<img class="precinctimage" src="~/EditPricinct/@img" />
}
else
{
<img class="precinctimage"
src="~/PrecinctThumbnail/@item.precent_name.image1" />
}
</a>
</div>

<div class="col-md-4 col-xs-12" style="padding-right:0px;">


<div class="" style="margin-bottom:8%;">
<p class="detailinfo"> <b>-</b>
@item.property_type.property_type</p>
<p class="detailinfo"> <b>-</b>
@item.pproj_Name.pproj_Name</p>
<p class="detailinfo"> <b>-</b>
@(item.precent_name.precent_name != null ? item.precent_name.precent_name :
"Precinct : NaN" ) </p>
<p class="detailinfo"> <b>-</b>
@(item.plot_size.plot_size != null ? item.plot_size.plot_size : "Plot Size: NaN" )
</p>
<p class="detailinfo"> <b>-</b> Plot no#
@item.Property_Number</p>
@if (item.Features != null)
{
string[] feature = item.Features.Split(new string[]
{ "*" }, StringSplitOptions.RemoveEmptyEntries);
string updatefeature = String.Join(", ", feature);

<p class="detailinfo" style="font-weight:600;"><b>-</b>


@updatefeature </p>
}
else
{
<p class="detailinfo" style="font-weight:600;"><b>-</b>
Features: NaN </p>
}
@*<p class="detailinfo"> <b>-</b> Downpayment <b>
@item.DownPaymentPercent.0%</b> of Assessed cost of land</p>*@
<p class="detailinfo"> <b>- Demand <br /> &nbsp; Rs.
@string.Format("{0:#,0}", item.TotalPaybleToSeller) </b></p>
</div>
</div>

<div class="col-md-4 col-xs-12" style="padding:0px; border-left:2px


solid black;">
@if (item.MarketPrice == 0)
{
<p class="rightcol" style="padding-top: 5px; font-weight:
bolder; font-size: smaller;">You Have a New Offers</p>
<div class="col-md-12 col-xs-12" style="margin: 0px;
padding: 0px; padding-left:10px; padding-right:5px;">
<div style="background-color:black;color:white;
font-weight: bolder; font-size: inherit;">
<p class="rightcol">Your Demand</p>
</div>
<div class="mydiv" style="padding:0px; background-
color:white; margin-top:-10px; height:150px; padding-top:50px; margin-
bottom:10px;">
<p class="" style="font-size:12px; font-
family:sans-serif; font-weight:700;text-align:center">Rs. @string.Format("{0:#,0}",
item.TotalPaybleToSeller)</p>
<p class="classdemandedprice" style="font-
size:12px; font-family:sans-serif; font-weight:700;text-
align:center">Rs.@string.Format("{0:#}", item.TotalPaybleToSeller) </p>
@*<p class="" style="font-size:10px; font-
family:sans-serif; font-weight:700;text-align:center">Payment Time : 20 Days</p>*@
</div>
</div>

@*<div class="col-md-6 col-xs-12" style="margin: 0px;


padding: 0px; padding-left:5px; padding-right:10px;">
<div style="background-color:black;color:white;
font-weight: bolder; font-size: inherit;">
<p class="rightcol">Buyer Offer</p>
</div>
<div class="mydiv" style="padding:0px;
background-color:white; margin-top:-10px;">
<p class="" style="font-size:12px; font-
family:sans-serif; font-weight:700;text-align:center">Rs .
@item.TotalPaybleToSeller</p>
<p class="classofferprice" style="font-
size:12px; font-family:sans-serif; font-weight:700;text-
align:center">Rs.@string.Format("{0:#}", item.TotalPaybleToSeller)</p>
<p class="" style="font-size:10px; font-
family:sans-serif; font-weight:700;text-align:center">Payment Time : 20 Days</p>
</div>
</div>*@

@*<div class="col-md-6 col-xs-12" style="margin: 0px;


padding: 0px; padding-left:10px; padding-right:5px;">
<button class="w3-btn w3-black"
id="@item.POSTLIST_id" onclick="" style="background-color:green; color: white;
font-size:12px; font-weight: bolder; width:100%; height:25px;">Send My
Response</button>
</div>
<div class="col-md-6 col-xs-12" style="margin: 0px;
padding: 0px; padding-left:5px; padding-right:10px;">
<button id="mymodel1" onclick="showmodel()"
class="w3-btn w3-teal" style="background-color: black; color: yellow; font-
size:smaller; font-weight: 600; width:100%; height:25px;">Show Negotiation
History</button>
</div>

<div class="col-md-12 col-xs-12" style="margin:


0px; padding-top: 10px; padding-left:10px; padding-right:10px;">
<button id="myBtnn" onclick="showmodal()"
class="w3-btn w3-black" style="font-size:12px; font-weight: bolder; width:100%;
color:red;">Reply Via Moderated Custom Message</button>
</div>*@
}
</div>
}
<div class="modal fade" id="myBtn" tabindex="-1" role="dialog"
aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<centre> <p id="myBtn"> Warning</p></centre>
<button type="button" class="close" data-
dismiss="modal" aria-label="Close" style="margin-top:-30px;">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">

<p id="myBtn">Moderate Custom messages,are read and


approved by the site Admins before being sent to the party</p><br />
<p id="myBtn">It may take upto 24 hours for your
messages to get approved by the Fortune.pk Admin</p><br />
<p id="myBtn">You must not share Any contact
details in this message or your message will not be Approved</p><br />
<p id="myBtn">Please try to Use , the predefined
set of messages to communicate and use this features when really Needed.</p><br />
<p id="myBtn">Maximum 3 messages per day
Allowed</p><br />

</div>
<div class="modal-footer ">
<a data-toggle="modal" href="#myBtnn2" class="btn
btn-success"><span class="glyphicon glyphicon-ok-sign"></span> Ok, Continue</a>

</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>

<div class="modal fade" id="myBtnn2" tabindex="-1" role="dialog"


aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<centre> <p id="myBtn"> Please Type your message
here</p></centre>
<button type="button" class="close" data-
dismiss="modal" aria-label="Close" style="margin-top:-30px;">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">

<p id="myBtn">Do not share any contact details , or


your message will be disapproved Ns will not be delivered to other Party </p><br
/><br /><br />
<label for="story">Tell us :</label>

<textarea id="story" name="story"


rows="5" cols="33"></textarea>

</div>
<div class="modal-footer ">
<button type="button" class="btn btn-success"><span
class="glyphicon glyphicon-ok-sign"></span> Send Message</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
@*for negotiation history*@

</div>
@for (int i = 0; i < offerdata.Count; i++)
{
<div class="row" style="background-color:black; color:white;
margin-bottom:1px; margin-top:-4px">
@{
int num = i + 1;
long offerid = offerdata[i].Offer_Id;
var responcedata = db.Offers_Response_Details.Include(a =>
a.Responses_Offers).Where(a => a.Offer_id == offerid).OrderByDescending(a =>
a.ORD_id).FirstOrDefault();

string responcestring =
responcedata.Responses_Offers.ResponseSelect_BuyerSellerSide;

string modalid = offerid + "modal";


}
<div class="col-md-1"> Offer @num</div>
<div class="col-md-2"> Rs . @string.Format("{0:#,0}",
offerdata[i].OfferAmount)</div>
<div class="col-md-2 @offerdata[i].Offer_Id">
Rs.@string.Format("{0:#}", offerdata[i].OfferAmount)</div>
<div class="col-md-1"> @offerdata[i].PaymentTransfer_Time
Days</div>
<div class="col-md-3">
@if (item.UserId == responcedata.UserId)
{

}
else
{
<div class="drop-down" style="background-color:
white;margin-bottom: 5px;">

<div class="selected" style="width: 250px;


color:black"> Please Select a Responce</div>
<input class="selected-inp" type="hidden"
name="responces" id="5">

<ul class="options" style="width:400px; margin-


left: -111px;margin-bottom: -15px; color:black;">

<li data-value="1">I accept this offer , Please


deposit 10% token amount to Fortune.pk . Where as I shall be bound to sign sale
agreement on a stamp paper , for you to collect.<br /></li>

<li data-value="2">We are close , negotiation


is possible . Let sit and talk with token amount if you are available in
Karachi.<br /></li>
<li data-value="3">I already have a better
offer , try increasing your offer.<br /></li>

<li data-value="4">This is a warning , Please


do not make non serious offer or you shall be blocked from making future offers to
me.<br /></li>
<li data-value="5">I might accept if you offer
a better Payment/transfer time.<br /></li>
<li data-value="6">I cannot accept this offer !
too low !<br /></li>
<li data-value="7">Reply Via Moderated Custom
Message.<br /></li>
</ul>
</div>
}
</div>

<div class="col-md-1" style="padding:0px;">


@if (item.UserId == responcedata.UserId)
{

}
else
{
<button class="w3-btn w3-black" id="5"
onclick="submitresponce(this.id)" style="background-color:green; color: white;
font-size:12px; font-weight: bolder; width:100px; height:38px;">Send My
Response</button>
}
</div>
<div class="col-md-2">
<button id="@offerid" onclick="showmodel(this.id)"
class="w3-btn w3-teal" style="background-color: black; color: yellow; font-
size:smaller; font-weight: 600; width:100%; height:38px;">Show Negotiation
History</button>
</div>
</div>

<div class="row" style="background-color:black; color:white;


margin-bottom:5px;">
<div class="col-md-12">
Responce:&nbsp;&nbsp;&nbsp;&nbsp; @responcestring
</div>
</div>

<div class="modal fade" id="@modalid" tabindex="-1" role="dialog"


aria-labelledby="edit" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="width:800px;">
<div class="modal-header">
<centre> <p id="mymodel">Your Negotiation History
is</p></centre>
<button type="button" class="close" data-
dismiss="modal" aria-label="Close" style="margin-top:-30px;">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">

@{
var responcesHistory =
db.Offers_Response_Details.Include(a => a.Responses_Offers).Where(a => a.Offer_id
== offerid).ToList();

}
<table>
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Time</th>
<th scope="col">Update From</th>
<th scope="col">Additional Remarks</th>
</tr>
</thead>
@for (int j = 0; j < responcesHistory.Count; j+
+)
{
<tr>
<td data-
label="Account">@responcesHistory[j].ORD_ED.Date.ToString("dd/MM/yyyy")</td>
<td data-label="Due
Date">@responcesHistory[j].ORD_ED.ToString("hh:mm tt")</td>
<td data-
label="Amount">@responcesHistory[j].Sender</td>
<td data-
label="Period">@responcesHistory[j].Responses_Offers.ResponseSelect_BuyerSellerSide
</td>
</tr>
}

</table>
@*<p id="myBtn"> </p><br /><br /><br />
<p id="myBtn"></p><br />*@

</div>

</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>

<script>
function inWords(num) {
if ((num = num.toString()).length > 9) return 'overflow';
n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})
(\d{2})(\d{1})(\d{2})$/);
if (!n) return; var str = '';
str += (n[1] != 0) ? (a[Number(n[1])] || b[n[1][0]] + ' ' +
a[n[1][1]]) + 'crore ' : '';
str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + ' ' +
a[n[2][1]]) + 'lac ' : '';
str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + ' ' +
a[n[3][1]]) + 'thousand ' : '';
str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + ' ' +
a[n[4][1]]) + 'hundred ' : '';
str += (n[5] != 0) ? ((str != '') ? 'and ' : '') +
(a[Number(n[5])] || b[n[5][0]] + ' ' + a[n[5][1]]) + 'only ' : '';
return str;
}

$
("."+@offerdata[i].Offer_Id).html(inWords("@offerdata[i].OfferAmount)"));
</script>
}
</div>

<script>

var addid = 1;
var status = "Actice"

$(".table-link").click(function () {
addid = $(this).attr('data-id');
status = $(this).attr('data-status');
var rowid = "#" + addid;
var row = $(this).closest(rowid);
var msg = "";
if (status == "Approved") {
msg = "Do you really want to Approve $ Accept this
offer?";
}
else {
msg = "Do you really want to " + status + " this
offer?"
}

var result = confirm(msg);


if (result) {
$.ajax({
url: '/Dashboard/UpdateAddStatus',
type: 'post',
data: { id: $(this).attr('data-id'), status: $
(this).attr('data-status') },
}).done(function (response) {
if (response == "Success") {
if (status == "Negotiate") {
alert("Your request to negotiate has
been sent to Fortune.pk Admins, please expect a call, within 48 hours.")
}
else if (status == "Approved") {
alert("Your request to approve has been
sent to Fortune.pk Admins, please allow 48 hours to activate your plot.")
}
else {
alert("Offer " + status + "
Successfully!");
}
location.reload();
}
else {
alert("Not updated at this time please try
later!");
}
});
}
});

$(".negotiatehistory").click(function () {
//Modal Function in PartialModalView File
addid = $(this).attr('data-id');
ShowShareModal(addid);
});

$(".investhistory").click(function () {
//Modal Function in PartialModalView File
addid = $(this).attr('data-id');
ShowInvestModal(addid);
});

$(".constructionstatus").click(function () {
//Modal Function in PartialModalView File
addid = $(this).attr('data-id');
ShowGallery(addid);
});

/* When the user clicks on the button,


toggle between hiding and showing the dropdown content */
function myFunction() {

document.getElementById("myDropdown").classList.toggle("show");
}

// Close the dropdown if the user clicks outside of it


window.onclick = function (event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns =
document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
//function showmodal() {
// $('#myBtn').modal('show')
// //alert("Warning")
//}
function showmodel(id) {
var newid='#'+id+'modal';
//alert(newid);
$(newid).modal('show')
//alert("Warning")
}

var a = ['', 'one ', 'two ', 'three ', 'four ', 'five ',
'six ', 'seven ', 'eight ', 'nine ', 'ten ', 'eleven ', 'twelve ', 'thirteen ',
'fourteen ', 'fifteen ', 'sixteen ', 'seventeen ', 'eighteen ', 'nineteen '];
var b = ['', '', 'twenty', 'thirty', 'forty', 'fifty',
'sixty', 'seventy', 'eighty', 'ninety'];

function inWords(num) {
if ((num = num.toString()).length > 9) return
'overflow';
n = ('000000000' + num).substr(-9).match(/^(\d{2})
(\d{2})(\d{2})(\d{1})(\d{2})$/);
if (!n) return; var str = '';
str += (n[1] != 0) ? (a[Number(n[1])] || b[n[1][0]] + '
' + a[n[1][1]]) + 'crore ' : '';
str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + '
' + a[n[2][1]]) + 'lac ' : '';
str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + '
' + a[n[3][1]]) + 'thousand ' : '';
str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + '
' + a[n[4][1]]) + 'hundred ' : '';
str += (n[5] != 0) ? ((str != '') ? 'and ' : '') +
(a[Number(n[5])] || b[n[5][0]] + ' ' + a[n[5][1]]) + 'only ' : '';
return str;
}

$
(".classdemandedprice").html(inWords("@item.TotalPaybleToSeller"));
$
(".classofferprice").html(inWords("@offerdata[0].OfferAmount)"));

//// This is for Number Formatter /////


$("input[data-type='currency']").on({
keyup: function () {
formatCurrency($(this));
},
//blur: function () {
// alert("bblur")
// formatCurrency($(this), "blur");
//}
});

function formatNumber(n) {
// format number 1000000 to 1,234,567
return n.replace(/\D/g, "").replace(/\B(?=(\d{3})+
(?!\d))/g, ",")
}

function formatCurrency(input, blur) {


// appends $ to value, validates decimal side
// and puts cursor back in right position.
// get input value
var input_val = input.val();

// don't validate empty input


if (input_val === "") { return; }

// original length
var original_len = input_val.length;

// initial caret position


var caret_pos = input.prop("selectionStart");

// check for decimal


if (input_val.indexOf(".") >= 0) {

// get position of first decimal


// this prevents multiple decimals from
// being entered
var decimal_pos = input_val.indexOf(".");

// split number by decimal point


var left_side = input_val.substring(0,
decimal_pos);
var right_side = input_val.substring(decimal_pos);

// add commas to left side of number


left_side = formatNumber(left_side);

// validate right side


right_side = formatNumber(right_side);

// On blur make sure 2 numbers after decimal


if (blur === "blur") {
right_side += "00";
}

// Limit decimal to only 2 digits


right_side = right_side.substring(0, 2);

// join number by .
input_val = left_side + "." + right_side;

} else {
// no decimal entered
// add commas to number
// remove all non-digits
input_val = formatNumber(input_val);
input_val = input_val;

// final formatting
if (blur === "blur") {
input_val += ".00";
}
}

// send updated string to input


input.val(input_val);
// put caret back in the right position
var updated_len = input_val.length;
caret_pos = updated_len - original_len + caret_pos;
input[0].setSelectionRange(caret_pos, caret_pos);
}

function submitresponce(id){
//alert(id);
var responceid = document.getElementById(id).value;
var responcetext =
document.getElementById(id).innerHTML;
//alert(responceid);
if(responceid=="29" || responceid=="30")
{
$('#myBtn').modal('show');
}
else
{
$.ajax({
url: '/API/OffersAPI/SubmitResponce?
offerid='+id+'&responceid='+responceid,
data: { offerid: id, responceid: responceid},
type: 'post'
}).done(function (response) {
//alert(response);
if (response == "Success") {
alert('Responce Sent Succesfully!')
//window.location.reload();
}
else {

alert('Fail to sent Responce!')


}
});
}
}
$('.options li').on('click', function () {
$('.selected').html($(this).text());
$('.selected-inp').val($
(this).data('value')).trigger('change');
$('.options').removeClass('show');
});

$('.selected').on('click', function () {
$('.options').toggleClass('show');
});
</script>

}
}

You might also like