Skip to content

Commit

Permalink
Merge pull request #890 from devgateway/develop-elgeyo
Browse files Browse the repository at this point in the history
Develop into master before 2.0.8
  • Loading branch information
mpostelnicu authored Apr 8, 2021
2 parents d387cbe + e4ddd7f commit a4a398f
Show file tree
Hide file tree
Showing 265 changed files with 61,898 additions and 16,848 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
 - 
<a href="https://github.com/devgateway/forms-makueni/blob/master/LICENSE"><wicket:message key="license"/></a>
&nbsp;-&nbsp;
<a href="/publication-policy.txt"><wicket:message key="publicationPolicy" /></a>
<a href="/ui/index.html#!/publication-policy"><wicket:message key="publicationPolicy" /></a>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<form wicket:id="editForm" role="form" class="edit-form">
<wicket:child/>

<div class="row">
<div class="row bottom-form-btns">
<div class="col-md-10">
<button wicket:id="save" type="button" class="btn btn-green">[[SAVE]]</button>
<button wicket:id="delete" type="button" class="btn btn-delete">[[DELETE]]</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ protected void onInitialize() {
email.required()
.getField().add(RfcCompliantEmailAddressValidator.getInstance());

if (editForm.getModelObject().getPurchaseReq() != null) {
if (editForm.getModelObject().getPurchaseReq() != null
&& editForm.getModelObject().getPurchaseReq().getTender().stream().findFirst().isPresent()) {
final TenderProcess purchaseReq = editForm.getModelObject().getPurchaseReq();
final Tender tender = purchaseReq.getTender().stream().findFirst().get();

editForm.add(new GenericSleepFormComponent("purchaseReq", new Model(tender.getTenderTitle())));
editForm.add(new GenericSleepFormComponent<>("purchaseReq", new Model<>(tender.getTenderTitle())));
} else {
editForm.add(new GenericSleepFormComponent("purchaseReq",
editForm.add(new GenericSleepFormComponent<>("purchaseReq",
new StringResourceModel("noTenderSelected", this)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ public abstract class AbstractCategoryEditPage<T extends Category> extends Abstr
public AbstractCategoryEditPage(final PageParameters parameters) {
super(parameters);
}

protected void addCreateLabel() {
label = ComponentUtil.addTextField(editForm, "label");
label.required();
label.getField().add(VALIDATOR);
}

@Override
protected void onInitialize() {
super.onInitialize();

label = ComponentUtil.addTextField(editForm, "label");
label.required();
label.getField().add(VALIDATOR);
addCreateLabel();
addUniqueNameValidator();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<div wicket:id="code" class="col-md-6"></div>
<div wicket:id="targetGroups" class="col-md-6"></div>
<div wicket:id="agpoRegistrationId" class="col-md-6"></div>
<div class="col-md-12">
<div wicket:id="nonPerforming"></div>
</div>
<div class="col-md-12">
<div wicket:id="contacts" class="form-group"></div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
package org.devgateway.toolkit.forms.wicket.page.edit.category;

import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.model.LambdaModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.devgateway.toolkit.forms.WebConstants;
import org.devgateway.toolkit.forms.wicket.behaviors.CountyAjaxFormComponentUpdatingBehavior;
import org.devgateway.toolkit.forms.wicket.components.form.Select2MultiChoiceBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.components.form.TextAreaFieldBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.components.form.TextFieldBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil;
import org.devgateway.toolkit.forms.wicket.page.lists.category.ListSupplierPage;
import org.devgateway.toolkit.persistence.dao.categories.Subcounty;
Expand Down Expand Up @@ -48,6 +51,15 @@ public EditSupplierPage(final PageParameters parameters) {
listPageClass = ListSupplierPage.class;
}

@Override
protected void addCreateLabel() {
label = new TextFieldBootstrapFormComponent<>("label", LambdaModel.of(editForm.getModel(),
Supplier::getRealLabel, Supplier::setRealLabel));
label.required();
label.getField().add(VALIDATOR);
editForm.add(label);
}

@Override
protected void onInitialize() {
editForm.attachFm("supplierForm");
Expand All @@ -67,6 +79,8 @@ protected void onInitialize() {
Select2MultiChoiceBootstrapFormComponent<Ward> wards;
wards = ComponentUtil.addSelect2MultiChoiceField(editForm, "wards", wardService);

ComponentUtil.addYesNoToggle(editForm, "nonPerforming");

Select2MultiChoiceBootstrapFormComponent<Subcounty> subcounties;
subcounties = ComponentUtil.addSelect2MultiChoiceField(editForm, "subcounties", subcountyService);
subcounties.getField()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ subcounties.label=Subcounties
wards.label=Wards
agpoRegistrationId.label=AGPO Registration ID
contacts.label=Contacts
nonPerforming.label=This supplier is non-performing
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil;
import org.devgateway.toolkit.forms.wicket.page.edit.roleassignable.TechAdminRoleAssignable;
import org.devgateway.toolkit.persistence.dao.form.AdministratorReport;
import org.devgateway.toolkit.persistence.dao.form.TenderProcess;
import org.devgateway.toolkit.persistence.service.form.AdministratorReportService;
import org.devgateway.toolkit.persistence.service.form.TenderProcessService;
import org.devgateway.toolkit.web.security.SecurityConstants;
Expand Down Expand Up @@ -50,23 +49,4 @@ protected void onInitialize() {
ComponentUtil.addYesNoToggle(editForm, "authorizePayment", true);
ComponentUtil.addDateField(editForm, "approvedDate");
}

@Override
protected void beforeSaveEntity(final AdministratorReport report) {
super.beforeSaveEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.addAdministratorReport(report);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final AdministratorReport report) {
super.beforeDeleteEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.removeAdministratorReport(report);
tenderProcessService.save(tenderProcess);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.devgateway.toolkit.forms.wicket.page.edit.roleassignable.ProcurementRoleAssignable;
import org.devgateway.toolkit.persistence.dao.categories.Supplier;
import org.devgateway.toolkit.persistence.dao.form.AwardAcceptance;
import org.devgateway.toolkit.persistence.dao.form.TenderProcess;
import org.devgateway.toolkit.persistence.service.form.AwardAcceptanceService;
import org.devgateway.toolkit.persistence.service.form.TenderProcessService;
import org.devgateway.toolkit.persistence.spring.PersistenceUtil;
Expand Down Expand Up @@ -61,24 +60,6 @@ protected AwardAcceptance newInstance() {
return awardAcceptance;
}

@Override
protected void beforeSaveEntity(final AwardAcceptance awardAcceptance) {
super.beforeSaveEntity(awardAcceptance);

final TenderProcess tenderProcess = awardAcceptance.getTenderProcess();
tenderProcess.addAwardAcceptance(awardAcceptance);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final AwardAcceptance awardAcceptance) {
super.beforeDeleteEntity(awardAcceptance);

final TenderProcess tenderProcess = awardAcceptance.getTenderProcess();
tenderProcess.removeAwardAcceptance(awardAcceptance);
tenderProcessService.save(tenderProcess);
}

@Override
protected PageParameters parametersAfterSubmitAndNext() {
final PageParameters pp = new PageParameters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.devgateway.toolkit.forms.WebConstants;
import org.devgateway.toolkit.forms.wicket.page.edit.panel.AwardNotificationItemPanel;
import org.devgateway.toolkit.forms.wicket.page.edit.roleassignable.ProcurementRoleAssignable;
import org.devgateway.toolkit.persistence.dao.form.AwardNotification;
import org.devgateway.toolkit.persistence.dao.form.TenderProcess;
import org.devgateway.toolkit.persistence.service.form.AwardNotificationService;
import org.devgateway.toolkit.persistence.service.form.TenderProcessService;
import org.devgateway.toolkit.persistence.spring.PersistenceUtil;
import org.devgateway.toolkit.web.security.SecurityConstants;
import org.springframework.util.ObjectUtils;
import org.wicketstuff.annotation.mount.MountPath;

/**
Expand Down Expand Up @@ -54,23 +50,4 @@ protected AwardNotification newInstance() {

return awardNotification;
}

@Override
protected void beforeSaveEntity(final AwardNotification awardNotification) {
super.beforeSaveEntity(awardNotification);

final TenderProcess tenderProcess = awardNotification.getTenderProcess();
tenderProcess.addAwardNotification(awardNotification);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final AwardNotification awardNotification) {
super.beforeDeleteEntity(awardNotification);

final TenderProcess tenderProcess = awardNotification.getTenderProcess();
tenderProcess.removeAwardNotification(awardNotification);
tenderProcessService.save(tenderProcess);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,6 @@ protected Contract newInstance() {
return contract;
}

@Override
protected void beforeSaveEntity(final Contract contract) {
super.beforeSaveEntity(contract);

final TenderProcess tenderProcess = contract.getTenderProcess();
tenderProcess.addContract(contract);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final Contract contract) {
super.beforeDeleteEntity(contract);

final TenderProcess tenderProcess = contract.getTenderProcess();
tenderProcess.removeContract(contract);
tenderProcessService.save(tenderProcess);
}

public static List<Supplier> getAcceptedSupplier(TenderProcess tenderProcess) {
if (tenderProcess.getSingleAwardAcceptance() != null) {
return tenderProcess.getSingleAwardAcceptance().getItems()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import org.devgateway.toolkit.forms.wicket.page.edit.roleassignable.TechAdminRoleAssignable;
import org.devgateway.toolkit.forms.wicket.providers.GenericPersistableJpaTextChoiceProvider;
import org.devgateway.toolkit.persistence.dao.form.InspectionReport;
import org.devgateway.toolkit.persistence.dao.form.TenderProcess;
import org.devgateway.toolkit.persistence.repository.category.InspectionReportOutcomeRepository;
import org.devgateway.toolkit.persistence.service.category.InspectionReportOutcomeService;
import org.devgateway.toolkit.persistence.service.form.InspectionReportService;
import org.devgateway.toolkit.persistence.service.form.TenderProcessService;
Expand Down Expand Up @@ -76,23 +74,4 @@ protected void onInitialize() {

editForm.add(new FileInputBootstrapFormComponent("picture"));
}

@Override
protected void beforeSaveEntity(final InspectionReport report) {
super.beforeSaveEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.addInspectionReport(report);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final InspectionReport report) {
super.beforeDeleteEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.removeInspectonReport(report);
tenderProcessService.save(tenderProcess);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.devgateway.toolkit.persistence.dao.categories.Subcounty;
import org.devgateway.toolkit.persistence.dao.categories.Ward;
import org.devgateway.toolkit.persistence.dao.form.MEReport;
import org.devgateway.toolkit.persistence.dao.form.TenderProcess;
import org.devgateway.toolkit.persistence.service.category.MEStatusService;
import org.devgateway.toolkit.persistence.service.category.SubWardService;
import org.devgateway.toolkit.persistence.service.category.SubcountyService;
Expand Down Expand Up @@ -128,24 +127,6 @@ protected void onUpdate(AjaxRequestTarget target) {
});
}

@Override
protected void beforeSaveEntity(final MEReport report) {
super.beforeSaveEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.addMEReport(report);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final MEReport report) {
super.beforeDeleteEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.removeMEReport(report);
tenderProcessService.save(tenderProcess);
}

@Override
protected void onApproved() {
super.onApproved();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.devgateway.toolkit.persistence.dao.categories.Subcounty;
import org.devgateway.toolkit.persistence.dao.categories.Ward;
import org.devgateway.toolkit.persistence.dao.form.PMCReport;
import org.devgateway.toolkit.persistence.dao.form.TenderProcess;
import org.devgateway.toolkit.persistence.service.category.PMCStatusService;
import org.devgateway.toolkit.persistence.service.category.ProjectClosureHandoverService;
import org.devgateway.toolkit.persistence.service.category.SubcountyService;
Expand Down Expand Up @@ -167,24 +166,6 @@ protected void onBeforeSaveApprove(AjaxRequestTarget target) {
editForm.getModelObject().setRejected(false);
}

@Override
protected void beforeSaveEntity(final PMCReport report) {
super.beforeSaveEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.addPMCReport(report);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final PMCReport report) {
super.beforeDeleteEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.removePMCReport(report);
tenderProcessService.save(tenderProcess);
}

@Override
protected void onApproved() {
super.onApproved();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.devgateway.toolkit.persistence.dao.DBConstants;
import org.devgateway.toolkit.persistence.dao.form.AbstractImplTenderProcessMakueniEntity;
import org.devgateway.toolkit.persistence.dao.form.PaymentVoucher;
import org.devgateway.toolkit.persistence.dao.form.TenderProcess;
import org.devgateway.toolkit.persistence.service.form.AbstractMakueniEntityService;
import org.devgateway.toolkit.persistence.service.form.AdministratorReportService;
import org.devgateway.toolkit.persistence.service.form.InspectionReportService;
Expand Down Expand Up @@ -109,23 +108,4 @@ protected void setButtonsPermissions() {
&& x.getContract().equals(editForm.getModelObject().getTenderProcess().getSingleContract())))
.collect(Collectors.toList()));
}

@Override
protected void beforeSaveEntity(final PaymentVoucher report) {
super.beforeSaveEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.addPaymentVoucher(report);
tenderProcessService.save(tenderProcess);
}

@Override
protected void beforeDeleteEntity(final PaymentVoucher report) {
super.beforeDeleteEntity(report);

final TenderProcess tenderProcess = report.getTenderProcess();
tenderProcess.removePaymentVoucher(report);
tenderProcessService.save(tenderProcess);
}

}
Loading

0 comments on commit a4a398f

Please sign in to comment.