Compare commits
2 Commits
0ade35717c
...
7914a73df0
| Author | SHA1 | Date | |
|---|---|---|---|
| 7914a73df0 | |||
| 382e4f7259 |
@@ -18,6 +18,8 @@ enum { PARTNER_STRIPE };
|
||||
#define OFFER_REJECT 333
|
||||
#define OFFER_CANCEL 222
|
||||
#define OFFER_EXPIRE 444
|
||||
#define OFFER_EXTEND 555
|
||||
|
||||
#define OFFER_SENDTOME 777
|
||||
|
||||
#define WEBSITE_LOGIN 1100
|
||||
|
||||
@@ -365,6 +365,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
REQ_STRING(in, "offer_code", 1, 15, "(.*)");
|
||||
|
||||
long rc = 0;
|
||||
CVars outx;
|
||||
// rc = 0 + load_db_record( out, "SELECT * FROM members_jobs_offer WHERE offer_code='%s' AND status = 1", in["offer_code"].c_str() );
|
||||
|
||||
|
||||
@@ -373,43 +374,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) {
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
load_db_record(out, "SELECT jo.member_id AS owner_member_id,jo.id AS offer_id, j.id AS job_id,jo.added::date AS added_date,j.title,j.description, j.timeline_days, j.price,jo.offer_code,jo.job_description,jo.expire FROM members_jobs_offer jo LEFT JOIN members_jobs j ON j.id = jo.job_id WHERE jo.expire > now() AND jo.status = 1 AND jo.client_id = %lu AND jo.offer_code='%s'", in["member_id"].Long(), in["offer_code"].c_str());
|
||||
|
||||
/*
|
||||
wrenchboard=>
|
||||
wrenchboard=>
|
||||
wrenchboard=>
|
||||
wrenchboard=> \d members_jobs_contract
|
||||
Table "public.members_jobs_contract"
|
||||
Column | Type | Modifiers
|
||||
---------------+-----------------------------+--------------------------------------------------------------------
|
||||
id | integer | not null default nextval('members_jobs_contract_id_seq'::regclass)
|
||||
job_id | integer | default 0
|
||||
contract | character varying(25) | not null
|
||||
member_id | integer |
|
||||
client_id | integer |
|
||||
title | character varying(150) |
|
||||
description | character varying(300) |
|
||||
job_detail | text |
|
||||
timeline_days | integer | not null
|
||||
price | integer | not null
|
||||
loc | inet |
|
||||
client_signed | timestamp without time zone |
|
||||
created | timestamp without time zone | default now()
|
||||
updated | timestamp without time zone | default now()
|
||||
status | integer | default 1
|
||||
Indexes:
|
||||
"members_jobs_contract_contract_key" UNIQUE CONSTRAINT, btree (contract)
|
||||
"members_jobs_contract_id_key" UNIQUE CONSTRAINT, btree (id)
|
||||
Foreign-key constraints:
|
||||
"members_jobs_contract_client_id_fkey" FOREIGN KEY (client_id) REFERENCES members(id)
|
||||
"members_jobs_contract_member_id_fkey" FOREIGN KEY (member_id) REFERENCES members(id)
|
||||
Referenced by:
|
||||
TABLE "jobs_contract_message" CONSTRAINT "jobs_contract_message_contract_fkey" FOREIGN KEY (contract) REFERENCES members_jobs_contract(contract)
|
||||
|
||||
wrenchboard=>
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
in["offer_id"] = out["offer_id"];
|
||||
in["offer_id"].set_valid(true);
|
||||
|
||||
@@ -418,6 +383,14 @@ TABLE "jobs_contract_message" CONSTRAINT "jobs_contract_message_contract_fkey" F
|
||||
long contract_id = 0;
|
||||
|
||||
switch (offer_result) {
|
||||
case OFFER_EXTEND:
|
||||
logfmt(logINFO, "WrenchConcludeJobsOffer() rc=OFFER_EXTEND");
|
||||
// You can only extend your jobs only
|
||||
if( load_db_record(outx, "SELECT id AS offer_id,* FROM members_jobs_offer WHERE offer_code='%s' AND status = 1 AND member_id=%lu", in["offer_code"].c_str(),in["member_id"].Long()) ){
|
||||
pgsql_exec("UPDATE members_jobs_offer SET expire = expire +'7 days' WHERE id = %lu AND offer_code='%s' ", outx["offer_id"].Long(), outx["offer_code"].c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OFFER_SENDTOME:
|
||||
job_email(JOBS_OFFER_SENDTOME_MAIL, in, out); // the email will come from
|
||||
|
||||
@@ -101,7 +101,8 @@ define('UPLOAD_FILE_SIZE',1);
|
||||
define('OFFER_ACCEPT',100);
|
||||
define('OFFER_REJECT',333);
|
||||
define('OFFER_CANCEL',222);
|
||||
define('OFFER_EXPIRE',444);
|
||||
define('OFFER_EXPIRE',444);
|
||||
define('OFFER_EXTEND',555);
|
||||
|
||||
define('OFFER_SENDTOME',777);
|
||||
|
||||
|
||||
@@ -1184,7 +1184,12 @@ echo $this->getMarketInterestMessage( $in['offer_code'], $out['client_id'] );
|
||||
{
|
||||
$this->concludeOffer(OFFER_SENDTOME);
|
||||
}
|
||||
|
||||
|
||||
public function viewjob_extend()
|
||||
{
|
||||
$this->concludeOffer(OFFER_EXTEND);
|
||||
}
|
||||
|
||||
private function concludeOffer($offer_result) {
|
||||
//WRENCHBOARD_JOB_OFFER_CONCLUDE
|
||||
$jobOfferID = $this->input->get('jobOfferID');
|
||||
@@ -1209,6 +1214,9 @@ echo $this->getMarketInterestMessage( $in['offer_code'], $out['client_id'] );
|
||||
case OFFER_CANCEL:
|
||||
echo "You have cancelled this offer and we have notified the recipient.";
|
||||
break;
|
||||
case OFFER_EXTEND:
|
||||
echo "New time";
|
||||
break;
|
||||
}
|
||||
}
|
||||
// print_r($out);
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</label>
|
||||
<div class="col-lg-8 d-flex align-items-center">
|
||||
<span class="fw-bolder fs-6 text-gray-800 me-2"><?php echo $expire; ?></span>
|
||||
<input type="button" name="extend_job" id="extend_job" onclick="return extendDuration;" value='Extend by a week' class="btn btn-info btn-sm" >
|
||||
<input type="button" name="extend_job" id="extend_job" onclick="return extendDuration();" value='Extend by a week' class="btn btn-info btn-sm" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-7">
|
||||
@@ -211,5 +211,18 @@
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function extendDuration(){
|
||||
$('#extend_result').html('Processing...');
|
||||
$('#extend_job').prop('disabled', true);
|
||||
//alert(element.value);
|
||||
$.ajax({
|
||||
url: "/jobs/viewjob_extend?jobOfferID=<?php echo $jobOfferID; ?>"
|
||||
}).done(function( data ) {
|
||||
$('#extend_result').html(data);
|
||||
$('#extend_job').prop('disabled', false);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user