Files
WrenchBoradWeb/www/application/views/jobs/view_latejob.php
T
2019-05-31 11:26:35 -04:00

272 lines
9.2 KiB
PHP

<!-- Main content -->
<form method="post" name="post_nav_find" action="">
<input type="hidden" name="jobID" value="">
</form>
<script type="text/javascript">
<!--
function post_nav_find_action(what, value) {
// alert(what);
document.post_nav_find.action = what + '';
document.post_nav_find.jobID.value = value;
document.post_nav_find.submit();
return false;
}
// -->
</script>
<div class="content-wrapper">
<!-- Quick stats boxes -->
<?php include('common/jobstrip.php'); ?>
<!-- /quick stats boxes -->
<!-- WYSIHTML5 basic -->
<div class="row">
<div class="panel panel-flat">
<div class="panel-body" >
<p class="content-group" style=' background-color: rgba(51, 71, 90, 0.1);'>
<a href="<?php echo $redirect_to; ?>" class="btn btn-primary btn-xs" >Return to List </a>
</p>
<p class="content-group" style=' background-color: rgba(51, 71, 90, 0.1);'>
<?php echo $this_job; ?>
</p>
<div id="message_table">
<?php
echo $message_table;
?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
<!--
var timerId = setTimeout(function tick() {
$.ajax({
url: "/proj/thisjobfiles?jobID=<?php echo $jobID; ?>"
}).done(function (data) {
$('#message_table').html(data);
});
timerId = setTimeout(tick, 300000);
}, 300000); // 300000 ms is 300 seconds is 5 minutes
function pad(num, size) {
var s = num + "";
while (s.length < size)
s = "0" + s;
return s;
}
function SendMessage() {
document.message.btn_cancel.disabled = true;
document.message.btn_submit.disabled = true;
$.post("/proj/thisjob", $("#message").serialize(), function (data) {
if (data == '10') {
var d = new Date();
var d_str = d.getFullYear() + '-' + pad(d.getMonth(), 2) + '-' + pad(d.getDate(), 2) + ' ' + pad(d.getHours(), 2) + ':' + pad(d.getMinutes(), 2) + ':' + pad(d.getSeconds(), 2) + '.' + pad(d.getMilliseconds(), 3);
var res = '<tr><td><b>[<?= $_SESSION["firstname"] ?>]->' + d_str + '</b><br>' + document.message.jobmessage.value + '</td></tr>';
var tbody = $("#jobs_contract_message tbody");
if (tbody.children().length == 0) {
$('#jobs_contract_message').append(res);
} else {
$('#jobs_contract_message > tbody:last-child').append(res);
}
document.message.jobmessage.value = '';
$('#jobmessage').data("wysihtml5").editor.clear();
$('#sendmessagenote').html('Message was sent!');
} else {
alert('Failed to send message');
}
document.message.btn_cancel.disabled = false;
document.message.btn_submit.disabled = false;
});
}
$(document).ready(function () {
var length_limit = 500;
$('#jobmessage').data("wysihtml5").editor.observe("load", function () {
editor.composer.element.addEventListener("keyup", function () {
// enter your listener-triggered code or function call here
var content = $(this).html();
if (content.length > length_limit) {
alert(length_limit + " characters is the limit!");
$(this).html(content.substr(0, length_limit));
}
});
});
});
// -->
</script>
<div class="row">
<div class="panel panel-flat">
<div class="panel-body">
<div class="form-group">
<?= $message ?>
<?php
if ($this_is_project_owner == true) {
?>
<form name='action_form'>
<table class='table table-striped table-hover table-bordered table-condensed'>
<tr>
<td>
<select data-placeholder='Select your Extension' class='form-control select' name='extension' >
<option value='1' >Extend the deadline by one day + 1 day</option>
<option value='2'>Extend the deadline by two days + 2 days</option>
<option value='3' >Extend the deadline by three days + 3 days</option>
</select>
</td>
<td style="width:100px;">
<div id="extend_completion"> <button type="submit" id="extend_completion_submit" class="btn btn-primary btn-xs" onclick="return extendJob('<?php echo $job_contract; ?>');" <?php echo $disabled11; ?> >Extend Timeline </button></div>
</td>
</tr>
<tr>
<td>
This task is now late; you can cancel this job and get refunded now
</td>
<td style="width:100px;">
<div id="cancel_job"> <button type="submit" id="cancel_job_submit" class="btn btn-danger btn-xs" <?php echo $disabled22; ?> onclick="return requestLateCancel('<?php echo $job_contract; ?>');" >Cancel this Job</button></div>
</td>
</tr>
</table>
</form>
<?php
}
?>
</div>
</div>
</div>
</div>
<!-- /WYSIHTML5 basic -->
</div>
<!-- /main content -->
<script type="text/javascript">
<!--
function showModal(interest_id) {
if (typeof event !== 'undefined') {
event.preventDefault();
}
// alert(123);
// collect data - either from forms or from data variables
var id = $(this).data('id');
// load the modal content with a loader gif and message
$('#modal-content').html('Loading...');
// show modal window
$('#modal_theme_primary').modal('show');
// do the ajax bit
var post_data = {
'interest_id': id,
};
$.ajax({
url: "/jobs/loaduserSkills?interest_id=" + interest_id
}).done(function (data) {
//alert(data);
$('#modal-content').html(data);
});
}
function showJobModal(contact_id) {
if (typeof event !== 'undefined') {
event.preventDefault();
}
// collect data - either from forms or from data variables
var id = $(this).data('id');
// load the modal content with a loader gif and message
$('#modal-content').html('Loading...');
// show modal window
$('#modal_theme_primary').modal('show');
// do the ajax bit
var post_data = {
'interest_id': id,
};
$.ajax({
url: "/jobs/jobdetail_modal?contact_id="+contact_id
}).done(function (data) {
//alert(data);
$('#modal-content').html(data);
});
}
function extendJob(job_contract) {
var ext_time = document.action_form.extension.value;
if (confirm("Are you sure you want extend completion date for this job by " + ext_time + " day(s)?")) {
// do something
} else {
return false;
}
$('#extend_completion').html('Processing...');
$('#cancel_job_submit').prop('disabled', true);
$('#extend_completion_submit').prop('disabled', true);
$.ajax({
url: "/proj/processjob_status?proc=EXTENDLATE&jobID=<?php echo $jobID; ?>&job_contract=" + job_contract + "&extension=" + ext_time
}).done(function (data) {
$('#extend_completion').html(data);
document.offer_individual.rec_email.value = '';
// $('#req_completion_submit').prop('disabled', false);
});
return false;
}
function requestLateCancel(job_contract) {
if (confirm("Are you sure you want to request the cancellation of this late job?")) {
// do something
} else {
return false;
}
$('#cancel_job').html('Processing...');
$('#cancel_job_submit').prop('disabled', true);
$('#extend_completion').prop('disabled', true);
$.ajax({
url: "/proj/processjob_status?proc=REQCANCELLATE&jobID=<?php echo $jobID; ?>&job_contract=" + job_contract
}).done(function (data) {
$('#cancel_job').html(data);
//document.offer_individual.rec_email.value = '';
$('#cancel_job_submit').prop('disabled', false);
});
return false;
}
// -->
</script>
<!-- Basic modal -->
<div id="modal_theme_primary" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
<!-- /basic modal -->