PopupForm Field OnChange
This commit is contained in:
parent
407fbd80ba
commit
a1333ec647
6 changed files with 30 additions and 8 deletions
|
|
@ -42,6 +42,17 @@ public static class LookupQueryValues
|
||||||
$"ORDER BY \"{DisplayExpr}\";";
|
$"ORDER BY \"{DisplayExpr}\";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string MaterialValues =
|
||||||
|
$"SELECT " +
|
||||||
|
$"\"Id\" AS \"Key\", " +
|
||||||
|
$"\"Name\" AS \"Name\", " +
|
||||||
|
$"\"UomId\" AS \"UomId\", " +
|
||||||
|
$"\"SalesPrice\" AS \"UnitPrice\", " +
|
||||||
|
$"1 AS \"Quantity\" " +
|
||||||
|
$"FROM \"{FullNameTable(TableNameEnum.Material)}\" " +
|
||||||
|
$"WHERE \"IsDeleted\" = 'false' " +
|
||||||
|
$"ORDER BY \"Name\";";
|
||||||
|
|
||||||
public static string ProjectPhaseValues =
|
public static string ProjectPhaseValues =
|
||||||
$"SELECT " +
|
$"SELECT " +
|
||||||
$"\"Id\" AS \"Key\", " +
|
$"\"Id\" AS \"Key\", " +
|
||||||
|
|
|
||||||
|
|
@ -2778,11 +2778,11 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
||||||
{
|
{
|
||||||
new() {
|
new() {
|
||||||
Order=1, ColCount=2, ColSpan=1, ItemType="group", Items =[
|
Order=1, ColCount=2, ColSpan=1, ItemType="group", Items =[
|
||||||
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
|
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorScript = EditorScriptValues.MaterialOnChange },
|
||||||
new EditingFormItemDto { Order = 2, DataField="Quantity", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 2, DataField="Quantity", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 3, DataField="UnitPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 3, DataField="UnitPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 4, DataField="TotalAmount", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 4, DataField="TotalAmount", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 5, DataField="Uom", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
|
new EditingFormItemDto { Order = 5, DataField="UomId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
|
||||||
new EditingFormItemDto { Order = 6, DataField="DiscountRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 6, DataField="DiscountRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 7, DataField="DiscountAmount", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 7, DataField="DiscountAmount", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 8, DataField="TaxRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 8, DataField="TaxRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
|
|
@ -2835,7 +2835,13 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
AllowSearch = true,
|
AllowSearch = true,
|
||||||
LookupJson = LookupQueryValues.DefaultLookupQueryJson(nameof(TableNameEnum.Material), "Id", "Name"),
|
LookupJson = JsonSerializer.Serialize(new LookupDto
|
||||||
|
{
|
||||||
|
DataSourceType = UiLookupDataSourceTypeEnum.Query,
|
||||||
|
DisplayExpr = "Name",
|
||||||
|
ValueExpr = "Key",
|
||||||
|
LookupQuery = LookupQueryValues.MaterialValues
|
||||||
|
}),
|
||||||
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
ValidationRuleJson = DefaultValidationRuleRequiredJson,
|
||||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||||
|
|
|
||||||
|
|
@ -1153,7 +1153,7 @@ public class ListFormSeeder_Mrp : IDataSeedContributor, ITransientDependency
|
||||||
ListFormCode = listForm.ListFormCode,
|
ListFormCode = listForm.ListFormCode,
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.String,
|
SourceDbType = DbType.String,
|
||||||
FieldName = "Uom",
|
FieldName = "UomId",
|
||||||
Width = 200,
|
Width = 200,
|
||||||
ListOrderNo = 5,
|
ListOrderNo = 5,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
|
|
|
||||||
|
|
@ -3209,7 +3209,7 @@ public class ListFormSeeder_SupplyChain : IDataSeedContributor, ITransientDepend
|
||||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[
|
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[
|
||||||
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 2, DataField="Quantity", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 2, DataField="Quantity", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 3, DataField="Uom", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 3, DataField="UomId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 4, DataField="EstimatedPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 4, DataField="EstimatedPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 5, DataField="Specification", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
|
new EditingFormItemDto { Order = 5, DataField="Specification", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
|
||||||
new EditingFormItemDto { Order = 6, DataField="Justification", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
|
new EditingFormItemDto { Order = 6, DataField="Justification", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
|
||||||
|
|
@ -4158,7 +4158,7 @@ public class ListFormSeeder_SupplyChain : IDataSeedContributor, ITransientDepend
|
||||||
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[
|
Order=1, ColCount=1, ColSpan=1, ItemType="group", Items =[
|
||||||
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired =true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired =true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 2, DataField="Quantity", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 2, DataField="Quantity", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 3, DataField="Uom", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 3, DataField="UomId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 4, DataField="UnitPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 4, DataField="UnitPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 5, DataField="TotalPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 5, DataField="TotalPrice", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 6, DataField="LeadTime", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 6, DataField="LeadTime", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat },
|
||||||
|
|
@ -4865,7 +4865,7 @@ public class ListFormSeeder_SupplyChain : IDataSeedContributor, ITransientDepend
|
||||||
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 1, DataField="MaterialId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 2, DataField="UnitPrice", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 2, DataField="UnitPrice", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 3, DataField="Quantity", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 3, DataField="Quantity", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 4, DataField="Uom", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 4, DataField="UomId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 5, DataField="TotalPrice", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
new EditingFormItemDto { Order = 5, DataField="TotalPrice", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat },
|
||||||
new EditingFormItemDto { Order = 6, DataField="Description", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea },
|
new EditingFormItemDto { Order = 6, DataField="Description", ColSpan = 1, EditorType2 = EditorTypes.dxTextArea },
|
||||||
]}
|
]}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public static class PlatformConsts
|
||||||
{
|
{
|
||||||
public static string CalcTotalDaysFromDates = "(() => {const d=v=>!v?null:(v instanceof Date?v:new Date(v));const nf={...formData,[editor.dataField]:e?.value};const s=d(nf.StartDate),t=d(nf.EndDate);setFormData({...formData,TotalDays: s&&t?Math.max(0,Math.floor((Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())-Date.UTC(s.getFullYear(),s.getMonth(),s.getDate()))/(24*60*60*1000))+1):null});})();";
|
public static string CalcTotalDaysFromDates = "(() => {const d=v=>!v?null:(v instanceof Date?v:new Date(v));const nf={...formData,[editor.dataField]:e?.value};const s=d(nf.StartDate),t=d(nf.EndDate);setFormData({...formData,TotalDays: s&&t?Math.max(0,Math.floor((Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())-Date.UTC(s.getFullYear(),s.getMonth(),s.getDate()))/(24*60*60*1000))+1):null});})();";
|
||||||
public static string CalcTotalHoursFromTimes = "(()=>{const toD=v=>!v?null:(v instanceof Date?v:new Date(v));const next={...formData,[e.dataField]:e.value};const s=toD(next.StartTime),t=toD(next.EndTime);let h=null;if(s&&t){h=(t-s)/36e5;if(h<0)h+=24;h=Math.round(h*10)/10;}setFormData({...next,TotalHours:h});})();";
|
public static string CalcTotalHoursFromTimes = "(()=>{const toD=v=>!v?null:(v instanceof Date?v:new Date(v));const next={...formData,[e.dataField]:e.value};const s=toD(next.StartTime),t=toD(next.EndTime);let h=null;if(s&&t){h=(t-s)/36e5;if(h<0)h+=24;h=Math.round(h*10)/10;}setFormData({...next,TotalHours:h});})();";
|
||||||
|
public static string MaterialOnChange = "(() => { const p = e.component.option('selectedItem'); setFormData({ ...formData, Quantity: p.Quantity, UnitPrice: p.UnitPrice, UomId: p.UomId } ) })();";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Prefix
|
public static class Prefix
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,8 @@ const useListFormColumns = ({
|
||||||
key: a.Key,
|
key: a.Key,
|
||||||
name: a.Name,
|
name: a.Name,
|
||||||
group: a.Group,
|
group: a.Group,
|
||||||
|
|
||||||
|
...a
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
@ -276,6 +278,8 @@ const useListFormColumns = ({
|
||||||
key: eval(keySelector),
|
key: eval(keySelector),
|
||||||
name: eval(nameSelector),
|
name: eval(nameSelector),
|
||||||
group: eval(groupSelector),
|
group: eval(groupSelector),
|
||||||
|
|
||||||
|
...a,
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue