Projects (GanjooRazor -> DivanRazor, GanjoorService.sln -> DivanService.sln), files, folders, classes, namespaces, settings, API routes (/api/divan) and DB tables (Divan*). External addresses (ganjoor.net, github.com/ganjoor) unchanged. Migrations renamed consistently (no pending model changes); requires a fresh database. Upstream RUNNING_LOCALLY/SEMANTIC_SEARCH docs archived unmodified under docs/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
163 lines
5.9 KiB
Plaintext
163 lines
5.9 KiB
Plaintext
@page
|
|
@model DivanRazor.Areas.Admin.Pages.TransferMeterModel
|
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
|
@using DNTPersianUtils.Core
|
|
@{
|
|
Layout = "_AdminLayout";
|
|
ViewData["Title"] = "انتقال وزن";
|
|
}
|
|
|
|
<h1>@ViewData["Title"]</h1>
|
|
|
|
@if (!string.IsNullOrEmpty(Model.FatalError))
|
|
{
|
|
<p>@Model.FatalError</p>
|
|
}
|
|
else
|
|
{
|
|
<script>
|
|
function confirmAndFinalize() {
|
|
|
|
var rhythm_new = $('#rhythm-new').val();
|
|
var rhythm_new2 = $('#rhythm-new2').val();
|
|
if (!confirm('آیا از حذف وزن «'+rhythm_new+'» و انتقال شعرهای آن به وزن «'+rhythm_new2+'» اطمینان دارید؟'))
|
|
return;
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '',
|
|
data: {
|
|
rhythm: rhythm_new,
|
|
rhythm2: rhythm_new2,
|
|
|
|
},
|
|
error: function(e) {
|
|
if (e.responseText == null)
|
|
alert(e);
|
|
else
|
|
alert(e.responseText);
|
|
},
|
|
success: function(b) {
|
|
if (b == true) {
|
|
alert('انتقال انجام شد.');
|
|
}
|
|
else {
|
|
alert('خطا رخ داد.');
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
}
|
|
</script>
|
|
<table>
|
|
|
|
<tr>
|
|
<td>
|
|
وزنی که حذف میشود:
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="select-search">جستجوی وزن:</label><br />
|
|
<input type="text" id="select-search" value="@Model.InitialSourceMeter" oninput="doSearchInRhythmsCombo('select-search', 'rhythm-new')" list="inputRhythms" autocomplete="off" size="50" />
|
|
<datalist id="inputRhythms">
|
|
@if (Model.RhythmsByVerseCount != null)
|
|
@foreach (var rhythm in Model.RhythmsByVerseCount)
|
|
{
|
|
<option value="@rhythm.Rhythm">@rhythm.Rhythm</option>
|
|
}
|
|
</datalist>
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
|
|
<select id="rhythm-new" name="rhythm-new">
|
|
@foreach (var rhythm in Model.RhythmsAlphabetically)
|
|
if (rhythm.Rhythm == Model.InitialSourceMeter)
|
|
{
|
|
<option value="@rhythm.Rhythm" selected>@rhythm.Rhythm</option>
|
|
}
|
|
else
|
|
{
|
|
<option value="@rhythm.Rhythm">@rhythm.Rhythm</option>
|
|
}
|
|
</select>
|
|
<a role="button" onclick="resetRhythm('rhythm-new')" class="pagebutton">پاک کردن وزن</a>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
وزن مقصد:
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<label for="select-search2">جستجوی وزن مقصد:</label><br />
|
|
<input type="text" id="select-search2" value="" oninput="doSearchInRhythmsCombo('select-search2', 'rhythm-new2')" list="inputRhythms" autocomplete="off" size="50" />
|
|
<datalist id="inputRhythms2">
|
|
@if (Model.RhythmsByVerseCount != null)
|
|
@foreach (var rhythm in Model.RhythmsByVerseCount)
|
|
{
|
|
<option value="@rhythm.Rhythm">@rhythm.Rhythm</option>
|
|
}
|
|
</datalist>
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="rhythm-new2">وزن مقصد انتخاب شده:</label><br /><select id="rhythm-new2" name="rhythm-new2">
|
|
@foreach (var rhythm in Model.RhythmsAlphabetically)
|
|
{
|
|
<option value="@rhythm.Rhythm">@rhythm.Rhythm</option>
|
|
|
|
}
|
|
</select>
|
|
<a role="button" onclick="resetRhythm('rhythm-new2')" class="pagebutton">پاک کردن وزن</a>
|
|
<br />
|
|
<script>
|
|
function newRhythm() {
|
|
var rhythm = prompt("پیشنهاد وزن جدید", "");
|
|
if (rhythm != null) {
|
|
var select = document.getElementById('rhythm-new');
|
|
var options = select.options;
|
|
for (let i = 0; i < options.length; i++) {
|
|
if (options[i].value == rhythm) {
|
|
alert('وزن پیشنهادی تکراری است.');
|
|
return;
|
|
}
|
|
}
|
|
var opt = document.createElement('option');
|
|
opt.value = rhythm;
|
|
opt.innerHTML = rhythm;
|
|
select.appendChild(opt);
|
|
|
|
var opt2 = document.createElement('option');
|
|
opt2.value = rhythm;
|
|
opt2.innerHTML = rhythm;
|
|
document.getElementById('rhythm-new2').appendChild(opt2);
|
|
|
|
alert('وزن پیشنهادی به انتهای لیست وزنها اضافه شده. لطفاً از لیست آن را انتخاب کنید.');
|
|
}
|
|
}
|
|
</script>
|
|
<a role="button" onclick="newRhythm()" class="pagebutton">پیشنهاد وزن جدید</a>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<a role="button" onclick="confirmAndFinalize()" class="pagebutton">انتقال</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
}
|
|
|