Skip to content

Commit

Permalink
Theme:: Perbaikan tampilan dan responsibilitas
Browse files Browse the repository at this point in the history
  • Loading branch information
bachtiarpanjaitan committed Sep 27, 2024
1 parent fcdadab commit 96a1f29
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 136 deletions.
8 changes: 8 additions & 0 deletions Bepe/Components/FilterOne.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public static class FilterOne
VerticalOptions = LayoutOptions.Center,
Text = "Tambah",
WidthRequest = 100,
ImageSource = new FontImageSource()
{
Glyph = "\uE145", //
FontFamily = "MaterialIcons",
Size = 15,
Color = Colors.DarkOrange
},
ContentLayout = new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left, 10),
Margin = new Thickness(5, 0)
};
private static readonly Label ModuleLabel = new()
Expand Down
34 changes: 27 additions & 7 deletions Bepe/Components/SideMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,44 @@ public VerticalStackLayout CreateSideMenu()
{
foreach (var mi in menuItems)
{
menuLayout.Add(ItemMenu(mi.Value.Label, mi.Value.Page));
menuLayout.Add(ItemMenu(mi.Value));
}
}
return menuLayout;
}

private Button ItemMenu(string text, string page)
private HorizontalStackLayout ItemMenu(MenuItemPage item)
{
var icon = new Image()
{
Source = new FontImageSource()
{
Glyph = item.Icon, //
FontFamily = "MaterialIcons",
Size = 20,
Color = Colors.DarkOrange
},
HorizontalOptions = LayoutOptions.Start
};
var button = new Button
{
Text = text,
CornerRadius = 5,
Margin = 5
Text = item.Label,
FontAttributes = FontAttributes.Bold,
Margin = 5,
BorderColor = Colors.Transparent,
};

button.Clicked += (s, e) => OnCLickItem(s, e, page);
button.Clicked += (s, e) => OnCLickItem(s, e, item.Page);

return button;
return new HorizontalStackLayout()
{
Children =
{
icon,
button
},
Margin = new Thickness(10,0)
};
}

private async void OnCLickItem(object sender, EventArgs e, string page)
Expand Down
6 changes: 0 additions & 6 deletions Bepe/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ public void OnClickSideMenuItemAsync(object obj, EventHandlerPageArgs e)
}

}

public void ClearEvent()
{
sm.ItemTapped -= OnClickSideMenuItemAsync;
_contentView = null;
}
}
}

4 changes: 2 additions & 2 deletions Bepe/Types/MenuItemPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ public class MenuItemPage
{
public string Label { get; set; }
public string Page { get; set; }
public string name { get; set; }
public string icon { get; set; }
public string Name { get; set; }
public string Icon { get; set; }
public MenuItemPage()
{

Expand Down
3 changes: 0 additions & 3 deletions IhandCashier.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Resources\Images\document.png" />
</ItemGroup>
<ItemGroup>
<MauiPlatformSpecificFolder Remove="Platforms\Android\" />
<MauiPlatformSpecificFolder Remove="Platforms\iOS\" />
Expand Down
18 changes: 18 additions & 0 deletions Layouts/MainLayout.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ public MainLayout()
DatagridProvider.DataGrid.RowHeight = 35;
DatagridProvider.DataGrid.DefaultStyle = Helper.SetDataGridStyle();
DatagridProvider.DataGrid.SelectionMode = DataGridSelectionMode.SingleDeselect;
DatagridProvider.PrevButton.ImageSource = new FontImageSource()
{
Glyph = "\ueaa7",
FontFamily = "MaterialIcons",
Size = 20,
Color = Colors.DarkOrange
};
DatagridProvider.NextButton.ImageSource = new FontImageSource()
{
Glyph = "\ueaaa", //
FontFamily = "MaterialIcons",
Size = 20,
Color = Colors.DarkOrange,
};
DatagridProvider.PrevButton.ContentLayout =
new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left, 10);
DatagridProvider.NextButton.ContentLayout =
new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 10);
Container.Content = new PageHome();

}
Expand Down
1 change: 1 addition & 0 deletions MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static MauiApp CreateMauiApp()
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("MaterialIcons-Regular.ttf", "MaterialIcons");
});
builder.Services.AddAppServices();

