Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
551bb1fc
Commit
551bb1fc
authored
Sep 09, 2022
by
Samir Sadyhov
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
скрипт компонент открытие форм в модалке или в контейнере
parent
4b3060fe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
0 deletions
+133
-0
constructor/scripts/openFormPlayer/openFormPlayer.css
constructor/scripts/openFormPlayer/openFormPlayer.css
+46
-0
constructor/scripts/openFormPlayer/openFormPlayer.js
constructor/scripts/openFormPlayer/openFormPlayer.js
+87
-0
No files found.
constructor/scripts/openFormPlayer/openFormPlayer.css
0 → 100644
View file @
551bb1fc
.wf-form-buttons-panel
{
width
:
100%
;
height
:
50px
;
overflow
:
hidden
;
background
:
#FAFAFA
;
border-bottom
:
1px
solid
#D9D9D9
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
0
20px
;
}
.wf-form-buttons-panel
div
{
display
:
flex
;
align-items
:
center
;
height
:
100%
;
gap
:
15px
;
}
.wf-form-player-container
{
height
:
calc
(
100%
-
50px
);
width
:
100%
;
overflow
:
auto
;
background
:
#fff
;
padding
:
30px
;
transition
:
0.3s
;
}
.wf-other-file-container
{
width
:
100%
;
height
:
calc
(
100%
-
40px
);
padding
:
30px
;
text-align
:
center
;
transition
:
0.3s
}
.wf-icons
{
color
:
#999
;
cursor
:
pointer
;
transition
:
0.3s
;
font-size
:
1.8em
;
}
.wf-icons
:hover
{
color
:
#333
;
}
constructor/scripts/openFormPlayer/openFormPlayer.js
0 → 100644
View file @
551bb1fc
const
getContentFromForm
=
async
(
uuid
,
parentContainer
)
=>
{
const
container
=
$
(
'
<div>
'
,
{
style
:
'
width: 100%; overflow: hidden;
'
});
if
(
parentContainer
)
{
container
.
css
(
'
height
'
,
'
100%
'
);
}
else
{
container
.
css
(
'
height
'
,
'
calc(100% - 40px)
'
);
}
let
editable
=
false
;
const
buttonsPanel
=
$
(
'
<div>
'
,
{
class
:
'
wf-form-buttons-panel
'
});
const
playerContainer
=
$
(
'
<div>
'
,
{
class
:
'
wf-form-player-container
'
});
const
player
=
UTILS
.
getSynergyPlayer
(
uuid
,
false
);
const
buttonSave
=
$
(
'
<span class="material-icons wf-icons" style="display: none;">save</span>
'
);
const
buttonPrint
=
$
(
'
<span class="material-icons wf-icons">print</span>
'
);
const
buttonEditable
=
$
(
'
<span class="material-icons wf-icons">edit</span>
'
);
player
.
view
.
container
.
css
({
'
background
'
:
'
#fff
'
});
playerContainer
.
append
(
player
.
view
.
container
);
buttonSave
.
on
(
'
click
'
,
e
=>
{
if
(
!
player
.
model
.
hasChanges
)
return
;
Cons
.
showLoader
();
if
(
!
player
.
model
.
isValid
())
{
showMessage
(
i18n
.
tr
(
'
Заполните обязательные поля
'
),
'
error
'
);
Cons
.
hideLoader
();
}
else
{
player
.
saveFormData
(
result
=>
{
showMessage
(
i18n
.
tr
(
'
Данные сохранены
'
),
'
success
'
);
Cons
.
hideLoader
();
});
}
});
buttonPrint
.
on
(
'
click
'
,
e
=>
{
if
(
player
.
model
.
hasPrintable
)
{
window
.
open
(
`../Synergy/rest/asforms/template/print/form?format=pdf&dataUUID=
${
uuid
}
`
);
}
else
{
UTILS
.
printForm
(
player
.
view
.
container
[
0
]);
}
});
buttonEditable
.
on
(
'
click
'
,
e
=>
{
editable
=
!
editable
;
player
.
view
.
setEditable
(
editable
);
if
(
editable
)
{
buttonEditable
.
text
(
'
description
'
);
buttonPrint
.
hide
();
buttonSave
.
show
();
}
else
{
buttonEditable
.
text
(
'
edit
'
);
buttonPrint
.
show
();
if
(
player
.
model
.
hasChanges
)
{
buttonSave
.
show
();
}
else
{
buttonSave
.
hide
();
}
}
});
buttonsPanel
.
append
(
$
(
'
<div>
'
).
append
(
buttonSave
,
buttonPrint
),
$
(
'
<div>
'
).
append
(
buttonEditable
)
);
container
.
append
(
buttonsPanel
,
playerContainer
);
return
{
container
,
player
};
}
this
.
openFormPlayer
=
async
(
uuid
,
parentContainer
=
null
,
closeDialogHandler
)
=>
{
Cons
.
showLoader
();
const
{
container
:
body
,
player
}
=
await
getContentFromForm
(
uuid
,
parentContainer
);
const
meaning
=
await
appAPI
.
getDocMeaningContent
(
uuid
)
||
'
Документ
'
;
if
(
parentContainer
)
{
parentContainer
.
empty
();
parentContainer
.
append
(
body
);
}
else
{
const
dialog
=
UTILS
.
getFullModalDialog
(
meaning
,
body
);
UIkit
.
modal
(
dialog
).
show
();
dialog
.
on
(
'
hidden
'
,
()
=>
{
dialog
.
remove
();
if
(
closeDialogHandler
&&
player
.
model
.
hasChanges
)
closeDialogHandler
();
});
}
Cons
.
hideLoader
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment