sorting works again, name overhaul

This commit is contained in:
Contrabang
2022-12-16 21:11:24 -05:00
parent 00b8f14485
commit a41a0d1bd3
3 changed files with 25 additions and 44 deletions
+12 -31
View File
@@ -240,16 +240,16 @@
)
ui_modal_message(src, "virus", "", null, payload)
qdel(D)
if("del_all")
if("del_all_med_records")
for(var/datum/data/record/R in GLOB.data_core.medical)
qdel(R)
set_temp("All medical records deleted.")
if("del_r")
if("del_med_record")
if(active2)
set_temp("Medical record deleted.")
qdel(active2)
if("d_rec")
var/datum/data/record/general_record = locate(params["d_rec"] || "")
if("view_record")
var/datum/data/record/general_record = locate(params["view_record"] || "")
if(!GLOB.data_core.general.Find(general_record))
set_temp("Record not found.", "danger")
return
@@ -263,7 +263,7 @@
active1 = general_record
active2 = medical_record
screen = MED_DATA_RECORD
if("new")
if("new_med_record")
if(istype(active1, /datum/data/record) && !istype(active2, /datum/data/record))
var/datum/data/record/R = new /datum/data/record()
R.fields["name"] = active1.fields["name"]
@@ -284,8 +284,8 @@
active2 = R
screen = MED_DATA_RECORD
set_temp("Medical record created.", "success")
if("del_c")
var/index = text2num(params["del_c"] || "")
if("del_comment")
var/index = text2num(params["del_comment"] || "")
if(!index || !istype(active2, /datum/data/record))
return
@@ -293,26 +293,7 @@
index = clamp(index, 1, length(comments))
if(comments[index])
comments.Cut(index, index + 1)
if("search")
active1 = null
active2 = null
var/t1 = lowertext(params["t1"] || "")
if(!length(t1))
return
for(var/datum/data/record/R in GLOB.data_core.medical)
if(t1 == lowertext(R.fields["name"]) || t1 == lowertext(R.fields["id"]) || t1 == lowertext(R.fields["b_dna"]))
active2 = R
break
if(!active2)
set_temp("Medical record not found. You must enter the person's exact name, ID or DNA.", "danger")
return
for(var/datum/data/record/E in GLOB.data_core.general)
if(E.fields["name"] == active2.fields["name"] && E.fields["id"] == active2.fields["id"])
active1 = E
break
screen = MED_DATA_RECORD
if("print_p")
if("print_record")
if(!printing)
printing = TRUE
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE)
@@ -345,7 +326,7 @@
ui_modal_choice(src, id, question, arguments = arguments, value = arguments["value"], choices = choices)
else
ui_modal_input(src, id, question, arguments = arguments, value = arguments["value"])
if("add_c")
if("add_comment")
ui_modal_input(src, id, "Please enter your message:")
else
return FALSE
@@ -371,7 +352,7 @@
active2.fields[field] = answer
else if(istype(active1) && (field in active1.fields))
active1.fields[field] = answer
if("add_c")
if("add_comment")
var/datum/ui_login/state = ui_login_get()
if(!length(answer) || !istype(active2) || !length(state.name))
return
@@ -404,11 +385,11 @@
<br>\nBlood Type: [active2.fields["blood_type"]]
<br>\nDNA: [active2.fields["b_dna"]]<br>\n
<br>\nMinor Disabilities: [active2.fields["mi_dis"]]
<br>\nDetails: [active2.fields["mi_dis_d"]]<br>\n
<br>\nDetails: [active2.fields["mi_dis_d"]]<br>
<br>\nMajor Disabilities: [active2.fields["ma_dis"]]
<br>\nDetails: [active2.fields["ma_dis_d"]]<br>\n
<br>\nAllergies: [active2.fields["alg"]]
<br>\nDetails: [active2.fields["alg_d"]]<br>\n
<br>\nDetails: [active2.fields["alg_d"]]<br>
<br>\nCurrent Diseases: [active2.fields["cdi"]] (per disease info placed in log/comment section)
<br>\nDetails: [active2.fields["cdi_d"]]<br>\n
<br>\nImportant Notes:
+12 -12
View File
@@ -176,7 +176,7 @@ const MedicalRecordsList = (_properties, context) => {
className={
'MedicalRecords__listRow--' + medStatusStyles[record.p_stat]
}
onClick={() => act('d_rec', { d_rec: record.ref })}
onClick={() => act('view_record', { view_record: record.ref })}
>
<Table.Cell>
<Icon name="user" /> {record.name}
@@ -209,7 +209,7 @@ const MedicalRecordsMaintenance = (_properties, context) => {
<Button.Confirm
icon="trash"
content="Delete All Medical Records"
onClick={() => act('del_all')}
onClick={() => act('del_all_med_records')}
/>
</Fragment>
);
@@ -231,7 +231,7 @@ const MedicalRecordsView = (_properties, context) => {
iconSpin={!!printing}
content="Print Entry"
ml="0.5rem"
onClick={() => act('print_p')}
onClick={() => act('print_record')}
/>
}>
<MedicalRecordsViewGeneral />
@@ -244,7 +244,7 @@ const MedicalRecordsView = (_properties, context) => {
icon="trash"
disabled={!!medical.empty}
content="Delete Medical Record"
onClick={() => act('del_r')}
onClick={() => act('del_med_record')}
/>
}>
<MedicalRecordsViewMedical />
@@ -316,7 +316,7 @@ const MedicalRecordsViewMedical = (_properties, context) => {
icon="pen"
content="New Record"
ml="0.5rem"
onClick={() => act('new')}
onClick={() => act('new_med_record')}
/>
</Box>
);
@@ -343,7 +343,7 @@ const MedicalRecordsViewMedical = (_properties, context) => {
<Button
icon="comment"
content="Add Entry"
onClick={() => modalOpen(context, 'add_c')}
onClick={() => modalOpen(context, 'add_comment')}
/>
}>
{medical.comments.length === 0 ? (
@@ -360,7 +360,7 @@ const MedicalRecordsViewMedical = (_properties, context) => {
icon="comment-slash"
color="bad"
ml="0.5rem"
onClick={() => act('del_c', { del_c: i + 1 })}
onClick={() => act('del_comment', { del_comment: i + 1 })}
/>
</Box>
))
@@ -374,8 +374,8 @@ const MedicalRecordsViruses = (_properties, context) => {
const { act, data } = useBackend(context);
const { virus } = data;
const [searchText, setSearchText] = useLocalState(context, 'searchText', '');
const [sortId, _setSortId] = useLocalState(context, 'sortId', 'name');
const [sortOrder, _setSortOrder] = useLocalState(context, 'sortOrder', true);
const [sortId2, _setSortId2] = useLocalState(context, 'sortId2', 'name');
const [sortOrder2, _setSortOrder2] = useLocalState(context, 'sortOrder2', true);
return(
<Flex direction="column" height="100%">
<Flex>
@@ -407,8 +407,8 @@ const MedicalRecordsViruses = (_properties, context) => {
})
)
.sort((a, b) => {
const i = sortOrder ? 1 : -1;
return a[sortId].localeCompare(b[sortId]) * i;
const i = sortOrder2 ? 1 : -1;
return a[sortId2].localeCompare(b[sortId2]) * i;
})
.map((vir) => (
<Table.Row
@@ -473,7 +473,7 @@ const MedicalRecordsMedbots = (_properties, context) => {
medbot.maximum_volume
: 'Using internal synthesizer'}
</Table.Cell>
</Table.Row>
</Table.Row>
))}
</Table>
</Section>
File diff suppressed because one or more lines are too long