Expand Down
16 changes: 5 additions & 11 deletions Pages/PageDataBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ public partial class PageDataBarang : PageController
public PageDataBarang()
{
InitializeComponent();
SideMenus.Add("barang", new MenuItemPage { Label = "BARANG", Page = typeof(GridDataBarang).FullName });
SideMenus.Add("harga_pembelian", new MenuItemPage { Label = "HARGA PEMBELIAN", Page = typeof(GridDataHargaBarang).FullName });
SideMenus.Add("satuan", new MenuItemPage { Label = "SATUAN", Page = typeof(GridDataSatuanBarang).FullName });
SideMenus.Add("basic_satuan", new MenuItemPage { Label = "SATUAN DASAR", Page = typeof(GridDataSatuanDasarBarang).FullName });
SideMenus.Add("barang", new MenuItemPage { Label = "BARANG", Page = typeof(GridDataBarang).FullName, Icon = "\uE8EF"});
SideMenus.Add("harga_pembelian", new MenuItemPage { Label = "HARGA PEMBELIAN", Page = typeof(GridDataHargaBarang).FullName, Icon = "\uf05b"});
SideMenus.Add("satuan", new MenuItemPage { Label = "SATUAN", Page = typeof(GridDataSatuanBarang).FullName, Icon = "\uE268"});
SideMenus.Add("basic_satuan", new MenuItemPage { Label = "SATUAN DASAR", Page = typeof(GridDataSatuanDasarBarang).FullName, Icon = "\uE3F2"});
DefineLayoutTwoColumn();
Unloaded += OnUnloaded;
}

private void OnUnloaded(object sender, EventArgs e)
{
ClearEvent();
}
}
}
6 changes: 3 additions & 3 deletions Pages/PageDataPengguna.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public PageDataPengguna()
{
InitializeComponent();

SideMenus.Add("kasir", new MenuItemPage { Label = "DATA KASIR", Page = typeof(GridDataKasir).FullName });
SideMenus.Add("pemasok", new MenuItemPage { Label = "DATA PEMASOK", Page = typeof(GridDataPemasok).FullName });
SideMenus.Add("pelanggan", new MenuItemPage { Label = "DATA PELANGGAN", Page = typeof(GridDataPelanggan).FullName });
SideMenus.Add("kasir", new MenuItemPage { Label = "DATA KASIR", Page = typeof(GridDataKasir).FullName, Icon = "\ueF3D"});
SideMenus.Add("pemasok", new MenuItemPage { Label = "DATA PEMASOK", Page = typeof(GridDataPemasok).FullName, Icon = "\uF8D9"});
SideMenus.Add("pelanggan", new MenuItemPage { Label = "DATA PELANGGAN", Page = typeof(GridDataPelanggan).FullName, Icon = "\uF8D7"});

DefineLayoutTwoColumn();
}
Expand Down
2 changes: 1 addition & 1 deletion Pages/PagePenerimaanBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class PagePenerimaanBarang : PageController
public PagePenerimaanBarang()
{
InitializeComponent();
SideMenus.Add("penerimaan_barang", new MenuItemPage { Label = "PENERIMAAN", Page = typeof(GridPenerimaanBarang).FullName });
SideMenus.Add("penerimaan_barang", new MenuItemPage { Label = "PENERIMAAN", Page = typeof(GridPenerimaanBarang).FullName, Icon = "\uE558"});
DefineLayoutTwoColumn();
}
}
2 changes: 1 addition & 1 deletion Pages/PagePenjualanBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class PagePenjualanBarang
public PagePenjualanBarang()
{
InitializeComponent();
SideMenus.Add("penjualan_barang", new MenuItemPage { Label = "PENJUALAN", Page = typeof(GridPenjualanBarang).FullName });
SideMenus.Add("penjualan_barang", new MenuItemPage { Label = "PENJUALAN", Page = typeof(GridPenjualanBarang).FullName, Icon = "\uf17e"});
DefineLayoutTwoColumn();
}
}
4 changes: 2 additions & 2 deletions Pages/PageReturnBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public partial class PageReturnBarang
public PageReturnBarang()
{
InitializeComponent();
SideMenus.Add("return_beli", new MenuItemPage { Label = "RETURN BELI", Page = typeof(GridReturnBeli).FullName });
SideMenus.Add("return_jual", new MenuItemPage { Label = "RETURN JUAL", Page = typeof(GridReturnJual).FullName });
SideMenus.Add("return_beli", new MenuItemPage { Label = "RETURN BELI", Page = typeof(GridReturnBeli).FullName, Icon = "\ue889"});
SideMenus.Add("return_jual", new MenuItemPage { Label = "RETURN JUAL", Page = typeof(GridReturnJual).FullName, Icon = "\ue923"});

DefineLayoutTwoColumn();
}
Expand Down
4 changes: 2 additions & 2 deletions Pages/PageSetting.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public PageSetting()
{
InitializeComponent();

SideMenus.Add("setting_aplikasi", new MenuItemPage { Label = "APLIKASI", Page = typeof(SettingApplication).FullName });
SideMenus.Add("setting_hak_akses", new MenuItemPage { Label = "HAK AKSES", Page = typeof(SettingAcl).FullName });
SideMenus.Add("setting_aplikasi", new MenuItemPage { Label = "APLIKASI", Page = typeof(SettingApplication).FullName, Icon = "\ue1b1"});
SideMenus.Add("setting_hak_akses", new MenuItemPage { Label = "HAK AKSES", Page = typeof(SettingAcl).FullName, Icon = "\ue32a"});

DefineLayoutTwoColumn();
}
Expand Down
4 changes: 2 additions & 2 deletions Pages/PageStokBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public partial class PageStokBarang
public PageStokBarang()
{
InitializeComponent();
SideMenus.Add("stok_barang", new MenuItemPage { Label = "STOK", Page = typeof(GridStokBarang).FullName });
SideMenus.Add("stok_penyesuaian_barang", new MenuItemPage { Label = "PENYESUAIAN", Page = typeof(GridPenyesuaianBarang).FullName });
SideMenus.Add("stok_barang", new MenuItemPage { Label = "STOK", Page = typeof(GridStokBarang).FullName, Icon = "\uebb8"});
SideMenus.Add("stok_penyesuaian_barang", new MenuItemPage { Label = "PENYESUAIAN", Page = typeof(GridPenyesuaianBarang).FullName, Icon = "\ue3ca"});

DefineLayoutTwoColumn();
}
Expand Down
40 changes: 40 additions & 0 deletions Pages/Views/BaseView.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,51 @@
using IhandCashier.Bepe.Types;
using IhandCashier.Core.Maui.Providers;

