whole project pushed

This commit is contained in:
2025-08-23 16:13:20 +03:30
parent 1cbde63229
commit 76a1e32e34
36 changed files with 1798 additions and 315 deletions

View File

@ -6,7 +6,6 @@
ViewBag.Title = Model.User_Id == 0 ? "کاربر جدید" : Model.User_Name + " " + Model.User_Family;
Layout = "~/Views/_PanelSideBar.cshtml";
Functions functions = new Functions();
}
<form autocomplete="off">
<div class="row">
@ -165,6 +164,13 @@
تنظیمات
</label>
</div>
<div class="checkbox-list mb-3">
<label class="checkbox">
<input type="checkbox" name="chkAccess" value="ManageItems" @(Model.User_Access != null && Model.User_Access.Contains("ManageItems") ? "checked" : "") />
<span></span>
مدیریت دسته‌بندی و تگ
</label>
</div>
</div>
</div>
</div>
@ -219,6 +225,14 @@
});
function Save() {
// --- ADDED: Client-side validation for image on new users ---
var isNew = (Id === 0);
var fileInput = $("#fuImage")[0];
if (isNew && fileInput.files.length === 0) {
toastr.error("لطفاً یک تصویر برای کاربر انتخاب کنید.");
return; // Stop the function if image is missing
}
let Phone = $("#txtPhone").val().trim();
if (Phone.length) {
let Access = "";
@ -238,7 +252,7 @@
$("#btnSave").css("opacity", 0.5);
$("#btnSave").attr("onclick", "");
let model = {
Auth: { UserId: UserId, Token: Token },
Auth: { UserId: @User.User_Id, Token: "@User.User_Token" },
Id: Id,
Name: $("#txtName").val().trim(),
Family: $("#txtFamily").val().trim(),
@ -255,12 +269,18 @@
ajax.addEventListener("load", function (event) {
$("#btnSave").css("opacity", 1);
let data = JSON.parse(event.target.responseText);
if (data.Status == "Success") {
toastr.success("ذخیره سازی با موفقیت انجام شد");
setTimeout(function () {
location.href = `../Panel/User/${data.Result}`;
}, 1500);
} else {
}
else if (data.Status == "DuplicatePhone") {
$("#btnSave").attr("onclick", "Save()"); // Re-enable button
toastr.error("این شماره تلفن قبلاً در سیستم ثبت شده است!");
}
else {
$("#btnSave").attr("onclick", "Save()");
console.log(data);
toastr.warning("خطا هنگام ذخیره سازی اطلاعات");
@ -291,7 +311,7 @@
confirmButtonText: 'بله'
}).then((result) => {
if (result.value) {
$.post("../api/User/Delete", { Id: Id, UserId: UserId, Token: Token }).done(function (data) {
$.post("../api/User/Delete", { Id: Id, UserId: @User.User_Id, Token: "@User.User_Token" }).done(function (data) {
if (data.Status == "Success") {
$(".btns").remove();
toastr.success("حذف با موفقیت انجام شد");