<?php
error_reporting(0);
ini_set('display_errors', 0);

session_start();
include "../../../root.class.php";
$db = new db_safeguard();

if (empty($_POST['jobcard_no'])) {
    echo '0';
    exit;
}

$jobcard_no = $_POST['jobcard_no'];
$reason     = $_POST['reason'] ?? '';
$note       = $_POST['note'] ?? '';
$image      = $_POST['image'] ?? '';
$date_time  = $_POST['date_time'] ?? date("Y-m-d H:i");

$db->query("notes", "INSERT INTO notes (jobcard_id, reason, note, image, date_time) 
    VALUES ('{$jobcard_no}', '{$reason}', '{$note}', '{$image}', '{$date_time}')");

echo '1';
?>