namespace IhandCashier.Pages.Views;

public class BaseView : ContentView
{
private static EventHandler _RefreshlickedHandlerRef;
private static EventHandler _EditClickedHandlerRef;
private static EventHandler _DeleteClickedHandlerRef;

public static MenuFlyoutItem RefreshMenu = new() { Text = "Refresh Data"};
public static MenuFlyoutItem EditMenu = new() { Text = "Ubah Data"};
public static MenuFlyoutItem DeleteMenu = new() { Text = "Hapus Data"};
public void ResetView()
{
DatagridProvider.Reset();
DatagridProvider.DataGrid.BindingContext = null;
}

public void SetContextMenuHandler(MenuFlyout ContextMenu, ContextMenuHandlers handler)
{
if (_RefreshlickedHandlerRef != null)RefreshMenu.Clicked -= _RefreshlickedHandlerRef;
if (_EditClickedHandlerRef != null) EditMenu.Clicked -= _EditClickedHandlerRef;
if (_DeleteClickedHandlerRef != null) DeleteMenu.Clicked -= _DeleteClickedHandlerRef;

if(handler.RefreshHandler != null) ContextMenu.Add(RefreshMenu);
if(handler.EditHandler != null) ContextMenu.Add(EditMenu);
if (handler.DeleteHandler != null)
{
ContextMenu.Add(new MenuFlyoutSeparator());
ContextMenu.Add(DeleteMenu);
}


_RefreshlickedHandlerRef = handler.RefreshHandler;
_EditClickedHandlerRef = handler.EditHandler;
_DeleteClickedHandlerRef = handler.DeleteHandler;

RefreshMenu.Clicked += _RefreshlickedHandlerRef;
EditMenu.Clicked += _EditClickedHandlerRef;
DeleteMenu.Clicked += _DeleteClickedHandlerRef;
}
}

