Skip to content

Commit

Permalink
thêm trang thôn báo và cảnh báo
Browse files Browse the repository at this point in the history
  • Loading branch information
vietvo371 committed Dec 6, 2024
1 parent e0dbafe commit 4e46db3
Show file tree
Hide file tree
Showing 18 changed files with 506 additions and 40 deletions.
3 changes: 2 additions & 1 deletion pages/pageThongBao/jsobjects/JSObject1/JSObject1.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
export default {
actionCreateAdmin: async () => {
actionCreateThongBao: async () => {
// Assuming `getAdmins` is a query to fetch existing admins
const uuid = UUID.genV4();
console.log(uuid);
const obj = {
id:uuid.hexNoDelim,
};
await insertThongBaos.run(obj);
await getNguyHiem.run();
showAlert("Thông báo đã được tạo thành công!", "success");
await getNguyHiem.run();
closeModal(modal_adduser.name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"gitSyncId": "6750f0cdf0b1ed2b4a0eb5b4_59a0cc4e-1dff-4fc8-a3b0-4605375499d4",
"id": "pageThongBao_JSObject1.actionCreateAdmin",
"id": "pageThongBao_JSObject1.actionCreateThongBao",
"pluginId": "js-plugin",
"pluginType": "JS",
"unpublishedAction": {
Expand All @@ -23,8 +23,8 @@
}
],
"executeOnLoad": false,
"fullyQualifiedName": "JSObject1.actionCreateAdmin",
"name": "actionCreateAdmin",
"fullyQualifiedName": "JSObject1.actionCreateThongBao",
"name": "actionCreateThongBao",
"pageId": "pageThongBao",
"userSetOnLoad": false
}
Expand Down
108 changes: 108 additions & 0 deletions pages/pageThongBao/queries/delThongBao/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"gitSyncId": "6750f0cdf0b1ed2b4a0eb5b4_a6cc4473-6645-41fc-853d-01fe2e4d491f",
"id": "pageThongBao_delThongBao",
"pluginId": "mongo-plugin",
"pluginType": "DB",
"unpublishedAction": {
"actionConfiguration": {
"encodeParamsToggle": true,
"formData": {
"aggregate": {
"arrayPipelines": {
"data": ""
},
"limit": {
"data": "10"
}
},
"collection": {
"data": "thong_baos"
},
"command": {
"data": "DELETE"
},
"count": {
"query": {
"data": ""
}
},
"delete": {
"limit": {
"data": "SINGLE"
},
"query": {
"data": "{\n\tid : {{table.triggeredRow.id}}\n}"
}
},
"distinct": {
"key": {
"data": ""
},
"query": {
"data": ""
}
},
"find": {
"limit": {
"data": ""
},
"projection": {
"data": ""
},
"query": {
"data": ""
},
"skip": {
"data": ""
},
"sort": {
"data": ""
}
},
"insert": {
"documents": {
"data": ""
}
},
"misc": {
"formToNativeQuery": {
"data": "{\n \"delete\": \"thong_baos\",\n \"deletes\": [{\n \"q\": {\n\tid : {{table.triggeredRow.id}}\n},\n \"limit\": 1,\n }]\n}\n",
"status": "SUCCESS"
}
},
"smartSubstitution": {
"data": true
},
"updateMany": {
"limit": {
"data": "SINGLE"
},
"query": {
"data": ""
},
"update": {
"data": ""
}
}
},
"paginationType": "NONE",
"timeoutInMillisecond": 10000
},
"confirmBeforeExecute": false,
"datasource": {
"id": "Resue_alert",
"isAutoGenerated": false,
"name": "Resue_alert",
"pluginId": "mongo-plugin"
},
"dynamicBindingPathList": [
{
"key": "formData.delete.query.data"
}
],
"executeOnLoad": false,
"name": "delThongBao",
"pageId": "pageThongBao",
"userSetOnLoad": false
}
}
2 changes: 1 addition & 1 deletion pages/pageThongBao/queries/getAdmins/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"pluginId": "mongo-plugin"
},
"dynamicBindingPathList": [],
"executeOnLoad": true,
"executeOnLoad": false,
"name": "getAdmins",
"pageId": "pageThongBao",
"userSetOnLoad": false
Expand Down
4 changes: 2 additions & 2 deletions pages/pageThongBao/queries/getThongBaos/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"formData": {
"aggregate": {
"arrayPipelines": {
"data": "[\n\t{\n\t\t\"$lookup\": {\n\t\t\t\"from\": \"admins\",\n\t\t\t\"localField\": \"id_nguoi_tao\",\n\t\t\t\"foreignField\": \"id\",\n\t\t\t\"as\": \"admin_details\"\n\t\t}\n\t},\n\t{\n\t\t\"$unwind\": {\n\t\t\t\"path\": \"$admin_details\",\n\t\t\t\"preserveNullAndEmptyArrays\": true\n\t\t}\n\t},\n\t{\n\t\t\"$skip\": \"{{(table.pageNo - 1) * table.pageSize}}\"\n\t},\n\n\t{\n\t\t\"$project\": {\n\t\t\t\"_id\": 0,\n\t\t\t\"id\":1,\n\t\t\t\"tieu_de\": 1,\n\t\t\t\"noi_dung\": 1,\n\t\t\t\"id_nguoi_tao\": 1,\n\t\t\t\"is_open\": 1,\n\t\t\t\"ten_nguoi_tao\": \"$admin_details.username\"\n\t\t}\n\t}\n]"
"data": "[\n\t{\n\t\t\"$lookup\": {\n\t\t\t\"from\": \"admins\",\n\t\t\t\"localField\": \"id_nguoi_tao\",\n\t\t\t\"foreignField\": \"id\",\n\t\t\t\"as\": \"admin_details\"\n\t\t}\n\t},\n\t{\n\t\t\"$unwind\": {\n\t\t\t\"path\": \"$admin_details\",\n\t\t\t\"preserveNullAndEmptyArrays\": true\n\t\t}\n\t},\n\t{\n\t\t\"$lookup\": {\n\t\t\t\"from\": \"vung_nguy_hiem\",\n\t\t\t\"localField\": \"id_vung_nguy_hiem\",\n\t\t\t\"foreignField\": \"id\",\n\t\t\t\"as\": \"vung_nguy_hiem_details\"\n\t\t}\n\t},\n\t{\n\t\t\"$unwind\": {\n\t\t\t\"path\": \"$vung_nguy_hiem_details\",\n\t\t\t\"preserveNullAndEmptyArrays\": true\n\t\t}\n\t},\n\t{\n\t\t\"$skip\": \"{{(table.pageNo - 1) * table.pageSize}}\"\n\t},\n\n\t{\n\t\t\"$project\": {\n\t\t\t\"_id\": 0,\n\t\t\t\"id\":1,\n\t\t\t\"tieu_de\": 1,\n\t\t\t\"noi_dung\": 1,\n\t\t\t\"id_nguoi_tao\": 1,\n\t\t\t\"id_vung_nguy_hiem\": 1,\n\t\t\t\"is_open\": 1,\n\t\t\t\"ten_loai_nguy_hiem\": \"$vung_nguy_hiem_details.loai_nguy_hiem\",\n\t\t\t\"ten_nguoi_tao\": \"$admin_details.username\"\n\t\t}\n\t}\n]"
},
"limit": {
"data": "{{table.pageSize}}"
Expand Down Expand Up @@ -66,7 +66,7 @@
},
"misc": {
"formToNativeQuery": {
"data": "{\n \"aggregate\": \"thong_baos\",\n \"pipeline\": [\n\t{\n\t\t\"$lookup\": {\n\t\t\t\"from\": \"admins\",\n\t\t\t\"localField\": \"id_nguoi_tao\",\n\t\t\t\"foreignField\": \"id\",\n\t\t\t\"as\": \"admin_details\"\n\t\t}\n\t},\n\t{\n\t\t\"$unwind\": {\n\t\t\t\"path\": \"$admin_details\",\n\t\t\t\"preserveNullAndEmptyArrays\": true\n\t\t}\n\t},\n\t{\n\t\t\"$skip\": \"{{(table.pageNo - 1) * table.pageSize}}\"\n\t},\n\n\t{\n\t\t\"$project\": {\n\t\t\t\"_id\": 0,\n\t\t\t\"id\":1,\n\t\t\t\"tieu_de\": 1,\n\t\t\t\"noi_dung\": 1,\n\t\t\t\"id_nguoi_tao\": 1,\n\t\t\t\"is_open\": 1,\n\t\t\t\"ten_nguoi_tao\": \"$admin_details.username\"\n\t\t}\n\t}\n],\n \"cursor\": {}\n}\n",
"data": "{\n \"aggregate\": \"thong_baos\",\n \"pipeline\": [\n\t{\n\t\t\"$lookup\": {\n\t\t\t\"from\": \"admins\",\n\t\t\t\"localField\": \"id_nguoi_tao\",\n\t\t\t\"foreignField\": \"id\",\n\t\t\t\"as\": \"admin_details\"\n\t\t}\n\t},\n\t{\n\t\t\"$unwind\": {\n\t\t\t\"path\": \"$admin_details\",\n\t\t\t\"preserveNullAndEmptyArrays\": true\n\t\t}\n\t},\n\t{\n\t\t\"$lookup\": {\n\t\t\t\"from\": \"vung_nguy_hiem\",\n\t\t\t\"localField\": \"id_vung_nguy_hiem\",\n\t\t\t\"foreignField\": \"id\",\n\t\t\t\"as\": \"vung_nguy_hiem_details\"\n\t\t}\n\t},\n\t{\n\t\t\"$unwind\": {\n\t\t\t\"path\": \"$vung_nguy_hiem_details\",\n\t\t\t\"preserveNullAndEmptyArrays\": true\n\t\t}\n\t},\n\t{\n\t\t\"$skip\": \"{{(table.pageNo - 1) * table.pageSize}}\"\n\t},\n\n\t{\n\t\t\"$project\": {\n\t\t\t\"_id\": 0,\n\t\t\t\"id\":1,\n\t\t\t\"tieu_de\": 1,\n\t\t\t\"noi_dung\": 1,\n\t\t\t\"id_nguoi_tao\": 1,\n\t\t\t\"id_vung_nguy_hiem\": 1,\n\t\t\t\"is_open\": 1,\n\t\t\t\"ten_loai_nguy_hiem\": \"$vung_nguy_hiem_details.loai_nguy_hiem\",\n\t\t\t\"ten_nguoi_tao\": \"$admin_details.username\"\n\t\t}\n\t}\n],\n \"cursor\": {}\n}\n",
"status": "SUCCESS"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"isLoading": false,
"isVisible": true,
"key": "xb83x50wc0",
"leftColumn": 35,
"leftColumn": 39,
"minWidth": 120,
"mobileBottomRow": 6,
"mobileLeftColumn": 16,
Expand Down
106 changes: 86 additions & 20 deletions pages/pageThongBao/widgets/containermaster/content/JSONForm1.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"borderColor": "#E0DEDE",
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"borderWidth": "1",
"bottomRow": 47,
"bottomRow": 62,
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}",
"childStylesheet": {
"ARRAY": {
Expand Down Expand Up @@ -122,9 +122,6 @@
{
"key": "schema.__root_schema__.children.is_open.defaultValue"
},
{
"key": "schema.__root_schema__.children.is_open.borderRadius"
},
{
"key": "schema.__root_schema__.children.noi_dung.defaultValue"
},
Expand Down Expand Up @@ -161,6 +158,18 @@
{
"key": "schema.__root_schema__.children.id.borderRadius"
},
{
"key": "schema.__root_schema__.children.customField1.accentColor"
},
{
"key": "schema.__root_schema__.children.customField1.borderRadius"
},
{
"key": "schema.__root_schema__.children.customField1.options"
},
{
"key": "schema.__root_schema__.children.customField1.defaultValue"
},
{
"key": "schema.__root_schema__.children.ten_nguoi_tao.defaultValue"
},
Expand All @@ -171,11 +180,24 @@
"key": "schema.__root_schema__.children.ten_nguoi_tao.accentColor"
},
{
"key": "schema.__root_schema__.children.id_nguoi_tao.options"
"key": "schema.__root_schema__.children.is_open.borderRadius"
},
{
"key": "schema.__root_schema__.children.ten_loai_nguy_hiem.defaultValue"
},
{
"key": "schema.__root_schema__.children.ten_loai_nguy_hiem.borderRadius"
},
{
"key": "schema.__root_schema__.children.ten_loai_nguy_hiem.accentColor"
}
],
"dynamicHeight": "AUTO_HEIGHT",
"dynamicPropertyPathList": [],
"dynamicPropertyPathList": [
{
"key": "schema.__root_schema__.children.is_open.defaultValue"
}
],
"dynamicTriggerPathList": [
{
"key": "onSubmit"
Expand All @@ -187,7 +209,7 @@
"isLoading": false,
"isVisible": true,
"key": "zov59r3f27",
"leftColumn": 35,
"leftColumn": 39,
"maxDynamicHeight": 9000,
"minDynamicHeight": 4,
"minWidth": 450,
Expand All @@ -196,8 +218,8 @@
"mobileRightColumn": 59,
"mobileTopRow": 5,
"needsErrorInfo": false,
"onSubmit": "{{updateThongBaos.run().then(() => {\n getThongBaos.run();\n showAlert('Thêm thông báo thành công', 'success');\n}).catch(() => {\n showAlert('Lỗi', 'error');\n});}}",
"originalBottomRow": 47,
"onSubmit": "{{updateThongBaos.run().then(() => {\n getThongBaos.run();\n showAlert('Cập nhật thành công', 'success');\n}).catch(() => {\n showAlert('Lỗi', 'error');\n});}}",
"originalBottomRow": 62,
"originalTopRow": 5,
"parentColumnSpace": 18.8896484375,
"parentId": "dymqkelahi",
Expand All @@ -220,6 +242,29 @@
"cellBorderRadius": "{{((sourceData, formData, fieldState) => ((appsmith.theme.borderRadius.appBorderRadius)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"cellBoxShadow": "none",
"children": {
"customField1": {
"accentColor": "{{((sourceData, formData, fieldState) => ((appsmith.theme.colors.primaryColor)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"accessor": "id_vung_nguy_hiem",
"borderRadius": "{{((sourceData, formData, fieldState) => ((appsmith.theme.borderRadius.appBorderRadius)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"boxShadow": "none",
"children": {},
"dataType": "string",
"defaultValue": "{{((sourceData, formData, fieldState) => (sourceData.id_vung_nguy_hiem))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"fieldType": "Select",
"identifier": "customField1",
"isCustomField": true,
"isDisabled": false,
"isFilterable": false,
"isRequired": false,
"isVisible": true,
"label": "Loại Nguy Hiểm",
"labelTextSize": "0.875rem",
"options": "{{ getNguyHiem.data.map(item => ({\n\tlabel: item.loai_nguy_hiem, \n\tvalue: item.id \n}))}}",
"originalIdentifier": "customField1",
"position": 9,
"serverSideFiltering": false,
"sourceData": ""
},
"id": {
"accentColor": "{{((sourceData, formData, fieldState) => ((appsmith.theme.colors.primaryColor)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"accessor": "id",
Expand All @@ -239,7 +284,7 @@
"label": "Id",
"labelTextSize": "0.875rem",
"originalIdentifier": "id",
"position": 8,
"position": 5,
"sourceData": 1
},
"id_nguoi_tao": {
Expand All @@ -250,20 +295,19 @@
"children": {},
"dataType": "number",
"defaultValue": "{{((sourceData, formData, fieldState) => (sourceData.id_nguoi_tao))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"fieldType": "Select",
"fieldType": "Number Input",
"iconAlign": "left",
"identifier": "id_nguoi_tao",
"isCustomField": false,
"isDisabled": false,
"isFilterable": false,
"isRequired": false,
"isVisible": true,
"label": "Người tạo",
"isSpellCheck": false,
"isVisible": false,
"label": "Id Nguoi Tao",
"labelTextSize": "0.875rem",
"options": "{{ getAdmins.data.map(item => ({\n\tlabel: item.username, \n\tvalue: item.id \n}))}}",
"originalIdentifier": "id_nguoi_tao",
"position": 3,
"serverSideFiltering": false,
"sourceData": 1
"sourceData": 12
},
"is_open": {
"accentColor": "{{((sourceData, formData, fieldState) => ((appsmith.theme.colors.primaryColor)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
Expand Down Expand Up @@ -307,6 +351,28 @@
"position": 1,
"sourceData": "Một cơn bão lớn đang đến"
},
"ten_loai_nguy_hiem": {
"accentColor": "{{((sourceData, formData, fieldState) => ((appsmith.theme.colors.primaryColor)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"accessor": "ten_loai_nguy_hiem",
"borderRadius": "{{((sourceData, formData, fieldState) => ((appsmith.theme.borderRadius.appBorderRadius)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"boxShadow": "none",
"children": {},
"dataType": "string",
"defaultValue": "{{((sourceData, formData, fieldState) => (sourceData.ten_loai_nguy_hiem))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"fieldType": "Text Input",
"iconAlign": "left",
"identifier": "ten_loai_nguy_hiem",
"isCustomField": false,
"isDisabled": false,
"isRequired": false,
"isSpellCheck": false,
"isVisible": true,
"label": "Ten Loai Nguy Hiem",
"labelTextSize": "0.875rem",
"originalIdentifier": "ten_loai_nguy_hiem",
"position": 7,
"sourceData": "Bão"
},
"ten_nguoi_tao": {
"accentColor": "{{((sourceData, formData, fieldState) => ((appsmith.theme.colors.primaryColor)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
"accessor": "ten_nguoi_tao",
Expand All @@ -322,12 +388,12 @@
"isDisabled": false,
"isRequired": false,
"isSpellCheck": false,
"isVisible": false,
"isVisible": true,
"label": "Ten Nguoi Tao",
"labelTextSize": "0.875rem",
"originalIdentifier": "ten_nguoi_tao",
"position": 5,
"sourceData": "admin9"
"position": 6,
"sourceData": "Việt võ"
},
"tieu_de": {
"accentColor": "{{((sourceData, formData, fieldState) => ((appsmith.theme.colors.primaryColor)))(JSONForm1.sourceData, JSONForm1.formData, JSONForm1.fieldState)}}",
Expand Down
Loading

0 comments on commit 4e46db3

Please sign in to comment.