'', 'type' => '', 'status' => '', 'accountID' => '', 'start_date' => '', 'duration' => '', 'service_count' => '', 'contract_details' => '', 'created' => '', 'createdby' => '', 'billing_plan' => '', 'pricing' => '', 'reference' => '', 'servicetool' => '', 'assigned_users' => [] ]; $contract_ID = $_GET['rowID'] ?? ''; if ($contract_ID !=''){ $url = 'index.php?page=contract&rowID='.$contract_ID.''; } else { $url = 'index.php?page=contracts'; } if (isset($_GET['rowID'])) { //CALL TO API $api_url = '/v1/contracts/rowID='.$contract_ID; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;} $contract = json_decode(json_encode($responses[0]), true); if ($update_allowed === 1){ if (isset($_POST['submit'])) { //GET ALL POST DATA $data = json_encode($_POST, JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/contracts', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=contracts&success_msg=2'); exit; } } } if ($delete_allowed === 1){ if (isset($_POST['delete'])) { //GET ALL POST DATA $data = json_encode($_POST , JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/contracts', $payload); // Redirect and delete product if ($responses === 'NOK'){ } else { header('Location: index.php?page=contracts&success_msg=3'); exit; } } } } else { // Create a new product if (isset($_POST['submit']) && $create_allowed === 1) { //GET ALL POST DATA $data = json_encode($_POST, JSON_UNESCAPED_UNICODE); //Secure data $payload = generate_payload($data); //API call $responses = ioServer('/v1/contracts', $payload); if ($responses === 'NOK'){ } else { header('Location: index.php?page=contracts&success_msg=1'); exit; } } } template_header('Contract', 'contract', 'manage'); $view ='
'; //Output echo $view; template_footer()?>