Compare commits

..

No commits in common. "7fd8cb9a65909be99dc2e3f98d0613a5dabbbaa3" and "d69b74561c3b5ae6a5d6d6fb95f910034157a853" have entirely different histories.

4 changed files with 48 additions and 140 deletions

View File

@ -504,7 +504,7 @@ const loadHistoryFromLocal = () => {
const parsed = JSON.parse(stored); const parsed = JSON.parse(stored);
historyResults.value = parsed.slice( historyResults.value = parsed.slice(
0, 0,
resolvedProps.value.maxHistoryItems, resolvedProps.value.maxHistoryItems
); );
recentSearches.value = historyResults.value recentSearches.value = historyResults.value
.slice(0, 5) .slice(0, 5)
@ -520,7 +520,7 @@ const saveHistoryToLocal = () => {
try { try {
localStorage.setItem( localStorage.setItem(
LOCAL_STORAGE_KEY, LOCAL_STORAGE_KEY,
JSON.stringify(historyResults.value), JSON.stringify(historyResults.value)
); );
} catch (err) { } catch (err) {
console.error("خطا در ذخیره تاریخچه:", err); console.error("خطا در ذخیره تاریخچه:", err);
@ -533,39 +533,39 @@ const hasVisibleResults = computed(
showResults.value && showResults.value &&
(showAutocompleteList.value || (showAutocompleteList.value ||
showHistoryList.value || showHistoryList.value ||
showEmptyState.value), showEmptyState.value)
); );
const showAutocompleteList = computed( const showAutocompleteList = computed(
() => () =>
showResults.value && showResults.value &&
autocompleteResults.value.length > 0 && autocompleteResults.value.length > 0 &&
searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete, searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete
); );
const showHistoryList = computed( const showHistoryList = computed(
() => showResults.value && searchQuery.value.length === 0, () => showResults.value && searchQuery.value.length === 0
); );
const showEmptyState = computed( const showEmptyState = computed(
() => () =>
showResults.value && showResults.value &&
!showAutocompleteList.value && !showAutocompleteList.value &&
!showHistoryList.value && !showHistoryList.value &&
searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete, searchQuery.value.length >= resolvedProps.value.minCharsForAutocomplete
); );
const totalResults = computed( const totalResults = computed(
() => () =>
(showAutocompleteList.value ? autocompleteResults.value.length : 0) + (showAutocompleteList.value ? autocompleteResults.value.length : 0) +
(showHistoryList.value ? historyResults.value.length : 0), (showHistoryList.value ? historyResults.value.length : 0)
); );
const selectedFilterIcon = computed( const selectedFilterIcon = computed(
() => () =>
quickFilters.value.find((f) => f.value === selectedFilter.value)?.icon || quickFilters.value.find((f) => f.value === selectedFilter.value)?.icon ||
"i-heroicons-funnel", "i-heroicons-funnel"
); );
const selectedFilterLabel = computed( const selectedFilterLabel = computed(
() => () =>
quickFilters.value.find((f) => f.value === selectedFilter.value)?.label || quickFilters.value.find((f) => f.value === selectedFilter.value)?.label ||
"فیلتر", "فیلتر"
); );
// فرمت زمان // فرمت زمان
@ -599,8 +599,6 @@ const fetchAutocomplete = async () => {
let url = `${resolvedProps.value.autocompleteUrl}/q=${searchQuery.value}`; let url = `${resolvedProps.value.autocompleteUrl}/q=${searchQuery.value}`;
if (selectedFilter.value !== "all") url += `&filter=${selectedFilter.value}`; if (selectedFilter.value !== "all") url += `&filter=${selectedFilter.value}`;
try { try {
console.log("url", url);
const response = await httpService.getRequest(url); const response = await httpService.getRequest(url);
const hits = response?.hits?.hits || []; const hits = response?.hits?.hits || [];
autocompleteResults.value = hits autocompleteResults.value = hits
@ -656,7 +654,7 @@ const addToHistory = (item) => {
if (historyResults.value.length > resolvedProps.value.maxHistoryItems) { if (historyResults.value.length > resolvedProps.value.maxHistoryItems) {
historyResults.value = historyResults.value.slice( historyResults.value = historyResults.value.slice(
0, 0,
resolvedProps.value.maxHistoryItems, resolvedProps.value.maxHistoryItems
); );
} }
recentSearches.value = historyResults.value.slice(0, 5).map((i) => i.label); recentSearches.value = historyResults.value.slice(0, 5).map((i) => i.label);
@ -884,7 +882,7 @@ const handleKeyDown = (event) => {
if (selectedIndex.value >= 0) { if (selectedIndex.value >= 0) {
if (activeSection.value === "autocomplete") { if (activeSection.value === "autocomplete") {
handleAutocompleteSelect( handleAutocompleteSelect(
autocompleteResults.value[selectedIndex.value], autocompleteResults.value[selectedIndex.value]
); );
} else if (activeSection.value === "history") { } else if (activeSection.value === "history") {
const historyIndex = selectedIndex.value - autocompleteCount; const historyIndex = selectedIndex.value - autocompleteCount;

View File

@ -52,7 +52,7 @@ function isList(text) {
(line) => (line) =>
line.trim().startsWith("*") || line.trim().startsWith("*") ||
line.trim().startsWith("-") || line.trim().startsWith("-") ||
/^\d+\./.test(line.trim()), /^\d+\./.test(line.trim())
); );
} }
const toolbarGroups = [ const toolbarGroups = [
@ -249,12 +249,12 @@ function generateDetailsHtml(item) {
let html = `<details class="custom-details" ${item.isOpen ? "open" : ""}>`; let html = `<details class="custom-details" ${item.isOpen ? "open" : ""}>`;
html += `<summary>`; html += `<summary>`;
if (item.tag) { if (item.tag) {
html += `<span > ${item.tag} </span>`; html += `<span href="${item.tag}"/>`;
} }
html += `${escapeHtml(item.title) || "بدون عنوان"}`; html += `${escapeHtml(item.title) || "بدون عنوان"}`;
if (item.link_url) { if (item.link_url) {
html += `<a class="link-url" href="${item.link_url}">${item.link_label}</a>`; html += `<a href="${item.link_url}">${item.link_label}</a>`;
} }
html += "</summary>"; html += "</summary>";
@ -297,7 +297,7 @@ watch(
loadFromJson(); loadFromJson();
}); });
}, },
{ deep: true, immediate: true }, { deep: true, immediate: true }
); );
onMounted(() => { onMounted(() => {
editor.value = new Editor({ editor.value = new Editor({
@ -342,8 +342,8 @@ onBeforeUnmount(() => {
/* فقط متغیرهای غیررنگ (سایه، انحنا، RGB اصلی) رنگ‌ها در main.css تعریف شده‌اند */ /* فقط متغیرهای غیررنگ (سایه، انحنا، RGB اصلی) رنگ‌ها در main.css تعریف شده‌اند */
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05); --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
--shadow-md: --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--radius: 0.75rem; --radius: 0.75rem;
--radius-sm: 0.5rem; --radius-sm: 0.5rem;
--radius-lg: 1rem; --radius-lg: 1rem;
@ -365,7 +365,7 @@ onBeforeUnmount(() => {
border: 1px solid var(--color-primary-200); border: 1px solid var(--color-primary-200);
border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
margin: 2rem auto 0; margin: 2rem auto 0;
max-width: 1200px; max-width: 900px;
box-shadow: var(--shadow-sm); box-shadow: var(--shadow-sm);
} }
@ -421,7 +421,7 @@ onBeforeUnmount(() => {
} }
.editor-content { .editor-content {
max-width: 1200px; max-width: 900px;
margin: 0 auto 2rem; margin: 0 auto 2rem;
padding: 2rem; padding: 2rem;
background: var(--color-white-normal); background: var(--color-white-normal);
@ -433,14 +433,8 @@ onBeforeUnmount(() => {
} }
.tiptap { .tiptap {
font-family: font-family: "Vazir", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
"Vazir", Roboto, sans-serif;
"Inter",
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
sans-serif;
color: var(--color-dark-primary-700); color: var(--color-dark-primary-700);
line-height: 1.7; line-height: 1.7;
@ -559,15 +553,14 @@ onBeforeUnmount(() => {
padding: 1.25rem 1.25rem 1.25rem 3.5rem; padding: 1.25rem 1.25rem 1.25rem 3.5rem;
background: linear-gradient( background: linear-gradient(
to right, to right,
var(--color-primary-100), var(--color-dark-primary-50),
var(--color-white-normal) var(--color-white-normal)
); );
color: var(--color-primary-700);
border-radius: var(--radius) var(--radius) 0 0; border-radius: var(--radius) var(--radius) 0 0;
font-weight: 700; font-weight: 700;
font-size: 1.1rem; font-size: 1.1rem;
color: var(--color-dark-primary-800); color: var(--color-dark-primary-800);
// cursor: pointer; cursor: pointer;
list-style: none; list-style: none;
user-select: none; user-select: none;
transition: all 0.2s ease; transition: all 0.2s ease;
@ -575,6 +568,15 @@ onBeforeUnmount(() => {
&::-webkit-details-marker { &::-webkit-details-marker {
display: none; display: none;
} }
&:hover {
background: linear-gradient(
to right,
var(--color-primary-100),
var(--color-white-normal)
);
color: var(--color-primary-700);
}
} }
> div { > div {
@ -639,10 +641,6 @@ onBeforeUnmount(() => {
padding-right: 1rem; padding-right: 1rem;
border-right: 2px dashed var(--color-primary-100); border-right: 2px dashed var(--color-primary-100);
} }
.link-url {
color: blue;
margin-right: 0.5em;
}
} }
@keyframes slideDown { @keyframes slideDown {

View File

@ -40,19 +40,15 @@ const setDataEditor = async () => {
console.log("setDataEditor ", response); console.log("setDataEditor ", response);
let _source = response._source; let _source = response._source;
let base_url =
let base_url = window.location.origin; window.location.origin +
base_url = base_url.replace("localhost:3007", "localhost:8082"); "/entity/show/view/qasection/{{qanon_id}}?jump_id={{section_id}}";
base_url = base_url.replace("majles.tavasi.ir", "jedit.tavasi.ir");
base_url += "/entity/show/view/qasection/{{qanon_id}}?jump_id={{section_id}}";
accordionItems.value = []; accordionItems.value = [];
let node = {}
if (_source.previous_info) { if (_source.previous_info) {
let item = _source.previous_info; let item = _source.previous_info;
node = { accordionItems.value.push({
isOpen: false, isOpen: false,
id: item.section_mom_id, id: item.section_mom_id,
title: "قانون مقدم : " + item.qanon_title + " > " + item.full_path, title: "قانون مقدم : " + item.qanon_title + " > " + item.full_path,
@ -62,32 +58,12 @@ const setDataEditor = async () => {
link_url: base_url link_url: base_url
.replace("{{qanon_id}}", item.qanon_id) .replace("{{qanon_id}}", item.qanon_id)
.replace("{{section_id}}", item.section_mom_id), .replace("{{section_id}}", item.section_mom_id),
children: [],
};
node["children"].push({
isOpen: false,
id: item.context_id,
title: "متن کامل با اجزاء دیگر مورد توجه : ",
content: _source.context1,
});
accordionItems.value.push(node);
item.rule_ids.forEach((rule_id) => {
let content = _source.rules_content[rule_id] ?? "";
accordionItems.value.push({
isOpen: false,
id: rule_id,
title: "حکم مورد استناد طرف مقدم با شناسه : " + rule_id,
content: content,
});
}); });
} }
if (_source.next_info) { if (_source.next_info) {
let item = _source.next_info; let item = _source.next_info;
node = { accordionItems.value.push({
isOpen: false, isOpen: false,
id: item.section_mom_id, id: item.section_mom_id,
title: "قانون موخر : " + item.qanon_title + " > " + item.full_path, title: "قانون موخر : " + item.qanon_title + " > " + item.full_path,
@ -97,73 +73,9 @@ const setDataEditor = async () => {
link_url: base_url link_url: base_url
.replace("{{qanon_id}}", item.qanon_id) .replace("{{qanon_id}}", item.qanon_id)
.replace("{{section_id}}", item.section_mom_id), .replace("{{section_id}}", item.section_mom_id),
children: [],
};
node["children"].push({
isOpen: false,
id: item.context_id,
title: "متن کامل با اجزاء دیگر مورد توجه : ",
content: _source.context1,
});
accordionItems.value.push(node);
item.rule_ids.forEach((rule_id) => {
let content = _source.rules_content[rule_id] ?? "";
accordionItems.value.push({
isOpen: false,
id: rule_id,
title: "حکم مورد استناد طرف موخر با شناسه : " + rule_id,
content: content,
});
}); });
} }
/////-------------وحدت موضوع----------------------
node = {
isOpen: true,
id: 11,
title: "توضیح هوشمند برای وجود وحدت موضوع بین احکام استنادی ",
content: _source.subject_unity.reason,
children: [],
}
if(_source.subject_unity.description){
node["children"].push({
isOpen: false,
id: item.context_id,
title: "شرط اعتبار وحدت موضوع : ",
content: _source.subject_unity.description,
});
}
accordionItems.value.push(node);
/////-------------توضیح تخالف----------------------
node = {
isOpen: true,
id: 11,
title: "توضیح وجود تخالف بین دو ماده ",
content: _source.conflict_detection.description,
children: [],
}
accordionItems.value.push(node);
/////-------------بیان نوع تخالف----------------------
node = {
isOpen: true,
id: 11,
title: "بیان نوع تخالف بین دو ماده : " + _source.conflict_relation_identification.main_type,
content: _source.conflict_relation_identification.description,
children: [],
}
accordionItems.value.push(node);
/////-----------------------------------
console.log("accordionItems", accordionItems.value); console.log("accordionItems", accordionItems.value);
}; };

View File

@ -132,7 +132,7 @@ const getListConflict = async (textSearch = "", filterExtended = "") => {
request.url, request.url,
request.payload_full, request.payload_full,
); );
// console.log("res", res); console.log("res", res);
listConflicts.value = res.hits; listConflicts.value = res.hits;
pagination.value.total = res.hits.total.value; pagination.value.total = res.hits.total.value;
@ -148,7 +148,7 @@ const getListConflict = async (textSearch = "", filterExtended = "") => {
function conflictDetails(event) { function conflictDetails(event) {
conflictSelected.value = event.item; conflictSelected.value = event.item;
activeTabKey.value = "RelationEdit"; activeTabKey.value = "RelationEdit";
// console.log("event", event); console.log("event", event);
} }
onMounted(() => { onMounted(() => {
getListConflict(); getListConflict();
@ -156,20 +156,20 @@ onMounted(() => {
}); });
function myContentAction({ action, payload }) { function myContentAction({ action, payload }) {
// console.log("payload ==> ", payload); console.log("payload ==> ", payload);
// console.log("action ==> ", action); console.log("action ==> ", action);
if (action === "pagination") { if (action === "pagination") {
const { page, limit } = payload; const { page, limit } = payload;
pagination.value.page = page; pagination.value.page = page;
pagination.value.limit = limit; pagination.value.limit = limit;
// console.log("pagination.value ==> ", pagination.value); console.log("pagination.value ==> ", pagination.value);
getListConflict(); getListConflict();
return; return;
} }
} }
function myHeaderToolsSearch(textSearch) { function myHeaderToolsSearch(data) {
console.log("dataqqqq ==> ", textSearch); console.log("dataqqqq ==> ", data);
getListConflict(textSearch); getListConflict(data);
} }
</script> </script>