Skip to content

Commit

Permalink
feat(crud): Fixing creation, update and delte, update e2e test and tr…
Browse files Browse the repository at this point in the history
…anslation
  • Loading branch information
DedrickEnc committed Oct 10, 2017
1 parent 1b22336 commit b4c524f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
23 changes: 12 additions & 11 deletions client/src/i18n/en/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"DATE_FROM": "Start",
"DATE_REGISTRATION": "Registration Date",
"DATE_TO": "End",
"DAYS" : "Days",
"DAYS": "Days",
"DEACTIVATE": "Deactivate",
"DEBIT": "Debit",
"DEBTOR_GROUP": "Debtor Group",
Expand Down Expand Up @@ -362,11 +362,11 @@
"NOTES": "Note(s)",
"NO_DISTRIBUTABLE": "Not distributable",
"OF": "Of",
"OPENING_BALANCE" : "Opening Balance",
"FINAL_BALANCE" : "Final Balance",
"INTERMEDIATE_BALANCE" : "Intermediate Balance",
"OPENING_BALANCE": "Opening Balance",
"FINAL_BALANCE": "Final Balance",
"INTERMEDIATE_BALANCE": "Intermediate Balance",
"OPTIONAL_INFO": "Optional Information",
"ORIGIN":"Origin",
"ORIGIN": "Origin",
"ORIGIN_LOCATION": "Location of Origin",
"ORIGIN_VILLAGE": "Village of Origin",
"ORIGIN_SECTOR": "Sector of Origin",
Expand Down Expand Up @@ -427,7 +427,7 @@
"SERVICE": "Service",
"SET_DATE": "Change Date",
"SEX": "Sex",
"SHOW_SIMPLE_PREVIEW" : "Show Simple Preview",
"SHOW_SIMPLE_PREVIEW": "Show Simple Preview",
"SIGNATURE": "Signature",
"SIZE_BYTES": "Bytes",
"SIZE_KB": "Kb",
Expand Down Expand Up @@ -525,12 +525,13 @@
"PROJECT_NAME": "the project name"
},
"PLACEHOLDERS": {
"ABBREVIATION": "Abbreviation",
"ACCOUNT": "Enter an account",
"CASHBOX": "Enter the cashbox",
"CODE": "Enter code",
"COUNTRY": "Enter country",
"CREDITOR": "Enter creditor",
"DATE" : "Enter a Date",
"DATE": "Enter a Date",
"DEBTOR": "Enter debtor",
"DEBTOR_GROUP": "Enter a Debtor Group",
"DESCRIPTION": "Enter description",
Expand Down Expand Up @@ -571,7 +572,7 @@
"CREDITOR_GROUP": "Select a Creditor Group",
"DATE_INTERVAL": "Select a date interval",
"DEBTOR_GROUP": "Select a Debtor Group",
"DEPOT":"Select a Depot",
"DEPOT": "Select a Depot",
"ENTERPRISE": "Select an Enterprise",
"FISCAL_YEAR": "Select a Fiscal Year",
"FUNCTION": "Select function",
Expand All @@ -598,7 +599,7 @@
"SERVICE": "Select a Service",
"SEX": "Select a Sex",
"SOURCE": "Select source",
"SUPPLIER" : "Supplier",
"SUPPLIER": "Supplier",
"TRANSACTION_TYPE": "Select a transaction type",
"TRANSFER_TYPE": "Select a Transfer type",
"TYPE": "Select a Type",
Expand Down Expand Up @@ -634,7 +635,7 @@
"NOT_AUTHORISED": "The requested page is not authorised",
"NOT_FOUND": "Not found",
"PAGE_NOT_FOUND": "The page you requested could not be found",
"NO_CHANGES" : "You haven't changed any form values. Nothing will be submitted to the server."
"NO_CHANGES": "You haven't changed any form values. Nothing will be submitted to the server."
}
}
}
}
1 change: 1 addition & 0 deletions client/src/i18n/fr/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@
"PROJECT_NAME": "le nom du projet"
},
"PLACEHOLDERS": {
"ABBREVIATION": "Abbreviation",
"ACCOUNT": "Entrer le compte",
"CASHBOX": "Entrer la caisse",
"CODE": "Entrer le code",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function InventoryUnitActionsModalController(InventoryUnit, Notify, Instance, Da
/** format data to data structure in the db */
function cleanForSubmit(session) {
return {
abbr : session.abbr,
text : session.text
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>

<div class="form-group"
ng-class="{ 'has-error' : ActionForm.$submitted && ActionForm.abbreviation.$invalid }">
<label class="control-label">{{ 'FORM.LABELS.ABBREVIATION' | translate }}</label>
<input
ng-model="$ctrl.session.abbr"
class="form-control"
type="text"
name="abbreviation"
placeholder="{{ 'FORM.PLACEHOLDERS.ABBREVIATION' | translate }}..."
required>
<div class="help-block" ng-messages="ActionForm.abbreviation.$error" ng-show="ActionForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
</div>
</div>

<div class="modal-footer">
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/inventory/inventory/units.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function create(record) {
* return a promise which can contains result or error which is caught
* in the main controller (inventory.js)
*/
return db.exec(sql, [record.text])
return db.exec(sql, [record.abbr, record.text])
.then(row => row.insertId);
}

Expand Down
7 changes: 4 additions & 3 deletions test/end-to-end/inventory/configuration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Inventory Configuration', () => {
const updateType = { text : '[E2E] Inventory Type updated' };

// inventory unit
const unit = { text : '[E2E] Inventory Unit' };
const unit = { text : '[E2E] Inventory Unit', abbr : 'IUE2E' };
const updateUnit = { text : '[E2E] Inventory Unit updated' };

describe('Groups', () => {
Expand Down Expand Up @@ -108,19 +108,20 @@ describe('Inventory Configuration', () => {
it('Successfully creates a new inventory unit', () => {
element(by.css('[data-create-unit]')).click();
FU.input('$ctrl.session.text', unit.text);
FU.input('$ctrl.session.abbr', unit.abbr);
FU.buttons.submit();
components.notification.hasSuccess();
});

it('Successfully updates an existing inventory unit', () => {
element(by.css('[data-edit-unit="' + unit.text +'"]')).click();
element(by.css('[data-edit-unit="' + unit.abbr +'"]')).click();
FU.input('$ctrl.session.text', updateUnit.text);
FU.buttons.submit();
components.notification.hasSuccess();
});

it('Successfully deletes an existing inventory unit', () => {
element(by.css('[data-delete-unit="' + updateUnit.text +'"]')).click();
element(by.css('[data-delete-unit="' + updateUnit.abbr +'"]')).click();
FU.buttons.submit();
components.notification.hasSuccess();
});
Expand Down

0 comments on commit b4c524f

Please sign in to comment.