|
- {"ast":null,"code":"import { createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, vModelText as _vModelText, withDirectives as _withDirectives, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, vModelSelect as _vModelSelect, createTextVNode as _createTextVNode, createBlock as _createBlock, withModifiers as _withModifiers } from \"vue\";\nconst _hoisted_1 = {\n class: \"modal fade\",\n id: \"editUser\",\n tabindex: \"-1\",\n role: \"dialog\",\n \"aria-labelledby\": \"exampleModalLabel\",\n \"aria-hidden\": \"false\"\n};\nconst _hoisted_2 = {\n class: \"modal-dialog modal-sm\",\n role: \"document\"\n};\nconst _hoisted_3 = {\n class: \"modal-content\"\n};\nconst _hoisted_4 = {\n class: \"modal-body\"\n};\nconst _hoisted_5 = {\n class: \"form-group\"\n};\nconst _hoisted_6 = {\n key: 0,\n class: \"text-danger\"\n};\nconst _hoisted_7 = {\n class: \"form-group\"\n};\nconst _hoisted_8 = {\n key: 0,\n class: \"text-danger\"\n};\nconst _hoisted_9 = {\n class: \"form-group\"\n};\nconst _hoisted_10 = {\n class: \"input-group\"\n};\nconst _hoisted_11 = {\n key: 0,\n class: \"text-danger\"\n};\nconst _hoisted_12 = {\n class: \"form-group\"\n};\nconst _hoisted_13 = {\n class: \"input-group\"\n};\nconst _hoisted_14 = {\n key: 0,\n class: \"text-danger\"\n};\nconst _hoisted_15 = {\n class: \"d-flex justify-content-end gap-2\",\n style: {\n \"margin-top\": \"20px\"\n }\n};\nconst _hoisted_16 = [\"disabled\"];\nconst _hoisted_17 = {\n key: 0,\n class: \"spinner-border spinner-border-sm\",\n role: \"status\"\n};\nexport function render(_ctx, _cache, $props, $setup, $data, $options) {\n const _component_BCol = _resolveComponent(\"BCol\");\n const _component_BRow = _resolveComponent(\"BRow\");\n const _component_BFormCheckbox = _resolveComponent(\"BFormCheckbox\");\n const _component_BCard = _resolveComponent(\"BCard\");\n return _openBlock(), _createElementBlock(\"div\", _hoisted_1, [_createElementVNode(\"div\", _hoisted_2, [_createElementVNode(\"div\", _hoisted_3, [_cache[32] || (_cache[32] = _createElementVNode(\"div\", {\n class: \"modal-header\"\n }, [_createElementVNode(\"h5\", {\n class: \"modal-title\",\n id: \"exampleModalLabel\"\n }, \"ویرایش کردن کاربر\"), _createElementVNode(\"button\", {\n type: \"button\",\n class: \"btn-close\",\n \"data-bs-dismiss\": \"modal\",\n \"aria-label\": \"Close\"\n })], -1 /* HOISTED */)), _createElementVNode(\"div\", _hoisted_4, [_createElementVNode(\"form\", {\n onSubmit: _cache[16] || (_cache[16] = _withModifiers((...args) => $setup.editUser && $setup.editUser(...args), [\"prevent\"]))\n }, [_createVNode(_component_BRow, {\n class: \"g-3\"\n }, {\n default: _withCtx(() => [_createCommentVNode(\" Form fields \"), _createVNode(_component_BCol, {\n class: \"col-lg-6\"\n }, {\n default: _withCtx(() => [_createElementVNode(\"div\", _hoisted_5, [_cache[17] || (_cache[17] = _createElementVNode(\"label\", {\n class: \"form-label\"\n }, \"نام \", -1 /* HOISTED */)), _withDirectives(_createElementVNode(\"input\", {\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = $event => $setup.localName = $event),\n onInput: _cache[1] || (_cache[1] = $event => $setup.clearError('name')),\n type: \"text\",\n class: \"form-control\",\n placeholder: \"نام کاربر را وارد نمایید\"\n }, null, 544 /* NEED_HYDRATION, NEED_PATCH */), [[_vModelText, $setup.localName]]), $setup.errors.name ? (_openBlock(), _createElementBlock(\"small\", _hoisted_6, _toDisplayString($setup.errors.name), 1 /* TEXT */)) : _createCommentVNode(\"v-if\", true)])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BCol, {\n class: \"col-lg-6\"\n }, {\n default: _withCtx(() => [_createElementVNode(\"div\", _hoisted_7, [_cache[18] || (_cache[18] = _createElementVNode(\"label\", {\n class: \"form-label\"\n }, \"موبایل\", -1 /* HOISTED */)), _withDirectives(_createElementVNode(\"input\", {\n \"onUpdate:modelValue\": _cache[2] || (_cache[2] = $event => $setup.localMobile = $event),\n onInput: _cache[3] || (_cache[3] = $event => $setup.clearError('mobile')),\n type: \"text\",\n class: \"form-control\",\n placeholder: \"شماره موبایل کاربر را وارد نمایید\"\n }, null, 544 /* NEED_HYDRATION, NEED_PATCH */), [[_vModelText, $setup.localMobile]]), $setup.errors.mobile ? (_openBlock(), _createElementBlock(\"small\", _hoisted_8, _toDisplayString($setup.errors.mobile), 1 /* TEXT */)) : _createCommentVNode(\"v-if\", true)])]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BRow, {\n class: \"g-3\"\n }, {\n default: _withCtx(() => [_createCommentVNode(\" User Type \"), _createVNode(_component_BCol, {\n class: \"col-lg-6\"\n }, {\n default: _withCtx(() => [_createElementVNode(\"div\", _hoisted_9, [_cache[21] || (_cache[21] = _createElementVNode(\"label\", {\n class: \"form-label\"\n }, \"نوع کاربر\", -1 /* HOISTED */)), _createElementVNode(\"div\", _hoisted_10, [$setup.localRole != 0 ? _withDirectives((_openBlock(), _createElementBlock(\"select\", {\n key: 0,\n class: \"form-select\",\n \"onUpdate:modelValue\": _cache[4] || (_cache[4] = $event => $setup.localRole = $event),\n onChange: _cache[5] || (_cache[5] = $event => $setup.clearError('role'))\n }, _cache[19] || (_cache[19] = [_createElementVNode(\"option\", {\n disabled: \"\",\n value: \"\"\n }, \"نوع کاربر\", -1 /* HOISTED */), _createElementVNode(\"option\", {\n value: \"1\"\n }, \"کاربر\", -1 /* HOISTED */), _createElementVNode(\"option\", {\n value: \"2\"\n }, \"اپراتور\", -1 /* HOISTED */)]), 544 /* NEED_HYDRATION, NEED_PATCH */)), [[_vModelSelect, $setup.localRole]]) : $setup.localRole == 0 ? _withDirectives((_openBlock(), _createElementBlock(\"select\", {\n key: 1,\n class: \"form-select\",\n \"onUpdate:modelValue\": _cache[6] || (_cache[6] = $event => $setup.localRole = $event),\n onChange: _cache[7] || (_cache[7] = $event => $setup.clearError('role'))\n }, _cache[20] || (_cache[20] = [_createElementVNode(\"option\", {\n disabled: \"\",\n value: \"\"\n }, \"نوع کاربر\", -1 /* HOISTED */), _createElementVNode(\"option\", {\n value: \"1\"\n }, \"کاربر\", -1 /* HOISTED */), _createElementVNode(\"option\", {\n value: \"2\"\n }, \"اپراتور\", -1 /* HOISTED */), _createElementVNode(\"option\", {\n value: \"0\"\n }, \"مدیر\", -1 /* HOISTED */)]), 544 /* NEED_HYDRATION, NEED_PATCH */)), [[_vModelSelect, $setup.localRole]]) : _createCommentVNode(\"v-if\", true)]), $setup.errors.role ? (_openBlock(), _createElementBlock(\"small\", _hoisted_11, _toDisplayString($setup.errors.role), 1 /* TEXT */)) : _createCommentVNode(\"v-if\", true)])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BCol, {\n class: \"col-lg-6\"\n }, {\n default: _withCtx(() => [_createElementVNode(\"div\", _hoisted_12, [_cache[23] || (_cache[23] = _createElementVNode(\"label\", {\n class: \"form-label\"\n }, \"رمز عبور\", -1 /* HOISTED */)), _createElementVNode(\"div\", _hoisted_13, [_cache[22] || (_cache[22] = _createElementVNode(\"span\", {\n class: \"input-group-text\"\n }, [_createElementVNode(\"i\", {\n class: \"feather icon-lock\"\n })], -1 /* HOISTED */)), _withDirectives(_createElementVNode(\"input\", {\n \"onUpdate:modelValue\": _cache[8] || (_cache[8] = $event => $setup.Password = $event),\n onInput: _cache[9] || (_cache[9] = $event => $setup.clearError('password')),\n type: \"password\",\n class: \"form-control\",\n placeholder: \"رمز عبور خود را وارد نمایید\"\n }, null, 544 /* NEED_HYDRATION, NEED_PATCH */), [[_vModelText, $setup.Password]])]), $setup.errors.password ? (_openBlock(), _createElementBlock(\"small\", _hoisted_14, _toDisplayString($setup.errors.password), 1 /* TEXT */)) : _createCommentVNode(\"v-if\", true)])]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n }), $setup.localRole == `2` ? (_openBlock(), _createBlock(_component_BCard, {\n key: 0,\n class: \"p-4\"\n }, {\n default: _withCtx(() => [_createCommentVNode(\" Access Checkboxes \"), _createVNode(_component_BRow, {\n class: \"g-3 justify-content-center\"\n }, {\n default: _withCtx(() => [_createVNode(_component_BCol, {\n cols: \"6\",\n class: \"d-flex\"\n }, {\n default: _withCtx(() => [_createVNode(_component_BFormCheckbox, {\n class: \"ml-3\",\n checked: $setup.localAccess?.includes('user'),\n onChange: _cache[10] || (_cache[10] = $event => $setup.toggleAccess('user'))\n }, {\n default: _withCtx(() => _cache[24] || (_cache[24] = [_createTextVNode(\"دسترسی به کاربران\")])),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"checked\"])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BCol, {\n cols: \"6\",\n class: \"d-flex\"\n }, {\n default: _withCtx(() => [_createVNode(_component_BFormCheckbox, {\n class: \"ml-3\",\n checked: $setup.localAccess?.includes('subjects'),\n onChange: _cache[11] || (_cache[11] = $event => $setup.toggleAccess('subjects'))\n }, {\n default: _withCtx(() => _cache[25] || (_cache[25] = [_createTextVNode(\"دسترسی به موضوع ها\")])),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"checked\"])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BCol, {\n cols: \"6\",\n class: \"d-flex\"\n }, {\n default: _withCtx(() => [_createVNode(_component_BFormCheckbox, {\n class: \"ml-3\",\n checked: $setup.localAccess?.includes('locations'),\n onChange: _cache[12] || (_cache[12] = $event => $setup.toggleAccess('locations'))\n }, {\n default: _withCtx(() => _cache[26] || (_cache[26] = [_createTextVNode(\"دسترسی به موقعیت ها\")])),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"checked\"])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BCol, {\n cols: \"6\",\n class: \"d-flex\"\n }, {\n default: _withCtx(() => [_createVNode(_component_BFormCheckbox, {\n class: \"ml-3\",\n checked: $setup.localAccess?.includes('meeting'),\n onChange: _cache[13] || (_cache[13] = $event => $setup.toggleAccess('meeting'))\n }, {\n default: _withCtx(() => _cache[27] || (_cache[27] = [_createTextVNode(\"دسترسی به جلسات\")])),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"checked\"])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BCol, {\n cols: \"6\",\n class: \"d-flex\"\n }, {\n default: _withCtx(() => [_createVNode(_component_BFormCheckbox, {\n class: \"ml-3\",\n checked: $setup.localAccess?.includes('private_meeting'),\n onChange: _cache[14] || (_cache[14] = $event => $setup.toggleAccess('private_meeting'))\n }, {\n default: _withCtx(() => _cache[28] || (_cache[28] = [_createTextVNode(\"دسترسی به جلسات شخصی\")])),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"checked\"])]),\n _: 1 /* STABLE */\n }), _createVNode(_component_BCol, {\n cols: \"6\",\n class: \"d-flex\"\n }, {\n default: _withCtx(() => [_createVNode(_component_BFormCheckbox, {\n class: \"ml-3\",\n checked: $setup.localAccess?.includes('note'),\n onChange: _cache[15] || (_cache[15] = $event => $setup.toggleAccess('note'))\n }, {\n default: _withCtx(() => _cache[29] || (_cache[29] = [_createTextVNode(\"دسترسی به یاد داشت ها\")])),\n _: 1 /* STABLE */\n }, 8 /* PROPS */, [\"checked\"])]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })]),\n _: 1 /* STABLE */\n })) : _createCommentVNode(\"v-if\", true), _createCommentVNode(\" Submit Buttons \"), _createElementVNode(\"div\", _hoisted_15, [_cache[31] || (_cache[31] = _createElementVNode(\"button\", {\n type: \"button\",\n class: \"btn btn-secondary\",\n \"data-bs-dismiss\": \"modal\"\n }, \" بستن \", -1 /* HOISTED */)), _createElementVNode(\"button\", {\n type: \"submit\",\n class: \"btn btn-primary\",\n disabled: $setup.loading\n }, [$setup.loading ? (_openBlock(), _createElementBlock(\"span\", _hoisted_17)) : _createCommentVNode(\"v-if\", true), _cache[30] || (_cache[30] = _createTextVNode(\" ذخیره \"))], 8 /* PROPS */, _hoisted_16)])], 32 /* NEED_HYDRATION */)])])])]);\n}","map":{"version":3,"names":["class","id","tabindex","role","key","style","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","type","_hoisted_4","onSubmit","_cache","_withModifiers","args","$setup","editUser","_createVNode","_component_BRow","default","_withCtx","_createCommentVNode","_component_BCol","_hoisted_5","$event","localName","onInput","clearError","placeholder","errors","name","_hoisted_6","_toDisplayString","_","_hoisted_7","localMobile","mobile","_hoisted_8","_hoisted_9","_hoisted_10","localRole","onChange","disabled","value","_hoisted_11","_hoisted_12","_hoisted_13","Password","password","_hoisted_14","_createBlock","_component_BCard","cols","_component_BFormCheckbox","checked","localAccess","includes","toggleAccess","_createTextVNode","_hoisted_15","loading","_hoisted_17","_hoisted_16"],"sources":["C:\\Users\\hp\\Desktop\\satari\\Vue\\Admin\\src\\components\\modals\\editUser.vue"],"sourcesContent":["<template>\r\n <div\r\n class=\"modal fade\"\r\n id=\"editUser\"\r\n tabindex=\"-1\"\r\n role=\"dialog\"\r\n aria-labelledby=\"exampleModalLabel\"\r\n aria-hidden=\"false\"\r\n >\r\n <div class=\"modal-dialog modal-sm\" role=\"document\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h5 class=\"modal-title\" id=\"exampleModalLabel\">ویرایش کردن کاربر</h5>\r\n <button\r\n type=\"button\"\r\n class=\"btn-close\"\r\n data-bs-dismiss=\"modal\"\r\n aria-label=\"Close\"\r\n ></button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <form @submit.prevent=\"editUser\">\r\n <BRow class=\"g-3\">\r\n <!-- Form fields -->\r\n <BCol class=\"col-lg-6\">\r\n <div class=\"form-group\">\r\n <label class=\"form-label\">نام </label>\r\n <input\r\n v-model=\"localName\"\r\n @input=\"clearError('name')\"\r\n type=\"text\"\r\n class=\"form-control\"\r\n placeholder=\"نام کاربر را وارد نمایید\"\r\n />\r\n <small v-if=\"errors.name\" class=\"text-danger\">{{\r\n errors.name\r\n }}</small>\r\n </div>\r\n </BCol>\r\n\r\n <BCol class=\"col-lg-6\">\r\n <div class=\"form-group\">\r\n <label class=\"form-label\">موبایل</label>\r\n <input\r\n v-model=\"localMobile\"\r\n @input=\"clearError('mobile')\"\r\n type=\"text\"\r\n class=\"form-control\"\r\n placeholder=\"شماره موبایل کاربر را وارد نمایید\"\r\n />\r\n <small v-if=\"errors.mobile\" class=\"text-danger\">{{\r\n errors.mobile\r\n }}</small>\r\n </div>\r\n </BCol>\r\n </BRow>\r\n\r\n <BRow class=\"g-3\">\r\n <!-- User Type -->\r\n <BCol class=\"col-lg-6\">\r\n <div class=\"form-group\">\r\n <label class=\"form-label\">نوع کاربر</label>\r\n <div class=\"input-group\">\r\n <select\r\n v-if=\"localRole != 0\"\r\n class=\"form-select\"\r\n v-model=\"localRole\"\r\n @change=\"clearError('role')\"\r\n >\r\n <option disabled value=\"\">نوع کاربر</option>\r\n <option value=\"1\">کاربر</option>\r\n <option value=\"2\">اپراتور</option>\r\n </select>\r\n <select\r\n v-else-if=\"localRole == 0\"\r\n class=\"form-select\"\r\n v-model=\"localRole\"\r\n @change=\"clearError('role')\"\r\n >\r\n <option disabled value=\"\">نوع کاربر</option>\r\n <option value=\"1\">کاربر</option>\r\n <option value=\"2\">اپراتور</option>\r\n <option value=\"0\">مدیر</option>\r\n </select>\r\n </div>\r\n <small v-if=\"errors.role\" class=\"text-danger\">{{\r\n errors.role\r\n }}</small>\r\n </div>\r\n </BCol>\r\n\r\n <BCol class=\"col-lg-6\">\r\n <div class=\"form-group\">\r\n <label class=\"form-label\">رمز عبور</label>\r\n <div class=\"input-group\">\r\n <span class=\"input-group-text\">\r\n <i class=\"feather icon-lock\"></i>\r\n </span>\r\n <input\r\n v-model=\"Password\"\r\n @input=\"clearError('password')\"\r\n type=\"password\"\r\n class=\"form-control\"\r\n placeholder=\"رمز عبور خود را وارد نمایید\"\r\n />\r\n </div>\r\n <small v-if=\"errors.password\" class=\"text-danger\">{{\r\n errors.password\r\n }}</small>\r\n </div>\r\n </BCol>\r\n </BRow>\r\n\r\n <BCard v-if=\"localRole == `2`\" class=\"p-4\">\r\n <!-- Access Checkboxes -->\r\n <BRow class=\"g-3 justify-content-center\">\r\n <BCol cols=\"6\" class=\"d-flex\">\r\n <BFormCheckbox\r\n class=\"ml-3\"\r\n :checked=\"localAccess?.includes('user')\"\r\n @change=\"toggleAccess('user')\"\r\n >دسترسی به کاربران</BFormCheckbox\r\n >\r\n </BCol>\r\n <BCol cols=\"6\" class=\"d-flex\">\r\n <BFormCheckbox\r\n class=\"ml-3\"\r\n :checked=\"localAccess?.includes('subjects')\"\r\n @change=\"toggleAccess('subjects')\"\r\n >دسترسی به موضوع ها</BFormCheckbox\r\n >\r\n </BCol>\r\n <BCol cols=\"6\" class=\"d-flex\">\r\n <BFormCheckbox\r\n class=\"ml-3\"\r\n :checked=\"localAccess?.includes('locations')\"\r\n @change=\"toggleAccess('locations')\"\r\n >دسترسی به موقعیت ها</BFormCheckbox\r\n >\r\n </BCol>\r\n <BCol cols=\"6\" class=\"d-flex\">\r\n <BFormCheckbox\r\n class=\"ml-3\"\r\n :checked=\"localAccess?.includes('meeting')\"\r\n @change=\"toggleAccess('meeting')\"\r\n >دسترسی به جلسات</BFormCheckbox\r\n >\r\n </BCol>\r\n <BCol cols=\"6\" class=\"d-flex\">\r\n <BFormCheckbox\r\n class=\"ml-3\"\r\n :checked=\"localAccess?.includes('private_meeting')\"\r\n @change=\"toggleAccess('private_meeting')\"\r\n >دسترسی به جلسات شخصی</BFormCheckbox\r\n >\r\n </BCol>\r\n <BCol cols=\"6\" class=\"d-flex\">\r\n <BFormCheckbox\r\n class=\"ml-3\"\r\n :checked=\"localAccess?.includes('note')\"\r\n @change=\"toggleAccess('note')\"\r\n >دسترسی به یاد داشت ها</BFormCheckbox\r\n >\r\n </BCol>\r\n </BRow>\r\n </BCard>\r\n\r\n <!-- Submit Buttons -->\r\n <div\r\n class=\"d-flex justify-content-end gap-2\"\r\n style=\"margin-top: 20px\"\r\n >\r\n <button\r\n type=\"button\"\r\n class=\"btn btn-secondary\"\r\n data-bs-dismiss=\"modal\"\r\n >\r\n بستن\r\n </button>\r\n <button type=\"submit\" class=\"btn btn-primary\" :disabled=\"loading\">\r\n <span\r\n v-if=\"loading\"\r\n class=\"spinner-border spinner-border-sm\"\r\n role=\"status\"\r\n ></span>\r\n ذخیره\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { ref, watch, toRef } from \"vue\";\r\nimport axios from \"axios\";\r\nimport Swal from \"sweetalert2\";\r\nimport { toast } from \"vue3-toastify\";\r\n\r\nexport default {\r\n props: {\r\n mobile: {\r\n type: String,\r\n required: true,\r\n },\r\n name: {\r\n type: String,\r\n required: true,\r\n },\r\n role: {\r\n type: String,\r\n required: true,\r\n },\r\n id: {\r\n type: String,\r\n required: true,\r\n },\r\n access: {\r\n type: Array,\r\n required: true,\r\n },\r\n },\r\n setup(props, { emit }) {\r\n const localName = toRef(props.name);\r\n const localMobile = toRef(props.mobile);\r\n const Password = toRef(props.password);\r\n const localRole = toRef(props.role);\r\n const localAccess = toRef(props.access);\r\n const localId = toRef(props.id);\r\n // Watch for prop changes to update local state\r\n watch(\r\n () => props.name,\r\n (newVal) => (localName.value = newVal)\r\n );\r\n watch(\r\n () => props.mobile,\r\n (newVal) => (localMobile.value = newVal)\r\n );\r\n watch(\r\n () => props.role,\r\n (newVal) => (localRole.value = newVal)\r\n );\r\n watch(\r\n () => props.access,\r\n (newVal) => (localAccess.value = newVal)\r\n );\r\n watch(\r\n () => props.id,\r\n (newVal) => (localId.value = newVal)\r\n );\r\n\r\n const errors = ref({});\r\n const loading = ref(false);\r\n const url = process.env.VUE_APP_ROOT_URL;\r\n const token = localStorage.getItem(\"token\");\r\n\r\n const validateForm = () => {\r\n errors.value = {};\r\n if (!localName.value)\r\n errors.value.localName = \"وارد کردن نام الزامی می باشد\";\r\n if (!localMobile.value)\r\n errors.value.localMobile = \"وارد کردن شماره موبایل الزامی می باشد\";\r\n if (!Password.value)\r\n errors.value.password = \"وارد کردن رمز عبور الزامی است\";\r\n if (!localRole.value)\r\n errors.value.localRole = \"انتخاب نوع کاربر الزامی است\";\r\n return Object.keys(errors.value).length === 0;\r\n };\r\n\r\n const clearError = (field) => {\r\n errors.value[field] = \"\";\r\n };\r\n\r\n const toggleAccess = (permission) => {\r\n if (localAccess.value.includes(permission)) {\r\n localAccess.value = localAccess.value.filter(\r\n (item) => item !== permission\r\n );\r\n } else {\r\n localAccess.value = [...localAccess.value, permission];\r\n }\r\n };\r\n\r\n const editUser = async () => {\r\n if (!validateForm()) return;\r\n loading.value = true;\r\n try {\r\n const formData = new FormData();\r\n formData.append(\"name\", localName.value);\r\n formData.append(\"mobile\", localMobile.value);\r\n if(Password.value){\r\n \r\n }\r\n \r\n formData.append(\"role\", localRole.value);\r\n formData.append(\"id\", localId.value);\r\n if (Array.isArray(localAccess.value)) {\r\n localAccess.value.forEach((item) => {\r\n formData.append(\"access[]\", item);\r\n });\r\n } else {\r\n console.error(\"localAccess.value is not an array\", localAccess.value);\r\n }\r\n const response = await axios.post(`${url}/admin/edit-user`, formData, {\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n Authorization: `Bearer ${token} `,\r\n },\r\n });\r\n console.log(response);\r\n\r\n if (response.data.status == true) {\r\n toast.success(\"کاربر با موفقیت ویرایش شد!\", {\r\n position: \"top-right\",\r\n autoClose: 1000,\r\n onClose: () => emit(\"user-updated\"),\r\n });\r\n } else {\r\n Swal.fire({\r\n icon: \"error\",\r\n title: \"خطا\",\r\n text: \"ویرایش کاربر با مشکل مواجه شد. لطفا دوباره امتحان کنید.\",\r\n });\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n Swal.fire({\r\n icon: \"error\",\r\n title: \"خطا\",\r\n text: `ویرایش کاربر با مشکل مواجه شد`,\r\n });\r\n } finally {\r\n loading.value = false;\r\n }\r\n };\r\n\r\n return {\r\n localName,\r\n localMobile,\r\n Password,\r\n localRole,\r\n localAccess,\r\n errors,\r\n loading,\r\n clearError,\r\n editUser,\r\n toggleAccess,\r\n };\r\n },\r\n};\r\n</script>\r\n\r\n<style scoped>\r\n.profile-upload-wrapper {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n}\r\n\r\n.profile-upload-icon {\r\n font-size: 64px;\r\n color: #6c757d;\r\n border: 2px dashed #6c757d;\r\n border-radius: 50%;\r\n width: 120px;\r\n height: 120px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n margin-bottom: 10px;\r\n}\r\n.modal-dialog {\r\n max-width: 50%;\r\n}\r\n\r\n.modal-content {\r\n padding: 20px;\r\n}\r\n\r\n.modal-header {\r\n border-bottom: 1px solid #dee2e6;\r\n}\r\n\r\n.modal-body {\r\n padding: 20px;\r\n}\r\n\r\n.form-group {\r\n margin-bottom: 1rem;\r\n}\r\n\r\n.input-group {\r\n margin-top: 0.5rem;\r\n}\r\n.profile-upload-wrapper {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n}\r\n\r\n.profile-upload-btn {\r\n width: 50px;\r\n height: 50px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n cursor: pointer;\r\n border: 2px solid #007bff;\r\n background-color: #ffffff;\r\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\r\n}\r\n\r\n.profile-upload-btn i {\r\n font-size: 20px;\r\n color: #007bff;\r\n}\r\n\r\n.profile-image-preview {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n\r\n.profile-placeholder {\r\n border: 2px dashed #007bff;\r\n}\r\n\r\n.d-none {\r\n display: none;\r\n}\r\n.profile-upload-wrapper {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n}\r\n\r\n.profile-upload-btn {\r\n width: 30px; /* اندازه دکمه را کوچکتر کنید */\r\n height: 30px;\r\n padding: 0;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n border: 1px solid #ccc; /* کمی خط دور دکمه برای بهتر دیده شدن */\r\n background-color: #fff;\r\n cursor: pointer;\r\n}\r\n\r\n.profile-upload-btn i {\r\n font-size: 16px; /* اندازه آیکون را کوچکتر کنید */\r\n color: #007bff; /* رنگ آیکون را تغییر دهید */\r\n}\r\n\r\n.profile-image-preview img,\r\n.profile-placeholder {\r\n width: 80px;\r\n height: 80px;\r\n}\r\n\r\n.profile-placeholder i {\r\n font-size: 40px;\r\n}\r\n.modal-dialog {\r\n max-width: 50%;\r\n}\r\n\r\n.modal-content {\r\n padding: 1.5rem; /* Increased padding for better spacing */\r\n}\r\n\r\n.modal-header {\r\n border-bottom: 1px solid #dee2e6;\r\n padding-bottom: 1rem; /* Added padding-bottom to separate the header from the content */\r\n}\r\n\r\n.modal-body {\r\n padding: 1rem 1.5rem; /* Adjusted padding for a more balanced layout */\r\n}\r\n\r\n.form-group {\r\n margin-bottom: 1.5rem; /* Increased margin between form groups */\r\n}\r\n\r\n.input-group {\r\n margin-top: 0.5rem;\r\n}\r\n\r\n.profile-image-preview:hover .overlay {\r\n opacity: 1;\r\n}\r\n\r\n.profile-image-preview:hover img,\r\n.profile-image-preview:hover .profile-placeholder {\r\n opacity: 0.7;\r\n}\r\n</style>\r\n"],"mappings":";;EAEIA,KAAK,EAAC,YAAY;EAClBC,EAAE,EAAC,UAAU;EACbC,QAAQ,EAAC,IAAI;EACbC,IAAI,EAAC,QAAQ;EACb,iBAAe,EAAC,mBAAmB;EACnC,aAAW,EAAC;;;EAEPH,KAAK,EAAC,uBAAuB;EAACG,IAAI,EAAC;;;EACjCH,KAAK,EAAC;AAAe;;EAUnBA,KAAK,EAAC;AAAY;;EAKVA,KAAK,EAAC;AAAY;;EAzBvCI,GAAA;EAkC4CJ,KAAK,EAAC;;;EAO7BA,KAAK,EAAC;AAAY;;EAzCvCI,GAAA;EAkD8CJ,KAAK,EAAC;;;EAU/BA,KAAK,EAAC;AAAY;;EAEhBA,KAAK,EAAC;AAAa;;EA9D1CI,GAAA;EAqF4CJ,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