public class ContextMenuHandlers
{
public EventHandler? RefreshHandler { get; set; }
public EventHandler? EditHandler { get; set; }
public EventHandler? DeleteHandler { get; set; }
}
28 changes: 7 additions & 21 deletions Pages/Views/GridDataBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ public GridDataBarang()
InitializeComponent();
FilterOne.Initialize(ModuleName);
ResetView();
CreateContextMenu();
DatagridProvider.DataGrid.Columns.Clear();
SetContextMenuHandler(ContextMenu,new ContextMenuHandlers
{
DeleteHandler = OnDeleteClicked,
EditHandler = OnEditClicked,
RefreshHandler = OnRefreshClicked
});
List<ColumnType> columns = [
new () { Type = ColumnTypes.Numeric,MappingName = "id", TextAlignment = TextAlignment.Center,ColumnMode = ColumnWidthMode.FitByCell ,HeaderText = "ID", Format = "N0" },
new() { Type = ColumnTypes.Text, MappingName = "kode", HeaderText = "KODE" },
new() { Type = ColumnTypes.Text, MappingName = "nama", HeaderText = "NAMA BARANG"},
new() { Type = ColumnTypes.Image, MappingImage = "resourceGambar" ,MappingName = "resourceGambarThumbnail", Width = 110, HeaderText = "GAMBAR", ImageHeight = 50, ImageWidth = 50}
];
foreach (var c in columns.Select(col => col.Create()))
{
DatagridProvider.DataGrid.Columns.Add(c);
};
foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);;
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down Expand Up @@ -86,21 +87,6 @@ private void OnEditClicked(object sender, EventArgs e)
}
}

private void CreateContextMenu()
{
MenuFlyoutItem refreshMenu = new() { Text = "Refresh Data"};
MenuFlyoutItem editMenu = new() { Text = "Ubah Data"};
MenuFlyoutItem deleteMenu = new() { Text = "Hapus Data"};
editMenu.Clicked += OnEditClicked;
deleteMenu.Clicked += OnDeleteClicked;
refreshMenu.Clicked += OnRefreshClicked;
ContextMenu.Add(refreshMenu);
ContextMenu.Add(editMenu);
ContextMenu.Add(new MenuFlyoutSeparator());
ContextMenu.Add(deleteMenu);

}

private void OnRefreshClicked(object sender, EventArgs e)
{
_pagination.RefreshData();
Expand Down
21 changes: 6 additions & 15 deletions Pages/Views/GridDataHargaBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ public GridDataHargaBarang()
{
InitializeComponent();
FilterOne.Initialize(ModuleName);
CreateContextMenu();
ResetView();
SetContextMenuHandler(ContextMenu,new ContextMenuHandlers
{
DeleteHandler = OnDeleteClicked,
EditHandler = OnEditClicked,
RefreshHandler = OnRefreshClicked
});
List<ColumnType> columns = [
new() { Type = ColumnTypes.Numeric,MappingName = "id", TextAlignment = TextAlignment.Center,ColumnMode = ColumnWidthMode.FitByCell ,HeaderText = "ID", Format = "N0" },
new() { Type = ColumnTypes.Text, MappingName = "kode", HeaderText = "KODE",ColumnMode = ColumnWidthMode.FitByCell },
Expand All @@ -51,20 +56,6 @@ public GridDataHargaBarang()
});
}

private void CreateContextMenu()
{
MenuFlyoutItem refreshMenu = new() { Text = "Refresh Data"};
MenuFlyoutItem editMenu = new() { Text = "Ubah Data"};
MenuFlyoutItem deleteMenu = new() { Text = "Hapus Data"};
editMenu.Clicked += OnEditClicked;
deleteMenu.Clicked += OnDeleteClicked;
refreshMenu.Clicked += OnRefreshClicked;
ContextMenu.Add(refreshMenu);
ContextMenu.Add(editMenu);
ContextMenu.Add(new MenuFlyoutSeparator());
ContextMenu.Add(deleteMenu);
}

private void OnClick(object sender, DataGridCellTappedEventArgs e)
{
_selectedProduct = e.RowData as ProductPriceDto;
Expand Down
1 change: 0 additions & 1 deletion Pages/Views/GridDataKasir.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public GridDataKasir()
InitializeComponent();

FilterOne.Initialize(ModuleName);

ResetView();
List<ColumnType> columns = [
new ColumnType { Type = ColumnTypes.Numeric,TextAlignment = TextAlignment.Center,MappingName = "id", ColumnMode = ColumnWidthMode.FitByCell ,HeaderText = "ID", Format = "N0" },
Expand Down
Loading

0 comments on commit 96a1f29

Please sign in to comment.