Files
WrenchBoardDocker/application/views/jobs/view_thisjob.php
T
2021-10-09 21:59:14 -04:00

415 lines
17 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="col-lg-12">
<div class="panel panel-flat">
<div class="panel-body" style=' background-color: #CEECF5;' >
<a href="<?php echo $redirect_to; ?>" class="label label-flat border-warning text-primary-600"> <i class="icon-arrow-left52 position-left"></i> Return to List </a> <?php echo $this_job; ?>
</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('<div class=\"text-left\"><div class=\"alert alert-info no-border\">Message was sent!</div></div>');
} else {
alert('<div class=\"text-left\"><div class=\"alert alert-danger no-border\">Failed to send message</div></div>');
}
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>
<!-- Basic modal -->
<div id="modal_theme_primary_fail" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h5 class="modal-title"><?php echo $contract_id; ?>- Delivery Detail</h5>
</div>
<div class="modal-body">
<p><?php echo $job_detail; ?>.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- /basic modal -->
<div class="row">
<div class="col-lg-6">
<div class="panel panel-flat">
<div class="panel-body">
<?= $message ?>
<div class="tabbable">
<ul class="nav nav-tabs bg-primary">
<li class="active"><a href="#basic-tab1" data-toggle="tab">Send Message</a></li>
<li><a href="#basic-tab2" data-toggle="tab">Add File(s)</a></li>
<li><a href="#basic-tab3" data-toggle="tab">Actions</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="basic-tab1">
<div id="sendmessagenote"></div>
<form name="message" id="message" action="/proj/thisjob" method='POST'>
<input type='hidden' name='ajax' value='1'>
<input type='hidden' name='jobID' value='<?php echo $jobID; ?>'>
<input type='hidden' name='contractId' value='<?php echo $contract_id; ?>'>
<div class="form-group">
<textarea cols="18" style="height:180px;" rows="3" id='jobmessage' name='jobmessage' class="textarea wysihtml5 wysihtml5-min form-control" placeholder="Enter message here ..."></textarea>
</div>
<div class="text-right">
<button id='btn_cancel' name='btn_cancel' type="submit" class="btn btn-danger btn-xs" onclick="document.message.ajax.value = '0';">Cancel</button>
<button id='btm_submit' name='btn_submit' type="submit" class="btn btn-primary btn-xs" onclick="SendMessage();return false;">Send Message</button>
</div>
</form>
</div>
<div class="tab-pane" id="basic-tab2">
<div class="form-group">
<form action="/proj/thisjob" method='POST' enctype="multipart/form-data">
<input type='hidden' name='uploadForm' value='1'>
<input type='hidden' name='jobID' value='<?php echo $jobID; ?>'>
<input type='hidden' name='contractId' value='<?php echo $contract_id; ?>'>
<input type="file" class="file-input" multiple="multiple" name="fileToUpload[]" id="fileToUpload[]">
<span class="help-block">There is a file size limit [<?php echo UPLOAD_FILE_SIZE; ?> MB]. Split large files into smaller size</span>
</form>
</div>
</div>
<div class="tab-pane" id="basic-tab3">
<h3>Use action to manage the status of the project</h3>
<div class="form-group">
<?php
if ($this_is_client == true) {
?>
<table class='table table-striped table-hover table-bordered table-condensed'>
<tr>
<td>
If you have completed this task and will like the owner to review the work for acceptance, click "Completed" button.
</td>
<td style="width:100px;">
<div id="req_completion"> <button type="submit" id="req_completion_submit" class="btn btn-primary btn-xs" onclick="return requestCompletion('<?php echo $job_contract; ?>');" <?php echo $disabled1; ?> >Completed</button></div>
</td>
</tr>
<tr>
<td>
If you are unable to complete and will like this project canceled, click "Cancel task" button.
</td>
<td style="width:100px;">
<div id="req_cancel"> <button type="submit" id="req_cancel_submit" onclick="return requestCancel('<?php echo $job_contract; ?>');" class="btn btn-danger btn-xs" <?php echo $disabled2; ?> >Request Cancel</button> </div>
</td>
</tr>
</table>
<div style="font-size: large; font-family: sans-serif">
<p style="color: #ff0000; background-color: #ffffff">Note: Buttons may be disabled for some days at the start of the task</p>
</div>
<?php
}
?>
<?php
if ($this_is_project_owner == true) {
?>
<table class='table table-striped table-hover table-bordered table-condensed'>
<tr>
<td>
Accept or reject the completion of the task below. We will notify the other partner and finalize payment for the task.
</td>
<td style="width:100px;">
<div id="accept_completion"> <button type="submit" id="accept_completion_submit" class="btn btn-primary btn-xs" onclick="return acceptCompletion('<?php echo $job_contract; ?>');" <?php echo $disabled11; ?> >Accept Completion</button></div>
</td>
</tr>
<tr>
<td>
If you reject the work done or want more review before accepting, click "Reject Completion."
</td>
<td style="width:100px;">
<div id="reject_completion"> <button type="submit" id="reject_completion_submit" class="btn btn-danger btn-xs" <?php echo $disabled22; ?> onclick="return rejectCompletion('<?php echo $job_contract; ?>');" >Reject Completion</button></div>
</td>
</tr>
</table>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="panel panel-flat">
<div id="message_table">
<?=$message_result_show?>
</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 requestCompletion(job_contract) {
if (confirm("Are you sure you want send completion messgae for this job?")) {
// do something
} else {
return false;
}
$('#req_completion').html('Processing...');
$('#req_completion_submit').prop('disabled', true);
$('#req_cancel_submit').prop('disabled', true);
$.ajax({
url: "/proj/processjob_status?proc=NCOMPLETE&jobID=<?php echo $jobID; ?>&job_contract=" + job_contract
}).done(function (data) {
$('#req_completion').html(data);
document.offer_individual.rec_email.value = '';
$('#req_completion_submit').prop('disabled', false);
});
return false;
}
function requestCancel(job_contract) {
if (confirm("Are you sure you want to request the cancellation of this job?")) {
// do something
} else {
return false;
}
$('#req_cancel').html('Processing...');
$('#req_cancel_submit').prop('disabled', true);
$('#req_completion_submit').prop('disabled', true);
$.ajax({
url: "/proj/processjob_status?proc=REQCANCEL&jobID=<?php echo $jobID; ?>&job_contract=" + job_contract
}).done(function (data) {
$('#req_cancel').html(data);
document.offer_individual.rec_email.value = '';
$('#req_cancel_submit').prop('disabled', false);
});
return false;
}
function acceptCompletion(job_contract) {
if (confirm("Are you sure you want to accept the completion of this job?")) {
// do something
} else {
return false;
}
$('#accept_completion').html('Processing...');
$('#accept_completion_submit').prop('disabled', true);
$('#reject_completion_submit').prop('disabled', true);
$.ajax({
url: "/proj/processjob_status?proc=ACCEPTCMP&jobID=<?php echo $jobID; ?>&job_contract=" + job_contract
}).done(function (data) {
$('#accept_completion').html(data);
document.offer_individual.rec_email.value = '';
$('#accept_completion_submit').prop('disabled', false);
});
return false;
}
function rejectCompletion(job_contract) {
if (confirm("Are you sure you want to reject the completion of this job?")) {
// do something
} else {
return false;
}
$('#reject_completion').html('Processing...');
$('#reject_completion_submit').prop('disabled', true);
$('#accept_completion_submit').prop('disabled', true);
$.ajax({
url: "/proj/processjob_status?proc=REJECTCMP&jobID=<?php echo $jobID; ?>&job_contract=" + job_contract
}).done(function (data) {
$('#reject_completion').html(data);
document.offer_individual.rec_email.value = '';
$('#reject_completion_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" id="modal-content">
</div>
</div>
</div>
<!-- /basic modal -->