build_app

This commit is contained in:
string 2024-11-04 11:13:53 +00:00
parent 7d600e58d4
commit 3cb4b52446
6 changed files with 22 additions and 273 deletions

@ -43,6 +43,10 @@ const DocumentSequence = require("./routes/DocumentSequence/DocumentSeq.routes")
app.use(`${basePath}`, DocumentSequence)
// buildercomponents
const FormaRouter = require("./routes/basic1/Forma.routes")

@ -1,8 +1,6 @@
const { pool, db } = require("../../config/database")
const getUsersPaged = async (req, res) => {
try {
@ -39,27 +37,6 @@ const getUsersPaged = async (req, res) => {
// Use Buffer conversion to boolean
q: Buffer.isBuffer(row.q) ? row.q.readUInt8(0) === 1 : row.q === 1,
m: Buffer.isBuffer(row.m) ? row.m.readUInt8(0) === 1 : row.m === 1,
n: Buffer.isBuffer(row.n) ? row.n.readUInt8(0) === 1 : row.n === 1,
}));
return res.json(formattedResults);
});
@ -97,25 +74,7 @@ const createUser = async (req, res) => {
try {
const params = [ body.radiob,
body.q,
body.m,
body.n,
const params = [ body.decimalf,
]
@ -127,21 +86,7 @@ body.n,
await executeQuery(
`
INSERT INTO forma
SET radiob = ?,
q = ?,
m = ?,
n = ?
SET decimalf = ?
`,
sanitizedParams
@ -149,8 +94,6 @@ n = ?
return res.json({
success: 1,
content: "user created successfully",
@ -170,23 +113,7 @@ const updateUsers = async (req, res) => {
try {
// Ensure that required parameters exist and replace undefined with null
const params = [body.radiob,
body.q,
body.m,
body.n,
const params = [body.decimalf,
id,
];
@ -196,21 +123,7 @@ body.n,
const results = await executeQuery(
`
UPDATE forma
SET radiob = ?,
q = ?,
m = ?,
n = ?
SET decimalf = ?
WHERE id = ?
`,
@ -258,8 +171,6 @@ const deleteUsers = async (req, res) => {
module.exports = {
getUsers,
getUsersPaged,
@ -269,8 +180,6 @@ getUsersPaged,
deleteUsers,
}
async function executeQuery(sql, values) {

@ -8,8 +8,6 @@ getUsersPaged,
deleteUsers,
} = require("../../entity/basic1/Forma.controller")
const router = require("express").Router()
@ -21,8 +19,6 @@ getUsersPaged,
.delete("/:id", deleteUsers)
module.exports = router

@ -1,2 +1,2 @@
CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, q bit(1), radiob VARCHAR(400), m bit(1), n bit(1), PRIMARY KEY (id));
CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, decimalf int, PRIMARY KEY (id));

@ -2,8 +2,6 @@
<div class="container mt-4">
<button class="btn btn-success mb-3" @click="openAddDialog">
Add New Item
</button>
@ -11,39 +9,14 @@
<thead class="table-light">
<tr>
<th scope="col">Radiob</th>
<th scope="col">checkboxm</th>
<th scope="col">Decimalf</th>
</tr>
</thead>
<tbody>
<tr v-for="item in paginatedData" :key="item.id">
<td>{{ item.radiob }}</td>
<td>{{ item.q }}</td>
<td>{{ item.m }}</td>
<td>{{ item.n }}</td>
<td>{{ item.decimalf }}</td>
<td>
<button class="btn btn-primary btn-sm" @click="openDialog(item)">
@ -51,8 +24,6 @@
</button>
<button
class="btn btn-danger btn-sm ms-2"
@ -99,8 +70,6 @@
<!-- Form Dialog -->
<div
@ -124,89 +93,10 @@
<div class="modal-body">
<form @submit.prevent="submitForm">
<div class="mb-3">
<label for="Radiob" class="form-label">radiob</label>
<div>
<input
v-model="currentItem.radiob"
type="radio"
id="q"
value="q"
class="form-check-input"
required
/>
<label for="q" class="form-check-label">q</label>
</div>
<div>
<input
v-model="currentItem.radiob"
type="radio"
id="b"
value="b"
class="form-check-input"
required
/>
<label for="b" class="form-check-label">b</label>
</div>
</div>
<div class="mb-3">
<label class="form-label">checkboxm</label>
<div>
<input
type="checkbox"
id="q"
v-model="currentItem.q"
class="form-check-input"
@change="handleCheckboxChange('q')"
/>
<label for="q" class="form-check-label">q</label>
</div>
<div>
<input
type="checkbox"
id="m"
v-model="currentItem.m"
class="form-check-input"
@change="handleCheckboxChange('m')"
/>
<label for="m" class="form-check-label">m</label>
</div>
<div>
<input
type="checkbox"
id="n"
v-model="currentItem.n"
class="form-check-input"
@change="handleCheckboxChange('n')"
/>
<label for="n" class="form-check-label">n</label>
</div>
</div>
<div class="form-group">
<label for="decimalf">Decimalf</label>
<input type="number" class="form-control" id="decimalf" v-model="currentItem.decimalf" required>
</div>
<button type="submit" class="btn btn-primary">
{{ isEditMode ? "Save changes" : "Add Item" }}
@ -233,24 +123,10 @@ const token = localStorage.getItem("token");
console.log("hii", token);
const data = ref([]);
const currentItem = ref({
radiob: "",
decimalf: "",
q: "",
m: "",
n: "",
});
const dialogVisible = ref(false);
const isEditMode = ref(false);
@ -271,8 +147,6 @@ const result = await response.json();
data.value = result;
} else {
console.error("Error: Fetched data is not an array");
} } catch (error) {
@ -304,24 +178,10 @@ const openDialog = (item) => {
const openAddDialog = () => {
currentItem.value = {
radiob: "",
decimalf: "",
q: "",
m: "",
n: "",
};
isEditMode.value = false;
dialogVisible.value = true;
@ -334,8 +194,6 @@ const closeDialog = () => {
const submitForm = async () => {
if (isEditMode.value) {
// Update item
try {
@ -397,29 +255,6 @@ const token = TokenService.getToken();
};
const handleCheckboxChange = (selected) => {
currentItem.value.q = selected === "q";
currentItem.value.m = selected === "m";
currentItem.value.n = selected === "n";
};
onMounted(fetchData);
</script>

@ -86,6 +86,11 @@ const router = createRouter({
path: "/Forma",
component: () => import("../components/BuilderComponents/basic1/Forma/Forma.vue"),
},
{
path: "/Forma",
component: () => import("../components/BuilderComponents/basic1/Forma/Forma.vue"),
},
{
path: "/datfolder",