+
@@ -75,6 +111,7 @@
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
var saveEditRoleSubAccountAjax = `@Url.Page("./Index", "EditRole")`;
var permissionListAjax = `@Url.Page("./Index", "Permissions")`;
+ var workshopListAjax = `@Url.Page("./Index", "WorkshopList")`;
var itemsPermission = @Html.Raw(Json.Serialize(Model.Permissions));
\ No newline at end of file
diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/css/ModalCreateRole.css b/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/css/ModalCreateRole.css
index 310b39c0..8e8b5b7f 100644
--- a/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/css/ModalCreateRole.css
+++ b/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/css/ModalCreateRole.css
@@ -1,4 +1,8 @@
-.errored {
+.modal-dialog {
+ max-width: 750px;
+}
+
+.errored {
animation: shake 300ms;
color: #eb3434 !important;
background-color: #fef2f2 !important;
@@ -30,7 +34,191 @@
width: 80px;
}*/
+.form-role-section {
+ display: grid;
+ grid-template-columns: repeat(6, minmax(0, 1fr));
+ gap: 8px;
+}
+.form-role-workshop-section {
+ grid-column: span 2 / span 2;
+}
+
+.workshop__mobile {
+ display: none;
+}
+
+.workshop-mobile-footer {
+ display: none;
+}
+
+.form-role-workshop-section-mobile {
+ position: fixed;
+ display: block !important;
+ bottom: 0;
+ right: 0;
+ width: 100%;
+ height: 350px;
+ z-index: 120;
+}
+
+.form-role-workshop-section-mobile::before {
+ content: "";
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100vh;
+ background: #000000;
+ opacity: 0.5;
+ z-index: 100;
+}
+
+.form-role-workshop-section-mobile .workshop__mobile {
+ display: block;
+}
+
+.form-role-workshop-section-mobile .workshop__mobile .workshop__label-mobile {
+ font-size: 16px;
+ color: #292929;
+ font-weight: 700 !important;
+}
+
+.form-role-workshop-section-mobile .workshop__mobile svg {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ margin: 10px 0;
+}
+
+.form-role-workshop-section-mobile .workshop {
+ border: none;
+ border-radius: 7px 7px 0 0;
+ z-index: 120;
+}
+
+.form-role-workshop-section-mobile .workshop .workshop__label {
+ display: none
+}
+
+.form-role-workshop-section-mobile .workshop #workshopItems {
+ height: 207px;
+ overflow-y: scroll;
+}
+
+.form-role-workshop-section-mobile .workshop .workshop-mobile-footer {
+ display: block;
+ border-top: 1px solid #D5D5D5;
+ padding: 11px 0;
+ margin: 11px 0;
+}
+
+.form-role-workshop-section-mobile .workshop .workshop-mobile-footer button {
+ width: 100%;
+ color: #fff;
+ padding: 5px 0;
+ border-radius: 5px;
+ height: 32px;
+}
+
+.form-role-workshop-section-mobile .workshop .workshop-mobile-footer button.btn-cancel {
+ background-color: #1F2937;
+}
+
+.form-role-workshop-section-mobile .workshop .workshop-mobile-footer button.btn-success {
+ background-color: #84CC16;
+}
+
+
+.form-role-all-section {
+ grid-column: span 4 / span 4;
+}
+
+.workshop {
+ position: relative;
+ background-color: #ffffff;
+ border: 1px solid #D1D1D1;
+ border-radius: 7px;
+ padding: 10px;
+ height: 100%;
+}
+
+.workshop__label {
+ position: absolute;
+ top: -11px;
+ right: 10px;
+ font-size: 12px;
+ color: #797979;
+ text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
+}
+
+.workshop__item {
+ width: 100%;
+ margin: 0 0 4px 0;
+}
+
+.workshop__checkbox {
+ display: none;
+}
+
+.workshop__label-text {
+ font-size: 12px;
+ font-weight: 500;
+ color: #0F8080;
+ background-color: #ffffff;
+ border: 1px solid #1D9D9D;
+ padding: 6px 9px;
+ border-radius: 9px;
+ width: 100%;
+ transition: all 0.3s ease-in-out;
+ cursor: pointer;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+/*.workshop__label-text:hover {
+ color: #ffffff;
+ background-color: #1c7474;
+ border-color: #23A8A8;
+}*/
+
+/* Rectangle 4252 */
+
+/*box-sizing: border-box;
+
+position: absolute;
+width: 320px;
+height: 30px;
+left: 28px;
+top: 127px;*/
+/* linear */
+/*background: linear-gradient(93.83deg, #2EBEBE 1.59%, #1E9D9D 47.86%, #0B7878 101.16%);
+border-radius: 7px;*/
+
+
+.workshop__checkbox:checked + .workshop__label-text {
+ color: #ffffff;
+ background-color: #1D9D9D;
+}
+
+.workshop-mobile-btn {
+ width: 100%;
+ color: #ffffff;
+ background: linear-gradient(93.83deg, #2EBEBE 1.59%, #1E9D9D 47.86%, #0B7878 101.16%);
+ font-size: 14px;
+ padding: 6px;
+ border-radius: 5px;
+}
+
+.workshop-mobile-btn__badge-number {
+ width: 20px;
+ height: 20px;
+ background: #fff;
+ border-radius: 4px;
+ color: #158c8c;
+}
/************************ checkbox Button Input () ************************/
.form-check-input[type="checkbox"] {
width: 15px;
@@ -100,7 +288,7 @@
}
.permissionBox {
- margin: 10px 0 0 0;
+ /*margin: 10px 0 0 0;*/
border: 1px solid #D1D1D1;
background-color: #FAFAFA;
border-radius: 7px;
@@ -179,8 +367,23 @@
background-color: transparent;
}
-@media (max-width:1366px) {
- #tree {
- height: 360px;
- }
- }
\ No newline at end of file
+@media (max-width: 1366px) {
+ #tree {
+ height: 360px;
+ }
+}
+
+
+@media (max-width: 768px) {
+ .modal-dialog {
+ max-width: 530px;
+ }
+
+ .form-role-workshop-section {
+ display: none;
+ }
+
+ .form-role-all-section {
+ grid-column: span 6 / span 6;
+ }
+}
\ No newline at end of file
diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalCreateRole.js b/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalCreateRole.js
index 2209ed63..ab0dcad1 100644
--- a/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalCreateRole.js
+++ b/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalCreateRole.js
@@ -1,5 +1,6 @@
$(document).ready(function () {
ajaxPermissionsList();
+ ajaxWorkshops();
$('#search-input').on('keyup', function () {
var searchText = $(this).val().toLowerCase();
@@ -203,6 +204,77 @@ function ajaxPermissionsList() {
});
}
+function ajaxWorkshops() {
+ var html = '';
+ $.ajax({
+ url: workshopListAjax,
+ type: 'GET',
+ success: function (response) {
+ if (response.success) {
+ var items = response.data;
+ items.forEach(function (item) {
+ html += `
+
+
+
`;
+ });
+ $('#workshopItems').html(html);
+ } else {
+ $('.alert-msg').show();
+ $('.alert-msg p').text(response.message);
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text('');
+ }, 3500);
+ }
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ }
+ });
+}
+
+function showModalWorkshop() {
+ $('.form-role-workshop-section').addClass('form-role-workshop-section-mobile');
+ $('body').css('overflow', 'hidden');
+}
+
+function hideModalWorkshop() {
+ $('.form-role-workshop-section').removeClass('form-role-workshop-section-mobile');
+ $('body').css('overflow', 'auto');
+}
+
+function chooseWorkshops() {
+
+ const checkedWorkshops = $('input[name="WorkshopIds[]"]:checked');
+
+ if (checkedWorkshops.length === 0) {
+ $('.alert-msg').show();
+ $('.alert-msg p').text('لطفا کارگاه مورد نظر را انتخاب کنید');
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text('');
+ }, 3500);
+ return;
+ }
+
+ countSelectWorkshops();
+ hideModalWorkshop();
+}
+
+function countSelectWorkshops() {
+
+ const checkedWorkshops = $('input[name="WorkshopIds[]"]:checked');
+
+ if (checkedWorkshops.length === 0) {
+ $('.workshop-mobile-btn__badge-number').hide().text(checkedWorkshops.length);
+ } else {
+ $('.workshop-mobile-btn__badge-number').show().text(checkedWorkshops.length);
+ }
+
+ hideModalWorkshop();
+}
+
$('#createData').on('click', SaveDataAjax);
function SaveDataAjax() {
var loading = $('#createData .spinner-loading');
@@ -220,6 +292,18 @@ function SaveDataAjax() {
return;
}
+ const checkedWorkshops = $('input[name="WorkshopIds[]"]:checked');
+
+ if (checkedWorkshops.length === 0) {
+ $('.alert-msg').show();
+ $('.alert-msg p').text('لطفا کارگاه مورد نظر را انتخاب کنید');
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text('');
+ }, 3500);
+ return;
+ }
+
var selectedPermissions = [];
$('input[name="Permissions"]').each(function () {
if (this.checked || this.indeterminate) {
@@ -283,4 +367,4 @@ function SaveDataAjax() {
console.log(err);
}
});
-}
+}
\ No newline at end of file
diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalEditRole.js b/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalEditRole.js
index 26c4a32f..214e6607 100644
--- a/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalEditRole.js
+++ b/ServiceHost/wwwroot/AssetsClient/pages/SubAccounts/js/ModalEditRole.js
@@ -1,6 +1,6 @@
$(document).ready(function () {
ajaxPermissionsList();
-
+ ajaxWorkshops();
$('#search-input').on('keyup', function () {
var searchText = $(this).val().toLowerCase();
@@ -237,6 +237,77 @@ function updateParentCheckbox(childCheckbox) {
}
}
+function ajaxWorkshops() {
+ var html = '';
+ $.ajax({
+ url: workshopListAjax,
+ type: 'GET',
+ success: function (response) {
+ if (response.success) {
+ var items = response.data;
+ items.forEach(function (item) {
+ html += `
+
+
+
`;
+ });
+ $('#workshopItems').html(html);
+ } else {
+ $('.alert-msg').show();
+ $('.alert-msg p').text(response.message);
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text('');
+ }, 3500);
+ }
+ },
+ error: function (xhr, status, error) {
+ console.error(xhr.responseText);
+ }
+ });
+}
+
+function showModalWorkshop() {
+ $('.form-role-workshop-section').addClass('form-role-workshop-section-mobile');
+ $('body').css('overflow', 'hidden');
+}
+
+function hideModalWorkshop() {
+ $('.form-role-workshop-section').removeClass('form-role-workshop-section-mobile');
+ $('body').css('overflow', 'auto');
+}
+
+function chooseWorkshops() {
+
+ const checkedWorkshops = $('input[name="WorkshopIds[]"]:checked');
+
+ if (checkedWorkshops.length === 0) {
+ $('.alert-msg').show();
+ $('.alert-msg p').text('لطفا کارگاه مورد نظر را انتخاب کنید');
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text('');
+ }, 3500);
+ return;
+ }
+
+ countSelectWorkshops();
+ hideModalWorkshop();
+}
+
+function countSelectWorkshops() {
+
+ const checkedWorkshops = $('input[name="WorkshopIds[]"]:checked');
+
+ if (checkedWorkshops.length === 0) {
+ $('.workshop-mobile-btn__badge-number').hide().text(checkedWorkshops.length);
+ } else {
+ $('.workshop-mobile-btn__badge-number').show().text(checkedWorkshops.length);
+ }
+
+ hideModalWorkshop();
+}
+
$('#createData').on('click', SaveDataAjax);
function SaveDataAjax() {
var loading = $('#createData .spinner-loading');
@@ -256,6 +327,18 @@ function SaveDataAjax() {
return;
}
+ const checkedWorkshops = $('input[name="WorkshopIds[]"]:checked');
+
+ if (checkedWorkshops.length === 0) {
+ $('.alert-msg').show();
+ $('.alert-msg p').text('لطفا کارگاه مورد نظر را انتخاب کنید');
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text('');
+ }, 3500);
+ return;
+ }
+
var selectedPermissions = [];
$('input[name="Permissions"]').each(function () {
if (this.checked || this.indeterminate) {