<div id="mediq-dashboard" dir="rtl">
<style>
/* ============================================================
MEDIQ DASHBOARD - SUPPLY
PRESENTATION VERSION
============================================================ */
#mediq-dashboard,
#mediq-dashboard * {
box-sizing: border-box;
}
#mediq-dashboard {
--navy: #073553;
--navy-dark: #062d49;
--primary: #08b9b0;
--primary-dark: #069e98;
--text: #173b59;
--muted: #748b9e;
--border: #dce9ef;
--bg: #f4f9fb;
--white: #ffffff;
position: fixed;
inset: 0;
width: 100vw;
height: 100vh;
z-index: 9999;
overflow: hidden;
direction: rtl;
font-family:
Tahoma,
Arial,
sans-serif;
color: var(--text);
background:
radial-gradient(
circle at 12% 4%,
rgba(9,185,176,.09),
transparent 27%
),
#f4f9fb;
}
/* ============================================================
HIDE CONFLUENCE
============================================================ */
html,
body,
#page,
#full-height-container,
#main,
#content,
#main-content,
.aui-page-panel,
.aui-page-panel-inner,
.aui-page-panel-content,
.content-body {
width: 100% !important;
height: 100% !important;
max-width: none !important;
margin: 0 !important;
padding: 0 !important;
}
html,
body {
overflow: hidden !important;
}
#footer,
footer,
.aui-footer,
#header,
#main-header,
.breadcrumbs,
#breadcrumbs,
.page-metadata {
display: none !important;
}
/* ============================================================
APP
============================================================ */
.mq-app {
width: 100%;
height: 100%;
display: grid;
grid-template-columns:
minmax(0,1fr)
255px;
direction: ltr;
}
/* ============================================================
SIDEBAR
============================================================ */
.mq-sidebar {
grid-column: 2;
height: 100vh;
padding:
24px
17px;
direction: rtl;
color: #fff;
display: flex;
flex-direction: column;
background:
linear-gradient(
180deg,
#073b5c 0%,
#062e4a 100%
);
box-shadow:
-12px 0 45px
rgba(7,53,83,.11);
}
/* LOGO */
.mq-logo {
width: 100%;
text-align: center;
padding:
3px
5px
22px;
border-bottom:
1px solid
rgba(255,255,255,.10);
}
.mq-logo img {
width: 174px;
max-width: 92%;
height: auto;
}
/* USER */
.mq-user {
margin-top: 17px;
padding:
14px
15px;
border-radius: 14px;
background:
rgba(255,255,255,.065);
border:
1px solid
rgba(255,255,255,.08);
}
.mq-user-name {
font-size: 12px;
font-weight: 900;
}
.mq-user-role {
margin-top: 6px;
color:
rgba(255,255,255,.58);
font-size: 9px;
font-weight: 600;
}
/* ============================================================
LIFE CYCLE
============================================================ */
.mq-life-title {
margin:
26px
7px
9px;
color:
rgba(255,255,255,.39);
font-size: 9px;
font-weight: 700;
}
.mq-life {
display: flex;
flex-direction: column;
gap: 6px;
}
.mq-life-item {
position: relative;
min-height: 46px;
padding:
0
13px;
border-radius: 11px;
display: flex;
align-items: center;
gap: 10px;
color:
rgba(255,255,255,.69);
font-size: 11px;
font-weight: 800;
cursor: pointer;
user-select: none;
transition:
background .15s ease,
color .15s ease,
transform .15s ease;
}
.mq-life-item:hover {
color: #fff;
background:
rgba(255,255,255,.075);
}
.mq-life-item.active {
color: #fff;
background:
linear-gradient(
90deg,
#08b9b0,
#079e99
);
box-shadow:
0 10px 23px
rgba(8,185,176,.18);
}
.mq-life-icon {
width: 28px;
height: 28px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
background:
rgba(255,255,255,.07);
}
.mq-life-item.active
.mq-life-icon {
background:
rgba(255,255,255,.14);
}
.mq-life-icon svg {
width: 16px;
height: 16px;
fill: none;
stroke: currentColor;
stroke-width: 1.9;
stroke-linecap: round;
stroke-linejoin: round;
}
/* ============================================================
LOGOUT
============================================================ */
.mq-sidebar-bottom {
margin-top: auto;
}
.mq-logout {
min-height: 43px;
padding:
0
13px;
border-radius: 10px;
display: flex;
align-items: center;
gap: 9px;
color:
rgba(255,255,255,.65);
font-size: 10px;
font-weight: 700;
cursor: pointer;
}
.mq-logout:hover {
color: #fff;
background:
rgba(255,255,255,.07);
}
/* ============================================================
MAIN
============================================================ */
.mq-main {
grid-column: 1;
height: 100vh;
direction: rtl;
overflow-y: auto;
padding:
0
clamp(25px,4vw,55px)
45px;
}
/* ============================================================
HEADER
============================================================ */
.mq-header {
min-height: 88px;
border-bottom:
1px solid
var(--border);
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
}
.mq-header-right {
min-width: 0;
}
.mq-page-title {
color:
var(--navy);
font-size: 20px;
font-weight: 900;
}
.mq-page-description {
margin-top: 6px;
color:
var(--muted);
font-size: 10px;
font-weight: 600;
}
/* CENTER */
.mq-center {
padding:
10px
14px;
border:
1px solid
var(--border);
border-radius: 11px;
background: #fff;
color:
#536f84;
font-size: 10px;
font-weight: 700;
}
/* ============================================================
BREADCRUMB
============================================================ */
.mq-breadcrumb {
min-height: 54px;
display: flex;
align-items: center;
gap: 7px;
flex-wrap: wrap;
}
.mq-bread-item {
color:
#8197a8;
font-size: 10px;
font-weight: 700;
}
.mq-bread-current {
color:
var(--primary-dark);
font-weight: 900;
}
.mq-bread-separator {
color:
#b6c4cf;
}
/* ============================================================
HERO
============================================================ */
.mq-hero {
position: relative;
overflow: hidden;
min-height: 112px;
padding:
21px
24px;
border-radius: 18px;
color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
background:
linear-gradient(
105deg,
#073b5c,
#087c7d
);
box-shadow:
0 15px 35px
rgba(7,53,83,.10);
}
.mq-hero::before {
content: "";
position: absolute;
width: 250px;
height: 250px;
left: -70px;
top: -150px;
border-radius: 50%;
background:
rgba(16,222,205,.14);
}
.mq-hero-title {
position: relative;
z-index: 2;
font-size: 16px;
font-weight: 900;
}
.mq-hero-desc {
position: relative;
z-index: 2;
margin-top: 6px;
color:
rgba(255,255,255,.70);
font-size: 10px;
}
.mq-back-btn {
position: relative;
z-index: 2;
display: none;
min-width: 88px;
height: 36px;
padding:
0
13px;
border:
1px solid
rgba(255,255,255,.25);
border-radius: 10px;
background:
rgba(255,255,255,.10);
color: #fff;
font-family:
inherit;
font-size: 10px;
font-weight: 800;
cursor: pointer;
}
.mq-back-btn:hover {
background:
rgba(255,255,255,.16);
}
/* ============================================================
CONTENT
============================================================ */
.mq-view {
margin-top: 23px;
animation:
mqFade
.22s ease;
}
@keyframes mqFade {
from {
opacity: 0;
transform: translateY(5px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* ============================================================
SECTION HEADER
============================================================ */
.mq-section-head {
margin-bottom: 14px;
display: flex;
align-items: center;
justify-content: space-between;
}
.mq-section-title {
color:
var(--navy);
font-size: 14px;
font-weight: 900;
}
.mq-section-desc {
margin-top: 4px;
color:
var(--muted);
font-size: 9px;
}
/* ============================================================
MODULE CARDS
============================================================ */
.mq-card-grid {
display: grid;
grid-template-columns:
repeat(4,minmax(0,1fr));
gap: 14px;
}
.mq-module-card {
position: relative;
min-height: 176px;
padding:
18px;
border:
1px solid
var(--border);
border-radius: 17px;
background: #fff;
cursor: pointer;
box-shadow:
0 9px 26px
rgba(19,65,90,.035);
transition:
transform .17s ease,
box-shadow .17s ease,
border-color .17s ease;
}
.mq-module-card:hover {
transform:
translateY(-4px);
border-color:
rgba(8,185,176,.45);
box-shadow:
0 18px 40px
rgba(19,65,90,.08);
}
.mq-module-icon {
width: 48px;
height: 48px;
margin-bottom: 17px;
border-radius: 14px;
display: flex;
align-items: center;
justify-content: center;
color:
var(--primary-dark);
background:
linear-gradient(
145deg,
#e9fbf9,
#d9f7f3
);
}
.mq-module-icon svg {
width: 24px;
height: 24px;
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
.mq-module-name {
color:
var(--navy);
font-size: 12px;
font-weight: 900;
line-height: 1.8;
}
.mq-module-arrow {
position: absolute;
left: 18px;
bottom: 17px;
width: 29px;
height: 29px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
color:
#8ea5b5;
background:
#f3f7f9;
font-size: 18px;
}
.mq-module-card:hover
.mq-module-arrow {
color: #fff;
background:
var(--primary);
}
/* ============================================================
LARGE ACTION CARDS
============================================================ */
.mq-action-grid {
display: grid;
grid-template-columns:
repeat(2,minmax(0,1fr));
gap: 15px;
}
.mq-action-card {
min-height: 155px;
padding:
19px;
border:
1px solid
var(--border);
border-radius: 17px;
background: #fff;
cursor: pointer;
display: flex;
align-items: center;
gap: 16px;
transition: .17s;
}
.mq-action-card:hover {
border-color:
rgba(8,185,176,.45);
transform:
translateY(-2px);
box-shadow:
0 15px 35px
rgba(24,74,98,.06);
}
.mq-action-icon {
flex: 0 0 auto;
width: 54px;
height: 54px;
border-radius: 15px;
display: flex;
align-items: center;
justify-content: center;
color:
var(--primary-dark);
background:
#e7faf8;
}
.mq-action-icon svg {
width: 25px;
height: 25px;
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
.mq-action-title {
color:
var(--navy);
font-size: 13px;
font-weight: 900;
}
.mq-action-sub {
margin-top: 6px;
color:
var(--muted);
font-size: 9px;
}
/* ============================================================
ASSET LIST MENU
============================================================ */
.mq-list-layout {
display: grid;
grid-template-columns:
330px
minmax(0,1fr);
gap: 16px;
direction: ltr;
}
.mq-list-menu,
.mq-preview {
direction: rtl;
border:
1px solid
var(--border);
border-radius: 18px;
background: #fff;
box-shadow:
0 10px 28px
rgba(19,65,90,.035);
}
.mq-list-menu {
padding: 13px;
}
.mq-list-option {
min-height: 52px;
margin-bottom: 5px;
padding:
0
13px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: space-between;
color:
#536f84;
font-size: 10px;
font-weight: 800;
cursor: pointer;
transition: .15s;
}
.mq-list-option:hover {
color:
var(--primary-dark);
background:
#f1faf9;
}
.mq-list-option.active {
color:
#087f7a;
background:
#e9f9f7;
}
.mq-option-badge {
width: 26px;
height: 26px;
border-radius: 7px;
display: flex;
align-items: center;
justify-content: center;
background:
rgba(8,185,176,.09);
color:
var(--primary-dark);
}
/* ============================================================
PREVIEW
============================================================ */
.mq-preview {
min-height: 390px;
padding:
23px;
}
.mq-preview-title {
color:
var(--navy);
font-size: 14px;
font-weight: 900;
}
.mq-preview-description {
margin-top: 7px;
color:
var(--muted);
font-size: 9px;
}
/* MOCK CONTENT */
.mq-demo-box {
margin-top: 23px;
padding: 20px;
border:
1px dashed
#bdd4df;
border-radius: 14px;
background:
#f8fbfc;
}
.mq-demo-icon {
width: 48px;
height: 48px;
margin:
0
auto
12px;
border-radius: 14px;
display: flex;
align-items: center;
justify-content: center;
color:
var(--primary-dark);
background:
#e6f9f7;
}
.mq-demo-text {
color:
#557287;
text-align: center;
font-size: 10px;
line-height: 2;
}
.mq-demo-button {
display: block;
min-width: 125px;
height: 38px;
margin:
17px
auto
0;
border: 0;
border-radius: 9px;
background:
linear-gradient(
90deg,
#08aaa4,
#0bc1b8
);
color: #fff;
font-family: inherit;
font-size: 10px;
font-weight: 800;
cursor: pointer;
}
/* ============================================================
PLACEHOLDER LIFE CYCLE
============================================================ */
.mq-empty-cycle {
min-height: 350px;
border:
1px dashed
#c7dce5;
border-radius: 18px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background:
rgba(255,255,255,.65);
color:
#7890a2;
}
.mq-empty-cycle strong {
color:
var(--navy);
font-size: 15px;
}
.mq-empty-cycle span {
margin-top: 8px;
font-size: 10px;
}
/* ============================================================
TOAST
============================================================ */
.mq-toast {
position: fixed;
left: 30px;
bottom: 27px;
z-index: 10020;
min-width: 260px;
max-width: 360px;
padding:
13px
16px;
border-radius: 11px;
color: #fff;
background:
#073b5c;
box-shadow:
0 16px 40px
rgba(0,0,0,.15);
font-size: 10px;
font-weight: 700;
opacity: 0;
transform:
translateY(12px);
pointer-events: none;
transition:
.2s;
}
.mq-toast.show {
opacity: 1;
transform:
translateY(0);
}
/* ============================================================
RESPONSIVE
============================================================ */
@media(max-width:1300px) {
.mq-card-grid {
grid-template-columns:
repeat(2,minmax(0,1fr));
}
}
@media(max-width:1000px) {
.mq-app {
grid-template-columns:
minmax(0,1fr)
210px;
}
.mq-list-layout {
grid-template-columns:
280px
minmax(0,1fr);
}
}
@media(max-width:800px) {
.mq-sidebar {
display: none;
}
.mq-app {
display: block;
}
.mq-main {
width: 100%;
}
.mq-card-grid,
.mq-action-grid,
.mq-list-layout {
grid-template-columns:
1fr;
}
}
/* ============================================================
MEDIQ SIDEBAR NAVIGATION TREE
============================================================ */
.mq-life-title,
.mq-life {
display: none !important;
}
.mq-tree-title {
margin: 22px 7px 9px;
color: rgba(255,255,255,.39);
font-size: 9px;
font-weight: 700;
}
.mq-tree {
display: flex;
flex-direction: column;
gap: 5px;
overflow-y: auto;
overflow-x: hidden;
padding-left: 2px;
scrollbar-width: thin;
}
.mq-tree::-webkit-scrollbar {
width: 4px;
}
.mq-tree::-webkit-scrollbar-thumb {
background: rgba(255,255,255,.15);
border-radius: 10px;
}
.mq-tree-row {
min-height: 38px;
padding: 0 10px;
border-radius: 9px;
display: flex;
align-items: center;
gap: 8px;
color: rgba(255,255,255,.70);
font-size: 10px;
font-weight: 800;
cursor: pointer;
user-select: none;
transition: background .15s ease, color .15s ease;
}
.mq-tree-row:hover {
color: #fff;
background: rgba(255,255,255,.07);
}
.mq-tree-row.active {
color: #fff;
background: linear-gradient(90deg,#08b9b0,#079e99);
}
.mq-tree-row.parent-active:not(.active) {
color: #fff;
background: rgba(255,255,255,.055);
}
.mq-tree-row.level-1 { padding-right: 10px; }
.mq-tree-row.level-2 { padding-right: 23px; font-size: 9.5px; }
.mq-tree-row.level-3 { padding-right: 36px; font-size: 9px; }
.mq-tree-row.level-4 { padding-right: 49px; font-size: 8.7px; color: rgba(255,255,255,.60); }
.mq-tree-dot {
width: 6px;
height: 6px;
flex: 0 0 6px;
border-radius: 50%;
background: rgba(255,255,255,.32);
}
.mq-tree-row.active .mq-tree-dot {
background: #fff;
}
.mq-tree-arrow {
margin-right: auto;
color: rgba(255,255,255,.45);
font-size: 13px;
transition: transform .18s ease;
}
.mq-tree-row.open > .mq-tree-arrow {
transform: rotate(90deg);
}
.mq-tree-children {
display: none;
margin-top: 2px;
}
.mq-tree-children.open {
display: block;
}
.mq-tree-separator {
height: 1px;
margin: 8px 9px;
background: rgba(255,255,255,.08);
}
/* ============================================================
MEDIQ UI POLISH - LARGER TYPOGRAPHY + TOP WELCOME
============================================================ */
#mediq-dashboard .mq-user-name { font-size: 15px; }
#mediq-dashboard .mq-user-role { font-size: 12px; }
#mediq-dashboard .mq-tree-title { font-size: 12px; }
#mediq-dashboard .mq-tree-row { font-size: 13px; min-height: 42px; }
#mediq-dashboard .mq-tree-row.level-2 { font-size: 12.5px; }
#mediq-dashboard .mq-tree-row.level-3 { font-size: 12px; }
#mediq-dashboard .mq-tree-row.level-4 { font-size: 11.7px; }
#mediq-dashboard .mq-logout { font-size: 13px; }
#mediq-dashboard .mq-page-title { font-size: 23px; }
#mediq-dashboard .mq-page-description { font-size: 13px; }
#mediq-dashboard .mq-center { font-size: 13px; }
#mediq-dashboard .mq-bread-item { font-size: 13px; }
#mediq-dashboard .mq-hero-title { font-size: 19px; }
#mediq-dashboard .mq-hero-desc { font-size: 13px; }
#mediq-dashboard .mq-back-btn { font-size: 13px; }
#mediq-dashboard .mq-section-title { font-size: 17px; }
#mediq-dashboard .mq-section-desc { font-size: 12px; }
#mediq-dashboard .mq-module-name { font-size: 15px; }
#mediq-dashboard .mq-action-title { font-size: 16px; }
#mediq-dashboard .mq-action-sub { font-size: 12px; }
#mediq-dashboard .mq-list-option { font-size: 13px; }
#mediq-dashboard .mq-preview-title { font-size: 17px; }
#mediq-dashboard .mq-preview-description,
#mediq-dashboard .mq-demo-text { font-size: 12px; }
#mediq-dashboard .mq-demo-button { font-size: 13px; }
#mediq-dashboard .mq-empty-cycle strong { font-size: 18px; }
#mediq-dashboard .mq-empty-cycle span { font-size: 13px; }
#mediq-dashboard .mq-toast { font-size: 13px; }
#mediq-dashboard .mq-header-welcome {
display:flex; align-items:center; gap:9px; padding:9px 14px;
border:1px solid rgba(8,185,176,.20); border-radius:999px;
background:rgba(255,255,255,.82); box-shadow:0 7px 22px rgba(7,53,83,.055);
color:#587287; font-size:13px; font-weight:700; white-space:nowrap;
}
#mediq-dashboard .mq-header-welcome strong { color:var(--navy); font-size:14px; font-weight:900; }
#mediq-dashboard .mq-welcome-dot { width:8px; height:8px; border-radius:50%; background:var(--primary); box-shadow:0 0 0 4px rgba(8,185,176,.10); }
#mediq-dashboard .mq-header-left { display:flex; align-items:center; gap:10px; }
#mediq-dashboard .mq-module-card { box-shadow:0 10px 30px rgba(19,65,90,.05); }
#mediq-dashboard .mq-module-card:hover { transform:translateY(-5px); box-shadow:0 20px 45px rgba(19,65,90,.10); }
#mediq-dashboard .mq-hero { box-shadow:0 18px 42px rgba(7,53,83,.12); }
/* ===== FINAL UI REFINEMENTS ===== */
#mediq-dashboard .mq-header { min-height: 92px; }
#mediq-dashboard .mq-header-left { margin-right:auto; }
#mediq-dashboard .mq-header-welcome { padding:10px 16px; }
#mediq-dashboard .mq-breadcrumb { min-height:46px; }
#mediq-dashboard .mq-hero { margin-top:14px; }
#mediq-dashboard .mq-tree { scrollbar-width:none; -ms-overflow-style:none; }
#mediq-dashboard .mq-tree::-webkit-scrollbar { display:none !important; width:0 !important; }
#mediq-dashboard .mq-sidebar { overflow:hidden; }
#mediq-dashboard .mq-bread-link {
cursor: pointer;
transition: color .15s ease, background .15s ease;
border-radius: 7px;
padding: 4px 6px;
}
#mediq-dashboard .mq-bread-link:hover {
color: var(--primary) !important;
background: rgba(8,185,176,.08);
}
/* MEDIQ -> CONFIFORMS BRIDGE */
.confiforms-registration-control {
position: fixed !important;
left: -10000px !important;
top: -10000px !important;
width: 1px !important;
height: 1px !important;
overflow: hidden !important;
opacity: 0 !important;
pointer-events: auto !important;
}
/* ============================================================
MEDIQ CONFIFORMS MODAL
============================================================ */
#mqCfModal {
position: fixed;
inset: 0;
z-index: 10050;
display: none;
align-items: center;
justify-content: center;
padding: 24px;
background: rgba(3, 35, 55, .48);
backdrop-filter: blur(3px);
direction: rtl;
}
#mqCfModal.open { display: flex; }
#mqCfDialog {
width: min(620px, 94vw);
max-height: 88vh;
overflow: auto;
background: #fff;
border: 1px solid #dce9ef;
border-radius: 20px;
box-shadow: 0 28px 80px rgba(3,35,55,.24);
}
#mqCfHeader {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 18px 22px;
border-bottom: 1px solid #e4eef2;
}
#mqCfHeader strong {
color: #073553;
font-size: 16px;
font-weight: 900;
}
#mqCfClose {
width: 34px;
height: 34px;
border: 0;
border-radius: 9px;
background: #f1f6f8;
color: #557287;
font: 700 20px/34px Tahoma,Arial,sans-serif;
cursor: pointer;
}
#mqCfClose:hover { background: #e6f4f4; color: #069e98; }
#mqCfBody { padding: 8px 18px 18px; }
/* The real ConfiForms registration panel is moved here at runtime */
#mqCfBody .confiFormsFormBorder {
width: 100% !important;
margin: 0 !important;
border: 0 !important;
box-shadow: none !important;
}
#mqCfBody .confiFormsFormTitle { display: none !important; }
#mqCfBody .confiFormsFormContent { padding: 16px 4px !important; }
#mqCfBody .confiFormsFormFooter {
padding: 14px 4px 4px !important;
background: transparent !important;
}
#mqCfBody table { width: 100% !important; }
#mqCfBody td {
border: 0 !important;
padding: 8px !important;
text-align: right !important;
}
#mqCfBody input[type="text"],
#mqCfBody input[type="password"],
#mqCfBody textarea,
#mqCfBody select {
width: 100% !important;
max-width: none !important;
min-width: 0 !important;
min-height: 40px;
border-radius: 9px !important;
direction: rtl;
}
#mqCfBody .entry_metadata_button,
#mqCfBody .entry_metadata { display: none !important; }
#mqCfBody .save-cf-btn {
min-width: 130px;
min-height: 40px;
border: 0 !important;
border-radius: 9px !important;
background: linear-gradient(90deg,#08aaa4,#0bc1b8) !important;
color: #fff !important;
font-family: inherit !important;
font-weight: 800 !important;
cursor: pointer;
}
/* ============================================================
MEDIQ - REAL PURCHASED ASSETS LIST (ConfiForms TableView)
============================================================ */
#mediq-dashboard .mq-assets-head {
margin-top: 18px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
#mediq-dashboard .mq-assets-actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
#mediq-dashboard .mq-assets-btn {
min-height: 38px;
padding: 0 15px;
border: 1px solid #d8e7ed;
border-radius: 9px;
background: #fff;
color: #47677d;
font-family: inherit;
font-size: 12px;
font-weight: 800;
cursor: pointer;
}
#mediq-dashboard .mq-assets-btn.primary {
border-color: transparent;
color: #fff;
background: linear-gradient(90deg,#08aaa4,#0bc1b8);
}
#mediq-dashboard .mq-assets-host {
margin-top: 14px;
min-height: 140px;
}
#mediq-dashboard .mq-assets-host > table,
#mediq-dashboard .mq-assets-host table {
width: 100% !important;
border-collapse: collapse !important;
direction: rtl !important;
background: #fff !important;
border: 1px solid #dce9ef !important;
border-radius: 12px !important;
overflow: hidden !important;
}
#mediq-dashboard .mq-assets-host th {
padding: 12px 14px !important;
text-align: right !important;
background: #f3f8fa !important;
color: #47677d !important;
border-bottom: 1px solid #dce9ef !important;
font-size: 12px !important;
font-weight: 900 !important;
}
#mediq-dashboard .mq-assets-host td {
padding: 12px 14px !important;
text-align: right !important;
color: #294e68 !important;
border-bottom: 1px solid #edf3f6 !important;
font-size: 12px !important;
font-weight: 700 !important;
}
#mediq-dashboard .mq-assets-message {
min-height: 140px;
display: flex;
align-items: center;
justify-content: center;
padding: 22px;
border: 1px dashed #c5dce5;
border-radius: 12px;
background: #f8fbfc;
color: #6f8799;
text-align: center;
font-size: 12px;
font-weight: 700;
}
/* ConfiForms delete proxy inside MediQ */
#mediq-dashboard .mq-cf-delete-proxy {
display: inline-flex !important;
align-items: center;
justify-content: center;
min-width: 58px;
min-height: 30px;
padding: 0 10px !important;
border: 1px solid #f1c9c9 !important;
border-radius: 8px !important;
background: #fff7f7 !important;
color: #b42318 !important;
text-decoration: none !important;
font-family: inherit !important;
font-size: 11px !important;
font-weight: 800 !important;
cursor: pointer !important;
}
#mediq-dashboard .mq-cf-delete-proxy:hover {
background: #ffeded !important;
border-color: #e8aaaa !important;
}
#mediq-dashboard .mq-cf-edit-proxy {
min-width: 50px !important;
height: 28px !important;
padding: 0 11px !important;
margin-left: 6px !important;
border: 1px solid rgba(8,185,176,.30) !important;
border-radius: 8px !important;
background: #effaf9 !important;
color: #078d87 !important;
font-family: inherit !important;
font-size: 11px !important;
font-weight: 800 !important;
cursor: pointer !important;
text-decoration: none !important;
}
#mediq-dashboard .mq-cf-edit-proxy:hover {
background: #dff7f4 !important;
border-color: rgba(8,185,176,.55) !important;
}
/* ============================================================
DEDICATED EDIT ASSET WORKSPACE
============================================================ */
#mediq-dashboard .mq-edit-wrap {
border: 1px solid var(--border);
border-radius: 18px;
background: #fff;
padding: 24px;
box-shadow: 0 10px 28px rgba(19,65,90,.035);
}
#mediq-dashboard .mq-edit-toolbar {
margin-top: 18px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
#mediq-dashboard .mq-edit-search {
width: min(390px, 100%);
min-height: 40px;
padding: 0 14px;
border: 1px solid #d8e7ed;
border-radius: 10px;
outline: none;
background: #fff;
color: #294e68;
direction: rtl;
font-family: inherit;
font-size: 12px;
font-weight: 700;
}
#mediq-dashboard .mq-edit-search:focus {
border-color: rgba(8,185,176,.65);
box-shadow: 0 0 0 3px rgba(8,185,176,.08);
}
#mediq-dashboard .mq-edit-help {
color: #71899a;
font-size: 12px;
font-weight: 700;
}
#mediq-dashboard .mq-edit-host {
margin-top: 14px;
}
#mediq-dashboard .mq-edit-host table {
width: 100% !important;
border-collapse: collapse !important;
direction: rtl !important;
background: #fff !important;
border: 1px solid #dce9ef !important;
}
#mediq-dashboard .mq-edit-host th {
padding: 12px 14px !important;
text-align: right !important;
background: #f3f8fa !important;
color: #47677d !important;
border-bottom: 1px solid #dce9ef !important;
font-size: 12px !important;
font-weight: 900 !important;
}
#mediq-dashboard .mq-edit-host td {
padding: 12px 14px !important;
text-align: right !important;
color: #294e68 !important;
border-bottom: 1px solid #edf3f6 !important;
font-size: 12px !important;
font-weight: 700 !important;
}
/* Keep ConfiForms/AUI edit dialogs above the full-screen MediQ shell */
.aui-blanket {
z-index: 10060 !important;
}
.aui-dialog,
.aui-dialog2,
.aui-dialog2[open],
.aui-dialog2[aria-hidden="false"] {
z-index: 10070 !important;
}
/* ============================================================
MEDIQ - SECTIONED CONFIFORMS + MODEL QUICK CREATE
============================================================ */
#mqCfDialog { width:min(780px,96vw); }
#mqModelModal {
position:fixed; inset:0; z-index:10080; display:none;
align-items:center; justify-content:center; padding:24px;
background:rgba(3,35,55,.58); backdrop-filter:blur(4px); direction:rtl;
}
#mqModelModal.open { display:flex; }
#mqModelDialog {
width:min(800px,96vw); max-height:90vh; overflow:auto;
background:#fff; border:1px solid #dce9ef; border-radius:20px;
box-shadow:0 30px 90px rgba(3,35,55,.28);
}
#mqModelHeader {
display:flex; align-items:center; justify-content:space-between; gap:16px;
padding:18px 22px; border-bottom:1px solid #e4eef2;
}
#mqModelHeader strong { color:#073553; font-size:16px; font-weight:900; }
#mqModelClose {
width:34px; height:34px; border:0; border-radius:9px;
background:#f1f6f8; color:#557287; font:700 20px/34px Tahoma,Arial,sans-serif; cursor:pointer;
}
#mqModelClose:hover { background:#e6f4f4; color:#069e98; }
#mqModelBody { padding:8px 18px 18px; }
#mqModelBody .confiFormsFormBorder {
width:100%!important; margin:0!important; border:0!important; box-shadow:none!important;
}
#mqModelBody .confiFormsFormTitle { display:none!important; }
#mqModelBody .confiFormsFormContent { padding:16px 4px!important; }
#mqModelBody .confiFormsFormFooter { padding:14px 4px 4px!important; background:transparent!important; }
#mqModelBody table { width:100%!important; }
#mqModelBody td { border:0!important; padding:8px!important; text-align:right!important; }
#mqModelBody input[type="text"],
#mqModelBody input[type="password"],
#mqModelBody textarea,
#mqModelBody select {
width:100%!important; max-width:none!important; min-width:0!important;
min-height:40px; border-radius:9px!important; direction:rtl;
}
#mqModelBody .save-cf-btn {
min-width:130px; min-height:40px; border:0!important; border-radius:9px!important;
background:linear-gradient(90deg,#08aaa4,#0bc1b8)!important;
color:#fff!important; font-family:inherit!important; font-weight:800!important; cursor:pointer;
}
#mqCfBody .mq-form-section-row td,
#mqModelBody .mq-form-section-row td {
padding:15px 8px 7px!important;
}
#mqCfBody .mq-form-section-title,
#mqModelBody .mq-form-section-title {
display:flex; align-items:center; gap:9px; color:#073553;
font-size:13px; font-weight:900; padding-bottom:8px;
border-bottom:1px solid #e5eef2;
}
#mqCfBody .mq-form-section-title::before,
#mqModelBody .mq-form-section-title::before {
content:""; width:7px; height:7px; border-radius:50%; background:#08b9b0;
box-shadow:0 0 0 4px rgba(8,185,176,.10);
}
#mqCfBody tr.mq-system-field,
#mqModelBody tr.mq-system-field { display:none!important; }
.mq-device-model-wrap {
display:flex!important; align-items:center!important; gap:8px!important; width:100%!important;
}
.mq-device-model-wrap > .select2-container,
.mq-device-model-wrap > select,
.mq-device-model-wrap > input {
flex:1 1 auto!important; width:auto!important; min-width:0!important;
}
.mq-model-plus {
flex:0 0 40px; width:40px; height:40px; min-width:40px; margin:0!important; padding:0!important;
border:1px solid rgba(8,185,176,.35); border-radius:10px;
background:#eafaf8; color:#078f89; font:900 22px/38px Tahoma,Arial,sans-serif;
cursor:pointer; vertical-align:top; text-align:center;
}
.mq-model-plus:hover { background:#08b9b0; color:#fff; }
.mq-model-field-cell { white-space:normal!important; }
/* Keep Select2 / AUI dropdowns above both MediQ modals while open. */
.select2-drop,
.select2-dropdown,
.aui-select2-drop { z-index:10120!important; }
/* ============================================================
MEDIQ - CONFIFORMS / AUI DATE PICKER FIX
Keeps Confluence/AUI calendar above MediQ modal
============================================================ */
#ui-datepicker-div,
.ui-datepicker,
.aui-datepicker,
.aui-datepicker-dialog,
.aui-datepicker-dialog .ui-datepicker,
.aui-inline-dialog {
z-index: 2147483000 !important;
}
/* Some Confluence/Team Calendars installations override this. */
.aui-inline-dialog .ui-datepicker,
.aui-datepicker-dialog .ui-datepicker {
position: relative !important;
}
/* Calendar should never be clipped visually by the MediQ shell. */
body > #ui-datepicker-div,
body > .aui-datepicker-dialog,
body > .aui-inline-dialog {
z-index: 2147483000 !important;
}
</style>
<div class="mq-app">
<!-- =====================================================
MAIN
===================================================== -->
<main class="mq-main">
<!-- HEADER -->
<header class="mq-header">
<div class="mq-header-right">
<div
id="mqPageTitle"
class="mq-page-title"
>
تأمین
</div>
<div
id="mqPageDesc"
class="mq-page-description"
>
مدیریت فرآیند تأمین تجهیزات پزشکی
</div>
</div>
<div class="mq-header-left">
<div class="mq-header-welcome">
<span class="mq-welcome-dot"></span>
<strong id="mqWelcomeUser">کاربر مدیکیو</strong>
<span>خوش آمدید</span>
</div>
</div>
</header>
<!-- HERO -->
<section class="mq-hero">
<div>
<div
id="mqHeroTitle"
class="mq-hero-title"
>
مدیریت تجهیزات
</div>
<div
id="mqHeroDesc"
class="mq-hero-desc"
>
بخش موردنظر خود را انتخاب کنید.
</div>
</div>
<button
id="mqBack"
class="mq-back-btn"
type="button"
>
بازگشت
</button>
</section>
<!-- BREADCRUMB -->
<div
id="mqBreadcrumb"
class="mq-breadcrumb"
></div>
<!-- DYNAMIC VIEW -->
<div
id="mqView"
class="mq-view"
></div>
</main>
<!-- =====================================================
SIDEBAR
===================================================== -->
<aside class="mq-sidebar">
<div class="mq-logo">
<img
src="/download/attachments/174855060/MediQ%20Heart%20Medical%20Logo.png"
alt="MediQ"
>
</div>
<div class="mq-life-title">
چرخه عمر تجهیزات
</div>
<div class="mq-life">
<div
class="mq-life-item active"
data-cycle="supply"
>
<div class="mq-life-icon">
<svg viewBox="0 0 24 24">
<path d="M4 7h16"></path>
<path d="M6 7l1 13h10l1-13"></path>
<path d="M9 4h6"></path>
</svg>
</div>
تأمین
</div>
<div
class="mq-life-item"
data-cycle="operation"
>
<div class="mq-life-icon">
<svg viewBox="0 0 24 24">
<circle
cx="12"
cy="12"
r="3"
></circle>
<path d="M12 3v3"></path>
<path d="M12 18v3"></path>
<path d="M3 12h3"></path>
<path d="M18 12h3"></path>
</svg>
</div>
بهرهبرداری
</div>
<div
class="mq-life-item"
data-cycle="replacement"
>
<div class="mq-life-icon">
<svg viewBox="0 0 24 24">
<path d="M4 7h11"></path>
<path d="M12 4l3 3-3 3"></path>
<path d="M20 17H9"></path>
<path d="M12 14l-3 3 3 3"></path>
</svg>
</div>
جایگزینی
</div>
<div
class="mq-life-item"
data-cycle="maintenance"
>
<div class="mq-life-icon">
<svg viewBox="0 0 24 24">
<path
d="M14 6a4 4 0 0 0 4 4l-8 8-4-4 8-8z"
></path>
</svg>
</div>
نگهداری
</div>
</div>
<!-- MEDIQ NAVIGATION TREE -->
<div class="mq-tree-title">ساختار تأمین</div>
<div class="mq-tree" id="mqTree">
<div class="mq-tree-row level-1 active" data-tree-action="equipment" data-tree-key="equipment">
<span class="mq-tree-dot"></span>
<span>مدیریت تجهیزات</span>
<span class="mq-tree-arrow">‹</span>
</div>
<div class="mq-tree-children open" data-tree-group="equipment">
<div class="mq-tree-row level-2" data-tree-action="property" data-tree-key="property">
<span class="mq-tree-dot"></span>
<span>مدیریت اموال</span>
</div>
<div class="mq-tree-row level-2" data-tree-action="equipmentMaintenance" data-tree-key="equipmentMaintenance">
<span class="mq-tree-dot"></span>
<span>مدیریت نگهداری و تعمیر</span>
</div>
<div class="mq-tree-row level-2" data-tree-action="finance" data-tree-key="finance">
<span class="mq-tree-dot"></span>
<span>مدیریت مالی و بهرهوری</span>
</div>
<div class="mq-tree-row level-2" data-tree-action="logistics" data-tree-key="logistics">
<span class="mq-tree-dot"></span>
<span>مدیریت تأمین و لجستیک</span>
<span class="mq-tree-arrow">‹</span>
</div>
<div class="mq-tree-children" data-tree-group="logistics">
<div class="mq-tree-row level-3" data-tree-action="purchase" data-tree-key="purchase">
<span class="mq-tree-dot"></span>
<span>خرید دارایی</span>
</div>
<div class="mq-tree-row level-3" data-tree-action="newAsset" data-tree-key="newAsset">
<span class="mq-tree-dot"></span>
<span>ورود دارایی جدید</span>
<span class="mq-tree-arrow">‹</span>
</div>
<div class="mq-tree-children" data-tree-group="newAsset">
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="newAsset" data-section="purchased" data-tree-key="newAsset-purchased"><span class="mq-tree-dot"></span><span>لیست داراییها</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="newAsset" data-section="technical" data-tree-key="newAsset-technical"><span class="mq-tree-dot"></span><span>شناسنامه فنی</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="newAsset" data-section="financial" data-tree-key="newAsset-financial"><span class="mq-tree-dot"></span><span>شناسنامه مالی</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="newAsset" data-section="maintenance" data-tree-key="newAsset-maintenance"><span class="mq-tree-dot"></span><span>شناسنامه نگهداری و تعمیر</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="newAsset" data-section="commercial" data-tree-key="newAsset-commercial"><span class="mq-tree-dot"></span><span>شناسنامه بازرگانی</span></div>
</div>
<div class="mq-tree-row level-3" data-tree-action="editAsset" data-tree-key="editAsset">
<span class="mq-tree-dot"></span>
<span>ویرایش دارایی</span>
<span class="mq-tree-arrow">‹</span>
</div>
<div class="mq-tree-children" data-tree-group="editAsset">
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="editAsset" data-section="purchased" data-tree-key="editAsset-purchased"><span class="mq-tree-dot"></span><span>لیست داراییها</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="editAsset" data-section="technical" data-tree-key="editAsset-technical"><span class="mq-tree-dot"></span><span>شناسنامه فنی</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="editAsset" data-section="financial" data-tree-key="editAsset-financial"><span class="mq-tree-dot"></span><span>شناسنامه مالی</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="editAsset" data-section="maintenance" data-tree-key="editAsset-maintenance"><span class="mq-tree-dot"></span><span>شناسنامه نگهداری و تعمیر</span></div>
<div class="mq-tree-row level-4" data-tree-action="section" data-mode="editAsset" data-section="commercial" data-tree-key="editAsset-commercial"><span class="mq-tree-dot"></span><span>شناسنامه بازرگانی</span></div>
</div>
<div class="mq-tree-row level-3" data-tree-action="consumable" data-tree-key="consumable">
<span class="mq-tree-dot"></span>
<span>کالاهای مصرفی</span>
</div>
</div>
</div>
<div class="mq-tree-separator"></div>
<div class="mq-tree-row level-1" data-tree-action="cycle" data-cycle="operation" data-tree-key="operation">
<span class="mq-tree-dot"></span><span>بهرهبرداری</span>
</div>
<div class="mq-tree-row level-1" data-tree-action="cycle" data-cycle="replacement" data-tree-key="replacement">
<span class="mq-tree-dot"></span><span>جایگزینی</span>
</div>
<div class="mq-tree-row level-1" data-tree-action="cycle" data-cycle="maintenance" data-tree-key="maintenanceCycle">
<span class="mq-tree-dot"></span><span>نگهداری</span>
</div>
</div>
<div class="mq-sidebar-bottom">
<div
id="mqLogout"
class="mq-logout"
>
خروج از حساب کاربری
</div>
</div>
</aside>
</div>
<!-- MEDIQ CONFIFORMS MODAL -->
<div id="mqCfModal" aria-hidden="true">
<div id="mqCfDialog" role="dialog" aria-modal="true" aria-labelledby="mqCfTitle">
<div id="mqCfHeader">
<strong id="mqCfTitle">ثبت دارایی جدید</strong>
<button id="mqCfClose" type="button" aria-label="بستن">×</button>
</div>
<div id="mqCfBody"></div>
</div>
</div>
<!-- MEDIQ NEW MODEL MODAL -->
<div id="mqModelModal" aria-hidden="true">
<div id="mqModelDialog" role="dialog" aria-modal="true" aria-labelledby="mqModelTitle">
<div id="mqModelHeader">
<strong id="mqModelTitle">ثبت مدل جدید</strong>
<button id="mqModelClose" type="button" aria-label="بستن">×</button>
</div>
<div id="mqModelBody"></div>
</div>
</div>
<div
id="mqToast"
class="mq-toast"
></div>
<script>
(function () {
"use strict";
/* ============================================================
STATE
============================================================ */
var state = {
cycle:
"supply",
screen:
"equipment",
selectedAssetSection:
"purchased"
};
/* ============================================================
ELEMENTS
============================================================ */
var view =
document.getElementById(
"mqView"
);
var breadcrumb =
document.getElementById(
"mqBreadcrumb"
);
var heroTitle =
document.getElementById(
"mqHeroTitle"
);
var heroDesc =
document.getElementById(
"mqHeroDesc"
);
var backButton =
document.getElementById(
"mqBack"
);
var pageTitle =
document.getElementById(
"mqPageTitle"
);
var pageDesc =
document.getElementById(
"mqPageDesc"
);
var toast =
document.getElementById(
"mqToast"
);
/* ============================================================
ICONS
============================================================ */
var ICONS = {
property:
'<path d="M12 3l7 4-7 4-7-4 7-4z"></path>' +
'<path d="M5 7v9l7 4 7-4V7"></path>' +
'<path d="M12 11v9"></path>',
maintenance:
'<circle cx="12" cy="12" r="3"></circle>' +
'<path d="M12 2v3"></path>' +
'<path d="M12 19v3"></path>' +
'<path d="M2 12h3"></path>' +
'<path d="M19 12h3"></path>',
finance:
'<circle cx="12" cy="12" r="9"></circle>' +
'<path d="M8 12h8"></path>' +
'<path d="M12 8v8"></path>',
supply:
'<path d="M4 7h16"></path>' +
'<path d="M6 7l1 13h10l1-13"></path>' +
'<path d="M9 4h6"></path>',
purchase:
'<path d="M4 5h2l2 11h9l2-7H8"></path>' +
'<circle cx="10" cy="20" r="1"></circle>' +
'<circle cx="17" cy="20" r="1"></circle>',
newAsset:
'<path d="M12 3l7 4-7 4-7-4 7-4z"></path>' +
'<path d="M5 7v9l7 4 7-4V7"></path>' +
'<path d="M18 3v6"></path>' +
'<path d="M15 6h6"></path>',
edit:
'<path d="M4 20h4l11-11-4-4L4 16v4z"></path>' +
'<path d="M13 7l4 4"></path>',
consumable:
'<rect x="5" y="4" width="14" height="16" rx="2"></rect>' +
'<path d="M8 9h8"></path>' +
'<path d="M8 13h8"></path>'
};
/* ============================================================
TOAST
============================================================ */
var toastTimer = null;
function showToast(message) {
if (!toast) {
return;
}
toast.textContent =
message;
toast.classList.add(
"show"
);
window.clearTimeout(
toastTimer
);
toastTimer =
window.setTimeout(
function () {
toast.classList.remove(
"show"
);
},
2200
);
}
/* ============================================================
BREADCRUMB
============================================================ */
function buildBreadcrumb(items) {
if (!breadcrumb) {
return;
}
var html = "";
items.forEach(function (item, index) {
var isLast = index === items.length - 1;
html +=
'<span class="' +
(isLast ? 'mq-bread-item mq-bread-current' : 'mq-bread-item mq-bread-link') +
'" data-bread-label="' + item + '">' +
item +
'</span>';
if (!isLast) {
html += '<span class="mq-bread-separator">/</span>';
}
});
breadcrumb.innerHTML = html;
var links = breadcrumb.querySelectorAll('.mq-bread-link');
for (var i = 0; i < links.length; i++) {
links[i].onclick = function () {
var label = this.getAttribute('data-bread-label');
if (label === 'تأمین' || label === 'مدیریت تجهیزات') {
renderEquipment();
}
else if (label === 'مدیریت تأمین و لجستیک') {
renderLogistics();
}
else if (label === 'ورود دارایی جدید') {
state.selectedAssetSection = 'purchased';
renderAssetSections('newAsset');
}
else if (label === 'ویرایش دارایی') {
renderEditAssetWorkspace();
}
};
}
}
/* ============================================================
CARD
============================================================ */
function moduleCard(
title,
icon,
action,
clickable
) {
return (
'<div class="mq-module-card" ' +
(
clickable
? 'data-action="' +
action +
'"'
: ''
) +
'>' +
'<div class="mq-module-icon">' +
'<svg viewBox="0 0 24 24">' +
icon +
'</svg>' +
'</div>' +
'<div class="mq-module-name">' +
title +
'</div>' +
(
clickable
? '<div class="mq-module-arrow">‹</div>'
: ''
) +
'</div>'
);
}
/* ============================================================
SCREEN : EQUIPMENT
============================================================ */
function renderEquipment() {
state.screen =
"equipment";
pageTitle.textContent =
"تأمین";
pageDesc.textContent =
"مدیریت فرآیند تأمین تجهیزات پزشکی";
heroTitle.textContent =
"مدیریت تجهیزات";
heroDesc.textContent =
"حوزه موردنظر را انتخاب کنید.";
backButton.style.display =
"none";
buildBreadcrumb(
[
"تأمین",
"مدیریت تجهیزات"
]
);
view.innerHTML =
'<div class="mq-section-head">' +
'<div>' +
'<div class="mq-section-title">' +
'مدیریت تجهیزات' +
'</div>' +
'<div class="mq-section-desc">' +
'یکی از حوزههای مدیریت تجهیزات را انتخاب کنید.' +
'</div>' +
'</div>' +
'</div>' +
'<div class="mq-card-grid">' +
moduleCard(
"مدیریت اموال",
ICONS.property,
"",
false
) +
moduleCard(
"مدیریت نگهداری و تعمیر",
ICONS.maintenance,
"",
false
) +
moduleCard(
"مدیریت مالی و بهرهوری",
ICONS.finance,
"",
false
) +
moduleCard(
"مدیریت تأمین و لجستیک",
ICONS.supply,
"logistics",
true
) +
'</div>';
bindActions();
mqTreeActivate("equipment");
}
/* ============================================================
SCREEN : LOGISTICS
============================================================ */
function renderLogistics() {
state.screen =
"logistics";
heroTitle.textContent =
"مدیریت تأمین و لجستیک";
heroDesc.textContent =
"عملیات موردنظر را انتخاب کنید.";
backButton.style.display =
"inline-block";
buildBreadcrumb(
[
"تأمین",
"مدیریت تجهیزات",
"مدیریت تأمین و لجستیک"
]
);
view.innerHTML =
'<div class="mq-section-head">' +
'<div>' +
'<div class="mq-section-title">' +
'مدیریت تأمین و لجستیک' +
'</div>' +
'<div class="mq-section-desc">' +
'عملیات مرتبط با تأمین و لجستیک تجهیزات' +
'</div>' +
'</div>' +
'</div>' +
'<div class="mq-action-grid">' +
actionCard(
"خرید دارایی",
"فرآیند خرید دارایی",
ICONS.purchase,
"purchase"
) +
actionCard(
"ورود دارایی جدید",
"ثبت و تکمیل اطلاعات دارایی جدید",
ICONS.newAsset,
"newAsset"
) +
actionCard(
"ویرایش دارایی",
"مشاهده و ویرایش اطلاعات دارایی موجود",
ICONS.edit,
"editAsset"
) +
actionCard(
"کالاهای مصرفی",
"مدیریت کالاهای مصرفی",
ICONS.consumable,
"consumable"
) +
'</div>';
bindActions();
mqTreeActivate("logistics");
}
function actionCard(
title,
subtitle,
icon,
action
) {
return (
'<div class="mq-action-card" data-action="' +
action +
'">' +
'<div class="mq-action-icon">' +
'<svg viewBox="0 0 24 24">' +
icon +
'</svg>' +
'</div>' +
'<div>' +
'<div class="mq-action-title">' +
title +
'</div>' +
'<div class="mq-action-sub">' +
subtitle +
'</div>' +
'</div>' +
'</div>'
);
}
/* ============================================================
ASSET SECTION SCREEN
============================================================ */
function renderAssetSections(mode) {
state.screen =
mode;
var isNew =
mode ===
"newAsset";
var title =
isNew
? "ورود دارایی جدید"
: "ویرایش دارایی موجود";
heroTitle.textContent =
title;
heroDesc.textContent =
isNew
? "اطلاعات موردنیاز برای ورود دارایی را انتخاب کنید."
: "بخش موردنظر برای ویرایش دارایی را انتخاب کنید.";
backButton.style.display =
"inline-block";
buildBreadcrumb(
[
"تأمین",
"مدیریت تجهیزات",
"مدیریت تأمین و لجستیک",
title
]
);
view.innerHTML =
'<div class="mq-list-layout">' +
'<div class="mq-list-menu">' +
listOption(
"purchased",
"لیست داراییها"
) +
listOption(
"technical",
"شناسنامه فنی"
) +
listOption(
"financial",
"شناسنامه مالی"
) +
listOption(
"maintenance",
"شناسنامه نگهداری و تعمیر"
) +
listOption(
"commercial",
"شناسنامه بازرگانی"
) +
'</div>' +
'<div class="mq-preview">' +
'<div id="mqPreviewContent"></div>' +
'</div>' +
'</div>';
bindSectionOptions();
renderPreview(
state.selectedAssetSection
);
mqTreeActivate(mode + "-" + state.selectedAssetSection);
}
function listOption(
key,
title
) {
return (
'<div ' +
'class="mq-list-option" ' +
'data-section="' +
key +
'">' +
'<span>' +
title +
'</span>' +
'<span class="mq-option-badge">' +
'‹' +
'</span>' +
'</div>'
);
}
/* ============================================================
PREVIEW CONTENT
============================================================ */
var SECTION_NAMES = {
purchased:
"لیست داراییها",
technical:
"شناسنامه فنی",
financial:
"شناسنامه مالی",
maintenance:
"شناسنامه نگهداری و تعمیر",
commercial:
"شناسنامه بازرگانی"
};
function mqFindConfiFormsTable() {
var tables = document.querySelectorAll("table");
for (var i = 0; i < tables.length; i++) {
var table = tables[i];
if (table.closest("#mediq-dashboard")) continue;
if (table.closest("#mqCfModal")) continue;
if (table.closest("form.aui-confiforms")) continue;
if (table.closest(".confiFormsFormBorder")) continue;
if (table.querySelectorAll("td").length >= 2) {
return table;
}
}
return null;
}
function mqFindDeleteControl(row) {
if (!row) return null;
var candidates = row.querySelectorAll('a, button, input[type="button"], input[type="submit"]');
for (var i = 0; i < candidates.length; i++) {
var el = candidates[i];
var text = ((el.textContent || el.value || '') + '').trim().toLowerCase();
var cls = ((el.className || '') + '').toLowerCase();
var title = ((el.getAttribute('title') || '') + '').toLowerCase();
if (text === 'delete' || text === 'حذف' || cls.indexOf('delete') >= 0 || title.indexOf('delete') >= 0) {
return el;
}
}
return null;
}
function mqFindEditControl(row) {
if (!row) return null;
var candidates = row.querySelectorAll('a, button, input[type="button"], input[type="submit"]');
for (var i = 0; i < candidates.length; i++) {
var el = candidates[i];
var text = ((el.textContent || el.value || '') + '').trim().toLowerCase();
var cls = ((el.className || '') + '').toLowerCase();
var title = ((el.getAttribute('title') || '') + '').toLowerCase();
if (text === 'edit' || text === 'ویرایش' || cls.indexOf('edit') >= 0 || title.indexOf('edit') >= 0) {
return el;
}
}
return null;
}
function mqExtractEntryId(deleteControl, row) {
function fromElement(el) {
if (!el) return "";
var directNames = [
"data-entry-id",
"data-entryid",
"data-entry",
"entryid",
"data-id"
];
for (var i = 0; i < directNames.length; i++) {
var v = el.getAttribute && el.getAttribute(directNames[i]);
if (v && /^[A-Za-z0-9_-]+$/.test(v)) return v;
}
var hidden = el.querySelector && el.querySelector('input[name="entryId"],input[name="entryid"]');
if (hidden && hidden.value) return hidden.value;
var raw = "";
try {
raw += " " + (el.getAttribute("href") || "");
raw += " " + (el.getAttribute("onclick") || "");
raw += " " + (el.outerHTML || "");
} catch (ignore) {}
try { raw = decodeURIComponent(raw); } catch (ignore2) {}
var match = raw.match(/entryId\s*[=:]\s*["']?([A-Za-z0-9_-]+)/i) ||
raw.match(/[?&]entryId=([^&"'<>\s]+)/i);
if (match && match[1]) return match[1];
var uuid = raw.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);
return uuid ? uuid[0] : "";
}
return fromElement(deleteControl) || fromElement(row);
}
function mqDeleteConfiFormsEntry(entryId, sourceRow, clonedRow) {
if (!entryId) {
showToast("شناسه رکورد ConfiForms پیدا نشد.");
return;
}
if (!window.confirm("این رکورد حذف شود؟")) return;
var pageId = "174855144";
var formName = "mediqNewAsset";
/* ConfiForms REST API v1 - Delete entry by ID */
var url =
"/rest/confiforms/1.0/deleteById/" +
encodeURIComponent(pageId) + "/" +
encodeURIComponent(formName) + "/" +
encodeURIComponent(entryId) +
"?skipIFTTTExecute=true";
var xhr = new XMLHttpRequest();
xhr.open("DELETE", url, true);
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.setRequestHeader("X-Atlassian-Token", "no-check");
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4) return;
if (xhr.status >= 200 && xhr.status < 300) {
if (sourceRow && sourceRow.parentNode) sourceRow.parentNode.removeChild(sourceRow);
if (clonedRow && clonedRow.parentNode) clonedRow.parentNode.removeChild(clonedRow);
showToast("رکورد با موفقیت حذف شد.");
return;
}
if (xhr.status === 401 || xhr.status === 403) {
showToast("اجازه حذف این رکورد را ندارید.");
return;
}
if (xhr.status === 404) {
showToast("رکورد یا API حذف ConfiForms پیدا نشد (404).");
return;
}
var details = "";
try {
details = (xhr.responseText || "").replace(/\s+/g, " ").trim();
if (details.length > 140) details = details.substring(0, 140) + "...";
} catch (ignore) {}
showToast(
"حذف انجام نشد. کد خطا: " + xhr.status +
(details ? " - " + details : "")
);
};
xhr.onerror = function () {
showToast("ارتباط با ConfiForms برای حذف رکورد برقرار نشد.");
};
xhr.send(null);
}
function mqBindClonedEditControls(sourceTable, clonedTable) {
var sourceRows = sourceTable.querySelectorAll('tr');
var clonedRows = clonedTable.querySelectorAll('tr');
for (var i = 0; i < clonedRows.length; i++) {
var clonedEdit = mqFindEditControl(clonedRows[i]);
if (!clonedEdit) continue;
var sourceRow = i < sourceRows.length ? sourceRows[i] : null;
var sourceEdit = sourceRow ? mqFindEditControl(sourceRow) : null;
clonedEdit.textContent = 'ویرایش';
if ('value' in clonedEdit && clonedEdit.tagName !== 'A') clonedEdit.value = 'ویرایش';
clonedEdit.setAttribute('title', 'ویرایش دارایی');
clonedEdit.classList.add('mq-cf-edit-proxy');
clonedEdit.setAttribute('href', '#');
if (!sourceEdit) {
clonedEdit.style.display = 'none';
continue;
}
(function (btn, srcEdit) {
btn.onclick = function (e) {
e.preventDefault();
e.stopPropagation();
try {
try {
window.sessionStorage.setItem('mediqPendingReturn', 'editAsset');
} catch (ignore) {}
srcEdit.click();
} catch (err) {
showToast('فرم ویرایش ConfiForms باز نشد.');
}
return false;
};
})(clonedEdit, sourceEdit);
}
}
function mqBindClonedDeleteControls(sourceTable, clonedTable) {
var sourceRows = sourceTable.querySelectorAll('tr');
var clonedRows = clonedTable.querySelectorAll('tr');
for (var i = 0; i < clonedRows.length; i++) {
var clonedDelete = mqFindDeleteControl(clonedRows[i]);
if (!clonedDelete) continue;
var sourceRow = i < sourceRows.length ? sourceRows[i] : null;
var sourceDelete = sourceRow ? mqFindDeleteControl(sourceRow) : null;
clonedDelete.textContent = 'حذف';
if ('value' in clonedDelete && clonedDelete.tagName !== 'A') clonedDelete.value = 'حذف';
clonedDelete.setAttribute('title', 'حذف رکورد');
clonedDelete.classList.add('mq-cf-delete-proxy');
clonedDelete.setAttribute('href', '#');
if (!sourceDelete) {
clonedDelete.style.display = 'none';
continue;
}
(function (btn, srcDelete, srcRow, visualRow) {
btn.onclick = function (e) {
e.preventDefault();
e.stopPropagation();
var entryId = mqExtractEntryId(srcDelete, srcRow);
mqDeleteConfiFormsEntry(entryId, srcRow, visualRow);
return false;
};
})(clonedDelete, sourceDelete, sourceRow, clonedRows[i]);
}
}
function mqLoadPurchasedAssets(attempt) {
var host = document.getElementById("mqAssetsHost");
if (!host) return;
var table = mqFindConfiFormsTable();
if (!table) {
if ((attempt || 0) < 12) {
window.setTimeout(function () {
mqLoadPurchasedAssets((attempt || 0) + 1);
}, 250);
return;
}
host.innerHTML =
'<div class="mq-assets-message">' +
'خروجی لیست ConfiForms روی صفحه پیدا نشد.' +
'</div>';
return;
}
var clonedTable = table.cloneNode(true);
/* Remove only form/edit inputs from the visual copy; keep Delete and proxy it to the real ConfiForms control */
var controls = clonedTable.querySelectorAll('input:not([type="button"]):not([type="submit"]), select, textarea');
for (var i = 0; i < controls.length; i++) {
controls[i].parentNode && controls[i].parentNode.removeChild(controls[i]);
}
/* Creation/list screen: editing is intentionally kept out of this screen. */
var clonedEdits = clonedTable.querySelectorAll('a, button, input[type="button"], input[type="submit"]');
for (var e = clonedEdits.length - 1; e >= 0; e--) {
var candidate = clonedEdits[e];
var txt = ((candidate.textContent || candidate.value || '') + '').trim().toLowerCase();
var cls = ((candidate.className || '') + '').toLowerCase();
var ttl = ((candidate.getAttribute('title') || '') + '').toLowerCase();
if (txt === 'edit' || txt === 'ویرایش' || cls.indexOf('edit') >= 0 || ttl.indexOf('edit') >= 0) {
candidate.parentNode && candidate.parentNode.removeChild(candidate);
}
}
mqBindClonedDeleteControls(table, clonedTable);
host.innerHTML = "";
host.appendChild(clonedTable);
}
function mqRenderPurchasedAssets(container) {
container.innerHTML =
'<div class="mq-preview-title">لیست داراییها</div>' +
'<div class="mq-preview-description">داراییهای ثبتشده</div>' +
'<div class="mq-assets-head">' +
'<div></div>' +
'<div class="mq-assets-actions">' +
'<button class="mq-assets-btn" type="button" id="mqAssetsRefresh">بهروزرسانی لیست</button>' +
'<button class="mq-assets-btn primary" type="button" id="mqAssetsNew">ثبت دارایی جدید</button>' +
'</div>' +
'</div>' +
'<div id="mqAssetsHost" class="mq-assets-host">' +
'<div class="mq-assets-message">در حال بارگذاری داراییها...</div>' +
'</div>';
var addButton = document.getElementById("mqAssetsNew");
if (addButton) addButton.onclick = openMediQAssetForm;
var refreshButton = document.getElementById("mqAssetsRefresh");
if (refreshButton) {
refreshButton.onclick = function () {
try {
window.sessionStorage.setItem("mediqResumeView", "newAsset-purchased");
} catch (e) {}
window.location.reload();
};
}
mqLoadPurchasedAssets(0);
}
function mqLoadEditAssets(attempt) {
var host = document.getElementById("mqEditAssetsHost");
if (!host) return;
var table = mqFindConfiFormsTable();
if (!table) {
if ((attempt || 0) < 12) {
window.setTimeout(function () {
mqLoadEditAssets((attempt || 0) + 1);
}, 250);
return;
}
host.innerHTML =
'<div class="mq-assets-message">' +
'خروجی لیست ConfiForms روی صفحه پیدا نشد.' +
'</div>';
return;
}
var clonedTable = table.cloneNode(true);
var inputs = clonedTable.querySelectorAll('input:not([type="button"]):not([type="submit"]), select, textarea');
for (var i = 0; i < inputs.length; i++) {
inputs[i].parentNode && inputs[i].parentNode.removeChild(inputs[i]);
}
/* Edit screen: only Edit is exposed; Delete stays in the registration/list screen. */
var buttons = clonedTable.querySelectorAll('a, button, input[type="button"], input[type="submit"]');
for (var x = buttons.length - 1; x >= 0; x--) {
var btn = buttons[x];
var text = ((btn.textContent || btn.value || '') + '').trim().toLowerCase();
var cls = ((btn.className || '') + '').toLowerCase();
var title = ((btn.getAttribute('title') || '') + '').toLowerCase();
if (text === 'delete' || text === 'حذف' || cls.indexOf('delete') >= 0 || title.indexOf('delete') >= 0) {
btn.parentNode && btn.parentNode.removeChild(btn);
}
}
mqBindClonedEditControls(table, clonedTable);
host.innerHTML = "";
host.appendChild(clonedTable);
var search = document.getElementById("mqEditSearch");
if (search) {
search.oninput = function () {
var q = (this.value || '').trim().toLowerCase();
var rows = clonedTable.querySelectorAll('tr');
for (var r = 1; r < rows.length; r++) {
var rowText = (rows[r].textContent || '').toLowerCase();
rows[r].style.display = (!q || rowText.indexOf(q) >= 0) ? '' : 'none';
}
};
}
}
function renderEditAssetWorkspace() {
state.screen = "editAsset";
pageTitle.textContent = "تأمین";
pageDesc.textContent = "مدیریت فرآیند تأمین تجهیزات پزشکی";
heroTitle.textContent = "ویرایش دارایی";
heroDesc.textContent = "دارایی موردنظر را انتخاب و اطلاعات آن را ویرایش کنید.";
backButton.style.display = "inline-block";
buildBreadcrumb([
"تأمین",
"مدیریت تجهیزات",
"مدیریت تأمین و لجستیک",
"ویرایش دارایی"
]);
view.innerHTML =
'<div class="mq-edit-wrap">' +
'<div class="mq-preview-title">ویرایش دارایی</div>' +
'<div class="mq-preview-description">دارایی را با نام یا شناسه جستجو کنید و روی «ویرایش» بزنید.</div>' +
'<div class="mq-edit-toolbar">' +
'<input id="mqEditSearch" class="mq-edit-search" type="text" placeholder="جستجو بر اساس شناسه یا نام دستگاه">' +
'</div>' +
'<div id="mqEditAssetsHost" class="mq-edit-host">' +
'<div class="mq-assets-message">در حال بارگذاری داراییها...</div>' +
'</div>' +
'</div>';
mqTreeActivate("editAsset");
mqLoadEditAssets(0);
}
function renderPreview(section) {
state.selectedAssetSection = section;
if (state.screen === "newAsset" || state.screen === "editAsset") {
mqTreeActivate(state.screen + "-" + section);
}
var container = document.getElementById("mqPreviewContent");
if (!container) return;
var title = SECTION_NAMES[section];
if (section === "purchased") {
mqRenderPurchasedAssets(container);
} else {
container.innerHTML =
'<div class="mq-preview-title">' + title + '</div>' +
'<div class="mq-preview-description">' +
(state.screen === "newAsset"
? "اطلاعات این بخش را برای دارایی انتخابشده تکمیل کنید."
: "اطلاعات این بخش را برای دارایی انتخابشده مشاهده یا ویرایش کنید.") +
'</div>' +
'<div class="mq-demo-box">' +
'<div class="mq-demo-icon">✓</div>' +
'<div class="mq-demo-text">' + title + '</div>' +
'<button class="mq-demo-button" type="button" id="mqDemoButton">' +
(state.screen === "newAsset" ? "ثبت اطلاعات" : "مشاهده اطلاعات") +
'</button>' +
'</div>';
}
var options = document.querySelectorAll("#mediq-dashboard .mq-list-option");
for (var i = 0; i < options.length; i++) {
options[i].classList.toggle(
"active",
options[i].getAttribute("data-section") === section
);
}
var demoButton = document.getElementById("mqDemoButton");
if (demoButton) {
demoButton.onclick = function () {
showToast("فرم این بخش هنوز تعریف نشده است.");
};
}
}
/* ============================================================
MEDIQ <-> CONFIFORMS : NEW ASSET FORM
============================================================ */
var mqCfOriginalParent = null;
var mqCfOriginalNext = null;
function findMediQAssetFormPanel() {
var form = document.querySelector(
'form.aui-confiforms input[name="registrationFormName"][value="mediqNewAsset"]'
);
if (!form) return null;
var panel = form.closest(".confiFormsFormBorder");
return panel || form.parentElement;
}
/* ============================================================
MEDIQ - AUI DATE PICKER INIT / FRONT FIX
============================================================ */
function mqRaiseDatePicker() {
window.setTimeout(function () {
var selectors = [
'#ui-datepicker-div',
'.ui-datepicker',
'.aui-datepicker',
'.aui-datepicker-dialog',
'.aui-inline-dialog'
];
for (var s = 0; s < selectors.length; s++) {
var nodes = document.querySelectorAll(selectors[s]);
for (var i = 0; i < nodes.length; i++) {
try {
nodes[i].style.setProperty('z-index', '2147483000', 'important');
} catch (ignore) {}
}
}
/* Team Calendars / other add-ons can override jQuery UI position. */
var calendars = document.querySelectorAll(
'.aui-inline-dialog .ui-datepicker, .aui-datepicker-dialog .ui-datepicker'
);
for (var j = 0; j < calendars.length; j++) {
try {
calendars[j].style.setProperty('position', 'relative', 'important');
} catch (ignore2) {}
}
}, 0);
}
function mqInitAssetDatePickers(panel) {
if (!panel || !window.AJS || !AJS.$) return;
var init = function () {
var inputs = panel.querySelectorAll(
'input[type="date"], input.aui-date-picker'
);
for (var i = 0; i < inputs.length; i++) {
var el = inputs[i];
try {
if (typeof AJS.$(el).datePicker === 'function') {
/* AUI jQuery helper safely reuses an existing picker. */
AJS.$(el).datePicker({
overrideBrowserDefault: true
});
}
} catch (e) {
if (window.console && console.warn) {
console.warn('MEDIQ DATEPICKER INIT:', e);
}
}
if (!el.getAttribute('data-mq-datepicker-bound')) {
el.setAttribute('data-mq-datepicker-bound', '1');
el.addEventListener('focus', mqRaiseDatePicker, true);
el.addEventListener('click', mqRaiseDatePicker, true);
}
}
mqRaiseDatePicker();
};
/* ConfiForms/AUI can finish field initialization asynchronously. */
window.setTimeout(init, 0);
window.setTimeout(init, 120);
window.setTimeout(init, 350);
window.setTimeout(init, 700);
}
function openMediQAssetForm() {
try {
window.sessionStorage.setItem('mediqPendingReturn', 'newAsset-purchased');
} catch (ignore) {}
var panel = findMediQAssetFormPanel();
var modal = document.getElementById("mqCfModal");
var body = document.getElementById("mqCfBody");
if (!panel || !modal || !body) {
showToast("فرم mediqNewAsset روی این صفحه پیدا نشد.");
return;
}
if (!mqCfOriginalParent) {
mqCfOriginalParent = panel.parentNode;
mqCfOriginalNext = panel.nextSibling;
}
body.appendChild(panel);
panel.style.display = "block";
panel.style.position = "static";
panel.style.left = "auto";
panel.style.top = "auto";
panel.style.width = "100%";
panel.style.height = "auto";
panel.style.opacity = "1";
panel.style.overflow = "visible";
panel.style.pointerEvents = "auto";
mqSectionizeConfiForm(panel, MQ_ASSET_FORM_SECTIONS, ["assetObjectId","devicePageId"]);
mqFixAssetPlaceholders(panel);
mqInjectModelPlus(panel);
mqRestoreAssetDraft(panel);
modal.classList.add("open");
modal.setAttribute("aria-hidden", "false");
/* Initialize / raise Confluence AUI date pickers inside the moved form. */
mqInitAssetDatePickers(panel);
/* Insight/Select2 initializes asynchronously; retry + button placement. */
mqScheduleAssetFormEnhancements(panel);
window.setTimeout(function () {
var first = panel.querySelector(
'input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled])'
);
if (first) first.focus();
}, 60);
}
function closeMediQAssetForm() {
var modal = document.getElementById("mqCfModal");
var panel = findMediQAssetFormPanel();
mqCloseSelect2Dropdowns(panel || document);
if (panel && mqCfOriginalParent) {
if (mqCfOriginalNext && mqCfOriginalNext.parentNode === mqCfOriginalParent) {
mqCfOriginalParent.insertBefore(panel, mqCfOriginalNext);
} else {
mqCfOriginalParent.appendChild(panel);
}
}
if (modal) {
modal.classList.remove("open");
modal.setAttribute("aria-hidden", "true");
}
window.setTimeout(function () { mqCloseSelect2Dropdowns(document); }, 20);
window.setTimeout(function () { mqCloseSelect2Dropdowns(document); }, 120);
}
(function bindMediQAssetModal() {
var modal = document.getElementById("mqCfModal");
var close = document.getElementById("mqCfClose");
if (close) {
close.onclick = closeMediQAssetForm;
}
if (modal) {
modal.onclick = function (e) {
if (e.target === modal) {
closeMediQAssetForm();
}
};
}
document.addEventListener("keydown", function (e) {
if (e.key === "Escape" && modal && modal.classList.contains("open")) {
closeMediQAssetForm();
}
});
})();
/* ============================================================
MEDIQ - SECTIONED FORMS / MODEL QUICK CREATE / SELECT2 CLEANUP
============================================================ */
var MQ_ASSET_FORM_SECTIONS = [
{ title:"مشخصات اصلی", fields:["deviceModel","deviceId","deviceName","serialNumber","assetNumber"] },
{ title:"خرید و اطلاعات مالی", fields:["purchaseDate","supplier","purchaseValueIRR","purchaseValueUSD","manufactureDate","expiryDate"] },
{ title:"موقعیت و مسئولیت", fields:["operatingRoom","businessUnit","responsibleUnit","receiver","accessories"] },
{ title:"وضعیت و بهرهبرداری", fields:["status","accessStatus","statusReason","usageMode","fallRisk","combinedFunction","aggregateValue","priority","emergency","portable","transportability","clinicalUser","entryDateTime","exitDateTime","inStore","storeLocation","financialCenter"] }
];
var MQ_MODEL_FORM_SECTIONS = [
{ title:"مشخصات اصلی مدل", fields:["modelTitle","modelName","deviceTitle","manufacturer","nature"] },
{ title:"طبقهبندی", fields:["modelType","modelGroup","modelFunction","criticality","technology"] },
{ title:"نیازمندیهای مصرفی", fields:["powerRequirement","waterRequirement","gasRequirement"] }
];
var MQ_FORM_LABELS = {
deviceModel:"مدل دستگاه",
deviceId:"شناسه دستگاه",
deviceName:"نام دستگاه",
serialNumber:"شماره سریال",
assetNumber:"شماره اموال",
purchaseDate:"تاریخ خرید",
supplier:"فروشنده",
purchaseValueIRR:"ارزش ریالی خرید",
purchaseValueUSD:"ارزش دلاری خرید",
manufactureDate:"تاریخ تولید",
expiryDate:"تاریخ انقضا",
operatingRoom:"موقعیت مکانی فعلی",
businessUnit:"محل کاربری",
responsibleUnit:"مسئول بهرهبرداری",
receiver:"تحویلگیرنده",
accessories:"متعلقات",
status:"وضعیت",
accessStatus:"وضعیت دسترسی",
statusReason:"علت وضعیت فعلی",
usageMode:"نحوه مصرف",
fallRisk:"آیا با خرابی این جزء دستگاه ترکیبی ساقط میشود؟",
combinedFunction:"عملکرد در مجموعههای ترکیبی",
aggregateValue:"ارزش ریالی/ارزی تجمیعی",
priority:"اولویت",
emergency:"اورژانسی",
portable:"قابل حمل",
transportability:"قابلیت حمل",
clinicalUser:"کاربر کلینیکال",
entryDateTime:"زمان ورود",
exitDateTime:"زمان خروج",
inStore:"در انبار",
storeLocation:"محل انبار",
financialCenter:"مرکز مالی",
modelTitle:"عنوان مدل",
modelName:"مدل دستگاه",
deviceTitle:"عنوان دستگاه",
manufacturer:"شرکت سازنده",
nature:"ماهیت دستگاه",
modelType:"نوع",
modelGroup:"گروه",
modelFunction:"کارکرد",
criticality:"سطح اهمیت",
technology:"فناوری",
powerRequirement:"برق مصرفی",
waterRequirement:"آب مصرفی",
gasRequirement:"گاز مصرفی"
};
function mqCloseSelect2Dropdowns(scope) {
var jq = null;
try {
jq = (window.AJS && AJS.$) ? AJS.$ : (window.jQuery || null);
} catch (ignore) {}
if (jq) {
try {
jq(scope || document)
.find('select, input')
.add(jq('select, input'))
.each(function () {
try {
var $el = jq(this);
if (
$el.data('select2') ||
$el.hasClass('select2-offscreen') ||
$el.hasClass('select2-hidden-accessible')
) {
$el.select2('close');
}
} catch (ignore2) {}
});
} catch (ignore3) {}
try {
jq('.select2-drop-active').removeClass('select2-drop-active').hide();
jq('.select2-container-active').removeClass('select2-container-active');
jq('.select2-container--open').removeClass('select2-container--open');
jq('#select2-drop-mask,.select2-drop-mask').hide();
jq('body > .select2-drop, body > .aui-select2-drop').hide();
} catch (ignore4) {}
}
var floating = document.querySelectorAll(
'body > .select2-drop,' +
'body > .select2-drop-mask,' +
'.select2-drop-active,' +
'.aui-select2-drop,' +
'.select2-dropdown'
);
for (var i = 0; i < floating.length; i++) {
floating[i].classList.remove('select2-drop-active');
floating[i].style.display = 'none';
}
var opened = document.querySelectorAll(
'.select2-container-active, .select2-container--open'
);
for (var j = 0; j < opened.length; j++) {
opened[j].classList.remove('select2-container-active');
opened[j].classList.remove('select2-container--open');
}
}
function mqFindNamedField(form, name) {
if (!form || !name) return null;
return form.querySelector('[name="' + name + '"], [name="' + name + '[]"]') ||
form.querySelector('[id$="_' + name + '"], [id*="' + name + '"]');
}
function mqFieldRow(form, name) {
var field = mqFindNamedField(form, name);
if (!field) return null;
return field.closest('tr') || field.closest('.field-group') || field.parentElement;
}
function mqPersianizeField(form, name) {
var field = mqFindNamedField(form, name);
if (!field) return;
var labelText = MQ_FORM_LABELS[name];
if (!labelText) return;
var id = field.getAttribute('id');
var label = id ? form.querySelector('label[for="' + id + '"]') : null;
if (!label) {
var row = field.closest('tr');
if (row) label = row.querySelector('label');
}
if (label) {
var required = label.querySelector('.aui-iconfont-required, .required, .cf_required');
label.childNodes.forEach && Array.prototype.forEach.call(label.childNodes, function (n) {
if (n.nodeType === 3) n.nodeValue = '';
});
if (!required) label.textContent = labelText;
else label.insertBefore(document.createTextNode(labelText + ' '), required);
}
}
function mqSectionizeConfiForm(panel, sections, systemFields) {
if (!panel) return;
var form = panel.querySelector('form.aui-confiforms') || panel.querySelector('form');
if (!form) return;
var old = form.querySelectorAll('.mq-form-section-row');
for (var z = 0; z < old.length; z++) old[z].parentNode && old[z].parentNode.removeChild(old[z]);
Object.keys(MQ_FORM_LABELS).forEach(function (name) { mqPersianizeField(form, name); });
(systemFields || []).forEach(function (name) {
var row = mqFieldRow(form, name);
if (row) row.classList.add('mq-system-field');
});
sections.forEach(function (section) {
var firstRow = null;
for (var i = 0; i < section.fields.length; i++) {
var row = mqFieldRow(form, section.fields[i]);
if (row && row.tagName && row.tagName.toLowerCase() === 'tr') {
firstRow = row;
break;
}
}
if (!firstRow || !firstRow.parentNode) return;
var tr = document.createElement('tr');
tr.className = 'mq-form-section-row';
var td = document.createElement('td');
td.setAttribute('colspan', '99');
td.innerHTML = '<div class="mq-form-section-title">' + section.title + '</div>';
tr.appendChild(td);
firstRow.parentNode.insertBefore(tr, firstRow);
});
}
function mqFindDeviceModelField(form) {
if (!form) return null;
var field =
mqFindNamedField(form, 'deviceModel') ||
form.querySelector('[name$="deviceModel"], [name*="deviceModel"], [id$="deviceModel"], [id*="deviceModel"]');
if (field) return field;
var rows = form.querySelectorAll('tr, .field-group');
for (var i = 0; i < rows.length; i++) {
var txt = (rows[i].textContent || '').replace(/\s+/g, ' ').trim();
if (txt.indexOf('مدل دستگاه') !== -1) {
return rows[i].querySelector(
'input.select2-offscreen, input.select2-hidden-accessible, select, input, .select2-container'
);
}
}
return null;
}
function mqFindDeviceModelVisual(form, field) {
if (!form || !field) return null;
if (field.classList && field.classList.contains('select2-container')) {
return field;
}
var row = field.closest('tr') || field.closest('.field-group') || field.parentElement;
if (row) {
var visibleInRow = row.querySelector('.select2-container');
if (visibleInRow) return visibleInRow;
}
var next = field.nextElementSibling;
if (next && next.classList && next.classList.contains('select2-container')) {
return next;
}
if (field.parentElement) {
var visibleInParent = field.parentElement.querySelector('.select2-container');
if (visibleInParent) return visibleInParent;
}
return field;
}
function mqInjectModelPlus(panel) {
if (!panel) return;
var form = panel.querySelector('form.aui-confiforms') || panel.querySelector('form');
if (!form) return;
if (form.querySelector('#mqAddModelBtn, .mq-model-plus')) return;
var field = mqFindDeviceModelField(form);
if (!field) return;
var visual = mqFindDeviceModelVisual(form, field);
if (!visual || !visual.parentNode) return;
var cell = visual.closest('td') || field.closest('td') || visual.parentNode;
if (!cell) return;
cell.classList.add('mq-model-field-cell');
var wrap = cell.querySelector('.mq-device-model-wrap');
if (!wrap) {
wrap = document.createElement('div');
wrap.className = 'mq-device-model-wrap';
visual.parentNode.insertBefore(wrap, visual);
wrap.appendChild(visual);
}
var btn = document.createElement('button');
btn.id = 'mqAddModelBtn';
btn.type = 'button';
btn.className = 'mq-model-plus';
btn.setAttribute('title', 'ثبت مدل جدید');
btn.setAttribute('aria-label', 'ثبت مدل جدید');
btn.textContent = '+';
btn.onclick = function (e) {
e.preventDefault();
e.stopPropagation();
mqCloseSelect2Dropdowns(panel);
openMediQModelForm();
};
wrap.appendChild(btn);
}
function mqFixAssetPlaceholders(panel) {
if (!panel) return;
var form = panel.querySelector('form.aui-confiforms') || panel.querySelector('form');
if (!form) return;
var idField = mqFindNamedField(form, 'deviceId');
var nameField = mqFindNamedField(form, 'deviceName');
if (idField && idField.tagName && idField.tagName.toLowerCase() === 'input') {
idField.setAttribute('placeholder', 'شناسه دستگاه را وارد کنید');
}
if (nameField && nameField.tagName && nameField.tagName.toLowerCase() === 'input') {
nameField.setAttribute('placeholder', 'نام دستگاه را وارد کنید');
}
}
function mqScheduleAssetFormEnhancements(panel) {
if (!panel) return;
var tries = [0, 80, 180, 350, 600, 1000];
for (var i = 0; i < tries.length; i++) {
(function (delay) {
window.setTimeout(function () {
mqFixAssetPlaceholders(panel);
mqInjectModelPlus(panel);
}, delay);
})(tries[i]);
}
}
var mqModelOriginalParent = null;
var mqModelOriginalNext = null;
function findMediQModelFormPanel() {
var form = document.querySelector(
'form.aui-confiforms input[name="registrationFormName"][value="mediqNewModel"]'
);
if (!form) return null;
return form.closest('.confiFormsFormBorder') || form.parentElement;
}
function mqSnapshotAssetDraft() {
var panel = findMediQAssetFormPanel();
if (!panel) return;
var form = panel.querySelector('form.aui-confiforms') || panel.querySelector('form');
if (!form) return;
var data = {};
var controls = form.querySelectorAll('input[name], textarea[name], select[name]');
for (var i = 0; i < controls.length; i++) {
var c = controls[i];
var name = c.name;
if (!name || name === 'deviceModel' || c.type === 'hidden' || c.type === 'submit' || c.type === 'button') continue;
if (c.type === 'checkbox' || c.type === 'radio') data[name] = !!c.checked;
else data[name] = c.value;
}
try { window.sessionStorage.setItem('mediqAssetDraft', JSON.stringify(data)); } catch (ignore) {}
}
function mqRestoreAssetDraft(panel) {
if (!panel) return;
var raw = '';
try { raw = window.sessionStorage.getItem('mediqAssetDraft') || ''; } catch (ignore) {}
if (!raw) return;
var data = {};
try { data = JSON.parse(raw); } catch (ignore2) { return; }
var form = panel.querySelector('form.aui-confiforms') || panel.querySelector('form');
if (!form) return;
Object.keys(data).forEach(function (name) {
var c = mqFindNamedField(form, name);
if (!c) return;
if (c.type === 'checkbox' || c.type === 'radio') c.checked = !!data[name];
else c.value = data[name];
});
try { window.sessionStorage.removeItem('mediqAssetDraft'); } catch (ignore3) {}
}
function openMediQModelForm() {
mqSnapshotAssetDraft();
var panel = findMediQModelFormPanel();
var modal = document.getElementById('mqModelModal');
var body = document.getElementById('mqModelBody');
if (!panel || !modal || !body) {
showToast('فرم mediqNewModel روی این صفحه پیدا نشد.');
return;
}
if (!mqModelOriginalParent) {
mqModelOriginalParent = panel.parentNode;
mqModelOriginalNext = panel.nextSibling;
}
body.appendChild(panel);
panel.style.display = 'block';
panel.style.position = 'static';
panel.style.left = 'auto';
panel.style.top = 'auto';
panel.style.width = '100%';
panel.style.height = 'auto';
panel.style.opacity = '1';
panel.style.overflow = 'visible';
panel.style.pointerEvents = 'auto';
mqSectionizeConfiForm(panel, MQ_MODEL_FORM_SECTIONS, ['createdModelId']);
modal.classList.add('open');
modal.setAttribute('aria-hidden','false');
}
function closeMediQModelForm() {
var modal = document.getElementById('mqModelModal');
var panel = findMediQModelFormPanel();
mqCloseSelect2Dropdowns(panel || document);
if (panel && mqModelOriginalParent) {
if (mqModelOriginalNext && mqModelOriginalNext.parentNode === mqModelOriginalParent) {
mqModelOriginalParent.insertBefore(panel, mqModelOriginalNext);
} else {
mqModelOriginalParent.appendChild(panel);
}
}
if (modal) {
modal.classList.remove('open');
modal.setAttribute('aria-hidden','true');
}
}
(function bindMediQModelModal() {
var modal = document.getElementById('mqModelModal');
var close = document.getElementById('mqModelClose');
if (close) close.onclick = closeMediQModelForm;
if (modal) {
modal.onclick = function (e) {
if (e.target === modal) closeMediQModelForm();
};
}
})();
/* Extra cleanup for dropdowns rendered outside the MediQ modal. */
document.addEventListener('click', function (e) {
var assetModal = document.getElementById('mqCfModal');
var closeBtn = e.target && e.target.closest ? e.target.closest('#mqCfClose') : null;
if (closeBtn || (assetModal && e.target === assetModal)) {
mqCloseSelect2Dropdowns(document);
window.setTimeout(function () { mqCloseSelect2Dropdowns(document); }, 30);
window.setTimeout(function () { mqCloseSelect2Dropdowns(document); }, 150);
}
}, true);
/* ============================================================
SIMPLE PRESENTATION PAGES
============================================================ */
function renderSimplePage(
title
) {
heroTitle.textContent =
title;
heroDesc.textContent =
"نمای پرزنت این بخش";
backButton.style.display =
"inline-block";
buildBreadcrumb(
[
"تأمین",
"مدیریت تجهیزات",
"مدیریت تأمین و لجستیک",
title
]
);
view.innerHTML =
'<div class="mq-empty-cycle">' +
'<strong>' +
title +
'</strong>' +
'<span>' +
'این بخش در ادامه فرآیند طراحی تکمیل میشود.' +
'</span>' +
'</div>';
}
/* ============================================================
OTHER LIFE CYCLE TABS
============================================================ */
function renderOtherCycle(
key,
title
) {
state.cycle =
key;
pageTitle.textContent =
title;
pageDesc.textContent =
"چرخه عمر تجهیزات پزشکی";
heroTitle.textContent =
title;
heroDesc.textContent =
"نمای ساختار این بخش";
backButton.style.display =
"none";
buildBreadcrumb(
[
title
]
);
view.innerHTML =
'<div class="mq-empty-cycle">' +
'<strong>' +
title +
'</strong>' +
'<span>' +
'ساختار این بخش در مرحله بعد طراحی میشود.' +
'</span>' +
'</div>';
}
/* ============================================================
BIND MODULE ACTIONS
============================================================ */
function bindActions() {
var elements =
document.querySelectorAll(
"#mediq-dashboard [data-action]"
);
for (
var i = 0;
i < elements.length;
i++
) {
elements[i].onclick =
function () {
var action =
this.getAttribute(
"data-action"
);
if (
action ===
"logistics"
) {
renderLogistics();
}
else if (
action ===
"newAsset"
) {
renderAssetSections(
"newAsset"
);
}
else if (
action ===
"editAsset"
) {
renderEditAssetWorkspace();
}
else if (
action ===
"purchase"
) {
renderSimplePage(
"خرید دارایی"
);
}
else if (
action ===
"consumable"
) {
renderSimplePage(
"کالاهای مصرفی"
);
}
};
}
}
/* ============================================================
SECTION OPTIONS
============================================================ */
function bindSectionOptions() {
var options =
document.querySelectorAll(
"#mediq-dashboard .mq-list-option"
);
for (
var i = 0;
i < options.length;
i++
) {
options[i].onclick =
function () {
renderPreview(
this.getAttribute(
"data-section"
)
);
};
}
}
/* ============================================================
BACK
============================================================ */
if (backButton) {
backButton.onclick =
function () {
if (
state.screen ===
"logistics"
) {
renderEquipment();
}
else if (
state.screen ===
"newAsset" ||
state.screen ===
"editAsset"
) {
renderLogistics();
}
else if (
state.screen === "property" ||
state.screen === "equipmentMaintenance" ||
state.screen === "finance"
) {
renderEquipment();
}
else if (
state.screen === "purchase" ||
state.screen === "consumable"
) {
renderLogistics();
}
else {
renderLogistics();
}
};
}
/* ============================================================
LIFE CYCLE BUTTONS
============================================================ */
var lifeItems =
document.querySelectorAll(
"#mediq-dashboard .mq-life-item"
);
for (
var i = 0;
i < lifeItems.length;
i++
) {
lifeItems[i].onclick =
function () {
var cycle =
this.getAttribute(
"data-cycle"
);
for (
var x = 0;
x < lifeItems.length;
x++
) {
lifeItems[x]
.classList
.remove(
"active"
);
}
this.classList.add(
"active"
);
if (
cycle ===
"supply"
) {
state.cycle =
"supply";
renderEquipment();
}
else if (
cycle ===
"operation"
) {
renderOtherCycle(
"operation",
"بهرهبرداری"
);
}
else if (
cycle ===
"replacement"
) {
renderOtherCycle(
"replacement",
"جایگزینی"
);
}
else if (
cycle ===
"maintenance"
) {
renderOtherCycle(
"maintenance",
"نگهداری"
);
}
};
}
/* ============================================================
LOGOUT
============================================================ */
var logout =
document.getElementById(
"mqLogout"
);
if (logout) {
logout.onclick =
function () {
window.location.href =
"/logout.action";
};
}
/* ============================================================
CURRENT USER / FULL NAME
============================================================ */
(function loadMediQCurrentUser() {
var fallbackUser = "";
try {
if (window.AJS && AJS.Meta) {
fallbackUser = AJS.Meta.get("remote-user") || "";
}
} catch (e) {}
function setWelcomeName(name) {
var welcomeUser = document.getElementById("mqWelcomeUser");
if (welcomeUser && name) {
welcomeUser.textContent = name;
}
}
setWelcomeName(fallbackUser || "کاربر مدیکیو");
try {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/rest/api/user/current", true);
xhr.setRequestHeader("Accept", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4 || xhr.status < 200 || xhr.status >= 300) return;
try {
var user = JSON.parse(xhr.responseText || "{}");
setWelcomeName(user.displayName || user.fullName || fallbackUser || "کاربر مدیکیو");
} catch (e) {}
};
xhr.send();
} catch (e) {}
})();
/* ============================================================
SIDEBAR TREE
============================================================ */
function mqTreeOpen(group, open) {
var el = document.querySelector('#mediq-dashboard [data-tree-group="' + group + '"]');
var row = document.querySelector('#mediq-dashboard [data-tree-key="' + group + '"]');
if (el) el.classList.toggle("open", !!open);
if (row) row.classList.toggle("open", !!open);
}
function mqTreeReset() {
var rows = document.querySelectorAll("#mediq-dashboard .mq-tree-row");
for (var i = 0; i < rows.length; i++) {
rows[i].classList.remove("active");
rows[i].classList.remove("parent-active");
}
}
function mqTreeActivate(key) {
mqTreeReset();
var active = document.querySelector('#mediq-dashboard [data-tree-key="' + key + '"]');
if (active) active.classList.add("active");
/* Default collapse */
mqTreeOpen("equipment", false);
mqTreeOpen("logistics", false);
mqTreeOpen("newAsset", false);
mqTreeOpen("editAsset", false);
if (key === "equipment" || key === "property" || key === "equipmentMaintenance" || key === "finance" ||
key === "logistics" || key === "purchase" || key === "newAsset" || key === "editAsset" ||
key === "consumable" || key.indexOf("newAsset-") === 0 || key.indexOf("editAsset-") === 0) {
mqTreeOpen("equipment", true);
var p1 = document.querySelector('[data-tree-key="equipment"]');
if (p1 && key !== "equipment") p1.classList.add("parent-active");
}
if (key === "logistics" || key === "purchase" || key === "newAsset" || key === "editAsset" ||
key === "consumable" || key.indexOf("newAsset-") === 0 || key.indexOf("editAsset-") === 0) {
mqTreeOpen("logistics", true);
var p2 = document.querySelector('[data-tree-key="logistics"]');
if (p2 && key !== "logistics") p2.classList.add("parent-active");
}
if (key === "newAsset" || key.indexOf("newAsset-") === 0) {
mqTreeOpen("newAsset", true);
var p3 = document.querySelector('[data-tree-key="newAsset"]');
if (p3 && key !== "newAsset") p3.classList.add("parent-active");
}
if (key.indexOf("editAsset-") === 0) {
mqTreeOpen("editAsset", true);
var p4 = document.querySelector('[data-tree-key="editAsset"]');
if (p4) p4.classList.add("parent-active");
}
}
function mqTreeSimpleEquipmentPage(title, key) {
state.screen = key;
pageTitle.textContent = "تأمین";
pageDesc.textContent = "مدیریت فرآیند تأمین تجهیزات پزشکی";
heroTitle.textContent = title;
heroDesc.textContent = "نمای پرزنت این بخش";
backButton.style.display = "inline-block";
buildBreadcrumb(["تأمین", "مدیریت تجهیزات", title]);
view.innerHTML =
'<div class="mq-empty-cycle">' +
'<strong>' + title + '</strong>' +
'<span>این بخش در ادامه فرآیند طراحی تکمیل میشود.</span>' +
'</div>';
mqTreeActivate(key);
}
function bindTree() {
var rows = document.querySelectorAll("#mediq-dashboard .mq-tree-row[data-tree-action]");
for (var i = 0; i < rows.length; i++) {
rows[i].onclick = function () {
var action = this.getAttribute("data-tree-action");
if (action === "equipment") {
renderEquipment();
}
else if (action === "property") {
mqTreeSimpleEquipmentPage("مدیریت اموال", "property");
}
else if (action === "equipmentMaintenance") {
mqTreeSimpleEquipmentPage("مدیریت نگهداری و تعمیر", "equipmentMaintenance");
}
else if (action === "finance") {
mqTreeSimpleEquipmentPage("مدیریت مالی و بهرهوری", "finance");
}
else if (action === "logistics") {
renderLogistics();
}
else if (action === "purchase") {
state.screen = "purchase";
renderSimplePage("خرید دارایی");
mqTreeActivate("purchase");
}
else if (action === "newAsset") {
state.selectedAssetSection = "purchased";
renderAssetSections("newAsset");
}
else if (action === "editAsset") {
renderEditAssetWorkspace();
}
else if (action === "consumable") {
state.screen = "consumable";
renderSimplePage("کالاهای مصرفی");
mqTreeActivate("consumable");
}
else if (action === "section") {
var mode = this.getAttribute("data-mode");
var section = this.getAttribute("data-section");
if (state.screen !== mode) {
state.selectedAssetSection = section;
renderAssetSections(mode);
} else {
renderPreview(section);
}
mqTreeActivate(mode + "-" + section);
}
else if (action === "cycle") {
var cycle = this.getAttribute("data-cycle");
if (cycle === "operation") {
renderOtherCycle("operation", "بهرهبرداری");
mqTreeActivate("operation");
}
else if (cycle === "replacement") {
renderOtherCycle("replacement", "جایگزینی");
mqTreeActivate("replacement");
}
else if (cycle === "maintenance") {
renderOtherCycle("maintenance", "نگهداری");
mqTreeActivate("maintenanceCycle");
}
}
};
}
}
/* ============================================================
CONFIFORMS SAVE CALLBACK
============================================================ */
(function mqBindConfiFormsSaveCallback() {
var previous = window.onCFSubmitFinished;
window.onCFSubmitFinished = function (formName) {
try {
if (typeof previous === 'function') previous.apply(this, arguments);
} catch (ignore) {}
if (formName === 'mediqNewModel') {
closeMediQModelForm();
showToast('مدل جدید ثبت شد؛ فهرست مدلها در حال بهروزرسانی است.');
try {
window.sessionStorage.setItem('mediqResumeView', 'newAsset-purchased');
window.sessionStorage.setItem('mediqOpenAssetAfterReload', '1');
} catch (ignoreModel) {}
window.setTimeout(function () {
window.location.reload();
}, 500);
return;
}
if (formName === 'mediqNewAsset') {
var target = 'newAsset-purchased';
try {
target = window.sessionStorage.getItem('mediqPendingReturn') ||
(state.screen === 'editAsset' ? 'editAsset' : 'newAsset-purchased');
window.sessionStorage.removeItem('mediqPendingReturn');
window.sessionStorage.setItem('mediqResumeView', target);
} catch (ignore2) {}
window.setTimeout(function () {
window.location.reload();
}, 450);
}
};
})();
/* ============================================================
INITIAL
============================================================ */
bindTree();
var mqResumeView = "";
try {
mqResumeView = window.sessionStorage.getItem("mediqResumeView") || "";
if (mqResumeView) {
window.sessionStorage.removeItem("mediqResumeView");
}
} catch (e) {}
if (mqResumeView === "newAsset-purchased") {
state.selectedAssetSection = "purchased";
renderAssetSections("newAsset");
var mqOpenAssetAfterReload = false;
try {
mqOpenAssetAfterReload = window.sessionStorage.getItem("mediqOpenAssetAfterReload") === "1";
if (mqOpenAssetAfterReload) window.sessionStorage.removeItem("mediqOpenAssetAfterReload");
} catch (ignoreOpen) {}
if (mqOpenAssetAfterReload) {
window.setTimeout(function () { openMediQAssetForm(); }, 500);
}
} else if (mqResumeView === "editAsset") {
renderEditAssetWorkspace();
} else {
renderEquipment();
}
})();
</script>
</div> |