<?php

include "../../classes/autoload.php";

$order_type = $_POST['order_type'];

$res = $db->query("terms", "SELECT * FROM terms WHERE document_type = 'QUOTES' AND order_type = '$order_type' LIMIT 1");

if ($res->num_rows == 0) {
    echo json_encode(['notes' => '', 'terms' => '']);
} else {
    $term = $res->fetch_assoc();
    echo json_encode(['notes' => $term['notes'], 'terms' => $term['terms']]);
}